diff options
-rw-r--r-- | .SRCINFO | 30 | ||||
-rw-r--r-- | .gitignore | 7 | ||||
-rw-r--r-- | PKGBUILD | 172 | ||||
-rw-r--r-- | depot-tools-git.install | 19 | ||||
-rw-r--r-- | depot_tools.install | 22 | ||||
-rwxr-xr-x | fixshebangs.py | 74 | ||||
-rw-r--r-- | gsutil-use-google-cloud-sdk.patch | 54 | ||||
-rwxr-xr-x | repo_fix.sh | 32 | ||||
-rw-r--r-- | vpython-use-system-python2.patch | 22 |
9 files changed, 92 insertions, 340 deletions
@@ -1,31 +1,15 @@ pkgbase = depot-tools-git - pkgdesc = Build tools for working with Chromium development, include gclient - pkgver = r6630.44134341f + pkgdesc = Tools for working with Chromium development + pkgver = r7308.7f3861357 pkgrel = 1 - url = https://dev.chromium.org/developers/how-tos/install-depot-tools - install = depot_tools.install + url = https://chromium.googlesource.com/chromium/tools/depot_tools + install = depot-tools-git.install arch = any - license = Custom + license = custom depends = git - depends = ninja - depends = python2 - optdepends = google-cloud-sdk: for gsutil and download_from_google_storage - optdepends = subversion: for repositories using svn - provides = depot_tools - provides = gclient - conflicts = gclient-svn - conflicts = depot_tools-svn - options = !strip - source = depot-tools-git::git+https://chromium.googlesource.com/chromium/tools/depot_tools.git - source = repo_fix.sh - source = fixshebangs.py - source = gsutil-use-google-cloud-sdk.patch - source = vpython-use-system-python2.patch + optdepends = bash-completion: for bash completion + source = git+https://chromium.googlesource.com/chromium/tools/depot_tools sha512sums = SKIP - sha512sums = bde33ffcad42a4d554d5490b6562981ef4b9f3abebadbed909749ee05ba391da4b5acb31b901e785b6f019b4ed3f9c740ab92623dd6a87e67b4b599a0010374b - sha512sums = 33d772f68deddefce985d2820d3ef60fa730a1f3bc404cef3c8b1b517369501b9c3a07bc7b1b3df4d0589b45cbe4850f935699676c3e10c437bceffb37eb8214 - sha512sums = 4043722867ebefc3d65b03f6faa016ef31c510587d499a96e3f3ae1f6e19b49299f5b540e3f2d5176e9ecfd73645d9b815d8c052fcc327687091a2355f817d6a - sha512sums = 4efd6fa204e429619d2da999d07d27eabd748b1941a913cfd5a83cf23fd93b3c8c021ed97c3f30dcc17f67b0dd32486bc361da374aa26e2be2d1d3ed922712c7 pkgname = depot-tools-git diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000000..22f75fe9e931 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +* +!.gitignore + +!PKGBUILD +!.SRCINFO + +!depot-tools-git.install @@ -1,4 +1,5 @@ -# Maintainer: Luis Aranguren <pizzaman@hotmail.com> +# Maintainer: relrel <relrelbachar@gmail.com> +# Contributor: Luis Aranguren <pizzaman@hotmail.com> # Contributor: Adrian Perez <aperez@igalia.com> # Contributor: Chih-Hsuan Yen <yan12125@gmail.com> # Contributor: rway <rway07@gmail.com> @@ -7,122 +8,67 @@ # Contributor: Andreas Schrafl <aschrafl@gmail.com> # Contributor: piojo <aur@zwell.net> # Contributor: hack.augusto <hack.augusto@gmail.com> - pkgname=depot-tools-git -pkgver=r6630.44134341f +pkgver=r7308.7f3861357 pkgrel=1 -pkgdesc='Build tools for working with Chromium development, include gclient' +pkgdesc="Tools for working with Chromium development" arch=('any') -url='https://dev.chromium.org/developers/how-tos/install-depot-tools' -source=( - "${pkgname}::git+https://chromium.googlesource.com/chromium/tools/depot_tools.git" - 'repo_fix.sh' - 'fixshebangs.py' - 'gsutil-use-google-cloud-sdk.patch' - 'vpython-use-system-python2.patch' -) -license=('Custom') -depends=('git' 'ninja' 'python2') -optdepends=( - 'google-cloud-sdk: for gsutil and download_from_google_storage' - 'subversion: for repositories using svn' -) -provides=('depot_tools' 'gclient') -conflicts=('gclient-svn' 'depot_tools-svn') -options=('!strip') -install="depot_tools.install" -sha512sums=('SKIP' - 'bde33ffcad42a4d554d5490b6562981ef4b9f3abebadbed909749ee05ba391da4b5acb31b901e785b6f019b4ed3f9c740ab92623dd6a87e67b4b599a0010374b' - '33d772f68deddefce985d2820d3ef60fa730a1f3bc404cef3c8b1b517369501b9c3a07bc7b1b3df4d0589b45cbe4850f935699676c3e10c437bceffb37eb8214' - '4043722867ebefc3d65b03f6faa016ef31c510587d499a96e3f3ae1f6e19b49299f5b540e3f2d5176e9ecfd73645d9b815d8c052fcc327687091a2355f817d6a' - '4efd6fa204e429619d2da999d07d27eabd748b1941a913cfd5a83cf23fd93b3c8c021ed97c3f30dcc17f67b0dd32486bc361da374aa26e2be2d1d3ed922712c7') - -_scripts_to_fix_exec=( - cit - clang-format - clang_format_merge_driver - compile_single_file - luci-auth - download_from_google_storage - fetch - gclient - git-runhooks - gn - roll-dep -) - -pkgver () { - cd "${pkgname}" +url="https://chromium.googlesource.com/chromium/tools/depot_tools" +license=('custom') +depends=(git) +optdepends=('bash-completion: for bash completion') +install="$pkgname.install" +source=("git+$url") +sha512sums=('SKIP') + +pkgver() { + cd "$srcdir/depot_tools/" printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" } -prepare () { - cd "${pkgname}" - - # This tools work with python2, but ArchLinux default is python3. Fix it. - # pylint is in extra, ninja is an executable and it does not need any change. - # gclient.py require a fix for work correctly with python2-colorama - # Another way is make default python2, but I don't think is a good idea! - # Fixing python scripts. - "${srcdir}/fixshebangs.py" - - # Fix gclient.py - sed -i -r -e 's/from third_party import colorama/import colorama/' \ - -e 's/from third_party.colorama import Fore/from colorama import Fore/' \ - gclient.py - - # Fixing scripts which use "exec python" - for script in "${_scripts_to_fix_exec[@]}" - do - sed -r -i -e 's/exec python/exec python2/' "${script}" - done - - # Make gsutil use google-cloud-sdk instead of downloading from Google Storage - patch -Np1 -i ../gsutil-use-google-cloud-sdk.patch - - # Force vpython to use system Python 2 - patch -Np1 -i ../vpython-use-system-python2.patch -} - -package() -{ - # Creating directories - install -d "${pkgdir}/opt" - - cp -r "${srcdir}/${pkgname}" "${pkgdir}/opt/depot_tools" - - # Install repo_fix.sh script - install -Dm 755 "${srcdir}/repo_fix.sh" "${pkgdir}/opt/depot_tools" - - # Install License - install -Dm644 "${pkgdir}/opt/depot_tools/LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" - - # Move manual pages to /usr/share/man - install -dm755 "${pkgdir}/usr/share/man" - mv "${pkgdir}/opt/depot_tools/man"/man[0-8] "${pkgdir}/usr/share/man/" - - # Ditto for HTML pages and README files, to /usr/share/doc - install -dm755 "${pkgdir}/usr/share/doc/${pkgname}" - mv "${pkgdir}/opt/depot_tools/man/html" "${pkgdir}/usr/share/doc/${pkgname}" - mv "${pkgdir}/opt/depot_tools"/README* "${pkgdir}/usr/share/doc/${pkgname}" - - # Remove stray files - rm -r "${pkgdir}/opt/depot_tools/man" - - # We depend on the "ninja" package, so the wrapper script which chooses a - # prebuilt version of it or makes a local build is not needed at all, so - # those are removed and a wrapper script which runs the system-installed - # /usr/bin/ninja is created instead. - rm "${pkgdir}/opt/depot_tools"/ninja* - cat > "${pkgdir}/opt/depot_tools/ninja" <<-EOF - #! /bin/sh - exec /usr/bin/ninja - EOF - chmod 755 "${pkgdir}/opt/depot_tools/ninja" - - # some commands (e.g., gsutil) calls vpython directly - install -Ddm755 "$pkgdir"/usr/bin - ln -s /opt/depot_tools/vpython "$pkgdir"/usr/bin/vpython - - rm -rf "${pkgdir}/opt/depot_tools/.git" +package() { + install -d "$pkgdir/opt/" + cp -r "$srcdir/depot_tools/" "$pkgdir/opt/depot_tools/" + chmod 775 "$pkgdir/opt/depot_tools/" + + rm -rf "$pkgdir/opt/depot_tools/.git/" + + # Make Windows files non-executable + chmod a-x "$pkgdir/opt/depot_tools/"*.{bat,exe} + + # TODO: Consider removing unneeded files, for example: + # .git{ignore,attributes} + # *OWNERS + # WATCHLISTS + # bootstrap/ + # infra/ + # ninja-{mac,linux32} + # *.{bat,exe} + # testing_support/ + # tests/ + # win32imports.py + # win_toolchain/ + + # Install license + install -d "$pkgdir/usr/share/licenses/$pkgname/" + mv "$pkgdir/opt/depot_tools/LICENSE" "$pkgdir/usr/share/licenses/$pkgname/" + + # Install man pages + install -d "$pkgdir/usr/share/man/" + mv "$pkgdir/opt/depot_tools/man/"man[0-8]/ "$pkgdir/usr/share/man/" + + # Install docs + install -d "$pkgdir/usr/share/doc/$pkgname/" + mv "$pkgdir/opt/depot_tools/man/html/" "$pkgdir/usr/share/doc/$pkgname/" + mv "$pkgdir/opt/depot_tools/"README* "$pkgdir/usr/share/doc/$pkgname/" + + # Remove man/ leftovers + rm -r "$pkgdir/opt/depot_tools/man/" + + # Install bash completions + install -d "$pkgdir/usr/share/bash-completion/completions/" + mv "$pkgdir/opt/depot_tools/gclient_completion.sh" "$pkgdir/usr/share/bash-completion/completions/gclient" + mv "$pkgdir/opt/depot_tools/git_cl_completion.sh" "$pkgdir/usr/share/bash-completion/completions/git-cl" + + # TODO: Install zsh-goodies/? } diff --git a/depot-tools-git.install b/depot-tools-git.install new file mode 100644 index 000000000000..299828e628ba --- /dev/null +++ b/depot-tools-git.install @@ -0,0 +1,19 @@ +post_install() { + cat <<- EOF + depot_tools is installed in /opt/depot_tools/. + This directory is not in \$PATH by default, so make sure to export PATH=/opt/depot_tools:\$PATH before using it. + Also, this directory has root permissions, so either use it as root, or if you want to use it as your currect user: + + # groupadd depot_tools + # gpasswd -a \$(whoami) depot_tools + # setfacl -m g:depot_tools:rwX /opt/depot_tools/ + + Then re-login as your current user or log your terminal in to the newly created group: + + $ newgrp depot_tools + EOF +} + +post_remove() { + rm -r opt/depot_tools/ +} diff --git a/depot_tools.install b/depot_tools.install deleted file mode 100644 index c7ab750ed0ce..000000000000 --- a/depot_tools.install +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -_prompt_modify_path() -{ - cat << EOF ->>>> Add export PATH="\${PATH}:/opt/depot_tools" to .bashrc/.zshrc or setenv PATH "\${PATH}:/opt/depot_tools" to ~/.tcshrc if you don't find any depot_tools related commands." -EOF -} - -post_install() -{ - echo ">>>> Please note that this tools and some related projects (for example ChromeOS) use python2." - echo ">>>> They assume that python2 is the default python interpreter. ArchLinux default is python3, so be prepared to fix python references in your works." - echo ">>>> This package contains a repo_fix.sh script. Use it to fix python2 references in python's script created after 'repo init' command" - echo ">>>> For getting started with depot_tools, visit this page: https://dev.chromium.org/developers/how-tos/depottools" - _prompt_modify_path -} - -post_upgrade() -{ - _prompt_modify_path -} diff --git a/fixshebangs.py b/fixshebangs.py deleted file mode 100755 index eda559437d47..000000000000 --- a/fixshebangs.py +++ /dev/null @@ -1,74 +0,0 @@ -#! /usr/bin/env python2 -# -*- coding: utf-8 -*- -# vim:fenc=utf-8 -# -# Copyright © 2015 Adrian Perez <aperez@igalia.com> -# -# Distributed under terms of the MIT license. - -from os import path, unlink, fstat, utime, chmod - - -VERBOSE = False -def verbose(fmt, *arg): - if VERBOSE: - from sys import stdout - stdout.write(fmt % arg) - - -def is_python_shebang(line): - return line.startswith("#!") and \ - (line.split()[-1].startswith("python") or - line.split("/")[-1].startswith("python")) - - -def add_shebang(fpath, fd, shebang=None): - if shebang is None: - shebang = "#! /usr/bin/env python2" - - # Save metadata of the open file. - stat = fstat(fd.fileno()) - - # Unlink the original file name. The contents will be available - # for reading as long as we keep an open file descriptor to it. - unlink(fpath) - - # Write new shebang as first line, then the original contents - with open(fpath, "w") as outfd: - outfd.write(shebang) - outfd.write("\n") - [outfd.write(chunk) for chunk in fd] - - # Restore original file metadata. - utime(fpath, (stat.st_atime, stat.st_mtime)) - chmod(fpath, stat.st_mode) - - -def check_files(arg, dirname, fnames): - assert arg is None - for fname in fnames: - if fname.startswith("."): - continue - fpath = path.join(dirname, fname) - if not path.isfile(fpath) or path.islink(fpath): - continue - with open(fpath, "rU") as fd: - line = fd.readline().strip() - if is_python_shebang(line): - verbose("Fixing: %s\n", fpath) - add_shebang(fpath, fd) - else: - verbose("Skipped: %s\n", fpath) - - -if __name__ == "__main__": - import sys - argv = sys.argv[1:] - if len(argv) > 0 and argv[0] in ("-v", "--verbose"): - VERBOSE = True - argv = argv[1:] - - if len(argv) == 0: - argv.append(".") - - [path.walk(top, check_files, None) for top in argv] diff --git a/gsutil-use-google-cloud-sdk.patch b/gsutil-use-google-cloud-sdk.patch deleted file mode 100644 index 89549951f765..000000000000 --- a/gsutil-use-google-cloud-sdk.patch +++ /dev/null @@ -1,54 +0,0 @@ -diff --git a/gsutil.py b/gsutil.py -index 8bfed540e..cca9d4b50 100755 ---- a/gsutil.py -+++ b/gsutil.py -@@ -82,45 +82,10 @@ def temporary_directory(base): - shutil.rmtree(tmpdir) - - def ensure_gsutil(version, target, clean): -- bin_dir = os.path.join(target, 'gsutil_%s' % version) -- gsutil_bin = os.path.join(bin_dir, 'gsutil', 'gsutil') -- gsutil_flag = os.path.join(bin_dir, 'gsutil', 'install.flag') -- # We assume that if gsutil_flag exists, then we have a good version -- # of the gsutil package. -- if not clean and os.path.isfile(gsutil_flag): -- # Everything is awesome! we're all done here. -- return gsutil_bin -- -- if not os.path.exists(target): -- os.makedirs(target) -- with temporary_directory(target) as instance_dir: -- # Clean up if we're redownloading a corrupted gsutil. -- cleanup_path = os.path.join(instance_dir, 'clean') -- try: -- os.rename(bin_dir, cleanup_path) -- except (OSError, IOError): -- cleanup_path = None -- if cleanup_path: -- shutil.rmtree(cleanup_path) -- -- download_dir = os.path.join(instance_dir, 'download') -- target_zip_filename = download_gsutil(version, instance_dir) -- with zipfile.ZipFile(target_zip_filename, 'r') as target_zip: -- target_zip.extractall(download_dir) -- -- try: -- os.rename(download_dir, bin_dir) -- except (OSError, IOError): -- # Something else did this in parallel. -- pass -- # Final check that the gsutil bin exists. This should never fail. -- if not os.path.isfile(gsutil_bin): -- raise InvalidGsutilError() -- # Drop a flag file. -- with open(gsutil_flag, 'w') as f: -- f.write('This flag file is dropped by gsutil.py') -- -- return gsutil_bin -+ candidate = '/opt/google-cloud-sdk/platform/gsutil/gsutil' -+ if os.path.exists(candidate): -+ return candidate -+ raise RuntimeError('Please install google-cloud-sdk package to use gsutil') - - - def run_gsutil(force_version, fallback, target, args, clean=False): diff --git a/repo_fix.sh b/repo_fix.sh deleted file mode 100755 index a6d720ee794f..000000000000 --- a/repo_fix.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -# usage: repo_fix.sh directory -# Fix python2 references in .repo/repo folder created after 'repo init' command -# Needed for work in ArchLinux! Or fix it by yourself! - -# Check for a valid parameter -if [ -z $1 ]; then - echo "Usage: repo_fix.sh repo_dir" -else - # Check for a valid directory - if [ -d $1 ]; then - # Check for a valid repo repository - if [ -d $1/.repo ]; then - echo "repo repository found (maybe). Proced with patching." - cd $1/.repo/repo - # Patching all python scripts. - # In my test with Android and ChromeOS repository, only main.py requires a patch, but I don't know if this thing will change in the future. - # So we will patch every python script! - for file in *.py - do - echo "Patching $file" - sed 's/"exec" python /"exec" python2 /' $file > $file.tmp - install -Dm 755 $file.tmp $file - rm $file.tmp - done - else - echo "This directory does not contain a valid repo repository!" - fi - else - echo "Invalid directory!" - fi -fi diff --git a/vpython-use-system-python2.patch b/vpython-use-system-python2.patch deleted file mode 100644 index a1d8a8d13a2e..000000000000 --- a/vpython-use-system-python2.patch +++ /dev/null @@ -1,22 +0,0 @@ -diff --git a/vpython b/vpython -index 9befaa690..03ebe525b 100755 ---- a/vpython -+++ b/vpython -@@ -4,7 +4,7 @@ - # Use of this source code is governed by a BSD-style license that can be - # found in the LICENSE file. - --if [[ $VPYTHON_BYPASS == "manually managed python not supported by chrome operations" ]] -+if [[ 1 ]] - then - NEWARGS=() - while [[ $# -gt 0 ]] -@@ -30,7 +30,7 @@ then - ;; - esac - done -- exec "python" "${NEWARGS[@]}" -+ exec "python2" "${NEWARGS[@]}" - fi - - |