summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile5
-rw-r--r--config.mk30
-rwxr-xr-xsrc/abslibre-tools/createworkdir6
-rwxr-xr-xsrc/abslibre-tools/librerelease2
-rwxr-xr-xsrc/abslibre-tools/librestage8
-rw-r--r--src/lib/conf.sh14
-rw-r--r--src/libretools.conf2
-rw-r--r--src/xbs-abs/.gitignore1
-rw-r--r--src/xbs-abs/Makefile12
-rwxr-xr-xsrc/xbs-abs/helper-abs183
-rw-r--r--src/xbs-abs/xbs-abs.conf10
-rw-r--r--src/xbs-abslibre/Makefile3
-rwxr-xr-xsrc/xbs-abslibre/helper-abslibre137
-rw-r--r--src/xbs/Makefile2
-rwxr-xr-xsrc/xbs/xbs147
-rw-r--r--src/xbs/xbs.conf1
16 files changed, 536 insertions, 27 deletions
diff --git a/Makefile b/Makefile
index feff83f..e7c46ec 100644
--- a/Makefile
+++ b/Makefile
@@ -4,7 +4,7 @@ include config.mk
################################################################################
# these are the resulting packages
-packages=doc libretools libretools-mips64el librelib gitget
+packages=doc libretools libretools-mips64el librelib gitget xbs xbs-abs xbs-abslibre
# and which directories they contain
doc=doc
libretools=\
@@ -18,6 +18,9 @@ libretools=\
libretools-mips64el=src/mips64el-tools
librelib=src/lib
gitget=src/gitget
+xbs=src/xbs
+xbs-abs=src/xbs-abs
+xbs-abslibre=src/xbs-abslibre
################################################################################
diff --git a/config.mk b/config.mk
index 548d4d3..a835102 100644
--- a/config.mk
+++ b/config.mk
@@ -4,22 +4,22 @@
# Note: In the default version of this file, commented out values indicate what
# the GNU standards dictate, when our values differ.
-DESTDIR=
+DESTDIR ?=
-#prefix=/usr/local
-prefix=/usr
-exec_prefix=$(prefix)
-bindir=$(exec_prefix)/bin
-#libexecdir=$(exec_prefix)/libexec
-libexecdir=$(exec_prefix)/lib
+#prefix ?= /usr/local
+prefix ?= /usr
+exec_prefix ?= $(prefix)
+bindir ?= $(exec_prefix)/bin
+#libexecdir ?= $(exec_prefix)/libexec
+libexecdir ?= $(exec_prefix)/lib
-datarootdir=$(prefix)/share
-datadir=$(datarootdir)
-#sysconfdir=$(prefix)/etc
-sysconfdir=/etc
+datarootdir ?= $(prefix)/share
+datadir ?= $(datarootdir)
+#sysconfdir ?= $(prefix)/etc
+sysconfdir ?= /etc
-docdir=$(datarootdir)/doc
-mandir=$(datarootdir)/man
+docdir ?= $(datarootdir)/doc
+mandir ?= $(datarootdir)/man
-devtoolsdir=$(topdir)/../devtools-par
-RONNFLAGS=--manual='libretools Manual' --organization='Parabola'
+devtoolsdir ?= $(topdir)/../devtools-par
+RONNFLAGS ?= --manual='libretools Manual' --organization='Parabola'
diff --git a/src/abslibre-tools/createworkdir b/src/abslibre-tools/createworkdir
index 8e5ebcd..8176cce 100755
--- a/src/abslibre-tools/createworkdir
+++ b/src/abslibre-tools/createworkdir
@@ -28,7 +28,7 @@ set -euE
. libremessages
. $(librelib conf.sh)
load_files libretools
-check_vars libretools WORKDIR REPOS ABSLIBRERECV ABSLIBRESEND
+check_vars libretools WORKDIR ABSLIBRERECV ABSLIBRESEND # these are asked for by `xbs download`
trap 'error "Aborting..."' EXIT
@@ -38,7 +38,7 @@ mkdir -p "$WORKDIR"
msg "Creating staging directory in WORKDIR..."
mkdir -p "$WORKDIR/staging"
-cmd=(gitget -f -p "$ABSLIBRESEND" checkout "$ABSLIBRERECV" "$WORKDIR/abslibre")
+cmd=(xbs -b abslibre download)
if ! "${cmd[@]}"; then
error "Could not clone ABSLibre"
plain "Try running this command:"
@@ -49,6 +49,6 @@ if ! "${cmd[@]}"; then
fi
msg "Finished, your packaging directory tree looks like this now:"
-ls --color=always "${WORKDIR}"/*
+ls --color=auto "${WORKDIR}"/*
trap -- EXIT
diff --git a/src/abslibre-tools/librerelease b/src/abslibre-tools/librerelease
index 03a57e0..e3869e9 100755
--- a/src/abslibre-tools/librerelease
+++ b/src/abslibre-tools/librerelease
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
# Librerelease
-# Uploads packages into [staging]
+# Uploads packages and releases them
# Copyright (C) 2010-2012 Joshua Ismael Haase Hernández (xihh) <hahj87@gmail.com>
# Copyright (C) 2010-2013 Nicolás Reynolds <fauno@parabola.nu>
diff --git a/src/abslibre-tools/librestage b/src/abslibre-tools/librestage
index 1e208c9..d566fa9 100755
--- a/src/abslibre-tools/librestage
+++ b/src/abslibre-tools/librestage
@@ -37,7 +37,7 @@ usage() {
main() {
if [[ -w / ]]; then
- error "This program should be run as regular user"
+ error "This program should be run as a regular user"
return 1
fi
@@ -51,13 +51,13 @@ main() {
repos=("$@")
if [[ ${#repos[@]} -eq 0 ]]; then
usage >&2
- return 1;
+ return 1
fi
- [[ ! -e ./PKGBUILD ]] && {
+ if ! [[ -e ./PKGBUILD ]]; then
error "PKGBUILD not found"
return 1
- }
+ fi
# Load configuration
load_files libretools
diff --git a/src/lib/conf.sh b/src/lib/conf.sh
index 2730b57..1aa7b56 100644
--- a/src/lib/conf.sh
+++ b/src/lib/conf.sh
@@ -51,6 +51,14 @@ list_files() {
echo "$LIBREHOME/.$slug.conf"
fi
;;
+ xbs)
+ echo /etc/$slug.conf
+ echo "$XDG_CONFIG_HOME/$slug.conf"
+ ;;
+ xbs*)
+ echo /etc/xbs.d/$slug.conf
+ echo "$XDG_CONFIG_HOME/xbs.d/$slug.conf"
+ ;;
libretools)
echo /etc/$slug.conf
echo "$XDG_CONFIG_HOME/libretools/$slug.conf"
@@ -76,8 +84,10 @@ list_envvars() {
GPGKEY PACKAGER
;;
libretools)
- printf '%s\n' \
- DIFFPROG
+ printf '%s\n' DIFFPROG
+ ;;
+ xbs)
+ printf '%s\n' BUILDSYSTEM
;;
*) :;;
esac
diff --git a/src/libretools.conf b/src/libretools.conf
index 12c4392..3999849 100644
--- a/src/libretools.conf
+++ b/src/libretools.conf
@@ -15,7 +15,7 @@ BLACKLIST=https://repo.parabolagnulinux.org/docs/blacklist.txt
DIFFPROG=`which kdiff3 meld gvimdiff vimdiff colordiff diff 2>/dev/null|sed 's/\s.*//;1q'`
## The repos you'll be packaging for
-## Used by `toru`, `createworkdir`
+## Used by `toru`
# Tip: As early repos take precedence on $REPOS loops, you can use this as
# inverted order of precedence. Put testing repos first so fullpkg find new
# PKGBUILDs first, for instance. Toru-path uses reverse order to enforce repo
diff --git a/src/xbs-abs/.gitignore b/src/xbs-abs/.gitignore
new file mode 100644
index 0000000..41ee0f5
--- /dev/null
+++ b/src/xbs-abs/.gitignore
@@ -0,0 +1 @@
+archrelease*
diff --git a/src/xbs-abs/Makefile b/src/xbs-abs/Makefile
new file mode 100644
index 0000000..7582592
--- /dev/null
+++ b/src/xbs-abs/Makefile
@@ -0,0 +1,12 @@
+pkgconfdir = $(sysconfdir)/xbs
+bindir = $(libexecdir)/xbs
+pkglibexecdir = $(libexecdir)/xbs/helper-abs.d
+copy_files = archrelease.in
+libs = archrelease
+include ../../common.mk
+
+archrelease: %: %.in
+ @echo "GEN $@"
+ @$(edit) <"$<" >"$@" || { rm -f -- '$@'; false; }
+ @sed -i '/valid-tags\.sh/d' '$@' || { rm -f -- '$@'; false; }
+ @chmod 755 "$@" || { rm -f -- '$@'; false; }
diff --git a/src/xbs-abs/helper-abs b/src/xbs-abs/helper-abs
new file mode 100755
index 0000000..d2baf42
--- /dev/null
+++ b/src/xbs-abs/helper-abs
@@ -0,0 +1,183 @@
+#!/bin/bash
+
+# Copyright (C) 2013 Luke Shumaker <lukeshu@sbcglobal.net>
+#
+# For code from db-functions (arch_svn):
+# Copyright (C) 2012 Pierre Schmitz <pierre@archlinux.de>
+# For code from db-move+db-remove (move+unrelease):
+# Copyright (C) 2008-2009 Aaron Griffin <aaronmgriffin@gmail.com>
+# Copyright (C) 2009 Abhishek Dasgupta <abhidg@gmail.com>
+# Copyright (C) 2009, 2011 Dan McGee <dan@archlinux.org>
+# Copyright (C) 2009-2012 Pierre Schmitz <pierre@archlinux.de>
+# For code just from db-move (move):
+# Copyright (C) 2011 Rémy Oudompheng <remyoudompheng@gmail.com>
+# Copyright (C) 2012 Florian Pritz <bluewind@xinu.at>
+# For code just from db-remove (unrelease):
+# Copyright (C) 2009 Eric Bélanger <snowmaniscool@gmail.com>
+# Copyright (C) 2011 Florian Pritz <bluewind@xinu.at>
+#
+# License: GNU GPLv2+
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+load_config() {
+ . $(librelib conf.sh)
+ load_files xbs-abs
+ # SVNUSER is optional
+ check_vars SVNDIR SVNREPOS ARCHES || exit 1
+}
+
+# This is taken from dbscripts:db-fuctions
+arch_svn() {
+ if [[ -z "${SVNUSER}" ]]; then
+ /usr/bin/svn "${@}"
+ else
+ sudo -u "${SVNUSER}" -- /usr/bin/svn --username "${USER}" "${@}"
+ fi
+}
+
+pac2svn() {
+ local pacrepo=$1
+
+ # Figure out which svn repo we need
+ local svnrepoStr
+ for svnrepoStr in "${SVNREPOS[@]}"; do
+ local svnrepoAry=($svnrepoStr)
+ local svnrepo=${svnrepoAry[0]}
+ local svnurl=${svnrepoAry[1]}
+ local pacrepos=("${svnrepoAry[@]:2}")
+
+ if in_array "$pacrepo" "${pacrepos[@]}"; then
+ echo "$svnrepo"
+ return 0
+ fi
+ done
+ return 1
+}
+
+status() {
+ load_config
+ [[ -z $(arch_svn status -q) ]]
+}
+
+download() {
+ load_config
+
+ local svnrepoStr
+ for svnrepoStr in "${SVNREPOS[@]}"; do
+ local svnrepoAry=($svnrepoStr)
+ local svnrepo=${svnrepoAry[0]}
+ local svnurl=${svnrepoAry[1]}
+ local pacrepos=("${svnrepoAry[@]:2}")
+
+ if [[ -d "$SVNDIR/$svnrepo/.svn" ]]; then
+ arch_svn -q up "$SVNDIR/$svnrepo"/*
+ else
+ # checkout non-recursive, then lazy load
+ # nescessary because:
+ # > DO NOT CHECK OUT THE ENTIRE SVN REPO. Your address
+ # > may be blocked.
+ arch_svn -q checkout -N "$svnurl" "$SVNDIR/$svnrepo"
+ fi
+ done
+}
+
+release() {
+ local repo=$1
+ local arch=$2
+
+ local tmpdir="$(mktemp -dt "xbs-abs-release.XXXXXXXXXX")"
+ trap "$(printf 'rm -rf -- %q' "$tmpdir")" EXIT
+
+ printf '%s\n' \
+ '#!/bin/bash' \
+ "$(declare -f arch_svn)" \
+ 'arch_svn "$@"' \
+ > "$tmpdir/svn"
+ chmod 755 "$tmpdir/svn"
+
+ PATH="$tmpdir:$PATH" "${0}.d/archrelease" -f "${repo}-${arch}"
+}
+
+unrelease() {
+ local pkgbase=$1
+ local repo=$2
+ local arch=$3
+
+ local tag="$repo-$arch"
+
+ load_config
+ local svndir="${SVNDIR}/$(pac2svn "$repo")/${pkgbase}"
+ arch_svn up -q "$svndir"
+
+ # This is based off code from dbscripts:db-remove
+ arch_svn rm --force -q "${svndir}/repos/${tag}"
+ arch_svn commit -q "${svndir}" -m "${0##*/}: $pkgbase removed by $(id -un)"
+}
+
+move() {
+ local repo_from=$1
+ local repo_to=$2
+ local pkgbase=$3
+
+ load_config
+ local svndir="${SVNDIR}/$(pac2svn "$repo")/${pkgbase}"
+ arch_svn up -q "$svndir"
+
+ local tag_list=""
+ local pkgarch
+ local arches=()
+ # this is based off code from dbscripts:db-move
+ for pkgarch in "${ARCHES[@]}" 'any'; do
+ dir_from="${svndir}/repos/${repo_from}-${pkgarch}"
+ dir_to="${svndir}/repos/${repo_to}-${pkgarch}"
+
+ if [ -f "${dir_from}/PKGBUILD" ]; then
+ if [ -d "${dir_to}" ]; then
+ for file in $(arch_svn ls "${dir_to}"); do
+ arch_svn rm -q "${dir_to}/$file@"
+ done
+ else
+ mkdir "${dir_to}"
+ arch_svn add -q "${dir_to}"
+ fi
+
+ for file in $(arch_svn ls "${dir_from}"); do
+ arch_svn mv -q -r HEAD "${dir_from}/$file@" "${dir_to}/"
+ done
+ arch_svn rm --force -q "${dir_from}"
+ tag_list="$tag_list, $pkgarch"
+ arches+=("$pkgarch")
+ fi
+ done
+ tag_list="${tag_list#, }"
+ arch_svn commit -q "${svndir}" -m "${0##*/}: moved ${pkgbase} from [${repo_from}] to [${repo_to}] (${tag_list})"
+ echo "${arches[*]}"
+}
+
+releasepath() {
+ local pkgbase=$1
+ local repo=$2
+ local arch=$3
+
+ load_config
+ local svndir="${SVNDIR}/$(pac2svn "$repo")/${pkgbase}"
+ arch_svn up -q "${svndir}"
+ echo "${svndir}/repos/${repo}-${arch}"
+}
+
+case "$1" in
+ status|download|release|unrelease|move|releasepath) "$@";;
+ *) exit 127;;
+esac
diff --git a/src/xbs-abs/xbs-abs.conf b/src/xbs-abs/xbs-abs.conf
new file mode 100644
index 0000000..3ceba6a
--- /dev/null
+++ b/src/xbs-abs/xbs-abs.conf
@@ -0,0 +1,10 @@
+SVNDIR=/var/lib/xbs-abs
+#SVNUSER=
+
+# name url repos...
+SVNREPOS=(
+ 'packages svn://svn.archlinux.org/packages core extra testing'
+ 'commuity svn://svn.archlinux.org/community community community-testing multilib multilib-testing'
+)
+
+ARCHES=(i686 x86_64)
diff --git a/src/xbs-abslibre/Makefile b/src/xbs-abslibre/Makefile
new file mode 100644
index 0000000..cbe09fa
--- /dev/null
+++ b/src/xbs-abslibre/Makefile
@@ -0,0 +1,3 @@
+pkgconfdir = $(sysconfdir)/xbs
+pkglibexecdir = $(libexecdir)/xbs
+include ../../common.mk
diff --git a/src/xbs-abslibre/helper-abslibre b/src/xbs-abslibre/helper-abslibre
new file mode 100755
index 0000000..57d8369
--- /dev/null
+++ b/src/xbs-abslibre/helper-abslibre
@@ -0,0 +1,137 @@
+#!/bin/bash
+
+# Copyright (C) 2012-2013 Luke Shumaker <lukeshu@sbcglobal.net>
+#
+# License: GNU GPLv2+
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Here's the idea:
+# We have two sources of abslibre:
+# - git - does not include packages imported directly from Arch Linux
+# - rsync - is read-only
+# They should be identical, except for the mentioned differences.
+#
+
+status() {
+ [[ -z $(git status -s .) ]]
+}
+
+download() {
+ . $(librelib conf)
+ load_files libretools
+ check_vars libretools WORKDIR ABSLIBRERECV || return 1
+
+ # Get the Parabola-added git repo
+ libregit "$ABSLIBRERECV" master "$WORKDIR/abslibre" || return 1
+ # This bit configures a 'pushUrl' to use ssh, leaves plain https for
+ # 'url' (used for fetch).
+ if [[ -n ${ABSLIBRESEND:-} ]]; then
+ pushd "$WORKDIR/abslibre" >/dev/null
+ local pushUrl="$(git config --get remote.origin.pushUrl)"
+ if [[ $? != 0 ]]; then
+ git config remote.origin.pushUrl "$ABSLIBRESEND";
+ elif [[ $pushUrl != "$ABSLIBRESEND" ]]; then
+ warning "A %s is configured for %s, but it doesn't match %s" pushUrl "$WORKDIR/abslibre" "$ABSLIBRESEND"
+ fi
+ popd >/dev/null
+ fi
+
+ # Get the everything-included tree
+ abs
+}
+
+release() {
+ local repo=$1
+ local arch=$2
+
+ . libremessages
+ . $(librelib conf)
+ load_files libretools
+ check_vars libretools WORKDIR || return 1
+ local lookupfile="${WORKDIR}/abslibre.xbs-lookup"
+
+ read mode type sha1 file <<<"$(git ls-tree -d --full-tree HEAD "$(pwd)")"
+
+ lock 9 "$lookupfile.lock" "Waiting for lock on %s" "$lookupfile"
+ {
+ sed "/^$repo $arch $pkgbase /d" < "$lookupfile"
+ echo "$repo $arch $pkgbase $sha1 $path"
+ } > "$lookupfile.$$"
+ mv "$lookupfile.$$" "$lookupfile"
+ lock_close 9
+}
+
+unrelease() {
+ local pkgbase=$1
+ local repo=$2
+ local arch=$3
+
+ . libremessages
+ . $(librelib conf)
+ load_files libretools
+ check_vars libretools WORKDIR || return 1
+ local lookupfile="${WORKDIR}/abslibre.xbs-lookup"
+
+ lock 9 "$lookupfile.lock" "Waiting for lock on %s" "$lookupfile"
+ sed -i "/^$repo $arch $pkgbase /d" "$lookupfile"
+ lock_close 9
+}
+
+move() {
+ local repo_from=$1
+ local repo_to=$2
+ local pkgbase=$3
+
+ . libremessages
+ . $(librelib conf)
+ load_files libretools
+ check_vars libretools WORKDIR || return 1
+ local lookupfile="${WORKDIR}/abslibre.xbs-lookup"
+
+ lock 9 "$lookupfile.lock" "Waiting for lock on %s" "$lookupfile"
+ sed -ri "s/^${repo_from} (\S+) $pkgbase /${repo_to} \1 $pkgbase/" "$lookupfile"
+ # TODO
+ lock_close 9
+ return 1
+}
+
+releasepath() {
+ local pkgbase=$1
+ local repo=$2
+ local arch=$3
+
+ local r=0
+ . $(librelib conf)
+ load_files libretools
+ check_vars libretools WORKDIR || r=$?
+ load_files abs
+ check_vars abs ABSROOT || r=$?
+
+ local abstree
+ local dir
+ for abstree in "$WORKDIR/abslibre" "$ABSROOT"; do
+ dir="$abstree/$repo/$pkgbase"
+ if [[ -f "$dir/PKGBUILD" ]]; then
+ printf '%s\n' "$dir"
+ return 0
+ fi
+ done
+ return 1
+}
+
+case "$1" in
+ status|download|release|unrelease|move|releasepath) "$@";;
+ *) exit 127;;
+esac
diff --git a/src/xbs/Makefile b/src/xbs/Makefile
new file mode 100644
index 0000000..fcb8ac2
--- /dev/null
+++ b/src/xbs/Makefile
@@ -0,0 +1,2 @@
+pkgconfdir = $(sysconfdir)
+include ../../common.mk
diff --git a/src/xbs/xbs b/src/xbs/xbs
new file mode 100755
index 0000000..6bd1af2
--- /dev/null
+++ b/src/xbs/xbs
@@ -0,0 +1,147 @@
+#!/bin/bash
+
+# Copyright (C) 2013 Luke Shumaker <lukeshu@sbcglobal.net>
+#
+# License: GNU GPLv2+
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. libremessages
+. $(librelib conf)
+
+errusage() {
+ if [[ $# -gt 0 ]]; then
+ error "$@"
+ fi
+ usage >&2
+ exit 1
+}
+
+usage() {
+ print 'Usage: %s [-b SYSTEM|-h] COMMAND [ARGUMENTS]' "${0##*/}"
+ print 'Tool for working with arbitrary ABS-like build systems'
+ echo
+ prose 'This is a pluggable tool. The BUILDSYSTEM it uses is configured in:'
+ bullet '/etc/xbs.conf'
+ bullet '${XDG_CONFIG_HOME}/xbs.conf'
+ bullet 'with the `-b` flag'
+ prose 'Later items take precidence over earlier ones.'
+ echo
+ prose 'It looks for a helper program at `/lib/xbs/helper-${BUILDSYSTEM}`.'
+ echo
+ print 'Options:'
+ flag "-b $(_ BUILDSYSTEM)" 'BUILDSYSTEM instead of the one configured in
+ xbs.conf'
+ flag '-h' 'Show this message'
+ echo
+ print 'Commands:'
+ flag 'status' \
+ 'Are there uncommited changes in `.`?'
+ flag 'download' \
+ 'Download or update the tree'
+ flag "release $(_ 'REPO ARCH')" \
+ 'Release `.`'
+ flag "unrelease $(_ 'PKGBASE REPO ARCH')" \
+ 'Unrelease a pkgbase'
+ flag "move $(_ 'FROMREPO TOREPO PKGBASE')" \
+ 'Move a pkgbase from one repo to another'
+ flag "releasepath $(_ 'PKGBASE REPO ARCH')" \
+ 'Print the path to the staged version of pkgbase'
+}
+
+status() {
+ if [[ ! -f PKGBUILD ]]; then
+ error 'PKGBUILD not found'
+ exit 1
+ fi
+ "$HELPER" status "$@"
+}
+
+download() {
+ "$HELPER" download "$@"
+}
+
+release() {
+ if [[ ! -f PKGBUILD ]]; then
+ error 'PKGBUILD not found'
+ exit 1
+ fi
+ if ! status; then
+ error 'You have not committed your changes yet!'
+ exit 1
+ fi
+ "$HELPER" release "$@"
+}
+
+unrelease() {
+ "$HELPER" unrelease "$@"
+}
+
+move() {
+ "$HELPER" move "$@"
+}
+
+releasepath() {
+ "$HELPER" releasepath "$@"
+}
+
+main() {
+ BUILDSYSTEM=''
+ while getopts 'b:h' arg; do
+ case $arg in
+ b) BUILDSYSTEM=$OPTARG;;
+ h) usage; return 0;;
+ *) errusage;;
+ esac
+ done
+ shift $(($OPTIND - 1))
+
+ if [[ -z $BUILDSYSTEM ]]; then
+ load_files xbs || return 1
+ check_vars xbs BUILDSYSTEM || return 1
+ fi
+
+ HELPER="/lib/xbs/helper-${BUILDSYSTEM}"
+ if [[ ! -x "$HELPER" ]]; then
+ error 'No helper for build system found: %s' "$BUILDSYSTEM"
+ return 1;
+ fi
+
+ if [[ $# -lt 1 ]]; then
+ errusage "Must specify a command"
+ fi
+
+ if [[ -w / ]]; then
+ error 'Run as a normal user'
+ fi
+
+ local cmd=$1; shift
+ case "$cmd" in
+ status|download)
+ [[ $# -eq 0 ]] || errusage 'bad number of argments'
+ $cmd "$@"
+ ;;
+ release)
+ [[ $# -eq 2 ]] || errusage 'bad number of argments'
+ $cmd "$@"
+ ;;
+ move|unrelease|releasepath)
+ [[ $# -eq 3 ]] || errusage 'bad number of argments'
+ $cmd "$@"
+ ;;
+ *) errusage 'unknown command: %s' "$cmd";;
+ esac
+}
+
+main "$@"
diff --git a/src/xbs/xbs.conf b/src/xbs/xbs.conf
new file mode 100644
index 0000000..caf8d8b
--- /dev/null
+++ b/src/xbs/xbs.conf
@@ -0,0 +1 @@
+BUILDSYSTEM=abs