summaryrefslogtreecommitdiff
path: root/treepkg
diff options
context:
space:
mode:
Diffstat (limited to 'treepkg')
-rwxr-xr-xtreepkg40
1 files changed, 22 insertions, 18 deletions
diff --git a/treepkg b/treepkg
index d21377d..8c4cc8e 100755
--- a/treepkg
+++ b/treepkg
@@ -18,12 +18,15 @@
source /etc/libretools.conf
source $XDG_CONFIG_HOME/libretools/libretools.conf >/dev/null 2>&1|| true
+term_title "$(basename $0)"
+
# Get system variables
source /etc/makepkg.conf
source $HOME/makepkg.conf >/dev/null 2>&1|| true
# End inmediately but print an useful message
trap_exit() {
+ term_title "error!"
error "($(basename $0)) $@ (leftovers on ${BUILDDIR})"
exit 1
}
@@ -81,16 +84,8 @@ bury() {
} || return 1
}
-# Finds a PKGBUILD on toru's path cache
-# Look in all caches but pick the first one
-# TODO move to a toru flag (-p?)
-where_is() {
- grep -m1 "^${1}:" "${TORUPATH}/paths" 2>/dev/null| \
- cut -d: -f2 2>/dev/null
-}
-
# Guess the repo from the pkgbase path
-# $1 path, pwd or where_is
+# $1 path, pwd or toru-where
guess_repo() {
basename "$(dirname "${1}")"
}
@@ -142,10 +137,12 @@ if ! ${BUILDNOW}; then
touch "${BUILDORDER}"
# If this package is already built quit silently
- if is_built "${pkgbase}" "${fullver}"; then
- add_order "ignore"
- exit 0
- fi
+ for _pkg in ${pkgname[@]}; do
+ if is_built "${_pkg}" "${fullver}"; then
+ add_order "ignore"
+ exit 0
+ fi
+ done
# Ignore if already in build order
egrep -q ";${pkgbase};" "${BUILDORDER}" && exit 0
@@ -165,17 +162,14 @@ if ! ${BUILDNOW}; then
# NOTE: getting depends from package() is a PITA
for _dep in ${deps[@]}; do
-# Ignore if already in build order
-# TODO move deps deeper in the tree if
+# Move deps deeper in the tree if
# pkgbase - dep1
# \ dep2 - dep1
# dep1 should be depth + 1
-# probably sed -i buildorder and increase dep's dep depth :D
-# remember to change dir name from xxx_pkgbase to xxx+1_pkgbase
egrep -q ";${_dep};" "${BUILDORDER}" && bury "${_dep}" ${NEXTDEPTH}
# Ask toru where's a PKGBUILD
- depdir="$(where_is ${_dep})"
+ depdir="$(toru-where ${_dep})"
if [ -z "${depdir}" -o ! -d "${depdir}" ]; then
# We specify the pkgname because we can't source the dep PKGBUILD
@@ -205,16 +199,25 @@ if [ ${DEPTH} -eq 0 ]; then
for _pkg in $(ls -r "${BUILDDIR}"); do
# Ignore if there's no PKGBUILD
if [ ! -f "${BUILDDIR}/${_pkg}/PKGBUILD" ]; then continue; fi
+# Skip if already built (faster than calling is_build again)
+ if [ -f "${BUILDDIR}/${_pkg}/built_ok" ]; then continue; fi
${VERBOSE} && msg "Building ${_pkg/_/ }" || true
+# Remove leading zeros and space if any
+ term_title "$(echo ${_pkg/_/ } | sed "s/^0\+ \?//")"
+
# Run build command
pushd "${BUILDDIR}/${_pkg}" >/dev/null
sudo pacman -Syu --noconfirm
+ ${HOOKPREBUILD}
+
${FULLBUILDCMD}
# Run local release hook with $1 = $repo
${HOOKLOCALRELEASE} $(egrep ";${_pkg#*_};" "${BUILDORDER}" | cut -d';' -f6)
+
+ touch built_ok
popd >/dev/null
done
@@ -230,4 +233,5 @@ fi
fi
+term_title "done"
exit $?