summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2008-12-07 21:14:32 +1000
committerDan McGee <dan@archlinux.org>2009-01-03 00:11:51 -0600
commit9a7f68317aa652cbc89e7fa69381d6239a63a6e7 (patch)
tree2d4d2173521e0ea0af71e6b63a14a0512aa56054
parent774c252753c3c1717684bea234a497941aa864d7 (diff)
makepkg: Introduce purge option
The purge option, combined with the PURGE_TARGETS variable, allows makepkg to automatically remove commonly confliting or removed files (e.g. /usr/share/info/dir, *.pod). Original work: Tim Yang Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--doc/makepkg.conf.5.txt9
-rw-r--r--etc/makepkg.conf.in7
-rw-r--r--scripts/makepkg.sh.in15
3 files changed, 27 insertions, 4 deletions
diff --git a/doc/makepkg.conf.5.txt b/doc/makepkg.conf.5.txt
index 18dbf350..8b3665b0 100644
--- a/doc/makepkg.conf.5.txt
+++ b/doc/makepkg.conf.5.txt
@@ -125,6 +125,10 @@ Options
*zipman*;;
Compress manual (man and info) pages with gzip.
+ *purge*;;
+ Remove files specified by the `PUGRE_TARGETS` variable from the
+ package.
+
**INTEGRITY_CHECK=(**check1 ...**)**::
File integrity checks to use. Multiple checks may be specified; this
affects both generation and checking. The current valid options are:
@@ -150,6 +154,11 @@ Options
to this array. *NOTE:* Do not add the leading slash to the directory
name.
+**PURGE_TARGETS=(**usr/{,share}/info/dir .podlist *.pod...**)**::
+ If "purge" is specified in the OPTIONS array, this variable will
+ instruct makepkg which files to remove from the package. This is
+ useful for index files that are added by multiple packages.
+
**PKGDEST=**"/path/to/folder"::
If this value is not set, packages will by default be placed in the
current directory (location of the linkman:PKGBUILD[5]). Many people
diff --git a/etc/makepkg.conf.in b/etc/makepkg.conf.in
index 82722bef..87b115c2 100644
--- a/etc/makepkg.conf.in
+++ b/etc/makepkg.conf.in
@@ -58,7 +58,7 @@ BUILDENV=(fakeroot !distcc color !ccache !xdelta)
# These are default values for the options=() settings
#########################################################################
#
-# Default: OPTIONS=(strip !docs libtool emptydirs zipman)
+# Default: OPTIONS=(strip !docs libtool emptydirs zipman purge)
# A negated option will do the opposite of the comments below.
#
#-- strip: Strip symbols from binaries/libraries
@@ -66,8 +66,9 @@ BUILDENV=(fakeroot !distcc color !ccache !xdelta)
#-- libtool: Leave libtool (.la) files in packages
#-- emptydirs: Leave empty directories in packages
#-- zipman: Compress manual (man and info) pages with gzip
+#-- purge: Remove files sepecified below from package
#
-OPTIONS=(strip !docs libtool emptydirs zipman)
+OPTIONS=(strip !docs libtool emptydirs zipman purge)
#-- File integrity checks to use. Valid: md5, sha1, sha256, sha384, sha512
INTEGRITY_CHECK=(md5)
@@ -77,6 +78,8 @@ MAN_DIRS=({usr{,/local}{,/share},opt/*}/{man,info})
DOC_DIRS=(usr/{,share/}{doc,gtk-doc} opt/*/{doc,gtk-doc})
#-- Directories to be searched for the strip option (if option set correctly above)
STRIP_DIRS=(bin lib sbin usr/{bin,lib,sbin,local/{bin,lib,sbin}} opt/*/{bin,lib,sbin})
+#-- Files to be removed from all packages
+PURGE_TARGETS=(usr/{,share}/info/dir .packlist *.pod)
#########################################################################
# PACKAGE OUTPUT
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index ef72dc25..66c68a54 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -41,7 +41,7 @@ confdir='@sysconfdir@'
startdir="$PWD"
srcdir="$startdir/src"
pkgdir="$startdir/pkg"
-packaging_options=('strip' 'docs' 'libtool' 'emptydirs' 'zipman')
+packaging_options=('strip' 'docs' 'libtool' 'emptydirs' 'zipman' 'purge')
other_options=('ccache' 'distcc' 'makeflags' 'force')
readonly -a packaging_options other_options
@@ -717,6 +717,18 @@ tidy_install() {
rm -rf ${DOC_DIRS[@]}
fi
+ if [ "$(check_option purge)" = "y" -a -n "PURGE_TARGETS" ]; then
+ msg2 "$(gettext "Removing pugre targets...")"
+ local pt
+ for pt in "${PURGE_TARGETS[@]}"; do
+ if [ "${pt}" == "${pt//\/}" ]; then
+ find . -type f -name "${pt}" -exec rm -f -- '{}' \;
+ else
+ rm -f ${pt}
+ fi
+ done
+ fi
+
if [ "$(check_option zipman)" = "y" ]; then
msg2 "$(gettext "Compressing man and info pages...")"
local manpage ext file link hardlinks hl
@@ -756,7 +768,6 @@ tidy_install() {
done
fi
-
if [ "$(check_option strip)" = "y" ]; then
msg2 "$(gettext "Stripping debugging symbols from binaries and libraries...")"
local binary