* stable-2.9: Add full names for options on list groups REST API Add full names for options on list projects REST API Make `-S` an alias of `--start` in changes query REST API Mention deprecation of sortkey parameters in 2.9 release notes Run change hooks and ref-updated events after indexing is done. Fix broken formatting in changes REST documentation Restrict the input of plugin_archetype_deploy.sh Gracefully handle `buck audit` failure Revert "Make VisibleRefFilter.Filter reuse the refs passed from JGit." Conflicts: gerrit-server/src/main/java/com/google/gerrit/server/change/PutTopic.java gerrit-server/src/main/java/com/google/gerrit/server/git/MergeOp.java tools/pack_war.py Change-Id: I89a9b42c049ec1365ef6dec53c73c7a10a41e888
		
			
				
	
	
		
			62 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			Python
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			62 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			Python
		
	
	
		
			Executable File
		
	
	
	
	
#!/usr/bin/python
 | 
						|
# Copyright (C) 2013 The Android Open Source Project
 | 
						|
#
 | 
						|
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
						|
# you may not use this file except in compliance with the License.
 | 
						|
# You may obtain a copy of the License at
 | 
						|
#
 | 
						|
# http://www.apache.org/licenses/LICENSE-2.0
 | 
						|
#
 | 
						|
# Unless required by applicable law or agreed to in writing, software
 | 
						|
# distributed under the License is distributed on an "AS IS" BASIS,
 | 
						|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
						|
# See the License for the specific language governing permissions and
 | 
						|
# limitations under the License.
 | 
						|
 | 
						|
from __future__ import print_function
 | 
						|
from optparse import OptionParser
 | 
						|
from os import getcwd, chdir, makedirs, path, symlink
 | 
						|
from subprocess import check_call, check_output
 | 
						|
import sys
 | 
						|
 | 
						|
opts = OptionParser()
 | 
						|
opts.add_option('-o', help='path to write WAR to')
 | 
						|
opts.add_option('--lib', action='append', help='target for WEB-INF/lib')
 | 
						|
opts.add_option('--pgmlib', action='append', help='target for WEB-INF/pgm-lib')
 | 
						|
opts.add_option('--tmp', help='temporary directory')
 | 
						|
args, ctx = opts.parse_args()
 | 
						|
 | 
						|
war = args.tmp
 | 
						|
root = war[:war.index('buck-out')]
 | 
						|
jars = set()
 | 
						|
 | 
						|
 | 
						|
def link_jars(libs, directory):
 | 
						|
  makedirs(directory)
 | 
						|
  while not path.isfile('.buckconfig'):
 | 
						|
    chdir('..')
 | 
						|
  try:
 | 
						|
    cp = check_output(['buck', 'audit', 'classpath'] + libs)
 | 
						|
  except Exception as e:
 | 
						|
    print('call to buck audit failed: %s' % e, file=sys.stderr)
 | 
						|
    exit(1)
 | 
						|
  for j in cp.strip().splitlines():
 | 
						|
    if j not in jars:
 | 
						|
      jars.add(j)
 | 
						|
      n = path.basename(j)
 | 
						|
      if j.startswith('buck-out/gen/gerrit-'):
 | 
						|
        n = j.split('/')[2] + '-' + n
 | 
						|
      symlink(path.join(root, j), path.join(directory, n))
 | 
						|
 | 
						|
if args.lib:
 | 
						|
  link_jars(args.lib, path.join(war, 'WEB-INF', 'lib'))
 | 
						|
if args.pgmlib:
 | 
						|
  link_jars(args.pgmlib, path.join(war, 'WEB-INF', 'pgm-lib'))
 | 
						|
try:
 | 
						|
  for s in ctx:
 | 
						|
    check_call(['unzip', '-q', '-d', war, s])
 | 
						|
  check_call(['zip', '-9qr', args.o, '.'], cwd=war)
 | 
						|
except KeyboardInterrupt:
 | 
						|
  print('Interrupted by user', file=sys.stderr)
 | 
						|
  exit(1)
 |