summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/.gitignore3
-rw-r--r--scripts/Makefile.am99
-rw-r--r--scripts/completion/.gitignore2
-rw-r--r--scripts/completion/bash_completion.in156
-rw-r--r--scripts/completion/zsh_completion.in723
-rw-r--r--scripts/libmakepkg/.gitignore3
-rw-r--r--scripts/libmakepkg/integrity.sh.in2
-rw-r--r--scripts/libmakepkg/integrity/generate_checksum.sh.in11
-rw-r--r--scripts/libmakepkg/integrity/generate_signature.sh.in2
-rw-r--r--scripts/libmakepkg/integrity/verify_checksum.sh.in6
-rw-r--r--scripts/libmakepkg/integrity/verify_signature.sh.in131
-rw-r--r--scripts/libmakepkg/lint_package.sh.in6
-rw-r--r--scripts/libmakepkg/lint_package/build_references.sh.in19
-rw-r--r--scripts/libmakepkg/lint_package/dotfiles.sh.in38
-rw-r--r--scripts/libmakepkg/lint_package/file_names.sh.in42
-rw-r--r--scripts/libmakepkg/lint_package/missing_backup.sh.in3
-rw-r--r--scripts/libmakepkg/lint_pkgbuild.sh.in2
-rw-r--r--scripts/libmakepkg/lint_pkgbuild/arch.sh.in2
-rw-r--r--scripts/libmakepkg/lint_pkgbuild/backup.sh.in2
-rw-r--r--scripts/libmakepkg/lint_pkgbuild/changelog.sh.in2
-rw-r--r--scripts/libmakepkg/lint_pkgbuild/epoch.sh.in2
-rw-r--r--scripts/libmakepkg/lint_pkgbuild/install.sh.in2
-rw-r--r--scripts/libmakepkg/lint_pkgbuild/optdepends.sh.in2
-rw-r--r--scripts/libmakepkg/lint_pkgbuild/options.sh.in2
-rw-r--r--scripts/libmakepkg/lint_pkgbuild/package_function.sh.in2
-rw-r--r--scripts/libmakepkg/lint_pkgbuild/pkgbase.sh.in2
-rw-r--r--scripts/libmakepkg/lint_pkgbuild/pkglist.sh.in2
-rw-r--r--scripts/libmakepkg/lint_pkgbuild/pkgname.sh.in7
-rw-r--r--scripts/libmakepkg/lint_pkgbuild/pkgrel.sh.in2
-rw-r--r--scripts/libmakepkg/lint_pkgbuild/pkgver.sh.in6
-rw-r--r--scripts/libmakepkg/lint_pkgbuild/provides.sh.in2
-rw-r--r--scripts/libmakepkg/lint_pkgbuild/source.sh.in2
-rw-r--r--scripts/libmakepkg/lint_pkgbuild/util.sh.in2
-rw-r--r--scripts/libmakepkg/lint_pkgbuild/variable.sh.in2
-rw-r--r--scripts/libmakepkg/source.sh.in2
-rw-r--r--scripts/libmakepkg/source/bzr.sh.in2
-rw-r--r--scripts/libmakepkg/source/file.sh.in2
-rw-r--r--scripts/libmakepkg/source/git.sh.in13
-rw-r--r--scripts/libmakepkg/source/hg.sh.in2
-rw-r--r--scripts/libmakepkg/source/local.sh.in2
-rw-r--r--scripts/libmakepkg/source/svn.sh.in2
-rw-r--r--scripts/libmakepkg/srcinfo.sh.in2
-rw-r--r--scripts/libmakepkg/tidy.sh.in2
-rw-r--r--scripts/libmakepkg/tidy/docs.sh.in2
-rw-r--r--scripts/libmakepkg/tidy/emptydirs.sh.in2
-rw-r--r--scripts/libmakepkg/tidy/libtool.sh.in2
-rw-r--r--scripts/libmakepkg/tidy/purge.sh.in2
-rw-r--r--scripts/libmakepkg/tidy/staticlibs.sh.in2
-rw-r--r--scripts/libmakepkg/tidy/strip.sh.in27
-rw-r--r--scripts/libmakepkg/tidy/zipman.sh.in2
-rw-r--r--scripts/libmakepkg/util.sh.in2
-rw-r--r--scripts/libmakepkg/util/message.sh.in (renamed from scripts/libmakepkg/util/message.sh)2
-rw-r--r--scripts/libmakepkg/util/option.sh.in (renamed from scripts/libmakepkg/util/option.sh)2
-rw-r--r--scripts/libmakepkg/util/parseopts.sh.in (renamed from scripts/library/parseopts.sh)50
-rw-r--r--scripts/libmakepkg/util/pkgbuild.sh.in2
-rw-r--r--scripts/libmakepkg/util/source.sh.in29
-rw-r--r--scripts/libmakepkg/util/util.sh.in (renamed from scripts/libmakepkg/util/util.sh)2
-rw-r--r--scripts/library/README20
-rwxr-xr-xscripts/makepkg-template.pl.in4
-rw-r--r--scripts/makepkg.sh.in190
-rw-r--r--scripts/pacman-db-upgrade.sh.in9
-rw-r--r--scripts/pacman-key.sh.in11
-rw-r--r--scripts/pacman-optimize.sh.in189
-rw-r--r--scripts/pkgdelta.sh.in11
-rw-r--r--scripts/po/POTFILES.in7
-rw-r--r--scripts/repo-add.sh.in28
-rw-r--r--scripts/wrapper.sh.in (renamed from scripts/makepkg-wrapper.sh.in)6
67 files changed, 1444 insertions, 479 deletions
diff --git a/scripts/.gitignore b/scripts/.gitignore
index 8dac5035..3a5ac8a7 100644
--- a/scripts/.gitignore
+++ b/scripts/.gitignore
@@ -1,10 +1,9 @@
makepkg
makepkg-template
-makepkg-wrapper
pacman-db-upgrade
pacman-key
-pacman-optimize
pkgdelta
repo-add
repo-elephant
repo-remove
+*-wrapper
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index e4f9fb1b..4bb08a24 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -1,39 +1,41 @@
# enforce that all scripts have a --help and --version option
AUTOMAKE_OPTIONS = std-options
-AM_INSTALLCHECK_STD_OPTIONS_EXEMPT = makepkg-wrapper
+AM_INSTALLCHECK_STD_OPTIONS_EXEMPT = \
+ makepkg-wrapper \
+ pacman-db-upgrade-wrapper \
+ pacman-key-wrapper \
+ pkgdelta-wrapper
SUBDIRS = po
bin_SCRIPTS = \
$(OURSCRIPTS) \
makepkg-template \
- makepkg-wrapper \
repo-remove \
- repo-elephant
+ repo-elephant \
+ $(WRAPPER)
OURSCRIPTS = \
makepkg \
pacman-db-upgrade \
pacman-key \
- pacman-optimize \
pkgdelta \
repo-add
EXTRA_DIST = \
makepkg.sh.in \
makepkg-template.pl.in \
- makepkg-wrapper.sh.in \
pacman-db-upgrade.sh.in \
pacman-key.sh.in \
- pacman-optimize.sh.in \
pkgdelta.sh.in \
repo-add.sh.in \
+ wrapper.sh.in \
+ $(COMPLETION_DIST) \
$(LIBRARY) \
$(LIBMAKEPKG_DIST)
LIBRARY = \
library/output_format.sh \
- library/parseopts.sh \
library/human_to_size.sh \
library/size_to_human.sh \
library/term_colors.sh
@@ -48,11 +50,6 @@ LIBMAKEPKGDIRS = \
tidy \
util
-LIBMAKEPKG = \
- libmakepkg/util/message.sh \
- libmakepkg/util/option.sh \
- libmakepkg/util/util.sh
-
LIBMAKEPKG_IN = \
libmakepkg/integrity.sh \
libmakepkg/integrity/generate_checksum.sh \
@@ -61,6 +58,8 @@ LIBMAKEPKG_IN = \
libmakepkg/integrity/verify_signature.sh \
libmakepkg/lint_package.sh \
libmakepkg/lint_package/build_references.sh \
+ libmakepkg/lint_package/dotfiles.sh \
+ libmakepkg/lint_package/file_names.sh \
libmakepkg/lint_package/missing_backup.sh \
libmakepkg/lint_pkgbuild.sh \
libmakepkg/lint_pkgbuild/arch.sh \
@@ -97,15 +96,31 @@ LIBMAKEPKG_IN = \
libmakepkg/tidy/strip.sh \
libmakepkg/tidy/zipman.sh \
libmakepkg/util.sh \
+ libmakepkg/util/message.sh \
+ libmakepkg/util/option.sh \
+ libmakepkg/util/parseopts.sh \
libmakepkg/util/pkgbuild.sh \
- libmakepkg/util/source.sh
+ libmakepkg/util/source.sh \
+ libmakepkg/util/util.sh
LIBMAKEPKG_DIST = \
- $(LIBMAKEPKG) \
$(addsuffix .in, $(LIBMAKEPKG_IN))
+WRAPPER = \
+ makepkg-wrapper \
+ pacman-db-upgrade-wrapper \
+ pacman-key-wrapper \
+ pkgdelta-wrapper
+
+COMPLETION_IN = \
+ completion/bash_completion \
+ completion/zsh_completion
+
+COMPLETION_DIST = \
+ $(addsuffix .in, $(COMPLETION_IN))
+
# Files that should be removed, but which Automake does not know.
-MOSTLYCLEANFILES = $(bin_SCRIPTS) $(LIBMAKEPKG_IN)
+MOSTLYCLEANFILES = $(bin_SCRIPTS) $(LIBMAKEPKG_IN) $(COMPLETION_IN)
clean-local:
$(AM_V_at)$(RM) -r .lib
@@ -159,10 +174,17 @@ $(LIBMAKEPKG_IN): %: %.in Makefile
$(AM_V_at)chmod a-w $@
@$(BASH_SHELL) -O extglob -n $@
+$(COMPLETION_IN): %: %.in Makefile
+ $(AM_V_at)$(RM) $@
+ $(AM_V_at)$(MKDIR_P) $(dir $@)
+ $(AM_V_GEN)$(edit) $(srcdir)/$@.in >$@
+ $(AM_V_at)chmod a-w $@
+
+all-am: $(COMPLETION_IN)
+
makepkg: \
$(srcdir)/makepkg.sh.in \
- $(srcdir)/makepkg-wrapper.sh.in \
- $(srcdir)/library/parseopts.sh \
+ $(srcdir)/wrapper.sh.in \
$(LIBMAKEPKG_IN)
makepkg-template: \
@@ -179,17 +201,11 @@ pacman-db-upgrade: \
pacman-key: \
$(srcdir)/pacman-key.sh.in \
- $(srcdir)/library/output_format.sh \
- $(srcdir)/library/parseopts.sh
-
-pacman-optimize: \
- $(srcdir)/pacman-optimize.sh.in \
$(srcdir)/library/output_format.sh
pkgdelta: \
$(srcdir)/pkgdelta.sh.in \
- $(srcdir)/library/output_format.sh \
- $(srcdir)/library/parseopts.sh
+ $(srcdir)/library/output_format.sh
repo-add: \
$(srcdir)/repo-add.sh.in \
@@ -203,26 +219,36 @@ repo-elephant: $(srcdir)/repo-add.sh.in
$(AM_V_at)$(RM) repo-elephant
$(AM_V_at)$(LN_S) repo-add repo-elephant
-makepkg-wrapper: \
- Makefile \
- $(srcdir)/makepkg-wrapper.sh.in \
- $(srcdir)/makepkg.sh.in \
- $(srcdir)/library/parseopts.sh \
- | makepkg
+.SECONDEXPANSION:
+$(WRAPPER): \
+ $$(subst -wrapper,,$$@)
+
$(AM_V_at)$(MKDIR_P) .lib
- $(AM_V_at)mv -f makepkg .lib
+ $(AM_V_at)mv -f $(subst -wrapper,,$@) .lib
$(AM_V_at)$(RM) $@
$(AM_V_GEN)sed \
-e "s|@PWD[@]|$$(pwd)|" \
+ -e "s|@PROGNAME[@]|$(subst -wrapper,,$@)|g" \
-e '1s|!/bin/bash|!$(BASH_SHELL)|g' \
- $(srcdir)/$@.sh.in > $@
+ $(srcdir)/wrapper.sh.in > $@
$(AM_V_at)chmod +x,a-w $@
- $(AM_V_at)$(LN_S) makepkg-wrapper makepkg
+ $(AM_V_at)$(LN_S) $@ $(subst -wrapper,,$@)
+
+install-data-local:
+ $(MKDIR_P) $(DESTDIR)$(sysconfdir)/bash_completion.d/
+ $(INSTALL_DATA) completion/bash_completion $(DESTDIR)$(sysconfdir)/bash_completion.d/pacman
+ $(MKDIR_P) $(DESTDIR)$(datarootdir)/zsh/site-functions/
+ $(INSTALL_DATA) completion/zsh_completion $(DESTDIR)$(datarootdir)/zsh/site-functions/_pacman
+
+uninstall-local:
+ $(RM) $(DESTDIR)$(sysconfdir)/bash_completion.d/pacman
+ $(RM) $(DESTDIR)$(datarootdir)/zsh/site-functions/_pacman
install-exec-hook:
- cd $(DESTDIR)$(bindir) && \
- $(RM) makepkg makepkg-wrapper
- $(INSTALL) .lib/makepkg $(DESTDIR)$(bindir)/makepkg
+ for wrapper in $(WRAPPER); do \
+ $(RM) $(DESTDIR)$(bindir)/$${wrapper}; \
+ $(INSTALL) .lib/$${wrapper%-wrapper} $(DESTDIR)$(bindir)/$${wrapper%-wrapper}; \
+ done
for dir in $(LIBMAKEPKGDIRS); do \
$(MKDIR_P) $(DESTDIR)$(libmakepkgdir)/$$dir; \
done
@@ -253,4 +279,5 @@ uninstall-hook:
$(RM) -r $(DESTDIR)$(libmakepkgdir)/$$dir; \
done
+
# vim:set noet:
diff --git a/scripts/completion/.gitignore b/scripts/completion/.gitignore
new file mode 100644
index 00000000..881bfd14
--- /dev/null
+++ b/scripts/completion/.gitignore
@@ -0,0 +1,2 @@
+bash_completion
+zsh_completion
diff --git a/scripts/completion/bash_completion.in b/scripts/completion/bash_completion.in
new file mode 100644
index 00000000..06963c42
--- /dev/null
+++ b/scripts/completion/bash_completion.in
@@ -0,0 +1,156 @@
+# This file is in the public domain.
+
+_arch_compgen() {
+ local i r
+ COMPREPLY=($(compgen -W '$*' -- "$cur"))
+ for ((i=1; i < ${#COMP_WORDS[@]}-1; i++)); do
+ for r in ${!COMPREPLY[@]}; do
+ if [[ ${COMP_WORDS[i]} = ${COMPREPLY[r]} ]]; then
+ unset 'COMPREPLY[r]'; break
+ fi
+ done
+ done
+}
+
+_arch_ptr2comp() {
+ local list= x y
+ for x; do
+ for y in '0 --' '1 -'; do
+ eval 'set -- ${'$x'[${y% *}]}'
+ list+=\ ${@/#/${y#* }}
+ done
+ done
+ _arch_compgen $list
+}
+
+_arch_incomp() {
+ local r="\s-(-${1#* }\s|\w*${1% *})"; [[ $COMP_LINE =~ $r ]]
+}
+
+_pacman_keyids() {
+ \pacman-key --list-keys 2>/dev/null | awk '
+ $1 == "pub" {
+ # key id
+ split($2, a, "/"); print a[2]
+ }
+ $1 == "uid" {
+ # email
+ if (match($NF, /<[^>]+>/))
+ print substr($NF, RSTART + 1, RLENGTH - 2)
+ }'
+}
+
+_pacman_key() {
+ local o cur opts prev wantfiles
+ COMPREPLY=()
+ _get_comp_words_by_ref cur prev
+ opts=('add config delete edit-key export finger gpgdir
+ help import import-trustdb init keyserver list-keys list-sigs
+ lsign-key nocolor populate recv-keys refresh-keys updatedb
+ verify version'
+ 'a d e f h l r u v V')
+
+ # operations for which we want to complete keyids
+ for o in 'd delete' 'e export' 'f finger' 'l list-keys' 'r recv-keys' \
+ 'edit-key' 'list-sigs' 'lsign-key' 'refresh-keys'; do
+ _arch_incomp "$o" && break
+ unset o
+ done
+
+ # options for which we want file completion
+ wantfiles='-@(c|-config|g|-gpgdir)'
+
+ if [[ $prev = 'pacman-key' || ( $cur = -* && $prev != $wantfiles ) ]]; then
+ _arch_ptr2comp opts
+ elif [[ $prev = @(-k|--keyserver) ]]; then
+ return
+ elif [[ $prev != $wantfiles && $o ]]; then
+ COMPREPLY=($(compgen -W '$(_pacman_keyids)' -- "$cur"))
+ fi
+ true
+}
+
+_makepkg() {
+ local cur opts prev
+ COMPREPLY=()
+ _get_comp_words_by_ref cur prev
+ if [[ $cur = -* && ! $prev =~ ^-(-(config|help|key|version)$|\w*[Vhp]) ]]; then
+ opts=('allsource asdeps check clean cleanbuild config force geninteg help
+ holdver ignorearch install key log needed noarchive nobuild nocheck
+ nocolor noconfirm nodeps noextract noprepare noprogressbar nosign
+ packagelist printsrcinfo repackage rmdeps sign skipchecksums
+ skipinteg skippgpcheck source syncdeps verifysource version'
+ 'A C L R S c d e f g h i m o p r s')
+ _arch_ptr2comp opts
+ fi
+ true
+}
+
+_pacman_pkg() {
+ _arch_compgen "$(
+ if [[ $2 ]]; then
+ \pacman -$1 2>/dev/null | \cut -d' ' -f1 | \sort -u
+ else
+ \pacman -$1 2>/dev/null
+ fi
+ )"
+}
+
+_pacman() {
+ local common core cur database files prev query remove sync upgrade o
+ COMPREPLY=()
+ _get_comp_words_by_ref cur prev
+ database=('asdeps asexplicit')
+ files=('list machinereadable owns search refresh regex' 'l o s x y')
+ query=('changelog check deps explicit file foreign groups info list owns
+ search unrequired upgrades' 'c e g i k l m o p s t u')
+ remove=('cascade dbonly nodeps assume-installed nosave print recursive unneeded' 'c n p s u')
+ sync=('asdeps asexplicit clean dbonly downloadonly force groups ignore ignoregroup
+ info list needed nodeps assume-installed print refresh recursive search sysupgrade'
+ 'c g i l p s u w y')
+ upgrade=('asdeps asexplicit force needed nodeps assume-installed print recursive' 'p')
+ common=('arch cachedir color config confirm dbpath debug gpgdir help hookdir logfile
+ noconfirm noprogressbar noscriptlet quiet root verbose' 'b d h q r v')
+ core=('database files help query remove sync upgrade version' 'D F Q R S U V h')
+
+ for o in 'D database' 'F files' 'Q query' 'R remove' 'S sync' 'U upgrade'; do
+ _arch_incomp "$o" && break
+ done
+
+ if [[ $? != 0 ]]; then
+ _arch_ptr2comp core
+ elif [[ ! $prev =~ ^-\w*[Vbhr] &&
+ ! $prev = --@(cachedir|color|config|dbpath|help|hookdir|gpgdir|logfile|root|version) ]]
+ then
+ [[ $cur = -* ]] && _arch_ptr2comp ${o#* } common ||
+ case ${o% *} in
+ D|R)
+ _pacman_pkg Qq;;
+ F)
+ _arch_incomp 'l list' && _pacman_pkg Slq;
+ ;;
+ Q)
+ { _arch_incomp 'g groups' && _pacman_pkg Qg sort; } ||
+ { _arch_incomp 'p file' && _pacman_file; } ||
+ _arch_incomp 'o owns' || _arch_incomp 'u upgrades' ||
+ _pacman_pkg Qq;;
+ S)
+ { _arch_incomp 'g groups' && _pacman_pkg Sg; } ||
+ { _arch_incomp 'l list' && _pacman_pkg Sl sort; } ||
+ _pacman_pkg Slq;;
+ U)
+ _pacman_file;;
+ esac
+ fi
+ true
+}
+
+_pacman_file() {
+ compopt -o filenames; _filedir 'pkg.tar*'
+}
+
+complete -F _pacman -o default pacman
+complete -F _makepkg -o default makepkg
+complete -F _pacman_key -o default pacman-key
+
+# ex:et ts=2 sw=2 ft=sh
diff --git a/scripts/completion/zsh_completion.in b/scripts/completion/zsh_completion.in
new file mode 100644
index 00000000..f74fa297
--- /dev/null
+++ b/scripts/completion/zsh_completion.in
@@ -0,0 +1,723 @@
+#compdef pacman pacman.static=pacman pacman-key makepkg
+
+# copy this file to /usr/share/zsh/site-functions/_pacman
+
+typeset -A opt_args
+setopt extendedglob
+
+# options for passing to _arguments: main pacman commands
+_pacman_opts_commands=(
+ {-D,--database}'[Modify database]'
+ {-F,--files}'[Query the files database]'
+ {-Q,--query}'[Query the package database]'
+ {-R,--remove}'[Remove a package from the system]'
+ {-S,--sync}'[Synchronize packages]'
+ {-T,--deptest}'[Check if dependencies are installed]'
+ {-U,--upgrade}'[Upgrade a package]'
+ {-V,--version}'[Display version and exit]'
+ '(-h --help)'{-h,--help}'[Display usage]'
+)
+
+# options for passing to _arguments: options common to all commands
+_pacman_opts_common=(
+ '--arch[Set an alternate architecture]'
+ {-b,--dbpath}'[Alternate database location]:database_location:_files -/'
+ '--color[colorize the output]:color options:(always never auto)'
+ {-h,--help}'[Display syntax for the given operation]'
+ {-r,--root}'[Set alternate installation root]:installation root:_files -/'
+ {-v,--verbose}'[Be more verbose]'
+ '--cachedir[Alternate package cache location]:cache_location:_files -/'
+ '--config[An alternate configuration file]:config file:_files'
+ '--confirm[Always ask for confirmation]'
+ '--debug[Display debug messages]'
+ '--gpgdir[Set an alternate directory for GnuPG (instead of @sysconfdir@/pacman.d/gnupg)]: :_files -/'
+ '--hookdir[Set an alternate hook location]: :_files -/'
+ '--logfile[An alternate log file]:config file:_files'
+ '--noconfirm[Do not ask for confirmation]'
+ '--noprogressbar[Do not show a progress bar when downloading files]'
+ '--noscriptlet[Do not execute the install scriptlet if one exists]'
+)
+
+# options for passing to _arguments: options for --upgrade commands
+_pacman_opts_pkgfile=(
+ '*-d[Skip dependency checks]'
+ '*--nodeps[Skip dependency checks]'
+ '*--assume-installed[Add virtual package to satisfy dependencies]'
+ '--dbonly[Only remove database entry, do not remove files]'
+ '--force[Overwrite conflicting files]'
+ '--needed[Do not reinstall up to date packages]'
+ '--asdeps[mark packages as non-explicitly installed]'
+ '--asexplicit[mark packages as explicitly installed]'
+ {-p,--print}'[Only print the targets instead of performing the operation]'
+ '*--ignore[Ignore a package upgrade]:package: _pacman_completions_all_packages'
+ '*--ignoregroup[Ignore a group upgrade]:package group:_pacman_completions_all_groups'
+ '--print-format[Specify how the targets should be printed]'
+ '*:package file:_files -g "*.pkg.tar*~*.sig(.,@)"'
+)
+
+# options for passing to _arguments: subactions for --query command
+_pacman_opts_query_actions=(
+ '(-Q --query)'{-Q,--query}
+ {-g,--groups}'[View all members of a package group]:*:package groups:->query_group'
+ {-o,--owns}'[Query the package that owns a file]:file:_files'
+ {-p,--file}'[Package file to query]:*:package file:->query_file'
+ {-s,--search}'[Search package names and descriptions]:*:search text:->query_search'
+)
+
+# options for passing to _arguments: options for --query and subcommands
+_pacman_opts_query_modifiers=(
+ {-c,--changelog}'[List package changelog]'
+ {-d,--deps}'[List packages installed as dependencies]'
+ {-e,--explicit}'[List packages explicitly installed]'
+ {\*-i,\*--info}'[View package information]'
+ {\*-k,\*--check}'[Check package files]'
+ {-l,--list}'[List package contents]'
+ {-m,--foreign}'[List installed packages not found in sync db(s)]'
+ {-n,--native}'[List installed packages found in sync db(s)]'
+ {-q,--quiet}'[Show less information for query and search]'
+ {-t,--unrequired}'[List packages not required by any package]'
+ {-u,--upgrades}'[List packages that can be upgraded]'
+)
+
+# options for passing to _arguments: options for --remove command
+_pacman_opts_remove=(
+ {-c,--cascade}'[Remove all dependent packages]'
+ {-d,--nodeps}'[Skip dependency checks]'
+ '*--assume-installed[Add virtual package to satisfy dependencies]'
+ {-n,--nosave}'[Remove protected configuration files]'
+ {-p,--print}'[Only print the targets instead of performing the operation]'
+ {\*-s,\*--recursive}'[Remove dependencies not required by other packages]'
+ {-u,--unneeded}'[Remove unneeded packages]'
+ '--dbonly[Only remove database entry, do not remove files]'
+ '--print-format[Specify how the targets should be printed]'
+ '*:installed package:_pacman_completions_installed_packages'
+)
+
+_pacman_opts_database=(
+ '--asdeps[mark packages as non-explicitly installed]'
+ '--asexplicit[mark packages as explicitly installed]'
+ '*:installed package:_pacman_completions_installed_packages'
+)
+
+_pacman_opts_files=(
+ {-l,--list}'[List the files owned by the queried package]:package:_pacman_completions_all_packages'
+ {-o,--owns}'[Query the package that owns]:files:_files'
+ {-s,--search}'[Search package file names for matching strings]:files:_files'
+ {-x,--regex}'[Enable searching using regular expressions]:regex:'
+ {-y,--refresh}'[Download fresh files databases from the server]'
+ '--machinereadable[Produce machine-readable output]'
+ {-q,--quiet}'[Show less information for query and search]'
+)
+
+# options for passing to _arguments: options for --sync command
+_pacman_opts_sync_actions=(
+ '(-S --sync)'{-S,--sync}
+ {\*-c,\*--clean}'[Remove old packages from cache]:\*:clean:->sync_clean'
+ {-g,--groups}'[View all members of a package group]:*:package groups:->sync_group'
+ {-s,--search}'[Search package names and descriptions]:*:search text:->sync_search'
+ '--dbonly[Only remove database entry, do not remove files]'
+ '--needed[Do not reinstall up to date packages]'
+ '--recursive[Reinstall all dependencies of target packages]'
+)
+
+# options for passing to _arguments: options for --sync command
+_pacman_opts_sync_modifiers=(
+ {\*-d,\*--nodeps}'[Skip dependency checks]'
+ '*--assume-installed[Add virtual package to satisfy dependencies]'
+ {\*-i,\*--info}'[View package information]'
+ {-l,--list}'[List all packages in a repository]'
+ {-p,--print}'[Print download URIs for each package to be installed]'
+ {-q,--quiet}'[Show less information for query and search]'
+ {\*-u,\*--sysupgrade}'[Upgrade all out-of-date packages]'
+ {-w,--downloadonly}'[Download packages only]'
+ {\*-y,\*--refresh}'[Download fresh package databases]'
+ '*--ignore[Ignore a package upgrade]:package: _pacman_completions_all_packages'
+ '*--ignoregroup[Ignore a group upgrade]:package group:_pacman_completions_all_groups'
+ '--asdeps[Install packages as non-explicitly installed]'
+ '--asexplicit[Install packages as explicitly installed]'
+ '--force[Overwrite conflicting files]'
+ '--print-format[Specify how the targets should be printed]'
+)
+
+# handles --help subcommand
+_pacman_action_help() {
+ _arguments -s : \
+ "$_pacman_opts_commands[@]"
+}
+
+# handles cases where no subcommand has yet been given
+_pacman_action_none() {
+ _arguments -s : \
+ "$_pacman_opts_commands[@]"
+}
+
+# handles --query subcommand
+_pacman_action_query() {
+ local context state line
+ typeset -A opt_args
+
+ case $state in
+ query_file)
+ _arguments -s : \
+ "$_pacman_opts_common[@]" \
+ "$_pacman_opts_query_modifiers[@]" \
+ '*:package file:_files -g "*.pkg.tar*~*.sig(.,@)"'
+ ;;
+ query_group)
+ _arguments -s : \
+ "$_pacman_opts_common[@]" \
+ "$_pacman_opts_query_modifiers[@]" \
+ '*:groups:_pacman_completions_installed_groups'
+ ;;
+ query_owner)
+ _arguments -s : \
+ "$_pacman_opts_common[@]" \
+ "$_pacman_opts_query_modifiers[@]" \
+ '*:file:_files'
+ ;;
+ query_search)
+ _arguments -s : \
+ "$_pacman_opts_common[@]" \
+ "$_pacman_opts_query_modifiers[@]" \
+ '*:search text: '
+ ;;
+ *)
+ _arguments -s : \
+ "$_pacman_opts_common[@]" \
+ "$_pacman_opts_query_actions[@]" \
+ "$_pacman_opts_query_modifiers[@]" \
+ '*:package:_pacman_completions_installed_packages'
+ ;;
+ esac
+}
+
+# handles --remove subcommand
+_pacman_action_remove() {
+ _arguments -s : \
+ '(--remove -R)'{-R,--remove} \
+ "$_pacman_opts_common[@]" \
+ "$_pacman_opts_remove[@]"
+}
+
+# handles --database subcommand
+_pacman_action_database() {
+ _arguments -s : \
+ '(--database -D)'{-D,--database} \
+ "$_pacman_opts_common[@]" \
+ "$_pacman_opts_database[@]"
+}
+
+# handles --files subcommand
+_pacman_action_files() {
+ _arguments -s : \
+ '(--files -F)'{-F,--files} \
+ "$_pacman_opts_common[@]" \
+ "$_pacman_opts_files[@]"
+}
+
+_pacman_action_deptest () {
+ _arguments -s : \
+ '(--deptest)-T' \
+ "$_pacman_opts_common[@]" \
+ ":packages:_pacman_all_packages"
+}
+
+
+# handles --sync subcommand
+_pacman_action_sync() {
+ local context state line
+ typeset -A opt_args
+ if (( $+words[(r)--clean] )); then
+ state=sync_clean
+ elif (( $+words[(r)--groups] )); then
+ state=sync_group
+ elif (( $+words[(r)--search] )); then
+ state=sync_search
+ fi
+
+ case $state in
+ sync_clean)
+ _arguments -s : \
+ {\*-c,\*--clean}'[Remove old packages from cache]' \
+ "$_pacman_opts_common[@]" \
+ "$_pacman_opts_sync_modifiers[@]"
+ ;;
+ sync_group)
+ _arguments -s : \
+ "$_pacman_opts_common[@]" \
+ "$_pacman_opts_sync_modifiers[@]" \
+ '(-g --group)'{-g,--groups} \
+ '*:package group:_pacman_completions_all_groups'
+ ;;
+ sync_search)
+ _arguments -s : \
+ "$_pacman_opts_common[@]" \
+ "$_pacman_opts_sync_modifiers[@]" \
+ '*:search text: '
+ ;;
+ *)
+ _arguments -s : \
+ "$_pacman_opts_common[@]" \
+ "$_pacman_opts_sync_actions[@]" \
+ "$_pacman_opts_sync_modifiers[@]" \
+ '*:package:_pacman_completions_all_packages'
+ ;;
+ esac
+}
+
+# handles --upgrade subcommand
+_pacman_action_upgrade() {
+ _arguments -s : \
+ '(-U --upgrade)'{-U,--upgrade} \
+ "$_pacman_opts_common[@]" \
+ "$_pacman_opts_pkgfile[@]"
+}
+
+# handles --version subcommand
+_pacman_action_version() {
+ # no further arguments
+ return 0
+}
+
+# provides completions for package groups
+_pacman_completions_all_groups() {
+ local -a cmd groups
+ _pacman_get_command
+ groups=( $(_call_program groups $cmd[@] -Sg) )
+ typeset -U groups
+
+ if [[ ${words[CURRENT-1]} == '--ignoregroup' ]]; then
+ _sequence compadd -S ',' "$@" -a groups
+ else
+ compadd "$@" -a groups
+ fi
+}
+
+# provides completions for packages available from repositories
+# these can be specified as either 'package' or 'repository/package'
+_pacman_completions_all_packages() {
+ local -a seq sep cmd packages repositories packages_long
+ _pacman_get_command
+
+ if [[ ${words[CURRENT-1]} == '--ignore' ]]; then
+ seq='_sequence'
+ sep=(-S ',')
+ else
+ seq=
+ sep=()
+ fi
+
+ if compset -P1 '*/*'; then
+ packages=( $(_call_program packages $cmd[@] -Sql ${words[CURRENT]%/*}) )
+ typeset -U packages
+ ${seq} _wanted repo_packages expl "repository/package" compadd ${sep[@]} ${(@)packages}
+ else
+ packages=( $(_call_program packages $cmd[@] -Sql) )
+ typeset -U packages
+ ${seq} _wanted packages expl "packages" compadd ${sep[@]} - "${(@)packages}"
+
+ repositories=(${(o)${${${(M)${(f)"$(<@sysconfdir@/pacman.conf)"}:#\[*}/\[/}/\]/}:#options})
+ typeset -U repositories
+ _wanted repo_packages expl "repository/package" compadd -S "/" $repositories
+ fi
+}
+
+# provides completions for package groups
+_pacman_completions_installed_groups() {
+ local -a cmd groups
+ _pacman_get_command
+ groups=(${(o)${(f)"$(_call_program groups $cmd[@] -Qg)"}% *})
+ typeset -U groups
+ compadd "$@" -a groups
+}
+
+# provides completions for installed packages
+_pacman_completions_installed_packages() {
+ local -a cmd packages packages_long
+ packages_long=(@localstatedir@/lib/pacman/local/*(/))
+ packages=( ${${packages_long#@localstatedir@/lib/pacman/local/}%-*-*} )
+ compadd "$@" -a packages
+}
+
+_pacman_all_packages() {
+ _alternative : \
+ 'localpkgs:local packages:_pacman_completions_installed_packages' \
+ 'repopkgs:repository packages:_pacman_completions_all_packages'
+}
+
+# provides completions for repository names
+_pacman_completions_repositories() {
+ local -a cmd repositories
+ repositories=(${(o)${${${(M)${(f)"$(<@sysconfdir@/pacman.conf)"}:#\[*}/\[/}/\]/}:#options})
+ # Uniq the array
+ typeset -U repositories
+ compadd "$@" -a repositories
+}
+
+# builds command for invoking pacman in a _call_program command - extracts
+# relevant options already specified (config file, etc)
+# $cmd must be declared by calling function
+_pacman_get_command() {
+ # this is mostly nicked from _perforce
+ cmd=( "pacman" "2>/dev/null")
+ integer i
+ for (( i = 2; i < CURRENT - 1; i++ )); do
+ if [[ ${words[i]} = "--config" || ${words[i]} = "--root" ]]; then
+ cmd+=( ${words[i,i+1]} )
+ fi
+ done
+}
+
+# main dispatcher
+_pacman_zsh_comp() {
+ local -a args cmds;
+ local tmp
+ args=( ${${${(M)words:#-*}#-}:#-*} )
+ for tmp in $words; do
+ cmds+=("${${_pacman_opts_commands[(r)*$tmp\[*]%%\[*}#*\)}")
+ done
+ case $args in #$words[2] in
+ h*)
+ if (( ${(c)#args} <= 1 && ${(w)#cmds} <= 1 )); then
+ _pacman_action_help
+ else
+ _message "no more arguments"
+ fi
+ ;;
+ *h*)
+ _message "no more arguments"
+ ;;
+ D*)
+ _pacman_action_database
+ ;;
+ F*)
+ _pacman_action_files
+ ;;
+ Q*g*) # ipkg groups
+ _arguments -s : \
+ "$_pacman_opts_common[@]" \
+ "$_pacman_opts_query_modifiers[@]" \
+ '*:groups:_pacman_completions_installed_groups'
+ ;;
+ Q*o*) # file
+ _arguments -s : \
+ "$_pacman_opts_common[@]" \
+ "$_pacman_opts_query_modifiers[@]" \
+ '*:package file:_files'
+ ;;
+ Q*p*) # file *.pkg.tar*
+ _arguments -s : \
+ "$_pacman_opts_common[@]" \
+ "$_pacman_opts_query_modifiers[@]" \
+ '*:package file:_files -g "*.pkg.tar*~*.sig(.,@)"'
+ ;;
+ T*)
+ _pacman_action_deptest
+ ;;
+ Q*)
+ _pacman_action_query
+ ;;
+ R*)
+ _pacman_action_remove
+ ;;
+ S*c*) # no completion
+ _arguments -s : \
+ '(-c --clean)'{\*-c,\*--clean}'[Remove all files from the cache]' \
+ "$_pacman_opts_common[@]"
+ ;;
+ S*l*) # repos
+ _arguments -s : \
+ "$_pacman_opts_common[@]" \
+ "$_pacman_opts_sync_modifiers[@]" \
+ '*:package repo:_pacman_completions_repositories' \
+ ;;
+ S*g*) # pkg groups
+ _arguments -s : \
+ "$_pacman_opts_common[@]" \
+ "$_pacman_opts_sync_modifiers[@]" \
+ '*:package group:_pacman_completions_all_groups'
+ ;;
+ S*s*)
+ _arguments -s : \
+ "$_pacman_opts_common[@]" \
+ "$_pacman_opts_sync_modifiers[@]" \
+ '*:search text: '
+ ;;
+ S*)
+ _pacman_action_sync
+ ;;
+ T*)
+ _arguments -s : \
+ '-T' \
+ "$_pacman_opts_common[@]" \
+ ":packages:_pacman_all_packages"
+ ;;
+ U*)
+ _pacman_action_upgrade
+ ;;
+ V*)
+ _pacman_action_version
+ ;;
+ *)
+
+ case ${(M)words:#--*} in
+ *--help*)
+ if (( ${(w)#cmds} == 1 )); then
+ _pacman_action_help
+ else
+ return 0;
+ fi
+ ;;
+ *--sync*)
+ _pacman_action_sync
+ ;;
+ *--query*)
+ _pacman_action_query
+ ;;
+ *--remove*)
+ _pacman_action_remove
+ ;;
+ *--deptest*)
+ _pacman_action_deptest
+ ;;
+ *--database*)
+ _pacman_action_database
+ ;;
+ *--files*)
+ _pacman_action_files
+ ;;
+ *--version*)
+ _pacman_action_version
+ ;;
+ *--upgrade*)
+ _pacman_action_upgrade
+ ;;
+ *)
+ _pacman_action_none
+ ;;
+ esac
+ ;;
+ esac
+}
+
+_key_shortopts=(
+ '-h[show help]'
+ '-a[Add the specified keys (empty for stdin)]: :_files'
+ '-d[Remove the Specified keyids]:*: :_keys'
+ '-e[Export the specified or all keyids]:*: :_keys'
+ '-f[List fingerprint for specified or all keyids]:*: :_keys'
+ '-l[List the specified or all keys]:*: :_keys'
+ '-r[Fetch the specified keyids]:*: :_keys'
+ '-u[Update the trustdb of pacman]'
+ '-v[Verify the file specified by the signature]: :_files -g "*.sig"'
+ '-V[Show program version]'
+)
+
+_key_longopts=(
+ '--help[show help]'
+ '--add[Add the specified keys (empty for stdin)]: :_files'
+ '--delete[Remove the Specified keyids]:*: :_keys'
+ '--export[Export the specified or all keyids]:*: :_keys'
+ '--finger[List fingerprint for specified or all keyids]:*: :_keys'
+ '--list-keys[List the specified or all keys]:*: :_keys'
+ '--recv-keys[Fetch the specified keyids]:*: :_keys'
+ '--updatedb[Update the trustdb of pacman]'
+ '--verify[Verify the file specified by the signature]: :_files -g "*.sig"'
+ '--version[Show program version]'
+ '--edit-key[Present a menu for key management task on keyids]:*: :_keys'
+ '--import[Imports pubring.gpg from dir(s)]: :_files -g "*.gpg"'
+ '--import-tb[Imports ownertrust values from trustdb.gpg in dir(s)]: :_files -g "*.gpg"'
+ '--init[Ensure the keyring is properly initialized]'
+ '--list-sigs[List keys and their signatures]:*: :_keys'
+ '--lsign-key[Locally sign the specified keyid]:*: :_keys'
+ '--populate[Reload the default keys from the (given) keyrings in '/usr/share/pacman/keyrings']: :_path_files -W /usr/share/pacman/keyrings'
+ '--refresh-keys[Update specified or all keys from a keyserver]:*: :_keys'
+)
+
+_pacman_key_options=(
+ '--config[Use an alternate config file (instead of @sysconfdir@/pacman.conf)]: :_files'
+ '--gpgdir[Set an alternate directory for GnuPG (instead of @sysconfdir@/pacman.d/gnupg)]: :_files -/'
+ '--keyserver[Specify a keyserver to use if necessary]'
+)
+
+_pacman_key() {
+ case $words[CURRENT] in
+ --*)
+ _arguments -s : \
+ "$_pacman_key_options[@]" \
+ "$_key_longopts[@]"
+ ;;
+ -*)
+ _arguments -s : \
+ "$_pacman_key_options[@]" \
+ "$_key_shortopts[@]" \
+ "$_key_longopts[@]"
+ ;;
+ *)
+ i=$#;
+ while [[ $words[$i] != -* ]] && [[ $words[$i] != "pacman-key" ]];do
+ i=$(($i-1))
+ done
+ case $i in
+ --*)
+ _arguments -s : \
+ "$_pacman_key_options[@]" \
+ "$_key_longopts[@]"
+ ;;
+ -*)
+ _arguments -s : \
+ "$_pacman_key_options[@]" \
+ "$_key_shortopts[@]" \
+ "$_key_longopts[@]"
+ ;;
+ *)
+ return 1
+ ;;
+ esac
+ ;;
+ esac
+}
+
+_keys() {
+ local keylist keys
+ keylist=$(pacman-key --list-keys 2>/dev/null | awk '
+ $1 == "pub" {
+ # key id
+ split($2, a, "/"); print a[2]
+ }
+ $1 == "uid" {
+ # email
+ if (match($NF, /<[^>]+>/))
+ print substr($NF, RSTART + 1, RLENGTH - 2)
+ #this adds support for names as well if that is ever added
+ }
+ $1 == "uid" {
+ for (i=2;i<NF;i++) {printf "%s%s",sep, $i;sep=" "}; printf "\n"
+ }' |sed -e 's/(.*)//g' -e 's/^\ //g' -e 's/\ *$//g' |uniq
+ )
+ keys=(${(s:/:)${keylist//$'\n'/\/}})
+ _describe -t modules 'keys in keyring' keys && return 0
+}
+
+_makepkg_shortopts=(
+ '-s[Install missing dependencies with pacman]'
+ '-i[Install package after successful build]'
+ '-A[Ignore incomplete arch field in PKGBUILD]'
+ '-c[Clean up work files after build]'
+ '-C[Remove $srcdir/ dir before building the package]'
+ '-d[Skip all dependency checks]'
+ '-e[Do not extract source files (use existing $srcdir/ dir)]'
+ '-f[Overwrite existing package]'
+ '-g[Generate integrity checks for source files]'
+ '-h[Show help message and exit]'
+ '-L[Log package build process]'
+ '-m[Disable colorized output messages]'
+ '-o[Download and extract files only]'
+ '-p[Use an alternate build script (instead of 'PKGBUILD')]: :_files'
+ '-r[Remove installed dependencies after a successful build]'
+ '-R[Repackage contents of the package without rebuilding]'
+ '-S[Generate a source-only tarball without downloading sources]'
+ '-V[Show version information and exit]'
+)
+
+_makepkg_action_none(){
+ _arguments \
+ "$_makepkg_shortopts[@]" \
+ "$_makepkg_longopts[@]"
+}
+_makepkg_longopts=(
+ '--ignorearch[Ignore incomplete arch field in PKGBUILD]'
+ '--clean[Clean up work files after build]'
+ '--cleanbuild[Remove $srcdir/ dir before building the package]'
+ '--nodeps[Skip all dependency checks]'
+ '--noextract[Do not extract source files (use existing $srcdir/ dir)]'
+ '--force[Overwrite existing package]'
+ '--geninteg[Generate integrity checks for source files]'
+ '--help[Show help message and exit]'
+ '--install[Install package after successful build]'
+ '--log[Log package build process]'
+ '--nocolor[Disable colorized output messages]'
+ '--nobuild[Download and extract files only]'
+ '--rmdeps[Remove installed dependencies after a successful build]'
+ '--repackage[Repackage contents of the package without rebuilding]'
+ '--syncdeps[Install missing dependencies with pacman]'
+ '--source[Generate a source-only tarball without downloading sources]'
+ '--version[Show version information and exit]'
+ '--allsource[Generate a source-only tarball including downloaded source]'
+ '--check[Run check() function in the PKGBUILD]'
+ '--config[Use an alternate config file instead of '@sysconfdir@/makepkg.conf']: :_files'
+ '--holdver[Do not update VCS sources]'
+ '--key[Specify key to use for gpg signing instead of the default]: :_keys'
+ '--noarchive[Do not create package archive]'
+ '--nocheck[Do not run the check() function in the PKGBUILD]'
+ '--noprepare[Do not run the prepare() function in the PKGBUILD]'
+ '--nosign[Do not create a signature for the package]'
+ '--packagelist[Only list packages that would be produced, without PKGEXT]'
+ '--printsrcinfo[Print the generated SRCINFO and exit]'
+ '--sign[Sign the resulting package with gpg]'
+ '--skipchecksums[Do not verify checksums of the source files]'
+ '--skipinteg[do not perform any verification checks on source files]'
+ '--skippgpcheck[Do not verify source files with PGP signatures]'
+ '--noconfirm[Do not ask for confirmation when resolving dependencies]'
+ '--asdeps[Install packages as non-explicitly installed]'
+ '--noprogressbar[Do not show a progress bar when downloading files]'
+ '--needed[Do not reinstall the targets that are already up to date]'
+ '--verifysource[Download source files (if needed) and perform integrity checks]'
+)
+_makepkg(){
+ case $words[CURRENT] in
+ -*)
+ _arguments -s -w : \
+ "$_makepkg_shortopts[@]" \
+ "$_makepkg_longopts[@]"
+ ;;
+ --* )
+ _arguments -s \
+ "$_makepkg_longopts[@]"
+ ;;
+ - )
+ _makepkg_action_none
+ ;;
+ *)
+ i=$#
+ while [[ $words[i] != -* ]] && [[ $words[$i] != "makepkg" ]];do
+ i=$((i-1));
+ done
+ case $words[$i] in
+ -*)
+ _arguments -s -w : \
+ "$_makepkg_shortopts[@]" \
+ "$_makepkg_longopts[@]"
+ ;;
+ --* )
+ _arguments -s \
+ "$_makepkg_longopts[@]"
+ ;;
+ - )
+ _makepkg_action_none
+ ;;
+ * )
+ return 1
+ ;;
+ esac
+ ;;
+ esac
+}
+_pacman_comp() {
+ case "$service" in
+ makepkg)
+ _makepkg "$@"
+ ;;
+ pacman-key)
+ _pacman_key "$@"
+ ;;
+ pacman)
+ _pacman_zsh_comp "$@"
+ ;;
+ *)
+ _message "Error"
+ ;;
+ esac
+}
+
+_pacman_comp "$@"
diff --git a/scripts/libmakepkg/.gitignore b/scripts/libmakepkg/.gitignore
index 941d39a5..ceb7bfc4 100644
--- a/scripts/libmakepkg/.gitignore
+++ b/scripts/libmakepkg/.gitignore
@@ -10,5 +10,8 @@ srcinfo.sh
tidy.sh
tidy/*.sh
util.sh
+util/message.sh
+util/option.sh
+util/parseopts.sh
util/pkgbuild.sh
util/source.sh
diff --git a/scripts/libmakepkg/integrity.sh.in b/scripts/libmakepkg/integrity.sh.in
index cb8159d3..3a77ef16 100644
--- a/scripts/libmakepkg/integrity.sh.in
+++ b/scripts/libmakepkg/integrity.sh.in
@@ -2,7 +2,7 @@
#
# integrity.sh - functions relating to source integrity checking
#
-# Copyright (c) 2011-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2011-2017 Pacman Development Team <pacman-dev@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
diff --git a/scripts/libmakepkg/integrity/generate_checksum.sh.in b/scripts/libmakepkg/integrity/generate_checksum.sh.in
index 7a567100..902a989e 100644
--- a/scripts/libmakepkg/integrity/generate_checksum.sh.in
+++ b/scripts/libmakepkg/integrity/generate_checksum.sh.in
@@ -2,7 +2,7 @@
#
# generate_checksum.sh - functions for generating source checksums
#
-# Copyright (c) 2014-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2014-2017 Pacman Development Team <pacman-dev@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
@@ -59,8 +59,8 @@ generate_one_checksum() {
if [[ $netfile != *.@(sig?(n)|asc) ]]; then
local file
file="$(get_filepath "$netfile")" || missing_source_file "$netfile"
- sum="$(openssl dgst -${integ} "$file")"
- sum=${sum##* }
+ sum="$("${integ}sum" "$file")"
+ sum=${sum%% *}
else
sum="SKIP"
fi
@@ -80,11 +80,6 @@ generate_one_checksum() {
generate_checksums() {
msg "$(gettext "Generating checksums for source files...")"
- if ! type -p openssl >/dev/null; then
- error "$(gettext "Cannot find the %s binary required for generating sourcefile checksums.")" "openssl"
- exit 1 # $E_MISSING_PROGRAM
- fi
-
local integlist
if (( $# == 0 )); then
IFS=$'\n' read -rd '' -a integlist < <(get_integlist)
diff --git a/scripts/libmakepkg/integrity/generate_signature.sh.in b/scripts/libmakepkg/integrity/generate_signature.sh.in
index d7f7cb14..060ae344 100644
--- a/scripts/libmakepkg/integrity/generate_signature.sh.in
+++ b/scripts/libmakepkg/integrity/generate_signature.sh.in
@@ -2,7 +2,7 @@
#
# generate_signature.sh - functions for generating PGP signatures
#
-# Copyright (c) 2008-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2008-2017 Pacman Development Team <pacman-dev@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
diff --git a/scripts/libmakepkg/integrity/verify_checksum.sh.in b/scripts/libmakepkg/integrity/verify_checksum.sh.in
index 44a2b2e1..1a11a082 100644
--- a/scripts/libmakepkg/integrity/verify_checksum.sh.in
+++ b/scripts/libmakepkg/integrity/verify_checksum.sh.in
@@ -2,7 +2,7 @@
#
# verify_checksum.sh - functions for checking source checksums
#
-# Copyright (c) 2014-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2014-2017 Pacman Development Team <pacman-dev@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
@@ -82,8 +82,8 @@ verify_integrity_one() {
return 1
fi
- local realsum="$(openssl dgst -${integ} "$file")"
- realsum="${realsum##* }"
+ local realsum="$("${integ}sum" "$file")"
+ realsum="${realsum%% *}"
if [[ ${expectedsum,,} = "$realsum" ]]; then
printf '%s\n' "$(gettext "Passed")" >&2
else
diff --git a/scripts/libmakepkg/integrity/verify_signature.sh.in b/scripts/libmakepkg/integrity/verify_signature.sh.in
index 6df62727..b5577523 100644
--- a/scripts/libmakepkg/integrity/verify_signature.sh.in
+++ b/scripts/libmakepkg/integrity/verify_signature.sh.in
@@ -2,7 +2,7 @@
#
# verify_signature.sh - functions for checking PGP signatures
#
-# Copyright (c) 2011-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2011-2017 Pacman Development Team <pacman-dev@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
@@ -32,7 +32,7 @@ check_pgpsigs() {
msg "$(gettext "Verifying source file signatures with %s...")" "gpg"
- local file ext decompress found pubkey success status fingerprint trusted
+ local netfile proto pubkey success status fingerprint trusted
local warning=0
local errors=0
local statusfile=$(mktemp)
@@ -46,44 +46,15 @@ check_pgpsigs() {
get_all_sources_for_arch 'all_sources'
;;
esac
- for file in "${all_sources[@]}"; do
- file="$(get_filename "$file")"
- if [[ $file != *.@(sig?(n)|asc) ]]; then
- continue
- fi
-
- printf " %s ... " "${file%.*}" >&2
-
- if ! file="$(get_filepath "$file")"; then
- printf '%s\n' "$(gettext "SIGNATURE NOT FOUND")" >&2
- errors=1
- continue
- fi
+ for netfile in "${all_sources[@]}"; do
+ proto="$(get_protocol "$netfile")"
- found=0
- for ext in "" gz bz2 xz lrz lzo Z; do
- if sourcefile="$(get_filepath "${file%.*}${ext:+.$ext}")"; then
- found=1
- break;
- fi
- done
- if (( ! found )); then
- printf '%s\n' "$(gettext "SOURCE FILE NOT FOUND")" >&2
- errors=1
- continue
+ if [[ $proto = git* ]]; then
+ verify_git_signature "$netfile" "$statusfile" || continue
+ else
+ verify_file_signature "$netfile" "$statusfile" || continue
fi
- case "$ext" in
- gz) decompress="gzip -c -d -f" ;;
- bz2) decompress="bzip2 -c -d -f" ;;
- xz) decompress="xz -c -d" ;;
- lrz) decompress="lrzip -q -d" ;;
- lzo) decompress="lzop -c -d -q" ;;
- Z) decompress="uncompress -c -f" ;;
- "") decompress="cat" ;;
- esac
-
- $decompress < "$sourcefile" | gpg --quiet --batch --status-file "$statusfile" --verify "$file" - 2> /dev/null
# these variables are assigned values in parse_gpg_statusfile
success=0
status=
@@ -145,6 +116,85 @@ check_pgpsigs() {
fi
}
+verify_file_signature() {
+ local netfile="$1" statusfile="$2"
+ local file ext decompress found sourcefile
+
+ file="$(get_filename "$netfile")"
+ if [[ $file != *.@(sig?(n)|asc) ]]; then
+ return 1
+ fi
+
+ printf " %s ... " "${file%.*}" >&2
+
+ if ! file="$(get_filepath "$netfile")"; then
+ printf '%s\n' "$(gettext "SIGNATURE NOT FOUND")" >&2
+ errors=1
+ return 1
+ fi
+
+ found=0
+ for ext in "" gz bz2 xz lrz lzo Z; do
+ if sourcefile="$(get_filepath "${file%.*}${ext:+.$ext}")"; then
+ found=1
+ break;
+ fi
+ done
+ if (( ! found )); then
+ printf '%s\n' "$(gettext "SOURCE FILE NOT FOUND")" >&2
+ errors=1
+ return 1
+ fi
+
+ case "$ext" in
+ gz) decompress="gzip -c -d -f" ;;
+ bz2) decompress="bzip2 -c -d -f" ;;
+ xz) decompress="xz -c -d" ;;
+ lrz) decompress="lrzip -q -d" ;;
+ lzo) decompress="lzop -c -d -q" ;;
+ Z) decompress="uncompress -c -f" ;;
+ "") decompress="cat" ;;
+ esac
+
+ $decompress < "$sourcefile" | gpg --quiet --batch --status-file "$statusfile" --verify "$file" - 2> /dev/null
+}
+
+verify_git_signature() {
+ local netfile=$1 statusfile=$2
+ local dir fragment query fragtype fragval
+
+ dir=$(get_filepath "$netfile")
+ fragment=$(get_uri_fragment "$netfile")
+ query=$(get_uri_query "$netfile")
+
+ if [[ $query != signed ]]; then
+ return 1
+ fi
+
+ case ${fragment%%=*} in
+ tag)
+ fragtype=tag
+ fragval=${fragment##*=}
+ ;;
+ commit|branch)
+ fragtype=commit
+ fragval=${fragment##*=}
+ ;;
+ '')
+ fragtype=commit
+ fragval=HEAD
+ esac
+
+ printf " %s git repo ... " "${dir##*/}" >&2
+
+ git -C "$dir" verify-$fragtype --raw "$fragval" > "$statusfile" 2>&1
+ if ! grep -qs NEWSIG "$statusfile"; then
+ printf '%s\n' "$(gettext "SIGNATURE NOT FOUND")" >&2
+ errors=1
+ return 1
+ fi
+}
+
parse_gpg_statusfile() {
local type arg1 arg6 arg10
@@ -204,11 +254,14 @@ parse_gpg_statusfile() {
}
source_has_signatures() {
- local file all_sources
+ local file all_sources proto
get_all_sources_for_arch 'all_sources'
for file in "${all_sources[@]}"; do
- if [[ ${file%%::*} = *.@(sig?(n)|asc) ]]; then
+ proto="$(get_protocol "$file")"
+ query=$(get_uri_query "$netfile")
+
+ if [[ ${file%%::*} = *.@(sig?(n)|asc) || ( $proto = git* && $query = signed ) ]]; then
return 0
fi
done
diff --git a/scripts/libmakepkg/lint_package.sh.in b/scripts/libmakepkg/lint_package.sh.in
index 82b8b9b8..ff0894ec 100644
--- a/scripts/libmakepkg/lint_package.sh.in
+++ b/scripts/libmakepkg/lint_package.sh.in
@@ -2,7 +2,7 @@
#
# lint_package.sh - functions for checking for packaging errors
#
-# Copyright (c) 2015-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2015-2017 Pacman Development Team <pacman-dev@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
@@ -40,7 +40,9 @@ lint_package() {
cd_safe "$pkgdir"
msg "$(gettext "Checking for packaging issue...")"
+ local ret=0
for func in ${lint_package_functions[@]}; do
- $func
+ $func || ret=1
done
+ return $ret
}
diff --git a/scripts/libmakepkg/lint_package/build_references.sh.in b/scripts/libmakepkg/lint_package/build_references.sh.in
index 67c14e66..9183fce9 100644
--- a/scripts/libmakepkg/lint_package/build_references.sh.in
+++ b/scripts/libmakepkg/lint_package/build_references.sh.in
@@ -2,7 +2,7 @@
#
# build_references.sh - Warn about files containing references to build directories
#
-# Copyright (c) 2013-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2013-2017 Pacman Development Team <pacman-dev@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
@@ -25,14 +25,17 @@ LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
source "$LIBRARY/util/message.sh"
-
lint_package_functions+=('warn_build_references')
warn_build_references() {
- if find "${pkgdir}" -type f -print0 | xargs -0 grep -q -I "${srcdir}" ; then
- warning "$(gettext "Package contains reference to %s")" "\$srcdir"
- fi
- if find "${pkgdir}" -type f -print0 | xargs -0 grep -q -I "${pkgdirbase}" ; then
- warning "$(gettext "Package contains reference to %s")" "\$pkgdir"
- fi
+ local refs
+
+ for var in srcdir pkgdir; do
+ mapfile -t refs < <(find "$pkgdir" -type f -exec grep -l "${!var}" {} +)
+ if (( ${#refs} > 0 )); then
+ warning "$(gettext 'Package contains reference to %s')" "\$$var"
+ printf '%s\n' "${refs[@]}" >&2
+ fi
+ done
+ return 0
}
diff --git a/scripts/libmakepkg/lint_package/dotfiles.sh.in b/scripts/libmakepkg/lint_package/dotfiles.sh.in
new file mode 100644
index 00000000..9842028c
--- /dev/null
+++ b/scripts/libmakepkg/lint_package/dotfiles.sh.in
@@ -0,0 +1,38 @@
+#!/bin/bash
+#
+# dotfiles.sh - check for dotfiles in the package root
+#
+# Copyright (c) 2016-2017 Pacman Development Team <pacman-dev@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/>.
+#
+
+[[ -n "$LIBMAKEPKG_LINT_PACKAGE_DOTFILES_SH" ]] && return
+LIBMAKEPKG_LINT_PACKAGE_DOTFILES_SH=1
+
+LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
+
+source "$LIBRARY/util/message.sh"
+
+lint_package_functions+=('check_dotfiles')
+
+check_dotfiles() {
+ local ret=0
+ for f in "$pkgdir"/.*; do
+ [[ ${f##*/} == . || ${f##*/} == .. ]] && continue
+ error "$(gettext "Dotfile found in package root '%s'")" "$f"
+ ret=1
+ done
+ return $ret
+}
diff --git a/scripts/libmakepkg/lint_package/file_names.sh.in b/scripts/libmakepkg/lint_package/file_names.sh.in
new file mode 100644
index 00000000..0b8e7a03
--- /dev/null
+++ b/scripts/libmakepkg/lint_package/file_names.sh.in
@@ -0,0 +1,42 @@
+#!/bin/bash
+#
+# file_names.sh - check package file names
+#
+# Copyright (c) 2016-2017 Pacman Development Team <pacman-dev@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/>.
+#
+
+[[ -n "$LIBMAKEPKG_LINT_PACKAGE_FILE_NAMES_SH" ]] && return
+LIBMAKEPKG_LINT_PACKAGE_FILE_NAMES_SH=1
+
+LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
+
+source "$LIBRARY/util/message.sh"
+
+lint_package_functions+=('lint_file_names')
+
+lint_file_names() {
+ local ret=0 paths
+
+ # alpm's local database format does not support newlines in paths
+ mapfile -t paths < <(find "$pkgdir" -name \*$'\n'\*)
+ if (( ${#paths} > 0 )); then
+ error "$(gettext 'Package contains paths with newlines')"
+ printf '%s\n' "${paths[@]}" >&2
+ ret=1
+ fi
+
+ return $ret
+}
diff --git a/scripts/libmakepkg/lint_package/missing_backup.sh.in b/scripts/libmakepkg/lint_package/missing_backup.sh.in
index 727a18bf..934dd12f 100644
--- a/scripts/libmakepkg/lint_package/missing_backup.sh.in
+++ b/scripts/libmakepkg/lint_package/missing_backup.sh.in
@@ -2,7 +2,7 @@
#
# missing_backup.sh - Warn about missing files in the backup array
#
-# Copyright (c) 2013-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2013-2017 Pacman Development Team <pacman-dev@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
@@ -35,4 +35,5 @@ warn_missing_backup() {
warning "$(gettext "%s entry file not in package : %s")" "backup" "$file"
fi
done
+ return 0
}
diff --git a/scripts/libmakepkg/lint_pkgbuild.sh.in b/scripts/libmakepkg/lint_pkgbuild.sh.in
index 25bb848f..d3a1a083 100644
--- a/scripts/libmakepkg/lint_pkgbuild.sh.in
+++ b/scripts/libmakepkg/lint_pkgbuild.sh.in
@@ -2,7 +2,7 @@
#
# lint_pkgbuild.sh - functions for detecting PKGBUILD errors
#
-# Copyright (c) 2015-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2015-2017 Pacman Development Team <pacman-dev@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
diff --git a/scripts/libmakepkg/lint_pkgbuild/arch.sh.in b/scripts/libmakepkg/lint_pkgbuild/arch.sh.in
index 623dc81a..ddc2f29e 100644
--- a/scripts/libmakepkg/lint_pkgbuild/arch.sh.in
+++ b/scripts/libmakepkg/lint_pkgbuild/arch.sh.in
@@ -2,7 +2,7 @@
#
# arch.sh - Check the 'arch' array conforms to requirements.
#
-# Copyright (c) 2014-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2014-2017 Pacman Development Team <pacman-dev@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
diff --git a/scripts/libmakepkg/lint_pkgbuild/backup.sh.in b/scripts/libmakepkg/lint_pkgbuild/backup.sh.in
index 99fa15fe..5b37b4e9 100644
--- a/scripts/libmakepkg/lint_pkgbuild/backup.sh.in
+++ b/scripts/libmakepkg/lint_pkgbuild/backup.sh.in
@@ -2,7 +2,7 @@
#
# backup.sh - Check the 'backup' array conforms to requirements.
#
-# Copyright (c) 2014-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2014-2017 Pacman Development Team <pacman-dev@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
diff --git a/scripts/libmakepkg/lint_pkgbuild/changelog.sh.in b/scripts/libmakepkg/lint_pkgbuild/changelog.sh.in
index 039db512..264ea105 100644
--- a/scripts/libmakepkg/lint_pkgbuild/changelog.sh.in
+++ b/scripts/libmakepkg/lint_pkgbuild/changelog.sh.in
@@ -2,7 +2,7 @@
#
# changelog.sh - Check the files in the 'changelog' array exist.
#
-# Copyright (c) 2014-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2014-2017 Pacman Development Team <pacman-dev@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
diff --git a/scripts/libmakepkg/lint_pkgbuild/epoch.sh.in b/scripts/libmakepkg/lint_pkgbuild/epoch.sh.in
index e6daf14c..cc11d975 100644
--- a/scripts/libmakepkg/lint_pkgbuild/epoch.sh.in
+++ b/scripts/libmakepkg/lint_pkgbuild/epoch.sh.in
@@ -2,7 +2,7 @@
#
# epoch.sh - Check the 'epoch' variable conforms to requirements.
#
-# Copyright (c) 2014-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2014-2017 Pacman Development Team <pacman-dev@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
diff --git a/scripts/libmakepkg/lint_pkgbuild/install.sh.in b/scripts/libmakepkg/lint_pkgbuild/install.sh.in
index ab89ebea..3e268923 100644
--- a/scripts/libmakepkg/lint_pkgbuild/install.sh.in
+++ b/scripts/libmakepkg/lint_pkgbuild/install.sh.in
@@ -2,7 +2,7 @@
#
# install.sh - Check the files in the 'install' array exist.
#
-# Copyright (c) 2014-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2014-2017 Pacman Development Team <pacman-dev@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
diff --git a/scripts/libmakepkg/lint_pkgbuild/optdepends.sh.in b/scripts/libmakepkg/lint_pkgbuild/optdepends.sh.in
index fe71fd77..f5fdbb90 100644
--- a/scripts/libmakepkg/lint_pkgbuild/optdepends.sh.in
+++ b/scripts/libmakepkg/lint_pkgbuild/optdepends.sh.in
@@ -2,7 +2,7 @@
#
# optdepends.sh - Check the 'optdepends' array conforms to requirements.
#
-# Copyright (c) 2014-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2014-2017 Pacman Development Team <pacman-dev@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
diff --git a/scripts/libmakepkg/lint_pkgbuild/options.sh.in b/scripts/libmakepkg/lint_pkgbuild/options.sh.in
index bf1cfa52..ffcd19e3 100644
--- a/scripts/libmakepkg/lint_pkgbuild/options.sh.in
+++ b/scripts/libmakepkg/lint_pkgbuild/options.sh.in
@@ -2,7 +2,7 @@
#
# options.sh - Check the 'options' array conforms to requirements.
#
-# Copyright (c) 2014-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2014-2017 Pacman Development Team <pacman-dev@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
diff --git a/scripts/libmakepkg/lint_pkgbuild/package_function.sh.in b/scripts/libmakepkg/lint_pkgbuild/package_function.sh.in
index 78c5c7cc..14398217 100644
--- a/scripts/libmakepkg/lint_pkgbuild/package_function.sh.in
+++ b/scripts/libmakepkg/lint_pkgbuild/package_function.sh.in
@@ -2,7 +2,7 @@
#
# package_function.sh - Check that required package functions exist.
#
-# Copyright (c) 2014-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2014-2017 Pacman Development Team <pacman-dev@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
diff --git a/scripts/libmakepkg/lint_pkgbuild/pkgbase.sh.in b/scripts/libmakepkg/lint_pkgbuild/pkgbase.sh.in
index 035b3abb..911e1128 100644
--- a/scripts/libmakepkg/lint_pkgbuild/pkgbase.sh.in
+++ b/scripts/libmakepkg/lint_pkgbuild/pkgbase.sh.in
@@ -2,7 +2,7 @@
#
# pkgbase.sh - Check the 'pkgbase' variable conforms to requirements.
#
-# Copyright (c) 2014-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2014-2017 Pacman Development Team <pacman-dev@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
diff --git a/scripts/libmakepkg/lint_pkgbuild/pkglist.sh.in b/scripts/libmakepkg/lint_pkgbuild/pkglist.sh.in
index 50ac3c0d..8c09ad5b 100644
--- a/scripts/libmakepkg/lint_pkgbuild/pkglist.sh.in
+++ b/scripts/libmakepkg/lint_pkgbuild/pkglist.sh.in
@@ -2,7 +2,7 @@
#
# pkglist.sh - Check the packages selected to build exist.
#
-# Copyright (c) 2014-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2014-2017 Pacman Development Team <pacman-dev@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
diff --git a/scripts/libmakepkg/lint_pkgbuild/pkgname.sh.in b/scripts/libmakepkg/lint_pkgbuild/pkgname.sh.in
index a0440827..b66eda68 100644
--- a/scripts/libmakepkg/lint_pkgbuild/pkgname.sh.in
+++ b/scripts/libmakepkg/lint_pkgbuild/pkgname.sh.in
@@ -2,7 +2,7 @@
#
# pkgname.sh - Check the 'pkgname' variable conforms to requirements.
#
-# Copyright (c) 2014-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2014-2017 Pacman Development Team <pacman-dev@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
@@ -32,6 +32,11 @@ lint_pkgbuild_functions+=('lint_pkgname')
lint_pkgname() {
local ret=0 i
+ if [[ -z ${pkgname[@]} ]]; then
+ error "$(gettext "%s is not allowed to be empty.")" "pkgname"
+ return 1
+ fi
+
for i in "${pkgname[@]}"; do
if [[ -z $i ]]; then
error "$(gettext "%s is not allowed to be empty.")" "pkgname"
diff --git a/scripts/libmakepkg/lint_pkgbuild/pkgrel.sh.in b/scripts/libmakepkg/lint_pkgbuild/pkgrel.sh.in
index 95cb8080..b5cdfcf1 100644
--- a/scripts/libmakepkg/lint_pkgbuild/pkgrel.sh.in
+++ b/scripts/libmakepkg/lint_pkgbuild/pkgrel.sh.in
@@ -2,7 +2,7 @@
#
# pkgrel.sh - Check the 'pkgrel' variable conforms to requirements.
#
-# Copyright (c) 2014-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2014-2017 Pacman Development Team <pacman-dev@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
diff --git a/scripts/libmakepkg/lint_pkgbuild/pkgver.sh.in b/scripts/libmakepkg/lint_pkgbuild/pkgver.sh.in
index 09041d17..0ec6584c 100644
--- a/scripts/libmakepkg/lint_pkgbuild/pkgver.sh.in
+++ b/scripts/libmakepkg/lint_pkgbuild/pkgver.sh.in
@@ -2,7 +2,7 @@
#
# pkgver.sh - Check the 'pkgver' variable conforms to requirements.
#
-# Copyright (c) 2014-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2014-2017 Pacman Development Team <pacman-dev@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
@@ -35,8 +35,8 @@ check_pkgver() {
return 1
fi
- if [[ $1 = *[[:space:]:-]* ]]; then
- error "$(gettext "%s is not allowed to contain colons, hyphens or whitespace.")" "pkgver"
+ if [[ $1 = *[[:space:]/:-]* ]]; then
+ error "$(gettext "%s is not allowed to contain colons, forward slashes, hyphens or whitespace.")" "pkgver"
return 1
fi
}
diff --git a/scripts/libmakepkg/lint_pkgbuild/provides.sh.in b/scripts/libmakepkg/lint_pkgbuild/provides.sh.in
index 5fedd7fc..f521d0f5 100644
--- a/scripts/libmakepkg/lint_pkgbuild/provides.sh.in
+++ b/scripts/libmakepkg/lint_pkgbuild/provides.sh.in
@@ -2,7 +2,7 @@
#
# provides.sh - Check the 'provides' array conforms to requirements.
#
-# Copyright (c) 2014-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2014-2017 Pacman Development Team <pacman-dev@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
diff --git a/scripts/libmakepkg/lint_pkgbuild/source.sh.in b/scripts/libmakepkg/lint_pkgbuild/source.sh.in
index b6edf1ce..052b9d54 100644
--- a/scripts/libmakepkg/lint_pkgbuild/source.sh.in
+++ b/scripts/libmakepkg/lint_pkgbuild/source.sh.in
@@ -2,7 +2,7 @@
#
# source.sh - Check the 'source' array is not sparse.
#
-# Copyright (c) 2014-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2014-2017 Pacman Development Team <pacman-dev@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
diff --git a/scripts/libmakepkg/lint_pkgbuild/util.sh.in b/scripts/libmakepkg/lint_pkgbuild/util.sh.in
index 3c248f91..e8a35933 100644
--- a/scripts/libmakepkg/lint_pkgbuild/util.sh.in
+++ b/scripts/libmakepkg/lint_pkgbuild/util.sh.in
@@ -2,7 +2,7 @@
#
# util.sh - utility functions for pkgbuild linting.
#
-# Copyright (c) 2014-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2014-2017 Pacman Development Team <pacman-dev@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
diff --git a/scripts/libmakepkg/lint_pkgbuild/variable.sh.in b/scripts/libmakepkg/lint_pkgbuild/variable.sh.in
index 30c99090..1e749638 100644
--- a/scripts/libmakepkg/lint_pkgbuild/variable.sh.in
+++ b/scripts/libmakepkg/lint_pkgbuild/variable.sh.in
@@ -2,7 +2,7 @@
#
# variable.sh - Check that variables are or are not arrays as appropriate
#
-# Copyright (c) 2014-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2014-2017 Pacman Development Team <pacman-dev@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
diff --git a/scripts/libmakepkg/source.sh.in b/scripts/libmakepkg/source.sh.in
index 9bed41da..234e35e4 100644
--- a/scripts/libmakepkg/source.sh.in
+++ b/scripts/libmakepkg/source.sh.in
@@ -2,7 +2,7 @@
#
# source.sh - functions for downloading and extracting sources
#
-# Copyright (c) 2015-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2015-2017 Pacman Development Team <pacman-dev@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
diff --git a/scripts/libmakepkg/source/bzr.sh.in b/scripts/libmakepkg/source/bzr.sh.in
index af8c3c50..97206714 100644
--- a/scripts/libmakepkg/source/bzr.sh.in
+++ b/scripts/libmakepkg/source/bzr.sh.in
@@ -2,7 +2,7 @@
#
# bzr.sh - function for handling the download and "extraction" of Bazaar sources
#
-# Copyright (c) 2015-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2015-2017 Pacman Development Team <pacman-dev@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
diff --git a/scripts/libmakepkg/source/file.sh.in b/scripts/libmakepkg/source/file.sh.in
index 20493a67..1d85ea9b 100644
--- a/scripts/libmakepkg/source/file.sh.in
+++ b/scripts/libmakepkg/source/file.sh.in
@@ -2,7 +2,7 @@
#
# file.sh - function for handling the download and extraction of source files
#
-# Copyright (c) 2015-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2015-2017 Pacman Development Team <pacman-dev@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
diff --git a/scripts/libmakepkg/source/git.sh.in b/scripts/libmakepkg/source/git.sh.in
index cc27663d..6d7e0a67 100644
--- a/scripts/libmakepkg/source/git.sh.in
+++ b/scripts/libmakepkg/source/git.sh.in
@@ -2,7 +2,7 @@
#
# git.sh - function for handling the download and "extraction" of Git sources
#
-# Copyright (c) 2015-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2015-2017 Pacman Development Team <pacman-dev@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
@@ -39,6 +39,7 @@ download_git() {
local url=$(get_url "$netfile")
url=${url#git+}
url=${url%%#*}
+ url=${url%%\?*}
if [[ ! -d "$dir" ]] || dir_is_empty "$dir" ; then
msg2 "$(gettext "Cloning %s %s repo...")" "${repo}" "git"
@@ -66,14 +67,8 @@ download_git() {
extract_git() {
local netfile=$1
- local fragment=${netfile#*#}
- if [[ $fragment = "$netfile" ]]; then
- unset fragment
- fi
-
- local repo=${netfile##*/}
- repo=${repo%%#*}
- repo=${repo%%.git*}
+ local fragment=$(get_uri_fragment "$netfile")
+ local repo=$(get_filename "$netfile")
local dir=$(get_filepath "$netfile")
[[ -z "$dir" ]] && dir="$SRCDEST/$(get_filename "$netfile")"
diff --git a/scripts/libmakepkg/source/hg.sh.in b/scripts/libmakepkg/source/hg.sh.in
index 61774e81..4e6ebad9 100644
--- a/scripts/libmakepkg/source/hg.sh.in
+++ b/scripts/libmakepkg/source/hg.sh.in
@@ -2,7 +2,7 @@
#
# hg.sh - function for handling the download and "extraction" of Mercurial sources
#
-# Copyright (c) 2015-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2015-2017 Pacman Development Team <pacman-dev@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
diff --git a/scripts/libmakepkg/source/local.sh.in b/scripts/libmakepkg/source/local.sh.in
index 6a4b8824..8104141a 100644
--- a/scripts/libmakepkg/source/local.sh.in
+++ b/scripts/libmakepkg/source/local.sh.in
@@ -2,7 +2,7 @@
#
# local.sh - function for handling the "download" of local sources
#
-# Copyright (c) 2015-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2015-2017 Pacman Development Team <pacman-dev@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
diff --git a/scripts/libmakepkg/source/svn.sh.in b/scripts/libmakepkg/source/svn.sh.in
index a78fca3d..6cb78235 100644
--- a/scripts/libmakepkg/source/svn.sh.in
+++ b/scripts/libmakepkg/source/svn.sh.in
@@ -2,7 +2,7 @@
#
# svn.sh - function for handling the download and "extraction" of Subversion sources
#
-# Copyright (c) 2015-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2015-2017 Pacman Development Team <pacman-dev@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
diff --git a/scripts/libmakepkg/srcinfo.sh.in b/scripts/libmakepkg/srcinfo.sh.in
index 83765fa5..99f5628a 100644
--- a/scripts/libmakepkg/srcinfo.sh.in
+++ b/scripts/libmakepkg/srcinfo.sh.in
@@ -2,7 +2,7 @@
#
# srcinfo.sh - functions for writing .SRCINFO files
#
-# Copyright (c) 2014-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2014-2017 Pacman Development Team <pacman-dev@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
diff --git a/scripts/libmakepkg/tidy.sh.in b/scripts/libmakepkg/tidy.sh.in
index fc14c6e2..856f2394 100644
--- a/scripts/libmakepkg/tidy.sh.in
+++ b/scripts/libmakepkg/tidy.sh.in
@@ -3,7 +3,7 @@
# tidy.sh - functions for modifying/removing installed files before
# package creation
#
-# Copyright (c) 2015-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2015-2017 Pacman Development Team <pacman-dev@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
diff --git a/scripts/libmakepkg/tidy/docs.sh.in b/scripts/libmakepkg/tidy/docs.sh.in
index ac86573b..0919f201 100644
--- a/scripts/libmakepkg/tidy/docs.sh.in
+++ b/scripts/libmakepkg/tidy/docs.sh.in
@@ -2,7 +2,7 @@
#
# docs.sh - Remove documentation files from the package
#
-# Copyright (c) 2008-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2008-2017 Pacman Development Team <pacman-dev@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
diff --git a/scripts/libmakepkg/tidy/emptydirs.sh.in b/scripts/libmakepkg/tidy/emptydirs.sh.in
index 85ab39df..2b16afdf 100644
--- a/scripts/libmakepkg/tidy/emptydirs.sh.in
+++ b/scripts/libmakepkg/tidy/emptydirs.sh.in
@@ -2,7 +2,7 @@
#
# emptydirs.sh - Remove empty directories from the package
#
-# Copyright (c) 2013-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2013-2017 Pacman Development Team <pacman-dev@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
diff --git a/scripts/libmakepkg/tidy/libtool.sh.in b/scripts/libmakepkg/tidy/libtool.sh.in
index e8187c78..b844c792 100644
--- a/scripts/libmakepkg/tidy/libtool.sh.in
+++ b/scripts/libmakepkg/tidy/libtool.sh.in
@@ -2,7 +2,7 @@
#
# libtool.sh - Remove libtool files from the package
#
-# Copyright (c) 2013-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2013-2017 Pacman Development Team <pacman-dev@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
diff --git a/scripts/libmakepkg/tidy/purge.sh.in b/scripts/libmakepkg/tidy/purge.sh.in
index 501d7531..5d37ded5 100644
--- a/scripts/libmakepkg/tidy/purge.sh.in
+++ b/scripts/libmakepkg/tidy/purge.sh.in
@@ -2,7 +2,7 @@
#
# purge.sh - Remove unwanted files from the package
#
-# Copyright (c) 2008-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2008-2017 Pacman Development Team <pacman-dev@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
diff --git a/scripts/libmakepkg/tidy/staticlibs.sh.in b/scripts/libmakepkg/tidy/staticlibs.sh.in
index 07282a80..643932dd 100644
--- a/scripts/libmakepkg/tidy/staticlibs.sh.in
+++ b/scripts/libmakepkg/tidy/staticlibs.sh.in
@@ -2,7 +2,7 @@
#
# staticlibs.sh - Remove static library files from the package
#
-# Copyright (c) 2013-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2013-2017 Pacman Development Team <pacman-dev@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
diff --git a/scripts/libmakepkg/tidy/strip.sh.in b/scripts/libmakepkg/tidy/strip.sh.in
index 1c7aacfd..76562808 100644
--- a/scripts/libmakepkg/tidy/strip.sh.in
+++ b/scripts/libmakepkg/tidy/strip.sh.in
@@ -2,7 +2,7 @@
#
# strip.sh - Strip debugging symbols from binary files
#
-# Copyright (c) 2007-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2007-2017 Pacman Development Team <pacman-dev@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
@@ -32,7 +32,12 @@ tidy_modify+=('tidy_strip')
build_id() {
- LANG=C readelf -n $1 | sed -n '/Build ID/ { s/.*: //p; q; }'
+ LANG=C readelf -n "$1" | sed -n '/Build ID/ { s/.*: //p; q; }'
+}
+
+source_files() {
+ LANG=C readelf "$1" --debug-dump | \
+ awk '/DW_AT_name +:/{name=$8}/DW_AT_comp_dir +:/{print $8 "/" name}'
}
strip_file() {
@@ -50,6 +55,18 @@ strip_file() {
return
fi
+ # copy source files to debug directory
+ local f t
+ while read -r f; do
+ t=${f/"$srcdir"/$dbgsrc}
+ mkdir -p "${t%/*}"
+ cp -- "$f" "$t"
+ done < <(source_files "$binary")
+
+ # adjust debug symbols to point at sources
+ debugedit -b "${srcdir}" -d /usr/src/debug/ -i "$binary" &> /dev/null
+
+ # copy debug symbols to debug directory
mkdir -p "$dbgdir/${binary%/*}"
objcopy --only-keep-debug "$binary" "$dbgdir/$binary.debug"
objcopy --add-gnu-debuglink="$dbgdir/${binary#/}.debug" "$binary"
@@ -88,8 +105,10 @@ tidy_strip() {
[[ -z ${STRIP_STATIC+x} ]] && STRIP_STATIC="-S"
if check_option "debug" "y"; then
- dbgdir="$pkgdir-@DEBUGSUFFIX@/usr/lib/debug"
- mkdir -p "$dbgdir"
+
+ dbgdir="$pkgdirbase/$pkgbase-@DEBUGSUFFIX@/usr/lib/debug"
+ dbgsrc="$pkgdirbase/$pkgbase-@DEBUGSUFFIX@/usr/src/debug"
+ mkdir -p "$dbgdir" "$dbgsrc"
fi
local binary strip_flags
diff --git a/scripts/libmakepkg/tidy/zipman.sh.in b/scripts/libmakepkg/tidy/zipman.sh.in
index 7ef4d5c3..ff82d43c 100644
--- a/scripts/libmakepkg/tidy/zipman.sh.in
+++ b/scripts/libmakepkg/tidy/zipman.sh.in
@@ -2,7 +2,7 @@
#
# zipman.sh - Compress man and info pages
#
-# Copyright (c) 2011-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2011-2017 Pacman Development Team <pacman-dev@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
diff --git a/scripts/libmakepkg/util.sh.in b/scripts/libmakepkg/util.sh.in
index c296d565..b7b56d34 100644
--- a/scripts/libmakepkg/util.sh.in
+++ b/scripts/libmakepkg/util.sh.in
@@ -2,7 +2,7 @@
#
# util.sh - utility functions for makepkg
#
-# Copyright (c) 2015-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2015-2017 Pacman Development Team <pacman-dev@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
diff --git a/scripts/libmakepkg/util/message.sh b/scripts/libmakepkg/util/message.sh.in
index 341ccf3f..33808de7 100644
--- a/scripts/libmakepkg/util/message.sh
+++ b/scripts/libmakepkg/util/message.sh.in
@@ -2,7 +2,7 @@
#
# message.sh - functions for outputting messages in makepkg
#
-# Copyright (c) 2006-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2006-2017 Pacman Development Team <pacman-dev@archlinux.org>
# Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
#
# This program is free software; you can redistribute it and/or modify
diff --git a/scripts/libmakepkg/util/option.sh b/scripts/libmakepkg/util/option.sh.in
index 54ba4740..8cf0039b 100644
--- a/scripts/libmakepkg/util/option.sh
+++ b/scripts/libmakepkg/util/option.sh.in
@@ -2,7 +2,7 @@
#
# option.sh - functions to test if build/packaging options are enabled
#
-# Copyright (c) 2009-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2009-2017 Pacman Development Team <pacman-dev@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
diff --git a/scripts/library/parseopts.sh b/scripts/libmakepkg/util/parseopts.sh.in
index cf6aa6c6..a7638cf1 100644
--- a/scripts/library/parseopts.sh
+++ b/scripts/libmakepkg/util/parseopts.sh.in
@@ -1,4 +1,40 @@
-# getopt-like parser
+#!/bin/bash
+#
+# parseopts.sh - getopt_long-like parser
+#
+# Copyright (c) 2012-2017 Pacman Development Team <pacman-dev@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/>.
+#
+# A getopt_long-like parser which portably supports longopts and
+# shortopts with some GNU extensions. It does not allow for options
+# with optional arguments. For both short and long opts, options
+# requiring an argument should be suffixed with a colon. After the
+# first argument containing the short opts, any number of valid long
+# opts may be be passed. The end of the options delimiter must then be
+# added, followed by the user arguments to the calling program.
+#
+# Recommended Usage:
+# OPT_SHORT='fb:z'
+# OPT_LONG=('foo' 'bar:' 'baz')
+# if ! parseopts "$OPT_SHORT" "${OPT_LONG[@]}" -- "$@"; then
+# exit 1
+# fi
+# set -- "${OPTRET[@]}"
+# Returns:
+# 0: parse success
+# 1: parse failure (error message supplied)
parseopts() {
local opt= optarg= i= shortopts=$1
local -a longopts=() unused_argv=()
@@ -34,7 +70,7 @@ parseopts() {
return 255 ;;
*)
# fail, ambiguous match
- printf "@SCRIPTNAME@: $(gettext "option '%s' is ambiguous; possibilities:")" "--$1"
+ printf "${0##*/}: $(gettext "option '%s' is ambiguous; possibilities:")" "--$1"
printf " '%s'" "${longmatch[@]%:}"
printf '\n'
return 254 ;;
@@ -53,7 +89,7 @@ parseopts() {
# option doesn't exist
if [[ $shortopts != *$opt* ]]; then
- printf "@SCRIPTNAME@: $(gettext "invalid option") -- '%s'\n" "$opt" >&2
+ printf "${0##*/}: $(gettext "invalid option") -- '%s'\n" "$opt" >&2
OPTRET=(--)
return 1
fi
@@ -72,7 +108,7 @@ parseopts() {
break
# parse failure
else
- printf "@SCRIPTNAME@: $(gettext "option requires an argument") -- '%s'\n" "$opt" >&2
+ printf "${0##*/}: $(gettext "option requires an argument") -- '%s'\n" "$opt" >&2
OPTRET=(--)
return 1
fi
@@ -86,7 +122,7 @@ parseopts() {
0)
# parse failure
if [[ $optarg ]]; then
- printf "@SCRIPTNAME@: $(gettext "option '%s' does not allow an argument")\n" "--$opt" >&2
+ printf "${0##*/}: $(gettext "option '%s' does not allow an argument")\n" "--$opt" >&2
OPTRET=(--)
return 1
# --longopt
@@ -104,7 +140,7 @@ parseopts() {
shift
# parse failure
else
- printf "@SCRIPTNAME@: $(gettext "option '%s' requires an argument")\n" "--$opt" >&2
+ printf "${0##*/}: $(gettext "option '%s' requires an argument")\n" "--$opt" >&2
OPTRET=(--)
return 1
fi
@@ -116,7 +152,7 @@ parseopts() {
;;
255)
# parse failure
- printf "@SCRIPTNAME@: $(gettext "invalid option") '--%s'\n" "$opt" >&2
+ printf "${0##*/}: $(gettext "invalid option") '--%s'\n" "$opt" >&2
OPTRET=(--)
return 1
;;
diff --git a/scripts/libmakepkg/util/pkgbuild.sh.in b/scripts/libmakepkg/util/pkgbuild.sh.in
index 7bf7c3e4..2a4bd3af 100644
--- a/scripts/libmakepkg/util/pkgbuild.sh.in
+++ b/scripts/libmakepkg/util/pkgbuild.sh.in
@@ -2,7 +2,7 @@
#
# pkgbuild.sh - functions to extract information from PKGBUILD files
#
-# Copyright (c) 2009-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2009-2017 Pacman Development Team <pacman-dev@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
diff --git a/scripts/libmakepkg/util/source.sh.in b/scripts/libmakepkg/util/source.sh.in
index 9d4ba4a6..238d1f58 100644
--- a/scripts/libmakepkg/util/source.sh.in
+++ b/scripts/libmakepkg/util/source.sh.in
@@ -2,7 +2,7 @@
#
# source.sh - functions to extract information from source URLs
#
-# Copyright (c) 2010-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2010-2017 Pacman Development Team <pacman-dev@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
@@ -65,6 +65,7 @@ get_filename() {
case $proto in
bzr*|git*|hg*|svn*)
filename=${netfile%%#*}
+ filename=${filename%%\?*}
filename=${filename%/}
filename=${filename##*/}
if [[ $proto = bzr* ]]; then
@@ -111,6 +112,32 @@ get_filepath() {
printf "%s\n" "$file"
}
+# extract the VCS revision/branch specifier from a source entry
+get_uri_fragment() {
+ local netfile=$1
+
+ local fragment=${netfile#*#}
+ if [[ $fragment = "$netfile" ]]; then
+ unset fragment
+ fi
+ fragment=${fragment%\?*}
+
+ printf "%s\n" "$fragment"
+}
+
+# extract the VCS "signed" status from a source entry
+get_uri_query() {
+ local netfile=$1
+
+ local query=${netfile#*\?}
+ if [[ $query = "$netfile" ]]; then
+ unset query
+ fi
+ query=${query%#*}
+
+ printf "%s\n" "$query"
+}
+
get_downloadclient() {
local proto=$1
diff --git a/scripts/libmakepkg/util/util.sh b/scripts/libmakepkg/util/util.sh.in
index f9f1c200..d676249d 100644
--- a/scripts/libmakepkg/util/util.sh
+++ b/scripts/libmakepkg/util/util.sh.in
@@ -2,7 +2,7 @@
#
# util.sh - general utility functions
#
-# Copyright (c) 2006-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2006-2017 Pacman Development Team <pacman-dev@archlinux.org>
# Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
#
# This program is free software; you can redistribute it and/or modify
diff --git a/scripts/library/README b/scripts/library/README
index e9615a2e..a9d15f1e 100644
--- a/scripts/library/README
+++ b/scripts/library/README
@@ -8,26 +8,6 @@ stdout and can be silenced by defining 'QUIET'. The 'warning' and 'error'
functions print to stderr with the appropriate prefix added to the
message.
-parseopts.sh:
-A getopt_long-like parser which portably supports longopts and shortopts
-with some GNU extensions. It does not allow for options with optional
-arguments. For both short and long opts, options requiring an argument
-should be suffixed with a colon. After the first argument containing
-the short opts, any number of valid long opts may be be passed. The end
-of the options delimiter must then be added, followed by the user arguments
-to the calling program.
-
-Recommended Usage:
- OPT_SHORT='fb:z'
- OPT_LONG=('foo' 'bar:' 'baz')
- if ! parseopts "$OPT_SHORT" "${OPT_LONG[@]}" -- "$@"; then
- exit 1
- fi
- set -- "${OPTRET[@]}"
-Returns:
- 0: parse success
- 1: parse failure (error message supplied)
-
human_to_size.sh:
A function to convert human readable sizes (such as "5.3 GiB") to raw byte
equivalents. base10 and base2 suffixes are supported, case sensitively. If
diff --git a/scripts/makepkg-template.pl.in b/scripts/makepkg-template.pl.in
index 483dc8bd..e0513776 100755
--- a/scripts/makepkg-template.pl.in
+++ b/scripts/makepkg-template.pl.in
@@ -2,7 +2,7 @@
# makepkg-template - template system for makepkg
# @configure_input@
#
-# Copyright (c) 2013-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2013-2017 Pacman Development Team <pacman-dev@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
@@ -191,7 +191,7 @@ sub version {
my ($exitstatus) = @_;
printf "makepkg-template (pacman) %s\n", '@PACKAGE_VERSION@';
print gettext(
- 'Copyright (c) 2013-2016 Pacman Development Team <pacman-dev@archlinux.org>.'."\n".
+ 'Copyright (c) 2013-2017 Pacman Development Team <pacman-dev@archlinux.org>.'."\n".
'This is free software; see the source for copying conditions.'."\n".
'There is NO WARRANTY, to the extent permitted by law.'."\n");
exit($exitstatus);
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 7b2ce511..0218e13b 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -3,7 +3,7 @@
# makepkg - make packages compatible for use with pacman
# @configure_input@
#
-# Copyright (c) 2006-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2006-2017 Pacman Development Team <pacman-dev@archlinux.org>
# Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
# Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
# Copyright (c) 2006 by Miklos Vajna <vmiklos@frugalware.org>
@@ -28,7 +28,7 @@
# makepkg uses quite a few external programs during its execution. You
# need to have at least the following installed for makepkg to function:
# awk, bsdtar (libarchive), bzip2, coreutils, fakeroot, file, find (findutils),
-# gettext, gpg, grep, gzip, openssl, sed, tput (ncurses), xz
+# gettext, gpg, grep, gzip, sed, tput (ncurses), xz
# gettext initialization
export TEXTDOMAIN='pacman-scripts'
@@ -137,6 +137,12 @@ clean_up() {
if [[ -n $pkgbase ]]; then
local fullver=$(get_full_version)
# Can't do this unless the BUILDSCRIPT has been sourced.
+ if (( PKGVERFUNC )); then
+ rm -f "${pkgbase}-${fullver}-${CARCH}-pkgver.log"*
+ fi
+ if (( PREPAREFUNC )); then
+ rm -f "${pkgbase}-${fullver}-${CARCH}-prepare.log"*
+ fi
if (( BUILDFUNC )); then
rm -f "${pkgbase}-${fullver}-${CARCH}-build.log"*
fi
@@ -243,7 +249,7 @@ handle_deps() {
(( $# == 0 )) && return $R_DEPS_SATISFIED
- local deplist="$*"
+ local deplist=("$@")
if (( ! DEP_BIN )); then
return $R_DEPS_MISSING
@@ -253,7 +259,7 @@ handle_deps() {
# install missing deps from binary packages (using pacman -S)
msg "$(gettext "Installing missing dependencies...")"
- if ! run_pacman -S --asdeps $deplist; then
+ if ! run_pacman -S --asdeps "${deplist[@]}"; then
error "$(gettext "'%s' failed to install missing dependencies.")" "$PACMAN"
exit 1 # TODO: error code
fi
@@ -276,12 +282,12 @@ resolve_deps() {
# deplist cannot be declared like this: local deplist=$(foo)
# Otherwise, the return value will depend on the assignment.
local deplist
- deplist="$(set +E; check_deps $*)" || exit 1
+ deplist=($(check_deps "$@")) || exit 1
[[ -z $deplist ]] && return $R_DEPS_SATISFIED
- if handle_deps $deplist; then
+ if handle_deps "${deplist[@]}"; then
# check deps again to make sure they were resolved
- deplist="$(set +E; check_deps $*)" || exit 1
+ deplist=$(check_deps "$@") || exit 1
[[ -z $deplist ]] && return $R_DEPS_SATISFIED
fi
@@ -398,20 +404,23 @@ prepare_buildenv() {
}
run_function_safe() {
- local restoretrap
+ local restoretrap restoreset restoreshopt
- set -e
- set -E
+ # we don't set any special shopts of our own, but we don't want the user to
+ # muck with our environment.
+ restoreshopt=$(shopt -p)
+
+ restoreset=$(shopt -o -p)
+ shopt -o -s errexit errtrace
restoretrap=$(trap -p ERR)
- trap 'error_function $pkgfunc' ERR
+ trap "error_function '$1'" ERR
run_function "$1"
- eval $restoretrap
-
- set +E
- set +e
+ eval "$restoretrap"
+ eval "$restoreset"
+ eval "$restoreshopt"
}
run_function() {
@@ -494,7 +503,7 @@ find_libdepends() {
done
if (( sodepends == 0 )); then
- printf '%s\n' "${depends[@]}"
+ (( ${#depends[@]} )) && printf '%s\n' "${depends[@]}"
return;
fi
@@ -543,7 +552,7 @@ find_libdepends() {
esac
done
- printf '%s\n' "${libdepends[@]}"
+ (( ${#libdepends[@]} )) && printf '%s\n' "${libdepends[@]}"
}
@@ -594,7 +603,20 @@ find_libprovides() {
fi
done
- printf '%s\n' "${libprovides[@]}"
+ (( ${#libprovides[@]} )) && printf '%s\n' "${libprovides[@]}"
+}
+
+write_kv_pair() {
+ local key="$1"
+ shift
+
+ for val in "$@"; do
+ if [[ $val = *$'\n'* ]]; then
+ error "$(gettext "Invalid value for %s: %s")" "$key" "$val"
+ exit 1
+ fi
+ printf "%s = %s\n" "$key" "$val"
+ done
}
write_pkginfo() {
@@ -615,15 +637,15 @@ write_pkginfo() {
printf "# using %s\n" "$(fakeroot -v)"
printf "# %s\n" "$(LC_ALL=C date -u)"
- printf "pkgname = %s\n" "$pkgname"
+ write_kv_pair "pkgname" "$pkgname"
if (( SPLITPKG )) || [[ "$pkgbase" != "$pkgname" ]]; then
- printf "pkgbase = %s\n" "$pkgbase"
+ write_kv_pair "pkgbase" "$pkgbase"
fi
local fullver=$(get_full_version)
- printf "pkgver = %s\n" "$fullver"
+ write_kv_pair "pkgver" "$fullver"
if [[ "$fullver" != "$basever" ]]; then
- printf "basever = %s\n" "$basever"
+ write_kv_pair "basever" "$basever"
fi
# TODO: all fields should have this treatment
@@ -631,43 +653,52 @@ write_pkginfo() {
spd=("${spd[@]#[[:space:]]}")
spd=("${spd[@]%[[:space:]]}")
- printf "pkgdesc = %s\n" "$spd"
- printf "url = %s\n" "$url"
- printf "builddate = %s\n" "$builddate"
- printf "packager = %s\n" "$packager"
- printf "size = %s\n" "$size"
- printf "arch = %s\n" "$pkgarch"
+ write_kv_pair "pkgdesc" "$spd"
+ write_kv_pair "url" "$url"
+ write_kv_pair "builddate" "$builddate"
+ write_kv_pair "packager" "$packager"
+ write_kv_pair "size" "$size"
+ write_kv_pair "arch" "$pkgarch"
mapfile -t provides < <(find_libprovides)
mapfile -t depends < <(find_libdepends)
- [[ $license ]] && printf "license = %s\n" "${license[@]}"
- [[ $replaces ]] && printf "replaces = %s\n" "${replaces[@]}"
- [[ $groups ]] && printf "group = %s\n" "${groups[@]}"
- [[ $conflicts ]] && printf "conflict = %s\n" "${conflicts[@]}"
- [[ $provides ]] && printf "provides = %s\n" "${provides[@]}"
- [[ $backup ]] && printf "backup = %s\n" "${backup[@]}"
- [[ $depends ]] && printf "depend = %s\n" "${depends[@]}"
- [[ $optdepends ]] && printf "optdepend = %s\n" "${optdepends[@]//+([[:space:]])/ }"
- [[ $makedepends ]] && printf "makedepend = %s\n" "${makedepends[@]}"
- [[ $checkdepends ]] && printf "checkdepend = %s\n" "${checkdepends[@]}"
+ write_kv_pair "license" "${license[@]}"
+ write_kv_pair "replaces" "${replaces[@]}"
+ write_kv_pair "group" "${groups[@]}"
+ write_kv_pair "conflict" "${conflicts[@]}"
+ write_kv_pair "provides" "${provides[@]}"
+ write_kv_pair "backup" "${backup[@]}"
+ write_kv_pair "depend" "${depends[@]}"
+ write_kv_pair "optdepend" "${optdepends[@]//+([[:space:]])/ }"
+ write_kv_pair "makedepend" "${makedepends[@]}"
+ write_kv_pair "checkdepend" "${checkdepends[@]}"
}
write_buildinfo() {
msg2 "$(gettext "Generating %s file...")" ".BUILDINFO"
- printf "builddir = %s\n" "${BUILDDIR}"
+ write_kv_pair "builddir" "${BUILDDIR}"
- local sum="$(openssl dgst -sha256 "${BUILDFILE}")"
- sum=${sum##* }
+ local sum="$(sha256sum "${BUILDFILE}")"
+ sum=${sum%% *}
- printf "pkgbuild_sha256sum = %s\n" $sum
+ write_kv_pair "pkgbuild_sha256sum" $sum
- printf "buildenv = %s\n" "${BUILDENV[@]}"
- printf "options = %s\n" "${OPTIONS[@]}"
+ write_kv_pair "buildenv" "${BUILDENV[@]}"
+ write_kv_pair "options" "${OPTIONS[@]}"
local pkglist=($(run_pacman -Q | sed "s# #-#"))
- printf "installed = %s\n" "${pkglist[@]}"
+ write_kv_pair "installed" "${pkglist[@]}"
+}
+
+# build a sorted NUL-separated list of the full contents of the current
+# directory suitable for passing to `bsdtar --files-from`
+# database files are placed at the beginning of the package regardless of
+# sorting
+list_package_files() {
+ (find . -path './.*' \! -name '.'; find . \! -path './.*' \! -name '.' | LC_ALL=C sort) |
+ sed -e 's|^\./||' | tr '\n' '\0'
}
create_package() {
@@ -686,8 +717,6 @@ create_package() {
write_pkginfo > .PKGINFO
write_buildinfo > .BUILDINFO
- local comp_files=('.PKGINFO' '.BUILDINFO')
-
# check for changelog/install files
for i in 'changelog/.CHANGELOG' 'install/.INSTALL'; do
IFS='/' read -r orig dest < <(printf '%s\n' "$i")
@@ -699,7 +728,6 @@ create_package() {
exit 1
fi
chmod 644 "$dest"
- comp_files+=("$dest")
fi
done
@@ -711,15 +739,10 @@ create_package() {
[[ -f $pkg_file ]] && rm -f "$pkg_file"
[[ -f $pkg_file.sig ]] && rm -f "$pkg_file.sig"
- # when fileglobbing, we want * in an empty directory to expand to
- # the null string rather than itself
- shopt -s nullglob
-
msg2 "$(gettext "Generating .MTREE file...")"
- LANG=C bsdtar -czf .MTREE --format=mtree \
+ list_package_files | LANG=C bsdtar -cnzf .MTREE --format=mtree \
--options='!all,use-set,type,uid,gid,mode,time,size,md5,sha256,link' \
- "${comp_files[@]}" *
- comp_files+=(".MTREE")
+ --null --files-from - --exclude .MTREE
msg2 "$(gettext "Compressing package...")"
# TODO: Maybe this can be set globally for robustness
@@ -727,7 +750,7 @@ create_package() {
# bsdtar's gzip compression always saves the time stamp, making one
# archive created using the same command line distinct from another.
# Disable bsdtar compression and use gzip -n for now.
- LANG=C bsdtar -cf - "${comp_files[@]}" * |
+ list_package_files | LANG=C bsdtar -cnf - --null --files-from - |
case "$PKGEXT" in
*tar.gz) ${COMPRESSGZ[@]:-gzip -c -f -n} ;;
*tar.bz2) ${COMPRESSBZ2[@]:-bzip2 -c -f} ;;
@@ -740,7 +763,6 @@ create_package() {
"$PKGEXT"; cat ;;
esac > "${pkg_file}" || ret=$?
- shopt -u nullglob
shopt -u -o pipefail
if (( ret )); then
@@ -771,18 +793,24 @@ create_debug_package() {
return
fi
- pkgdir="${pkgdir}-@DEBUGSUFFIX@"
+ pkgdir="$pkgdirbase/$pkgbase-@DEBUGSUFFIX@"
# check if we have any debug symbols to package
if dir_is_empty "$pkgdir/usr/lib/debug"; then
return
fi
- depends=("$pkgname=$(get_full_version)")
- pkgdesc="Detached debugging symbols for $pkgname"
- pkgname=$pkgname-@DEBUGSUFFIX@
+ unset groups depends optdepends provides conflicts replaces backup install changelog
- unset groups optdepends provides conflicts replaces backup install changelog
+ local pkg
+ for pkg in ${pkgname[@]}; do
+ if [[ $pkg != $pkgbase ]]; then
+ provides+=("$pkg-@DEBUGSUFFIX@")
+ fi
+ done
+
+ pkgdesc="Detached debugging symbols for $pkgname"
+ pkgname=$pkgbase-@DEBUGSUFFIX@
create_package
}
@@ -959,7 +987,7 @@ check_vcs_software() {
client=$(get_vcsclient "$proto") || exit $?
# ensure specified program is installed
local uninstalled
- uninstalled="$(set +E; check_deps $client)" || exit 1
+ uninstalled=$(check_deps "$client") || exit 1
# if not installed, check presence in depends or makedepends
if [[ -n "$uninstalled" ]] && (( ! NODEPS || ( VERIFYSOURCE && !DEP_BIN ) )); then
if ! in_array "$client" ${all_deps[@]}; then
@@ -1022,12 +1050,18 @@ check_software() {
fi
fi
- # openssl - checksum operations
- if (( ! SKIPCHECKSUMS )); then
- if ! type -p openssl >/dev/null; then
- error "$(gettext "Cannot find the %s binary required for validating source file checksums.")" "openssl"
- ret=1
- fi
+ # checksum operations
+ if (( GENINTEG || ! SKIPCHECKSUMS )); then
+ local integlist
+ IFS=$'\n' read -rd '' -a integlist < <(get_integlist)
+
+ local integ
+ for integ in "${integlist[@]}"; do
+ if ! type -p "${integ}sum" >/dev/null; then
+ error "$(gettext "Cannot find the %s binary required for source file checksums operations.")" "${integ}sum"
+ ret=1
+ fi
+ done
fi
# distcc - compilation with distcc
@@ -1145,16 +1179,14 @@ run_split_packaging() {
backup_package_variables
run_package $pkgname
tidy_install
- lint_package
+ lint_package || exit 1
create_package
- create_debug_package
restore_package_variables
done
pkgname=("${pkgname_backup[@]}")
+ create_debug_package
}
-m4_include(library/parseopts.sh)
-
usage() {
printf "makepkg (pacman) %s\n" "$makepkg_version"
echo
@@ -1212,7 +1244,7 @@ usage() {
version() {
printf "makepkg (pacman) %s\n" "$makepkg_version"
printf -- "$(gettext "\
-Copyright (c) 2006-2016 Pacman Development Team <pacman-dev@archlinux.org>.\n\
+Copyright (c) 2006-2017 Pacman Development Team <pacman-dev@archlinux.org>.\n\
Copyright (C) 2002-2006 Judd Vinet <jvinet@zeroflux.org>.\n\n\
This is free software; see the source for copying conditions.\n\
There is NO WARRANTY, to the extent permitted by law.\n")"
@@ -1448,7 +1480,11 @@ fi
unset pkgname pkgbase pkgver pkgrel epoch pkgdesc url license groups provides
unset md5sums replaces depends conflicts backup source install changelog build
-unset makedepends optdepends options noextract validpgpkeys
+unset sha{1,224,256,384,512}sums makedepends optdepends options noextract validpgpkeys
+unset "${!makedepends_@}" "${!depends_@}" "${!source_@}" "${!checkdepends_@}"
+unset "${!optdepends_@}" "${!conflicts_@}" "${!provides_@}" "${!replaces_@}"
+unset "${!md5sums_@}" "${!sha1sums_@}" "${!sha224sums_@}" "${!sha256sums_@}"
+unset "${!sha384sums_@}" "${!sha512sums_@}"
BUILDFILE=${BUILDFILE:-$BUILDSCRIPT}
if [[ ! -f $BUILDFILE ]]; then
@@ -1476,7 +1512,7 @@ pkgbase=${pkgbase:-${pkgname[0]}}
# check the PKGBUILD for some basic requirements
lint_pkgbuild || exit 1
-if (( !SOURCEONLY )); then
+if (( !SOURCEONLY && !PRINTSRCINFO )); then
merge_arch_attrs
fi
@@ -1581,7 +1617,7 @@ if (( INFAKEROOT )); then
run_package
fi
tidy_install
- lint_package
+ lint_package || exit 1
create_package
create_debug_package
else
diff --git a/scripts/pacman-db-upgrade.sh.in b/scripts/pacman-db-upgrade.sh.in
index 79e1c590..a6ff3b25 100644
--- a/scripts/pacman-db-upgrade.sh.in
+++ b/scripts/pacman-db-upgrade.sh.in
@@ -3,7 +3,7 @@
# pacman-db-upgrade - upgrade the local pacman db to a newer format
# @configure_input@
#
-# Copyright (c) 2010-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2010-2017 Pacman Development Team <pacman-dev@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
@@ -30,7 +30,10 @@ declare -r myver='@PACKAGE_VERSION@'
m4_include(library/output_format.sh)
-m4_include(library/parseopts.sh)
+LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
+
+# Import parseopts.sh
+source "$LIBRARY"/util/parseopts.sh
usage() {
printf "pacman-db-upgrade (pacman) %s\n" "${myver}"
@@ -52,7 +55,7 @@ usage() {
version() {
printf "pacman-db-upgrade (pacman) %s\n" "$myver"
printf -- "$(gettext "\
-Copyright (c) 2010-2016 Pacman Development Team <pacman-dev@archlinux.org>.\n\
+Copyright (c) 2010-2017 Pacman Development Team <pacman-dev@archlinux.org>.\n\
This is free software; see the source for copying conditions.\n\
There is NO WARRANTY, to the extent permitted by law.\n")"
}
diff --git a/scripts/pacman-key.sh.in b/scripts/pacman-key.sh.in
index ffefc68c..7b158da7 100644
--- a/scripts/pacman-key.sh.in
+++ b/scripts/pacman-key.sh.in
@@ -4,7 +4,7 @@
# Based on apt-key, from Debian
# @configure_input@
#
-# Copyright (c) 2010-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2010-2017 Pacman Development Team <pacman-dev@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
@@ -26,6 +26,11 @@ export TEXTDOMAINDIR='@localedir@'
declare -r myver="@PACKAGE_VERSION@"
+LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
+
+# Import parseopts.sh
+source "$LIBRARY"/util/parseopts.sh
+
# Options
ADD=0
DELETE=0
@@ -50,8 +55,6 @@ DEFAULT_KEYSERVER='hkp://pool.sks-keyservers.net'
m4_include(library/output_format.sh)
-m4_include(library/parseopts.sh)
-
usage() {
printf "pacman-key (pacman) %s\n" ${myver}
echo
@@ -92,7 +95,7 @@ usage() {
version() {
printf "pacman-key (pacman) %s\n" "${myver}"
printf -- "$(gettext "\
-Copyright (c) 2010-2016 Pacman Development Team <pacman-dev@archlinux.org>.\n\
+Copyright (c) 2010-2017 Pacman Development Team <pacman-dev@archlinux.org>.\n\
This is free software; see the source for copying conditions.\n\
There is NO WARRANTY, to the extent permitted by law.\n")"
}
diff --git a/scripts/pacman-optimize.sh.in b/scripts/pacman-optimize.sh.in
deleted file mode 100644
index f5ad924b..00000000
--- a/scripts/pacman-optimize.sh.in
+++ /dev/null
@@ -1,189 +0,0 @@
-#!/bin/bash
-#
-# pacman-optimize
-# @configure_input@
-#
-# Copyright (c) 2006-2016 Pacman Development Team <pacman-dev@archlinux.org>
-# Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.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/>.
-#
-
-# gettext initialization
-export TEXTDOMAIN='pacman-scripts'
-export TEXTDOMAINDIR='@localedir@'
-
-USE_COLOR='y'
-
-declare -r myver='@PACKAGE_VERSION@'
-
-eval $(awk '/DBPath/ {print $1$2$3}' @sysconfdir@/pacman.conf)
-dbroot="${DBPath:-@localstatedir@/lib/pacman/}"
-
-m4_include(library/output_format.sh)
-
-usage() {
- printf "pacman-optimize (pacman) %s\n\n" "$myver"
- printf -- "$(gettext "Usage: %s [--nocolor] [pacman_db_root]")\n\n" "$0"
- printf -- "$(gettext "\
-pacman-optimize is a little hack that should improve the performance\n\
-of pacman when reading/writing to its filesystem-based database.\n\n")"
- printf -- "$(gettext "\
-Because pacman uses many small files to keep track of packages,\n\
-there is a tendency for these files to become fragmented over time.\n\
-This script attempts to relocate these small files into one\n\
-continuous location on your hard drive. The result is that the hard\n\
-drive should be able to read them faster, since the hard drive head\n\
-does not have to move around the disk as much.\n")"
-}
-
-version() {
- printf "pacman-optimize (pacman) %s\n" "$myver"
- printf -- "$(gettext "\
-Copyright (c) 2006-2016 Pacman Development Team <pacman-dev@archlinux.org>.\n\
-Copyright (C) 2002-2006 Judd Vinet <jvinet@zeroflux.org>.\n\n\
-This is free software; see the source for copying conditions.\n\
-There is NO WARRANTY, to the extent permitted by law.\n")"
-}
-
-die() {
- error "$@"
- exit 1
-}
-
-die_r() {
- rm -f "$lockfile"
- die "$@"
-}
-
-# PROGRAM START
-
-# determine whether we have gettext; make it a no-op if we do not
-if ! type gettext &>/dev/null; then
- gettext() {
- echo "$@"
- }
-fi
-
-if [[ $1 = "-h" || $1 = "--help" ]]; then
- usage
- exit 0
-fi
-
-if [[ $1 = "-V" || $1 = "--version" ]]; then
- version
- exit 0
-fi
-
-if [[ $1 = "--nocolor" ]]; then
- USE_COLOR='n'
- shift
-fi
-
-m4_include(library/term_colors.sh)
-
-if [[ -n $1 ]]; then
- dbroot="$1"
-fi
-
-if ! type -p openssl >/dev/null; then
- die "$(gettext "Cannot find the %s binary required for verifying integrity.")" "openssl"
-fi
-
-if [[ ! -d $dbroot || ! -d $dbroot/local ]]; then
- die "$(gettext "%s does not exist or is not a directory.")" "$dbroot"
-fi
-
-if [[ ! -w $dbroot ]]; then
- die "$(gettext "You must have correct permissions to optimize the database.")"
-fi
-
-# strip any trailing slash from our dbroot
-dbroot="${dbroot%/}"
-lockfile="${dbroot}/db.lck"
-localdb="${dbroot}/local"
-
-# make sure pacman isn't running
-if [[ -f $lockfile ]]; then
- die "$(gettext "Pacman lock file was found. Cannot run while pacman is running.")"
-fi
-# do not let pacman run while we do this
-touch "$lockfile"
-
-workdir=$(mktemp -d "${TMPDIR:-/tmp}/pacman-optimize.XXXXXXXXXX") ||
- die_r "$(gettext "Cannot create temporary directory for database building.")\n" >&2
-
-# step 1: sum the old db
-msg "$(gettext "MD5sum'ing the old database...")"
-(cd "$localdb" && find . -type f -print0 | \
- xargs -0 openssl dgst -md5 | sort > "$workdir/pacsums.old")
-
-# step 2: tar it up
-msg "$(gettext "Tar'ing up %s...")" "$localdb"
-bsdtar -czf "$workdir/pacman-db.tar.gz" -C "$localdb" ./
-if (( $? )); then
- rm -rf "$workdir"
- die_r "$(gettext "Tar'ing up %s failed.")" "$localdb"
-fi
-
-# step 3: make and sum the new db side-by-side with the old
-msg "$(gettext "Making and MD5sum'ing the new database...")"
-mkdir "$localdb.new"
-bsdtar -xpf "$workdir/pacman-db.tar.gz" -C "$localdb.new"
-if (( $? )); then
- rm -rf "$workdir"
- die_r "$(gettext "Untar'ing %s failed.")" "$localdb"
-fi
-# immediate sync following extraction should get it written continuously on HDD
-msg "$(gettext "Syncing database to disk...")"
-sync
-(cd "$localdb.new" && find . -type f -print0 | \
- xargs -0 openssl dgst -md5 | sort > "$workdir/pacsums.new")
-
-# step 4: compare the sums
-msg "$(gettext "Checking integrity...")"
-read -ra old_dgst < <(openssl dgst -md5 < "$workdir/pacsums.old")
-read -ra new_dgst < <(openssl dgst -md5 < "$workdir/pacsums.new")
-if [[ ${old_dgst[@]:(-1)} != ${new_dgst[@]:(-1)} ]]; then
- # failed
- # leave our pacman-optimize tmpdir for checking to see what doesn't match up
- rm -rf "$localdb.new"
- die_r "$(gettext "Integrity check FAILED, reverting to old database.")"
-fi
-
-# step 5: shuffle the newly extracted DB into the proper location
-msg "$(gettext "Rotating database into place...")"
-
-fail=0
-mv "$localdb" "$localdb.old" || fail=1
-mv "$localdb.new" "$localdb" || fail=1
-chmod $(@MODECMD@ "$localdb.old") "$localdb" || fail=1
-chown $(@OWNERCMD@ "$localdb.old") "$localdb" || fail=1
-if (( fail )); then
- # failure with our directory shuffle
- die_r "$(gettext "New database substitution failed. Check for %s, %s, and %s directories.")" "$localdb" "$localdb.old" "$localdb.new"
-fi
-rm -rf "$localdb.old"
-
-# remove the lock file and our working directory with sums and tarfile
-rm -f "$lockfile"
-rm -rf "$workdir"
-
-echo
-msg "$(gettext "Finished. Your pacman database has been optimized.")"
-echo
-
-exit 0
-
-# vim: set noet:
diff --git a/scripts/pkgdelta.sh.in b/scripts/pkgdelta.sh.in
index fe63974d..4500dd75 100644
--- a/scripts/pkgdelta.sh.in
+++ b/scripts/pkgdelta.sh.in
@@ -28,6 +28,12 @@ export TEXTDOMAINDIR='@localedir@'
declare -r myver='@PACKAGE_VERSION@'
+LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
+
+# Import parseopts.sh
+source "$LIBRARY"/util/parseopts.sh
+
+# Options
QUIET=0
USE_COLOR='y'
@@ -41,7 +47,6 @@ max_delta_size=70
# ensure we have a sane umask set
umask 0022
-m4_include(library/parseopts.sh)
m4_include(library/output_format.sh)
# print usage instructions
@@ -114,7 +119,7 @@ create_xdelta()
newver="$pkgver"
newarch="$arch"
- pkgsize="$(@SIZECMD@ -L "$newfile")"
+ pkgsize="$(wc -c "$newfile" | cut -d' ' -f1)"
if ((pkgsize < min_pkg_size)); then
msg "$(gettext "Skipping delta creation for small package: %s - size %s")" "$newname" "$pkgsize"
@@ -146,7 +151,7 @@ create_xdelta()
return 1
fi
- deltasize="$(@SIZECMD@ -L "$deltafile")"
+ deltasize="$(wc -c "$deltafile" | cut -d' ' -f1)"
if ((max_delta_size * pkgsize / 100 < deltasize)); then
msg "$(gettext "Delta package larger than maximum size. Removing.")"
diff --git a/scripts/po/POTFILES.in b/scripts/po/POTFILES.in
index 53dd545e..7cc6a031 100644
--- a/scripts/po/POTFILES.in
+++ b/scripts/po/POTFILES.in
@@ -5,7 +5,6 @@ scripts/makepkg.sh.in
scripts/makepkg-template.pl.in
scripts/pacman-db-upgrade.sh.in
scripts/pacman-key.sh.in
-scripts/pacman-optimize.sh.in
scripts/pkgdelta.sh.in
scripts/repo-add.sh.in
scripts/libmakepkg/integrity.sh.in
@@ -15,6 +14,8 @@ scripts/libmakepkg/integrity/verify_checksum.sh.in
scripts/libmakepkg/integrity/verify_signature.sh.in
scripts/libmakepkg/lint_package.sh.in
scripts/libmakepkg/lint_package/build_references.sh.in
+scripts/libmakepkg/lint_package/dotfiles.sh.in
+scripts/libmakepkg/lint_package/file_names.sh.in
scripts/libmakepkg/lint_package/missing_backup.sh.in
scripts/libmakepkg/lint_pkgbuild.sh.in
scripts/libmakepkg/lint_pkgbuild/arch.sh.in
@@ -49,7 +50,7 @@ scripts/libmakepkg/tidy/purge.sh.in
scripts/libmakepkg/tidy/staticlibs.sh.in
scripts/libmakepkg/tidy/strip.sh.in
scripts/libmakepkg/tidy/zipman.sh.in
-scripts/libmakepkg/util/message.sh
+scripts/libmakepkg/util/message.sh.in
+scripts/libmakepkg/util/parseopts.sh.in
scripts/libmakepkg/util/source.sh.in
scripts/library/output_format.sh
-scripts/library/parseopts.sh
diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in
index 4da2c317..68edbf4b 100644
--- a/scripts/repo-add.sh.in
+++ b/scripts/repo-add.sh.in
@@ -4,7 +4,7 @@
# repo-remove - remove a package entry from a given repo database file
# @configure_input@
#
-# Copyright (c) 2006-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2006-2017 Pacman Development Team <pacman-dev@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
@@ -94,7 +94,7 @@ version() {
cmd=${0##*/}
printf "%s (pacman) %s\n\n" "$cmd" "$myver"
printf -- "$(gettext "\
-Copyright (c) 2006-2016 Pacman Development Team <pacman-dev@archlinux.org>\n\n\
+Copyright (c) 2006-2017 Pacman Development Team <pacman-dev@archlinux.org>\n\n\
This is free software; see the source for copying conditions.\n\
There is NO WARRANTY, to the extent permitted by law.\n")"
}
@@ -151,9 +151,9 @@ db_write_delta() {
echo -e "%DELTAS%" >"$deltas"
fi
# get md5sum and compressed size of package
- md5sum=$(openssl dgst -md5 "$deltafile")
- md5sum=${md5sum##* }
- csize=$(@SIZECMD@ -L "$deltafile")
+ md5sum=$(md5sum "$deltafile")
+ md5sum=${md5sum%% *}
+ csize=$(wc -c "$deltafile" | cut -d' ' -f1)
oldfile=$(xdelta3 printhdr "$deltafile" | grep "XDELTA filename (source)" | sed 's/.*: *//')
newfile=$(xdelta3 printhdr "$deltafile" | grep "XDELTA filename (output)" | sed 's/.*: *//')
@@ -368,23 +368,23 @@ db_write_entry() {
error "$(gettext "Cannot use armored signatures for packages: %s")" "$pkgfile.sig"
return 1
fi
- pgpsigsize=$(@SIZECMD@ -L "$pkgfile.sig")
+ pgpsigsize=$(wc -c "$pkgfile.sig" | cut -d' ' -f1)
if (( pgpsigsize > 16384 )); then
error "$(gettext "Invalid package signature file '%s'.")" "$pkgfile.sig"
return 1
fi
msg2 "$(gettext "Adding package signature...")"
- pgpsig=$(openssl base64 -in "$pkgfile.sig" | tr -d '\n')
+ pgpsig=$(base64 "$pkgfile.sig" | tr -d '\n')
fi
- csize=$(@SIZECMD@ -L "$pkgfile")
+ csize=$(wc -c "$pkgfile" | cut -d' ' -f1)
# compute checksums
msg2 "$(gettext "Computing checksums...")"
- md5sum=$(openssl dgst -md5 "$pkgfile")
- md5sum=${md5sum##* }
- sha256sum=$(openssl dgst -sha256 "$pkgfile")
- sha256sum=${sha256sum##* }
+ md5sum=$(md5sum "$pkgfile")
+ md5sum=${md5sum%% *}
+ sha256sum=$(sha256sum "$pkgfile")
+ sha256sum=${sha256sum%% *}
# remove an existing entry if it exists, ignore failures
db_remove_entry "$pkgname"
@@ -455,7 +455,7 @@ db_write_entry() {
msg2 "$(gettext "Creating '%s' db entry...")" 'files'
local files_path="$tmpdir/files/$pkgname-$pkgver/files"
echo "%FILES%" >"$files_path"
- bsdtar --exclude='^.*' -tf "$pkgfile" >>"$files_path"
+ bsdtar --exclude='^.*' -tf "$pkgfile" | LC_ALL=C sort -u >>"$files_path"
if (( RMEXISTING )); then
msg2 "$(gettext "Removing old package file '%s'")" "$oldfilename"
@@ -501,7 +501,7 @@ elephant() {
"ZL9JFFZeAa0a2+lKjL2anpYfV+0Zx9LJ+/MC8nRayuDlSNy2rfAPibOzsiWHL0jL" \
"SsjFAQAA"
;;
- esac | openssl base64 -d | gzip -d
+ esac | base64 -d | gzip -d
}
prepare_repo_db() {
diff --git a/scripts/makepkg-wrapper.sh.in b/scripts/wrapper.sh.in
index 6e713145..f7595fce 100644
--- a/scripts/makepkg-wrapper.sh.in
+++ b/scripts/wrapper.sh.in
@@ -1,8 +1,8 @@
#!/bin/bash
#
-# makepkg - a wrapper for running the real makepkg in the source tree
+# @PROGNAME@ - a wrapper for running the real @PROGNAME@ in the source tree
#
-# Copyright (c) 2013-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2013-2017 Pacman Development Team <pacman-dev@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
@@ -20,4 +20,4 @@
DIR="@PWD@"
-LIBRARY="$DIR"/libmakepkg exec "$DIR"/.lib/makepkg "$@"
+LIBRARY="$DIR"/libmakepkg exec "$DIR"/.lib/@PROGNAME@ "$@"