Merge remote-tracking branch 'dave/buildsys'

This commit is contained in:
Dan McGee 2012-04-29 20:27:32 -05:00
commit 8c7202ca19
16 changed files with 141 additions and 72 deletions

View File

@ -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

1
contrib/.gitignore vendored
View File

@ -7,4 +7,5 @@ paclog-pkglist
pacscripts
pacsearch
pacsysclean
rankmirrors
zsh_completion

View File

@ -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:

View File

@ -305,4 +305,3 @@ echo Done
exit 0
# vim: set ts=2 sw=2 noet:

View File

@ -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=("$@")

View File

@ -2,3 +2,4 @@
.libs
*.lo
*.la
libalpm.pc

View File

@ -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 \

12
lib/libalpm/libalpm.pc.in Normal file
View File

@ -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@

1
scripts/.gitignore vendored
View File

@ -3,7 +3,6 @@ pacman-db-upgrade
pacman-key
pacman-optimize
pkgdelta
rankmirrors
repo-add
repo-elephant
repo-remove

View File

@ -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