Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'contrib')
-rw-r--r--contrib/.gitignore2
-rw-r--r--contrib/Makefile.am14
-rw-r--r--contrib/PKGBUILD.vim7
-rw-r--r--contrib/README3
-rwxr-xr-xcontrib/bacman.in2
-rw-r--r--contrib/bash_completion.in10
-rwxr-xr-xcontrib/paccache.in300
-rwxr-xr-xcontrib/pacdiff.in2
-rwxr-xr-xcontrib/paclist.in85
-rwxr-xr-xcontrib/paclog-pkglist.in68
-rwxr-xr-xcontrib/pacscripts.in4
-rwxr-xr-xcontrib/pacsearch.in2
-rwxr-xr-xcontrib/wget-xdelta.sh.in70
13 files changed, 417 insertions, 152 deletions
diff --git a/contrib/.gitignore b/contrib/.gitignore
index f9fc107e..1bd145fc 100644
--- a/contrib/.gitignore
+++ b/contrib/.gitignore
@@ -1,7 +1,9 @@
bacman
bash_completion
+paccache
pacdiff
paclist
+paclog-pkglist
pacscripts
pacsearch
wget-xdelta.sh
diff --git a/contrib/Makefile.am b/contrib/Makefile.am
index 827d9ec0..10b03a2f 100644
--- a/contrib/Makefile.am
+++ b/contrib/Makefile.am
@@ -1,10 +1,11 @@
OURSCRIPTS = \
bacman \
+ paccache \
pacdiff \
paclist \
+ paclog-pkglist \
pacscripts \
- pacsearch \
- wget-xdelta.sh
+ pacsearch
OURFILES = \
bash_completion \
@@ -14,12 +15,13 @@ EXTRA_DIST = \
PKGBUILD.vim \
bacman.in \
bash_completion.in \
+ paccache.in \
+ paclog-pkglist.in \
pacdiff.in \
paclist.in \
pacscripts.in \
pacsearch.in \
vimprojects \
- wget-xdelta.sh.in \
zsh_completion.in \
README
@@ -29,7 +31,8 @@ MOSTLYCLEANFILES = $(OURSCRIPTS) $(OURFILES) *.tmp
edit = sed \
-e 's|@sysconfdir[@]|$(sysconfdir)|g' \
-e 's|@localstatedir[@]|$(localstatedir)|g' \
- -e 's|@BASH_SHELL[@]|$(BASH_SHELL)|g'
+ -e 's|@SIZECMD[@]|$(SIZECMD)|g' \
+ -e '1s|!/bin/bash|!$(BASH_SHELL)|g'
$(OURSCRIPTS): Makefile
@echo ' ' GEN $@;
@@ -50,12 +53,13 @@ all-am: $(OURSCRIPTS) $(OURFILES)
bacman: $(srcdir)/bacman.in
bash_completion: $(srcdir)/bash_completion.in
+paccache: $(srcdir)/paccache.in
pacdiff: $(srcdir)/pacdiff.in
paclist: $(srcdir)/paclist.in
+paclog-pkglist: $(srcdir)/paclog-pkglist.in
pacscripts: $(srcdir)/pacscripts.in
pacsearch: $(srcdir)/pacsearch.in
pactree: $(srcdir)/pactree.in
-wget-xdelta.sh: $(srcdir)/wget-xdelta.sh.in
zsh_completion: $(srcdir)/zsh_completion.in
# vim:set ts=2 sw=2 noet:
diff --git a/contrib/PKGBUILD.vim b/contrib/PKGBUILD.vim
index f627a5e6..1814c224 100644
--- a/contrib/PKGBUILD.vim
+++ b/contrib/PKGBUILD.vim
@@ -13,6 +13,7 @@ elseif exists("b:current_syntax")
endif
let b:main_syntax = "sh"
+let b:is_bash = 1
runtime! syntax/sh.vim
" case on
@@ -106,6 +107,11 @@ syn keyword pb_k_optdepends optdepends contained
syn match pbValidOptdepends /\([[:alnum:]]\|+\|-\|_\)*/ contained
syn region pbOptdependsGroup start=/^optdepends=(/ end=/)/ contains=pb_k_optdepends,pbValidOptdepends,shDoubleQuote,shSingleQuote
+" checkdepends
+syn keyword pb_k_ckdepends ckdepends contained
+syn match pbValidCkdepends /\([[:alnum:]]\|+\|-\|_\)*/ contained
+syn region pbCkdependsGroup start=/^checkdepends=(/ end=/)/ contains=pb_k_ckdepends,pbValidCkdepends,shDoubleQuote,shSingleQuote
+
" conflicts
syn keyword pb_k_conflicts conflicts contained
syn match pbValidConflicts /\([[:alnum:]]\|+\|-\|_\)*/ contained
@@ -228,6 +234,7 @@ hi def link pbIllegalArch Error
hi def link pb_k_groups pbKeywords
hi def link pb_k_makedepends pbKeywords
hi def link pb_k_optdepends pbKeywords
+hi def link pb_k_ckdepends pbKeywords
hi def link pb_k_depends pbKeywords
hi def link pb_k_replaces pbKeywords
hi def link pb_k_conflicts pbKeywords
diff --git a/contrib/README b/contrib/README
index 4f591012..04b656f3 100644
--- a/contrib/README
+++ b/contrib/README
@@ -28,6 +28,3 @@ database entries. Useful for reuse, or possible config file extension.
vimprojects - a project file for the vim project plugin.
-wget-xdelta.sh - A download script for pacman which allows binary deltas
-generated with makepkg to be used instead of downloading full binary packages.
-This should cut download sizes for some package upgrades significantly.
diff --git a/contrib/bacman.in b/contrib/bacman.in
index ebcc386d..fe13e5b9 100755
--- a/contrib/bacman.in
+++ b/contrib/bacman.in
@@ -1,4 +1,4 @@
-#!@BASH_SHELL@
+#!/bin/bash
#
# bacman: recreate a package from a running system
# This script rebuilds an already installed package using metadata
diff --git a/contrib/bash_completion.in b/contrib/bash_completion.in
index 7f47f4b4..51a37732 100644
--- a/contrib/bash_completion.in
+++ b/contrib/bash_completion.in
@@ -31,11 +31,11 @@ _makepkg() {
local cur opts prev
COMPREPLY=()
_get_comp_words_by_ref cur prev
- if [[ $cur = -* && ! $prev =~ ^-(-(cleancache|config|help)$|\w*[Chp]) ]]; then
- opts=('allsource asroot clean cleancache config force geninteg help holdver
- ignorearch install log nobuild nocolor noconfirm nodeps noextract
- noprogressbar pkg repackage rmdeps skipinteg source syncdeps'
- 'A C L R c d e f g h i m o p r s')
+ if [[ $cur = -* && ! $prev =~ ^-(-(config|help)$|\w*[Chp]) ]]; then
+ opts=('allsource asroot check clean config force geninteg help holdver ignorearch
+ install log nobuild nocheck nocolor noconfirm nodeps noextract noprogressbar
+ nosign pkg repackage rmdeps sign skipinteg source syncdeps'
+ 'A L R c d e f g h i m o p r s')
_arch_ptr2comp opts
fi
true
diff --git a/contrib/paccache.in b/contrib/paccache.in
new file mode 100755
index 00000000..b191ed9a
--- /dev/null
+++ b/contrib/paccache.in
@@ -0,0 +1,300 @@
+#!/bin/bash
+#
+# pacache - flexible pacman cache cleaning
+#
+# Copyright (C) 2011 Dave Reisner <dreisner@archlinux.org>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
+shopt -s extglob
+
+declare -a candidates=() cmdopts=() whitelist=() blacklist=()
+declare -i delete=0 dryrun=0 filecount=0 keep=3 move=0 totalsaved=0
+declare cachedir=@localstatedir@/cache/pacman/pkg delim=$'\n' movedir= scanarch=
+
+msg() {
+ local mesg=$1; shift
+ printf "==> $mesg\n" "$@"
+} >&2
+
+error() {
+ local mesg=$1; shift
+ printf "==> ERROR: $mesg\n" "$@"
+} >&2
+
+die() {
+ error "$@"
+ exit 1
+}
+
+# reads a list of files on stdin and prints out deletion candidates
+pkgfilter() {
+ # there's whitelist and blacklist parameters passed to this
+ # script after the block of awk.
+
+ awk -v keep="$1" -v scanarch="$2" '
+ function parse_filename(filename, parts, count, i, pkgname, arch) {
+
+ count = split(filename, parts, "-")
+
+ i = 1
+ pkgname = parts[i++]
+ while (i <= count - 3) {
+ pkgname = pkgname "-" parts[i++]
+ }
+
+ arch = substr(parts[count], 1, index(parts[count], ".") - 1)
+
+ # filter on whitelist or blacklist
+ if (wlen && !whitelist[pkgname]) return
+ if (blen && blacklist[pkgname]) return
+
+ if ("" == packages[pkgname,arch]) {
+ packages[pkgname,arch] = filename
+ } else {
+ packages[pkgname,arch] = packages[pkgname,arch] SUBSEP filename
+ }
+ }
+
+ BEGIN {
+ # create whitelist
+ wlen = ARGV[1]; delete ARGV[1]
+ for (i = 2; i < 2 + wlen; i++) {
+ whitelist[ARGV[i]] = 1
+ delete ARGV[i]
+ }
+
+ # create blacklist
+ blen = ARGV[i]; delete ARGV[i]
+ while (i++ < ARGC) {
+ blacklist[ARGV[i]] = 1
+ delete ARGV[i]
+ }
+
+ # read package filenames
+ while (getline < "/dev/stdin") {
+ parse_filename($0)
+ }
+
+ for (pkglist in packages) {
+ # idx[1,2] = idx[pkgname,arch]
+ split(pkglist, idx, SUBSEP)
+
+ # enforce architecture match if specified
+ if (!scanarch || scanarch == idx[2]) {
+ count = split(packages[idx[1], idx[2]], pkgs, SUBSEP)
+ if (count > keep) {
+ for(i = 1; i <= count - keep; i++) {
+ print pkgs[i]
+ }
+ }
+ }
+ }
+ }' "${@:3}"
+}
+
+size_to_human() {
+ awk -v size="$1" '
+ BEGIN {
+ suffix[1] = "B"
+ suffix[2] = "KiB"
+ suffix[3] = "MiB"
+ suffix[4] = "GiB"
+ suffix[5] = "TiB"
+ count = 1
+
+ while (size > 1024) {
+ size /= 1024
+ count++
+ }
+
+ sizestr = sprintf("%.2f", size)
+ sub(/.?0+$/, "", sizestr)
+ printf("%s %s", sizestr, suffix[count])
+ }'
+}
+
+runcmd() {
+ if (( needsroot )); then
+ msg "Privilege escalation required"
+ if sudo -v &>/dev/null && sudo -l &>/dev/null; then
+ sudo "$@"
+ else
+ printf '%s ' 'root'
+ su -c "$(printf '%q ' "$@")"
+ fi
+ else
+ "$@"
+ fi
+}
+
+summarize() {
+ local -i filecount=$1; shift
+ local seenarch= seen= arch= name=
+ local -r pkg_re='(.+)-[^-]+-[0-9]+-([^.]+)\.pkg.*'
+
+ if (( delete )); then
+ printf -v output 'finished: %d packages removed' "$filecount"
+ elif (( move )); then
+ printf -v output "finished: %d packages moved to \`%s'" "$filecount" "$movedir"
+ elif (( dryrun )); then
+ if (( verbose )); then
+ msg "Candidate packages:"
+ while read -r pkg; do
+ if (( verbose >= 3 )); then
+ [[ $pkg =~ $pkg_re ]] && name=${BASH_REMATCH[1]} arch=${BASH_REMATCH[2]}
+ if [[ -z $seen || $seenarch != $arch || $seen != $name ]]; then
+ printf '%s (%s):\n' "$name" "$arch"
+ fi
+ printf ' %s\n' "$pkg"
+ elif (( verbose >= 2 )); then
+ printf "$PWD/%s$delim" "$pkg"
+ else
+ printf "%s$delim" "$pkg"
+ fi
+ done < <(printf '%s\n' "$@" | pacsort)
+ fi
+ printf -v output 'finished dry run: %d candidates' "$filecount"
+ fi
+
+ printf '\n' >&2
+ msg "$output (diskspace saved: %s)" "$(size_to_human "$totalsaved")"
+}
+
+usage() {
+ cat <<EOF
+usage: ${0##*/} <operation> [options] [targets...]
+
+${0##*/} is a flexible pacman cache cleaning utility, which has numerous
+options to help control how much, and what, is deleted from any directory
+containing pacman package tarballs.
+
+ Operations:
+ -d perform a dry run, only finding candidate packages.
+ -m <movedir> move candidate packages to 'movedir'.
+ -r remove candidate packages.
+
+ Options:
+ -a <arch> scan for 'arch' (default: all architectures).
+ -c <cachedir> scan 'cachedir' for packages (default: @localstatedir@/cache/pacman/pkg).
+ -f apply force to mv(1) and rm(1) operations.
+ -h display this help message.
+ -i <pkgs> ignore 'pkgs', which is a comma separated. Alternatively,
+ specify '-' to read package names from stdin, newline delimited.
+ -k <num> keep 'num' of each package in 'cachedir' (default: 3).
+ -u target uninstalled packages.
+ -v increase verbosity. specify up to 3 times.
+ -z use null delimiters for candidate names (only with -v and -vv)
+
+EOF
+}
+
+if (( ! UID )); then
+ error "Do not run this script as root. You will be prompted for privilege escalation."
+ exit 42
+fi
+
+while getopts ':a:c:dfhi:k:m:rsuvz' opt; do
+ case $opt in
+ a) scanarch=$OPTARG ;;
+ c) cachedir=$OPTARG ;;
+ d) dryrun=1 ;;
+ f) cmdopts=(-f) ;;
+ h) usage
+ exit 0 ;;
+ i) if [[ $OPTARG = '-' ]]; then
+ [[ ! -t 0 ]] && IFS=$'\n' read -r -d '' -a ign
+ else
+ IFS=',' read -r -a ign <<< "$OPTARG"
+ fi
+ blacklist+=("${ign[@]}")
+ unset i ign ;;
+ k) keep=$OPTARG
+ if [[ $keep != $OPTARG ]] || (( keep < 0 )); then
+ die 'argument to option -k must be a non-negative integer'
+ fi ;;
+ m) move=1 movedir=$OPTARG ;;
+ r) delete=1 ;;
+ u) IFS=$'\n' read -r -d '' -a ign < <(pacman -Qq)
+ blacklist+=("${ign[@]}")
+ unset ign ;;
+ v) (( ++verbose )) ;;
+ z) delim='\0' ;;
+ :) die "option '--%s' requires an argument" "$OPTARG" ;;
+ ?) die "invalid option -- '%s'" "$OPTARG" ;;
+ esac
+done
+shift $(( OPTIND - 1 ))
+
+# remaining args are a whitelist
+whitelist=("$@")
+
+# sanity checks
+case $(( dryrun+delete+move )) in
+ 0) die "no operation specified (use -h for help)" ;;
+ [^1]) die "only one operation may be used at a time" ;;
+esac
+
+[[ -d $cachedir ]] ||
+ die "cachedir \`%s' does not exist or is not a directory" "$cachedir"
+
+[[ $movedir && ! -d $movedir ]] &&
+ die "move-to directory \`%s' does not exist or is not a directory" "$movedir"
+
+if (( move || delete )); then
+ # make it an absolute path since we're about to chdir
+ [[ ${movedir:0:1} != '/' ]] && movedir=$PWD/$movedir
+ [[ ! -w $cachedir || ( $movedir && ! -w $movedir ) ]] && needsroot=1
+fi
+
+# unlikely that this will fail, but better make sure
+cd "$cachedir" || die "failed to chdir to \`%s'" "$cachedir"
+
+# note that these results are returned in an arbitrary order from awk, but
+# they'll be resorted (in summarize) iff we have a verbosity level set.
+IFS=$'\n' read -r -d '' -a candidates < \
+ <(printf '%s\n' *.pkg.tar?(.+([^.])) | pacsort |
+ pkgfilter "$keep" "$scanarch" \
+ "${#whitelist[*]}" "${whitelist[@]}" \
+ "${#blacklist[*]}" "${blacklist[@]}")
+
+if (( ! ${#candidates[*]} )); then
+ msg 'no candidate packages found for pruning'
+ exit 1
+fi
+
+# grab this prior to signature scavenging
+pkgcount=${#candidates[*]}
+
+# copy the list, merging in any found sigs
+for cand in "${candidates[@]}"; do
+ candtemp+=("$cand")
+ [[ -f $cand.sig ]] && candtemp+=("$cand.sig")
+done
+candidates=("${candtemp[@]}")
+unset candtemp
+
+# do this before we destroy anything
+totalsaved=$(@SIZECMD@ "${candidates[@]}" | awk '{ sum += $1 } END { print sum }')
+
+# crush. kill. destroy.
+(( verbose )) && cmdopts+=(-v)
+if (( delete )); then
+ runcmd rm "${cmdopts[@]}" "${candidates[@]}"
+elif (( move )); then
+ runcmd mv "${cmdopts[@]}" "${candidates[@]}" "$movedir"
+fi
+
+summarize "$pkgcount" "${candidates[@]}"
diff --git a/contrib/pacdiff.in b/contrib/pacdiff.in
index ac4ce893..3f26f381 100755
--- a/contrib/pacdiff.in
+++ b/contrib/pacdiff.in
@@ -1,4 +1,4 @@
-#!@BASH_SHELL@
+#!/bin/bash
# pacdiff : a simple pacnew/pacorig/pacsave updater
#
# Copyright (c) 2007 Aaron Griffin <aaronmgriffin@gmail.com>
diff --git a/contrib/paclist.in b/contrib/paclist.in
index 0379a4c5..84144f78 100755
--- a/contrib/paclist.in
+++ b/contrib/paclist.in
@@ -1,7 +1,8 @@
-#!/usr/bin/perl
+#!/bin/bash
# paclist - List all packages installed from a given repo
#
# Copyright (C) 2008 Dan McGee <dpmcgee@gmail.com>
+# Copyright (C) 2011 Dave Reisner <dreisner@archlinux.org>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -16,73 +17,27 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-use strict;
-use warnings;
+export TEXTDOMAIN='pacman'
+export TEXTDOMAINDIR='/usr/share/locale'
-my $progname = "paclist";
-my $version = "1.0";
-
-if ($#ARGV != 0 || $ARGV[0] eq "--help" || $ARGV[0] eq "-h") {
- print "$progname - List all packages installed from a given repo\n";
- print "Usage: $progname <repo>\n";
- print "Example: $progname testing\n";
- if ($#ARGV != 0) {
- exit 1;
+# determine whether we have gettext; make it a no-op if we do not
+if ! type gettext &>/dev/null; then
+ gettext() {
+ echo "$@"
}
- exit 0;
-}
-
-if ( $ARGV[0] eq "--version" || $ARGV[0] eq "-v") {
- print "$progname version $version\n";
- print "Copyright (C) 2008 Dan McGee\n";
- exit 0;
-}
-
-# This hash table will be used to store pairs of ('name version', count) from
-# the return of both pacman -Sl <repo> and pacman -Q output. We then check to
-# see if a value was added twice (count = 2)- if so, we will print that package
-# as it is both in the repo we queried and installed on our local system.
-my %packages = ();
-my $output;
+fi
-$output = `pacman -Sl $ARGV[0]`;
-if ($? != 0) {
- exit 1;
-}
-my @sync = split(/\n/, $output);
-# sample output from pacman -Sl:
-# testing foobar 1.0-1
-foreach $_ (@sync) {
- my @info = split(/ /);
- # we only want to store 'foobar 1.0-1' in our hash table
- my $pkg = $info[1] . " " . $info[2];
- $packages{$pkg}++;
-}
+if [[ -z $1 ]]; then
+ printf '%s - List all packages installed from a given repo\n' "${0##*/}"
+ printf 'Usage: %s <repo>\n' "${0##*/}"
+ printf 'Example: %s testing\n' "${0##*/}"
+ exit 1
+fi
-$output = `pacman -Q`;
-if ($? != 0) {
- exit 1;
-}
-# sample output from pacman -Q:
-# foobar 1.0-1
-my @local = split(/\n/, $output);
-foreach $_ (@local) {
- # store 'foobar 1.0-1' in our hash table
- $packages{$_}++;
-}
-
-# run comparison check- if value was added twice, it was in the intersection
-my @intersection;
-foreach $_ (keys %packages) {
- if ($packages{$_} == 2) {
- push @{ \@intersection }, $_;
- }
-}
+printf -v installed '[%s]' "$(gettext installed)"
+pacman -Sl $1 | awk -v i="$installed" '$NF == i { print $2,$3 }'
-# print our intersection, and bask in the glory and speed of perl
-@intersection = sort @intersection;
-foreach $_ (@intersection) {
- print $_ . "\n";
-}
+# exit with pacman's return value, not awk's
+exit ${PIPESTATUS[0]}
-#vim: set noet:
+# vim: set ts=2 sw=2 noet:
diff --git a/contrib/paclog-pkglist.in b/contrib/paclog-pkglist.in
new file mode 100755
index 00000000..27dfd302
--- /dev/null
+++ b/contrib/paclog-pkglist.in
@@ -0,0 +1,68 @@
+#!/bin/bash
+#
+# paclog-pkglist - Parse a log file into a list of currently installed packages
+#
+# Copyright (C) 2011 Dave Reisner <dave@archlinux.org>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+export TEXTDOMAIN='pacman'
+export TEXTDOMAINDIR='/usr/share/locale'
+declare logfile=${1:-@localstatedir@/log/pacman.log}
+
+if [[ $1 ]]; then
+ if [[ $1 = -@(h|-help) ]]; then
+ printf 'usage: %s [pacman log]\n' "${0##*/}"
+ printf 'example: %s @localstatedir@/log/pacman.log\n' "${0##*/}"
+ printf '\ndefaults to: @localstatedir@/log/pacman.log\n'
+ exit 0
+ elif [[ ! -e $logfile ]]; then
+ printf $"target not found: %s\n" "$1"
+ exit 1
+ fi
+fi
+
+<"$logfile" awk '
+{
+ action = $3
+ pkgname = $4
+ pkgver = $5
+ upgver = $7
+}
+
+NF == 5 && action == "installed" {
+ gsub(/[()]/, "", pkgver)
+ pkg[pkgname] = pkgver
+ next
+}
+
+NF == 7 && action == "upgraded" {
+ sub(/\)/, "", upgver)
+ pkg[pkgname] = upgver
+ next
+}
+
+NF == 5 && action == "removed" {
+ pkg[pkgname] = -1
+}
+
+END {
+ for (i in pkg) {
+ if (pkg[i] != -1) {
+ printf "%s %s\n",i,pkg[i]
+ }
+ }
+}' | sort
+
+# vim: set ts=2 sw=2 noet:
diff --git a/contrib/pacscripts.in b/contrib/pacscripts.in
index d3664091..37d3feae 100755
--- a/contrib/pacscripts.in
+++ b/contrib/pacscripts.in
@@ -1,4 +1,4 @@
-#!@BASH_SHELL@
+#!/bin/bash
#
# pacscripts : tries to print out the {pre,post}_{install,remove,upgrade}
# scripts of a given package
@@ -61,7 +61,7 @@ spacman() {
if [ $EUID -eq 0 ]; then
pacman "$@"
else
- if [ ! "$(type -p sudo)" ]; then
+ if ! type -p sudo; then
error "Cannot find the sudo binary! Is sudo installed?"
error "Otherwise try to run the program as root"
exit 1
diff --git a/contrib/pacsearch.in b/contrib/pacsearch.in
index dd848a73..db9d6ad1 100755
--- a/contrib/pacsearch.in
+++ b/contrib/pacsearch.in
@@ -111,6 +111,8 @@ if ($#querypkgs >= 0) {
foreach $_ (@querypkgs) {
# we grab 4 fields here: repo, name/ver, installed, and desc
my @pkgfields = /^(.*?)\/(.*?) ?(\[.*\])?\n(.*)$/s;
+ # skip any non-matching line
+ next if not defined $pkgfields[1];
# since installed is optional, we should fill it in if necessary
$pkgfields[2] = "" if not defined $pkgfields[2];
# check if the package was listed in the sync out
diff --git a/contrib/wget-xdelta.sh.in b/contrib/wget-xdelta.sh.in
deleted file mode 100755
index f2ac1c87..00000000
--- a/contrib/wget-xdelta.sh.in
+++ /dev/null
@@ -1,70 +0,0 @@
-#!@BASH_SHELL@
-
-if [ -r "@sysconfdir@/makepkg.conf" ]; then
- source @sysconfdir@/makepkg.conf
-else
- echo "wget-xdelta: Unable to find makepkg.conf"
- exit 1
-fi
-
-if [ -r ~/.makepkg.conf ]; then
- source ~/.makepkg.conf
-fi
-
-out_file=$(basename $1)
-file_url=$2
-
-if ! [[ "$out_file" =~ "pkg.tar.gz" ]]; then
- # If it's not a package file download as normal and exit.
- #wget --passive-ftp -c -O "$out_file" "$file_url"
- exit $?
-fi
-
-
-# Get the package name and version
-[[ "$out_file" =~ "$CARCH" ]] && arch="-$CARCH" || arch=""
-pkg_data=$(echo $out_file | \
- sed "s|^\(.*\)-\([[:alnum:]_\.]*-[[:alnum:]_\.]*\)${arch}${PKGEXT}.part|\1 \2|")
-pkgname=$(echo $pkg_data | cut -d ' ' -f 1)
-new_version=$(echo $pkg_data | cut -d ' ' -f 2)
-base_url=${file_url%/*}
-
-# Look for the last version
-for file in $(ls -r @localstatedir@/cache/pacman/pkg/${pkgname}-*-*{,-$CARCH}$PKGEXT 2>/dev/null); do
- [[ "$file" =~ "$CARCH" ]] && arch="-$CARCH" || arch=""
- check_version=$(echo $file | \
- sed "s|^.*/${pkgname}-\([[:alnum:]_\.]*-[[:alnum:]_\.]*\)${arch}$PKGEXT$|\1|" | \
- grep -v "^@localstatedir@/cache/pacman/pkg")
-
- [ "$check_version" = "" ] && continue
-
- vercmp=$(vercmp "$check_version" "$old_version")
- if [ "$check_version" != "$new_version" -a $vercmp -gt 0 ]; then
- old_version=$check_version
- old_file=$file
- fi
-done
-
-if [ "$old_version" != "" -a "$old_version" != "$new_version" ]; then
- # Great, we have a cached file, now calculate a patch name from it
- delta_name="$pkgname-${old_version}_to_${new_version}-${CARCH}.delta"
-
- echo "wget-xdelta: Attempting to download delta $delta_name..." >&2
- if wget --passive-ftp -c "$base_url/$delta_name"; then
- echo "wget-xdelta: Applying delta..."
- if xdelta patch "$delta_name" "$old_file" "$out_file"; then
- echo "wget-xdelta: Delta applied successfully!"
- rm "$delta_name"
- exit 0
- else
- echo "wget-xdelta: Failed to apply delta!"
- rm $delta_name
- fi
- fi
- fi
-
-echo "wget-xdelta: Downloading new package..."
-wget --passive-ftp -c -O "$out_file" "$file_url"
-exit $?
-
-# vim:set ts=4 sw=4 noet: