From f8ad66a76a1edae0651c6824c8a961ae292a9d89 Mon Sep 17 00:00:00 2001 From: Ronan Le Martret Date: Tue, 2 Apr 2013 15:29:50 +0200 Subject: [PATCH] - replace url in source by filename (rpm 4.10 do a curl request if Source is "with url" and "no local file".) --- Tizen_TZ_package/spec2yocto.py | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/Tizen_TZ_package/spec2yocto.py b/Tizen_TZ_package/spec2yocto.py index d03505d..35265b0 100755 --- a/Tizen_TZ_package/spec2yocto.py +++ b/Tizen_TZ_package/spec2yocto.py @@ -240,12 +240,14 @@ class specParser: command += " --target='%s' " % self.__cpu # command += " --define='_target_cpu %s' " % self.__cpu + # command += " --define='RPM_OPT_FLAGS %s' " % "-O2 -g2 -feliminate-unused-debug-types -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=32 -Wformat -Wformat-security -fmessage-length=0 -m64 -march=corei7 -msse4.2 -mtune=corei7-avx -mfpmath=sse -fasynchronous-unwind-tables -fno-omit-frame-pointer -fipa-cp-clone" # command += " --define='configure #configure' " pkgName=os.path.basename(tmp_package_spec_path)[:-5] + if pkgName in [ "cantarell-fonts","monotype-fonts","libkate","google-droid-fonts","texinfo"]: command += " --define='_bindir /usr/bin'" @@ -263,6 +265,29 @@ class specParser: command += " --define='%%_configure %s'" % oe_runconf2 + + patternUrlSourceFile = r'Source[\d]*[\s]*:[\s]*(http.*/)(.*)' + + with open(tmp_package_spec_path,'r') as currentSpecFile: + currentSpecString=currentSpecFile.read() + + resUrlSourceFile=re.findall(patternUrlSourceFile,currentSpecString) + + if len(resUrlSourceFile)>0: + for r in resUrlSourceFile: + print "r",r + currentSpecString=currentSpecString.replace(r[0]+r[1],r[1]) + + with tempfile.NamedTemporaryFile(mode='w', + suffix='tmp', + prefix=os.path.basename(tmp_package_spec_path), + delete=False) as tmpSpecFile: + tmpSpecFile.write(currentSpecString) + tmp_package_spec_path=tmpSpecFile.name + + + + if self.__packagePN == "dbus-initial": with open(tmp_package_spec_path,'r') as currentSpecFile: currentSpecString=currentSpecFile.read() @@ -327,7 +352,7 @@ class specParser: command += " --define='%s #%s' " % (p,p) command += " --parse %s " % tmp_package_spec_path -# print "command :",command + print "command :",command if not os.path.isdir(os.path.join("/tmp","parsed_spec")): os.mkdir(os.path.join("/tmp","parsed_spec")) -- 2.7.4