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_CC_C99
AC_PROG_INSTALL AC_PROG_INSTALL
AC_CHECK_PROGS([PYTHON], [python2.7 python2.6 python2.5 python2 python], [false]) 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 # find installed gettext
AM_GNU_GETTEXT([external], [need-ngettext]) 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([ AC_CONFIG_FILES([
lib/libalpm/Makefile lib/libalpm/Makefile
lib/libalpm/po/Makefile.in lib/libalpm/po/Makefile.in
lib/libalpm/libalpm.pc
src/pacman/Makefile src/pacman/Makefile
src/pacman/po/Makefile.in src/pacman/po/Makefile.in
src/util/Makefile src/util/Makefile

1
contrib/.gitignore vendored
View file

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

View file

@ -4,15 +4,22 @@ AUTOMAKE_OPTIONS = std-options
bin_SCRIPTS = \ bin_SCRIPTS = \
$(OURSCRIPTS) $(OURSCRIPTS)
OURSCRIPTS = \ BASHSCRIPTS = \
bacman \ bacman \
paccache \ paccache \
pacdiff \ pacdiff \
paclist \ paclist \
paclog-pkglist \ paclog-pkglist \
pacscripts \ pacscripts \
pacsearch \ pacsysclean \
pacsysclean rankmirrors
OTHERSCRIPTS = \
pacsearch
OURSCRIPTS = \
$(BASHSCRIPTS) \
$(OTHERSCRIPTS)
OURFILES = \ OURFILES = \
bash_completion \ bash_completion \
@ -20,15 +27,16 @@ OURFILES = \
EXTRA_DIST = \ EXTRA_DIST = \
PKGBUILD.vim \ PKGBUILD.vim \
bacman.in \ bacman.sh.in \
bash_completion.in \ bash_completion.in \
paccache.in \ paccache.sh.in \
paclog-pkglist.in \ paclog-pkglist.sh.in \
pacdiff.in \ pacdiff.sh.in \
paclist.in \ paclist.sh.in \
pacscripts.in \ pacscripts.sh.in \
pacsearch.in \ pacsearch.in \
pacsysclean.in \ pacsysclean.sh.in \
rankmirrors.sh.in
vimprojects \ vimprojects \
zsh_completion.in \ zsh_completion.in \
README README
@ -50,12 +58,18 @@ edit = sed \
-e 's|@SIZECMD[@]|$(SIZECMD)|g' \ -e 's|@SIZECMD[@]|$(SIZECMD)|g' \
-e '1s|!/bin/bash|!$(BASH_SHELL)|g' -e '1s|!/bin/bash|!$(BASH_SHELL)|g'
$(OURSCRIPTS): Makefile $(OTHERSCRIPTS): Makefile
$(AM_V_at)$(RM) $@ $@.tmp $(AM_V_at)$(RM) $@ $@.tmp
$(AM_V_GEN)$(edit) $(srcdir)/$@.in >$@.tmp $(AM_V_GEN)$(edit) $(srcdir)/$@.in >$@.tmp
$(AM_V_at)chmod +x,a-w $@.tmp $(AM_V_at)chmod +x,a-w $@.tmp
$(AM_V_at)mv $@.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 $(OURFILES): Makefile
$(AM_V_at)$(RM) $@ $@.tmp $(AM_V_at)$(RM) $@ $@.tmp
$(AM_V_GEN)$(edit) $(srcdir)/$@.in >$@.tmp $(AM_V_GEN)$(edit) $(srcdir)/$@.in >$@.tmp
@ -74,15 +88,16 @@ uninstall-local:
$(RM) $(DESTDIR)$(sysconfdir)/bash_completion.d/pacman $(RM) $(DESTDIR)$(sysconfdir)/bash_completion.d/pacman
$(RM) $(DESTDIR)$(datarootdir)/zsh/site-functions/_pacman $(RM) $(DESTDIR)$(datarootdir)/zsh/site-functions/_pacman
bacman: $(srcdir)/bacman.in bacman: $(srcdir)/bacman.sh.in
bash_completion: $(srcdir)/bash_completion.in bash_completion: $(srcdir)/bash_completion.in
paccache: $(srcdir)/paccache.in paccache: $(srcdir)/paccache.sh.in $(top_srcdir)/scripts/library/parseopts.sh
pacdiff: $(srcdir)/pacdiff.in pacdiff: $(srcdir)/pacdiff.sh.in
paclist: $(srcdir)/paclist.in paclist: $(srcdir)/paclist.sh.in
paclog-pkglist: $(srcdir)/paclog-pkglist.in paclog-pkglist: $(srcdir)/paclog-pkglist.sh.in
pacscripts: $(srcdir)/pacscripts.in pacscripts: $(srcdir)/pacscripts.sh.in
pacsearch: $(srcdir)/pacsearch.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 zsh_completion: $(srcdir)/zsh_completion.in
# vim:set ts=2 sw=2 noet: # vim:set ts=2 sw=2 noet:

View file

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

View file

@ -42,6 +42,8 @@ die() {
exit 1 exit 1
} }
m4_include(../scripts/library/parseopts.sh)
# reads a list of files on stdin and prints out deletion candidates # reads a list of files on stdin and prints out deletion candidates
pkgfilter() { pkgfilter() {
# there's whitelist and blacklist parameters passed to this # 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. containing pacman package tarballs.
Operations: Operations:
-d perform a dry run, only finding candidate packages. -d, --dryrun perform a dry run, only finding candidate packages.
-m <movedir> move candidate packages to 'movedir'. -m, --move <dir> move candidate packages to 'movedir'.
-r remove candidate packages. -r, --remove remove candidate packages.
Options: Options:
-a <arch> scan for 'arch' (default: all architectures). -a, --arch <arch> scan for 'arch' (default: all architectures).
-c <cachedir> scan 'cachedir' for packages (default: @localstatedir@/cache/pacman/pkg). -c, --cachedir <dir> scan 'cachedir' for packages (default: @localstatedir@/cache/pacman/pkg).
-f apply force to mv(1) and rm(1) operations. -f, --force apply force to mv(1) and rm(1) operations.
-h display this help message. -h, --help display this help message and exit.
-i <pkgs> ignore 'pkgs', which is a comma separated. Alternatively, -i, --ignore <pkgs> ignore 'pkgs', comma separated. Alternatively, specify '-' to
specify '-' to read package names from stdin, newline delimited. read package names from stdin, newline delimited.
-k <num> keep 'num' of each package in 'cachedir' (default: 3). -k, --keep <num> keep 'num' of each package in 'cachedir' (default: 3).
-u target uninstalled packages. -u, --uninstalled target uninstalled packages.
-v increase verbosity. specify up to 3 times. -v, --verbose increase verbosity. specify up to 3 times.
-z use null delimiters for candidate names (only with -v and -vv) -z, --null use null delimiters for candidate names (only with -v and -vv)
EOF EOF
} }
@ -213,47 +215,70 @@ if (( ! UID )); then
exit 42 exit 42
fi fi
# TODO: remove this workaround and use a sane command line parser (like the OPT_SHORT=':a:c:dfhi:k:m:rsuVvz'
# parse_options library from scripts/) here OPT_LONG=('arch:' 'cachedir:' 'dryrun' 'force' 'help' 'ignore:' 'keep:' 'move'
if [[ $1 = -@(h|-help) ]]; then 'remove' 'uninstalled' 'version' 'verbose' 'null')
usage
exit 0
elif [[ $1 = -@(V|-version) ]]; then
version
exit 0
fi
while getopts ':a:c:dfi:k:m:rsuvz' opt; do if ! parseopts "$OPT_SHORT" "${OPT_LONG[@]}" -- "$@"; then
case $opt in exit 1
a) scanarch=$OPTARG ;; fi
c) cachedir=$OPTARG ;; set -- "${OPTRET[@]}"
d) dryrun=1 ;; unset OPT_SHORT OPT_LONG OPTRET
f) cmdopts=(-f) ;;
i) if [[ $OPTARG = '-' ]]; then while :; do
[[ ! -t 0 ]] && IFS=$'\n' read -r -d '' -a ign case $1 in
else -a|--arch)
IFS=',' read -r -a ign <<< "$OPTARG" scanarch=$2
fi shift ;;
blacklist+=("${ign[@]}") -c|--cachedir)
unset i ign ;; cachedir=$2
k) keep=$OPTARG 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 if [[ -z $keep || -n ${keep//[0-9]/} ]]; then
die 'argument to option -k must be a non-negative integer' die 'argument to option -k must be a non-negative integer'
else else
keep=$(( 10#$keep )) keep=$(( 10#$keep ))
fi ;; fi
m) move=1 movedir=$OPTARG ;; shift ;;
r) delete=1 ;; -m|--move)
u) IFS=$'\n' read -r -d '' -a ign < <(pacman -Qq) move=1 movedir=$2
blacklist+=("${ign[@]}") shift ;;
unset ign ;; -r|--remove)
v) (( ++verbose )) ;; delete=1 ;;
z) delim='\0' ;; -u|--uninstalled)
:) die "option '--%s' requires an argument" "$OPTARG" ;; IFS=$'\n' read -r -d '' -a ign < <(pacman -Qq)
?) die "invalid option -- '%s'" "$OPTARG" ;; blacklist+=("${ign[@]}")
unset ign ;;
-V|--version)
version
exit 0 ;;
-v|--verbose)
(( ++verbose )) ;;
-z|--null)
delim='\0' ;;
--)
shift
break 2 ;;
esac esac
shift
done done
shift $(( OPTIND - 1 ))
# remaining args are a whitelist # remaining args are a whitelist
whitelist=("$@") whitelist=("$@")

View file

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

View file

@ -23,6 +23,9 @@ if ENABLE_GNU89_INLINE_CC
AM_CFLAGS += -fgnu89-inline AM_CFLAGS += -fgnu89-inline
endif endif
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libalpm.pc
libalpm_la_SOURCES = \ libalpm_la_SOURCES = \
add.h add.c \ add.h add.c \
alpm.h alpm.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-key
pacman-optimize pacman-optimize
pkgdelta pkgdelta
rankmirrors
repo-add repo-add
repo-elephant repo-elephant
repo-remove repo-remove

View file

@ -12,7 +12,6 @@ OURSCRIPTS = \
pacman-key \ pacman-key \
pacman-optimize \ pacman-optimize \
pkgdelta \ pkgdelta \
rankmirrors \
repo-add repo-add
EXTRA_DIST = \ EXTRA_DIST = \
@ -21,7 +20,6 @@ EXTRA_DIST = \
pacman-key.sh.in \ pacman-key.sh.in \
pacman-optimize.sh.in \ pacman-optimize.sh.in \
pkgdelta.sh.in \ pkgdelta.sh.in \
rankmirrors.sh.in \
repo-add.sh.in \ repo-add.sh.in \
$(LIBRARY) $(LIBRARY)
@ -64,6 +62,7 @@ $(OURSCRIPTS): Makefile
$(AM_V_at)$(RM) $@ $(AM_V_at)$(RM) $@
$(AM_V_GEN)test -f $(srcdir)/$@.sh.in && m4 -P -I $(srcdir) $(srcdir)/$@.sh.in | $(edit) >$@ $(AM_V_GEN)test -f $(srcdir)/$@.sh.in && m4 -P -I $(srcdir) $(srcdir)/$@.sh.in | $(edit) >$@
$(AM_V_at)chmod +x,a-w $@ $(AM_V_at)chmod +x,a-w $@
@$(BASH_SHELL) -O extglob -n $@
makepkg: \ makepkg: \
$(srcdir)/makepkg.sh.in \ $(srcdir)/makepkg.sh.in \
@ -86,8 +85,6 @@ pkgdelta: \
$(srcdir)/pkgdelta.sh.in \ $(srcdir)/pkgdelta.sh.in \
$(srcdir)/library/output_format.sh $(srcdir)/library/output_format.sh
rankmirrors: $(srcdir)/rankmirrors.sh.in
repo-add: \ repo-add: \
$(srcdir)/repo-add.sh.in \ $(srcdir)/repo-add.sh.in \
$(srcdir)/library/output_format.sh $(srcdir)/library/output_format.sh