summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Fanninger2015-08-23 15:39:26 +0200
committerThomas Fanninger2015-08-23 15:39:26 +0200
commitac4daf2193a1c5a35225f878a833a36b85c343d5 (patch)
treef8ee01920775c36bb58e50992fb204856ca13c1a
parent4c4755c13bd01829aa406166a7af9aec00e32a20 (diff)
downloadaur-ac4daf2193a1c5a35225f878a833a36b85c343d5.tar.gz
Update build script + add some workarounds
-rw-r--r--.SRCINFO15
-rw-r--r--PKGBUILD98
-rw-r--r--app.ini.patch20
-rw-r--r--app_new.ini79
-rw-r--r--app_old.ini76
-rw-r--r--helper.sh94
6 files changed, 302 insertions, 80 deletions
diff --git a/.SRCINFO b/.SRCINFO
index e0d3f83ddd35..39dfc1669d6e 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,6 +1,6 @@
pkgbase = gogs-git
pkgdesc = Gogs(Go Git Service) is a Self Hosted Git Service in the Go Programming Language. This is the current git version from branch master.
- pkgver = 20150317
+ pkgver = 20150823
pkgrel = 1
epoch = 1
url = http://gogs.io/
@@ -11,10 +11,9 @@ pkgbase = gogs-git
arch = armv7h
license = MIT
makedepends = go>=1.2
- makedepends = git
- makedepends = mercurial
+ makedepends = git>=1.7.1
makedepends = patch
- depends = git
+ depends = git>=1.7.1
optdepends = sqlite: SQLite support
optdepends = mariadb: MariaDB support
optdepends = postgresql: PostgreSQL support
@@ -23,15 +22,17 @@ pkgbase = gogs-git
optdepends = openssh: GIT over SSH support
conflicts = gogs-bin
conflicts = gogs
- conflicts = gogs-git-dev
+ conflicts = gogs-git
options = !strip
options = !emptydirs
backup = srv/gogs/conf/app.ini
source = gogs.service
source = app.ini.patch
- source = gogs::git+https://github.com/gogits/gogs.git
+ source = helper.sh
+ source = gogs::git+https://github.com/gogits/gogs.git#branch=master
sha512sums = 2b4303f850e3b13b2fc3c9f0bc5820dae431d228002b35f01be0d4bfbcf05de8dcec2a559a85e318b609e4a4d492d44306eadf5f6508fd72333b198661bb0bb7
- sha512sums = 9c3d8425cf0e5291e9a7870b9b0ceec4d3d0de3818e0bd93b6a9e9c954cf16e8f2ae230242d6cc0d71147ad10c4224322b1f4f2f8eb3ca5e96c219e9fc35d29b
+ sha512sums = 939be9ad851ae6e20b786e2e189b0b67c0198edfc8c83442934ec48c7be073e03c75172e79f23a6ee1e0eb467c6fa18096a66d69d1142ebba28fdc8bb2a3964c
+ sha512sums = e746dbdafc4c8d0b15a224dba95ae3151611ba9ff468ee6f0b1789e489955e4d7eaac0dbdf28a22e5b8211559af5950726f4a37d699a2490fd349f034401028c
sha512sums = SKIP
pkgname = gogs-git
diff --git a/PKGBUILD b/PKGBUILD
index 77d146131980..87552d86b370 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,71 +1,111 @@
# Contributor: Thomas Laroche <tho.laroche@gmail.com>
-# Contributor: Kristian Klausen <klausenbusk@hotmail.com>
# Maintainer: Thomas Fanninger <thomas@fanninger.at>
pkgname=gogs-git
_pkgname=gogs
-pkgver=20150317
+_branch=master
+pkgver=20150823
pkgrel=1
epoch=1
-pkgdesc="Gogs(Go Git Service) is a Self Hosted Git Service in the Go Programming Language. This is the current git version from branch master."
+pkgdesc="Gogs(Go Git Service) is a Self Hosted Git Service in the Go Programming Language. This is the current git version from branch ${_branch}."
arch=('i686' 'x86_64' 'armv6h' 'armv7h')
url="http://gogs.io/"
license=('MIT')
-depends=('git')
+depends=('git>=1.7.1')
optdepends=('sqlite: SQLite support'
'mariadb: MariaDB support'
'postgresql: PostgreSQL support'
'redis: Redis support'
'memcached: MemCached support'
'openssh: GIT over SSH support')
-makedepends=('go>=1.2' 'git' 'mercurial' 'patch')
-conflicts=('gogs-bin' 'gogs' 'gogs-git-dev')
+makedepends=('go>=1.2' 'git>=1.7.1' 'patch')
+conflicts=('gogs-bin' 'gogs' 'gogs-git')
options=('!strip' '!emptydirs')
backup=('srv/gogs/conf/app.ini')
install=gogs.install
-_gourl=github.com/gogits
+_gourl=github.com/gogits/$_pkgname
source=('gogs.service'
'app.ini.patch'
- "${_pkgname}::git+https://${_gourl}/${_pkgname}.git")
+ 'helper.sh'
+ "$_pkgname::git+https://${_gourl}.git#branch=${_branch}")
-sha512sums=('2b4303f850e3b13b2fc3c9f0bc5820dae431d228002b35f01be0d4bfbcf05de8dcec2a559a85e318b609e4a4d492d44306eadf5f6508fd72333b198661bb0bb7'
- '9c3d8425cf0e5291e9a7870b9b0ceec4d3d0de3818e0bd93b6a9e9c954cf16e8f2ae230242d6cc0d71147ad10c4224322b1f4f2f8eb3ca5e96c219e9fc35d29b'
+sha512sums=(2b4303f850e3b13b2fc3c9f0bc5820dae431d228002b35f01be0d4bfbcf05de8dcec2a559a85e318b609e4a4d492d44306eadf5f6508fd72333b198661bb0bb7
+ 939be9ad851ae6e20b786e2e189b0b67c0198edfc8c83442934ec48c7be073e03c75172e79f23a6ee1e0eb467c6fa18096a66d69d1142ebba28fdc8bb2a3964c
+ e746dbdafc4c8d0b15a224dba95ae3151611ba9ff468ee6f0b1789e489955e4d7eaac0dbdf28a22e5b8211559af5950726f4a37d699a2490fd349f034401028c
'SKIP')
+_goroot="/usr/lib/go"
+
pkgver(){
- cd "$srcdir/${_pkgname}"
+ cd "$srcdir/$_pkgname"
echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}
prepare() {
- mkdir -p "${srcdir}/src/${_gourl}"
- mv "${_pkgname}" "${srcdir}/src/${_gourl}/${_pkgname}"
- msg2 "go get"
- GOPATH="${srcdir}" go get -tags "sqlite redis memcache" "${_gourl}/${_pkgname}"
+ source $srcdir/helper.sh
+
+ export GOROOT=/usr/lib/go
+
+ msg2 "Prepare GO build enviroment"
+ rm -rf build
+ mkdir -p build/go
+ cd build/go
+
+ for f in "$GOROOT/"*; do
+ ln -s "$f"
+ done
+
+ rm pkg
+ mkdir pkg
+ cd pkg
+
+ for f in "$GOROOT/pkg/"*; do
+ ln -s "$f"
+ done
+
+ export GOROOT="$srcdir/build/go"
+ export GOPATH="$srcdir/build"
+
+ mkdir -p "$GOPATH/src/github.com/gogits"
- msg2 "Patch: GOGS app.ini"
- patch -Np1 -i "${srcdir}/app.ini.patch" "${srcdir}/src/${_gourl}/${_pkgname}/conf/app.ini"
+ mv "$srcdir/$_pkgname" $GOPATH/src/${_gourl}
+
+ msg2 "Check and download dependencies from .gopmfile"
+ get_gopm "$GOPATH/src/${_gourl}/.gopmfile" "$GOPATH/src"
+
+ msg2 "Download missing dependencies"
+ go_get github.com/shurcooL/sanitized_anchor_name "$GOPATH/src/github.com/shurcooL/sanitized_anchor_name"
+# go_get golang.org/x/net "$GOPATH/src/golang.org/x/net"
+# go_get golang.org/x/text "$GOPATH/src/golang.org/x/text"
+
+ msg2 "Workaround dependencies"
+ cd "$GOPATH/src/github.com/gogits/go-gogs-client/"
+ git checkout -q master
+
+ # Execute patch
+ msg2 "Execute patches"
+ patch -Np1 -i "$srcdir/app.ini.patch" "$GOPATH/src/${_gourl}/conf/app.ini"
}
build() {
+ cd $GOPATH/src/${_gourl}
+
msg2 "Build program"
- cd ${srcdir}/src/${_gourl}/${_pkgname}
- GOPATH="${srcdir}" go fix
- GOPATH="${srcdir}" go build -tags "sqlite redis memcache"
+ go fix
+ go build -x -tags='sqlite redis memcache'
}
package() {
- install -D -m 0755 "${srcdir}/src/${_gourl}/${_pkgname}/${_pkgname}" "${pkgdir}/usr/share/${_pkgname}/${_pkgname}"
+ install -Dm0755 "$srcdir/build/src/${_gourl}/$_pkgname" "$pkgdir/usr/share/$_pkgname/$_pkgname"
- cp -r "${srcdir}/src/${_gourl}/${_pkgname}/conf" "${pkgdir}/usr/share/${_pkgname}"
- install -d "${pkgdir}/usr/share/themes/gogs/default/"
- cp -r "${srcdir}/src/${_gourl}/${_pkgname}/public" "${pkgdir}/usr/share/themes/gogs/default"
- cp -r "${srcdir}/src/${_gourl}/${_pkgname}/templates" "${pkgdir}/usr/share/themes/gogs/default"
+ cp -r "$srcdir/build/src/${_gourl}/conf" "$pkgdir/usr/share/$_pkgname"
+ mkdir -p "$pkgdir/usr/share/themes/gogs/default/"
+ cp -r "$srcdir/build/src/${_gourl}/public" "$pkgdir/usr/share/themes/gogs/default"
+ cp -r "$srcdir/build/src/${_gourl}/templates" "$pkgdir/usr/share/themes/gogs/default"
- install -D -m 0600 "${pkgdir}/usr/share/${_pkgname}/conf/app.ini" "$pkgdir/srv/${_pkgname}/conf/app.ini"
- install -D -m 0644 "${srcdir}/gogs.service" "$pkgdir/usr/lib/systemd/system/gogs.service"
- install -d "${pkgdir}/var/log/gogs"
- install -D -m 0644 "${srcdir}/src/${_gourl}/${_pkgname}/LICENSE" "${pkgdir}/usr/share/licenses/$_pkgname"
+ install -Dm0644 "$pkgdir/usr/share/$_pkgname/conf/app.ini" "$pkgdir/srv/$_pkgname/conf/app.ini"
+ install -Dm0644 "$srcdir/gogs.service" "$pkgdir/usr/lib/systemd/system/gogs.service"
+ install -Dm0644 "$srcdir/build/src/${_gourl}/LICENSE" "$pkgdir/usr/share/licenses/$_pkgname"
}
diff --git a/app.ini.patch b/app.ini.patch
index bcc8d34be1bc..dd912fd9e8e1 100644
--- a/app.ini.patch
+++ b/app.ini.patch
@@ -1,36 +1,32 @@
-1,3d0
-< # NEVER EVER MODIFY THIS FILE
-< # PLEASE MAKE CHANGES ON CORRESPONDING CUSTOM CONFIG FILE
-<
-7c4
+7c7
< RUN_USER = git
---
> RUN_USER = gogs
-12c9
+12c12
< ROOT =
---
> ROOT = /srv/gogs/repo
-39c36
+43c43
< STATIC_ROOT_PATH =
---
> STATIC_ROOT_PATH = /usr/share/themes/gogs/default
-55c52
+59c59
< PATH = data/gogs.db
---
> PATH = /srv/gogs/sqlite/gogs.db
-174c171
+184c184
< PROVIDER_CONFIG = data/sessions
---
> PROVIDER_CONFIG = /srv/gogs/sessions
-189c186
+199c199
< AVATAR_UPLOAD_PATH = data/avatars
---
> AVATAR_UPLOAD_PATH = /srv/gogs/data/avatars
-198c195
+209c209
< PATH = data/attachments
---
> PATH = /srv/gogs/data/attachments
-213c210
+224c224
< ROOT_PATH =
---
> ROOT_PATH = /var/log/gogs
diff --git a/app_new.ini b/app_new.ini
index 4c35ef2e9a84..1a61538add51 100644
--- a/app_new.ini
+++ b/app_new.ini
@@ -1,3 +1,6 @@
+# NEVER EVER MODIFY THIS FILE
+# PLEASE MAKE CHANGES ON CORRESPONDING CUSTOM CONFIG FILE
+
; App name that shows on every page title
APP_NAME = Gogs: Go Git Service
; Change it if you run locally
@@ -9,6 +12,10 @@ RUN_MODE = dev
ROOT = /srv/gogs/repo
SCRIPT_TYPE = bash
+[ui]
+; Number of issues that are showed in one page
+ISSUE_PAGING_NUM = 10
+
[server]
PROTOCOL = http
DOMAIN = localhost
@@ -80,10 +87,12 @@ ENABLE_NOTIFY_MAIL = false
; More detail: https://github.com/gogits/gogs/issues/165
ENABLE_REVERSE_PROXY_AUTHENTICATION = false
ENABLE_REVERSE_PROXY_AUTO_REGISTRATION = false
+; Do not check minimum key size with corresponding type
+DISABLE_MINIMUM_KEY_SIZE_CHECK = false
[webhook]
-; Cron task interval in minutes
-TASK_INTERVAL = 1
+; Hook task queue length
+QUEUE_LENGTH = 1000
; Deliver timeout in seconds
DELIVER_TIMEOUT = 5
; Allow insecure certification
@@ -99,14 +108,18 @@ SUBJECT = %(APP_NAME)s
; Gmail: smtp.gmail.com:587
; QQ: smtp.qq.com:25
; Note, if the port ends with "465", SMTPS will be used. Using STARTTLS on port 587 is recommended per RFC 6409. If the server supports STARTTLS it will always be used.
-HOST =
+HOST =
+; Disable HELO operation when hostname are different.
+DISABLE_HELO =
+; Custom hostname for HELO operation, default is from system.
+HELO_HOSTNAME =
; Do not verify the certificate of the server. Only use this for self-signed certificates
SKIP_VERIFY =
; Use client certificate
USE_CERTIFICATE = false
CERT_FILE = custom/mailer/cert.pem
KEY_FILE = custom/mailer/key.pem
-; Mail from address, RFC 5322. This can be just an email address, or the "Name" <email@example.com> format
+; Mail from address, RFC 5322. This can be just an email address, or the `"Name" <email@example.com>` format
FROM =
; Mailer user name and password
USER =
@@ -185,6 +198,7 @@ SESSION_LIFE_TIME = 86400
SERVICE = server
AVATAR_UPLOAD_PATH = /srv/gogs/data/avatars
; Chinese users can choose "duoshuo"
+; or a custom avatar source, like: http://cn.gravatar.com/avatar/
GRAVATAR_SOURCE = gravatar
DISABLE_GRAVATAR = false
@@ -198,7 +212,7 @@ ALLOWED_TYPES = image/jpeg|image/png
; Max size of each file. Defaults to 32MB
MAX_SIZE = 32
; Max number of files per upload. Defaults to 10
-MAX_FILES = 10
+MAX_FILES = 5
[time]
; Specifies the format for fully outputed dates. Defaults to RFC1123
@@ -267,21 +281,54 @@ DRIVER =
; Based on xorm, e.g.: root:root@localhost/gogs?charset=utf8
CONN =
+[cron]
+; Enable running cron tasks periodically.
+ENABLED = true
+; Run cron tasks when Gogs starts.
+RUN_AT_START = false
+
+; Update mirrors
+[cron.update_mirrors]
+SCHEDULE = @every 1h
+
+; Repository health check
+[cron.repo_health_check]
+SCHEDULE = @every 24h
+; Arguments for command 'git fsck', e.g.: "--unreachable --tags"
+; see more on http://git-scm.com/docs/git-fsck/1.7.5
+ARGS =
+
+; Check repository statistics
+[cron.check_repo_stats]
+RUN_AT_START = true
+SCHEDULE = @every 24h
+
[git]
MAX_GIT_DIFF_LINES = 10000
; Arguments for command 'git gc', e.g.: "--aggressive --auto"
; see more on http://git-scm.com/docs/git-gc/1.7.5
GC_ARGS =
-; Git health check.
-[git.fsck]
-ENABLE = true
-; Execution interval in hours. Default is 24.
-INTERVAL = 24
-; Arguments for command 'git fsck', e.g.: "--unreachable --tags"
-; see more on http://git-scm.com/docs/git-fsck/1.7.5
-ARGS =
-
[i18n]
-LANGS = en-US,zh-CN,zh-HK,de-DE,fr-CA,nl-NL,lv-LV,ru-RU,ja-JP,es-ES,pt-BR
-NAMES = English,简体中文,繁體中文,Deutsch,Français,Nederlands,Latviešu,Русский,日本语,Español,Português
+LANGS = en-US,zh-CN,zh-HK,de-DE,fr-FR,nl-NL,lv-LV,ru-RU,ja-JP,es-ES,pt-BR,pl-PL,bg-BG,it-IT
+NAMES = English,简体中文,繁體中文,Deutsch,Français,Nederlands,Latviešu,Русский,日本語,Español,Português do Brasil,Polski,български,Italiano
+
+; Used for datetimepicker
+[i18n.datelang]
+en-US = en
+zh-CN = zh
+zh-HK = zh-TW
+de-DE = de
+fr-FR = fr
+nl-NL = nl
+lv-LV = lv
+ru-RU = ru
+ja-JP = ja
+es-ES = es
+pt-BR = pt-BR
+pl-PL = pl
+bg-BG = bg
+it-IT = it
+
+[other]
+SHOW_FOOTER_BRANDING = false \ No newline at end of file
diff --git a/app_old.ini b/app_old.ini
index c2f7495da495..9b8e4145dc0b 100644
--- a/app_old.ini
+++ b/app_old.ini
@@ -12,6 +12,10 @@ RUN_MODE = dev
ROOT =
SCRIPT_TYPE = bash
+[ui]
+; Number of issues that are showed in one page
+ISSUE_PAGING_NUM = 10
+
[server]
PROTOCOL = http
DOMAIN = localhost
@@ -83,10 +87,12 @@ ENABLE_NOTIFY_MAIL = false
; More detail: https://github.com/gogits/gogs/issues/165
ENABLE_REVERSE_PROXY_AUTHENTICATION = false
ENABLE_REVERSE_PROXY_AUTO_REGISTRATION = false
+; Do not check minimum key size with corresponding type
+DISABLE_MINIMUM_KEY_SIZE_CHECK = false
[webhook]
-; Cron task interval in minutes
-TASK_INTERVAL = 1
+; Hook task queue length
+QUEUE_LENGTH = 1000
; Deliver timeout in seconds
DELIVER_TIMEOUT = 5
; Allow insecure certification
@@ -102,14 +108,18 @@ SUBJECT = %(APP_NAME)s
; Gmail: smtp.gmail.com:587
; QQ: smtp.qq.com:25
; Note, if the port ends with "465", SMTPS will be used. Using STARTTLS on port 587 is recommended per RFC 6409. If the server supports STARTTLS it will always be used.
-HOST =
+HOST =
+; Disable HELO operation when hostname are different.
+DISABLE_HELO =
+; Custom hostname for HELO operation, default is from system.
+HELO_HOSTNAME =
; Do not verify the certificate of the server. Only use this for self-signed certificates
SKIP_VERIFY =
; Use client certificate
USE_CERTIFICATE = false
CERT_FILE = custom/mailer/cert.pem
KEY_FILE = custom/mailer/key.pem
-; Mail from address, RFC 5322. This can be just an email address, or the "Name" <email@example.com> format
+; Mail from address, RFC 5322. This can be just an email address, or the `"Name" <email@example.com>` format
FROM =
; Mailer user name and password
USER =
@@ -188,6 +198,7 @@ SESSION_LIFE_TIME = 86400
SERVICE = server
AVATAR_UPLOAD_PATH = data/avatars
; Chinese users can choose "duoshuo"
+; or a custom avatar source, like: http://cn.gravatar.com/avatar/
GRAVATAR_SOURCE = gravatar
DISABLE_GRAVATAR = false
@@ -201,7 +212,7 @@ ALLOWED_TYPES = image/jpeg|image/png
; Max size of each file. Defaults to 32MB
MAX_SIZE = 32
; Max number of files per upload. Defaults to 10
-MAX_FILES = 10
+MAX_FILES = 5
[time]
; Specifies the format for fully outputed dates. Defaults to RFC1123
@@ -270,21 +281,54 @@ DRIVER =
; Based on xorm, e.g.: root:root@localhost/gogs?charset=utf8
CONN =
+[cron]
+; Enable running cron tasks periodically.
+ENABLED = true
+; Run cron tasks when Gogs starts.
+RUN_AT_START = false
+
+; Update mirrors
+[cron.update_mirrors]
+SCHEDULE = @every 1h
+
+; Repository health check
+[cron.repo_health_check]
+SCHEDULE = @every 24h
+; Arguments for command 'git fsck', e.g.: "--unreachable --tags"
+; see more on http://git-scm.com/docs/git-fsck/1.7.5
+ARGS =
+
+; Check repository statistics
+[cron.check_repo_stats]
+RUN_AT_START = true
+SCHEDULE = @every 24h
+
[git]
MAX_GIT_DIFF_LINES = 10000
; Arguments for command 'git gc', e.g.: "--aggressive --auto"
; see more on http://git-scm.com/docs/git-gc/1.7.5
GC_ARGS =
-; Git health check.
-[git.fsck]
-ENABLE = true
-; Execution interval in hours. Default is 24.
-INTERVAL = 24
-; Arguments for command 'git fsck', e.g.: "--unreachable --tags"
-; see more on http://git-scm.com/docs/git-fsck/1.7.5
-ARGS =
-
[i18n]
-LANGS = en-US,zh-CN,zh-HK,de-DE,fr-CA,nl-NL,lv-LV,ru-RU,ja-JP,es-ES,pt-BR
-NAMES = English,简体中文,繁體中文,Deutsch,Français,Nederlands,Latviešu,Русский,日本语,Español,Português
+LANGS = en-US,zh-CN,zh-HK,de-DE,fr-FR,nl-NL,lv-LV,ru-RU,ja-JP,es-ES,pt-BR,pl-PL,bg-BG,it-IT
+NAMES = English,简体中文,繁體中文,Deutsch,Français,Nederlands,Latviešu,Русский,日本語,Español,Português do Brasil,Polski,български,Italiano
+
+; Used for datetimepicker
+[i18n.datelang]
+en-US = en
+zh-CN = zh
+zh-HK = zh-TW
+de-DE = de
+fr-FR = fr
+nl-NL = nl
+lv-LV = lv
+ru-RU = ru
+ja-JP = ja
+es-ES = es
+pt-BR = pt-BR
+pl-PL = pl
+bg-BG = bg
+it-IT = it
+
+[other]
+SHOW_FOOTER_BRANDING = false \ No newline at end of file
diff --git a/helper.sh b/helper.sh
new file mode 100644
index 000000000000..b32164d31d6b
--- /dev/null
+++ b/helper.sh
@@ -0,0 +1,94 @@
+#!/bin/bash
+
+# $1 = package name
+# $2 = target directory path
+# $3 = branch/commit/revision string, if empty then maste ist used
+function go_get {
+ if [[ $1 == github.com* ]]
+ then
+ get_git $1 $2 $3
+ elif [[ $1 == code.google.com* ]]
+ then
+ get_hg $1 $2 $3
+ elif [[ $1 == golang.org* ]]
+ then
+ get_golang $1 $2 $3
+ else
+ go get $1
+ fi
+}
+
+# $1 = git package
+# $2 = target directory path
+# $3 = branch/commit/revision string, if empty then maste ist used
+function get_git {
+ git clone https://$1 $2
+ if [[ $3 != "master" ]] && [[ ${3:0} == commit* ]]
+ then
+ cd $2
+ git checkout -q ${3:7}
+ elif [[ $3 != "master" ]] && [[ ${3:0} == tag* ]]
+ then
+ cd $2
+ git checkout -q tags/${3:4}
+ else
+ cd $2
+ git checkout -q ${3:7}
+ fi
+}
+
+# $1 = mercury package name
+# $2 = target directory path
+# $3 = branch/commit/revision string, if empty then maste ist used
+function get_hg {
+ if [[ $3 == "master" ]] || [[ $3 == "" ]]
+ then
+ hg clone https://$1 $2
+ else
+ hg clone https://$1 -r $3 $2
+ fi
+}
+
+function get_golang {
+ if [[ $1 == "golang.org/x/net" ]]
+ then
+ echo $1 $2 $3
+ get_git "github.com/golang/net" $2
+ elif [[ $1 == "golang.org/x/text" ]]
+ then
+ echo $1 $2 $3
+ get_git "github.com/golang/text" $2
+ else
+ echo $1 $2 $3
+ fi
+
+}
+
+# Read the .gopmfile file and clone the branch/commits of the depends
+# $1 = .gopmfile file path
+# $2 = target directory path
+function get_gopm {
+ local startStr=""
+ local revStr=""
+
+ while read line
+ do
+ if [[ $startStr == 'X' ]] && [[ $line == '' ]]
+ then
+ break
+ elif [[ $startStr == 'X' ]]
+ then
+ IFS="=" read -a array <<< "$line"
+ if [[ ${array[1]} != "" ]]
+ then
+ local revStr=${array[1]//\`}
+ go_get ${array[0]} "$2/${array[0]}" $revStr
+ else
+ go_get ${array[0]} "$2/${array[0]}" master
+ fi
+ elif [[ $line == '[deps]' ]]
+ then
+ local startStr="X"
+ fi
+ done <$1
+} \ No newline at end of file