[pacman-dev] [PATCH] makepkg: Add EXTRAVERSION field to package filenames

Anders Bergh anders1 at gmail.com
Thu Oct 22 18:18:58 EDT 2009


>From 92f67cdcff4cbec3c5c9d6b0ca17a6f71fdf87b9 Mon Sep 17 00:00:00 2001
From: Anders Bergh <anders1 at gmail.com>
Date: Fri, 23 Oct 2009 00:11:05 +0200
Subject: [PATCH] makepkg: Add EXTRAVERSION field to package filenames.
This is intended
 for packages compiled to run on another operating system than Linux,
 such as cygwin or Darwin. It is set using --with-pkg-extra-version.

The package filename format is as follows:

{name}-{version}-{rel}-{extraversion}{arch}{ext}

Signed-off-by: Anders Bergh <anders1 at gmail.com>
---
 configure.ac          |    6 ++++++
 etc/makepkg.conf.in   |    1 +
 scripts/makepkg.sh.in |   24 ++++++++++++------------
 3 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/configure.ac b/configure.ac
index dada0dd..30c25fb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -88,6 +88,11 @@ AC_ARG_WITH(db-ext,
 	AS_HELP_STRING([--with-db-ext=ext], [set the file extension used by
the database]),
 	[DBEXT=$withval], [DBEXT=.db.tar.gz])

+# Help line for extra version field
+AC_ARG_WITH(pkg-extra-version,
+	AS_HELP_STRING([--with-pkg-extra-version=ver], [add extra version
field to package filenames]),
+	[EXTRAVERSION=$withval], [EXTRAVERSION=])
+
 # Help line for buildscript filename
 AC_ARG_WITH(buildscript,
 	AS_HELP_STRING([--with-buildscript=name], [set the build script name
used by makepkg]),
@@ -378,6 +383,7 @@ ${PACKAGE_NAME}:
     source pkg extension   : ${SRCEXT}
     database extension     : ${DBEXT}
     build script name      : ${BUILDSCRIPT}
+    extra version          : ${EXTRAVERSION}

   Compilation options:
     Run make in doc/ dir   : ${wantdoc}
diff --git a/etc/makepkg.conf.in b/etc/makepkg.conf.in
index 3a3a415..a16f71e 100644
--- a/etc/makepkg.conf.in
+++ b/etc/makepkg.conf.in
@@ -103,5 +103,6 @@ PURGE_TARGETS=(usr/{,share}/info/dir .packlist *.pod)
 #
 PKGEXT='@PKGEXT@'
 SRCEXT='@SRCEXT@'
+EXTRAVERSION='@EXTRAVERSION@'

 # vim: set ft=sh ts=2 sw=2 et:
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 40367ae..219d59e 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -158,12 +158,12 @@ clean_up() {
 		rm -rf "$pkgdir" "$srcdir"
 		if [ -n "$pkgname" ]; then
 			# Can't do this unless the BUILDSCRIPT has been sourced.
-			rm -f "${pkgbase}-${pkgver}-${pkgrel}-${CARCH}-build.log"*
+			rm -f "${pkgbase}-${pkgver}-${pkgrel}-${EXTRAVERSION}${CARCH}-build.log"*
 			if [ "$PKGFUNC" -eq 1 ]; then
-				rm -f "${pkgbase}-${pkgver}-${pkgrel}-${CARCH}-package.log"*
+				rm -f "${pkgbase}-${pkgver}-${pkgrel}-${EXTRAVERSION}${CARCH}-package.log"*
 			elif [ "$SPLITPKG" -eq 1 ]; then
 				for pkg in ${pkgname[@]}; do
-					rm -f "${pkg}-${pkgver}-${pkgrel}-${CARCH}-package.log"*
+					rm -f "${pkg}-${pkgver}-${pkgrel}-${EXTRAVERSION}${CARCH}-package.log"*
 				done
 			fi
 		fi
@@ -730,7 +730,7 @@ run_function() {

 	local ret=0
 	if [ "$LOGGING" -eq 1 ]; then
-		BUILDLOG="${startdir}/${pkgname}-${pkgver}-${pkgrel}-${CARCH}-$pkgfunc.log"
+		BUILDLOG="${startdir}/${pkgname}-${pkgver}-${pkgrel}-${EXTRAVERSION}${CARCH}-$pkgfunc.log"
 		if [ -f "$BUILDLOG" ]; then
 			local i=1
 			while true; do
@@ -1015,7 +1015,7 @@ create_package() {
 		*) warning "$(gettext "'%s' is not a valid archive extension.")" \
 		"$PKGEXT" ; EXT=$PKGEXT ;;
 	esac
-	local pkg_file="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${EXT}"
+	local pkg_file="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${EXTRAVERSION}${PKGARCH}${EXT}"

 	local ret=0

@@ -1121,10 +1121,10 @@ install_package() {

 	local pkglist
 	for pkg in ${pkgname[@]}; do
-		if [ -f $PKGDEST/${pkg}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT} ]; then
-			pkglist="${pkglist} $PKGDEST/${pkg}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}"
+		if [ -f $PKGDEST/${pkg}-${pkgver}-${pkgrel}-${EXTRAVERSION}${CARCH}${PKGEXT}
]; then
+			pkglist="${pkglist}
$PKGDEST/${pkg}-${pkgver}-${pkgrel}-${EXTRAVERSION}${CARCH}${PKGEXT}"
 		else
-			pkglist="${pkglist} $PKGDEST/${pkg}-${pkgver}-${pkgrel}-any${PKGEXT}"
+			pkglist="${pkglist}
$PKGDEST/${pkg}-${pkgver}-${pkgrel}-${EXTRAVERSION}any${PKGEXT}"
 		fi
 	done

@@ -1721,8 +1721,8 @@ fi
 pkgbase=${pkgbase:-${pkgname[0]}}

 if [ "$SPLITPKG" -eq 0 ]; then
-	if [ \( -f "$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}" \
-	     -o -f "$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-any${PKGEXT}" \) \
+	if [ \( -f "$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${EXTRAVERSION}${CARCH}${PKGEXT}"
\
+	     -o -f "$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${EXTRAVERSION}any${PKGEXT}"
\) \
 			 -a "$FORCE" -eq 0 -a "$SOURCEONLY" -eq 0 -a "$NOBUILD" -eq 0 ]; then
 		if [ "$INSTALL" -eq 1 ]; then
 			warning "$(gettext "A package has already been built, installing
existing package...")"
@@ -1737,8 +1737,8 @@ else
 	allpkgbuilt=1
 	somepkgbuilt=0
 	for pkg in ${pkgname[@]}; do
-		if [ \( -f "$PKGDEST/${pkg}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}" \
-		     -o -f "$PKGDEST/${pkg}-${pkgver}-${pkgrel}-any${PKGEXT}" \) ]; then
+		if [ \( -f "$PKGDEST/${pkg}-${pkgver}-${pkgrel}-${EXTRAVERSION}${CARCH}${PKGEXT}"
\
+		     -o -f "$PKGDEST/${pkg}-${pkgver}-${pkgrel}-${EXTRAVERSION}any${PKGEXT}"
\) ]; then
 			somepkgbuilt=1
 		else
 			allpkgbuilt=0
-- 
1.6.5.1


More information about the pacman-dev mailing list