From 7f06b598118666dbd0542690912e7cded34cbbcb Mon Sep 17 00:00:00 2001 From: Bob Badour Date: Wed, 26 Jun 2019 12:04:50 -0700 Subject: Remove unused emma and upload tools. Makefile removed in: https://android-review.git.corp.google.com/c/platform/external/owasp/sanitizer/+/1000297 These unused tools are no longer referenced at all. While licenses term look okay, there is no reason to keep these around. Bug: 136097319 Test: packages/apps/Email/tests packages/apps/UnifiedEmail/tests pass. Change-Id: If8f9ac6477604d75e968e64b1edf1ccc20995b39 --- tools/cut_release.py | 179 ------------------- tools/emma/README.txt | 43 ----- tools/emma/lib/emma.jar | Bin 428218 -> 0 bytes tools/googlecode_upload.py | 256 --------------------------- tools/stage_to_maven_central.sh | 91 ---------- tools/update_tree_in_svn.py | 130 -------------- tools/upload_jars_to_googlecode_downloads.sh | 92 ---------- 7 files changed, 791 deletions(-) delete mode 100755 tools/cut_release.py delete mode 100644 tools/emma/README.txt delete mode 100644 tools/emma/lib/emma.jar delete mode 100755 tools/googlecode_upload.py delete mode 100755 tools/stage_to_maven_central.sh delete mode 100755 tools/update_tree_in_svn.py delete mode 100755 tools/upload_jars_to_googlecode_downloads.sh diff --git a/tools/cut_release.py b/tools/cut_release.py deleted file mode 100755 index c0a6377..0000000 --- a/tools/cut_release.py +++ /dev/null @@ -1,179 +0,0 @@ -#!/usr/bin/python - -""" -Packages a new maven release. -""" - -import os -import re -import shutil -import subprocess -import sys -import xml.dom.minidom - -def mime_type_from_path(path): - if path.endswith(".pom"): - return "text/xml;charset=UTF-8" - elif path.endswith(".jar"): - return "application/java-archive" - return None - -if "__main__" == __name__: - # Compute directories relative to tools. - trunk_directory_path = os.path.realpath(os.path.join( - os.path.dirname(sys.argv[0]), - "..")) - maven_directory_path = os.path.realpath(os.path.join( - os.path.dirname(sys.argv[0]), - "..", - "..", - "maven", - "owasp-java-html-sanitizer", - "owasp-java-html-sanitizer")) - maven_metadata_path = os.path.join( - maven_directory_path, - "maven-metadata.xml") - version_template_directory_path = os.path.join( - maven_directory_path, - "+++version+++") - jar_path = os.path.join( - trunk_directory_path, - "distrib", - "lib", - "owasp-java-html-sanitizer.jar") - src_jar_path = os.path.join( - trunk_directory_path, - "distrib", - "lib", - "owasp-java-html-sanitizer-sources.jar") - doc_jar_path = os.path.join( - trunk_directory_path, - "distrib", - "lib", - "owasp-java-html-sanitizer-javadoc.jar") - - # Make sure the directory_structures we expect exist. - assert os.path.isdir(maven_directory_path), maven_directory_path - assert os.path.isdir(trunk_directory_path), trunk_directory_path - assert os.path.isfile(maven_metadata_path), maven_metadata_path - assert os.path.isdir(version_template_directory_path), ( - version_template_directory_path) - assert os.path.isfile(jar_path), jar_path - assert os.path.isfile(src_jar_path), src_jar_path - assert os.path.isfile(doc_jar_path), doc_jar_path - - # Get svn info of the trunk directory. - svn_info_xml = ( - subprocess.Popen(["svn", "info", "--xml", trunk_directory_path], - stdout=subprocess.PIPE) - .communicate()[0]) - svn_info = xml.dom.minidom.parseString(svn_info_xml) - - # Process SVN output XML to find fields. - date_element = svn_info.getElementsByTagName("date")[0] - entry_element = svn_info.getElementsByTagName("entry")[0] - def inner_text(node): - if node.nodeType == 3: return node.nodeValue - if node.nodeType == 1: - return "".join([inner_text(child) for child in node.childNodes]) - return "" - - # Create a list of fields to use in substitution. - fields = { - "version": "r%s" % entry_element.getAttribute("revision"), - "timestamp": re.sub(r"[^.\d]|\.\d+", "", inner_text(date_element)) - } - - def replace_fields(s): - return re.sub(r"\+\+\+(\w+)\+\+\+", lambda m: fields[m.group(1)], s) - - # List of files that need to have ##DUPE## and ##REPLACE## sections expanded - # NOTE(12 February 2013): We no longer rewrite maven_metadata_path since this - # project is now hosted in Maven Central, and maven_metadata used a - # groupId/artifactId pair that is incompatible with the convention used by - # Maven Central. - # All maven versions after 12 February are undiscoverable by looking at - # maven_metadata. - files_to_rewrite = [] - new_file_paths = [] - - def copy_directory_structure_template(src_path, container_path): - dest_path = os.path.join( - container_path, - replace_fields(os.path.basename(src_path))) - if os.path.isdir(src_path): - os.mkdir(dest_path) - for child in os.listdir(src_path): - # Skip .svn directories. - if "." == child[0:1]: continue - copy_directory_structure_template( - os.path.join(src_path, child), dest_path) - else: - shutil.copyfile(src_path, dest_path) - mime_type = mime_type_from_path(dest_path) - if mime_type is None or mime_type.startswith("text/"): - files_to_rewrite.append(dest_path) - new_file_paths.append(dest_path) - return dest_path - - def rewrite_file(path): - lines = [] - in_file = open(path, "r") - try: - file_content = in_file.read() - finally: - in_file.close() - for line in file_content.split("\n"): - indentation = re.match(r"^\s*", line).group() - matches = re.findall(r"()", line) - if len(matches) >= 2: raise Error("%s: %s" % (path, line)) - if len(matches): - match = matches[0] - line = "%s%s %s" % (indentation, replace_fields(match[1]), match[0]) - else: - matches = re.findall("##DUPE##(.*)##END##", line) - if len(matches) >= 2: raise Error("%s: %s" % (path, line)) - if len(matches): - match = matches[0] - lines.append("%s%s" % (indentation, replace_fields(match))) - lines.append(line) - out_file = open(path, "w") - try: - out_file.write("\n".join(lines)) - finally: - out_file.close() - - versioned_jar_path = os.path.join( - version_template_directory_path, - "owasp-java-html-sanitizer-+++version+++.jar") - versioned_src_jar_path = os.path.join( - version_template_directory_path, - "owasp-java-html-sanitizer-+++version+++-sources.jar") - versioned_doc_jar_path = os.path.join( - version_template_directory_path, - "owasp-java-html-sanitizer-+++version+++-javadoc.jar") - - shutil.copyfile(jar_path, versioned_jar_path) - shutil.copyfile(src_jar_path, versioned_src_jar_path) - shutil.copyfile(doc_jar_path, versioned_doc_jar_path) - ok = False - version_directory_path = None - try: - version_directory_path = copy_directory_structure_template( - version_template_directory_path, maven_directory_path) - for file_to_rewrite in files_to_rewrite: - rewrite_file(file_to_rewrite) - ok = True - finally: - os.unlink(versioned_jar_path) - os.unlink(versioned_src_jar_path) - os.unlink(versioned_doc_jar_path) - if not ok and version_directory_path is not None: - shutil.rmtree(version_directory_path) - - print "svn add '%s'" % version_directory_path - - for new_file_path in new_file_paths: - mime_type = mime_type_from_path(new_file_path) - if mime_type is not None: - print "svn propset svn:mime-type '%s' '%s'" % (mime_type, new_file_path) diff --git a/tools/emma/README.txt b/tools/emma/README.txt deleted file mode 100644 index 58c6f36..0000000 --- a/tools/emma/README.txt +++ /dev/null @@ -1,43 +0,0 @@ - -EMMA is a Java code coverage tool. For more information on EMMA, please -look at the HTML and PDF documentation included in docs/ directory. More -information is available at EMMA's home site: - - http://emma.sourceforge.net - -The top level directories in this distribution are: - -lib/ EMMA implementation jars -docs/ EMMA user guide and reference manual -examples/ ANT build.xml examples (referenced by the user guide) - - -REQUIREMENTS -~~~~~~~~~~~~ - -EMMA is a self-contained toolkit (with no external library dependencies) -supported on any Java 2 runtime. - - -EXAMPLES -~~~~~~~~ - -To try the examples please read the user guide or follow instructions in -docs/README.txt. - - -BUILDING EMMA -~~~~~~~~~~~~~ - -To limit the download size, this distribution does not include the source -code. You can obtain it and the build instructions as -emma--src.zip download from EMMA's project summary site: - - http://sourceforge.net/projects/emma - - __________________________________________________________________________ - Copyright (C) 2003-2005 Vladimir Roubtsov. All rights reserved. - - This program and the accompanying materials are made available under - the terms of the Common Public License v1.0 which accompanies this - distribution, and is available at http://www.eclipse.org/legal/cpl-v10.html diff --git a/tools/emma/lib/emma.jar b/tools/emma/lib/emma.jar deleted file mode 100644 index 27629de..0000000 Binary files a/tools/emma/lib/emma.jar and /dev/null differ diff --git a/tools/googlecode_upload.py b/tools/googlecode_upload.py deleted file mode 100755 index 1691236..0000000 --- a/tools/googlecode_upload.py +++ /dev/null @@ -1,256 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2006, 2007 Google Inc. All Rights Reserved. -# Author: danderson@google.com (David Anderson) -# -# Script for uploading files to a Google Code project. -# -# This is intended to be both a useful script for people who want to -# streamline project uploads and a reference implementation for -# uploading files to Google Code projects. -# -# To upload a file to Google Code, you need to provide a path to the -# file on your local machine, a small summary of what the file is, a -# project name, and a valid account that is a member or owner of that -# project. You can optionally provide a list of labels that apply to -# the file. The file will be uploaded under the same name that it has -# in your local filesystem (that is, the "basename" or last path -# component). Run the script with '--help' to get the exact syntax -# and available options. -# -# Note that the upload script requests that you enter your -# googlecode.com password. This is NOT your Gmail account password! -# This is the password you use on googlecode.com for committing to -# Subversion and uploading files. You can find your password by going -# to http://code.google.com/hosting/settings when logged in with your -# Gmail account. If you have already committed to your project's -# Subversion repository, the script will automatically retrieve your -# credentials from there (unless disabled, see the output of '--help' -# for details). -# -# If you are looking at this script as a reference for implementing -# your own Google Code file uploader, then you should take a look at -# the upload() function, which is the meat of the uploader. You -# basically need to build a multipart/form-data POST request with the -# right fields and send it to https://PROJECT.googlecode.com/files . -# Authenticate the request using HTTP Basic authentication, as is -# shown below. -# -# Licensed under the terms of the Apache Software License 2.0: -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Questions, comments, feature requests and patches are most welcome. -# Please direct all of these to the Google Code users group: -# http://groups.google.com/group/google-code-hosting - -"""Google Code file uploader script. -""" - -__author__ = 'danderson@google.com (David Anderson)' - -import httplib -import os.path -import optparse -import getpass -import base64 -import sys - - -def upload(file, project_name, user_name, password, summary, labels=None): - """Upload a file to a Google Code project's file server. - - Args: - file: The local path to the file. - project_name: The name of your project on Google Code. - user_name: Your Google account name. - password: The googlecode.com password for your account. - Note that this is NOT your global Google Account password! - summary: A small description for the file. - labels: an optional list of label strings with which to tag the file. - - Returns: a tuple: - http_status: 201 if the upload succeeded, something else if an - error occured. - http_reason: The human-readable string associated with http_status - file_url: If the upload succeeded, the URL of the file on Google - Code, None otherwise. - """ - # The login is the user part of user@gmail.com. If the login provided - # is in the full user@domain form, strip it down. - if user_name.endswith('@gmail.com'): - user_name = user_name[:user_name.index('@gmail.com')] - - form_fields = [('summary', summary)] - if labels is not None: - form_fields.extend([('label', l.strip()) for l in labels]) - - content_type, body = encode_upload_request(form_fields, file) - - upload_host = '%s.googlecode.com' % project_name - upload_uri = '/files' - auth_token = base64.b64encode('%s:%s'% (user_name, password)) - headers = { - 'Authorization': 'Basic %s' % auth_token, - 'User-Agent': 'Googlecode.com uploader v0.9.4', - 'Content-Type': content_type, - } - - server = httplib.HTTPSConnection(upload_host) - server.request('POST', upload_uri, body, headers) - resp = server.getresponse() - server.close() - - if resp.status == 201: - location = resp.getheader('Location', None) - else: - location = None - return resp.status, resp.reason, location - - -def encode_upload_request(fields, file_path): - """Encode the given fields and file into a multipart form body. - - fields is a sequence of (name, value) pairs. file is the path of - the file to upload. The file will be uploaded to Google Code with - the same file name. - - Returns: (content_type, body) ready for httplib.HTTP instance - """ - BOUNDARY = '----------Googlecode_boundary_reindeer_flotilla' - CRLF = '\r\n' - - body = [] - - # Add the metadata about the upload first - for key, value in fields: - body.extend( - ['--' + BOUNDARY, - 'Content-Disposition: form-data; name="%s"' % key, - '', - value, - ]) - - # Now add the file itself - file_name = os.path.basename(file_path) - f = open(file_path, 'rb') - file_content = f.read() - f.close() - - body.extend( - ['--' + BOUNDARY, - 'Content-Disposition: form-data; name="filename"; filename="%s"' - % file_name, - # The upload server determines the mime-type, no need to set it. - 'Content-Type: application/octet-stream', - '', - file_content, - ]) - - # Finalize the form body - body.extend(['--' + BOUNDARY + '--', '']) - - return 'multipart/form-data; boundary=%s' % BOUNDARY, CRLF.join(body) - - -def upload_find_auth(file_path, project_name, summary, labels=None, - user_name=None, password=None, tries=3): - """Find credentials and upload a file to a Google Code project's file server. - - file_path, project_name, summary, and labels are passed as-is to upload. - - Args: - file_path: The local path to the file. - project_name: The name of your project on Google Code. - summary: A small description for the file. - labels: an optional list of label strings with which to tag the file. - config_dir: Path to Subversion configuration directory, 'none', or None. - user_name: Your Google account name. - tries: How many attempts to make. - """ - if user_name is None or password is None: - from netrc import netrc - authenticators = netrc().authenticators("code.google.com") - if authenticators: - if user_name is None: - user_name = authenticators[0] - if password is None: - password = authenticators[2] - - while tries > 0: - if user_name is None: - # Read username if not specified or loaded from svn config, or on - # subsequent tries. - sys.stdout.write('Please enter your googlecode.com username: ') - sys.stdout.flush() - user_name = sys.stdin.readline().rstrip() - if password is None: - # Read password if not loaded from svn config, or on subsequent tries. - print 'Please enter your googlecode.com password.' - print '** Note that this is NOT your Gmail account password! **' - print 'It is the password you use to access Subversion repositories,' - print 'and can be found here: http://code.google.com/hosting/settings' - password = getpass.getpass() - - status, reason, url = upload(file_path, project_name, user_name, password, - summary, labels) - # Returns 403 Forbidden instead of 401 Unauthorized for bad - # credentials as of 2007-07-17. - if status in [httplib.FORBIDDEN, httplib.UNAUTHORIZED]: - # Rest for another try. - user_name = password = None - tries = tries - 1 - else: - # We're done. - break - - return status, reason, url - - -def main(): - parser = optparse.OptionParser(usage='googlecode-upload.py -s SUMMARY ' - '-p PROJECT [options] FILE') - parser.add_option('-s', '--summary', dest='summary', - help='Short description of the file') - parser.add_option('-p', '--project', dest='project', - help='Google Code project name') - parser.add_option('-u', '--user', dest='user', - help='Your Google Code username') - parser.add_option('-w', '--password', dest='password', - help='Your Google Code password') - parser.add_option('-l', '--labels', dest='labels', - help='An optional list of comma-separated labels to attach ' - 'to the file') - - options, args = parser.parse_args() - - if not options.summary: - parser.error('File summary is missing.') - elif not options.project: - parser.error('Project name is missing.') - elif len(args) < 1: - parser.error('File to upload not provided.') - elif len(args) > 1: - parser.error('Only one file may be specified.') - - file_path = args[0] - - if options.labels: - labels = options.labels.split(',') - else: - labels = None - - status, reason, url = upload_find_auth(file_path, options.project, - options.summary, labels, - options.user, options.password) - if url: - print 'The file was uploaded successfully.' - print 'URL: %s' % url - return 0 - else: - print 'An error occurred. Your file was not uploaded.' - print 'Google Code upload server said: %s (%s)' % (reason, status) - return 1 - - -if __name__ == '__main__': - sys.exit(main()) diff --git a/tools/stage_to_maven_central.sh b/tools/stage_to_maven_central.sh deleted file mode 100755 index f01ad99..0000000 --- a/tools/stage_to_maven_central.sh +++ /dev/null @@ -1,91 +0,0 @@ -#!/bin/bash - -function requireLocalRepoUpToDate() { - local LOCAL_CHANGES="$(svn status -u | egrep -v '^Status against revision:')" - # -u causes status differences from head to be reported. - if [[ -n "$LOCAL_CHANGES" ]]; then - echo "Repo is not up-to-date or not committed." - echo ======================================== - echo "$LOCAL_CHANGES" - echo ======================================== - - echo "Aborting." - echo - exit -1 - fi -} - -requireLocalRepoUpToDate - -PROJECT_DIR="$(pushd "$(dirname "$0")/../.." >& /dev/null; pwd -P; popd >& /dev/null)" - -VERSION="$1" - -PASSPHRASE="$2" - -KEYNAME=41449802 - -function usageAndExit() { - echo "Usage: $0 " - echo - echo "Stages a release for deployment into Maven central" - echo - echo " is the current SVN revision number." - echo "svn info gives more info about the state of trunk." - echo - echo " is the passphrase for the GPG key $KEYNAME." - echo "gpg --list-keys for more details on the key." - echo - echo "For example: $0 r123 ELIDED" - exit -1 -} - -if ! [ -d "$PROJECT_DIR/maven" ]; then - echo "Cannot determine script directory. $PROJECT_DIR" - usageAndExit -fi - -if ! [[ "$VERSION" =~ r[0-9]+ ]]; then - echo "Bad version $VERSION" - echo - usageAndExit -fi - -if [ -z "$PASSPHRASE" ]; then - echo "Missing passphrase" - echo - usageAndExit -fi - -POMFILE="$PROJECT_DIR/maven/owasp-java-html-sanitizer/owasp-java-html-sanitizer/$VERSION/owasp-java-html-sanitizer-$VERSION.pom" - -JAR_NO_EXT="$PROJECT_DIR/maven/owasp-java-html-sanitizer/owasp-java-html-sanitizer/$VERSION/owasp-java-html-sanitizer-$VERSION" - -function requireFile() { - local FILE="$1" - if ! [ -e "$FILE" ]; then - echo "Missing file : $FILE" - echo - usageAndExit - fi -} - -requireFile "$POMFILE" -requireFile "$JAR_NO_EXT".jar -requireFile "$JAR_NO_EXT"-sources.jar -requireFile "$JAR_NO_EXT"-javadoc.jar - -mvn -X -e \ - gpg:sign-and-deploy-file \ - -Dgpg.keyname="$KEYNAME" \ - -Dgpg.passphrase="$PASSPHRASE" \ - -DgeneratePom=false \ - -DpomFile="$POMFILE" \ - -Dfile="$JAR_NO_EXT".jar \ - -Dfiles="$JAR_NO_EXT"-sources.jar,"$JAR_NO_EXT"-javadoc.jar \ - -Dtypes=jar,jar \ - -Dclassifiers=sources,javadoc \ - -Durl=https://oss.sonatype.org/service/local/staging/deploy/maven2/ \ - -DrepositoryId=sonatype-nexus-staging \ -&& \ -echo "Follow instructions at https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage+Guide#SonatypeOSSMavenRepositoryUsageGuide-8a.ReleaseIt" diff --git a/tools/update_tree_in_svn.py b/tools/update_tree_in_svn.py deleted file mode 100755 index 855ed04..0000000 --- a/tools/update_tree_in_svn.py +++ /dev/null @@ -1,130 +0,0 @@ -#!/usr/bin/python - -""" -After building can be used to replace documentation, -and jars with the newly built versions in SVN. -""" - -import filecmp -import os -import pipes -import sys - -FILE = 'f' -DIR = 'd' -NO_EXIST = 'n' - -MIME_TYPES_BY_EXTENSION = { - 'html': 'text/html;charset=UTF-8', - 'txt': 'text/plain;charset=UTF-8', - 'css': 'text/css;charset=UTF-8', - 'js': 'text/javascript;charset=UTF-8', - 'jar': 'application/x-java-archive', - 'xsl': 'text/xml;charset=UTF-8', - 'gif': 'image/gif', - 'png': 'image/png' - } - -def sync(src_to_dest): - """ - Syncrhonize the destination file tree with the source file tree - in both the current client and in subversion. - """ - - def classify(path): - if not os.path.exists(path): return NO_EXIST - if os.path.isdir(path): return DIR - return FILE - - # If we see a case where (conflict) is present, then we need to be - # sure to do svn deletes in a separate commit before svn adds. - conflict = False - # Keep track of changes to make in subversion - svn_adds = [] - svn_deletes = [] - svn_propsets = {} - - # A bunch of actions that can be taken to synchronize one aspect - # of a source file and a destination file - def run(argv): - """ - Prints out a command line that needs to be run. - """ - print ' '.join([pipes.quote(arg) for arg in argv]) - - def svn(verb_and_flags, args): - cmd = ['svn'] - cmd.extend(verb_and_flags) - cmd.extend(args) - run(cmd) - - def remove(src, dst): run(['rm', dst]) - - def svn_delete(src, dst): svn_deletes.append(dst) - - def recurse(src, dst): - children = set() - if os.path.isdir(src): children.update(os.listdir(src)) - if os.path.isdir(dst): - children.update(os.listdir(dst)) - children.discard('.svn') - for child in children: - handle(os.path.join(src, child), os.path.join(dst, child)) - - def copy(src, dst): run(['cp', '-f', src, dst]) - - def copy_if_different(src, dst): - if not filecmp.cmp(src, dst, shallow=0): copy(src, dst) - - def svn_add(src, dst): - svn_adds.append(dst) - dot = dst.rfind('.') - if dot >= 0: - mime_type = MIME_TYPES_BY_EXTENSION.get(dst[dot+1:]) - if mime_type is not None: - key = ('svn:mime-type', mime_type) - if key not in svn_propsets: - svn_propsets[key] = [] - svn_propsets[key].append(dst) - - def cnf(src, dst): conflict = True - - def mkdir(src, dst): run(['mkdir', dst]) - - # The below table contains the actions to take for each possible - # scenario. - actions = { - # src dst actions - (NO_EXIST, NO_EXIST): (), - (NO_EXIST, FILE) : (remove, svn_delete,), - (NO_EXIST, DIR) : (recurse, remove, svn_delete,), - (FILE, NO_EXIST): (copy, svn_add,), - (FILE, FILE) : (copy_if_different,), - (FILE, DIR) : (recurse, remove, svn_delete, copy, svn_add, cnf), - (DIR, NO_EXIST): (mkdir, svn_add, recurse,), - (DIR, FILE) : (remove, svn_delete, mkdir, svn_add, recurse, cnf), - (DIR, DIR) : (recurse,), - } - - # Walk the file tree (see recurse action above) and synchronize it at - # each step. - def handle(src, dst): - src_t = classify(src) - dst_t = classify(dst) - for action in actions[(src_t, dst_t)]: action(src, dst) - - for (src, dst) in src_to_dest: - handle(src, dst) - - if len(svn_deletes): - svn(['delete'], svn_deletes) - if conflict: - svn(['commit', '-m', 'remove obsolete files from the snapshot tree'], - commit_args) - if len(svn_adds): - svn(['add', '--depth=empty'], svn_adds) - for ((propname, propvalue), files) in svn_propsets.items(): - svn(['propset', propname, propvalue], files) - -if '__main__' == __name__: - sync([(sys.argv[1], sys.argv[2])]) diff --git a/tools/upload_jars_to_googlecode_downloads.sh b/tools/upload_jars_to_googlecode_downloads.sh deleted file mode 100755 index bc1a4f8..0000000 --- a/tools/upload_jars_to_googlecode_downloads.sh +++ /dev/null @@ -1,92 +0,0 @@ -#!/bin/bash - -function help_and_exit() { - echo "Usage: $0 [-go] [-verbose] [-force]" - echo - echo "Moves minified CSS and JS to distribution directories and" - echo "creates a branch in SVN." - echo - echo " -go: Run commands instead of just echoing them." - echo " -verbose: More verbose logging." - echo " -force: Ignore sanity checks for testing." - echo " Incompatible with -go." - echo " -nobranch: Don't create a new release branch." - exit "$1" -} - -# 1 for verbose logging -export VERBOSE="0" -# 1 if commands that have side-effects should actually be run instead of logged -export EFFECT="0" - -for var in "$@"; do - case "$var" in - -verbose) - VERBOSE="1" - ;; - -go) - EFFECT="1" - ;; - -h) - help_and_exit 0 - ;; - *) - echo "Unrecognized argument $var" - help_and_exit -1 - ;; - esac -done - - -function panic() { - echo "PANIC: $*" - - if ! (( $NO_PANIC )); then - exit -1 - fi -} - -function command() { - if (( $VERBOSE )) || ! (( $EFFECT )); then - echo '$' "$*" - fi - if (( $EFFECT )); then - "$@" || panic "command failed: $@" - fi -} - -export VERSION_BASE="$( - pushd "$(dirname "$0")/../.." > /dev/null; pwd; popd > /dev/null)" - -if ! [ -d "$VERSION_BASE/trunk/tools" ]; then - panic "missing trunk/tools in $VERSION_BASE" -fi - -VERSION="$(svn info | perl -ne 'print $1 if m/^Revision: (\d+)$/')" - -DOWNLOADS_ZIP="$VERSION_BASE/trunk/out/owasp-java-html-sanitizer.zip" -VERSIONED_ZIP="$VERSION_BASE/trunk/out/owasp-java-html-sanitizer-r$VERSION.zip" - -pushd "$VERSION_BASE/trunk" > /dev/null -command make download -popd > /dev/null - -if ! [ -f "$DOWNLOADS_ZIP" ]; then - panic "$DOWNLOADS_ZIP is not up-to-date" -fi - -command cp "$DOWNLOADS_ZIP" "$VERSIONED_ZIP" - -command "$VERSION_BASE/trunk/tools/googlecode_upload.py" \ - --summary="JARs, source JAR, and documentation for version $VERSION." \ - -p owasp-java-html-sanitizer -u mikesamuel \ - --labels='Type-Archive,OpSys-All,Featured' \ - "$VERSIONED_ZIP" - -if (( $EFFECT )); then - echo "Don't forget to mark any old ones deprecated at" - echo "https://code.google.com/p/owasp-java-html-sanitizer/downloads/list" -else - echo - echo "Rerun with -go to actually run these commands." -fi -- cgit v1.2.3