Skip to content
This repository has been archived by the owner on Aug 9, 2019. It is now read-only.

Commit

Permalink
Remove rsync ABS backend support
Browse files Browse the repository at this point in the history
  • Loading branch information
larchunix committed May 21, 2017
1 parent b842c38 commit 5b195ad
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 66 deletions.
63 changes: 7 additions & 56 deletions src/lib/abs.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,73 +3,25 @@
# abs.sh
# This file is part of Yaourt (http://archlinux.fr/yaourt-en)

RSYNCCMD=$(type -p rsync 2> /dev/null)
RSYNCOPT="-mrtv --no-motd --no-p --no-o --no-g"

ABSCONF=0

load_lib alpm_query
load_lib pkgbuild

# source abs configuration
source_abs_conf() {
((ABSCONF)) && return || ABSCONF=1
local vars=()
local abs_conf
[[ ! $SYNCSERVER ]] && vars+=(SYNCSERVER)
[[ ! $REPOS ]] && vars+=(REPOS)
if [[ $vars ]]; then
abs_conf=$(
[[ -r "@sysconfdir@/abs.conf" ]] &&
source "@sysconfdir@/abs.conf" > /dev/null
[[ -r ~/.abs.conf ]] &&
source ~/.abs.conf > /dev/null
declare -p ${vars[*]} 2>/dev/null | tr '\n' ';'
)
[[ ! $abs_conf ]] && return
# Change vars names because "declare" create a local var
abs_conf=${abs_conf//SYNCSERVER/_SYNCSERVER}
abs_conf=${abs_conf//REPOS/_REPOS}
eval "$abs_conf"
SYNCSERVER=${SYNCSERVER:-$_SYNCSERVER}
[[ ! $REPOS ]] && REPOS=(${_REPOS[@]})
fi
}

# Get sources in current dir
# Usage abs_get_pkgbuild ($repo/$pkg[,$arch,[$pkgbase]])
abs_get_pkgbuild() {
source_abs_conf
local repo=${1%/*} pkg=${1#*/} arch=$2 pkgbase=$3 pkgver=
local repo=${1%/*} pkg=${1#*/} arch=$2 pkgbase=$3 pkgver= url=

if [[ ! $arch || ! $pkgbase ]]; then
read arch pkgver < <(pkgquery -1Sif '%a %v' "$repo/$pkg")
pkgbase=$(get_pkgbase $pkg $repo $pkgver)
fi
if ((USE_GIT)) && [[ " ${REPOS[*]} " =~ " $repo " ]]; then
local url
if [[ $repo = "core" || $repo = "extra" ]]; then
url="https://projects.archlinux.org/svntogit/packages.git/snapshot/packages/$pkgbase.tar.gz"
else
url="https://projects.archlinux.org/svntogit/community.git/snapshot/community-packages/$pkgbase.tar.gz"
fi
curl_fetch -L -f "$url" -o - | bsdtar --strip-components 3 --include="*/$pkgbase/trunk/" -xvf -

if [[ $repo = "core" || $repo = "extra" || $repo = "testing" ]]; then
url="https://git.archlinux.org/svntogit/packages.git/snapshot/packages/$pkgbase.tar.gz"
else
if [[ $RSYNCCMD && $SYNCSERVER && " ${REPOS[*]} " =~ " $repo " ]]; then
$RSYNCCMD $RSYNCOPT "$SYNCSERVER::abs/$arch/$repo/$pkgbase/" . && return 0
fi
# TODO: store abs archive somewhere else.
local abs_tar="$YAOURTTMPDIR/$repo.abs.tar.gz"
local abs_url
local repo_date=$(stat -c "%Z" "${P[dbpath]}/sync/$repo.db")
local abs_repo_date=$(stat -c "%Z" "$abs_tar" 2> /dev/null)
if [[ ! $abs_repo_date ]] || (( ${abs_repo_date%.*} < ${repo_date%.*} )); then
abs_url=$(pkgquery -1Sif "%u" "$repo/$pkg")
abs_url="${abs_url%/*}/$repo.abs.tar.gz"
msg "$repo/$pkgbase: $(gettext 'Download abs archive')"
curl_fetch -L -f -# "$abs_url" -o "$abs_tar" || return 1
fi
bsdtar --strip-components 2 -xvf "$abs_tar" "$repo/$pkgbase"
url="https://git.archlinux.org/svntogit/community.git/snapshot/community-packages/$pkgbase.tar.gz"
fi
curl_fetch -L -f "$url" -o - | bsdtar --strip-components 3 --include="*/$pkgbase/trunk/" -xvf -
}

# Build from abs or aur
Expand Down Expand Up @@ -454,5 +406,4 @@ upgrade_devel_package() {
show_targets 'Targets' "${devel_pkgs[@]}" && build_pkg "${devel_pkgs[@]}"
}


# vim: set ts=4 sw=4 noet:
4 changes: 0 additions & 4 deletions src/lib/util.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -243,10 +243,6 @@ DEVEL=0
FORCE=0
SUDONOVERIF=0
NO_TESTDB=0
# ABS
USE_GIT=0
REPOS=()
SYNCSERVER=""
# AUR
AURURL='@aururl@'
AURCOMMENT=5
Expand Down
6 changes: 0 additions & 6 deletions src/yaourtrc.in
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@
#SUDONOVERIF=0 # Avoid multiple sudo checks when timestamp_timeout=0
#SUDOREDIRECT=1 # Define to 0 in case you use a fingerprint device

# ABS
#USE_GIT=0
# If the package "abs" is installed, those var are parsed from abs.conf
#REPOS=() # REPOS available at $SYNCSERVER
#SYNCSERVER=""

# AUR
#AURURL="@aururl@"
#AURCOMMENT=5
Expand Down

0 comments on commit 5b195ad

Please sign in to comment.