diff options
author | Andrei Pozolotin | 2016-06-12 15:39:22 +0000 |
---|---|---|
committer | Andrei Pozolotin | 2016-06-12 15:39:22 +0000 |
commit | 4fbad3d32ae03701420991938d362e2f663971fd (patch) | |
tree | 7fcac0556cc04ad95c385161a40a3b4015bdbc57 | |
download | aur-4fbad3d32ae03701420991938d362e2f663971fd.tar.gz |
initial commit
-rw-r--r-- | .SRCINFO | 15 | ||||
-rw-r--r-- | .gitignore | 11 | ||||
-rw-r--r-- | PKGBUILD | 38 | ||||
-rw-r--r-- | acpush-aur.launch | 10 | ||||
-rwxr-xr-x | acpush-aur.launch.sh | 111 | ||||
-rwxr-xr-x | build.sh | 28 | ||||
-rw-r--r-- | lib.go.patch | 10 |
7 files changed, 223 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..5f0c79006f7e --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,15 @@ +pkgbase = acpush + pkgdesc = App Container Server Push Command + pkgver = 0.0.0 + pkgrel = 1 + url = https://github.com/appc/acpush + arch = i686 + arch = x86_64 + license = Apache + makedepends = git + makedepends = go + source = git+https://github.com/appc/acpush.git + md5sums = SKIP + +pkgname = acpush + diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000000..08eb2a15d553 --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +# eclipse meta data +.project + +# generated resources +/*/ +/*.xz +/*.log + +# build resources +gopath/ +bin/ diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..c8da6ee38776 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,38 @@ +pkgdesc='App Container Server Push Command' +pkgname=acpush +pkgver=0.0.0 # TODO pending release +pkgrel=1 +url="https://github.com/appc/$pkgname" +source=("git+${url}.git") +makedepends=('git' 'go') +arch=('i686' 'x86_64') +md5sums=('SKIP') +license=('Apache') + +# 1. +prepare() { # TODO pending release + local base=$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd) + local repo="$srcdir/$pkgname" # working repo location + local target=$([[ $pkgver == "0.0.0" ]] && printf "master" || printf "v$version") + git -C "$repo" checkout --quiet "$target" # checkout proper version + git -C "$repo" status # verify working repo change + cp -f $base/build.sh $repo/build # TODO this file is to come from upstream + patch -d "$repo" -p0 < "$base/lib.go.patch" +} + +# 2. +build() { + cd $pkgname + ./build +} + +# 3. +check() { + true +} + +# 4. +package() { + cd "$pkgname" + install -D "./bin/$pkgname" "$pkgdir/usr/bin/$pkgname" +} diff --git a/acpush-aur.launch b/acpush-aur.launch new file mode 100644 index 000000000000..12db00da9f52 --- /dev/null +++ b/acpush-aur.launch @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<launchConfiguration type="org.eclipse.ui.externaltools.ProgramLaunchConfigurationType"> +<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/> +<listAttribute key="org.eclipse.debug.ui.favoriteGroups"> +<listEntry value="org.eclipse.ui.externaltools.launchGroup"/> +</listAttribute> +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LAUNCH_CONFIGURATION_BUILD_SCOPE" value="${none}"/> +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/acpush-aur/acpush-aur.launch.sh}"/> +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/acpush-aur}"/> +</launchConfiguration> diff --git a/acpush-aur.launch.sh b/acpush-aur.launch.sh new file mode 100755 index 000000000000..78c49bad940d --- /dev/null +++ b/acpush-aur.launch.sh @@ -0,0 +1,111 @@ +#! /bin/bash + +# build package automation + +readonly location=$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd) +source $location/PKGBUILD + +is_root() { + [[ $(id -u) == 0 ]] +} + +has_makepkg() { + which makepkg >/dev/null 2>&1 +} + + +do_provision() { + if has_makepkg ; then + do_provision_proper + else + do_provision_simple + fi +} + +do_provision_proper() { + echo "// do_provision_proper" + local suno="" + if is_root ; then + chown -R nobody $location + suno="sudo -u nobody" + fi + $suno makepkg --force +} + +do_provision_simple() { + echo "// do_provision_simple" + local source="$url.git" + if [[ -e $pkgname ]] ; then + git -C $pkgname pull + else + git clone $source + fi +} + +do_version() { + #echo "version $pkgver -> $(pkgver)" + if has_makepkg; then + do_version_proper + else + do_version_simple + fi +} + +do_version_simple() { + echo "// do_version_simple" + + local pkgver=$(pkgver) + local file_list="PKGBUILD .SRCINFO" + + local file + for file in $file_list ; do + sed -r -i "s%^([ ]*pkgver[ ]*=[ ]*).*%\1$pkgver%" "$file" + sed -r -i "s%#tag=v[0-9]+%#tag=v$pkgver%" "$file" + done +} + +do_version_proper() { + echo "// do_version_proper" + + local suno="" + local user="nobody" + if is_root ; then + chown -R $user $location + suno="sudo -u $user" + fi + + $suno makepkg --printsrcinfo > .SRCINFO + +} + +do_commit() { + echo "// do_commit" + + git add --all :/ + git status + + local message=$(git status --short) + git commit --message "$message" + + git push + +} + +do_clean() { + echo "// clean" + rm -rf "$location/$pkgname" + rm -rf "$location/src" + rm -rf "$location/pkg" +} + +### + +#set -e + +do_provision + +do_version + +do_commit + +do_clean diff --git a/build.sh b/build.sh new file mode 100755 index 000000000000..20291de23448 --- /dev/null +++ b/build.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +set -e + +# TODO this file is to come from upstream +# made after prototype https://github.com/appc/acbuild/blob/master/build + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +NAME="acpush" +ORG_PATH="github.com/appc" +REPO_PATH="${ORG_PATH}/${NAME}" +VERSION=$(cd "${DIR}" && git describe --always) +GLDFLAGS="-X ${REPO_PATH}/lib.Version=${VERSION}" + +if [ ! -h gopath/src/${REPO_PATH} ]; then + mkdir -p gopath/src/${ORG_PATH} + ln -s ../../../.. gopath/src/${REPO_PATH} || exit 255 +fi + +export GOBIN=${DIR}/bin +export GOPATH=${DIR}/Godeps/_workspace:${DIR}/gopath + +eval $(go env) +export GOOS GOARCH +export CGO_ENABLED=1 + +echo "Building $NAME ..." +go build -o ${GOBIN}/${NAME} -ldflags "${GLDFLAGS}" ${REPO_PATH} diff --git a/lib.go.patch b/lib.go.patch new file mode 100644 index 000000000000..7ad02a90fce1 --- /dev/null +++ b/lib.go.patch @@ -0,0 +1,10 @@ +--- lib/lib.go 2016-06-12 15:17:59.198364508 +0000 ++++ lib/lib.go 2016-06-12 15:19:42.419076228 +0000 +@@ -23,7 +23,7 @@ + "io/ioutil" + "net/http" + "os" +- "runtime" ++ // "runtime" // https://github.com/appc/acpush/issues/3 + "strings" + "time" |