]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
kernel: update get_sha1_from_pkg_name() regex 983/head
authorIlya Dryomov <idryomov@gmail.com>
Mon, 14 Nov 2016 09:48:02 +0000 (10:48 +0100)
committerIlya Dryomov <idryomov@gmail.com>
Mon, 14 Nov 2016 15:41:37 +0000 (16:41 +0100)
ceph-build kernel packages will be named -ceph-g${SHA1:0:12}.  As the
first step towards using ceph-build, change the local package regex.
With this, I'm able to download post ceph/ceph-build#540 packages and
install them as a local deb/rpm.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
teuthology/task/kernel.py

index 8a56d724b75bb5f4db86c3e249c647a8323176bf..63f4608e37974c8ed490caa6a4ee904d8b6611a0 100644 (file)
@@ -1020,16 +1020,15 @@ def get_latest_image_version_deb(remote, ostype):
 
 def get_sha1_from_pkg_name(path):
     """
-    Get commit hash (min 7 max 40 chars) from (rpm or deb) package name.
-    Sample basenames of "make deb-pkg" and "make rpm-pkg" packages
-        linux-image-3.10.0-ceph-rhdeb-00050-g687d1a5f0083_3.10.0-ceph-rhdeb-00050-g687d1a5f0083-6_amd64.deb
-        kernel-3.10.0_ceph_rhrpm_00050_g687d1a5f0083-8.x86_64.rpm
-    Make sure kernel was built with CONFIG_LOCALVERSION_AUTO=y.
+    Get commit hash (min 12 max 40 chars) from (rpm or deb) package name.
+    Example package names ("make bindeb-pkg" and "make binrpm-pkg"):
+        linux-image-4.9.0-rc4-ceph-g156db39ecfbd_4.9.0-rc4-ceph-g156db39ecfbd-1_amd64.deb
+        kernel-4.9.0_rc4_ceph_g156db39ecfbd-2.x86_64.rpm
 
     :param path: (rpm or deb) package path (only basename is used)
     """
     basename = os.path.basename(path)
-    match = re.search('\d+[-_]g([0-9a-f]{7,40})', basename)
+    match = re.search('[-_]ceph[-_]g([0-9a-f]{12,40})', basename)
     sha1 = match.group(1) if match else None
     log.debug("get_sha1_from_pkg_name: %s -> %s -> %s", path, basename, sha1)
     return sha1