makepkg : fix a lot of breakages caused by Allan

This patch started as a simple typo fix (pugre instead of purge in two
places), as well as a fix of a test which was using PURGE_TARGETS instead of
$PURGE_TARGETS.

It evolved in a slight handling change of the OPTIONS which have a variable
affecting their behavior (strip STRIP_DIRS, docs DOC_DIRS, zipman MAN_DIRS
and purge PURGE_TARGETS), as well as a clarification in makepkg.conf. Now
when a variable is undefined or empty, the corresponding option will have no
effect. It looked weird to have a fallback when a option is defined but
empty, it seems more natural to not have any fallbacks.

Also re-enable docs by default. It seems arbitrary to delete files from
packages by default, and it would be more vanilla and distro agnostic to
keep them. docs was also the only negated option.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Xavier Chantry 2009-01-03 11:19:12 +01:00 committed by Dan McGee
parent 0501d340cd
commit 4ec846f5ac
3 changed files with 18 additions and 27 deletions

View file

@ -128,10 +128,11 @@ Options
Leave empty directories in packages. Leave empty directories in packages.
*zipman*;; *zipman*;;
Compress manual (man and info) pages with gzip. Compress manual (man and info) pages with gzip. The directories
affected are specified by the `MAN_DIRS` variable.
*purge*;; *purge*;;
Remove files specified by the `PUGRE_TARGETS` variable from the Remove files specified by the `PURGE_TARGETS` variable from the
package. package.
**INTEGRITY_CHECK=(**check1 ...**)**:: **INTEGRITY_CHECK=(**check1 ...**)**::

View file

@ -59,27 +59,27 @@ BUILDENV=(fakeroot !distcc color !ccache !xdelta)
# These are default values for the options=() settings # These are default values for the options=() settings
######################################################################### #########################################################################
# #
# Default: OPTIONS=(strip !docs libtool emptydirs zipman purge) # Default: OPTIONS=(strip docs libtool emptydirs zipman purge)
# A negated option will do the opposite of the comments below. # A negated option will do the opposite of the comments below.
# #
#-- strip: Strip symbols from binaries/libraries #-- strip: Strip symbols from binaries/libraries in STRIP_DIRS
#-- docs: Save doc and info directories #-- docs: Save doc directories specified by DOC_DIRS
#-- libtool: Leave libtool (.la) files in packages #-- libtool: Leave libtool (.la) files in packages
#-- emptydirs: Leave empty directories in packages #-- emptydirs: Leave empty directories in packages
#-- zipman: Compress manual (man and info) pages with gzip #-- zipman: Compress manual (man and info) pages in MAN_DIRS with gzip
#-- purge: Remove files sepecified below from package #-- purge: Remove files specified by PURGE_TARGETS
# #
OPTIONS=(strip !docs libtool emptydirs zipman purge) OPTIONS=(strip docs libtool emptydirs zipman purge)
#-- File integrity checks to use. Valid: md5, sha1, sha256, sha384, sha512 #-- File integrity checks to use. Valid: md5, sha1, sha256, sha384, sha512
INTEGRITY_CHECK=(md5) INTEGRITY_CHECK=(md5)
#-- Manual (man and info) directories to compress (if option set correctly above) #-- Manual (man and info) directories to compress (if zipman is specified)
MAN_DIRS=({usr{,/local}{,/share},opt/*}/{man,info}) MAN_DIRS=({usr{,/local}{,/share},opt/*}/{man,info})
#-- Doc directories to remove (if option set correctly above) #-- Doc directories to remove (if !docs is specified)
DOC_DIRS=(usr/{,share/}{doc,gtk-doc} opt/*/{doc,gtk-doc}) DOC_DIRS=(usr/{,share/}{doc,gtk-doc} opt/*/{doc,gtk-doc})
#-- Directories to be searched for the strip option (if option set correctly above) #-- Directories to be searched for the strip option (if strip is specified)
STRIP_DIRS=(bin lib sbin usr/{bin,lib,sbin,local/{bin,lib,sbin}} opt/*/{bin,lib,sbin}) STRIP_DIRS=(bin lib sbin usr/{bin,lib,sbin,local/{bin,lib,sbin}} opt/*/{bin,lib,sbin})
#-- Files to be removed from all packages #-- Files to be removed from all packages (if purge is specified)
PURGE_TARGETS=(usr/{,share}/info/dir .packlist *.pod) PURGE_TARGETS=(usr/{,share}/info/dir .packlist *.pod)
######################################################################### #########################################################################

View file

@ -712,14 +712,13 @@ tidy_install() {
cd "$pkgdir" cd "$pkgdir"
msg "$(gettext "Tidying install...")" msg "$(gettext "Tidying install...")"
if [ "$(check_option docs)" = "n" ]; then if [ "$(check_option docs)" = "n" -a -n "${DOC_DIRS[*]}" ]; then
msg2 "$(gettext "Removing doc files...")" msg2 "$(gettext "Removing doc files...")"
#fix flyspray bug #5021
rm -rf ${DOC_DIRS[@]} rm -rf ${DOC_DIRS[@]}
fi fi
if [ "$(check_option purge)" = "y" -a -n "PURGE_TARGETS" ]; then if [ "$(check_option purge)" = "y" -a -n "${PURGE_TARGETS[*]}" ]; then
msg2 "$(gettext "Removing pugre targets...")" msg2 "$(gettext "Purging other files...")"
local pt local pt
for pt in "${PURGE_TARGETS[@]}"; do for pt in "${PURGE_TARGETS[@]}"; do
if [ "${pt}" == "${pt//\/}" ]; then if [ "${pt}" == "${pt//\/}" ]; then
@ -730,13 +729,9 @@ tidy_install() {
done done
fi fi
if [ "$(check_option zipman)" = "y" ]; then if [ "$(check_option zipman)" = "y" -a -n "${MAN_DIRS[*]}" ]; then
msg2 "$(gettext "Compressing man and info pages...")" msg2 "$(gettext "Compressing man and info pages...")"
local manpage ext file link hardlinks hl local manpage ext file link hardlinks hl
if [ -z "${MAN_DIRS[*]}" ]; then
# fall back to default value
MAN_DIRS=({usr{,/local}{,/share},opt/*}/{man,info})
fi
find ${MAN_DIRS[@]} -type f 2>/dev/null | find ${MAN_DIRS[@]} -type f 2>/dev/null |
while read manpage ; do while read manpage ; do
# check file still exists (potentially compressed with hard link) # check file still exists (potentially compressed with hard link)
@ -769,14 +764,9 @@ tidy_install() {
done done
fi fi
if [ "$(check_option strip)" = "y" ]; then if [ "$(check_option strip)" = "y" -a -n "${STRIP_DIRS[*]}" ]; then
msg2 "$(gettext "Stripping debugging symbols from binaries and libraries...")" msg2 "$(gettext "Stripping debugging symbols from binaries and libraries...")"
local binary local binary
if [ -z "${STRIP_DIRS[*]}" ]; then
# fall back to default value
STRIP_DIRS=(bin lib sbin usr/{bin,lib,sbin,local/{bin,lib,sbin}}
opt/*/{bin,lib,sbin})
fi
find ${STRIP_DIRS[@]} -type f 2>/dev/null | while read binary ; do find ${STRIP_DIRS[@]} -type f 2>/dev/null | while read binary ; do
case "$(file -biz "$binary")" in case "$(file -biz "$binary")" in
*application/x-sharedlib*) # Libraries (.so) *application/x-sharedlib*) # Libraries (.so)