summaryrefslogtreecommitdiffstats
path: root/scripts/lib
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2015-04-28 17:10:11 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-05-01 17:08:50 +0100
commitfa61a9468b816c597b4a3e2f3855717c284ffa80 (patch)
treebffeb99201802eebad8c7634e392201f60a0b5a6 /scripts/lib
parent4502daefb8f6da31f3fe9f0e8d34d0a5d667640e (diff)
downloadpoky-fa61a9468b816c597b4a3e2f3855717c284ffa80.tar.gz
recipetool: allow specifying SRCREV via rev= in URI
Provide a means to set SRCREV immediately by using rev= in the URI; if it is specified then it is removed before setting SRC_URI and SRCREV is set to the same value instead. (From OE-Core rev: c9304fcb0a2b81700d0ed5c13b4d976bd4230ce3) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib')
-rw-r--r--scripts/lib/recipetool/create.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py
index cd45998f64..ec6e107e62 100644
--- a/scripts/lib/recipetool/create.py
+++ b/scripts/lib/recipetool/create.py
@@ -58,13 +58,13 @@ class RecipeHandler():
58 58
59 59
60 60
61def fetch_source(uri, destdir): 61def fetch_source(uri, destdir, srcrev):
62 import bb.data 62 import bb.data
63 bb.utils.mkdirhier(destdir) 63 bb.utils.mkdirhier(destdir)
64 localdata = bb.data.createCopy(tinfoil.config_data) 64 localdata = bb.data.createCopy(tinfoil.config_data)
65 bb.data.update_data(localdata) 65 bb.data.update_data(localdata)
66 localdata.setVar('BB_STRICT_CHECKSUM', '') 66 localdata.setVar('BB_STRICT_CHECKSUM', '')
67 localdata.setVar('SRCREV', '${AUTOREV}') 67 localdata.setVar('SRCREV', srcrev)
68 ret = (None, None) 68 ret = (None, None)
69 olddir = os.getcwd() 69 olddir = os.getcwd()
70 try: 70 try:
@@ -88,6 +88,9 @@ def fetch_source(uri, destdir):
88 88
89def supports_srcrev(uri): 89def supports_srcrev(uri):
90 localdata = bb.data.createCopy(tinfoil.config_data) 90 localdata = bb.data.createCopy(tinfoil.config_data)
91 # This is a bit sad, but if you don't have this set there can be some
92 # odd interactions with the urldata cache which lead to errors
93 localdata.setVar('SRCREV', '${AUTOREV}')
91 bb.data.update_data(localdata) 94 bb.data.update_data(localdata)
92 fetcher = bb.fetch2.Fetch([uri], localdata) 95 fetcher = bb.fetch2.Fetch([uri], localdata)
93 urldata = fetcher.ud 96 urldata = fetcher.ud
@@ -108,13 +111,19 @@ def create_recipe(args):
108 checksums = (None, None) 111 checksums = (None, None)
109 tempsrc = '' 112 tempsrc = ''
110 srcsubdir = '' 113 srcsubdir = ''
114 srcrev = '${AUTOREV}'
111 if '://' in args.source: 115 if '://' in args.source:
112 # Fetch a URL 116 # Fetch a URL
113 srcuri = args.source 117 srcuri = args.source
118 rev_re = re.compile(';rev=([^;]+)')
119 res = rev_re.search(srcuri)
120 if res:
121 srcrev = res.group(1)
122 srcuri = rev_re.sub('', srcuri)
114 tempsrc = tempfile.mkdtemp(prefix='recipetool-') 123 tempsrc = tempfile.mkdtemp(prefix='recipetool-')
115 srctree = tempsrc 124 srctree = tempsrc
116 logger.info('Fetching %s...' % srcuri) 125 logger.info('Fetching %s...' % srcuri)
117 checksums = fetch_source(args.source, srctree) 126 checksums = fetch_source(args.source, srctree, srcrev)
118 dirlist = os.listdir(srctree) 127 dirlist = os.listdir(srctree)
119 if 'git.indirectionsymlink' in dirlist: 128 if 'git.indirectionsymlink' in dirlist:
120 dirlist.remove('git.indirectionsymlink') 129 dirlist.remove('git.indirectionsymlink')
@@ -210,7 +219,7 @@ def create_recipe(args):
210 lines_before.append('') 219 lines_before.append('')
211 lines_before.append('# Modify these as desired') 220 lines_before.append('# Modify these as desired')
212 lines_before.append('PV = "%s+git${SRCPV}"' % (realpv or '1.0')) 221 lines_before.append('PV = "%s+git${SRCPV}"' % (realpv or '1.0'))
213 lines_before.append('SRCREV = "${AUTOREV}"') 222 lines_before.append('SRCREV = "%s"' % srcrev)
214 lines_before.append('') 223 lines_before.append('')
215 224
216 if srcsubdir and pv: 225 if srcsubdir and pv: