Buck: extend the tool chain to support unsigning JARs
After switching to Eclipse Maven repository for pulling JGit lib, we have the problem that according to Eclipse release train the JARs have to be signed. That collids with our jgit patch for diff deserialization. To rectify that, add `unsign` parameter to maven_jar() function. Change-Id: Ib7bfa5d16f980a64b887d61a4b4ec325e6ffb0a1
This commit is contained in:
parent
8108a00038
commit
2dbda45dee
@ -10,6 +10,7 @@ maven_jar(
|
||||
src_sha1 = 'b4e3d9c9c3da39b72acf72bd913ce9dbee88a9d4',
|
||||
license = 'jgit',
|
||||
repository = REPO,
|
||||
unsign = True,
|
||||
deps = [':ewah'],
|
||||
exclude = [
|
||||
'META-INF/eclipse.inf',
|
||||
|
@ -33,6 +33,7 @@ def maven_jar(
|
||||
license,
|
||||
exclude = [],
|
||||
exclude_java_sources = False,
|
||||
unsign = False,
|
||||
deps = [],
|
||||
sha1 = '', bin_sha1 = '', src_sha1 = '',
|
||||
repository = MAVEN_CENTRAL,
|
||||
@ -73,6 +74,8 @@ def maven_jar(
|
||||
cmd.extend(['-x', x])
|
||||
if exclude_java_sources:
|
||||
cmd.append('--exclude_java_sources')
|
||||
if unsign:
|
||||
cmd.append('--unsign')
|
||||
|
||||
genrule(
|
||||
name = name + '__download_bin',
|
||||
|
@ -109,6 +109,7 @@ opts.add_option('-u', help='URL to download')
|
||||
opts.add_option('-v', help='expected content SHA-1')
|
||||
opts.add_option('-x', action='append', help='file to delete from ZIP')
|
||||
opts.add_option('--exclude_java_sources', action='store_true')
|
||||
opts.add_option('--unsign', action='store_true')
|
||||
args, _ = opts.parse_args()
|
||||
|
||||
root_dir = args.o
|
||||
@ -166,7 +167,22 @@ if args.exclude_java_sources:
|
||||
finally:
|
||||
zf.close()
|
||||
except (BadZipfile, LargeZipFile) as err:
|
||||
print("error opening %s: %s" % (cache_ent, err), file=stderr)
|
||||
print('error opening %s: %s' % (cache_ent, err), file=stderr)
|
||||
exit(1)
|
||||
|
||||
if args.unsign:
|
||||
try:
|
||||
zf = ZipFile(cache_ent, 'r')
|
||||
try:
|
||||
for n in zf.namelist():
|
||||
if (n.endswith('.RSA')
|
||||
or n.endswith('.SF')
|
||||
or n.endswith('.LIST')):
|
||||
exclude.append(n)
|
||||
finally:
|
||||
zf.close()
|
||||
except (BadZipfile, LargeZipFile) as err:
|
||||
print('error opening %s: %s' % (cache_ent, err), file=stderr)
|
||||
exit(1)
|
||||
|
||||
safe_mkdirs(path.dirname(args.o))
|
||||
@ -174,7 +190,7 @@ if exclude:
|
||||
try:
|
||||
shutil.copyfile(cache_ent, args.o)
|
||||
except (shutil.Error, IOError) as err:
|
||||
print("error copying to %s: %s" % (args.o, err), file=stderr)
|
||||
print('error copying to %s: %s' % (args.o, err), file=stderr)
|
||||
exit(1)
|
||||
try:
|
||||
check_call(['zip', '-d', args.o] + exclude)
|
||||
@ -188,5 +204,5 @@ else:
|
||||
try:
|
||||
shutil.copyfile(cache_ent, args.o)
|
||||
except (shutil.Error, IOError) as err:
|
||||
print("error copying to %s: %s" % (args.o, err), file=stderr)
|
||||
print('error copying to %s: %s' % (args.o, err), file=stderr)
|
||||
exit(1)
|
||||
|
Loading…
Reference in New Issue
Block a user