[pacman-dev] [PATCH 1/2] makepkg: fixup broken revision and repo references
bzr support "worked", but didn't handle any of the actual features we wanted with makepkg. This moves the revision specification to the proper place (extraction, rather than download), and fixes an additional broken reference to $repo which was never set. Fixes FS#35281. Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- I tested this on a fresh clone, an existing clone, and an existing clone with a revision fragment, but anyone who actually uses bzr might want to play with this to make sure I haven't fubar'd things even further. scripts/makepkg.sh.in | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index b85b87e..9ebfdf3 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -448,29 +448,14 @@ download_bzr() { url=${url%%#*} local repo=$(get_filename "$netfile") - local displaylocation="$url" - local revision=('-r-1') - - if [[ -n $fragment ]]; then - case ${fragment%%=*} in - revision) - revision=("-r${fragment##*=}") - displaylocation="$url -r ${fragment##*=}" - ;; - *) - error "$(gettext "Unrecognized reference: %s")" "${fragment}" - plain "$(gettext "Aborting...")" - exit 1 - esac - fi local dir=$(get_filepath "$netfile") [[ -z "$dir" ]] && dir="$SRCDEST/$(get_filename "$netfile")" if [[ ! -d "$dir" ]] || dir_is_empty "$dir" ; then msg2 "$(gettext "Branching %s ...")" "${displaylocation}" - if ! bzr branch "$url" "$dir" ${revision[@]} --no-tree --use-existing-dir; then + if ! bzr branch "$url" "$dir" --no-tree --use-existing-dir; then error "$(gettext "Failure while branching %s")" "${displaylocation}" plain "$(gettext "Aborting...")" exit 1 @@ -495,7 +480,7 @@ download_bzr() { fi msg2 "$(gettext "Pulling %s ...")" "${displaylocation}" cd_safe "$dir" - if ! bzr pull "$url" ${revision[@]} --overwrite; then + if ! bzr pull "$url" --overwrite; then # only warn on failure to allow offline builds warning "$(gettext "Failure while pulling %s")" "${displaylocation}" fi @@ -505,11 +490,25 @@ download_bzr() { extract_bzr() { local netfile=$1 + local repo=$(get_filename "$netfile") local fragment=${netfile#*#} if [[ $fragment = "$netfile" ]]; then unset fragment fi + if [[ -n $fragment ]]; then + case ${fragment%%=*} in + revision) + revision=("-r" "${fragment#*=}") + displaylocation="$url -r ${fragment#*=}" + ;; + *) + error "$(gettext "Unrecognized reference: %s")" "${fragment}" + plain "$(gettext "Aborting...")" + exit 1 + esac + fi + local dir=$(get_filepath "$netfile") [[ -z "$dir" ]] && dir="$SRCDEST/$(get_filename "$netfile")" @@ -517,7 +516,8 @@ extract_bzr() { pushd "$srcdir" &>/dev/null rm -rf "${dir##*/}" - if ! bzr checkout "$dir" --lightweight; then + if ! { bzr checkout "$dir" "${revision[@]}" --lightweight && + ( cd "$repo" && bzr pull "$dir" -q --overwrite "${revision[@]}" ); }; then error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "bzr" plain "$(gettext "Aborting...")" exit 1 -- 1.8.2.3
su is terribad. In addition to reverting, this also removes support for privilege escalation via su. If you want to use paccache as root and fail to comprehend how much better sudo is than su, then run paccache directly via su. Fixes FS#35173. This reverts commit 597286eb258f841dfc00f65474138fc6192f0092. Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- contrib/paccache.sh.in | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/contrib/paccache.sh.in b/contrib/paccache.sh.in index 64c3c53..a9c6524 100644 --- a/contrib/paccache.sh.in +++ b/contrib/paccache.sh.in @@ -109,8 +109,7 @@ runcmd() { if sudo -v &>/dev/null && sudo -l &>/dev/null; then sudo "$@" else - printf '%s ' 'root' - su -c "$(printf '%q ' "$@")" + die 'Unable to escalate privileges using sudo' fi else "$@" @@ -308,9 +307,9 @@ totalsaved=$(@SIZECMD@ "${candidates[@]}" | awk '{ sum += $1 } END { print sum } # crush. kill. destroy. (( verbose )) && cmdopts+=(-v) if (( delete )); then - runcmd xargs -0a <(printf '%s\0' "${candidates[@]}") rm "${cmdopts[@]}" + printf '%s\0' "${candidates[@]}" | runcmd xargs -0 rm "${cmdopts[@]}" elif (( move )); then - runcmd xargs -0a <(printf '%s\0' "${candidates[@]}") mv "${cmdopts[@]}" -t "$movedir" + printf '%s\0' "${candidates[@]}" | runcmd xargs -0 mv "${cmdopts[@]}" -t "$movedir" fi summarize "$pkgcount" "${candidates[@]}" -- 1.8.2.3
On 15/05/13 23:58, Dave Reisner wrote:
su is terribad. In addition to reverting, this also removes support for privilege escalation via su. If you want to use paccache as root and fail to comprehend how much better sudo is than su, then run paccache directly via su.
Fixes FS#35173.
This reverts commit 597286eb258f841dfc00f65474138fc6192f0092.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Ack -> maint
On 15/05/13 23:58, Dave Reisner wrote:
bzr support "worked", but didn't handle any of the actual features we wanted with makepkg. This moves the revision specification to the proper place (extraction, rather than download), and fixes an additional broken reference to $repo which was never set.
Fixes FS#35281.
Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- I tested this on a fresh clone, an existing clone, and an existing clone with a revision fragment, but anyone who actually uses bzr might want to play with this to make sure I haven't fubar'd things even further.
Ack -> maint. But someone who uses bzr regularly should be testing this...
participants (2)
-
Allan McRae
-
Dave Reisner