19092: upload crunchstat_summary to Pypi
[arvados-dev.git] / jenkins / run_upload_packages.py
index 8a31d2e383bc20ba1c71d76c397dae9a9b64fc11..6f695b7fc73b1acd41ecf219c36b9a6b8df7d1c0 100755 (executable)
@@ -56,7 +56,7 @@ class TimestampFile:
         try:
             os.makedirs(p)
         except OSError as exc:
-            if exc.errno == errno.EEXIST and os.path.isdir(path):
+            if exc.errno == errno.EEXIST and os.path.isdir(p):
                 pass
             else:
                 raise
@@ -69,9 +69,18 @@ class TimestampFile:
             return -1
 
     def update(self):
-        os.close(os.open(self.path, os.O_CREAT | os.O_APPEND))
-        os.utime(self.path, (time.time(), self.start_time))
-
+        try:
+            os.close(os.open(self.path, os.O_CREAT | os.O_APPEND))
+            os.utime(self.path, (time.time(), self.start_time))
+        except:
+            # when the packages directory is created/populated by a build in a
+            # docker container, as root, the script that runs the upload
+            # doesn't always have permission to touch a timestamp file there.
+            # In production, we build/upload from ephemeral machines, which
+            # means that the timestamp mechanism is not used. We print a
+            # warning and move on without erroring out.
+            print("Warning: unable to update timestamp file",self.path,"permission problem?")
+            pass
 
 class PackageSuite:
     NEED_SSH = False
@@ -216,11 +225,8 @@ aptly publish update "$DISTNAME" filesystem:"${DISTNAME%-*}":
     def __init__(self, glob_root, rel_globs, target, ssh_host, ssh_opts, repo):
         super().__init__(glob_root, rel_globs, target, ssh_host, ssh_opts)
         self.TARGET_DISTNAMES = {
-            'debian8': 'jessie-'+repo,
-            'debian9': 'stretch-'+repo,
             'debian10': 'buster-'+repo,
-            'ubuntu1404': 'trusty-'+repo,
-            'ubuntu1604': 'xenial-'+repo,
+            'debian11': 'bullseye-'+repo,
             'ubuntu1804': 'bionic-'+repo,
             'ubuntu2004': 'focal-'+repo,
             }
@@ -237,7 +243,7 @@ cd "$1"; shift
 REPODIR=$1; shift
 rpmsign --addsign "$@" </dev/null
 mv "$@" "$REPODIR"
-createrepo "$REPODIR"
+createrepo -c ~/.createrepo-cache --update "$REPODIR"
 """
     REPO_ROOT = '/var/www/rpm.arvados.org/'
 
@@ -262,6 +268,7 @@ PACKAGE_SUITES = {
                             'sdk/python/dist/*.tar.gz',
                             'sdk/cwl/dist/*.tar.gz',
                             'services/fuse/dist/*.tar.gz',
+                            'tools/crunchstat-summary/dist/*.tar.gz',
                         ),
     'gems': _define_suite(GemPackageSuite,
                           'sdk/ruby/*.gem',
@@ -298,7 +305,7 @@ def parse_arguments(arguments):
     if args.workspace is None:
         parser.error("workspace not set from command line or environment")
 
-    for target in ['debian8', 'debian9', 'debian10', 'ubuntu1404', 'ubuntu1604', 'ubuntu1804', 'ubuntu2004']:
+    for target in ['debian10', 'debian11', 'ubuntu1804', 'ubuntu2004']:
         PACKAGE_SUITES[target] = _define_suite(
             DebianPackageSuite, os.path.join('packages', target, '*.deb'),
             target=target, repo=args.repo)