You are not logged in.

#1 2018-03-09 23:18:09

Kewl
Wiki Maintainer
From: UK
Registered: 2018-03-09
Posts: 22

PKGBUILD etc-update-git - request for review

Hello

I am creating a git version for `etc-update` because the latter is quite outdated and not dynamic. The full code is stored in the PKGBUILD of `etc-update` itself which I don't think is good practice.
Your feedback would be appreciated, thanks very much in advance.

# Maintainer: Kewl <xrjy@nygb.rh.bet(rot13)>

pkgname=etc-update-git
_name=${pkgname%-git}
pkgver=2.3.24.r48.g15b849853
pkgrel=1
pkgdesc="CLI to interactively merge .pacnew in /etc (git version)"
url="https://wiki.gentoo.org/wiki/Handbook:X86/Portage/Tools#etc-update"
arch=('any')
license=('GPL')
depends=('bash')
makedepends=('git')
conflicts=('etc-update')
source=("$pkgname::git+https://github.com/kewlfft/portage.git")
sha256sums=('SKIP')

pkgver() {
  cd "$pkgname"
  git describe --long | sed 's/^portage-//;s/\([^-]*-g\)/r\1/;s/-/./g'
}

prepare() {
  sed -e "/Public License v2/a # Ported to Arch Linux by:\n# Kewl <xrjy@nygb.rh.bet(rot13)>
    /^OS_RELEASE_ID=/c\OS_RELEASE_ID=arch
    s/suse|opensuse/arch/
    s/'suse'/'arch'/g
    s/\.rpmnew/\.pacnew/g
    s/Gentoo's/Arch/g
    s/PROTECT='\/etc'/PROTECT='\/etc \/usr\/lib \/usr\/share\/config'/
    s/PROTECT_MASK=''/PROTECT_MASK='\/etc\/udev\/rules.d'/
    s/local file ofile /local file ofile='.pacnew' /
    s/file:10/file::-7/g" "$pkgname/bin/$_name" > "$_name"
}

package() {
  install -Dm 0755 "$_name" "$pkgdir/usr/bin/$_name"
  install -Dm 0644 "$pkgname/cnf/$_name.conf" "$pkgdir/etc/$_name.conf"
}

I tested it successfully and pushed it in the AUR I am still interested in your feedback to improve it.

Last edited by Kewl (2018-03-10 21:37:05)

Offline

#2 2018-03-11 01:47:23

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: PKGBUILD etc-update-git - request for review

AFAICT the only thing this complicated sed command does is patch in support for Arch Linux to go with/replace their existing support for OpenSUSE... so given that they already maintain support for other distros, have you considered, uh, adding upstream support for Arch Linux too?

Aside for that, I generally find that *.patch files, which will fail with errors if they no longer apply due to upstream changes, are better than sed commands which will silently fail to do anything while returning a successful status if *they* no longer apply. So as a general rule of thumb in the event that you cannot fix something upstream, consider using a patch file. tongue


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#3 2018-03-11 08:26:37

Kewl
Wiki Maintainer
From: UK
Registered: 2018-03-09
Posts: 22

Re: PKGBUILD etc-update-git - request for review

Thanks for your feedback Eli
1. I have contacted the Gentoo team to see if they would accept adding Arch compatibility upstream.
2. I had thought about a patch, then in this case I control the upstream (it is a fork) and will check the sed is still good before releasing in GitHub. The sed was to give me maximum versatility so that I don't need to amend the package unless changes are significant but I may be able to achieve the same with a patch. I get your valid point, patch is safer and should be preferred.

Thanks, I will follow up with 1. which would be the best solution

Offline

#4 2018-03-14 22:06:03

Kewl
Wiki Maintainer
From: UK
Registered: 2018-03-09
Posts: 22

Re: PKGBUILD etc-update-git - request for review

I have contacted the Gentoo Portage team and they accept to support Arch within etc-update, I will therefore commit to portage.
Nice cooperation and thanks for the suggestion.
...
Merged now: https://github.com/gentoo/portage/pull/267

Last edited by Kewl (2018-03-15 20:56:43)

Offline

Board footer

Powered by FluxBB