[pacman-dev] [PATCH] makepkg: Add DEBUGDEST for a pkgtype of debug
Fixes FS#48902. This patch piggybacks on makepkg's internal knowledge of the package name to move packages of type "debug" (more on this later) to a user defined directory. The goal is to make moving only debug packages to a debug repo in a reliable manner without using globbing to try and guess if a package is a debug package or not. This concept patch adds a new global variable called "pkgtype" which defines the kind of package it is, currently the only pkgtype is "debug". I've left non-debug pkgtypes to indicate a normal package but it may be potentially expanded with different types of package in future. Currently pkg_file is updated based on the variable and prefers DEBUGDEST if it is defined otherwise falling back on PKGDEST which essentially treats debug packages as normal packages if DEBUGDEST is not configured. Signed-off-by: Earnestly <zibeon@gmail.com> --- doc/makepkg.conf.5.txt | 5 +++++ etc/makepkg.conf.in | 3 +++ scripts/makepkg.sh.in | 8 ++++++++ 3 files changed, 16 insertions(+) diff --git a/doc/makepkg.conf.5.txt b/doc/makepkg.conf.5.txt index 5bd3472..53502d6 100644 --- a/doc/makepkg.conf.5.txt +++ b/doc/makepkg.conf.5.txt @@ -224,6 +224,11 @@ Options like to keep all their packages in one place so this option allows for this behavior. A common location is ``/home/packages''. +**DEBUGDEST**"/path/to/directory":: + If this value is not set, debug packages will by default honor `PKGDEST`. + This allows people to configure a directory where debug packages will be + placed. + **SRCDEST=**"/path/to/directory":: If this value is not set, downloaded source files will only be stored in the current directory. Many people like to keep all source files in diff --git a/etc/makepkg.conf.in b/etc/makepkg.conf.in index efac16a..78220f8 100644 --- a/etc/makepkg.conf.in +++ b/etc/makepkg.conf.in @@ -108,6 +108,9 @@ PURGE_TARGETS=(usr/{,share}/info/dir .packlist *.pod) # #-- Destination: specify a fixed directory where all packages will be placed #PKGDEST=/home/packages +#-- Destination: specify a fixed directory where all debug packages will be +# placed, uses PKGDEST if not set +#DEBUGDEST=/home/packages #-- Source cache: specify a fixed directory where source files will be cached #SRCDEST=/home/sources #-- Source packages: specify a fixed directory where all src packages will be placed diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index f80e37a..4afa4f2 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1106,6 +1106,13 @@ create_package() { done # tar it up + case $pkgtype in + # If the user hasn't configured DEBUGDEST then we need to fall back on + # PKGDEST so the package has somewhere to go. + debug) PKGDEST=${DEBUGDEST:-$PKGDEST} ;; + *) PKGDEST=$PKGDEST ;; + esac + local fullver=$(get_full_version) local pkg_file="$PKGDEST/${pkgname}-${fullver}-${pkgarch}${PKGEXT}" local ret=0 @@ -1174,6 +1181,7 @@ create_debug_package() { fi pkgdir="${pkgdir}-@DEBUGSUFFIX@" + pkgtype=debug # check if we have any debug symbols to package if dir_is_empty "$pkgdir/usr/lib/debug"; then -- 2.8.0
On 14/04/16 00:36, Earnestly via pacman-dev wrote:
Fixes FS#48902.
This patch piggybacks on makepkg's internal knowledge of the package name to move packages of type "debug" (more on this later) to a user defined directory.
The goal is to make moving only debug packages to a debug repo in a reliable manner without using globbing to try and guess if a package is a debug package or not.
This concept patch adds a new global variable called "pkgtype" which defines the kind of package it is, currently the only pkgtype is "debug".
I've left non-debug pkgtypes to indicate a normal package but it may be potentially expanded with different types of package in future.
Currently pkg_file is updated based on the variable and prefers DEBUGDEST if it is defined otherwise falling back on PKGDEST which essentially treats debug packages as normal packages if DEBUGDEST is not configured.
My initial feeling is there is no need for this. There are 0 packages with names ending in "-debug" in Arch Linux and maybe 5 in the AUR. It is also quite quick to extract the list of package file names and match them to debugs variants. This leads me to question what problem this is solving. Unless a strong case can be made for its inclusion, I am inclined to not make this change. Allan
On Mon, Apr 18, 2016 at 02:50:06PM +1000, Allan McRae wrote:
My initial feeling is there is no need for this. There are 0 packages with names ending in "-debug" in Arch Linux and maybe 5 in the AUR. It is also quite quick to extract the list of package file names and match them to debugs variants.
Indeed, as we discussed on IRC there are infact not only no packages ending with -debug, but that the pattern *-debug-* doesn't appear anywhere. It is still not guaranteed to match -debug- packages but it's pretty damn likely.
This leads me to question what problem this is solving. Unless a strong case can be made for its inclusion, I am inclined to not make this change.
Based on the above it might be better to not include this patch. I do still think there is perhaps some merit in using the pkgtype concept, I'm not exactly sure what that merit is yet... YAGNI
participants (2)
-
Allan McRae
-
Earnestly