#!/usr/bin/python # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/.
import os import sys import shutil import re import tempfile from optparse import OptionParser from subprocess import check_call from subprocess import check_output
def inplace_replace(replacements=[], filename=""): for r in replacements: ifnot isinstance(r, Replacement): raise TypeError("Expecting a list of Replacement objects")
with tempfile.NamedTemporaryFile(mode="w", delete=False) as tmp_file: with open(filename) as in_file: for line in in_file: for r in replacements:
line = r.replace(line)
tmp_file.write(line)
tmp_file.flush()
def ensure_arguments_after_action(how_many, usage): if (len(sys.argv) != (2 + how_many)):
exit_with_failure("incorrect number of arguments, expected parameters are:\n" + usage)
def set_major_versions(major): for name, file in [["NSSUTIL_VMAJOR", nssutil_h],
["SOFTOKEN_VMAJOR", softkver_h],
["NSS_VMAJOR", nss_h]]:
inplace_replace(filename=file, replacements=[
Replacement(regex=r'^(#define *{} ?).*$'.format(name),
repl=r'\g<1>{}'.format(major))])
def set_minor_versions(minor): for name, file in [["NSSUTIL_VMINOR", nssutil_h],
["SOFTOKEN_VMINOR", softkver_h],
["NSS_VMINOR", nss_h]]:
inplace_replace(filename=file, replacements=[
Replacement(regex=r'^(#define *{} ?).*$'.format(name),
repl=r'\g<1>{}'.format(minor))])
def set_patch_versions(patch): for name, file in [["NSSUTIL_VPATCH", nssutil_h],
["SOFTOKEN_VPATCH", softkver_h],
["NSS_VPATCH", nss_h]]:
inplace_replace(filename=file, replacements=[
Replacement(regex=r'^(#define *{} ?).*$'.format(name),
repl=r'\g<1>{}'.format(patch))])
def set_build_versions(build): for name, file in [["NSSUTIL_VBUILD", nssutil_h],
["SOFTOKEN_VBUILD", softkver_h],
["NSS_VBUILD", nss_h]]:
inplace_replace(filename=file, replacements=[
Replacement(regex=r'^(#define *{} ?).*$'.format(name),
repl=r'\g<1>{}'.format(build))])
def set_full_lib_versions(version): for name, file in [["NSSUTIL_VERSION", nssutil_h],
["SOFTOKEN_VERSION", softkver_h],
["NSS_VERSION", nss_h]]:
inplace_replace(filename=file, replacements=[
Replacement(regex=r'^(#define *{} *\")([0-9.]+)(.*)$'.format(name),
repl=r'\g<1>{}\g<3>'.format(version))])
def set_root_ca_version():
ensure_arguments_after_action(2, "major_version minor_version")
major = args[1].strip()
minor = args[2].strip()
version = major + '.' + minor
if (old_major < new_major or (old_major == new_major and old_minor < new_minor)):
print("You're increasing the minor (or major) version:")
print("- erasing ABI comparison expectations")
new_branch = "NSS_" + str(old_major) + "_" + str(old_minor) + "_BRANCH"
print("- setting reference branch to the branch of the previous version: " + new_branch) with open(abi_base_version_file, "w") as abi_base:
abi_base.write("%s\n" % new_branch) for report_file in abi_report_files: with open(report_file, "w") as report_file_handle:
report_file_handle.truncate()
if action in ('remove_beta'):
remove_beta_status()
elif action in ('set_beta'):
set_beta_status()
elif action in ('print_library_versions'):
print_library_versions()
elif action in ('print_root_ca_version'):
print_root_ca_version()
elif action in ('set_root_ca_version'):
set_root_ca_version()
# x.y version number - 2 parameters elif action in ('set_version_to_minor_release'):
set_version_to_minor_release()
# x.y.z version number - 3 parameters elif action in ('set_version_to_patch_release'):
set_version_to_patch_release()
# change the release candidate number, usually increased by one, # usually if previous release candiate had a bug # 1 parameter elif action in ('set_release_candidate_number'):
set_release_candidate_number()
# use the build/release candiate number in the identifying version number # 4 parameters elif action in ('set_4_digit_release_number'):
set_4_digit_release_number()
elif action in ('create_nss_release_archive'):
create_nss_release_archive()
else:
o.print_help()
sys.exit(2)
sys.exit(0)
Messung V0.5
¤ Dauer der Verarbeitung: 0.1 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.