summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2012-04-29 20:27:32 -0500
committerDan McGee <dan@archlinux.org>2012-04-29 20:27:32 -0500
commit8c7202ca19361c35357140b0e3083cfa5bc12d21 (patch)
tree26111b943283582e4d4962138aa6e0fb1c70b5b9
parent9dd42dc0daab510a4e68118d89b5543936d2074f (diff)
parent82b7122542e16354b560bae9c7f6f3608873a8e1 (diff)
Merge remote-tracking branch 'dave/buildsys'
-rw-r--r--configure.ac19
-rw-r--r--contrib/.gitignore1
-rw-r--r--contrib/Makefile.am51
-rwxr-xr-xcontrib/bacman.sh.in (renamed from contrib/bacman.in)1
-rwxr-xr-xcontrib/paccache.sh.in (renamed from contrib/paccache.in)119
-rwxr-xr-xcontrib/pacdiff.sh.in (renamed from contrib/pacdiff.in)0
-rwxr-xr-xcontrib/paclist.sh.in (renamed from contrib/paclist.in)0
-rwxr-xr-xcontrib/paclog-pkglist.sh.in (renamed from contrib/paclog-pkglist.in)0
-rwxr-xr-xcontrib/pacscripts.sh.in (renamed from contrib/pacscripts.in)0
-rwxr-xr-xcontrib/pacsysclean.sh.in (renamed from contrib/pacsysclean.in)0
-rw-r--r--contrib/rankmirrors.sh.in (renamed from scripts/rankmirrors.sh.in)0
-rw-r--r--lib/libalpm/.gitignore1
-rw-r--r--lib/libalpm/Makefile.am3
-rw-r--r--lib/libalpm/libalpm.pc.in12
-rw-r--r--scripts/.gitignore1
-rw-r--r--scripts/Makefile.am5
16 files changed, 141 insertions, 72 deletions
diff --git a/configure.ac b/configure.ac
index d488bfaf..15e93e71 100644
--- a/configure.ac
+++ b/configure.ac
@@ -148,7 +148,23 @@ AC_PROG_AWK
AC_PROG_CC_C99
AC_PROG_INSTALL
AC_CHECK_PROGS([PYTHON], [python2.7 python2.6 python2.5 python2 python], [false])
-AC_PATH_PROGS([BASH_SHELL], [bash bash4 bash3], [false])
+AC_PATH_PROGS([BASH_SHELL], [bash bash4], [false])
+
+AS_IF([test "x$BASH_SHELL" = "xfalse"],
+ AC_MSG_WARN([*** bash >= 4.1.0 is required for pacman scripts]),
+ [bash_version_major=`$BASH_SHELL -c 'echo "${BASH_VERSINFO[[0]]}"'`
+ bash_version_minor=`$BASH_SHELL -c 'echo "${BASH_VERSINFO[[1]]}"'`
+ ok=yes
+ if test "$bash_version_major" -lt 4; then
+ ok=no
+ fi
+ if test "$bash_version_major" -eq 4 && test "$bash_version_minor" -lt 1; then
+ ok=no
+ fi
+ if test "$ok" = "no"; then
+ AC_MSG_ERROR([*** bash >= 4.1.0 is required for pacman scripts])
+ fi
+ unset bash_version_major bash_version_minor ok])
# find installed gettext
AM_GNU_GETTEXT([external], [need-ngettext])
@@ -433,6 +449,7 @@ AC_DEFINE_UNQUOTED([SCRIPTLET_SHELL], "$SCRIPTLET_SHELL", [The full path of the
AC_CONFIG_FILES([
lib/libalpm/Makefile
lib/libalpm/po/Makefile.in
+lib/libalpm/libalpm.pc
src/pacman/Makefile
src/pacman/po/Makefile.in
src/util/Makefile
diff --git a/contrib/.gitignore b/contrib/.gitignore
index 70d19093..01bc22bd 100644
--- a/contrib/.gitignore
+++ b/contrib/.gitignore
@@ -7,4 +7,5 @@ paclog-pkglist
pacscripts
pacsearch
pacsysclean
+rankmirrors
zsh_completion
diff --git a/contrib/Makefile.am b/contrib/Makefile.am
index a3d2d42b..a325d62a 100644
--- a/contrib/Makefile.am
+++ b/contrib/Makefile.am
@@ -4,15 +4,22 @@ AUTOMAKE_OPTIONS = std-options
bin_SCRIPTS = \
$(OURSCRIPTS)
-OURSCRIPTS = \
+BASHSCRIPTS = \
bacman \
paccache \
pacdiff \
paclist \
paclog-pkglist \
pacscripts \
- pacsearch \
- pacsysclean
+ pacsysclean \
+ rankmirrors
+
+OTHERSCRIPTS = \
+ pacsearch
+
+OURSCRIPTS = \
+ $(BASHSCRIPTS) \
+ $(OTHERSCRIPTS)
OURFILES = \
bash_completion \
@@ -20,15 +27,16 @@ OURFILES = \
EXTRA_DIST = \
PKGBUILD.vim \
- bacman.in \
+ bacman.sh.in \
bash_completion.in \
- paccache.in \
- paclog-pkglist.in \
- pacdiff.in \
- paclist.in \
- pacscripts.in \
+ paccache.sh.in \
+ paclog-pkglist.sh.in \
+ pacdiff.sh.in \
+ paclist.sh.in \
+ pacscripts.sh.in \
pacsearch.in \
- pacsysclean.in \
+ pacsysclean.sh.in \
+ rankmirrors.sh.in
vimprojects \
zsh_completion.in \
README
@@ -50,12 +58,18 @@ edit = sed \
-e 's|@SIZECMD[@]|$(SIZECMD)|g' \
-e '1s|!/bin/bash|!$(BASH_SHELL)|g'
-$(OURSCRIPTS): Makefile
+$(OTHERSCRIPTS): Makefile
$(AM_V_at)$(RM) $@ $@.tmp
$(AM_V_GEN)$(edit) $(srcdir)/$@.in >$@.tmp
$(AM_V_at)chmod +x,a-w $@.tmp
$(AM_V_at)mv $@.tmp $@
+$(BASHSCRIPTS): Makefile
+ $(AM_V_at)$(RM) $@
+ $(AM_V_GEN)test -f $(srcdir)/$@.sh.in && m4 -P -I $(srcdir) $(srcdir)/$@.sh.in | $(edit) >$@
+ $(AM_V_at)chmod +x,a-w $@
+ @$(BASH_SHELL) -O extglob -n $@
+
$(OURFILES): Makefile
$(AM_V_at)$(RM) $@ $@.tmp
$(AM_V_GEN)$(edit) $(srcdir)/$@.in >$@.tmp
@@ -74,15 +88,16 @@ uninstall-local:
$(RM) $(DESTDIR)$(sysconfdir)/bash_completion.d/pacman
$(RM) $(DESTDIR)$(datarootdir)/zsh/site-functions/_pacman
-bacman: $(srcdir)/bacman.in
+bacman: $(srcdir)/bacman.sh.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
+paccache: $(srcdir)/paccache.sh.in $(top_srcdir)/scripts/library/parseopts.sh
+pacdiff: $(srcdir)/pacdiff.sh.in
+paclist: $(srcdir)/paclist.sh.in
+paclog-pkglist: $(srcdir)/paclog-pkglist.sh.in
+pacscripts: $(srcdir)/pacscripts.sh.in
pacsearch: $(srcdir)/pacsearch.in
-pacsysclean: $(srcdir)/pacsysclean.in
+pacsysclean: $(srcdir)/pacsysclean.sh.in
+rankmirrors: $(srcdir)/rankmirrors.sh.in
zsh_completion: $(srcdir)/zsh_completion.in
# vim:set ts=2 sw=2 noet:
diff --git a/contrib/bacman.in b/contrib/bacman.sh.in
index 93623565..ffb9d6d3 100755
--- a/contrib/bacman.in
+++ b/contrib/bacman.sh.in
@@ -305,4 +305,3 @@ echo Done
exit 0
# vim: set ts=2 sw=2 noet:
-
diff --git a/contrib/paccache.in b/contrib/paccache.sh.in
index da65f476..e8116721 100755
--- a/contrib/paccache.in
+++ b/contrib/paccache.sh.in
@@ -42,6 +42,8 @@ die() {
exit 1
}
+m4_include(../scripts/library/parseopts.sh)
+
# reads a list of files on stdin and prints out deletion candidates
pkgfilter() {
# there's whitelist and blacklist parameters passed to this
@@ -184,21 +186,21 @@ 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.
+ -d, --dryrun perform a dry run, only finding candidate packages.
+ -m, --move <dir> move candidate packages to 'movedir'.
+ -r, --remove 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)
+ -a, --arch <arch> scan for 'arch' (default: all architectures).
+ -c, --cachedir <dir> scan 'cachedir' for packages (default: @localstatedir@/cache/pacman/pkg).
+ -f, --force apply force to mv(1) and rm(1) operations.
+ -h, --help display this help message and exit.
+ -i, --ignore <pkgs> ignore 'pkgs', comma separated. Alternatively, specify '-' to
+ read package names from stdin, newline delimited.
+ -k, --keep <num> keep 'num' of each package in 'cachedir' (default: 3).
+ -u, --uninstalled target uninstalled packages.
+ -v, --verbose increase verbosity. specify up to 3 times.
+ -z, --null use null delimiters for candidate names (only with -v and -vv)
EOF
}
@@ -213,47 +215,70 @@ if (( ! UID )); then
exit 42
fi
-# TODO: remove this workaround and use a sane command line parser (like the
-# parse_options library from scripts/) here
-if [[ $1 = -@(h|-help) ]]; then
- usage
- exit 0
-elif [[ $1 = -@(V|-version) ]]; then
- version
- exit 0
-fi
+OPT_SHORT=':a:c:dfhi:k:m:rsuVvz'
+OPT_LONG=('arch:' 'cachedir:' 'dryrun' 'force' 'help' 'ignore:' 'keep:' 'move'
+ 'remove' 'uninstalled' 'version' 'verbose' 'null')
-while getopts ':a:c:dfi:k:m:rsuvz' opt; do
- case $opt in
- a) scanarch=$OPTARG ;;
- c) cachedir=$OPTARG ;;
- d) dryrun=1 ;;
- f) cmdopts=(-f) ;;
- 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 ! parseopts "$OPT_SHORT" "${OPT_LONG[@]}" -- "$@"; then
+ exit 1
+fi
+set -- "${OPTRET[@]}"
+unset OPT_SHORT OPT_LONG OPTRET
+
+while :; do
+ case $1 in
+ -a|--arch)
+ scanarch=$2
+ shift ;;
+ -c|--cachedir)
+ cachedir=$2
+ shift ;;
+ -d|--dryrun)
+ dryrun=1 ;;
+ -f|--force)
+ cmdopts=(-f) ;;
+ -h|--help)
+ usage
+ exit 0 ;;
+ -i|--ignore)
+ if [[ $2 = '-' ]]; then
+ [[ ! -t 0 ]] && IFS=$'\n' read -r -d '' -a ign
+ else
+ IFS=',' read -r -a ign <<< "$2"
+ fi
+ blacklist+=("${ign[@]}")
+ unset i ign
+ shift ;;
+ -k|--keep)
+ keep=$2
if [[ -z $keep || -n ${keep//[0-9]/} ]]; then
die 'argument to option -k must be a non-negative integer'
else
keep=$(( 10#$keep ))
- 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" ;;
+ fi
+ shift ;;
+ -m|--move)
+ move=1 movedir=$2
+ shift ;;
+ -r|--remove)
+ delete=1 ;;
+ -u|--uninstalled)
+ IFS=$'\n' read -r -d '' -a ign < <(pacman -Qq)
+ blacklist+=("${ign[@]}")
+ unset ign ;;
+ -V|--version)
+ version
+ exit 0 ;;
+ -v|--verbose)
+ (( ++verbose )) ;;
+ -z|--null)
+ delim='\0' ;;
+ --)
+ shift
+ break 2 ;;
esac
+ shift
done
-shift $(( OPTIND - 1 ))
# remaining args are a whitelist
whitelist=("$@")
diff --git a/contrib/pacdiff.in b/contrib/pacdiff.sh.in
index bfafda26..bfafda26 100755
--- a/contrib/pacdiff.in
+++ b/contrib/pacdiff.sh.in
diff --git a/contrib/paclist.in b/contrib/paclist.sh.in
index 7883e21b..7883e21b 100755
--- a/contrib/paclist.in
+++ b/contrib/paclist.sh.in
diff --git a/contrib/paclog-pkglist.in b/contrib/paclog-pkglist.sh.in
index 222bbc4c..222bbc4c 100755
--- a/contrib/paclog-pkglist.in
+++ b/contrib/paclog-pkglist.sh.in
diff --git a/contrib/pacscripts.in b/contrib/pacscripts.sh.in
index 84687145..84687145 100755
--- a/contrib/pacscripts.in
+++ b/contrib/pacscripts.sh.in
diff --git a/contrib/pacsysclean.in b/contrib/pacsysclean.sh.in
index 162530ef..162530ef 100755
--- a/contrib/pacsysclean.in
+++ b/contrib/pacsysclean.sh.in
diff --git a/scripts/rankmirrors.sh.in b/contrib/rankmirrors.sh.in
index 875a1439..875a1439 100644
--- a/scripts/rankmirrors.sh.in
+++ b/contrib/rankmirrors.sh.in
diff --git a/lib/libalpm/.gitignore b/lib/libalpm/.gitignore
index 36d41441..82318d3f 100644
--- a/lib/libalpm/.gitignore
+++ b/lib/libalpm/.gitignore
@@ -2,3 +2,4 @@
.libs
*.lo
*.la
+libalpm.pc
diff --git a/lib/libalpm/Makefile.am b/lib/libalpm/Makefile.am
index 0781d5d8..ef448417 100644
--- a/lib/libalpm/Makefile.am
+++ b/lib/libalpm/Makefile.am
@@ -23,6 +23,9 @@ if ENABLE_GNU89_INLINE_CC
AM_CFLAGS += -fgnu89-inline
endif
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = libalpm.pc
+
libalpm_la_SOURCES = \
add.h add.c \
alpm.h alpm.c \
diff --git a/lib/libalpm/libalpm.pc.in b/lib/libalpm/libalpm.pc.in
new file mode 100644
index 00000000..fe4e2583
--- /dev/null
+++ b/lib/libalpm/libalpm.pc.in
@@ -0,0 +1,12 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: libalpm
+Description: Arch Linux package management library
+URL: http://www.archlinux.org/pacman/
+Version: @VERSION@
+Cflags: -I${includedir}
+Libs: -L${libdir} -lalpm
+Libs.private: @LIBS@ @LIBARCHIVE_LIBS@ @LIBSSL_LIBS@ @LIBCURL_LIBS@ @GPGME_LIBS@
diff --git a/scripts/.gitignore b/scripts/.gitignore
index 21b671c0..9e403bfb 100644
--- a/scripts/.gitignore
+++ b/scripts/.gitignore
@@ -3,7 +3,6 @@ pacman-db-upgrade
pacman-key
pacman-optimize
pkgdelta
-rankmirrors
repo-add
repo-elephant
repo-remove
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index b8a19900..a1a4f366 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -12,7 +12,6 @@ OURSCRIPTS = \
pacman-key \
pacman-optimize \
pkgdelta \
- rankmirrors \
repo-add
EXTRA_DIST = \
@@ -21,7 +20,6 @@ EXTRA_DIST = \
pacman-key.sh.in \
pacman-optimize.sh.in \
pkgdelta.sh.in \
- rankmirrors.sh.in \
repo-add.sh.in \
$(LIBRARY)
@@ -64,6 +62,7 @@ $(OURSCRIPTS): Makefile
$(AM_V_at)$(RM) $@
$(AM_V_GEN)test -f $(srcdir)/$@.sh.in && m4 -P -I $(srcdir) $(srcdir)/$@.sh.in | $(edit) >$@
$(AM_V_at)chmod +x,a-w $@
+ @$(BASH_SHELL) -O extglob -n $@
makepkg: \
$(srcdir)/makepkg.sh.in \
@@ -86,8 +85,6 @@ pkgdelta: \
$(srcdir)/pkgdelta.sh.in \
$(srcdir)/library/output_format.sh
-rankmirrors: $(srcdir)/rankmirrors.sh.in
-
repo-add: \
$(srcdir)/repo-add.sh.in \
$(srcdir)/library/output_format.sh