Skip to content

Commit 045f065

Browse files
author
Release Manager
committed
sagemathgh-37762: `dist.yml`: Download optional/experimental tarballs for GitHub Release assets <!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes sagemath#12345". --> - Fixes sagemath#37752, at least for the non-"huge" tarballs (we skip the "huge" tarballs here). - More options for `sage -package download` (a subset of what `sage -package list` supports) - Also remove some zombie package files Test run: https://github.com/mkoeppe/sage/actions/workflows/dist.yml ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [ ] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation accordingly. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> - Depends on sagemath#37099 (merged to resolve merge conflict) URL: sagemath#37762 Reported by: Matthias Köppe Reviewer(s): Kwankyu Lee, Matthias Köppe
2 parents 7ace60e + a055882 commit 045f065

File tree

14 files changed

+87
-56
lines changed

14 files changed

+87
-56
lines changed

.github/workflows/dist.yml

+23-2
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,37 @@ jobs:
3737
sudo DEBIAN_FRONTEND=noninteractive apt-get update
3838
sudo DEBIAN_FRONTEND=noninteractive apt-get install $(build/bin/sage-get-system-packages debian _bootstrap)
3939
- name: make dist (--disable-download-from-upstream-url)
40+
id: make_dist
4041
run: |
4142
./bootstrap -D && ./configure --disable-download-from-upstream-url && make dist
4243
env:
4344
MAKE: make -j8
45+
- name: make download (--disable-download-from-upstream-url)
46+
id: make_download
47+
run: |
48+
make -k download DOWNLOAD_PACKAGES=":all: --no-file huge"
49+
env:
50+
MAKE: make -j8
51+
- name: Reconfigure with --enable-download-from-upstream-url
52+
if: (success() || failure()) && (steps.make_dist.outcome != 'success' || steps.make_download.outcome != 'success')
53+
run: |
54+
./configure
4455
- name: make dist (--enable-download-from-upstream-url)
45-
if: failure()
56+
if: (success() || failure()) && steps.make_dist.outcome != 'success'
4657
run: |
47-
./configure && make dist
58+
make dist
4859
env:
4960
MAKE: make -j8
61+
- name: make download (--enable-download-from-upstream-url)
62+
if: (success() || failure()) && steps.make_download.outcome != 'success'
63+
run: |
64+
make -k download DOWNLOAD_PACKAGES=":all: --no-file huge --allow-upstream"
65+
env:
66+
MAKE: make -j8
67+
- name: Remove what cannot be distributed
68+
if: success() || failure()
69+
run: |
70+
rm -f upstream/*do-not-distribute*
5071
- uses: actions/upload-artifact@v4
5172
if: success() || failure()
5273
with:

Makefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,11 @@ reconfigure:
7979
fi
8080

8181
# Preemptively download all source tarballs of normal packages.
82+
DOWNLOAD_PACKAGES=:all:
8283
download:
8384
export SAGE_ROOT=$$(pwd) && \
8485
export PATH=$$SAGE_ROOT/build/bin:$$PATH && \
85-
sage-package download :all:
86+
sage-package download $(DOWNLOAD_PACKAGES)
8687

8788
dist: build/make/Makefile
8889
./sage --sdist

build/pkgs/deprecation/spkg-configure.m4

-1
This file was deleted.

build/pkgs/pcre/distros/alpine.txt

-1
This file was deleted.

build/pkgs/pycygwin/spkg-configure.m4

-1
This file was deleted.

build/pkgs/setuptools_scm_git_archive/distros/alpine.txt

-1
This file was deleted.

build/pkgs/setuptools_scm_git_archive/distros/arch.txt

-1
This file was deleted.

build/pkgs/setuptools_scm_git_archive/distros/debian.txt

-1
This file was deleted.

build/pkgs/setuptools_scm_git_archive/distros/fedora.txt

-1
This file was deleted.

build/pkgs/setuptools_scm_git_archive/distros/freebsd.txt

-1
This file was deleted.

build/pkgs/setuptools_scm_git_archive/distros/gentoo.txt

-1
This file was deleted.

build/pkgs/setuptools_scm_git_archive/spkg-configure.m4

-1
This file was deleted.

build/sage_bootstrap/app.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -315,11 +315,14 @@ def download(self, package_name, allow_upstream=False):
315315
package.tarball.download(allow_upstream=allow_upstream)
316316
print(package.tarball.upstream_fqn)
317317

318-
def download_cls(self, package_name_or_class, allow_upstream=False, on_error='stop'):
318+
def download_cls(self, *package_classes, **kwds):
319319
"""
320320
Download a package or a class of packages
321321
"""
322-
pc = PackageClass(package_name_or_class, has_files=['checksums.ini'])
322+
allow_upstream = kwds.pop('allow_upstream', False)
323+
on_error = kwds.pop('on_error', 'stop')
324+
has_files = list(kwds.pop('has_files', []))
325+
pc = PackageClass(*package_classes, has_files=has_files + ['checksums.ini'], **kwds)
323326

324327
def download_with_args(package):
325328
try:

build/sage_bootstrap/cmdline.py

+57-41
Original file line numberDiff line numberDiff line change
@@ -272,19 +272,19 @@ def make_parser():
272272
parser_config = subparsers.add_parser(
273273
'config', epilog=epilog_config,
274274
formatter_class=argparse.RawDescriptionHelpFormatter,
275-
help='Print the configuration')
275+
help='print the configuration')
276276

277277
parser_list = subparsers.add_parser(
278278
'list', epilog=epilog_list,
279279
formatter_class=argparse.RawDescriptionHelpFormatter,
280-
help='Print a list of packages known to Sage')
280+
help='print a list of packages known to Sage')
281281
parser_list.add_argument(
282282
'package_class', metavar='[PACKAGE_NAME|pkg:pypi/DISTRIBUTION-NAME|:PACKAGE_TYPE:]',
283283
type=str, default=[':all-or-nothing:'], nargs='*',
284284
help=('package name, pkg:pypi/ followed by a distribution name, '
285285
'or designator for all packages of a given type '
286286
'(one of :all:, :standard:, :optional:, and :experimental:); '
287-
'default: :all: (or nothing when --include-dependencies or --exclude-dependencies is given'))
287+
'default: :all: (or nothing when --include-dependencies or --exclude-dependencies is given)'))
288288
parser_list.add_argument(
289289
'--has-file', action='append', default=[], metavar='FILENAME', dest='has_files',
290290
help=('only include packages that have this file in their metadata directory '
@@ -306,7 +306,7 @@ def make_parser():
306306
parser_properties = subparsers.add_parser(
307307
'properties', epilog=epilog_properties,
308308
formatter_class=argparse.RawDescriptionHelpFormatter,
309-
help='Print properties of given packages')
309+
help='print properties of given packages')
310310
parser_properties.add_argument(
311311
'package_class', metavar='[PACKAGE_NAME|pkg:pypi/DISTRIBUTION-NAME|:PACKAGE_TYPE:]',
312312
type=str, nargs='+',
@@ -320,7 +320,7 @@ def make_parser():
320320
parser_dependencies = subparsers.add_parser(
321321
'dependencies', epilog=epilog_dependencies,
322322
formatter_class=argparse.RawDescriptionHelpFormatter,
323-
help='Print the list of packages that are dependencies of given packages')
323+
help='print the list of packages that are dependencies of given packages')
324324
parser_dependencies.add_argument(
325325
'package_class', metavar='[package_name|:package_type:]',
326326
type=str, nargs='+',
@@ -345,74 +345,88 @@ def make_parser():
345345
parser_name = subparsers.add_parser(
346346
'name', epilog=epilog_name,
347347
formatter_class=argparse.RawDescriptionHelpFormatter,
348-
help='Find the package name given a tarball filename')
349-
parser_name.add_argument('tarball_filename', type=str, help='Tarball filename')
348+
help='find the package name given a tarball filename')
349+
parser_name.add_argument('tarball_filename', type=str, help='tarball filename')
350350

351351
parser_tarball = subparsers.add_parser(
352352
'tarball', epilog=epilog_tarball,
353353
formatter_class=argparse.RawDescriptionHelpFormatter,
354-
help='Find the tarball filename given a package name')
355-
parser_tarball.add_argument('package_name', type=str, help='Package name')
354+
help='find the tarball filename given a package name')
355+
parser_tarball.add_argument('package_name', type=str, help='package name')
356356

357357
parser_apropos = subparsers.add_parser(
358358
'apropos', epilog=epilog_apropos,
359359
formatter_class=argparse.RawDescriptionHelpFormatter,
360-
help='Find up to 5 package names that are close to the given name')
360+
help='find up to 5 package names that are close to the given name')
361361
parser_apropos.add_argument(
362362
'incorrect_name', type=str,
363-
help='Fuzzy name to search for')
363+
help='fuzzy name to search for')
364364

365365
parser_update = subparsers.add_parser(
366366
'update', epilog=epilog_update,
367367
formatter_class=argparse.RawDescriptionHelpFormatter,
368-
help='Update a package. This modifies the Sage sources.')
368+
help='update a package, modifying the Sage sources')
369369
parser_update.add_argument(
370-
'package_name', type=str, help='Package name')
370+
'package_name', type=str, help='package name')
371371
parser_update.add_argument(
372-
'new_version', type=str, help='New version')
372+
'new_version', type=str, help='new version')
373373
parser_update.add_argument(
374-
'--url', type=str, default=None, help='Download URL')
374+
'--url', type=str, default=None, help='download URL')
375375
parser_update.add_argument(
376376
'--commit', action="store_true",
377-
help='Whether to run "git commit"')
377+
help='whether to run "git commit"')
378378

379379
parser_update_latest = subparsers.add_parser(
380380
'update-latest', epilog=epilog_update_latest,
381381
formatter_class=argparse.RawDescriptionHelpFormatter,
382-
help='Update a package to the latest version. This modifies the Sage sources.')
382+
help='update a package to the latest version, modifying the Sage sources')
383383
parser_update_latest.add_argument(
384-
'package_name', type=str, help='Package name (:all: for all packages)')
384+
'package_name', type=str, help='package name (:all: for all packages)')
385385
parser_update_latest.add_argument(
386386
'--commit', action="store_true",
387-
help='Whether to run "git commit"')
387+
help='whether to run "git commit"')
388388

389389
parser_download = subparsers.add_parser(
390390
'download', epilog=epilog_download,
391391
formatter_class=argparse.RawDescriptionHelpFormatter,
392-
help='Download tarball')
392+
help='download tarball')
393393
parser_download.add_argument(
394-
'package_name', type=str, help='Package name or :type:')
394+
'package_class', metavar='[package_name|:package_type:]',
395+
type=str, nargs='+',
396+
help=('package name or designator for all packages of a given type '
397+
'(one of :all:, :standard:, :optional:, and :experimental:)'))
398+
parser_download.add_argument(
399+
'--has-file', action='append', default=[], metavar='FILENAME', dest='has_files',
400+
help=('only include packages that have this file in their metadata directory '
401+
'(examples: SPKG.rst, spkg-configure.m4, distros/debian.txt, spkg-install|spkg-install.in)'))
402+
parser_download.add_argument(
403+
'--no-file', action='append', default=[], metavar='FILENAME', dest='no_files',
404+
help=('only include packages that do not have this file in their metadata directory '
405+
'(examples: huge, patches, huge|has_nonfree_dependencies)'))
406+
parser_download.add_argument(
407+
'--exclude', nargs='*', action='append', default=[], metavar='PACKAGE_NAME',
408+
help='exclude package from list')
395409
parser_download.add_argument(
396410
'--allow-upstream', action="store_true",
397-
help='Whether to fall back to downloading from the upstream URL')
411+
help='whether to fall back to downloading from the upstream URL')
398412
parser_download.add_argument(
399413
'--on-error', choices=['stop', 'warn'], default='stop',
400-
help='What to do if the tarball cannot be downloaded')
414+
help='what to do if the tarball cannot be downloaded')
401415
parser_download.add_argument(
402416
'--no-check-certificate', action='store_true',
403-
help='Do not check SSL certificates for https connections')
417+
help='do not check SSL certificates for https connections')
404418

405419
parser_upload = subparsers.add_parser(
406420
'upload', epilog=epilog_upload,
407421
formatter_class=argparse.RawDescriptionHelpFormatter,
408-
help='Upload tarball to Sage mirrors')
422+
help='upload tarball to Sage mirrors')
409423
parser_upload.add_argument(
410-
'package_name', type=str, help='Package name or :type:')
424+
'package_name', type=str, help='package name or :type:')
411425

412426
parser_fix_checksum = subparsers.add_parser(
413427
'fix-checksum', epilog=epilog_fix_checksum,
414428
formatter_class=argparse.RawDescriptionHelpFormatter,
415-
help='Fix the checksum of normal packages.')
429+
help='fix the checksum of normal packages')
416430
parser_fix_checksum.add_argument(
417431
'package_class', metavar='[PACKAGE_NAME|pkg:pypi/DISTRIBUTION-NAME|:PACKAGE_TYPE:]',
418432
type=str, default=[':all:'], nargs='*',
@@ -423,39 +437,39 @@ def make_parser():
423437
parser_create = subparsers.add_parser(
424438
'create', epilog=epilog_create,
425439
formatter_class=argparse.RawDescriptionHelpFormatter,
426-
help='Create or overwrite package.')
440+
help='create or overwrite a package')
427441
parser_create.add_argument(
428442
'package_name', default=None, type=str,
429-
help='Package name.')
443+
help='package name')
430444
parser_create.add_argument(
431-
'--source', type=str, default=None, help='Package source (one of normal, wheel, script, pip); default depends on provided arguments')
445+
'--source', type=str, default=None, help='package source (one of normal, wheel, script, pip); default depends on provided arguments')
432446
parser_create.add_argument(
433-
'--version', type=str, default=None, help='Package version')
447+
'--version', type=str, default=None, help='package version')
434448
parser_create.add_argument(
435-
'--tarball', type=str, default=None, help='Tarball filename pattern, e.g. Foo-VERSION.tar.bz2')
449+
'--tarball', type=str, default=None, help='tarball filename pattern, e.g. Foo-VERSION.tar.bz2')
436450
parser_create.add_argument(
437-
'--type', type=str, default=None, help='Package type')
451+
'--type', type=str, default=None, help='package type')
438452
parser_create.add_argument(
439-
'--url', type=str, default=None, help='Download URL pattern, e.g. http://example.org/Foo-VERSION.tar.bz2')
453+
'--url', type=str, default=None, help='download URL pattern, e.g. http://example.org/Foo-VERSION.tar.bz2')
440454
parser_create.add_argument(
441-
'--description', type=str, default=None, help='Short description of the package (for SPKG.rst)')
455+
'--description', type=str, default=None, help='short description of the package (for SPKG.rst)')
442456
parser_create.add_argument(
443-
'--license', type=str, default=None, help='License of the package (for SPKG.rst)')
457+
'--license', type=str, default=None, help='license of the package (for SPKG.rst)')
444458
parser_create.add_argument(
445-
'--upstream-contact', type=str, default=None, help='Upstream contact (for SPKG.rst)')
459+
'--upstream-contact', type=str, default=None, help='upstream contact (for SPKG.rst)')
446460
parser_create.add_argument(
447461
'--pypi', action="store_true",
448-
help='Create a package for a Python package available on PyPI')
462+
help='create a package for a Python package available on PyPI')
449463

450464
parser_clean = subparsers.add_parser(
451465
'clean', epilog=epilog_clean,
452466
formatter_class=argparse.RawDescriptionHelpFormatter,
453-
help='Remove outdated source tarballs from the upstream/ directory')
467+
help='remove outdated source tarballs from the upstream/ directory')
454468

455469
parser_metrics = subparsers.add_parser(
456470
'metrics', epilog=epilog_metrics,
457471
formatter_class=argparse.RawDescriptionHelpFormatter,
458-
help='Print metrics of given packages')
472+
help='print metrics of given packages')
459473
parser_metrics.add_argument(
460474
'package_class', metavar='[PACKAGE_NAME|pkg:pypi/DISTRIBUTION-NAME|:PACKAGE_TYPE:]',
461475
type=str, nargs='*', default=[':all:'],
@@ -522,7 +536,9 @@ def run():
522536
ssl._create_default_https_context = ssl._create_unverified_context
523537
except ImportError:
524538
pass
525-
app.download_cls(args.package_name,
539+
app.download_cls(*args.package_class,
540+
has_files=args.has_files, no_files=args.no_files,
541+
exclude=args.exclude,
526542
allow_upstream=args.allow_upstream,
527543
on_error=args.on_error)
528544
elif args.subcommand == 'create':

0 commit comments

Comments
 (0)