From 44e84ad7c13d209e7251ebc82e9bbc7b2d718160 Mon Sep 17 00:00:00 2001 From: Taeyeon Mori Date: Sat, 26 Mar 2016 14:23:33 +0100 Subject: [PATCH] aur.sh: Use --asdeps for makepkg, Add package ignore list --- bin/aur.sh | 28 +++++++++++++++++++++++++--- dotfiles/makepkg.conf | 2 +- etc/aur.conf | 11 +++++++++-- git/config | 3 +++ 4 files changed, 38 insertions(+), 6 deletions(-) diff --git a/bin/aur.sh b/bin/aur.sh index 1ccbd40..c9131ef 100755 --- a/bin/aur.sh +++ b/bin/aur.sh @@ -31,6 +31,8 @@ ADD_UPDATES=false RECURSE_DEPS=false NEED_COWER=false LIST_ONLY=false +EXCLUDE= +ASDEPS=true add_makepkg_arg() { makepkg_args=("${makepkg_args[@]}" "$1") @@ -49,6 +51,8 @@ process_arg() { case "$_next_arg" in --aur-host) AUR_HOST="$cx";; + --exclude) + EXCLUDE=",$cx";; esac _next_arg= continue @@ -63,7 +67,7 @@ process_arg() { DL_ONLY=true;; --ask) ASK=true;; - --aur-host) # need more args + --aur-host|--exclude) # need more args _next_arg="$cx";; -u|--update) [ -n "$MODE" ] && throw 255 "Can only use one flag from the 'aur.sh command' category" @@ -96,6 +100,9 @@ process_arg() { echo " --old-aur Use the old (non-git) AUR methods" echo " --ask Ask before installing packages (removes --noconfirm)" echo " --clean Clean up leaftover temporary files (of failed builds) and exit" + echo " --exclude " + echo " Exclude packages from -u" + echo " --asexplicit Don't pass --asdeps to makepkg" echo echo "Useful makepkg options:" echo " -i Install package after building it" @@ -118,8 +125,10 @@ process_arg() { done color 35 echo "Cleaned leftover temporary files." exit 0;; + --asexplicit) + ASDEPS=false;; # Makepkg args - --pkg|--key|--config) # These take an additional value + --pkg|--key|--config|-p) # These take an additional value _proxy_args=1 add_makepkg_arg "$cx";; -*) @@ -143,6 +152,7 @@ for cx in "$@"; do esac done + # Cower Detection USE_COWER=false @@ -203,11 +213,19 @@ if $ADD_UPDATES; then packages=("${packages[@]}" "`echo $update | cut -d' ' -f2`") done IFS="$OFS" + + msg "[AUR] Updates available for: ${packages[*]}" + + if [ -n "$EXCLUDE" -o -n "$AURSH_IGNORE_UPDATES" ]; then + packages=(`echo ${packages[@]} | sed -re "s/$(echo $EXCLUDE $AURSH_IGNORE_UPDATES | sed -e 's/[ ,]/|/g')//g"`) + fi fi if [ -z "$packages" ]; then warn "[AUR] Nothing to do." exit 0 +else + msg "[AUR] Package set: ${packages[*]}" fi # Figure out build directory @@ -217,7 +235,7 @@ if ! $DL_ONLY && ! $LIST_ONLY; then test -d "$build" || mkdir -p "$build" || throw 1 "Couldn't create build directory" clean_exit() { - rm "$build/aur.sh.running" + rm "$build/aur.sh.running" 2>/dev/null || true exit ${1-0} } trap clean_exit TERM @@ -234,6 +252,10 @@ if ! $DL_ONLY && ! $LIST_ONLY; then add_makepkg_arg "--noconfirm" fi + + $ASDEPS && add_makepkg_arg "--asdeps" + + msg "[AUR] Makepkg args: ${makepkg_args[*]}" fi diff --git a/dotfiles/makepkg.conf b/dotfiles/makepkg.conf index dd91744..5918d5e 100644 --- a/dotfiles/makepkg.conf +++ b/dotfiles/makepkg.conf @@ -16,7 +16,7 @@ CFLAGS="`fix_march $CFLAGS`" CXXFLAGS="`fix_march $CXXFLAGS`" LDFLAGS="$LDFLAGS" -MAKEFLAGS="-j`grep "cpu cores" /proc/cpuinfo | cut -d: -f2`" +MAKEFLAGS="-j`nproc`" # Store stuff source "$DOTFILES/etc/aur.conf" diff --git a/etc/aur.conf b/etc/aur.conf index 311e27a..e6a2c9c 100644 --- a/etc/aur.conf +++ b/etc/aur.conf @@ -5,17 +5,25 @@ AURDIR="$HOME/aur" AURDEST="$AURDIR/Pkgbuilds" PKGDEST="$AURDIR/Packages" SRCDEST="$AURDIR/Source" +ABSDEST="$AURDIR/ABS" +GNUPGHOME="$AURDIR/gnupg" +# Local options +test -e "$DOTFILES/etc/aur.conf.local" && + source "$DOTFILES/etc/aur.conf.local" + +# Create directories test -d "$AURDEST" || mkdir -p "$AURDEST" || exit 1 test -d "$PKGDEST" || mkdir -p "$PKGDEST" || exit 1 test -d "$SRCDEST" || mkdir -p "$SRCDEST" || exit 1 # GnuPG Signatures -export GNUPGHOME="$AURDIR/gnupg" +export GNUPGHOME test -d "$GNUPGHOME" || mkdir -p "$GNUPGHOME" && chmod go-w "$GNUPGHOME" || exit 1 if ! test -e "$GNUPGHOME/gpg.conf"; then + echo "[AUR] Initializing GnuPG keyring in $GNUPGHOME" cat >"$GNUPGHOME/gpg.conf" </dev/null 2>&1; then - ABSDEST="$AURDIR/ABS" export ASPROOT="$ABSDEST/.asp" test -d "$ABSDEST" || mkdir -p "$ABSDEST" || exit 1 diff --git a/git/config b/git/config index fd80f44..6cf931d 100644 --- a/git/config +++ b/git/config @@ -7,3 +7,6 @@ [url "git@github.com:"] insteadOf = git://github.com/ insteadOf = https://github.com/ + +[url "https://aur.archlinux.org/"] + insteadOf = https://aur4.archlinux.org/