[pacman-dev] [PATCH] Add liba option in PKGBUILD
This option (enabled by default) removes static library files in packages. Related to the thread: https://mailman.archlinux.org/pipermail/arch-dev-public/2013-March/024552.ht... Signed-off-by: Sébastien Luttringer <seblu@seblu.net> --- doc/PKGBUILD.5.txt | 4 ++++ doc/makepkg.conf.5.txt | 6 +++++- etc/makepkg.conf.in | 3 ++- scripts/makepkg.sh.in | 9 +++++++-- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/doc/PKGBUILD.5.txt b/doc/PKGBUILD.5.txt index c37477a..1e64b8f 100644 --- a/doc/PKGBUILD.5.txt +++ b/doc/PKGBUILD.5.txt @@ -243,6 +243,10 @@ A normal sync or upgrade will not use its value. Leave libtool (.la) files in packages. Specify `!libtool` to remove them. + *liba*;; + Leave static library (.a) files in packages. Specify `!liba` to + remove them. + *emptydirs*;; Leave empty directories in packages. diff --git a/doc/makepkg.conf.5.txt b/doc/makepkg.conf.5.txt index 71cfc5d..94f2a0c 100644 --- a/doc/makepkg.conf.5.txt +++ b/doc/makepkg.conf.5.txt @@ -138,7 +138,7 @@ Options Specify a key to use for gpg signing instead of the default key in the keyring. Can be overridden with makepkg's '\--key' option. -**OPTIONS=(**strip docs libtool emptydirs zipman purge !upx**)**:: +**OPTIONS=(**strip docs libtool !liba emptydirs zipman purge !upx**)**:: This array contains options that affect the default packaging. They are equivalent to options that can be placed in the PKGBUILD; the defaults are shown here. All options should always be left in the array; to enable or @@ -160,6 +160,10 @@ Options Leave libtool (.la) files in packages. Specify `!libtool` to remove them. + *liba*;; + Leave static library (.a) files in packages. Specify `!liba` to remove + them. + *emptydirs*;; Leave empty directories in packages. diff --git a/etc/makepkg.conf.in b/etc/makepkg.conf.in index 1436042..8af8e3f 100644 --- a/etc/makepkg.conf.in +++ b/etc/makepkg.conf.in @@ -71,13 +71,14 @@ BUILDENV=(fakeroot !distcc color !ccache check !sign) #-- strip: Strip symbols from binaries/libraries #-- docs: Save doc directories specified by DOC_DIRS #-- libtool: Leave libtool (.la) files in packages +#-- liba: Leave static library (.a) files in packages #-- emptydirs: Leave empty directories in packages #-- zipman: Compress manual (man and info) pages in MAN_DIRS with gzip #-- purge: Remove files specified by PURGE_TARGETS #-- upx: Compress binary executable files using UPX #-- debug: Add debugging flags as specified in DEBUG_* variables # -OPTIONS=(strip docs libtool emptydirs zipman purge !upx !debug) +OPTIONS=(strip docs libtool !liba emptydirs zipman purge !upx !debug) #-- File integrity checks to use. Valid: md5, sha1, sha256, sha384, sha512 INTEGRITY_CHECK=(md5) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index bd29d73..274739c 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -44,8 +44,8 @@ declare -r confdir='@sysconfdir@' declare -r BUILDSCRIPT='@BUILDSCRIPT@' declare -r startdir="$PWD" -packaging_options=('strip' 'docs' 'libtool' 'emptydirs' 'zipman' 'purge' 'upx' \ - 'debug') +packaging_options=('strip' 'docs' 'libtool' 'liba' 'emptydirs' 'zipman' \ + 'purge' 'upx' 'debug') other_options=('ccache' 'distcc' 'buildflags' 'makeflags') splitpkg_overrides=('pkgver' 'pkgrel' 'epoch' 'pkgdesc' 'arch' 'url' 'license' \ 'groups' 'depends' 'optdepends' 'provides' 'conflicts' \ @@ -1503,6 +1503,11 @@ tidy_install() { find . ! -type d -name "*.la" -exec rm -f -- '{}' \; fi + if check_option "liba" "n"; then + msg2 "$(gettext "Removing "%s" files...")" "static libraries" + find . ! -type d -name "*.a" -exec rm -f -- '{}' \; + fi + if check_option "emptydirs" "n"; then msg2 "$(gettext "Removing empty directories...")" find . -depth -type d -exec rmdir '{}' + 2>/dev/null -- 1.8.1.5
On 04/03/13 12:01, Sébastien Luttringer wrote:
This option (enabled by default) removes static library files in packages.
Related to the thread: https://mailman.archlinux.org/pipermail/arch-dev-public/2013-March/024552.ht...
Signed-off-by: Sébastien Luttringer <seblu@seblu.net> ---
You think given I was the one who suggested to use PURGE_TARGETS for this, that you might of thought have thought twice about doing this being the way to implement it... So provide an explanation why this is better. libtool option is not an answer because we could merge that into PURGE too...
doc/PKGBUILD.5.txt | 4 ++++ doc/makepkg.conf.5.txt | 6 +++++- etc/makepkg.conf.in | 3 ++- scripts/makepkg.sh.in | 9 +++++++-- 4 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/doc/PKGBUILD.5.txt b/doc/PKGBUILD.5.txt index c37477a..1e64b8f 100644 --- a/doc/PKGBUILD.5.txt +++ b/doc/PKGBUILD.5.txt @@ -243,6 +243,10 @@ A normal sync or upgrade will not use its value. Leave libtool (.la) files in packages. Specify `!libtool` to remove them.
+ *liba*;; + Leave static library (.a) files in packages. Specify `!liba` to + remove them. + *emptydirs*;; Leave empty directories in packages.
diff --git a/doc/makepkg.conf.5.txt b/doc/makepkg.conf.5.txt index 71cfc5d..94f2a0c 100644 --- a/doc/makepkg.conf.5.txt +++ b/doc/makepkg.conf.5.txt @@ -138,7 +138,7 @@ Options Specify a key to use for gpg signing instead of the default key in the keyring. Can be overridden with makepkg's '\--key' option.
-**OPTIONS=(**strip docs libtool emptydirs zipman purge !upx**)**:: +**OPTIONS=(**strip docs libtool !liba emptydirs zipman purge !upx**)**:: This array contains options that affect the default packaging. They are equivalent to options that can be placed in the PKGBUILD; the defaults are shown here. All options should always be left in the array; to enable or @@ -160,6 +160,10 @@ Options Leave libtool (.la) files in packages. Specify `!libtool` to remove them.
+ *liba*;; + Leave static library (.a) files in packages. Specify `!liba` to remove + them. + *emptydirs*;; Leave empty directories in packages.
diff --git a/etc/makepkg.conf.in b/etc/makepkg.conf.in index 1436042..8af8e3f 100644 --- a/etc/makepkg.conf.in +++ b/etc/makepkg.conf.in @@ -71,13 +71,14 @@ BUILDENV=(fakeroot !distcc color !ccache check !sign) #-- strip: Strip symbols from binaries/libraries #-- docs: Save doc directories specified by DOC_DIRS #-- libtool: Leave libtool (.la) files in packages +#-- liba: Leave static library (.a) files in packages #-- emptydirs: Leave empty directories in packages #-- zipman: Compress manual (man and info) pages in MAN_DIRS with gzip #-- purge: Remove files specified by PURGE_TARGETS #-- upx: Compress binary executable files using UPX #-- debug: Add debugging flags as specified in DEBUG_* variables # -OPTIONS=(strip docs libtool emptydirs zipman purge !upx !debug) +OPTIONS=(strip docs libtool !liba emptydirs zipman purge !upx !debug)
#-- File integrity checks to use. Valid: md5, sha1, sha256, sha384, sha512 INTEGRITY_CHECK=(md5) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index bd29d73..274739c 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -44,8 +44,8 @@ declare -r confdir='@sysconfdir@' declare -r BUILDSCRIPT='@BUILDSCRIPT@' declare -r startdir="$PWD"
-packaging_options=('strip' 'docs' 'libtool' 'emptydirs' 'zipman' 'purge' 'upx' \ - 'debug') +packaging_options=('strip' 'docs' 'libtool' 'liba' 'emptydirs' 'zipman' \ + 'purge' 'upx' 'debug') other_options=('ccache' 'distcc' 'buildflags' 'makeflags') splitpkg_overrides=('pkgver' 'pkgrel' 'epoch' 'pkgdesc' 'arch' 'url' 'license' \ 'groups' 'depends' 'optdepends' 'provides' 'conflicts' \ @@ -1503,6 +1503,11 @@ tidy_install() { find . ! -type d -name "*.la" -exec rm -f -- '{}' \; fi
+ if check_option "liba" "n"; then + msg2 "$(gettext "Removing "%s" files...")" "static libraries" + find . ! -type d -name "*.a" -exec rm -f -- '{}' \; + fi + if check_option "emptydirs" "n"; then msg2 "$(gettext "Removing empty directories...")" find . -depth -type d -exec rmdir '{}' + 2>/dev/null
On Mon, Mar 4, 2013 at 8:39 AM, Allan McRae <allan@archlinux.org> wrote:
On 04/03/13 12:01, Sébastien Luttringer wrote:
This option (enabled by default) removes static library files in packages.
Related to the thread: https://mailman.archlinux.org/pipermail/arch-dev-public/2013-March/024552.ht...
Signed-off-by: Sébastien Luttringer <seblu@seblu.net> ---
You think given I was the one who suggested to use PURGE_TARGETS for this, that you might of thought have thought twice about doing this being the way to implement it... I thought you suggest PURGE_TARGETS as a way to find a quick solution, saving you time to add a new option.
So provide an explanation why this is better. libtool option is not an answer because we could merge that into PURGE too... Having all the unwanted stuff removed in the purge option, avoid duplication of the same code and make removal of future others files a regex addition. Merge libtool into purge was my alternative patch option but looking at the number of PKGBUILD using the option, I thougth it was a lighter path to keep it and provide it counterpart for *.a files to stay coherent. .$ grep -lri '!libtool' /var/abs|wc -l 1354 As libtool is not an answer, this patch is in the bad way.
Cheers, -- Sébastien "Seblu" Luttringer https://www.seblu.net GPG: 0x2072D77A
On 04/03/13 20:03, Sébastien Luttringer wrote:
On Mon, Mar 4, 2013 at 8:39 AM, Allan McRae <allan@archlinux.org> wrote:
On 04/03/13 12:01, Sébastien Luttringer wrote:
This option (enabled by default) removes static library files in packages.
Related to the thread: https://mailman.archlinux.org/pipermail/arch-dev-public/2013-March/024552.ht...
Signed-off-by: Sébastien Luttringer <seblu@seblu.net> ---
You think given I was the one who suggested to use PURGE_TARGETS for this, that you might of thought have thought twice about doing this being the way to implement it... I thought you suggest PURGE_TARGETS as a way to find a quick solution, saving you time to add a new option.
So provide an explanation why this is better. libtool option is not an answer because we could merge that into PURGE too... Having all the unwanted stuff removed in the purge option, avoid duplication of the same code and make removal of future others files a regex addition. Merge libtool into purge was my alternative patch option but looking at the number of PKGBUILD using the option, I thougth it was a lighter path to keep it and provide it counterpart for *.a files to stay coherent. .$ grep -lri '!libtool' /var/abs|wc -l 1354 As libtool is not an answer, this patch is in the bad way.
The correct answer is that this will need frequently disabled. So purge is really not a solution. I just wanted to see what the though process was here... I will provide a proper review of your patch now. Allan
On 04/03/13 12:01, Sébastien Luttringer wrote:
This option (enabled by default) removes static library files in packages.
Related to the thread: https://mailman.archlinux.org/pipermail/arch-dev-public/2013-March/024552.ht...
Signed-off-by: Sébastien Luttringer <seblu@seblu.net> --- doc/PKGBUILD.5.txt | 4 ++++ doc/makepkg.conf.5.txt | 6 +++++- etc/makepkg.conf.in | 3 ++- scripts/makepkg.sh.in | 9 +++++++-- 4 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/doc/PKGBUILD.5.txt b/doc/PKGBUILD.5.txt index c37477a..1e64b8f 100644 --- a/doc/PKGBUILD.5.txt +++ b/doc/PKGBUILD.5.txt @@ -243,6 +243,10 @@ A normal sync or upgrade will not use its value. Leave libtool (.la) files in packages. Specify `!libtool` to remove them.
+ *liba*;;
Call the option "staticlibs". That is more descriptive.
+ Leave static library (.a) files in packages. Specify `!liba` to + remove them. + *emptydirs*;; Leave empty directories in packages.
diff --git a/doc/makepkg.conf.5.txt b/doc/makepkg.conf.5.txt index 71cfc5d..94f2a0c 100644 --- a/doc/makepkg.conf.5.txt +++ b/doc/makepkg.conf.5.txt @@ -138,7 +138,7 @@ Options Specify a key to use for gpg signing instead of the default key in the keyring. Can be overridden with makepkg's '\--key' option.
-**OPTIONS=(**strip docs libtool emptydirs zipman purge !upx**)**:: +**OPTIONS=(**strip docs libtool !liba emptydirs zipman purge !upx**)**::
staticlib should be the default. Removing using !staticlibs should be at the packagers discretion.
This array contains options that affect the default packaging. They are equivalent to options that can be placed in the PKGBUILD; the defaults are shown here. All options should always be left in the array; to enable or @@ -160,6 +160,10 @@ Options Leave libtool (.la) files in packages. Specify `!libtool` to remove them.
+ *liba*;; + Leave static library (.a) files in packages. Specify `!liba` to remove + them. + *emptydirs*;; Leave empty directories in packages.
diff --git a/etc/makepkg.conf.in b/etc/makepkg.conf.in index 1436042..8af8e3f 100644 --- a/etc/makepkg.conf.in +++ b/etc/makepkg.conf.in @@ -71,13 +71,14 @@ BUILDENV=(fakeroot !distcc color !ccache check !sign) #-- strip: Strip symbols from binaries/libraries #-- docs: Save doc directories specified by DOC_DIRS #-- libtool: Leave libtool (.la) files in packages +#-- liba: Leave static library (.a) files in packages #-- emptydirs: Leave empty directories in packages #-- zipman: Compress manual (man and info) pages in MAN_DIRS with gzip #-- purge: Remove files specified by PURGE_TARGETS #-- upx: Compress binary executable files using UPX #-- debug: Add debugging flags as specified in DEBUG_* variables # -OPTIONS=(strip docs libtool emptydirs zipman purge !upx !debug) +OPTIONS=(strip docs libtool !liba emptydirs zipman purge !upx !debug)
#-- File integrity checks to use. Valid: md5, sha1, sha256, sha384, sha512 INTEGRITY_CHECK=(md5) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index bd29d73..274739c 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -44,8 +44,8 @@ declare -r confdir='@sysconfdir@' declare -r BUILDSCRIPT='@BUILDSCRIPT@' declare -r startdir="$PWD"
-packaging_options=('strip' 'docs' 'libtool' 'emptydirs' 'zipman' 'purge' 'upx' \ - 'debug') +packaging_options=('strip' 'docs' 'libtool' 'liba' 'emptydirs' 'zipman' \ + 'purge' 'upx' 'debug') other_options=('ccache' 'distcc' 'buildflags' 'makeflags') splitpkg_overrides=('pkgver' 'pkgrel' 'epoch' 'pkgdesc' 'arch' 'url' 'license' \ 'groups' 'depends' 'optdepends' 'provides' 'conflicts' \ @@ -1503,6 +1503,11 @@ tidy_install() { find . ! -type d -name "*.la" -exec rm -f -- '{}' \; fi
+ if check_option "liba" "n"; then + msg2 "$(gettext "Removing "%s" files...")" "static libraries"
I think that string can be translated. Also it should be "Removing static library files".
+ find . ! -type d -name "*.a" -exec rm -f -- '{}' \; + fi + if check_option "emptydirs" "n"; then msg2 "$(gettext "Removing empty directories...")" find . -depth -type d -exec rmdir '{}' + 2>/dev/null
On Mon, Mar 04, 2013 at 03:01:06AM +0100, Sébastien Luttringer wrote:
This option (enabled by default) removes static library files in packages.
Related to the thread: https://mailman.archlinux.org/pipermail/arch-dev-public/2013-March/024552.ht...
Signed-off-by: Sébastien Luttringer <seblu@seblu.net> --- doc/PKGBUILD.5.txt | 4 ++++ doc/makepkg.conf.5.txt | 6 +++++- etc/makepkg.conf.in | 3 ++- scripts/makepkg.sh.in | 9 +++++++-- 4 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/doc/PKGBUILD.5.txt b/doc/PKGBUILD.5.txt index c37477a..1e64b8f 100644 --- a/doc/PKGBUILD.5.txt +++ b/doc/PKGBUILD.5.txt @@ -243,6 +243,10 @@ A normal sync or upgrade will not use its value. Leave libtool (.la) files in packages. Specify `!libtool` to remove them.
+ *liba*;; + Leave static library (.a) files in packages. Specify `!liba` to + remove them. + *emptydirs*;; Leave empty directories in packages.
diff --git a/doc/makepkg.conf.5.txt b/doc/makepkg.conf.5.txt index 71cfc5d..94f2a0c 100644 --- a/doc/makepkg.conf.5.txt +++ b/doc/makepkg.conf.5.txt @@ -138,7 +138,7 @@ Options Specify a key to use for gpg signing instead of the default key in the keyring. Can be overridden with makepkg's '\--key' option.
-**OPTIONS=(**strip docs libtool emptydirs zipman purge !upx**)**:: +**OPTIONS=(**strip docs libtool !liba emptydirs zipman purge !upx**)**:: This array contains options that affect the default packaging. They are equivalent to options that can be placed in the PKGBUILD; the defaults are shown here. All options should always be left in the array; to enable or @@ -160,6 +160,10 @@ Options Leave libtool (.la) files in packages. Specify `!libtool` to remove them.
+ *liba*;; + Leave static library (.a) files in packages. Specify `!liba` to remove + them. + *emptydirs*;; Leave empty directories in packages.
diff --git a/etc/makepkg.conf.in b/etc/makepkg.conf.in index 1436042..8af8e3f 100644 --- a/etc/makepkg.conf.in +++ b/etc/makepkg.conf.in @@ -71,13 +71,14 @@ BUILDENV=(fakeroot !distcc color !ccache check !sign) #-- strip: Strip symbols from binaries/libraries #-- docs: Save doc directories specified by DOC_DIRS #-- libtool: Leave libtool (.la) files in packages +#-- liba: Leave static library (.a) files in packages #-- emptydirs: Leave empty directories in packages #-- zipman: Compress manual (man and info) pages in MAN_DIRS with gzip #-- purge: Remove files specified by PURGE_TARGETS #-- upx: Compress binary executable files using UPX #-- debug: Add debugging flags as specified in DEBUG_* variables # -OPTIONS=(strip docs libtool emptydirs zipman purge !upx !debug) +OPTIONS=(strip docs libtool !liba emptydirs zipman purge !upx !debug)
#-- File integrity checks to use. Valid: md5, sha1, sha256, sha384, sha512 INTEGRITY_CHECK=(md5) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index bd29d73..274739c 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -44,8 +44,8 @@ declare -r confdir='@sysconfdir@' declare -r BUILDSCRIPT='@BUILDSCRIPT@' declare -r startdir="$PWD"
-packaging_options=('strip' 'docs' 'libtool' 'emptydirs' 'zipman' 'purge' 'upx' \ - 'debug') +packaging_options=('strip' 'docs' 'libtool' 'liba' 'emptydirs' 'zipman' \ + 'purge' 'upx' 'debug') other_options=('ccache' 'distcc' 'buildflags' 'makeflags') splitpkg_overrides=('pkgver' 'pkgrel' 'epoch' 'pkgdesc' 'arch' 'url' 'license' \ 'groups' 'depends' 'optdepends' 'provides' 'conflicts' \ @@ -1503,6 +1503,11 @@ tidy_install() { find . ! -type d -name "*.la" -exec rm -f -- '{}' \; fi
+ if check_option "liba" "n"; then + msg2 "$(gettext "Removing "%s" files...")" "static libraries" + find . ! -type d -name "*.a" -exec rm -f -- '{}' \;
I realize you're just copying what's above here, but please don't. You're forking once for every removal, instead of once for everything. This really should be fixed for the libtool option as well.
+ fi + if check_option "emptydirs" "n"; then msg2 "$(gettext "Removing empty directories...")" find . -depth -type d -exec rmdir '{}' + 2>/dev/null -- 1.8.1.5
participants (3)
-
Allan McRae
-
Dave Reisner
-
Sébastien Luttringer