summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdrian Perez de Castro2014-07-07 17:26:23 +0300
committerAdrian Perez de Castro2015-06-15 01:11:14 +0200
commit04feefeccc7be0f5d8f82f64a3d75f6e9cfbba5a (patch)
tree9030ba5447641593928162e6105709f0270e8323
downloadaur-04feefeccc7be0f5d8f82f64a3d75f6e9cfbba5a.tar.gz
depot-tools-git: Initial import
-rw-r--r--.SRCINFO28
-rw-r--r--PKGBUILD101
-rw-r--r--depot_tools.install19
-rwxr-xr-xdepot_tools.sh1
-rwxr-xr-xrepo_fix.sh32
5 files changed, 181 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 00000000000..41f6d706fed
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,28 @@
+pkgbase = depot-tools-git
+ pkgdesc = Build tools for working with Chromium development, include gclient
+ pkgver = r2379.05fb911
+ pkgrel = 1
+ url = http://dev.chromium.org/developers/how-tos/install-depot-tools
+ install = depot_tools.install
+ arch = any
+ license = Custom
+ makedepends = git
+ makedepends = scons
+ makedepends = setconf
+ depends = python2
+ depends = python2-colorama
+ depends = python2-pylint
+ 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 = depot_tools.sh
+ source = repo_fix.sh
+ md5sums = SKIP
+ md5sums = 39d5d3e78fa7456a1d8dd5ac10a1c8bb
+ md5sums = fb0c546a078c312aa64c1f2a31599557
+
+pkgname = depot-tools-git
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 00000000000..8c4caef4424
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,101 @@
+# Maintainer: Adrian Perez <aperez@igalia.com>
+# Contributor: rway <rway07@gmail.com>
+# Contributor: wabi <aschrafl@jetnet.ch>
+# Contributor: Alexander Rødseth <rodseth@gmail.com>
+# Contributor: Andreas Schrafl <aschrafl@gmail.com>
+# Contributor: piojo <aur@zwell.net>
+# Contributor: hack.augusto <hack.augusto@gmail.com>
+
+pkgname=depot-tools-git
+pkgver=r2379.05fb911
+pkgrel=1
+pkgdesc='Build tools for working with Chromium development, include gclient'
+arch=('any')
+url='http://dev.chromium.org/developers/how-tos/install-depot-tools'
+source=("${pkgname}::git+https://chromium.googlesource.com/chromium/tools/depot_tools.git"
+ 'depot_tools.sh' 'repo_fix.sh')
+license=('Custom')
+depends=('python2' 'python2-colorama' 'python2-pylint')
+makedepends=('git' 'scons' 'setconf')
+provides=('depot_tools' 'gclient')
+conflicts=('gclient-svn' 'depot_tools-svn')
+options=('!strip')
+md5sums=('SKIP'
+ '39d5d3e78fa7456a1d8dd5ac10a1c8bb'
+ 'fb0c546a078c312aa64c1f2a31599557')
+install="depot_tools.install"
+
+pkgver () {
+ cd "${pkgname}"
+ 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.
+ msg "Patching script for python2 usage..."
+ for script in *.py
+ do
+ sed -i -r -e 's/#!(.*)python.*/#!\1python2/' "${script}"
+ done
+
+ # Fixing gclient.py
+ sed -i -r -e 's/#!(.*)python.*/#!\1python2/' \
+ -e 's/from third_party import colorama/import colorama/' \
+ -e 's/from third_party.colorama import Fore/from colorama import Fore/' \
+ gclient.py
+
+ # Fixing repo
+ sed -r -i -e 's/"exec" python/"exec" python2/' repo
+
+ # Fixing scripts in root folder
+ for script in {apply_issue,drover,gcl,git-cl,git-gs,git-try,hammer,weekly,wtf,update_depot_tools}
+ do
+ sed -r -i -e 's/exec python/exec python2/' \
+ -e 's/#!(.*)python.*/#!\1python2/' \
+ "${script}"
+ done
+
+ # Fixing scripts in other folders
+ # Is it safe remove those folders?? I don't now, further tests required. For now fix it and include all tools.
+ sed -r -i -e 's/python/python2/' git-cl-upload-hook
+
+ for script in {git_utils/git-tree-prune,support/chromite_wrapper,tests/sample_pre_commit_hook,third_party/pylint/epylint.py}
+ do
+ sed -r -i -e 's/env python/env python2/' "${script}"
+ done
+
+ for folder in {testing_support,tests,third_party}
+ do
+ cd "${folder}"
+ for script in *.py
+ do
+ sed -r -i -e 's/env python/env python2/' "${script}"
+ done
+ cd ..
+ done
+}
+
+package()
+{
+ # Creating directories
+ install -d "${pkgdir}/opt"
+
+ cp -r "${srcdir}/${pkgname}" "${pkgdir}/opt/"
+
+ # Export PATH
+ install -Dm755 "${srcdir}/depot_tools.sh" "${pkgdir}/etc/profile.d/depot_tools.sh"
+
+ # Install repo_fix.sh script
+ install -Dm 755 "${srcdir}/repo_fix.sh" "${pkgdir}/opt/${pkgname}"
+
+ # Install License
+ install -Dm644 "${pkgdir}/opt/${pkgname}/LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
+
+ rm -rf "${pkgdir}/opt/${pkgname}/.git"
+}
diff --git a/depot_tools.install b/depot_tools.install
new file mode 100644
index 00000000000..7f8d306c794
--- /dev/null
+++ b/depot_tools.install
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+post_install()
+{
+ source /etc/profile
+
+ 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: http://dev.chromium.org/developers/how-tos/depottools"
+ echo ">>>> Run 'source /etc/profile' if you don't find any depot_tools related commands."
+}
+
+post_upgrade()
+{
+ source /etc/profile
+
+ echo ">>>> Run 'source /etc/profile' if you don't find any depot_tools related commands."
+}
diff --git a/depot_tools.sh b/depot_tools.sh
new file mode 100755
index 00000000000..9fcd6abb09a
--- /dev/null
+++ b/depot_tools.sh
@@ -0,0 +1 @@
+export PATH="${PATH}:/opt/depot-tools-git"
diff --git a/repo_fix.sh b/repo_fix.sh
new file mode 100755
index 00000000000..a6d720ee794
--- /dev/null
+++ b/repo_fix.sh
@@ -0,0 +1,32 @@
+#!/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