utils/scanpypi: correctly handle license dirs in subdirs for .hash files
authorPeter Korsgaard <peter@korsgaard.com>
Fri, 9 Mar 2018 14:30:43 +0000 (15:30 +0100)
committerPeter Korsgaard <peter@korsgaard.com>
Fri, 9 Mar 2018 21:23:35 +0000 (22:23 +0100)
create_hash_file() used basename(licensefile) when it writes the entry for
the license file in the .hash, which is obviously not correct when license
file is locate in a sub directory.

Instead copy the logic from __create_mk_license() to strip the directory
prefix from the absolute filename instead.

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Reviewed-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
utils/scanpypi

index 2b3188dbf6ddf2423b6c6d065bdf116f5f745ee0..b9006ee4f788eb2b7c22c7be905a7031ceb43215 100755 (executable)
@@ -554,7 +554,7 @@ class BuildrootPackage():
             hash_line = '{method}\t{digest}  {filename}\n'.format(
                 method='sha256',
                 digest=sha256.hexdigest(),
-                filename=os.path.basename(license_file))
+                filename=license_file.replace(self.tmp_extract, '')[1:])
             lines.append(hash_line)
 
         with open(path_to_hash, 'w') as hash_file: