|
|
@ -166,52 +166,86 @@ def main():
|
|
|
|
options.patchset = properties['patchsets'][-1]
|
|
|
|
options.patchset = properties['patchsets'][-1]
|
|
|
|
print('No patchset specified. Using patchset %d' % options.patchset)
|
|
|
|
print('No patchset specified. Using patchset %d' % options.patchset)
|
|
|
|
|
|
|
|
|
|
|
|
print('Downloading the patch.')
|
|
|
|
issues_patchsets_to_apply = [(options.issue, options.patchset)]
|
|
|
|
try:
|
|
|
|
depends_on_info = obj.get_depends_on_patchset(options.issue, options.patchset)
|
|
|
|
patchset = obj.get_patch(options.issue, options.patchset)
|
|
|
|
while depends_on_info:
|
|
|
|
except urllib2.HTTPError as e:
|
|
|
|
depends_on_issue = int(depends_on_info['issue'])
|
|
|
|
print(
|
|
|
|
depends_on_patchset = int(depends_on_info['patchset'])
|
|
|
|
'Failed to fetch the patch for issue %d, patchset %d.\n'
|
|
|
|
try:
|
|
|
|
'Try visiting %s/%d') % (
|
|
|
|
depends_on_info = obj.get_depends_on_patchset(depends_on_issue,
|
|
|
|
options.issue, options.patchset,
|
|
|
|
depends_on_patchset)
|
|
|
|
options.server, options.issue)
|
|
|
|
issues_patchsets_to_apply.insert(0, (depends_on_issue,
|
|
|
|
return 1
|
|
|
|
depends_on_patchset))
|
|
|
|
if options.whitelist:
|
|
|
|
except urllib2.HTTPError:
|
|
|
|
patchset.patches = [patch for patch in patchset.patches
|
|
|
|
print ('The patchset that was marked as a dependency no longer '
|
|
|
|
if patch.filename in options.whitelist]
|
|
|
|
'exists: %s/%d/#ps%d' % (
|
|
|
|
if options.blacklist:
|
|
|
|
options.server, depends_on_issue, depends_on_patchset))
|
|
|
|
patchset.patches = [patch for patch in patchset.patches
|
|
|
|
print 'Therefore it is likely that this patch will not apply cleanly.'
|
|
|
|
if patch.filename not in options.blacklist]
|
|
|
|
print
|
|
|
|
for patch in patchset.patches:
|
|
|
|
depends_on_info = None
|
|
|
|
print(patch)
|
|
|
|
|
|
|
|
full_dir = os.path.abspath(options.root_dir)
|
|
|
|
num_issues_patchsets_to_apply = len(issues_patchsets_to_apply)
|
|
|
|
scm_type = scm.determine_scm(full_dir)
|
|
|
|
if num_issues_patchsets_to_apply > 1:
|
|
|
|
if scm_type == 'svn':
|
|
|
|
print
|
|
|
|
scm_obj = checkout.SvnCheckout(full_dir, None, None, None, None)
|
|
|
|
print 'apply_issue.py found %d dependent CLs.' % (
|
|
|
|
elif scm_type == 'git':
|
|
|
|
num_issues_patchsets_to_apply - 1)
|
|
|
|
scm_obj = checkout.GitCheckout(full_dir, None, None, None, None)
|
|
|
|
print 'They will be applied in the following order:'
|
|
|
|
elif scm_type == None:
|
|
|
|
num = 1
|
|
|
|
scm_obj = checkout.RawCheckout(full_dir, None, None)
|
|
|
|
for issue_to_apply, patchset_to_apply in issues_patchsets_to_apply:
|
|
|
|
else:
|
|
|
|
print ' #%d %s/%d/#ps%d' % (
|
|
|
|
parser.error('Couldn\'t determine the scm')
|
|
|
|
num, options.server, issue_to_apply, patchset_to_apply)
|
|
|
|
|
|
|
|
num += 1
|
|
|
|
# TODO(maruel): HACK, remove me.
|
|
|
|
print
|
|
|
|
# When run a build slave, make sure buildbot knows that the checkout was
|
|
|
|
|
|
|
|
# modified.
|
|
|
|
for issue_to_apply, patchset_to_apply in issues_patchsets_to_apply:
|
|
|
|
if options.root_dir == 'src' and getpass.getuser() == 'chrome-bot':
|
|
|
|
issue_url = '%s/%d/#ps%d' % (options.server, issue_to_apply,
|
|
|
|
# See sourcedirIsPatched() in:
|
|
|
|
patchset_to_apply)
|
|
|
|
# http://src.chromium.org/viewvc/chrome/trunk/tools/build/scripts/slave/
|
|
|
|
print('Downloading patch from %s' % issue_url)
|
|
|
|
# chromium_commands.py?view=markup
|
|
|
|
try:
|
|
|
|
open('.buildbot-patched', 'w').close()
|
|
|
|
patchset = obj.get_patch(issue_to_apply, patchset_to_apply)
|
|
|
|
|
|
|
|
except urllib2.HTTPError as e:
|
|
|
|
print('\nApplying the patch.')
|
|
|
|
print(
|
|
|
|
try:
|
|
|
|
'Failed to fetch the patch for issue %d, patchset %d.\n'
|
|
|
|
scm_obj.apply_patch(patchset, verbose=True)
|
|
|
|
'Try visiting %s/%d') % (
|
|
|
|
except checkout.PatchApplicationFailed as e:
|
|
|
|
issue_to_apply, patchset_to_apply,
|
|
|
|
print(str(e))
|
|
|
|
options.server, issue_to_apply)
|
|
|
|
print('CWD=%s' % os.getcwd())
|
|
|
|
return 1
|
|
|
|
print('Checkout path=%s' % scm_obj.project_path)
|
|
|
|
if options.whitelist:
|
|
|
|
return 1
|
|
|
|
patchset.patches = [patch for patch in patchset.patches
|
|
|
|
|
|
|
|
if patch.filename in options.whitelist]
|
|
|
|
|
|
|
|
if options.blacklist:
|
|
|
|
|
|
|
|
patchset.patches = [patch for patch in patchset.patches
|
|
|
|
|
|
|
|
if patch.filename not in options.blacklist]
|
|
|
|
|
|
|
|
for patch in patchset.patches:
|
|
|
|
|
|
|
|
print(patch)
|
|
|
|
|
|
|
|
full_dir = os.path.abspath(options.root_dir)
|
|
|
|
|
|
|
|
scm_type = scm.determine_scm(full_dir)
|
|
|
|
|
|
|
|
if scm_type == 'svn':
|
|
|
|
|
|
|
|
scm_obj = checkout.SvnCheckout(full_dir, None, None, None, None)
|
|
|
|
|
|
|
|
elif scm_type == 'git':
|
|
|
|
|
|
|
|
scm_obj = checkout.GitCheckout(full_dir, None, None, None, None)
|
|
|
|
|
|
|
|
elif scm_type == None:
|
|
|
|
|
|
|
|
scm_obj = checkout.RawCheckout(full_dir, None, None)
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
parser.error('Couldn\'t determine the scm')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# TODO(maruel): HACK, remove me.
|
|
|
|
|
|
|
|
# When run a build slave, make sure buildbot knows that the checkout was
|
|
|
|
|
|
|
|
# modified.
|
|
|
|
|
|
|
|
if options.root_dir == 'src' and getpass.getuser() == 'chrome-bot':
|
|
|
|
|
|
|
|
# See sourcedirIsPatched() in:
|
|
|
|
|
|
|
|
# http://src.chromium.org/viewvc/chrome/trunk/tools/build/scripts/slave/
|
|
|
|
|
|
|
|
# chromium_commands.py?view=markup
|
|
|
|
|
|
|
|
open('.buildbot-patched', 'w').close()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print('\nApplying the patch from %s' % issue_url)
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
scm_obj.apply_patch(patchset, verbose=True)
|
|
|
|
|
|
|
|
except checkout.PatchApplicationFailed as e:
|
|
|
|
|
|
|
|
print(str(e))
|
|
|
|
|
|
|
|
print('CWD=%s' % os.getcwd())
|
|
|
|
|
|
|
|
print('Checkout path=%s' % scm_obj.project_path)
|
|
|
|
|
|
|
|
return 1
|
|
|
|
|
|
|
|
|
|
|
|
if ('DEPS' in map(os.path.basename, patchset.filenames)
|
|
|
|
if ('DEPS' in map(os.path.basename, patchset.filenames)
|
|
|
|
and not options.ignore_deps):
|
|
|
|
and not options.ignore_deps):
|
|
|
|