Bug 1096524

Summary: mockchain traceback
Product: [Fedora] Fedora Reporter: Daniel Narvaez <dwnarvaez>
Component: mockAssignee: Clark Williams <williams>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 20CC: mebrown, msuchy, williams
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-05-12 07:59:30 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Daniel Narvaez 2014-05-11 15:55:10 UTC
[root@localhost ~]# /usr/bin/mockchain -r fedora-19-armhfp -l /var/tmp/mockremote-CZCJ0/build/ -a http://fedora.sugarlabs.org/out/ http://fedora.sugarlabs.org/out/rpmbuild/SRPMS/sugar-0.101.7-6.20140511gite85c062.fc20.src.rpm
starting logfile: None
results dir: /var/tmp/mockremote-CZCJ0/build/results/fedora-19-armhfp
config dir: /var/tmp/mockremote-CZCJ0/build/configs/fedora-19-armhfp
Traceback (most recent call last):
  File "/usr/bin/mockchain", line 353, in <module>
    main(sys.argv)
  File "/usr/bin/mockchain", line 252, in main
    res, msg =  add_local_repo(my_mock_config, my_mock_config, baseurl)
  File "/usr/bin/mockchain", line 106, in add_local_repo
    repoid = re.sub(r'[^a-zA-Z0-9_]', '', repoid)
  File "/usr/lib/python2.7/re.py", line 151, in sub
    return _compile(pattern, flags).sub(repl, string, count)

Seems to be caused by the following change. (Maybe the intention was to also keep the removed line?). 

commit 9db6edb33cc34a450e762eb5d2bedf9067ebc419
Author: Miroslav Suchý <msuchy>
Date:   Sat Jan 4 14:48:58 2014 -0600

    mockchain: Do not pass $ to repo id in mockchain [BZ# 1034805]
    
    remove special characters when constructing the internal id for
    a repo from the passed in parameter 'repoid'
    
    Signed-off-by: Clark Williams <clark.williams>

diff --git a/py/mockchain.py b/py/mockchain.py
index df66746..f13293a 100755
--- a/py/mockchain.py
+++ b/py/mockchain.py
@@ -102,7 +102,7 @@ def add_local_repo(infile, destfile, baseurl, repoid=None):
     try:
         execfile(infile)
         if not repoid:
-            repoid=baseurl.split('//')[1].replace('/','_')
+            repoid = re.sub(r'[^a-zA-Z0-9_]', '', repoid)
         localyumrepo="""
 [%s]
 name=%s

Comment 1 Miroslav Suchý 2014-05-12 07:59:30 UTC

*** This bug has been marked as a duplicate of bug 1034805 ***