diff options
author | Jon Turney <jon.turney@dronecode.org.uk> | 2024-01-04 17:30:01 +0300 |
---|---|---|
committer | Jon Turney <jon.turney@dronecode.org.uk> | 2024-01-04 19:04:32 +0300 |
commit | d77f50aab8f7727eebcfb122a10607f2f9f7d835 (patch) | |
tree | 26920c92fe37fff2744c570ea3b91b6037151be1 | |
parent | 48dafae913459780cb081c8c31191ecbaf6b26f0 (diff) |
Isolate tests from a local repodir
This fixes the tests if a local /git/cygwin-packages happens to exist,
and adds some test coverage of code which examines repodir.
-rwxr-xr-x | calm/calm.py | 2 | ||||
-rwxr-xr-x | calm/package.py | 15 | ||||
-rwxr-xr-x | calm/pkg2html.py | 9 | ||||
-rwxr-xr-x | test/test_calm.py | 2 | ||||
-rwxr-xr-x | test/testdata/htdocs.expected/summary/cygwin-src.html | 1 | ||||
-rw-r--r-- | test/testdata/process_arch/packages.json.expected | 1 | ||||
-rw-r--r-- | test/testdata/repodir/cygwin.git/cygwin.cygport | 0 |
7 files changed, 19 insertions, 11 deletions
diff --git a/calm/calm.py b/calm/calm.py index c0926e0..69fb923 100755 --- a/calm/calm.py +++ b/calm/calm.py @@ -861,6 +861,7 @@ def main(): pidfile_default = '/sourceware/cygwin-staging/calm.pid' pkglist_default = common_constants.PKGMAINT relarea_default = common_constants.FTP + repodir_default = '/git/cygwin-packages' setupdir_default = common_constants.HTDOCS vault_default = common_constants.VAULT logdir_default = '/sourceware/cygwin-staging/logs' @@ -877,6 +878,7 @@ def main(): parser.add_argument('--pkglist', action='store', metavar='FILE', help="package maintainer list (default: " + pkglist_default + ")", default=pkglist_default) parser.add_argument('--release', action='store', help='value for setup-release key (default: cygwin)', default='cygwin') parser.add_argument('--releasearea', action='store', metavar='DIR', help="release directory (default: " + relarea_default + ")", default=relarea_default, dest='rel_area') + parser.add_argument('--repodir', action='store', metavar='DIR', help="packaging repositories directory (default: " + repodir_default + ")", default=repodir_default) parser.add_argument('--setupdir', action='store', metavar='DIR', help="setup executable directory (default: " + setupdir_default + ")", default=setupdir_default) parser.add_argument('--stagingdir', action='store', metavar='DIR', help="automated build staging directory (default: " + stagingdir_default + ")", default=stagingdir_default) parser.add_argument('--no-stale', action='store_false', dest='stale', help="don't vault stale packages") diff --git a/calm/package.py b/calm/package.py index d135d80..f84d494 100755 --- a/calm/package.py +++ b/calm/package.py @@ -1396,12 +1396,13 @@ def upper_first_character(s): # # -def _find_build_recipe_file(pn): - repo = '/git/cygwin-packages/%s.git' % pn - if os.path.exists(repo): - # XXX: we might want to check contents of the repo to determine if this - # package has a cygport or g-b-s build script - return 'https://cygwin.com/cgit/cygwin-packages/%s/tree/%s.cygport' % (pn, pn) +def _find_build_recipe_file(args, pn): + if args.repodir: + repo = os.path.join(args.repodir, '%s.git' % pn) + if os.path.exists(repo): + # XXX: we might want to check contents of the repo to determine if this + # package has a cygport or g-b-s build script + return 'https://cygwin.com/cgit/cygwin-packages/%s/tree/%s.cygport' % (pn, pn) return None @@ -1457,7 +1458,7 @@ def write_repo_json(args, packages, f): if 'license' in po.version_hints[bv]: d['license'] = po.version_hints[bv]['license'] - build_recipe = _find_build_recipe_file(po.orig_name) + build_recipe = _find_build_recipe_file(args, po.orig_name) if build_recipe: d['build_recipe'] = build_recipe diff --git a/calm/pkg2html.py b/calm/pkg2html.py index 43591ff..5a3f4ac 100755 --- a/calm/pkg2html.py +++ b/calm/pkg2html.py @@ -293,10 +293,11 @@ def update_package_listings(args, packages): print('<br><br>', file=f) if po.kind == package.Kind.source: - repo = '/git/cygwin-packages/%s.git' % pn - if os.path.exists(repo): - repo_browse_url = '/cgit/cygwin-packages/%s/' % pn - print('<span class="detail">packaging repository</span>: <a href="%s">%s.git</a>' % (repo_browse_url, pn), file=f) + if args.repodir: + repo = os.path.join(args.repodir, '%s.git' % pn) + if os.path.exists(repo): + repo_browse_url = '/cgit/cygwin-packages/%s/' % pn + print('<span class="detail">packaging repository</span>: <a href="%s">%s.git</a>' % (repo_browse_url, pn), file=f) print('<ul>', file=f) for arch in sorted(packages): diff --git a/test/test_calm.py b/test/test_calm.py index 819ce64..c494b76 100755 --- a/test/test_calm.py +++ b/test/test_calm.py @@ -149,6 +149,7 @@ class CalmTest(unittest.TestCase): args.dryrun = False args.force = True args.pkglist = 'testdata/pkglist/cygwin-pkg-maint' + args.repodir = 'testdata/repodir' try: shutil.rmtree(htdocs) @@ -421,6 +422,7 @@ class CalmTest(unittest.TestCase): args.inifile = os.path.join(args.rel_area, 'setup.ini') args.pkglist = 'testdata/pkglist/cygwin-pkg-maint' args.release = 'trial' + args.repodir = 'testdata/repodir' args.setup_version = '3.1415' args.stale = True diff --git a/test/testdata/htdocs.expected/summary/cygwin-src.html b/test/testdata/htdocs.expected/summary/cygwin-src.html index 87d13f0..d19e118 100755 --- a/test/testdata/htdocs.expected/summary/cygwin-src.html +++ b/test/testdata/htdocs.expected/summary/cygwin-src.html @@ -21,6 +21,7 @@ <span class="smaller">(Use <a href="/lists.html#cygwin">the mailing list</a> to report bugs or ask questions. <a href="/problems.html#personal-email">Do not contact the maintainer(s) directly</a>.)</span> <br><br> +<span class="detail">packaging repository</span>: <a href="/cgit/cygwin-packages/cygwin/">cygwin.git</a> <ul> <li><span class="detail">x86_64</span></li> <table class="pkgtable"> diff --git a/test/testdata/process_arch/packages.json.expected b/test/testdata/process_arch/packages.json.expected index 0a2a7df..a915f4d 100644 --- a/test/testdata/process_arch/packages.json.expected +++ b/test/testdata/process_arch/packages.json.expected @@ -51,6 +51,7 @@ ' "arches": [\n' ' "x86_64"\n' ' ],\n' + ' "build_recipe": "https://cygwin.com/cgit/cygwin-packages/cygwin/tree/cygwin.cygport",\n' ' "license": "LGPL-3.0-or-later WITH LGPL-3.0-linking-exception",\n' ' "maintainers": [\n' ' "Corinna Vinschen",\n' diff --git a/test/testdata/repodir/cygwin.git/cygwin.cygport b/test/testdata/repodir/cygwin.git/cygwin.cygport new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/testdata/repodir/cygwin.git/cygwin.cygport |