aur.sh: Move from cower to auracle

master
Taeyeon Mori 4 years ago
parent d31b4b42cb
commit d0d62bb785
  1. 65
      bin/aur.sh

@ -64,7 +64,7 @@ ADD_UPDATES=false
ADD_SCMPKGS=false ADD_SCMPKGS=false
ADD_PYTHON=false ADD_PYTHON=false
RECURSE_DEPS=false RECURSE_DEPS=false
NEED_COWER=false NEED_AURACLE=false
NEED_ROOT=false NEED_ROOT=false
LIST_ONLY=false LIST_ONLY=false
IGNORE_ERRORS=false IGNORE_ERRORS=false
@ -130,7 +130,7 @@ process_arg() {
-1) -1)
export MAKEPKG_MAKETHREADS=$[`nproc` - 1];; export MAKEPKG_MAKETHREADS=$[`nproc` - 1];;
-u|--update) -u|--update)
NEED_COWER=true NEED_AURACLE=true
ADD_UPDATES=true;; ADD_UPDATES=true;;
-g|--scm-packages|--scm-update) -g|--scm-packages|--scm-update)
ADD_SCMPKGS=true;; ADD_SCMPKGS=true;;
@ -139,7 +139,7 @@ process_arg() {
NEEDED=false NEEDED=false
add_makepkg_arg -f;; add_makepkg_arg -f;;
-S|--recurse-deps) -S|--recurse-deps)
NEED_COWER=true NEED_AURACLE=true
RECURSE_DEPS=true RECURSE_DEPS=true
NEED_ROOT=true NEED_ROOT=true
add_makepkg_arg -i;; add_makepkg_arg -i;;
@ -202,8 +202,8 @@ process_arg() {
echo " -f, --force Force rebuilding of built packages. Implies --reinstall" echo " -f, --force Force rebuilding of built packages. Implies --reinstall"
echo " --no- Negate options: --no-asdeps --no-noconfirm" echo " --no- Negate options: --no-asdeps --no-noconfirm"
echo echo
echo "NOTE: options marked [c] require cower to be installed (\$ $PROG -is cower)" echo "NOTE: options marked [c] require auracle to be installed (\$ $PROG -is auracle-git)"
echo " However, certain cower-only features are automatically enabled when cower is found." echo " However, certain auracle-only features are automatically enabled when auracle is found."
exit 0 exit 0
;; ;;
# Clean up files from failed operations # Clean up files from failed operations
@ -276,34 +276,34 @@ done
$NEEDED && add_makepkg_arg "--needed" $NEEDED && add_makepkg_arg "--needed"
$NOCONFIRM && add_makepkg_arg "--noconfirm" $NOCONFIRM && add_makepkg_arg "--noconfirm"
# Cower Detection # Auracle Detection
USE_COWER=false USE_AURACLE=false
if cower --version >/dev/null; then if auracle --version >/dev/null; then
USE_COWER=true # Auto-enable cower support if installed. USE_AURACLE=true # Auto-enable auracle support if installed.
elif $NEED_COWER; then elif $NEED_AURACLE; then
throw 31 "Options requiring cower have been selected but cower was not found." throw 31 "Options requiring auracle have been selected but auracle was not found. Install auracle-git from AUR."
else else
warn "Could not detect cower on the system." warn "Could not detect auracle on the system."
fi fi
if [ "$aur_get" != "aur_get_aur4" ] || [ "$AUR_HOST" != "$AUR_DEFAULT_HOST" ]; then if [ "$aur_get" != "aur_get_aur4" ] || [ "$AUR_HOST" != "$AUR_DEFAULT_HOST" ]; then
USE_COWER=false USE_AURACLE=false
$NEED_COWER && $NEED_AURACLE &&
throw 31 "--old-aur and --aur-host are currently not supported with cower features" || throw 31 "--old-aur and --aur-host are not supported with auracle features" ||
warn "Features depending on cower cannot be used with --old-aur and --aur-host. Disabling them." warn "--old-aur and --aur-host are no longer supported"
fi fi
if ! $USE_COWER; then if ! $USE_AURACLE; then
warn "Cower will not be used. Not all features are available without it." warn "Auracle will not be used. Not all features are available without it."
warn "Specifically, split packages cannot be detected without cower." warn "Specifically, split packages cannot be detected without auracle."
fi fi
# ------------------------------------------------------------------------- # -------------------------------------------------------------------------
# aur functions # aur functions
aur_get_old() { aur_get_old() {
[ -d "$1/.git" ] && err "Local copy of $1 is a Git clone from AUR v4. Don't use --old-aur with it!" && return 32 [ -d "$1/.git" ] && throw 32 "Local copy of $1 is a Git clone from AUR v4. Don't use --old-aur with it!"
curl "$AUR_HOST/packages/${1:0:2}/$1/$1.tar.gz" | tar xz curl "$AUR_HOST/packages/${1:0:2}/$1/$1.tar.gz" | tar xz
} }
@ -355,7 +355,7 @@ parse_pkgbuild() {
collect_package() { collect_package() {
local p="$1" # package name local p="$1" # package name
local COWER_INFO="$2" local INFO="$2"
# Skip dupes (prob. from dependencies) # Skip dupes (prob. from dependencies)
if (( $AFFECTED_PKGS[(I)$p] )); then if (( $AFFECTED_PKGS[(I)$p] )); then
@ -372,15 +372,15 @@ collect_package() {
PKG_INFO[$p:From]="$CUSTOMDIR/$p" PKG_INFO[$p:From]="$CUSTOMDIR/$p"
parse_pkgbuild "$p" "$CUSTOMDIR/$p/PKGBUILD" parse_pkgbuild "$p" "$CUSTOMDIR/$p/PKGBUILD"
else else
if $USE_COWER; then if $USE_AURACLE; then
if [ -z "$COWER_INFO" ]; then if [ -z "$INFO" ]; then
COWER_INFO=`cower -i "$p"` INFO=`auracle info "$p"`
fi fi
PKG_INFO[$p:CowerInfo]="$COWER_INFO" PKG_INFO[$p:Info]="$INFO"
info_grep() { info_grep() {
echo "$COWER_INFO" | grep "$@" | cut -d: -f2 echo "$INFO" | grep "$@" | cut -d: -f2
} }
PKG_INFO[$p:PackageBase]=`info_grep PackageBase | sed -e 's/^\s*//' -e 's/\s*$//'` PKG_INFO[$p:PackageBase]=`info_grep PackageBase | sed -e 's/^\s*//' -e 's/\s*$//'`
@ -392,8 +392,8 @@ collect_package() {
# Check for split package # Check for split package
if [ -n "$PKG_INFO[$p:PackageBase]" ]; then if [ -n "$PKG_INFO[$p:PackageBase]" ]; then
color 35 echo "[AUR] $p: Is a split package. Selecting base package '$PKG_INFO[$p:PackageBase]' instead." color 35 echo "[AUR] $p: Is a split package. Selecting base package '$PKG_INFO[$p:PackageBase]' instead."
warn "[AUR] Operations on specific sub-packages require the base package to be specified along with --pkg." warn "[AUR] Split-Package support is currently broken."
collect_package "$PKG_INFO[$p:PackageBase]" "`echo "$PKG_INFO[$p:CowerInfo]" | grep -v PackageBase`" collect_package "$PKG_INFO[$p:PackageBase]" "`echo "$PKG_INFO[$p:Info]" | grep -v PackageBase`"
return $? return $?
fi fi
@ -434,7 +434,7 @@ collect_package() {
if (( $packages[(I)$dep] )); then # make sure queued dependencies are processed before dependants, even if a version is already installed if (( $packages[(I)$dep] )); then # make sure queued dependencies are processed before dependants, even if a version is already installed
collect_package "$dep" collect_package "$dep"
fi fi
if $RECURSE_DEPS && ! pacman -Qi "$dep" >/dev/null 2>&1 && cower -i "$dep" >/dev/null 2>&1; then # Check if it's an (un-installed) aur package if $RECURSE_DEPS && ! pacman -Qi "$dep" >/dev/null 2>&1 && auracle info "$dep" >/dev/null 2>&1; then # Check if it's an (un-installed) aur package
color 35 echo "[AUR] $p: Collecting AUR dependency '$dep'..." color 35 echo "[AUR] $p: Collecting AUR dependency '$dep'..."
collect_package "$dep" collect_package "$dep"
# Mark as dependency # Mark as dependency
@ -508,9 +508,10 @@ fi
if $ADD_UPDATES; then if $ADD_UPDATES; then
declare -a updates declare -a updates
for update in "${(f)$(cower -u)}"; do updates=($(auracle outdated -q))
updates+=("${${(s: :)update}[2]}") #for update in "${(f)$(auracle outdated)}"; do
done # updates+=("${${(s: :)update}[2]}")
#done
msg "[AUR] Updates available for: ${updates[*]}" msg "[AUR] Updates available for: ${updates[*]}"

Loading…
Cancel
Save