[pacman-dev] [PATCH] Mac OS X [1] Full path of stat (SIZECMD) and [2] sed -i

Kevin Barry barryk at gmail.com
Sun Feb 15 18:18:07 EST 2009


Change configure.ac to use the full path of stat when on darwin/mac.
This is needed for situations when a user installs the GNU/coreutils
and places it in their path before /usr/bin, but the SIZECMD is
already configured for Darwin's version of stat.

Signed-off-by: Kevin Barry <barryk gmail com>
---
 configure.ac |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/configure.ac b/configure.ac
index 2e7f433..216cf76 100644
--- a/configure.ac
+++ b/configure.ac
@@ -190,7 +190,7 @@ case "${host_os}" in
 		;;
 	darwin*)
 		host_os_darwin=yes
-		SIZECMD="stat -f %z"
+		SIZECMD="/usr/bin/stat -f %z"
 		;;
 esac

-- 
1.6.1.2


Patch Number Two

This patch changes the way that sed inplace is run in makepkg when
running in versionpkg mode. Previous, sed would run with no backup
file, called in the GNU way. It seems there is no cross platform
method of calling sed inplace with no backup (BSD/sed uses sed -i '',
GNU/sed uses sed -i'' or simply sed -i).

Instead, this patch creates a backup file (.pkgsave) and removes it
after the succesful completion of the sed operation. This means the
user should not see the backup file, unless something went run (full
hard drive?) in which case they don't lose the PKGBUILD as they would
have before.

Signed-off-by: Kevin Barry <barryk gmail com>
---
 scripts/makepkg.sh.in |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index e10c345..8ddf88f 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1199,8 +1199,9 @@ devel_update() {
 	if [ -n "$newpkgver" ]; then
 		if [ "$newpkgver" != "$pkgver" ]; then
 			if [ -f "./$BUILDSCRIPT" ]; then
-				sed -i "s/^pkgver=[^ ]*/pkgver=$newpkgver/" "./$BUILDSCRIPT"
-				sed -i "s/^pkgrel=[^ ]*/pkgrel=1/" "./$BUILDSCRIPT"
+				sed -i.pkgsave -e "s/^pkgver=[^ ]*/pkgver=$newpkgver/" \
+						   -e "s/^pkgrel=[^ ]*/pkgrel=1/" "./$BUILDSCRIPT" &&
+					rm -f "./${BUILDSCRIPT}.pkgsave"
 				source "$BUILDSCRIPT"
 			fi
 		fi
-- 
1.6.1.2


More information about the pacman-dev mailing list