parent
b5d8fcd306
commit
9808ca4159
|
@ -1,134 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# gopm-lite
|
||||
# a shell script to download, extract, and link
|
||||
# dependencies from a .gopmfile
|
||||
# requirements: curl, coreutils
|
||||
|
||||
# Needed environment variables:
|
||||
# GOPATH - packages will be linked to $GOPATH/src/
|
||||
# GOPMSTORE - where to store downloaded packages
|
||||
|
||||
# Optional environment variables
|
||||
# MAXDEPTH - Maximum amount of attempts to recurse
|
||||
# and download all packages
|
||||
# Defaults to 5
|
||||
|
||||
# Needed arguments:
|
||||
# 1 - path to a .gopmfile
|
||||
|
||||
if [ -z "$GOPATH" -o -z "$GOPMSTORE" ]; then
|
||||
printf 'Need the following environment variables defined:\n'
|
||||
printf 'GOPATH\n'
|
||||
printf 'GOPMSTORE\n'
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "$1" ]; then
|
||||
printf 'Usage: %s /path/to/.gopmfile\n' "$0"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$MAXDEPTH" ]; then
|
||||
MAXDEPTH=5
|
||||
fi
|
||||
|
||||
export MAXDEPTH
|
||||
export GOPATH
|
||||
export GOPMSTORE
|
||||
|
||||
mkdir -p "${GOPATH}/src"
|
||||
mkdir -p "${GOPMSTORE}/archives"
|
||||
mkdir -p "${GOPMSTORE}/repos"
|
||||
|
||||
indeps=""
|
||||
curdepth=0
|
||||
|
||||
download_and_link() {
|
||||
local gopmfile=$1
|
||||
local extracted_counter=0
|
||||
printf 'Downloading deps for %s\n' "$gopmfile" 1>&2
|
||||
while read line; do
|
||||
if [ "$line" = "[deps]" ]; then
|
||||
indeps="deps"
|
||||
continue
|
||||
fi
|
||||
if [ -z "$line" -a -n "$indeps" ]; then
|
||||
break;
|
||||
fi
|
||||
if [ -z "$indeps" ]; then
|
||||
continue;
|
||||
fi
|
||||
|
||||
host=""
|
||||
user=""
|
||||
package=""
|
||||
tagish=""
|
||||
|
||||
url=$(printf '%s' "$line" | cut -f1 -d'=' | sed 's/ //g');
|
||||
version=$(printf '%s' "$line" | cut -f2 -d'=' | sed 's/ //g');
|
||||
|
||||
host=$(printf '%s' "$url" | cut -f1 -d'/')
|
||||
user=$(printf '%s' "$url" | cut -f2 -d'/')
|
||||
package=$(printf '%s' "$url" | cut -f3 -d'/')
|
||||
|
||||
if [ -z "$package" ]; then
|
||||
package="${user}"
|
||||
fi
|
||||
|
||||
|
||||
if [ "$host" = "gopkg.in" ]; then
|
||||
host="github.com"
|
||||
if [ "$user" = "$package" ]; then
|
||||
package=$(printf '%s' "$package" | cut -f1 -d'.')
|
||||
user="go-$package"
|
||||
else
|
||||
package=$(printf '%s' "$package" | cut -f1 -d'.')
|
||||
fi
|
||||
|
||||
fi
|
||||
if [ "$host" = "golang.org" ]; then
|
||||
host="github.com"
|
||||
user="golang"
|
||||
fi
|
||||
|
||||
if [ -n "$version" ]; then
|
||||
tagish=$(printf '%s' "$version" | cut -f2 -d':')
|
||||
else
|
||||
tagish="master"
|
||||
fi
|
||||
|
||||
if [ ! -e "$GOPMSTORE/archives/$host-$user-$package-$tagish.tar.gz" ]; then
|
||||
curl --silent -R -L -o "$GOPMSTORE/archives/$host-$user-$package-$tagish.tar.gz" "https://$host/$user/$package/archive/$tagish.tar.gz"
|
||||
fi
|
||||
if [ ! -e "$GOPMSTORE/repos/$url.$tagish" ]; then
|
||||
mkdir -p "$GOPMSTORE/repos/$url.$tagish"
|
||||
tar xf "$GOPMSTORE/archives/$host-$user-$package-$tagish.tar.gz" -C "$GOPMSTORE/repos/$url.$tagish" --strip-components=1
|
||||
fi
|
||||
|
||||
if [ ! -e "$GOPATH/src/$url" ]; then
|
||||
mkdir -p "$GOPATH/src/$url"
|
||||
rmdir "$GOPATH/src/$url"
|
||||
ln -s "$GOPMSTORE/repos/$url.$tagish" "$GOPATH/src/$url"
|
||||
extracted_counter=$((extracted_counter+1))
|
||||
fi
|
||||
|
||||
done <"$gopmfile"
|
||||
printf '%s' "$extracted_counter"
|
||||
}
|
||||
|
||||
packages_processed=$(download_and_link $1)
|
||||
printf 'Done with %s packages\n' "$packages_processed" 1>&2
|
||||
curdepth=1
|
||||
|
||||
export -f download_and_link
|
||||
|
||||
while [ ! "$packages_processed" = "0" ]; do
|
||||
if [ "$curdepth" = "$MAXDEPTH" ]; then
|
||||
break
|
||||
fi
|
||||
packages_processed=$(find -L "$GOPATH/src" -name '.gopmfile' -exec bash -c 'download_and_link "$0"' {} \; | awk '{s+=$1} END {print s}')
|
||||
curdepth=$((curdepth+1))
|
||||
printf 'Done with %s packages\n' "$packages_processed" 1>&2
|
||||
done
|
||||
|
||||
exit 0
|
|
@ -1,7 +1,7 @@
|
|||
# Template build file for 'gogs'
|
||||
pkgname=gogs
|
||||
version=0.11.29
|
||||
revision=3
|
||||
version=0.11.34
|
||||
revision=1
|
||||
build_style=go
|
||||
go_import_path="github.com/gogits/gogs"
|
||||
short_desc="Self-hosted Git Service in Go"
|
||||
|
@ -10,7 +10,7 @@ license="MIT"
|
|||
homepage="http://gogs.io"
|
||||
depends="git"
|
||||
distfiles="https://github.com/gogits/gogs/archive/v${version}.tar.gz"
|
||||
checksum=3da2799e85d78ae36bc78725b4f19d409d45949831bb9aa306af43e851b89b13
|
||||
checksum=cc6b51cc53b6effed44c37ac7086af5822e2ceff9e2589316782e6c7b28a445f
|
||||
hostmakedepends="git-perl curl"
|
||||
|
||||
conf_files="/etc/gogs.ini"
|
||||
|
@ -20,24 +20,24 @@ gogs_shell="/bin/bash"
|
|||
|
||||
export CGO_ENABLED=1
|
||||
|
||||
broken=https://build.voidlinux.eu/builders/i686_builder/builds/4423/steps/shell_3/logs/stdio
|
||||
|
||||
post_extract() {
|
||||
mkdir tmp
|
||||
mkdir -p $GOPATH/src/github.com/gogits
|
||||
ln -s $PWD $GOPATH/src/github.com/gogits/${pkgname}
|
||||
TMPDIR=${PWD}/tmp/ GOPMSTORE=${PWD}/tmp/gopm ${FILESDIR}/gopm-lite .gopmfile 1>/dev/null 2>/dev/null
|
||||
TMPDIR=${PWD}/tmp/ go get -d -tags "sqlite redis memcache" "github.com/gogits/gogs"
|
||||
cd "$GOPATH/src/github.com/gogits/gogs"
|
||||
TMPDIR=${PWD}/tmp/ GOPATH=$GOPATH go get -d -tags "sqlite redis memcache" "github.com/gogits/gogs"
|
||||
}
|
||||
|
||||
do_build() {
|
||||
TMPDIR=${PWD}/tmp/ GOOS=linux go build -tags "sqlite redis memcache"
|
||||
cd "$GOPATH/src/github.com/gogits/gogs"
|
||||
TMPDIR=${PWD}/tmp/ GOOS=linux GOPATH=$GOPATH go build -tags "sqlite redis memcache"
|
||||
rm -rf tmp
|
||||
}
|
||||
|
||||
do_install() {
|
||||
cd "$GOPATH/src/github.com/gogits/gogs"
|
||||
vbin gogs-${version} gogs
|
||||
vbin gogs gogs
|
||||
install -d "$DESTDIR/usr/share/themes/gogs/default"
|
||||
cp -r public "$DESTDIR/usr/share/themes/gogs/default/"
|
||||
cp -r templates "$DESTDIR/usr/share/themes/gogs/default/"
|
||||
|
|
Loading…
Reference in New Issue