diff options
author | Nicolás Reynolds <fauno@kiwwwi.com.ar> | 2012-11-03 13:37:08 -0300 |
---|---|---|
committer | Nicolás Reynolds <fauno@kiwwwi.com.ar> | 2012-11-03 13:37:08 -0300 |
commit | 9983b0c757834d61b9099a5953dec9d92330ac76 (patch) | |
tree | 25da78388d742dd71b581df54d3fef33f34b61b4 | |
parent | 38550a26dc66a8e5dd462da65acaf56119964536 (diff) | |
parent | 958043bd456f8e60f54a2b2e3a601439394558ca (diff) |
Merge branch 'master' into smart-cleanup
Conflicts:
update-cleansystem
-rwxr-xr-x | libremessages | 6 | ||||
-rw-r--r-- | libretools.conf | 6 | ||||
-rwxr-xr-x | toru-info | 28 | ||||
-rwxr-xr-x | toru-path | 29 | ||||
-rwxr-xr-x | toru-utils | 2 | ||||
-rwxr-xr-x | toru-where | 10 | ||||
-rwxr-xr-x | treepkg | 17 | ||||
-rwxr-xr-x | update-cleansystem | 9 |
8 files changed, 80 insertions, 27 deletions
diff --git a/libremessages b/libremessages index 5d817dd..68badb8 100755 --- a/libremessages +++ b/libremessages @@ -86,6 +86,12 @@ stat_done() { printf "${BOLD}done${ALL_OFF}\n" >&2 } +# Set the terminal title +# TODO test on several terms - it works on screen/tmux +term_title() { + printf "\033k%s\033\\" "$@" +} + # usage : in_array( $needle, $haystack ) in_array() { [[ $2 ]] || return 1 # Not found diff --git a/libretools.conf b/libretools.conf index 40f92dc..88ba515 100644 --- a/libretools.conf +++ b/libretools.conf @@ -7,10 +7,12 @@ DIFFTOOL=vimdiff # The dir where you work on WORKDIR=/home/$USER/packages # The repos you'll be packaging for +# # 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. -REPOS=('core' 'extra' 'community' 'libre' 'libre-testing' 'social' 'sugar') +# PKGBUILDs first, for instance. Toru-path uses reverse order to enforce repo +# precedence on the path cache (the last path added replaces the rest) +REPOS=('core' 'libre' 'extra' 'community' 'libre-testing' 'social' 'sugar') # The architectures ARCHES=('i686' 'x86_64' 'mips64el' 'any') diff --git a/toru-info b/toru-info new file mode 100755 index 0000000..523f682 --- /dev/null +++ b/toru-info @@ -0,0 +1,28 @@ +#!/bin/bash +# Prints info about a given pkgname +source /etc/libretools.conf + +for _pkg in $@; do + _pkgbuild="$(toru-where $_pkg)" + + if [ -f "$_pkgbuild/PKGBUILD" ]; then + source "$_pkgbuild/PKGBUILD" 2>/dev/null || { + warning "Errors on %s" $_pkg + continue + } + + deps="${depends[@]} ${makedepends[@]} ${checkdepends[@]}" + repo="$(basename $(dirname "$_pkgbuild"))" + + unset build package depends makedepends checkdepends optdepends source md5sums + + msg "%s/%s %s-%s" $repo $_pkg $pkgver $pkgrel + msg2 "$pkgdesc" + msg2 "$url" + msg2 "Depends: ${deps}" + else + warning "%s doesn't exist" $_pkg + fi + + unset pkgname pkgver pkgrel pkgdesc url +done @@ -2,22 +2,35 @@ source $(dirname $(command -v $0))/toru-utils +TORUPATH=${T:-${TORUPATH}} +VERBOSE=${V:-false} + if [ ! -w "$TORUPATH" ]; then error "Toru's path isn't writable. Please check $TORUPATH" exit 1 fi LASTSYNCFILE=${TORUPATH}/lastsync.paths +PATHFILE=${TORUPATH}/paths.tch + +if [ ! -e "${PATHFILE}" ]; then + tcamgr create "${PATHFILE}" +fi # TODO pass other paths via flags -pkgbuilds=($(get_pkgbuilds ${ABSROOT})) -paths=() +# ABSROOT has trailing slash +fullrepos=() +for (( i = ${#REPOS[@]}-1 ; i >= 0 ; i-- )); do + ${VERBOSE} && msg "Processing [%s]" ${REPOS[$i]} + fullrepos+=("${ABSROOT}${REPOS[$i]}") +done +pkgbuilds=($(get_pkgbuilds ${fullrepos[@]})) msg "Updating path cache" msg2 "${#pkgbuilds[@]} PKGBUILDs to update" for _pkgbuild in ${pkgbuilds[@]}; do - $DEBUG && plain "$_pkgbuild" - source ${_pkgbuild} || { +# plain "$_pkgbuild" + source ${_pkgbuild} >/dev/null 2>&1 || { error "${_pkgbuild} contains errors, skipping" continue } @@ -25,15 +38,11 @@ for _pkgbuild in ${pkgbuilds[@]}; do fullpath=$(dirname ${_pkgbuild}) for _pkg in ${pkgbase} ${pkgname[@]} ${provides[@]}; do - paths+=(${_pkg/[<>=]*}:${fullpath}) + $VERBOSE && msg2 "${_pkg} -> ${fullpath}" + tcamgr put ${PATHFILE} ${_pkg/[<>=]*} ${fullpath} done unset pkgbase pkgname provides done - -# TODO remove old paths -# by joining new paths to old paths and exclude the joining points from the -# cache (sort of a sql join) -echo ${paths[@]} | tr ' ' "\n" | sort >> ${TORUPATH}/paths lastsync ${LASTSYNCFILE} @@ -1,6 +1,4 @@ #!/bin/bash -#!/bin/bash - source /etc/abs.conf source /etc/libretools.conf @@ -1,11 +1,7 @@ #!/bin/bash # Locates a PKGBUILD dir on toru's path cache +source /etc/libretools.conf -source $(dirname $(command -v $0))/toru-utils +PATHFILE=${TORUPATH}/paths.tch -# Look in all cached but pick the last one -grep "^${1}:" "${TORUPATH}/paths" 2>/dev/null| \ - tail -n1 2>/dev/null|\ - cut -d: -f2 2>/dev/null - -exit $? +tcamgr get ${PATHFILE} $1 2>/dev/null || echo "" @@ -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 } @@ -134,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 @@ -199,6 +204,9 @@ if [ ${DEPTH} -eq 0 ]; then ${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 @@ -225,4 +233,5 @@ fi fi +term_title "done" exit $? diff --git a/update-cleansystem b/update-cleansystem index 7c652ab..6bec742 100755 --- a/update-cleansystem +++ b/update-cleansystem @@ -3,6 +3,7 @@ # Creates a fake Parabola root and writes to cleansystem all # packages installable from base and base-devel plus extras. +set -e # Copyright 2012 Nicolás Reynolds, Luke Shumaker # ---------- GNU General Public License 3 ---------- @@ -59,5 +60,9 @@ pacman -b "${db_dir}" --config /etc/pacman.conf -Sy 2>/dev/null pacman -b "${db_dir}" \ --config /etc/pacman.conf \ -Sp --print-format "%n" \ - base base-devel sudo "$@" | sort > "$cleansystem" -pacman -Sy --needed --noconfirm base base-devel sudo "$@" + base base-devel sudo $@ | sort > "$cleansystem" + +# Ensures everything's installed +pacman -Sy --needed --noconfirm base base-devel sudo $@ + +exit $? |