Skip to contentSkip to conversation

utils/scanpypi: correctly handle license dirs in subdirs for .hash files

PATCH New Peter Korsgaard 2 participants 3 messages Mar 9, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 utils/scanpypi: correctly handle license dirs in subdirs for .hash files

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.

---
 utils/scanpypi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
utils/scanpypi +1 -1
index 2b3188dbf6..b9006ee4f7 100755
@@ -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:
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/1 utils/scanpypi: correctly handle license dirs in subdirs for .hash files

Hi Peter,

Quoted 8 lines · Peter Korsgaard

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.

Good catch.

Quoted 20 lines
---
 utils/scanpypi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
utils/scanpypi +1 -2
index 2b3188dbf6..b9006ee4f7 100755
@@ -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:
--

2.11.0

#2 lore raw

PATCH 1/1 utils/scanpypi: correctly handle license dirs in subdirs for .hash files

In reply to Peter Korsgaard
Quoted 10 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Peter" == Peter Korsgaard <[email protected]> writes:

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.

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard