summaryrefslogtreecommitdiffstats
path: root/scripts/lib/recipetool/create_buildsys.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/lib/recipetool/create_buildsys.py')
-rw-r--r--scripts/lib/recipetool/create_buildsys.py37
1 files changed, 25 insertions, 12 deletions
diff --git a/scripts/lib/recipetool/create_buildsys.py b/scripts/lib/recipetool/create_buildsys.py
index f84ec3dc6c..37d161ef0f 100644
--- a/scripts/lib/recipetool/create_buildsys.py
+++ b/scripts/lib/recipetool/create_buildsys.py
@@ -830,22 +830,35 @@ class SpecFileRecipeHandler(RecipeHandler):
830 if 'PV' in extravalues and 'PN' in extravalues: 830 if 'PV' in extravalues and 'PN' in extravalues:
831 return 831 return
832 filelist = RecipeHandler.checkfiles(srctree, ['*.spec'], recursive=True) 832 filelist = RecipeHandler.checkfiles(srctree, ['*.spec'], recursive=True)
833 pn = None 833 valuemap = {'Name': 'PN',
834 pv = None 834 'Version': 'PV',
835 'Summary': 'SUMMARY',
836 'Url': 'HOMEPAGE',
837 'License': 'LICENSE'}
838 foundvalues = {}
835 for fileitem in filelist: 839 for fileitem in filelist:
836 linecount = 0 840 linecount = 0
837 with open(fileitem, 'r') as f: 841 with open(fileitem, 'r') as f:
838 for line in f: 842 for line in f:
839 if line.startswith('Name:') and not pn: 843 for value, varname in valuemap.iteritems():
840 pn = line.split(':')[1].strip() 844 if line.startswith(value + ':') and not varname in foundvalues:
841 if line.startswith('Version:') and not pv: 845 foundvalues[varname] = line.split(':', 1)[1].strip()
842 pv = line.split(':')[1].strip() 846 break
843 if pv or pn: 847 if len(foundvalues) == len(valuemap):
844 if pv and not 'PV' in extravalues and validate_pv(pv): 848 break
845 extravalues['PV'] = pv 849 if 'PV' in foundvalues:
846 if pn and not 'PN' in extravalues: 850 if not validate_pv(foundvalues['PV']):
847 extravalues['PN'] = pn 851 del foundvalues['PV']
848 break 852 license = foundvalues.pop('LICENSE', None)
853 if license:
854 liccomment = '# NOTE: spec file indicates the license may be "%s"' % license
855 for i, line in enumerate(lines_before):
856 if line.startswith('LICENSE ='):
857 lines_before.insert(i, liccomment)
858 break
859 else:
860 lines_before.append(liccomment)
861 extravalues.update(foundvalues)
849 862
850def register_recipe_handlers(handlers): 863def register_recipe_handlers(handlers):
851 # Set priorities with some gaps so that other plugins can insert 864 # Set priorities with some gaps so that other plugins can insert