diff options
-rw-r--r-- | .SRCINFO | 12 | ||||
-rw-r--r-- | .gitignore | 12 | ||||
-rw-r--r-- | PKGBUILD | 29 | ||||
-rw-r--r-- | dgr-aur.launch | 10 | ||||
-rwxr-xr-x | dgr-aur.launch.sh | 111 |
5 files changed, 174 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..f200e9ec7da0 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,12 @@ +pkgbase = dgr + pkgdesc = dgr - container build and runtime tool + pkgver = 69 + pkgrel = 1 + url = https://github.com/blablacar/dgr + arch = x86_64 + license = Apache + source = https://github.com/blablacar/dgr/releases/download/69/dgr-linux-amd64-69.tar.gz + md5sums = SKIP + +pkgname = dgr + diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000000..ad27df29fdeb --- /dev/null +++ b/.gitignore @@ -0,0 +1,12 @@ +# eclipse meta data +.project + +# generated resources +/*/ +/*.xz +/*.gz +/*.log + +# build resources +gopath/ +bin/ diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..56fb4c719f54 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,29 @@ +pkgdesc='dgr - container build and runtime tool' +pkgname=dgr +pkgver=69 +pkgrel=1 +url="https://github.com/blablacar/$pkgname" +source=("$url/releases/download/$pkgver/$pkgname-linux-amd64-$pkgver.tar.gz") +arch=('x86_64') +md5sums=('SKIP') +license=('Apache') + +# 1. +prepare() { + true +} + +# 2. +build() { + true +} + +# 3. +check() { + true +} + +# 4. +package() { + install -D -m755 dgr "$pkgdir/usr/bin/dgr" +} diff --git a/dgr-aur.launch b/dgr-aur.launch new file mode 100644 index 000000000000..a7495e5a25a3 --- /dev/null +++ b/dgr-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:/dgr-aur/dgr-aur.launch.sh}"/> +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/dgr-aur}"/> +</launchConfiguration> diff --git a/dgr-aur.launch.sh b/dgr-aur.launch.sh new file mode 100755 index 000000000000..78c49bad940d --- /dev/null +++ b/dgr-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 |