diff options
Diffstat (limited to 'scripts/lib')
| -rw-r--r-- | scripts/lib/recipetool/create.py | 17 |
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 | ||
| 61 | def fetch_source(uri, destdir): | 61 | def 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 | ||
| 89 | def supports_srcrev(uri): | 89 | def 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: |
