From 6033c0d7a587ea65d124a84146eba8e8cfff4095 Mon Sep 17 00:00:00 2001 From: Nicolas Reynolds Date: Wed, 7 Sep 2011 11:21:32 -0300 Subject: My build environment I run buildenv from my current user to bind mount all the needed files on the clean chroot. It's like having the current user home and makepkg.conf under a clean environment. PKGBUILD edition is done outside the chroot. Chcleanup is the script to cleanup the installed packages, used by the mipsrelease hook to return the chroot to a clean state. The user is called 'abs', PKGDEST is /home/pkgdest and SRCDEST /home/srcdest. On libretools.conf: FULLBUILDCMD="sudo libremakepkg -cumL -M --noconfirm -M" --- buildenv | 26 ++++++++++++++++++++++++++ chcleanup | 7 +++++++ 2 files changed, 33 insertions(+) create mode 100755 buildenv create mode 100755 chcleanup diff --git a/buildenv b/buildenv new file mode 100755 index 0000000..1a9fff6 --- /dev/null +++ b/buildenv @@ -0,0 +1,26 @@ +#!/bin/bash + +trap "umount_all" 0 ERR TERM KILL + +umount_all() { + for mp in home/pkgdest home/srcdest home/abs; do + msg "Umounting /$mp" + umount $CHROOTDIR/$CHCOPY/$mp || error "Couldn't umount" + done +} + +source /etc/libretools.conf + +for mp in home/pkgdest home/srcdest home/abs var/lib/toru; do + msg "Binding /$mp" + mount -o bind /$mp $CHROOTDIR/$CHCOPY/$mp || exit 1 +done + +for etc in etc/makepkg.conf etc/abs.conf etc/mtab; do + msg "Copying config /$etc" + cp --remove-destination /$etc $CHROOTDIR/$CHCOPY/$etc || exit 1 +done + +$(dirname $0)/librechroot $CHCOPY + +exit $? diff --git a/chcleanup b/chcleanup new file mode 100755 index 0000000..83c9f3f --- /dev/null +++ b/chcleanup @@ -0,0 +1,7 @@ +#!/bin/bash + +[ ! -f ~/cleansystem ] && exit 1 + +sudo pacman --noconfirm -Rcs $(comm -23 <(pacman -Qq | sort) <(sort ~/cleansystem)) + +exit $? -- cgit v1.2.3-54-g00ecf From d3056495cdab4c03e1a5a73c303b4cc25337597d Mon Sep 17 00:00:00 2001 From: Nicolas Reynolds Date: Wed, 7 Sep 2011 11:26:53 -0300 Subject: Instead of 'abs', now buildenv uses ${USER}. --- buildenv | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/buildenv b/buildenv index 1a9fff6..dc41e19 100755 --- a/buildenv +++ b/buildenv @@ -3,7 +3,7 @@ trap "umount_all" 0 ERR TERM KILL umount_all() { - for mp in home/pkgdest home/srcdest home/abs; do + for mp in home/pkgdest home/srcdest home/${USER}; do msg "Umounting /$mp" umount $CHROOTDIR/$CHCOPY/$mp || error "Couldn't umount" done @@ -11,7 +11,7 @@ umount_all() { source /etc/libretools.conf -for mp in home/pkgdest home/srcdest home/abs var/lib/toru; do +for mp in home/pkgdest home/srcdest home/${USER} var/lib/toru; do msg "Binding /$mp" mount -o bind /$mp $CHROOTDIR/$CHCOPY/$mp || exit 1 done -- cgit v1.2.3-54-g00ecf From 6082f831bbacb174c050915d3b301910fb2ea261 Mon Sep 17 00:00:00 2001 From: Nicolas Reynolds Date: Wed, 21 Sep 2011 13:26:21 -0300 Subject: Use SUDO_USER or specified user on $1 --- buildenv | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/buildenv b/buildenv index dc41e19..1cb07de 100755 --- a/buildenv +++ b/buildenv @@ -2,8 +2,10 @@ trap "umount_all" 0 ERR TERM KILL +user=${SUDO_USER:-${1}} + umount_all() { - for mp in home/pkgdest home/srcdest home/${USER}; do + for mp in home/pkgdest home/srcdest home/${user}; do msg "Umounting /$mp" umount $CHROOTDIR/$CHCOPY/$mp || error "Couldn't umount" done @@ -11,7 +13,7 @@ umount_all() { source /etc/libretools.conf -for mp in home/pkgdest home/srcdest home/${USER} var/lib/toru; do +for mp in home/pkgdest home/srcdest home/${user} var/lib/toru; do msg "Binding /$mp" mount -o bind /$mp $CHROOTDIR/$CHCOPY/$mp || exit 1 done -- cgit v1.2.3-54-g00ecf From 46798e856bcfa70791e19e7729322ad2f425d157 Mon Sep 17 00:00:00 2001 From: Nicolas Reynolds Date: Tue, 1 Nov 2011 17:16:48 -0300 Subject: PKGBUILD path caching * Toru is overly complex * Moved path caching to toru-path. Run it without arguments to update the PKGBUILD paths cache * Updated fullpkg to check this new paths cache --- fullpkg | 20 +++++----------- toru | 42 ++++----------------------------- toru-path | 31 ++++++++++++++++++++++++ toru-utils | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 121 insertions(+), 52 deletions(-) create mode 100755 toru-path create mode 100755 toru-utils diff --git a/fullpkg b/fullpkg index f242039..6b940f3 100755 --- a/fullpkg +++ b/fullpkg @@ -44,17 +44,8 @@ usage() { # Look in all caches but pick the first one # TODO move to a toru flag (-p?) where_is() { - local _repo - local _path - for _repo in ${REPOS[@]}; do - _path=$(grep "^${1}:" "${TORUPATH}/${_repo}.paths.cache" 2>/dev/null| \ - cut -d: -f2 2>/dev/null) - - [ -n "${_path}" ] && break - done - - echo ${_path} - + grep -m1 "^${1}:" "${TORUPATH}/paths" 2>/dev/null| \ + cut -d: -f2 2>/dev/null } # Removes a package from the buildorder @@ -147,6 +138,8 @@ find_deps() { for _dep in ${deps[@]}; do + msg2 "Checking ${_dep}" + local found=false local pkgdir=$(where_is ${_dep}) @@ -160,9 +153,8 @@ find_deps() { # probable circular deps [ $? -eq 20 ] && return 20 popd > /dev/null - fi - - if ! (( found )); then + else + error "Not found" echo "dep_not_found:$_dep" >>$build_dir/log fi diff --git a/toru b/toru index d622510..55e4119 100755 --- a/toru +++ b/toru @@ -12,43 +12,7 @@ # * Possibility to hook up ABS dirs besides ABSROOT (low priority) # * Tell updates and non available binary packages (working on this) -source /etc/abs.conf -source /etc/libretools.conf - -if [ ! -w "$TORUPATH" ]; then - error "Toru's path isn't writable. Please check $TORUPATH" - exit 1 -fi - -# TODO move to common functions -# usage : in_array( $needle, $haystack ) -function in_array { - [[ $2 ]] || return 1 # Not found - - local needle=$1; shift - local item - - for item in "$@"; do - [[ ${item#@} = $needle ]] && return 0 # Found - done - - return 1 # Not Found -} - -# Stores the lastsync date -lastsync() { - local lastsyncfile - - lastsyncfile=$1 - - [ -e ${lastsyncfile} -a ! -w ${lastsyncfile} ] && { - error "The sync date can't be saved. ${lastsyncfile} isn't writable." - return 1 - } - - date +%s > ${lastsyncfile} - touch ${lastsyncfile} -} +source $(dirname $0)/toru-utils # Saves contents on a named cache # $1 cache name (repo) @@ -267,7 +231,9 @@ update() { # See above FIXME # print_package_array "${updates[@]}" > ${TMPDIR}/updates - store_cache ${_repo}.updates ${TMPDIR}/updates + if [ -r ${TMPDIR}/updates ]; then + store_cache ${_repo}.updates ${TMPDIR}/updates + fi else $quiet || msg "Reading updates from cache..." diff --git a/toru-path b/toru-path new file mode 100755 index 0000000..82378a4 --- /dev/null +++ b/toru-path @@ -0,0 +1,31 @@ +#!/bin/bash + +source $(dirname $0)/toru-utils + +LASTSYNCFILE=${TORUPATH}/lastsync.paths + +# TODO pass other paths via flags +pkgbuilds=($(get_pkgbuilds ${ABSROOT})) +paths=() +# TODO create a --ignore flag +ignore=($@) + +msg "Updating path cache" +msg2 "${#pkgbuilds[@]} PKGBUILDs to update" +for _pkgbuild in ${pkgbuilds[@]}; do + $DEBUG && plain "$_pkgbuild" + source ${_pkgbuild} || { + error "${_pkgbuild} contains errors, skipping" + continue + } + + fullpath=$(dirname $(readlink -f ${_pkgbuild})) + + for _pkg in ${pkgname[@]}; do + paths+=(${_pkg}:${fullpath}) + done +done + +echo ${paths[@]} | tr ' ' "\n" | sort >> ${TORUPATH}/paths + +lastsync ${LASTSYNCFILE} diff --git a/toru-utils b/toru-utils new file mode 100755 index 0000000..e930273 --- /dev/null +++ b/toru-utils @@ -0,0 +1,80 @@ +#!/bin/bash +#!/bin/bash + + +source /etc/abs.conf +source /etc/libretools.conf + +if [ ! -w "$TORUPATH" ]; then + error "Toru's path isn't writable. Please check $TORUPATH" + exit 1 +fi + +LASTSYNCFILE=${TORUPATH}/lastsync +FORCE=false +QUIET=false +DEBUG=false + +# usage : in_array( $needle, $haystack ) +function in_array { + [[ $2 ]] || return 1 # Not found + + local needle=$1; shift + local item + + for item in "$@"; do + [[ ${item#@} = $needle ]] && return 0 # Found + done + + return 1 # Not Found +} + +# Stores the lastsync date +lastsync() { + local lastsyncfile + + lastsyncfile=$1 + + [ -e ${lastsyncfile} -a ! -w ${lastsyncfile} ] && { + error "The sync date can't be saved. ${lastsyncfile} isn't writable." + return 1 + } + + date +%s > ${lastsyncfile} + touch ${lastsyncfile} +} + + +# repo paths +get_pkgbuilds() { + pkgbuilds=() + + if [[ $FORCE = true || ! -e ${LASTSYNCFILE} ]]; then + + $QUIET || warning "Forcing upgrade" +# Get all PKGBUILDs + pkgbuilds=($(find $@ -mindepth 2 -maxdepth 3 -type f -name 'PKGBUILD')) + + else + +# Only find newer than lastsyncfile and read everything else from cache + pkgbuilds=($(find $@ -mindepth 2 -maxdepth 3 -type f -name 'PKGBUILD' -newer ${LASTSYNCFILE})) + + fi + +# Return all PKGBUILDs found + echo ${pkgbuilds[@]} +} + +# End inmediately but print a useful message +trap_exit() { + error "$@" + + exit 1 +} + +# Trap signals from makepkg +set -E +trap 'trap_exit "(prfullpkg:${level}) TERM signal caught. Exiting..."' TERM HUP QUIT +trap 'trap_exit "(prfullpkg:${level}) Aborted by user! Exiting..."' INT +trap 'trap_exit "(prfullpkg:${level}) An unknown error has occurred. Exiting..."' ERR -- cgit v1.2.3-54-g00ecf From 22a9fdddd1f6fd02e1b8d8ca9022398cd64c68b2 Mon Sep 17 00:00:00 2001 From: Nicolas Reynolds Date: Thu, 24 Nov 2011 11:08:54 -0300 Subject: change CHCOPY to CHROOT --- buildenv | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/buildenv b/buildenv index 1cb07de..84a1fc2 100755 --- a/buildenv +++ b/buildenv @@ -7,7 +7,7 @@ user=${SUDO_USER:-${1}} umount_all() { for mp in home/pkgdest home/srcdest home/${user}; do msg "Umounting /$mp" - umount $CHROOTDIR/$CHCOPY/$mp || error "Couldn't umount" + umount $CHROOTDIR/$CHROOT/$mp || error "Couldn't umount" done } @@ -15,14 +15,14 @@ source /etc/libretools.conf for mp in home/pkgdest home/srcdest home/${user} var/lib/toru; do msg "Binding /$mp" - mount -o bind /$mp $CHROOTDIR/$CHCOPY/$mp || exit 1 + mount -o bind /$mp $CHROOTDIR/$CHROOT/$mp || exit 1 done for etc in etc/makepkg.conf etc/abs.conf etc/mtab; do msg "Copying config /$etc" - cp --remove-destination /$etc $CHROOTDIR/$CHCOPY/$etc || exit 1 + cp --remove-destination /$etc $CHROOTDIR/$CHROOT/$etc || exit 1 done -$(dirname $0)/librechroot $CHCOPY +$(dirname $0)/librechroot $CHROOT exit $? -- cgit v1.2.3-54-g00ecf From 40fa0a4c04a34740b40c88a75b7ef1c816cda195 Mon Sep 17 00:00:00 2001 From: Nicolas Reynolds Date: Thu, 24 Nov 2011 11:09:23 -0300 Subject: Toru-path fixes --- toru-path | 6 ++---- toru-utils | 6 ++++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/toru-path b/toru-path index 82378a4..bdf2f23 100755 --- a/toru-path +++ b/toru-path @@ -7,8 +7,6 @@ LASTSYNCFILE=${TORUPATH}/lastsync.paths # TODO pass other paths via flags pkgbuilds=($(get_pkgbuilds ${ABSROOT})) paths=() -# TODO create a --ignore flag -ignore=($@) msg "Updating path cache" msg2 "${#pkgbuilds[@]} PKGBUILDs to update" @@ -21,8 +19,8 @@ for _pkgbuild in ${pkgbuilds[@]}; do fullpath=$(dirname $(readlink -f ${_pkgbuild})) - for _pkg in ${pkgname[@]}; do - paths+=(${_pkg}:${fullpath}) + for _pkg in ${pkgname[@]} ${provides[@]}; do + paths+=(${_pkg/[<>=]*}:${fullpath}) done done diff --git a/toru-utils b/toru-utils index e930273..bb0aef4 100755 --- a/toru-utils +++ b/toru-utils @@ -44,6 +44,12 @@ lastsync() { touch ${lastsyncfile} } +get_dbs() { + local _db + for _db in /var/lib/pacman/sync/*.db; do + bsdtar tf ${_db} | cut -d'/' -f1 | sort -u + done +} # repo paths get_pkgbuilds() { -- cgit v1.2.3-54-g00ecf From 55abb1e683ace68905f987bdcd452df6e709a9e8 Mon Sep 17 00:00:00 2001 From: Nicolas Reynolds Date: Wed, 14 Dec 2011 14:47:14 -0300 Subject: Perform cleanup to avoid bogus paths --- toru-path | 3 +++ 1 file changed, 3 insertions(+) diff --git a/toru-path b/toru-path index bdf2f23..7500aed 100755 --- a/toru-path +++ b/toru-path @@ -22,8 +22,11 @@ for _pkgbuild in ${pkgbuilds[@]}; do for _pkg in ${pkgname[@]} ${provides[@]}; do paths+=(${_pkg/[<>=]*}:${fullpath}) done + + unset pkgname provides done +# TODO remove old paths echo ${paths[@]} | tr ' ' "\n" | sort >> ${TORUPATH}/paths lastsync ${LASTSYNCFILE} -- cgit v1.2.3-54-g00ecf From 825ac89cfa857e4379e9e1baf6d470cf9e583dde Mon Sep 17 00:00:00 2001 From: Joshua Ismael Haase Hernández Date: Wed, 11 Jan 2012 21:43:33 -0600 Subject: fullpkg: corrected some error. --- fullpkg | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fullpkg b/fullpkg index fe74432..bccd816 100755 --- a/fullpkg +++ b/fullpkg @@ -27,6 +27,7 @@ done shift $(( OPTIND - 1 )) -fullpkg-find "$1" && fullpkg-build -N "$1" +build_dir="${1:-$(mktemp -d /tmp/fullpkg.XXXXXX)}" +fullpkg-find "$build_dir" && fullpkg-build -N "$build_dir" exit 0 -- cgit v1.2.3-54-g00ecf From 0e9e94d70a0442e2c0aebdfb282269e90d688712 Mon Sep 17 00:00:00 2001 From: Nicolas Reynolds Date: Sat, 21 Jan 2012 11:04:56 -0300 Subject: noupdate check --- fullpkg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fullpkg b/fullpkg index 7e75afc..a282926 100755 --- a/fullpkg +++ b/fullpkg @@ -340,7 +340,7 @@ if [ ${level} -eq 0 ]; then touch "${build_dir}"/{log,BUILDORDER} buildorder="${build_dir}/BUILDORDER" - if ! noupdate; then + if ! $noupdate; then msg "Updating pacman db" sudo pacman -Sy --noconfirm || true -- cgit v1.2.3-54-g00ecf From 0985429b68d8da1016bf4a84b2a2d32fb8c3027c Mon Sep 17 00:00:00 2001 From: Nicolas Reynolds Date: Sat, 21 Jan 2012 11:16:42 -0300 Subject: Merging fullpkg --- fullpkg | 8 -------- fullpkg-find | 9 +++++++++ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/fullpkg b/fullpkg index 227f329..fe74432 100755 --- a/fullpkg +++ b/fullpkg @@ -19,14 +19,6 @@ usage() { } -# 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 -} - while getopts 'haA:l:nm:' arg; do case "$arg" in h) usage ;; diff --git a/fullpkg-find b/fullpkg-find index 25565ae..d253913 100644 --- a/fullpkg-find +++ b/fullpkg-find @@ -11,6 +11,14 @@ guess_repo() { basename $(dirname $(pwd)) } +# 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 +} + # return : full version spec, including epoch (if necessary), pkgver, pkgrel # usage : get_fullver( ${epoch:-0}, $pkgver, $pkgrel ) get_fullver() { @@ -71,6 +79,7 @@ find_deps() { for _dep in ${deps[@]}; do local found=false +# TODO change for where_is or toru-path local pkgdir=$(toru -p ${_dep}) if [ -n "$pkgdir" -a -d "${pkgdir}" ]; then -- cgit v1.2.3-54-g00ecf From bcc304daf7152101d95a148350a18b7a7d140e9f Mon Sep 17 00:00:00 2001 From: Nicolas Reynolds Date: Tue, 24 Jan 2012 00:26:17 -0300 Subject: Fixed ID error --- pkgbuild-check-nonfree | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgbuild-check-nonfree b/pkgbuild-check-nonfree index bd6fa4b..df0ff36 100755 --- a/pkgbuild-check-nonfree +++ b/pkgbuild-check-nonfree @@ -161,7 +161,7 @@ while getopts 'h' arg; do esac done -if (( ! EUID )); then +if [ -w / ]; then error "Run as normal user" fi -- cgit v1.2.3-54-g00ecf From 29b793a63d5f8e134f23cfebc9694a98acb316b8 Mon Sep 17 00:00:00 2001 From: Joshua Ismael Haase Hernández Date: Wed, 25 Jan 2012 11:22:31 -0600 Subject: libremakepkg: pass arguments to makechrootpkg correctly --- libremakepkg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libremakepkg b/libremakepkg index 99ab1a4..257faf4 100755 --- a/libremakepkg +++ b/libremakepkg @@ -55,7 +55,7 @@ function usage { echo '' echo 'cd to a dir containing a PKGBUILD and run:' - echo '$0 [options] [-- makechrootpkg args] [-- makepkg args]' + echo '$0 [options] [-- makechrootpkg args [-- makepkg args]]' echo 'This script will build your package on a chroot.' echo '' echo 'OPTIONS:' @@ -118,7 +118,7 @@ fi unset CLEANFIRST UPDATEFIRST LIBRECHROOT_ARGS -makechrootpkg -r "$CHROOTDIR" -l "$CHROOT" "$MAKEPKG_ARGS" +makechrootpkg -r "$CHROOTDIR" -l "$CHROOT" $MAKEPKG_ARGS ev="$?" # exit value copy_log -- cgit v1.2.3-54-g00ecf From 7887f99d234b4c88c3833c294869e307d2757787 Mon Sep 17 00:00:00 2001 From: Joshua Ismael Haase Hernández Date: Wed, 25 Jan 2012 12:12:21 -0600 Subject: is_built: faster (from fauno's branch) updated calls to is_built --- fullpkg-find | 2 +- is_built | 31 ++++++++++++++++++++++--------- prtools/prfullpkg | 4 ++-- 3 files changed, 25 insertions(+), 12 deletions(-) diff --git a/fullpkg-find b/fullpkg-find index d253913..8c0c063 100644 --- a/fullpkg-find +++ b/fullpkg-find @@ -47,7 +47,7 @@ find_deps() { fi fi - if is_built "${pkgbase}>=${fullver}"; then + if is_built "${pkgbase}" "${fullver}"; then exit 0 # pkg is built and updated fi diff --git a/is_built b/is_built index 60f24e9..2a90d65 100755 --- a/is_built +++ b/is_built @@ -2,9 +2,10 @@ usage() { echo "$0 " echo - echo "Detect is a package is installed or in a database" + echo "Detect if a given package version is already in repos" + echo "Assuming you want greater or equal" echo - echo "Example usage: is_built \"pcre>=20\"" + echo "Example usage: is_built 'pcre' '20'" } while getopts 'h' arg; do @@ -14,12 +15,24 @@ while getopts 'h' arg; do esac done -# Checks for package, if -T returns non-zero output, egrep will return 0 -# because it finds it, so we negate the value to say it's not built. -# -Sp works backwards, it will print output only when the package already -# exists +set -x -!(sudo pacman -T "$1" | egrep "*" >/dev/null) || \ -sudo pacman -Sp "$1" --print-format "%n-%v" 2>/dev/null | egrep "*" >/dev/null +ver=${2} +pkg=${1} +pver=$(LC_ALL=C pacman -Sdp --print-format "%v" "${pkg}" 2>/dev/null) -exit $? +# if pacman fails or returns nothing +r=$? +[ "${pver}" = " there is nothing to do" ] && r=1 + +result=$(vercmp "${pver}" "${ver}") + +# if vercmp > 1 means our version is bigger +if [ ${result} -ge 0 -a ${r} -eq 0 ]; then + exit 0 +else + exit 1 +fi + +# just in case +exit 1 diff --git a/prtools/prfullpkg b/prtools/prfullpkg index dd2ba3a..bbb8d73 100755 --- a/prtools/prfullpkg +++ b/prtools/prfullpkg @@ -85,7 +85,7 @@ function find_deps { # Checks ABSROOT and look for target pkg deps. Adds them i local epoch=${epoch:-0} local fullver=$(get_fullver ${epoch} ${pkgver} ${pkgrel}) - if is_built "${pkgbase}>=${fullver}"; then + if is_built "${pkgbase}" "${fullver}"; then exit 0 # pkg is built and updated fi @@ -316,7 +316,7 @@ fi if [ $level -eq 0 ]; then if [ ! -d ${build_dir} ]; then # in case of custom -d option - mkdir -p ${build_dir} + mkdir -p ${build_dir} else cleanup # files already there can screw find_deps fi -- cgit v1.2.3-54-g00ecf From d9e8d78e09bed97b77bf05626ff91ec77a8f1f3a Mon Sep 17 00:00:00 2001 From: Nicolás Reynolds Date: Sat, 4 Feb 2012 12:57:43 -0300 Subject: Removed debug setting --- is_built | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/is_built b/is_built index 2a90d65..1fa79d2 100755 --- a/is_built +++ b/is_built @@ -15,11 +15,9 @@ while getopts 'h' arg; do esac done -set -x - ver=${2} pkg=${1} -pver=$(LC_ALL=C pacman -Sdp --print-format "%v" "${pkg}" 2>/dev/null) +pver=$(LC_ALL=C pacman -Sddp --print-format "%v" "${pkg}" 2>/dev/null) # if pacman fails or returns nothing r=$? -- cgit v1.2.3-54-g00ecf From 8aae92a56d577749d8ff73179ad5186ee7cba34b Mon Sep 17 00:00:00 2001 From: Nicolás Reynolds Date: Sat, 4 Feb 2012 13:11:13 -0300 Subject: Tool to quickly know if a package is unfree --- is_unfree | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100755 is_unfree diff --git a/is_unfree b/is_unfree new file mode 100755 index 0000000..f32c193 --- /dev/null +++ b/is_unfree @@ -0,0 +1,11 @@ +#!/bin/bash +# Checks if a package is on blacklist + +# fail immediately on error +set -E + +blacklist="$XDG_CONFIG_HOME/libretools/blacklist.txt" + +egrep -q "^${1}:" "${blacklist}" + +exit $? -- cgit v1.2.3-54-g00ecf From 9808018ca09050ade144d0dfc0b0b6edadefa368 Mon Sep 17 00:00:00 2001 From: Nicolás Reynolds Date: Sat, 4 Feb 2012 13:12:11 -0300 Subject: Diff PKGBUILDs if duplicate + use https AUR --- aur | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/aur b/aur index 1b17358..b96cb20 100755 --- a/aur +++ b/aur @@ -42,28 +42,48 @@ for _pkg in ${@}; do _pkg="${_pkg%%[<>=]*}" if [ -f "${_pkg}/PKGBUILD" ]; then - warning "${_pkg} already existed. skipping..." - continue + warning "${_pkg} already existed." + +# Check if we want to diff + if [ -z "${DIFFTOOL}" ]; then + continue + else +# Store our copy of the PKGBUILD dir + _diff="${PWD}/${_pkg}" + stdnull "pushd $(mktemp -d /tmp/${_pkg}.XXXX)" + msg2 "Downloading PKGBUILD into ${PWD} for diff" + fi fi msg "Downloading $_pkg..." - wget -O - -q http://aur.archlinux.org/packages/$_pkg/$_pkg.tar.gz | \ + wget -O - -q https://aur.archlinux.org/packages/$_pkg/$_pkg.tar.gz | \ tar xzf - >/dev/null 2>&1 - [[ $? -ne 0 ]] && { + if [ $? -ne 0 ]; then error "Couldn't get $_pkg" continue - } + fi stdnull "pushd $_pkg" + if [ ! -z "$_diff" ]; then + msg2 "Diffing files" +# Diff all files with our difftool + for file in *; do + ${DIFFTOOL} ${_diff}/${file} ${file} + done + +# Go back to our copy to continue working + stdnull "pushd ${_diff}" + fi + source PKGBUILD - pkgbuild-check-nonfree || { + if ! pkgbuild-check-nonfree; then if [ $? -eq 15 ]; then warning "This PKGBUILD links to known unfree packages" fi - } + fi msg2 "Checking license..." free=0 @@ -84,7 +104,7 @@ for _pkg in ${@}; do if ! is_built $_dep; then if ! find ${ABSROOT} -maxdepth 2 -type d -name "$_dep" | egrep "*" >/dev/null ; then msg2 "$_dep will be get from AUR" - missing_deps+=($_dep) + missing_deps+=($_dep) fi else msg2 "$_dep is on repos" -- cgit v1.2.3-54-g00ecf