You are not logged in.
Hello,
I'm writing this PKGBUILD and would like to know what you guys think about it.
# Maintainer: Pierre-Alain TORET <pierre-alain.toret@protonmail.com>
pkgname=pitrery
pkgver=2.0
pkgrel=1
pkgdesc="Point In Time Recovery tools for PostgreSQL"
arch=("any")
depends=("bash")
makedepends=("make")
optdepends=("openssh" "rsync")
url="https://dalibo.github.io/pitrery/"
license=("BSD")
backup=('etc/pitrery/pitrery.conf')
source=("https://dl.dalibo.com/public/pitrery/pitrery-2.0.tar.gz")
sha256sums=("19b5821a6215153bb5071da38a6d7d6ffc8f4c0aa776c77ecf3621f7286d53b6")
validpgpkeys=("https://dl.dalibo.com/public/pitrery/pitrery-2.0.tar.gz.asc")
build() {
cd "$pkgname-$pkgver"
sed -i 's@PREFIX = /usr/local@PREFIX = /usr@g' config.mk
sed -i 's@SYSCONFDIR = ${PREFIX}/etc/${NAME}@SYSCONFDIR = /etc/${NAME}@g' config.mk
make
}
package() {
cd "$pkgname-$pkgver"
make DESTDIR="$pkgdir" install
install -Dm644 COPYRIGHT "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
Offline
You don't need the makedeps=make since base-devel is assumed to be installed. Do you really need to supply /usr/share/doc/pitrery/*
% tree pkg
pkg
└── pitrery
├── etc
│ └── pitrery
│ └── pitrery.conf
└── usr
├── bin
│ ├── archive_xlog
│ ├── pitrery
│ └── restore_xlog
└── share
├── doc
│ └── pitrery
│ ├── CHANGELOG
│ ├── COPYRIGHT
│ ├── INSTALL.md
│ ├── pitrery.conf
│ └── UPGRADE.md
├── licenses
│ └── pitrery
│ └── LICENSE
└── man
└── man1
├── archive_xlog.1.gz
├── pitrery.1.gz
└── restore_xlog.1.gz
12 directories, 13 files
Last edited by graysky (2018-03-31 11:45:51)
CPU-optimized Linux-ck packages @ Repo-ck • AUR packages • Zsh and other configs
Offline
graysky, thanks for the review, you're right I don't need the doc directory. Also I'll remove the makedeps.
Offline
validpgpkeys is for the key, not for the signature itself. That should be in the source array. You'll want to use the $pkgver variable in them so that you don't have to change it in 2-3 places when you update the package.
Optional deps should have a description with them.
In general, yes, you should supply the doc dir.
Why are you renaming the COPYRIGHT file?
There's no reason to call sed twice on the same file, you can specify more than one expression. I would also do them a bit differently, but it's best to use what makes sense to you there.
Last edited by Scimmia (2018-03-31 15:07:34)
Offline
Hello Scimmia, thanks for the review.
Following both your advice and trying to understand what's best for my package I ended with the following PKGBUILD.
I tried to use pkgver in a more efficient way, same for sed.
I kept the COPYRIGHT file as it is and decided it makes sense to provide the doc folder.
# Maintainer: Pierre-Alain TORET <pierre-alain.toret@protonmail.com>
pkgname=pitrery
pkgver=2.0
pkgrel=1
pkgdesc="Point In Time Recovery tools for PostgreSQL"
arch=("any")
depends=("bash")
optdepends=("openssh: used for remote backups" "rsync: used for network WAL archiving")
url="https://dalibo.github.io/pitrery/"
license=("BSD")
backup=('etc/pitrery/pitrery.conf')
source=("https://dl.dalibo.com/public/pitrery/pitrery-$pkgver.tar.gz" "https://dl.dalibo.com/public/pitrery/pitrery-$pkgver.tar.gz.asc")
sha256sums=("19b5821a6215153bb5071da38a6d7d6ffc8f4c0aa776c77ecf3621f7286d53b6" "323cbb950daf5ad7f4a5523fe9c29c6688e2809d16e5de4d16c655115b25796c")
build() {
cd "$pkgname-$pkgver"
sed -i -e 's@PREFIX = /usr/local@PREFIX = /usr@g' -e 's@SYSCONFDIR = ${PREFIX}/etc/${NAME}@SYSCONFDIR = /etc/${NAME}@g' config.mk
make
}
package() {
cd "$pkgname-$pkgver"
make DESTDIR="$pkgdir" install
install -Dm644 COPYRIGHT "$pkgdir/usr/share/licenses/$pkgname/COPYRIGHT"
}
Last edited by daftaupe (2018-04-01 12:06:00)
Offline
As a pedantic note about sed, the 'g' modifier servers no purpose in your commands. And while your current version does indeed only require one sed process, it includes multiple -e parameters which are not needed. Either of the following would have the same effect as what you have now:
sed -i 's@PREFIX = /usr/local@PREFIX = /usr@;s@SYSCONFDIR = ${PREFIX}/etc/${NAME}@SYSCONFDIR = /etc/${NAME}@' config.mk
sed -i '/^PREFIX/s/local//;/^SYSCONFDIR/s/${PREFIX}//' config.mk
The first of the above is closer to what you have but it gets rid of the superflous 'g' modifers and -e parameters. The second is - obviously - much more concise, but one might argue not as clear as to it's purpose.
Last edited by Trilby (2018-04-01 12:02:16)
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline
Trilby, I take note of your comment, for sure the second line is much shorter, but I'll go for the first one as it makes more sense to me and is still an improvment over what I wrote. I'm not familiar enough with sed.
Offline
You do need the validpgpkeys entry, it just shouldn't be the url of the signature file. The validpgpkeys entry is supposed to list the PGP fingerprint of the expected key, which makepkg will consider trusted to sign the package sources even if the user has not explicitly signed your PGP key.
Managing AUR repos The Right Way -- aurpublish (now a standalone tool)
Offline
I see, so in this case I've added the following
validpgpkeys=("A9C12688B6D6A1A66A9FE2BC36B6559CD664AA4D")
Offline