From 13f258bf05b13d920ffebbf06ffebdac8743fcc3 Mon Sep 17 00:00:00 2001 From: Dan Jacques Date: Thu, 6 Jul 2017 17:13:27 -0700 Subject: [PATCH] Remove SVN bootstrapping and some tooling. Remove Windows SVN bootstrapping and some SVN tooling. Since "depot_tools" is no longer sync'd to SVN, and we have been committed to Git for years now, this is obsolete. Any transition code will never reach SVN users, and any remaining code should not be used by Chromium developers. BUG=chromium:630904 TEST=unit Change-Id: Ie984e8400a748702b125eaeed8157719ef4b88cc Reviewed-on: https://chromium-review.googlesource.com/562748 Commit-Queue: Daniel Jacques Reviewed-by: Robbie Iannucci Reviewed-by: Aaron Gable --- bootstrap/gclient.bat | 22 ---- bootstrap/win/README.md | 1 - bootstrap/win/svn.new.bat | 4 - bootstrap/win/svnversion.new.bat | 4 - bootstrap/win/win_tools.bat | 2 +- tests/sample_pre_commit_hook | 187 ------------------------------- tests/subversion_config/config | 47 -------- update_depot_tools | 16 --- update_depot_tools.bat | 19 +--- 9 files changed, 3 insertions(+), 299 deletions(-) delete mode 100644 bootstrap/gclient.bat delete mode 100644 bootstrap/win/svn.new.bat delete mode 100644 bootstrap/win/svnversion.new.bat delete mode 100644 tests/sample_pre_commit_hook delete mode 100644 tests/subversion_config/config diff --git a/bootstrap/gclient.bat b/bootstrap/gclient.bat deleted file mode 100644 index e79c08860..000000000 --- a/bootstrap/gclient.bat +++ /dev/null @@ -1,22 +0,0 @@ -@echo off -:: Copyright (c) 2012 The Chromium Authors. All rights reserved. -:: Use of this source code is governed by a BSD-style license that can be -:: found in the LICENSE file. - -:: IMPORTANT NOTE: -:: The bootstrap flow has been removed. This file's only purpose is to make the -:: transition smooth as the previous update script called bootstrap\gclient.bat -:: The current flow took place on March 21, 2012. This file should be removed -:: when it is believed everyone has updated since then. - -:: At this point we know %DEPOT_TOOLS_UPDATE% != 0 as in the previous script -:: bootstrap\gclient.bat was only called if this was the case. - -:: Update the root directory. The previous version only supported svn so there -:: is no need looking for git here (i.e. if someone has git they can't get to -:: this point where the bootstrap dir is gone during the update anyways...) -IF NOT EXIST "%~dp0..\.svn\." GOTO :EOF -call svn up -q "%~dp0.." - -:: Call the updated gclient.bat in the root directory to wrap the update. -call "%~dp0..\gclient.bat" diff --git a/bootstrap/win/README.md b/bootstrap/win/README.md index 1f26b5e2e..6f73cfbf4 100644 --- a/bootstrap/win/README.md +++ b/bootstrap/win/README.md @@ -6,7 +6,6 @@ mechanisms. ## Software bootstrapped * Python (https://www.python.org/) * Git for Windows (https://git-for-windows.github.io/) - * Subversion (https://subversion.apache.org/) ## Mechanism diff --git a/bootstrap/win/svn.new.bat b/bootstrap/win/svn.new.bat deleted file mode 100644 index ade645a67..000000000 --- a/bootstrap/win/svn.new.bat +++ /dev/null @@ -1,4 +0,0 @@ -@echo off -setlocal -set PATH=%~dp0svn_bin;%PATH% -"%~dp0svn_bin\svn.exe" %* diff --git a/bootstrap/win/svnversion.new.bat b/bootstrap/win/svnversion.new.bat deleted file mode 100644 index 4716903ff..000000000 --- a/bootstrap/win/svnversion.new.bat +++ /dev/null @@ -1,4 +0,0 @@ -@echo off -setlocal -set PATH=%~dp0svn_bin;%PATH% -"%~dp0svn_bin\svnversion.exe" %* diff --git a/bootstrap/win/win_tools.bat b/bootstrap/win/win_tools.bat index 1701aa4e9..36cdc578a 100644 --- a/bootstrap/win/win_tools.bat +++ b/bootstrap/win/win_tools.bat @@ -3,7 +3,7 @@ :: Use of this source code is governed by a BSD-style license that can be :: found in the LICENSE file. -:: This script will determine if python, git, or svn binaries need updates. It +:: This script will determine if python or git binaries need updates. It :: returns 123 if the user's shell must restart, otherwise !0 is failure :: Sadly, we can't use SETLOCAL here otherwise it ERRORLEVEL is not correctly diff --git a/tests/sample_pre_commit_hook b/tests/sample_pre_commit_hook deleted file mode 100644 index ba67e5d82..000000000 --- a/tests/sample_pre_commit_hook +++ /dev/null @@ -1,187 +0,0 @@ -#!/usr/bin/env python -# Copyright (c) 2011 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file at -# http://src.chromium.org/viewvc/chrome/trunk/src/LICENSE - -"""Commit bot fake author svn server hook. - -Looks for svn commit --withrevprop realauthor=foo, replaces svn:author with this -author and sets the property commitbot to the commit bot credential to signify -this revision was committed with the commit bot. - -It achieves its goal using an undocumented way. This script could use 'svnlook' -to read revprop properties but the code would still be needed to overwrite the -properties. - -http://svnbook.red-bean.com/nightly/en/svn.reposadmin.create.html#svn.reposadmin.create.hooks -strongly advise against modifying a transation in a commit because the svn -client caches certain bits of repository data. Upon asking subversion devs, -having the wrong svn:author cached on the commit checkout is the worst that can -happen. - -This code doesn't care about this issue because only the commit bot will trigger -this code, which runs in a controlled environment. - -The transaction file format is also extremely unlikely to change. If it does, -the hook will throw an UnexpectedFileFormat exception which will be silently -ignored. -""" - -import os -import re -import sys - - -class UnexpectedFileFormat(Exception): - """The transaction file format is not the format expected.""" - - -def read_svn_dump(filepath): - """Returns list of (K, V) from a keyed svn file. - - Don't use a map so ordering is kept. - - raise UnexpectedFileFormat if the file cannot be understood. - """ - class InvalidHeaderLine(Exception): - """Raised by read_entry when the line read is not the format expected. - """ - - try: - f = open(filepath, 'rb') - except EnvironmentError: - raise UnexpectedFileFormat('The transaction file cannot be opened') - - try: - out = [] - def read_entry(entrytype): - header = f.readline() - match = re.match(r'^' + entrytype + ' (\d+)$', header) - if not match: - raise InvalidHeaderLine(header) - datalen = int(match.group(1)) - data = f.read(datalen) - if len(data) != datalen: - raise UnpexpectedFileFormat( - 'Data value is not the expected length') - # Reads and ignore \n - if f.read(1) != '\n': - raise UnpexpectedFileFormat('Data value doesn\'t end with \\n') - return data - - while True: - try: - key = read_entry('K') - except InvalidHeaderLine, e: - # Check if it's the end of the file. - if e.args[0] == 'END\n': - break - raise UnpexectedFileFormat('Failed to read a key: %s' % e) - try: - value = read_entry('V') - except InvalidHeaderLine, e: - raise UnpexectedFileFormat('Failed to read a value: %s' % e) - out.append([key, value]) - return out - finally: - f.close() - - -def write_svn_dump(filepath, data): - """Writes a svn keyed file with a list of (K, V).""" - f = open(filepath, 'wb') - try: - def write_entry(entrytype, value): - f.write('%s %d\n' % (entrytype, len(value))) - f.write(value) - f.write('\n') - - for k, v in data: - write_entry('K', k) - write_entry('V', v) - f.write('END\n') - finally: - f.close() - - -def find_key(data, key): - """Finds the item in a list of tuple where item[0] == key. - - asserts if there is more than one item with the key. - """ - items = [i for i in data if i[0] == key] - if not items: - return None - assert len(items) == 1 - return items[0] - - -def handle_commit_bot(repo_path, tx, commit_bot, admin_email): - """Replaces svn:author with realauthor and sets commit-bot.""" - # The file format is described there: - # http://svn.apache.org/repos/asf/subversion/trunk/notes/dump-load-format.txt - propfilepath = os.path.join( - repo_path, 'db', 'transactions', tx + '.txn', 'props') - - # Do a lot of checks to make sure everything is in the expected format. - try: - data = read_svn_dump(propfilepath) - except UnexpectedFileFormat: - return ( - 'Failed to parse subversion server transaction format.\n' - 'Please contact %s ASAP with\n' - 'this error message.') % admin_email - if not data: - return ( - 'Failed to load subversion server transaction file.\n' - 'Please contact %s ASAP with\n' - 'this error message.') % admin_email - - realauthor = find_key(data, 'realauthor') - if not realauthor: - # That's fine, there is no author to fake. - return - - author = find_key(data, 'svn:author') - if not author or not author[1]: - return ( - 'Failed to load svn:author from the transaction file.\n' - 'Please contact %s ASAP with\n' - 'this error message.') % admin_email - - if author[1] != commit_bot: - # The author will not be changed and realauthor will be kept as a - # revision property. - return - - if len(realauthor[1]) > 50: - return 'Fake author was rejected due to being too long.' - - if not re.match(r'^[a-zA-Z0-9\@\-\_\+\%\.]+$', realauthor[1]): - return 'Fake author was rejected due to not passing regexp.' - - # Overwrite original author - author[1] = realauthor[1] - # Remove realauthor svn property - data.remove(realauthor) - # Add svn property commit-bot= - data.append(('commit-bot', commit_bot)) - write_svn_dump(propfilepath, data) - - -def main(): - # Replace with your commit-bot credential. - commit_bot = 'user1@example.com' - admin_email = 'dude@example.com' - ret = handle_commit_bot(sys.argv[1], sys.argv[2], commit_bot, admin_email) - if ret: - print >> sys.stderr, ret - return 1 - return 0 - - -if __name__ == '__main__': - sys.exit(main()) - -# vim: ts=4:sw=4:tw=80:et: diff --git a/tests/subversion_config/config b/tests/subversion_config/config deleted file mode 100644 index 6c2a0bb2e..000000000 --- a/tests/subversion_config/config +++ /dev/null @@ -1,47 +0,0 @@ -# Chromium-specific config file to put at ~/.subversion/config or %USERPROFILE%\AppData\Roaming\Subversion\config -# Inspired by http://src.chromium.org/svn/trunk/tools/build/slave/config - -[auth] -# Warning, this is insecure. -store-passwords=yes - -[miscellany] -global-ignores = *.pyc *.user *.suo *.bak *~ #*# *.ncb *.o *.lo *.la .*~ .#* .DS_Store .*.swp *.mk *.Makefile *.sln *.vcproj *.rules SConstruct *.xcodeproj -enable-auto-props = yes - -[auto-props] -*.afm = svn:eol-style=LF -*.bat = svn:eol-style=CRLF -*.c = svn:eol-style=LF -*.cc = svn:eol-style=LF -*.cpp = svn:eol-style=LF -*.css = svn:eol-style=LF -*.def = svn:eol-style=LF -*.dll = svn:executable -*.exe = svn:executable -*.grd = svn:eol-style=LF -*.gyp = svn:eol-style=LF -*.gypi = svn:eol-style=LF -*.h = svn:eol-style=LF -*.htm = svn:eol-style=LF -*.html = svn:eol-style=LF -*.idl = svn:eol-style=LF -*.jpg = svn:mime-type=image/jpeg -*.js = svn:eol-style=LF -*.m = svn:eol-style=LF -*.make = svn:eol-style=LF -*.mm = svn:eol-style=LF -*.mock-http-headers = svn:eol-style=LF -*.obsolete = svn:eol-style=LF -*.pdf = svn:mime-type=application/pdf -*.pl = svn:eol-style=LF -*.pm = svn:eol-style=LF -*.png = svn:mime-type=image/png -*.py = svn:eol-style=LF -*.pyd = svn:executable -*.sh = svn:eol-style=LF;svn:executable -*.txt = svn:eol-style=LF -*.webp = svn:mime-type=image/webp -*.xml = svn:eol-style=LF -*.xtb = svn:eol-style=LF -Makefile = svn:eol-style=LF diff --git a/update_depot_tools b/update_depot_tools index 4dcdcf77a..bc5ca4868 100755 --- a/update_depot_tools +++ b/update_depot_tools @@ -119,20 +119,4 @@ then cd - > /dev/null fi -# We're on POSIX. We can now safely look for svn checkout. -if [ "X$DEPOT_TOOLS_UPDATE" != "X0" -a -e "$base_dir/.svn" ] -then - echo "========================" - echo "WARNING: You have an SVN checkout of depot_tools!" - echo - echo "depot_tools has migrated to Git. You are" - echo "NO LONGER RECEIVING UPDATES to depot_tools." - echo - echo "You must follow these instructions[1] to get a Git copy of depot_tools." - echo - echo "[1]: https://www.chromium.org/developers/how-tos/install-depot-tools" - echo "========================" - return 1 -fi - find "$base_dir" -iname "*.pyc" -exec rm -f {} \; diff --git a/update_depot_tools.bat b/update_depot_tools.bat index f3c1126ea..cfb44f047 100644 --- a/update_depot_tools.bat +++ b/update_depot_tools.bat @@ -23,7 +23,7 @@ IF EXIST "%DEPOT_TOOLS_DIR%.disable_auto_update" GOTO :EOF set GIT_URL=https://chromium.googlesource.com/chromium/tools/depot_tools.git -:: Will download git, svn and python. +:: Will download git and python. call "%DEPOT_TOOLS_DIR%bootstrap\win\win_tools.bat" if errorlevel 1 goto :EOF :: Now clear errorlevel so it can be set by other programs later. @@ -32,27 +32,12 @@ set errorlevel= :: Shall skip automatic update? IF "%DEPOT_TOOLS_UPDATE%" == "0" GOTO :EOF -:: We need either .\.svn\. or .\.git\. to be able to sync. -IF EXIST "%DEPOT_TOOLS_DIR%.svn\." GOTO :SVN_UPDATE +:: We need .\.git\. to be able to sync. IF EXIST "%DEPOT_TOOLS_DIR%.git\." GOTO :GIT_UPDATE echo Error updating depot_tools, no revision tool found. goto :EOF -:SVN_UPDATE -echo ======================== -echo WARNING: You have an SVN checkout of depot_tools! -echo. -echo depot_tools has migrated to Git. You are -echo NO LONGER RECEIVING UPDATES to depot_tools. -echo. -echo You must follow these instructions[1] to get a Git copy of depot_tools. -echo. -echo [1]: https://www.chromium.org/developers/how-tos/install-depot-tools -echo ======================== -goto :EOF - - :GIT_UPDATE cd /d "%DEPOT_TOOLS_DIR%." call git config remote.origin.fetch > NUL