Blame SOURCES/BZ-1270784-checksum-prefix.patch
|
|
164e0b |
commit 0904d34bc9286b903b79f8fc42afc3f7cb63a9ad
|
|
|
164e0b |
Author: Valentina Mukhamedzhanova <vmukhame@redhat.com>
|
|
|
164e0b |
Date: Mon Jan 4 15:18:21 2016 +0100
|
|
|
164e0b |
|
|
|
164e0b |
Make sure filename doesn't already contain a checksum. BZ#1104840
|
|
|
164e0b |
|
|
|
164e0b |
diff --git a/createrepo/utils.py b/createrepo/utils.py
|
|
|
164e0b |
index b0d92ec..697728b 100644
|
|
|
164e0b |
--- a/createrepo/utils.py
|
|
|
164e0b |
+++ b/createrepo/utils.py
|
|
|
164e0b |
@@ -18,6 +18,7 @@
|
|
|
164e0b |
|
|
|
164e0b |
import os
|
|
|
164e0b |
import os.path
|
|
|
164e0b |
+import re
|
|
|
164e0b |
import sys
|
|
|
164e0b |
import bz2
|
|
|
164e0b |
import gzip
|
|
|
164e0b |
@@ -173,6 +174,9 @@ def checksum_and_rename(fn_path, sumtype='sha256'):
|
|
|
164e0b |
csum = misc.checksum(sumtype, fn_path)
|
|
|
164e0b |
fn = os.path.basename(fn_path)
|
|
|
164e0b |
fndir = os.path.dirname(fn_path)
|
|
|
164e0b |
+ fn_match = re.match(r'[0-9A-Fa-f]{32,128}-(.+)', fn)
|
|
|
164e0b |
+ if fn_match:
|
|
|
164e0b |
+ fn = fn_match.groups()[0]
|
|
|
164e0b |
csum_fn = csum + '-' + fn
|
|
|
164e0b |
csum_path = os.path.join(fndir, csum_fn)
|
|
|
164e0b |
os.rename(fn_path, csum_path)
|