[pacman-dev] Changing from double quotes to single quotes
Hi, Patch 1 and 4 are for changing quotes from double to single for the pkgdesc in PKGBUILD.proto and PKGBUILD-split.proto. Since few packages perform variable replacement in the package description, I think it would make sense to make single quotes the default. Patch 2 is for doing the same for the url. Patch 3 and 5 are for removing quotes when using cd and make. I was informed that this is safe to do when using $pkgdir. Best regards, Alexander Rødseth
Signed-off-by: Alexander Rødseth <rodseth@gmail.com> --- proto/PKGBUILD-split.proto | 2 +- proto/PKGBUILD.proto | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/proto/PKGBUILD-split.proto b/proto/PKGBUILD-split.proto index f873db6..c52d98c 100644 --- a/proto/PKGBUILD-split.proto +++ b/proto/PKGBUILD-split.proto @@ -9,7 +9,7 @@ pkgbase=BASE pkgver=VERSION pkgrel=1 epoch= -pkgdesc="" +pkgdesc='' arch=() url="" license=('GPL') diff --git a/proto/PKGBUILD.proto b/proto/PKGBUILD.proto index 98172d8..8c72ffd 100644 --- a/proto/PKGBUILD.proto +++ b/proto/PKGBUILD.proto @@ -8,7 +8,7 @@ pkgname=NAME pkgver=VERSION pkgrel=1 epoch= -pkgdesc="" +pkgdesc='' arch=() url="" license=('GPL') -- 1.8.0
I can add that this change is in line with our current bash coding style: https://wiki.archlinux.org/index.php/DeveloperWiki:Bash_Coding_Style -- Best regards, Alexander Rødseth Arch Linux Trusted User (xyproto on IRC, trontonic on AUR)
Signed-off-by: Alexander Rødseth <rodseth@gmail.com> --- proto/PKGBUILD-split.proto | 2 +- proto/PKGBUILD.proto | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/proto/PKGBUILD-split.proto b/proto/PKGBUILD-split.proto index c52d98c..d400da7 100644 --- a/proto/PKGBUILD-split.proto +++ b/proto/PKGBUILD-split.proto @@ -11,7 +11,7 @@ pkgrel=1 epoch= pkgdesc='' arch=() -url="" +url='' license=('GPL') groups=() depends=() diff --git a/proto/PKGBUILD.proto b/proto/PKGBUILD.proto index 8c72ffd..1284cf5 100644 --- a/proto/PKGBUILD.proto +++ b/proto/PKGBUILD.proto @@ -10,7 +10,7 @@ pkgrel=1 epoch= pkgdesc='' arch=() -url="" +url='' license=('GPL') groups=() depends=() -- 1.8.0
On Thu, Oct 25, 2012 at 03:20:58PM +0200, Alexander Rødseth wrote:
Signed-off-by: Alexander Rødseth <rodseth@gmail.com> --- proto/PKGBUILD-split.proto | 2 +- proto/PKGBUILD.proto | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/proto/PKGBUILD-split.proto b/proto/PKGBUILD-split.proto index c52d98c..d400da7 100644 --- a/proto/PKGBUILD-split.proto +++ b/proto/PKGBUILD-split.proto @@ -11,7 +11,7 @@ pkgrel=1 epoch= pkgdesc='' arch=() -url="" +url='' license=('GPL') groups=() depends=()
Excuse me, but don't we want to consider that most urls use some sort of expansion concerning $pkgname, $pkgver and other variables case by case? It seems to me single quotes won't be able of doing that. cheers! mar77i
Hi Martti, 2012/10/29 Martti Kühne <mysatyre@gmail.com>:
Excuse me, but don't we want to consider that most urls use some sort of expansion concerning $pkgname, $pkgver and other variables case by case?
Are you confusing url with source? -- Best regards, Alexander Rødseth
On Mon, Oct 29, 2012 at 04:42:29PM +0100, Alexander Rødseth wrote:
Hi Martti,
2012/10/29 Martti Kühne <mysatyre@gmail.com>:
Excuse me, but don't we want to consider that most urls use some sort of expansion concerning $pkgname, $pkgver and other variables case by case?
Are you confusing url with source?
-- Best regards, Alexander Rødseth
Indeed. :) cheers! mar77i
Signed-off-by: Alexander Rødseth <rodseth@gmail.com> --- proto/PKGBUILD-split.proto | 8 ++++---- proto/PKGBUILD.proto | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/proto/PKGBUILD-split.proto b/proto/PKGBUILD-split.proto index d400da7..ab31e71 100644 --- a/proto/PKGBUILD-split.proto +++ b/proto/PKGBUILD-split.proto @@ -29,13 +29,13 @@ noextract=() md5sums=() #generate with 'makepkg -g' build() { - cd "$srcdir/$pkgbase-$pkgver" + cd $srcdir/$pkgbase-$pkgver ./configure --prefix=/usr make } check() { - cd "$srcdir/$pkgname-$pkgver" + cd $srcdir/$pkgname-$pkgver make -k check } @@ -59,7 +59,7 @@ package_pkg1() { install= changelog= - cd "$srcdir/$pkgbase-$pkgver" + cd $srcdir/$pkgbase-$pkgver make DESTDIR="$pkgdir/" install-pkg1 } @@ -67,6 +67,6 @@ package_pkg2() { # options and directives overrides pkgdesc="" - cd "$srcdir/$pkgbase-$pkgver" + cd $srcdir/$pkgbase-$pkgver make DESTDIR="$pkgdir/" install-pkg2 } diff --git a/proto/PKGBUILD.proto b/proto/PKGBUILD.proto index 1284cf5..5603e35 100644 --- a/proto/PKGBUILD.proto +++ b/proto/PKGBUILD.proto @@ -29,18 +29,18 @@ noextract=() md5sums=() #generate with 'makepkg -g' build() { - cd "$srcdir/$pkgname-$pkgver" + cd $srcdir/$pkgname-$pkgver ./configure --prefix=/usr make } check() { - cd "$srcdir/$pkgname-$pkgver" + cd $srcdir/$pkgname-$pkgver make -k check } package() { - cd "$srcdir/$pkgname-$pkgver" + cd $srcdir/$pkgname-$pkgver make DESTDIR="$pkgdir/" install } -- 1.8.0
On Thu, Oct 25, 2012 at 8:20 AM, Alexander Rødseth <rodseth@gmail.com> wrote:
Signed-off-by: Alexander Rødseth <rodseth@gmail.com>
How did this go when you placed a sample PKGBUILD in "/tmp/dir with spaces/PKGBUILD" and ran it?
--- proto/PKGBUILD-split.proto | 8 ++++---- proto/PKGBUILD.proto | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/proto/PKGBUILD-split.proto b/proto/PKGBUILD-split.proto index d400da7..ab31e71 100644 --- a/proto/PKGBUILD-split.proto +++ b/proto/PKGBUILD-split.proto @@ -29,13 +29,13 @@ noextract=() md5sums=() #generate with 'makepkg -g'
build() { - cd "$srcdir/$pkgbase-$pkgver" + cd $srcdir/$pkgbase-$pkgver ./configure --prefix=/usr make }
check() { - cd "$srcdir/$pkgname-$pkgver" + cd $srcdir/$pkgname-$pkgver make -k check }
@@ -59,7 +59,7 @@ package_pkg1() { install= changelog=
- cd "$srcdir/$pkgbase-$pkgver" + cd $srcdir/$pkgbase-$pkgver make DESTDIR="$pkgdir/" install-pkg1 }
@@ -67,6 +67,6 @@ package_pkg2() { # options and directives overrides pkgdesc=""
- cd "$srcdir/$pkgbase-$pkgver" + cd $srcdir/$pkgbase-$pkgver make DESTDIR="$pkgdir/" install-pkg2 } diff --git a/proto/PKGBUILD.proto b/proto/PKGBUILD.proto index 1284cf5..5603e35 100644 --- a/proto/PKGBUILD.proto +++ b/proto/PKGBUILD.proto @@ -29,18 +29,18 @@ noextract=() md5sums=() #generate with 'makepkg -g'
build() { - cd "$srcdir/$pkgname-$pkgver" + cd $srcdir/$pkgname-$pkgver ./configure --prefix=/usr make }
check() { - cd "$srcdir/$pkgname-$pkgver" + cd $srcdir/$pkgname-$pkgver make -k check }
package() { - cd "$srcdir/$pkgname-$pkgver" + cd $srcdir/$pkgname-$pkgver make DESTDIR="$pkgdir/" install }
-- 1.8.0
Hi Dan, I was told that for official packages, spaces would never appear in $pkgdir, so quoting was not needed. -- Regards, Alexander Rødseth Arch Linux Trusted User (xyproto on IRC, trontonic on AUR)
Hi again, Ok, just learned that pacman needs to consider not only official packages, but all possible packages, so removing double quotes is not an acceptable default. No problem, just disregard this particular patch. -- Cordially, Alexander Rødseth Arch Linux Trusted User (xyproto on IRC, trontonic on AUR)
On Thu, Oct 25, 2012 at 8:44 AM, Alexander Rødseth <rodseth@gmail.com> wrote:
Hi Dan,
I was told that for official packages, spaces would never appear in $pkgdir, so quoting was not needed.
Mind naming that source? This concerns the directories that have nothing to do with the package or pkgname itself, so I'm also not sure how that applies here. Also, Arch might have a standard of not naming packages with spaces, but pacman itself has no problem with spaces in pkgnames, and I intend to continue supporting that. -Dan diff --git a/test/pacman/tests/sync001.py b/test/pacman/tests/sync001.py index 0f5fdcf..0ad46a5 100644 --- a/test/pacman/tests/sync001.py +++ b/test/pacman/tests/sync001.py @@ -1,13 +1,13 @@ self.description = "Install a package from a sync db" -sp = pmpkg("dummy") +sp = pmpkg("dummy space") sp.files = ["bin/dummy", "usr/man/man1/dummy.1"] self.addpkg2db("sync", sp) -self.args = "-S %s" % sp.name +self.args = "-S '%s'" % sp.name self.addrule("PACMAN_RETCODE=0") -self.addrule("PKG_EXIST=dummy") +self.addrule("PKG_EXIST=%s" % sp.name) for f in sp.files: self.addrule("FILE_EXIST=%s" % f)
Dan McGee wrote:
Also, Arch might have a standard of not naming packages with spaces, but pacman itself has no problem with spaces in pkgnames, and I intend to continue supporting that.
-Dan
I just wanted to say thank you for this. Handling all cases is good design and I am very glad to see that you support this. I've always been surprised that there is opposition to proper variable quoting in official PKGBUILDS on the basis that such cases should not be considered. If spaces may appear in paths, an application is broken if it cannot run on such a path. It's like not supporting unicode because your native language is English and you see no point to all those accents and umlauts. /X
Signed-off-by: Alexander Rødseth <rodseth@gmail.com> --- proto/PKGBUILD-split.proto | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/proto/PKGBUILD-split.proto b/proto/PKGBUILD-split.proto index ab31e71..6b36dea 100644 --- a/proto/PKGBUILD-split.proto +++ b/proto/PKGBUILD-split.proto @@ -44,9 +44,9 @@ package_pkg1() { pkgver= pkgrel= epoch= - pkgdesc="" + pkgdesc='' arch=() - url="" + url='' license=() groups=() depends=() @@ -65,7 +65,7 @@ package_pkg1() { package_pkg2() { # options and directives overrides - pkgdesc="" + pkgdesc='' cd $srcdir/$pkgbase-$pkgver make DESTDIR="$pkgdir/" install-pkg2 -- 1.8.0
Signed-off-by: Alexander Rødseth <rodseth@gmail.com> --- proto/PKGBUILD-split.proto | 4 ++-- proto/PKGBUILD.proto | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/proto/PKGBUILD-split.proto b/proto/PKGBUILD-split.proto index 6b36dea..d4870e5 100644 --- a/proto/PKGBUILD-split.proto +++ b/proto/PKGBUILD-split.proto @@ -60,7 +60,7 @@ package_pkg1() { changelog= cd $srcdir/$pkgbase-$pkgver - make DESTDIR="$pkgdir/" install-pkg1 + make DESTDIR=$pkgdir install-pkg1 } package_pkg2() { @@ -68,5 +68,5 @@ package_pkg2() { pkgdesc='' cd $srcdir/$pkgbase-$pkgver - make DESTDIR="$pkgdir/" install-pkg2 + make DESTDIR=$pkgdir install-pkg2 } diff --git a/proto/PKGBUILD.proto b/proto/PKGBUILD.proto index 5603e35..ebb3472 100644 --- a/proto/PKGBUILD.proto +++ b/proto/PKGBUILD.proto @@ -41,7 +41,7 @@ check() { package() { cd $srcdir/$pkgname-$pkgver - make DESTDIR="$pkgdir/" install + make DESTDIR=$pkgdir install } # vim:set ts=2 sw=2 et: -- 1.8.0
participants (4)
-
Alexander Rødseth
-
Dan McGee
-
Martti Kühne
-
Xyne