- replace url in source by filename (rpm 4.10 do a curl request if Source is "with...
authorRonan Le Martret <ronan@fridu.net>
Tue, 2 Apr 2013 13:29:50 +0000 (15:29 +0200)
committerRonan Le Martret <ronan@fridu.net>
Tue, 2 Apr 2013 13:29:50 +0000 (15:29 +0200)
Tizen_TZ_package/spec2yocto.py

index d03505d..35265b0 100755 (executable)
@@ -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"))