summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xabslibre-commit3
-rwxr-xr-xfullpkg33
-rwxr-xr-xlibrecommit34
-rwxr-xr-xlibremakepkg2
-rwxr-xr-xtoru97
5 files changed, 123 insertions, 46 deletions
diff --git a/abslibre-commit b/abslibre-commit
index 8922cc0..e906fbd 100755
--- a/abslibre-commit
+++ b/abslibre-commit
@@ -27,7 +27,8 @@ for _pkg in ${@}; do
unset pkgbase pkgname
source ${_pkg}/PKGBUILD
- git stage ${_pkg}/*
+# use . instead of * will use .gitignore
+ git stage ${_pkg}/.
git commit -m "${pkgbase:-$pkgname}-${pkgver}-${pkgrel}"
done
diff --git a/fullpkg b/fullpkg
index 33dd4f2..b7f09ba 100755
--- a/fullpkg
+++ b/fullpkg
@@ -205,17 +205,17 @@ function find_deps {
# if search pkgname in repo doesn't work
# this should find pkgsplits
-# elif _dir=($(find "$ABSROOT/${_repo}" -type f -name PKGBUILD -print0 2>/dev/null | \
-# "xargs" -0 -e grep -HEw "pkgname=|pkgbase=|provides=" | grep -w "$_dep" 2>&1));
-# then
-# _dir=$(dirname $(echo $_dir | cut -d: -f1))
-# plain "guess for $_dep -> $_dir"
-# pushd $_dir > /dev/null
-# $0 -c -d ${build_dir} -l ${next_level}
-## Circular deps must fail
-# [ $? -eq 20 ] && return 20
-# popd > /dev/null
-# break 1 # found, go to next dep
+ elif _dir=($(find "$ABSROOT/${_repo}" -type f -name PKGBUILD -print0 2>/dev/null | \
+ "xargs" -0 -e grep -HEw "pkgname=|pkgbase=|provides=" | grep -w "$_dep" 2>&1));
+ then
+ _dir=$(dirname $(echo $_dir | cut -d: -f1))
+ plain "guess for $_dep -> $_dir"
+ pushd $_dir > /dev/null
+ $0 -c -d ${build_dir} -l ${next_level}
+# Circular deps must fail
+ [ $? -eq 20 ] && return 20
+ popd > /dev/null
+ break 1 # found, go to next dep
else
echo "dep_not_found:$_dep:$_repo" >> $build_dir/log
@@ -281,8 +281,9 @@ function _pkg_build () {
source .INFO && [ -n $repo ] && {
# Calls a local release script if it's used
- [ -z "$HOOKLOCALRELEASE" ] || \
- $HOOKLOCALRELEASE $repo *.pkg.tar.?z
+ [ -z $HOOKLOCALRELEASE ] || \
+ find -name "*.pkg.tar.?z" -print0 | \
+ xargs -0 $HOOKLOCALRELEASE $repo
# Stage for releasing
librestage $repo || {
@@ -290,7 +291,7 @@ function _pkg_build () {
}
msg "Updating pacman db and packages"
- sudo pacman -Sy
+ sudo pacman -Sy || true
}
echo "built:$(basename $PWD)" >> $build_dir/log
@@ -374,7 +375,7 @@ while getopts 'ha:b:cCd:l:nm:r:o' arg; do
usage
exit 1
}
- [ -e ${build_dir}/BUILDORDER ] && {
+ [ ! -r ${build_dir}/BUILDORDER ] && {
error "${build_dir}/BUILDORDER doesn't exist."
exit 1
};;
@@ -458,7 +459,7 @@ find_deps || {
else
rsync -e ssh -aq $PARABOLAHOST:mips64el/ban >/dev/null 2>&1 || {
- warning "Failed to get ban list" && [ -r $ban_file ] && {
+ warning "Failed to get ban list" && [ -r ${ban_file} ] && {
# Use local copy of ban file if it is avaliable and continue.
search=$(cat ${ban_file} | tr "\n" "|")
diff --git a/librecommit b/librecommit
index bec5915..9444bd9 100755
--- a/librecommit
+++ b/librecommit
@@ -21,19 +21,43 @@
source /etc/libretools.conf
usage () {
- printf "$(gettext "cd to the dir with the PKGBUILD you are commiting and %s")" "$0"
+ echo "cd to the dir with the PKGBUILD you are commiting and"
+ echo
+ echo "$0 [optionally files to commit]"
+ echo
+ echo "This script commits the package using name, pkgver an pkgver"
echo
- printf "$(gettext "This script commits the package using name, pkgver an pkgver")"
}
+msg='Commiting libre package $pkg-$pkgver-$pkgrel'
+files=""
+
+for opt in $@ ; do
+ case ${opt} in
+ h) usage ;;
+ m) msg=${OPTARG} ;;
+ *) files+="${opt} " ;;
+ esac
+done
+
if [ ! -e PKGBUILD ]; then exit 1; fi
source PKGBUILD
-pkg=$pkgbase
+pkg=${pkgbase:-${pkgname}}
+
+if [ ${COMMITCD} = 'git' ]; then
+
+ ${COMMITCD} add $@ && ${COMMITCD} -m ""
+
+elif [ ${COMMITCD} = 'hg' ]; then
+
+ ${COMMITCMD} commit $@ -m -v || exit 1
+
+else
-if [ ${#pkg} -eq 0 ]; then pkg=$pkgname; fi
+ error "COMMITCD is not correctly set on libretools.conf"
-$COMMITCMD commit $@ -m "Commiting libre package $pkg-$pkgver-$pkgrel" -v || exit 1
+fi
exit 0
diff --git a/libremakepkg b/libremakepkg
index 58dc352..2226f81 100755
--- a/libremakepkg
+++ b/libremakepkg
@@ -89,7 +89,7 @@ msg "Creating the package"
makechrootpkg $_CLEAN -r ${CHROOTDIR} -l "${chrootname}" $_PKGINSTALL -- $_MAKEPKG_ARGS
ev=$? # exit value
-[ $ev -ne 0 -a "$use_log" == 'y' -a -e ${CHROOTDIR}/${chrootname}/build/*.log ] && {
+[ "$use_log" == 'y' -a -e ${CHROOTDIR}/${chrootname}/build/*.log ] && {
cp ${CHROOTDIR}/${chrootname}/build/*.log ./
}
exit $ev
diff --git a/toru b/toru
index 9716744..1ae336b 100755
--- a/toru
+++ b/toru
@@ -2,46 +2,97 @@
# Queries the ABS
# License: GPL3
-# TODO
+## TODO
# * Add license text
-# * Use libremessages
+# * Add everything
+# * Compare pacman sync against ABS (db-functions could be useful)
+# * Create symlinks from pkgbase to pkgname[@] for easy package finding
+
+## GOALS
+# * Have a searchable database of PKGBUILD metadata
+# * Have an interface for source-only builds
+# * Possibility to hook up ABS dirs besides ABSROOT
+# * Tell updates and non available binary packages
source /etc/abs.conf
source /etc/libretools.conf
+[ ! -w / ] && {
+ error "This script must be run as root."
+ exit 1
+}
+
+# This is the syncfile, stores the last date as content and mtime
+lastsyncfile=${ABSROOT}/toru.lastsync
+
TMPDIR=$(mktemp -d)
[[ -z ${TMPDIR} ]] && exit 1
-update() {
- pushd ${ABSROOT} >/dev/null
+# Stores the lastsync date
+lastsync() {
+ [ -e ${lastsyncfile} -a ! -w ${lastsyncfile} ] && {
+ error "The sync date can't be saved. ${lastsyncfile} isn't writable."
+ return 1
+ }
-# Find all the PKGBUILDs newer than the last update
- find * -type f -name 'PKGBUILD' -newer ${ABSROOT}/toru >> ${TMPDIR}/update.list
+ date +%s > ${lastsyncfile}
+ touch ${lastsyncfile}
+}
+
+# Adds a field=value on the package description
+addfield() {
+}
- while read _pkgbuild; do
- pushd $(dirname ${_pkgbuild}) >/dev/null
+# Updates the database by finding all PKGBUILDS
+# Args:
+update() {
+# Find all the PKGBUILDs newer than the last update
+# Update newer, otherwise everything
+ if [ ! -e ${lastsyncfile} -o "${force}" = "y" ]; then
+ msg "Forcing upgrade"
+ pkgbuilds=($(find ${@} -maxdepth 2 -type f -name 'PKGBUILD'))
+ else
+ pkgbuilds=($(find ${@} -maxdepth 2 -type f -name 'PKGBUILD' -newer ${lastsyncfile}))
+ fi
+
+# Inform how many PKGBUILDS were found and quit immediately if none
+ msg "Found $((${#pkgbuilds[*]}-1)) packages to update"
+ [ ${#pkgbuilds[*]} -eq 1 ] && {
+ msg2 "There's nothing to be done. Phew!"
+ exit 0
+ }
+
+ for _pkgbuild in ${pkgbuilds[@]}; do
+
+# The repo name is guessed
+# You *must* use repo/pkgbase structure
+ _pkgpath=$(dirname "${_pkgbuild}")
+ _pkgbase=$(basename "${_pkgpath}")
+ _pkgrepo=$(basename $(dirname "${_pkgpath}"))
+
+ msg2 "Updating ${_pkgrepo}/${_pkgbase}"
+
+ source ${_pkgbuild}
+
+ for _pkg in ${pkgname[@]}; do
+ done
- unset pkgbase pkgname pkgver pkgrel
+ unset pkgbase pkgname pkgver pkgrel source
- source PKGBUILD
+ done
- for _pkg in ${pkgbase:-${pkgname[@]}}; do
- dir="${TMPDIR}/packages/${_pkg}-${pkgver}-${pkgver}"
- mkdir -p "${dir}"
+ lastsync
- echo "${ABSROOT}/${_pkgbuild}" >> "${dir}/path"
+}
- done
- popd >/dev/null
- done < ${TMPDIR}/update.list
- popd >/dev/null
+## MAIN
+command=${1:-update}; shift
+force=${1:-n}; shift
+dirs=${@}
- last_update
-}
+${command} ${dirs[@]}
-last_update() {
- touch ${ABSROOT}/toru
-}
+exit $?