[pacman-dev] [PATCH] makepkg: enable passing PKGBUILD from pipe
Do not attemp to update pkgver/pkgrel when reading a SCM based PKGBUILD from a pipe. Fixes FS#9187. Signed-off-by: Allan McRae <allan@archlinux.org> --- scripts/makepkg.sh.in | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 52784b6..f5caa12 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1048,6 +1048,10 @@ devel_check() { if [ "$HOLDVER" = "1" ]; then return fi + # Cannot update pkgver/pkgrel if reading PKGBUILD from pipe + if [ ! -f "./$BUILDSCRIPT" ]; then + return + fi if [ "$FORCE_VER" = "" ]; then # Check if this is a svn/cvs/etc PKGBUILD; set $newpkgver if so. # This will only be used on the first call to makepkg; subsequent @@ -1115,9 +1119,11 @@ devel_update() { # if [ "$newpkgver" != "" ]; then if [ "$newpkgver" != "$pkgver" ]; then - sed -i "s/^pkgver=[^ ]*/pkgver=$newpkgver/" ./$BUILDSCRIPT - sed -i "s/^pkgrel=[^ ]*/pkgrel=1/" ./$BUILDSCRIPT - source $BUILDSCRIPT + if [ -f "./$BUILDSCRIPT" ]; then + sed -i "s/^pkgver=[^ ]*/pkgver=$newpkgver/" ./$BUILDSCRIPT + sed -i "s/^pkgrel=[^ ]*/pkgrel=1/" ./$BUILDSCRIPT + source $BUILDSCRIPT + fi fi fi } -- 1.6.0.3
On Tue, Oct 28, 2008 at 7:07 AM, Allan McRae <allan@archlinux.org> wrote:
Do not attemp to update pkgver/pkgrel when reading a SCM based PKGBUILD from a pipe. Fixes FS#9187.
So the patch makes sense, but I'm not quite seeing that it is this easy. dmcgee@galway /tmp/test $ ls dmcgee@galway /tmp/test $ ls ../ PKGBUILD ssh-RWLFkm5100 dmcgee@galway /tmp/test $ makepkg < ../PKGBUILD ==> ERROR: PKGBUILD does not exist. -Dan
Dan McGee wrote:
On Tue, Oct 28, 2008 at 7:07 AM, Allan McRae <allan@archlinux.org> wrote:
Do not attemp to update pkgver/pkgrel when reading a SCM based PKGBUILD from a pipe. Fixes FS#9187.
So the patch makes sense, but I'm not quite seeing that it is this easy.
dmcgee@galway /tmp/test $ ls
dmcgee@galway /tmp/test $ ls ../ PKGBUILD ssh-RWLFkm5100
dmcgee@galway /tmp/test $ makepkg < ../PKGBUILD ==> ERROR: PKGBUILD does not exist.
Well, it gets us part of the way there... "makepkg -p /dev/stdin < ../PKGBUILD" now works which was the example given in the bug report. You can just remove the "Fixes FS#" comment for the time being. Allan
On Tue, Oct 28, 2008 at 10:13 PM, Allan McRae <allan@archlinux.org> wrote:
Dan McGee wrote:
On Tue, Oct 28, 2008 at 7:07 AM, Allan McRae <allan@archlinux.org> wrote:
Do not attemp to update pkgver/pkgrel when reading a SCM based PKGBUILD from a pipe. Fixes FS#9187.
So the patch makes sense, but I'm not quite seeing that it is this easy.
dmcgee@galway /tmp/test $ ls
dmcgee@galway /tmp/test $ ls ../ PKGBUILD ssh-RWLFkm5100
dmcgee@galway /tmp/test $ makepkg < ../PKGBUILD ==> ERROR: PKGBUILD does not exist.
Well, it gets us part of the way there... "makepkg -p /dev/stdin < ../PKGBUILD" now works which was the example given in the bug report. You can just remove the "Fixes FS#" comment for the time being.
Ahh yeah, I forgot about that rather crazy example. The patch is worthwhile anyway, so I will apply it. -Dan
Dan McGee wrote:
On Tue, Oct 28, 2008 at 10:13 PM, Allan McRae <allan@archlinux.org> wrote:
Dan McGee wrote:
On Tue, Oct 28, 2008 at 7:07 AM, Allan McRae <allan@archlinux.org> wrote:
Do not attemp to update pkgver/pkgrel when reading a SCM based PKGBUILD from a pipe. Fixes FS#9187.
So the patch makes sense, but I'm not quite seeing that it is this easy.
dmcgee@galway /tmp/test $ ls
dmcgee@galway /tmp/test $ ls ../ PKGBUILD ssh-RWLFkm5100
dmcgee@galway /tmp/test $ makepkg < ../PKGBUILD ==> ERROR: PKGBUILD does not exist.
Well, it gets us part of the way there... "makepkg -p /dev/stdin < ../PKGBUILD" now works which was the example given in the bug report. You can just remove the "Fixes FS#" comment for the time being.
Ahh yeah, I forgot about that rather crazy example. The patch is worthwhile anyway, so I will apply it.
Adding this fixes reading from a pipe properly... if [ ! -f "$BUILDSCRIPT" ]; then - error "$(gettext "%s does not exist.")" "$BUILDSCRIPT" - exit 1 + if [ -t 0 ]; then + error "$(gettext "%s does not exist.")" "$BUILDSCRIPT" + exit 1 + else + # PKGBUILD passed through a pipe + BUILDSCRIPT=/dev/stdin + fi fi Do you want an altered version of the previous patch or a new patch? Allan
On Tue, Oct 28, 2008 at 11:13 PM, Allan McRae <allan@archlinux.org> wrote:
Adding this fixes reading from a pipe properly...
if [ ! -f "$BUILDSCRIPT" ]; then - error "$(gettext "%s does not exist.")" "$BUILDSCRIPT" - exit 1 + if [ -t 0 ]; then + error "$(gettext "%s does not exist.")" "$BUILDSCRIPT" + exit 1 + else + # PKGBUILD passed through a pipe + BUILDSCRIPT=/dev/stdin + fi fi
Do you want an altered version of the previous patch or a new patch?
Let's go with another patch, I have the original on my local master branch already: http://code.toofishes.net/gitweb.cgi?p=pacman.git;a=commitdiff;h=8d33dcb81c4... -Dan
participants (2)
-
Allan McRae
-
Dan McGee