index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
-rw-r--r-- | contrib/Makefile.am | 10 | ||||
-rw-r--r-- | contrib/README | 3 | ||||
-rwxr-xr-x | contrib/bacman.in | 2 | ||||
-rw-r--r-- | contrib/bash_completion.in | 10 | ||||
-rwxr-xr-x | contrib/pacdiff.in | 2 | ||||
-rwxr-xr-x | contrib/paclist.in | 85 | ||||
-rwxr-xr-x | contrib/paclog-pkglist.in | 68 | ||||
-rwxr-xr-x | contrib/pacscripts.in | 4 | ||||
-rwxr-xr-x | contrib/wget-xdelta.sh.in | 70 |
diff --git a/contrib/Makefile.am b/contrib/Makefile.am index 827d9ec0..69304a44 100644 --- a/contrib/Makefile.am +++ b/contrib/Makefile.am @@ -2,9 +2,9 @@ OURSCRIPTS = \ bacman \ pacdiff \ paclist \ + paclog-pkglist \ pacscripts \ - pacsearch \ - wget-xdelta.sh + pacsearch OURFILES = \ bash_completion \ @@ -14,12 +14,12 @@ EXTRA_DIST = \ PKGBUILD.vim \ bacman.in \ bash_completion.in \ + paclog-pkglist.in \ pacdiff.in \ paclist.in \ pacscripts.in \ pacsearch.in \ vimprojects \ - wget-xdelta.sh.in \ zsh_completion.in \ README @@ -29,7 +29,7 @@ MOSTLYCLEANFILES = $(OURSCRIPTS) $(OURFILES) *.tmp edit = sed \ -e 's|@sysconfdir[@]|$(sysconfdir)|g' \ -e 's|@localstatedir[@]|$(localstatedir)|g' \ - -e 's|@BASH_SHELL[@]|$(BASH_SHELL)|g' + -e '1s|!/bin/bash|!$(BASH_SHELL)|g' $(OURSCRIPTS): Makefile @echo ' ' GEN $@; @@ -52,10 +52,10 @@ bacman: $(srcdir)/bacman.in bash_completion: $(srcdir)/bash_completion.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/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/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/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: |