all_selects = configtree.all_selects()
for sym, vals in bpi.items():
if sym.startswith('BPAUTO_BUILD_'):
- if not sym[15:] in all_selects:
+ if not sym[13:] in all_selects:
disable_list.append(sym)
continue
symtype, module_name, c_files, h_files = vals
logwrite("Failed to apply changes from %s" % print_name)
for line in output:
logwrite('> %s' % line)
- raise Exception('Patch failed')
+ return 2
if args.refresh:
pfilef = open(pfile + '.tmp', 'a')
logwrite("Failed to diff to refresh %s" % print_name)
pfilef.close()
os.unlink(pfile + '.tmp')
- raise Exception('Refresh failed')
+ return 2
pfilef.close()
os.rename(pfile + '.tmp', pfile)
print_name = cocci_file[prefix_len:]
if args.verbose:
logwrite("Applying SmPL patch %s" % print_name)
+ logwrite(" %s" % cmd)
sprocess = subprocess.Popen(cmd,
stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
close_fds=True, universal_newlines=True,
output = sprocess.communicate()[0]
sprocess.wait()
if sprocess.returncode != 0:
- logwrite("Failed to process SmPL patch %s" % print_name)
- raise Exception('SmPL patch failed')
+ logwrite("Failed to process SmPL patch %s with %i" % (print_name, sprocess.returncode))
+ return 2
output = output.split('\n')
if output[-1] == '':
output = output[:-1]
# Our binary requirements go here
req = reqs.Req()
req.require('git')
- req.coccinelle('1.0.0-rc21')
+ req.coccinelle('1.0.6')
if not req.reqs_match():
sys.exit(1)
help='Refresh patches as they are applied, the source dir will be modified!')
parser.add_argument('--base-name', metavar='<name>', type=str, default='Linux',
help='name of base tree, default just "Linux"')
- parser.add_argument('--gitdebug', const=True, default=False, action="store_const",
+ parser.add_argument('--gitdebug', '--git-debug', const=True, default=False, action="store_const",
help='Use git, in the output tree, to debug the various transformation steps ' +
'that the tree generation makes (apply patches, ...)')
parser.add_argument('--verbose', const=True, default=False, action="store_const",
bpcfg.disable_symbols(disable_list)
git_debug_snapshot(args, 'Add automatic backports')
- apply_patches(args, "backport", source_dir, 'patches', bpid.target_dir, logwrite)
+ failure = apply_patches(args, "backport", source_dir, 'patches', bpid.target_dir, logwrite)
+ if failure:
+ return failure
# Kernel integration requires Kconfig.versions already generated for you,
# we cannot do this for a package as we have no idea what kernel folks
# some post-processing is required
configtree = kconfig.ConfigTree(os.path.join(bpid.target_dir, 'Kconfig'), bpid)
- ignore=['Kconfig.kernel', 'Kconfig.versions']
+ ignore=['Kconfig.kernel', 'Kconfig.versions', 'Kconfig.local']
configtree.verify_sources(ignore=ignore)
git_debug_snapshot(args, "verify sources on top level backports Kconfig")
ignore = [os.path.join(bpid.target_dir, x) for x in [
'Kconfig.package.hacks',
'Kconfig.versions',
+ 'Kconfig.local',
'Kconfig',
]
]
# write local symbol list -- needed during packaging build
if not bpid.integrate:
- f = open(os.path.join(bpid.target_dir, '.local-symbols'), 'w')
+ f = open(os.path.join(bpid.target_dir, 'local-symbols'), 'w')
for sym in symbols:
f.write('%s=\n' % sym)
f.close()
git_debug_snapshot(args, "add symbols files")
+ # also write Kconfig.local, representing all local symbols
+ # with a BACKPORTED_ prefix
+ f = open(os.path.join(bpid.target_dir, 'Kconfig.local'), 'w')
+ for sym in symbols:
+ f.write('config BACKPORTED_%s\n' % sym)
+ f.write('\ttristate\n')
+ f.write('\tdefault %s\n' % sym)
+ f.close()
+ git_debug_snapshot(args, "add Kconfig.local")
# add defconfigs that we want
defconfigs_dir = os.path.join(source_dir, 'backport', 'defconfigs')
data = open(os.path.join(root, f), 'r').read()
for r in regexes:
data = r.sub(r'' + bpid.full_prefix + '\\1', data)
+ # we have an absolue path in $(src) since we compile out of tree
+ data = re.sub(r'\$\(srctree\)/\$\(src\)', '$(src)', data)
data = re.sub(r'\$\(srctree\)', '$(backport_srctree)', data)
data = re.sub(r'-Idrivers', '-I$(backport_srctree)/drivers', data)
if bpid.integrate:
# groups -- 50 seemed safer and is still fast)
regexes = []
for some_symbols in [disable_makefile[i:i + 50] for i in range(0, len(disable_makefile), 50)]:
- r = '^([^#].*((' + bpid.full_prefix_resafe + '|CONFIG_)(' + '|'.join([s for s in some_symbols]) + ')))'
+ r = '^(([^#].*((' + bpid.full_prefix_resafe + '|CONFIG_)(' + '|'.join([s for s in some_symbols]) + ')))\W)'
regexes.append(re.compile(r, re.MULTILINE))
for f in maketree.get_makefiles():
data = open(f, 'r').read()
f.close()
git_debug_snapshot(args, "hooked backport to top level Kconfig")
- apply_patches(args, "integration", source_dir, 'integration-patches/',
- bpid.project_dir, logwrite)
+ failure = apply_patches(args, "integration", source_dir, 'integration-patches/',
+ bpid.project_dir, logwrite)
+ if failure:
+ return failure
if (args.kup or args.kup_test):
req = reqs.Req()