diff options
author | Nicolas Reynolds <fauno@kiwwwi.com.ar> | 2011-06-20 23:09:02 -0300 |
---|---|---|
committer | Nicolas Reynolds <fauno@kiwwwi.com.ar> | 2011-06-20 23:09:02 -0300 |
commit | 59b03ff6bb15a5163604ad8ba344a8fd2f664826 (patch) | |
tree | b780564f9857e372ba81091973d96b2ded99f14e | |
parent | 7d2a691276f60e10c59204631f06fa9c5d6a1c25 (diff) | |
parent | 702cc20bd94cdb2939e0c163e8e9671c920c5b19 (diff) |
Merge branch 'master' of ssh://vparabola/srv/git/projects/libretools
Conflicts:
fullpkg
-rwxr-xr-x | abslibre-commit | 3 | ||||
-rwxr-xr-x | fullpkg | 33 | ||||
-rwxr-xr-x | librecommit | 34 | ||||
-rwxr-xr-x | libremakepkg | 2 | ||||
-rwxr-xr-x | toru | 97 |
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 @@ -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 @@ -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 $? |