[pacman-dev] [PATCH] makepkg: Add DEBUGDEST for a pkgtype of debug

Earnestly zibeon at googlemail.com
Wed Apr 13 14:36:50 UTC 2016


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 at 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}- at DEBUGSUFFIX@"
+	pkgtype=debug
 
 	# check if we have any debug symbols to package
 	if dir_is_empty "$pkgdir/usr/lib/debug"; then
-- 
2.8.0


More information about the pacman-dev mailing list