From 5577dbdcf13c2f6091c81bfee6a810aa51fa6778 Mon Sep 17 00:00:00 2001 From: machenbach Date: Fri, 23 Jan 2015 02:45:24 -0800 Subject: [PATCH] Remove version generation approach. Revert "Partially reland Auto-generate v8 version based on tags." This reverts commit 0707afc863e14ad216fa2157f41fc35f86bd64b2. Revert "Ensure tags are fetched when generating the V8 version." This reverts commit ea6831e9de62ceade14b7baeb7d57c74a30a1f38. Revert "Restrict tag-update for version generation to cached git repos." This reverts commit c6641e138bb4a81b47f70e62bb9113c87b590a6f. BUG=chromium:446166 LOG=n Review URL: https://codereview.chromium.org/866263005 Cr-Commit-Position: refs/heads/master@{#26244} --- .gitignore | 1 - DEPS | 5 -- Makefile | 22 +++---- build/generate_version.py | 149 ---------------------------------------------- 4 files changed, 7 insertions(+), 170 deletions(-) delete mode 100755 build/generate_version.py diff --git a/.gitignore b/.gitignore index 5744940..f720bee 100644 --- a/.gitignore +++ b/.gitignore @@ -46,7 +46,6 @@ shell_g /out /perf.data /perf.data.old -/src/version_gen.cc /test/benchmarks/CHECKED_OUT_* /test/benchmarks/downloaded_* /test/benchmarks/kraken diff --git a/DEPS b/DEPS index 25a5d76..9cb7551 100644 --- a/DEPS +++ b/DEPS @@ -88,11 +88,6 @@ hooks = [ 'action': ['python', 'v8/tools/clang/scripts/update.py', '--if-needed'], }, { - # Generate v8 version based on the last git tag. - "pattern": ".", - "action": ["python", "v8/build/generate_version.py"], - }, - { # A change to a .gyp, .gypi, or to GYP itself should run the generator. "pattern": ".", "action": ["python", "v8/build/gyp_v8"], diff --git a/Makefile b/Makefile index 8dc5b10..5468d91 100644 --- a/Makefile +++ b/Makefile @@ -266,7 +266,7 @@ NACL_CHECKS = $(addsuffix .check,$(NACL_BUILDS)) # File where previously used GYPFLAGS are stored. ENVFILE = $(OUTDIR)/environment -.PHONY: all check clean builddeps dependencies $(ENVFILE).new native version \ +.PHONY: all check clean builddeps dependencies $(ENVFILE).new native \ qc quickcheck $(QUICKCHECKS) turbocheck \ $(addsuffix .quickcheck,$(MODES)) $(addsuffix .quickcheck,$(ARCHES)) \ $(ARCHES) $(MODES) $(BUILDS) $(CHECKS) $(addsuffix .clean,$(ARCHES)) \ @@ -279,13 +279,9 @@ ENVFILE = $(OUTDIR)/environment # Target definitions. "all" is the default. all: $(DEFAULT_MODES) -# Target for generating the v8 version file from git tags. -version: - build/generate_version.py - # Special target for the buildbots to use. Depends on $(OUTDIR)/Makefile # having been created before. -buildbot: version +buildbot: $(MAKE) -C "$(OUTDIR)" BUILDTYPE=$(BUILDTYPE) \ builddir="$(abspath $(OUTDIR))/$(BUILDTYPE)" @@ -296,14 +292,14 @@ $(MODES): $(addsuffix .$$@,$(DEFAULT_ARCHES)) $(ARCHES): $(addprefix $$@.,$(DEFAULT_MODES)) # Defines how to build a particular target (e.g. ia32.release). -$(BUILDS): $(OUTDIR)/Makefile.$$@ version +$(BUILDS): $(OUTDIR)/Makefile.$$@ @$(MAKE) -C "$(OUTDIR)" -f Makefile.$@ \ BUILDTYPE=$(shell echo $(subst .,,$(suffix $@)) | \ python -c "print \ raw_input().replace('opt', '').capitalize()") \ builddir="$(shell pwd)/$(OUTDIR)/$@" -native: $(OUTDIR)/Makefile.native version +native: $(OUTDIR)/Makefile.native @$(MAKE) -C "$(OUTDIR)" -f Makefile.native \ BUILDTYPE=Release \ builddir="$(shell pwd)/$(OUTDIR)/$@" @@ -311,8 +307,7 @@ native: $(OUTDIR)/Makefile.native version $(ANDROID_ARCHES): $(addprefix $$@.,$(MODES)) $(ANDROID_BUILDS): $(GYPFILES) $(ENVFILE) build/android.gypi \ - must-set-ANDROID_NDK_ROOT_OR_TOOLCHAIN Makefile.android \ - version + must-set-ANDROID_NDK_ROOT_OR_TOOLCHAIN Makefile.android @$(MAKE) -f Makefile.android $@ \ ARCH="$(basename $@)" \ MODE="$(subst .,,$(suffix $@))" \ @@ -322,7 +317,7 @@ $(ANDROID_BUILDS): $(GYPFILES) $(ENVFILE) build/android.gypi \ $(NACL_ARCHES): $(addprefix $$@.,$(MODES)) $(NACL_BUILDS): $(GYPFILES) $(ENVFILE) \ - Makefile.nacl must-set-NACL_SDK_ROOT version + Makefile.nacl must-set-NACL_SDK_ROOT @$(MAKE) -f Makefile.nacl $@ \ ARCH="$(basename $@)" \ MODE="$(subst .,,$(suffix $@))" \ @@ -422,10 +417,7 @@ native.clean: rm -rf $(OUTDIR)/native find $(OUTDIR) -regex '.*\(host\|target\)\.native\.mk' -delete -version.clean: - rm -f src/version_gen.cc - -clean: $(addsuffix .clean, $(ARCHES) $(ANDROID_ARCHES) $(NACL_ARCHES)) native.clean gtags.clean version.clean +clean: $(addsuffix .clean, $(ARCHES) $(ANDROID_ARCHES) $(NACL_ARCHES)) native.clean gtags.clean # GYP file generation targets. OUT_MAKEFILES = $(addprefix $(OUTDIR)/Makefile.,$(BUILDS)) diff --git a/build/generate_version.py b/build/generate_version.py deleted file mode 100755 index 930e485..0000000 --- a/build/generate_version.py +++ /dev/null @@ -1,149 +0,0 @@ -#!/usr/bin/env python -# Copyright 2014 the V8 project authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -""" -Script to set v8's version file to the version given by the latest tag. - -The script is intended to be run as a gclient hook. The script will write a -generated version file into the checkout. - -On build systems where no git is available and where the version information -is not necessary, the version generation can be bypassed with the option ---skip. -""" - - -import optparse -import os -import re -import subprocess -import sys - - -CWD = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) -VERSION_CC = os.path.join(CWD, "src", "version.cc") -VERSION_GEN_CC = os.path.join(CWD, "src", "version_gen.cc") - -VERSION_RE_RAW = r"^(?P\d+)\.(?P\d+)\.(?P\d+)" -VERSION_RE = re.compile(VERSION_RE_RAW + r"$") -VERSION_WITH_PATCH_RE = re.compile(VERSION_RE_RAW + r"\.(?P\d+)$") - -def generate_version_file(): - # Make sure the tags are fetched from cached git repos. - url = subprocess.check_output( - "git config --get remote.origin.url", - shell=True, - cwd=CWD).strip() - if not url.startswith("http"): - subprocess.check_output( - "git fetch origin +refs/tags/*:refs/tags/*", - shell=True, - cwd=CWD) - tag = subprocess.check_output( - "git describe --tags", - shell=True, - cwd=CWD, - ).strip() - assert tag - - # Check for commits not exactly matching a tag. Those are candidate builds - # for the next version. The output has the form - # --. - if "-" in tag: - version = tag.split("-")[0] - candidate = "1" - else: - version = tag - candidate = "0" - - match = VERSION_RE.match(version) - match_patch = VERSION_WITH_PATCH_RE.match(version) - if match: - # Simple version e.g. "3.30.5". - major = match.group("major") - minor = match.group("minor") - build = match.group("build") - patch = "0" - invalid = "0" - elif match_patch: - # Version with patch level e.g. "3.30.5.2". - major = match.group("major") - minor = match.group("minor") - build = match.group("build") - patch = match.group("patch") - invalid = "0" - else: - # A tag was found that's not a version string. - major = "0" - minor = "0" - build = "0" - patch = "0" - invalid = "1" - - # Increment build level for candidate builds. - if candidate == "1" and invalid != "1": - build = str(int(build) + 1) - patch = "0" - - # Modify version_gen.cc with the new values. - output = [] - with open(VERSION_CC, "r") as f: - for line in f: - for definition, substitute in ( - ("MAJOR_VERSION", major), - ("MINOR_VERSION", minor), - ("BUILD_NUMBER", build), - ("PATCH_LEVEL", patch), - ("IS_CANDIDATE_VERSION", candidate), - ("IS_INVALID_VERSION", invalid)): - if line.startswith("#define %s" % definition): - line = re.sub("\d+$", substitute, line) - output.append(line) - - # Prepare log message. - suffix_txt = " (candidate)" if candidate == "1" else "" - suffix_txt = " (invalid)" if invalid == "1" else suffix_txt - patch_txt = ".%s" % patch if patch != "0" else "" - version_txt = ("%s.%s.%s%s%s" % - (major, minor, build, patch_txt, suffix_txt)) - log_message = "Modifying version_gen.cc. Set V8 version to %s" % version_txt - return "".join(output), log_message - - -def bypass_version_file(): - with open(VERSION_CC, "r") as f: - return f.read(), "Bypassing V8 version creation." - - -def main(): - parser = optparse.OptionParser() - parser.add_option("--skip", - help="Use raw version.cc file (disables version " - "generation and uses a dummy version).", - default=False, action="store_true") - (options, args) = parser.parse_args() - - if options.skip: - version_file_content, log_message = bypass_version_file() - else: - version_file_content, log_message = generate_version_file() - - old_content = "" - if os.path.exists(VERSION_GEN_CC): - with open(VERSION_GEN_CC, "r") as f: - old_content = f.read() - - # Only generate version file if content has changed. - if old_content != version_file_content: - with open(VERSION_GEN_CC, "w") as f: - f.write(version_file_content) - # Log what was calculated. - print log_message - - return 0 - - -if __name__ == "__main__": - sys.exit(main()) -- 2.7.4