diff options
author | Andrei Pozolotin | 2016-06-13 13:23:25 +0000 |
---|---|---|
committer | Andrei Pozolotin | 2016-06-13 13:23:25 +0000 |
commit | e464d0524414fa98c5d359f8a602f1c2db98e726 (patch) | |
tree | a52ced8d4a4ba13ea3fc8f715c94b4931c460c2a | |
download | aur-e464d0524414fa98c5d359f8a602f1c2db98e726.tar.gz |
initial commit
-rw-r--r-- | .SRCINFO | 19 | ||||
-rw-r--r-- | .gitignore | 8 | ||||
-rw-r--r-- | PKGBUILD | 52 | ||||
-rw-r--r-- | zinc-aur.launch | 10 | ||||
-rwxr-xr-x | zinc-aur.launch.sh | 111 | ||||
-rw-r--r-- | zincer.service | 24 | ||||
-rwxr-xr-x | zincer.sh | 41 |
7 files changed, 265 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..ff7b1e864702 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,19 @@ +pkgbase = zinc + pkgdesc = Zinc is a stand-alone version of sbt's incremental compiler + pkgver = 0.3.9 + pkgrel = 1 + url = https://github.com/typesafehub/zinc + arch = any + license = Apache + depends = java-environment + provides = zinc + conflicts = zinc-git + source = http://downloads.typesafe.com/zinc/0.3.9/zinc-0.3.9.tgz + source = zincer.sh + source = zincer.service + md5sums = SKIP + md5sums = SKIP + md5sums = SKIP + +pkgname = zinc + diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000000..ca9d158b8ecd --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +# eclipse meta data +.project + +# generated resources +/*/ +/*.xz +/*.tgz +/*.log diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..c53e555a7ef0 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,52 @@ +pkgdesc="Zinc is a stand-alone version of sbt's incremental compiler" +pkgname="zinc" +pkgver=0.3.9 +pkgrel=1 +url="https://github.com/typesafehub/zinc" +arch=('any') +license=('Apache') +depends=('java-environment') +provides=('zinc') +conflicts=('zinc-git') +source=( + "http://downloads.typesafe.com/zinc/$pkgver/zinc-$pkgver.tgz" + "zincer.sh" # server launcher + "zincer.service" # systemd service +) +md5sums=( + 'SKIP' + 'SKIP' + 'SKIP' +) + +# 1. +prepare() { + true +} + +# 2. +build() { + true +} + +# 3. +check() { + true +} + +# 4. +package() { + local home="/opt/zinc" + local source="$pkgname-$pkgver" + local target="$pkgdir/$home" + + mkdir -p "$target" + cp -a "$source/." "$target/" + + install -D -m755 zincer.sh "$target/zincer.sh" + install -D -m644 zincer.service "$pkgdir/usr/lib/systemd/system/zincer.service" + + mkdir -p $pkgdir/usr/bin + ln -s "$home/bin/zinc" "$pkgdir/usr/bin/zinc" + ln -s "$home/zincer.sh" "$pkgdir/usr/bin/zincer" +} diff --git a/zinc-aur.launch b/zinc-aur.launch new file mode 100644 index 000000000000..ed5d4aa960e7 --- /dev/null +++ b/zinc-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:/zinc-aur/zinc-aur.launch.sh}"/> +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/zinc-aur}"/> +</launchConfiguration> diff --git a/zinc-aur.launch.sh b/zinc-aur.launch.sh new file mode 100755 index 000000000000..78c49bad940d --- /dev/null +++ b/zinc-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/zincer.service b/zincer.service new file mode 100644 index 000000000000..6a58782a925b --- /dev/null +++ b/zincer.service @@ -0,0 +1,24 @@ + +[Unit] +Description=Zinc Server +Documentation=https://github.com/typesafehub/zinc + +[Service] +# +Environment=ZINC_HOME=/opt/zinc +Environment=ZINC_PORT=3030 +Environment=ZINC_TIMEOUT=0 +# +Environment=JAVA_EXEC=java +Environment=JAVA_META=512m +Environment=JAVA_HEAP=1024m +Environment=JAVA_CODE=256m +Environment=JAVA_STACK=1m +# +ExecStart=/bin/bash ${ZINC_HOME}/zincer.sh +# +Restart=on-failure +RestartSec=1s + +[Install] +WantedBy=multi-user.target diff --git a/zincer.sh b/zincer.sh new file mode 100755 index 000000000000..f846eb25c42d --- /dev/null +++ b/zincer.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +# zinc server launcher + +[[ $ZINC_HOME ]] || ZINC_HOME=/opt/zinc +[[ $ZINC_PORT ]] || ZINC_PORT=3030 +[[ $ZINC_TIMEOUT ]] || ZINC_TIMEOUT=0 + +[[ $JAVA_EXEC ]] || JAVA_EXEC=java +[[ $JAVA_META ]] || JAVA_META=512m +[[ $JAVA_HEAP ]] || JAVA_HEAP=1024m +[[ $JAVA_CODE ]] || JAVA_CODE=256m +[[ $JAVA_STACK ]] || JAVA_STACK=1m + +command="\ +\ +$JAVA_EXEC \ +\ +-server \ +-XX:+UseG1GC \ +-XX:+DoEscapeAnalysis \ +-XX:+UseCompressedOops \ +-XX:+UseCompressedClassPointers \ +-XX:+HeapDumpOnOutOfMemoryError \ +-XX:InitialHeapSize=$JAVA_HEAP \ +-XX:MaxHeapSize=$JAVA_HEAP \ +-XX:ThreadStackSize=$JAVA_STACK \ +-XX:MetaspaceSize=$JAVA_META \ +-XX:MaxMetaspaceSize=$JAVA_META \ +-XX:InitialCodeCacheSize=$JAVA_CODE \ +-XX:ReservedCodeCacheSize=$JAVA_CODE \ +\ +-Djava.net.preferIPv4Stack=true \ +\ +-Dzinc.home=$ZINC_HOME \ +-classpath $ZINC_HOME/lib/*:. \ +com.typesafe.zinc.Nailgun \ +$ZINC_PORT $ZINC_TIMEOUT \ +" + +exec $command |