[pacman-dev] [PATCH 1/2] Quote sources in PKGBUILD prototypes and example PKGBUILD
From: "Jason St. John" <jstjohn@purdue.edu> Signed-off-by: Jason St. John <jstjohn@purdue.edu> --- Resubmission containing Allan's requested change to PKGBUILD-example.txt doc/PKGBUILD-example.txt | 2 +- proto/PKGBUILD-split.proto | 4 ++-- proto/PKGBUILD.proto | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/PKGBUILD-example.txt b/doc/PKGBUILD-example.txt index 9ab5dff..00dd8b1 100644 --- a/doc/PKGBUILD-example.txt +++ b/doc/PKGBUILD-example.txt @@ -9,7 +9,7 @@ url="https://www.gnu.org/software/patch/patch.html" license=('GPL') groups=('base-devel') depends=('glibc' 'ed') -source=(ftp://ftp.gnu.org/gnu/$pkgname/$pkgname-$pkgver.tar.gz) +source=("ftp://ftp.gnu.org/gnu/$pkgname/$pkgname-$pkgver.tar.gz") md5sums=('ee5ae84d115f051d87fcaaef3b4ae782') build() { diff --git a/proto/PKGBUILD-split.proto b/proto/PKGBUILD-split.proto index 672e7df..54e5557 100644 --- a/proto/PKGBUILD-split.proto +++ b/proto/PKGBUILD-split.proto @@ -24,8 +24,8 @@ backup=() options=() install= changelog= -source=($pkgbase-$pkgver.tar.gz - $pkgname-$pkgver.patch) +source=("$pkgbase-$pkgver.tar.gz" + "$pkgname-$pkgver.patch") noextract=() md5sums=() #generate with 'makepkg -g' diff --git a/proto/PKGBUILD.proto b/proto/PKGBUILD.proto index d4c01b8..5b854ce 100644 --- a/proto/PKGBUILD.proto +++ b/proto/PKGBUILD.proto @@ -24,8 +24,8 @@ backup=() options=() install= changelog= -source=($pkgname-$pkgver.tar.gz - $pkgname-$pkgver.patch) +source=("$pkgname-$pkgver.tar.gz" + "$pkgname-$pkgver.patch") noextract=() md5sums=() #generate with 'makepkg -g' -- 1.8.3
From: "Jason St. John" <jstjohn@purdue.edu> Update doc/PKGBUILD-example.txt with several changes from the official Arch Linux package for patch-2.7.1-2, including other changes shown below: -- moves the patch command into its own prepare() function -- replaces spaces with tabs in functions -- adds check() function -- added "-k" switch in check() function -- replaces 'make prefix=' with 'make DESTDIR=' -- improves quoting of the "cd" command in functions Signed-off-by: Jason St. John <jstjohn@purdue.edu> --- doc/PKGBUILD-example.txt | 40 ++++++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/doc/PKGBUILD-example.txt b/doc/PKGBUILD-example.txt index 00dd8b1..f2eb8c9 100644 --- a/doc/PKGBUILD-example.txt +++ b/doc/PKGBUILD-example.txt @@ -1,24 +1,44 @@ # Maintainer: Joe User <joe.user@example.com> pkgname=patch -pkgver=2.5.4 -pkgrel=3 +pkgver=2.7.1 +pkgrel=2 pkgdesc="A utility to apply patch files to original sources" arch=('i686' 'x86_64') url="https://www.gnu.org/software/patch/patch.html" license=('GPL') groups=('base-devel') -depends=('glibc' 'ed') -source=("ftp://ftp.gnu.org/gnu/$pkgname/$pkgname-$pkgver.tar.gz") -md5sums=('ee5ae84d115f051d87fcaaef3b4ae782') +depends=('glibc') +makedepends=('ed') +optdepends=('ed: for "patch -e" functionality') +source=("ftp://ftp.gnu.org/gnu/$pkgname/$pkgname-$pkgver.tar.xz"{,.sig} + "patch-2.7.1-initialize-data-structures-early-enough.patch") +md5sums=('e9ae5393426d3ad783a300a338c09b72' + 'SKIP' + 'dc6367a7cd49933d4006c246789e98da') + +prepare() { + cd "$srcdir/$pkgname-$pkgver" + + # Fix segfault on non-numeric strip-count + # (also segfaults on nonexistent directory passed to -d) + # http://savannah.gnu.org/bugs/?37500 + patch -Np1 -i \ + "$srcdir/patch-2.7.1-initialize-data-structures-early-enough.patch" +} build() { - cd "$srcdir"/$pkgname-$pkgver - ./configure --prefix=/usr - make + cd "$srcdir/$pkgname-$pkgver" + ./configure --prefix=/usr + make +} + +check() { + cd "$srcdir/$pkgname-$pkgver" + make -k check } package() { - cd "$srcdir"/$pkgname-$pkgver - make prefix="$pkgdir"/usr install + cd "$srcdir/$pkgname-$pkgver" + make DESTDIR="$pkgdir/" install } -- 1.8.3
On 28/05/13 20:54, Jason St. John wrote:
From: "Jason St. John" <jstjohn@purdue.edu>
Update doc/PKGBUILD-example.txt with several changes from the official Arch Linux package for patch-2.7.1-2, including other changes shown below:
-- moves the patch command into its own prepare() function
See below
-- replaces spaces with tabs in functions
OK
-- adds check() function
I'd skip it - see below.
-- added "-k" switch in check() function
No - that is not needed if check passes...
-- replaces 'make prefix=' with 'make DESTDIR='
OK
-- improves quoting of the "cd" command in functions
OK
Signed-off-by: Jason St. John <jstjohn@purdue.edu> ---
Repeating my review of this in April: https://mailman.archlinux.org/pipermail/pacman-dev/2013-April/016968.html This has gone from being a nice minimal example to something that is very overboard... We already refer the user to their distributions PKGBUILDs or ABS to get more examples, so I think it should stay as simple as possible.
doc/PKGBUILD-example.txt | 40 ++++++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-)
diff --git a/doc/PKGBUILD-example.txt b/doc/PKGBUILD-example.txt index 00dd8b1..f2eb8c9 100644 --- a/doc/PKGBUILD-example.txt +++ b/doc/PKGBUILD-example.txt @@ -1,24 +1,44 @@ # Maintainer: Joe User <joe.user@example.com>
pkgname=patch -pkgver=2.5.4 -pkgrel=3 +pkgver=2.7.1 +pkgrel=2 pkgdesc="A utility to apply patch files to original sources" arch=('i686' 'x86_64') url="https://www.gnu.org/software/patch/patch.html" license=('GPL') groups=('base-devel') -depends=('glibc' 'ed') -source=("ftp://ftp.gnu.org/gnu/$pkgname/$pkgname-$pkgver.tar.gz") -md5sums=('ee5ae84d115f051d87fcaaef3b4ae782') +depends=('glibc') +makedepends=('ed') +optdepends=('ed: for "patch -e" functionality') +source=("ftp://ftp.gnu.org/gnu/$pkgname/$pkgname-$pkgver.tar.xz"{,.sig} + "patch-2.7.1-initialize-data-structures-early-enough.patch") +md5sums=('e9ae5393426d3ad783a300a338c09b72' + 'SKIP' + 'dc6367a7cd49933d4006c246789e98da') + +prepare() { + cd "$srcdir/$pkgname-$pkgver" + + # Fix segfault on non-numeric strip-count + # (also segfaults on nonexistent directory passed to -d) + # http://savannah.gnu.org/bugs/?37500 + patch -Np1 -i \ + "$srcdir/patch-2.7.1-initialize-data-structures-early-enough.patch" +}
build() { - cd "$srcdir"/$pkgname-$pkgver - ./configure --prefix=/usr - make + cd "$srcdir/$pkgname-$pkgver" + ./configure --prefix=/usr + make +} + +check() { + cd "$srcdir/$pkgname-$pkgver" + make -k check }
package() { - cd "$srcdir"/$pkgname-$pkgver - make prefix="$pkgdir"/usr install + cd "$srcdir/$pkgname-$pkgver" + make DESTDIR="$pkgdir/" install } -- 1.8.3
participants (2)
-
Allan McRae
-
Jason St. John