You are not logged in.

#1 2017-03-22 10:30:24

parchd
Member
Registered: 2014-03-08
Posts: 421

Feedback requested for PKGBUILD

I'm giving a PKGBUILD I have been maintaining an overhaul and was hoping for some feedback.

The package is brother-dcp-9020cdw and the current version is just a slightly edited version of another printer's PKGBUILD that looked similar at the time. Since then I've hated it more and more every time I've looked at it - it had unnecessary dependencies, and the admin script was creating files that were not managed by pacman.

I would appreciate someone having a look over the new version and giving me some feedback/tips before I upload it to the AUR.

# Maintainer: parchd <parchd@archlinux.info>

pkgname="brother-dcp-9020cdw"
pkgver="1.1.4"
pkgrel=2
pkgdesc="CUPS driver for the Brother DCP-9020CDW"
url="http://support.brother.com/g/b/producttop.aspx?c=gb&lang=en&prod=dcp9020cdw_eu"
arch=('i686' 'x86_64')
license=('GPL2')
depends=('cups' 'lib32-glibc' 'psutils')
source=(
       'http://download.brother.com/welcome/dlf100444/dcp9020cdw_cupswrapper_GPL_source_1.1.4-0.tar.gz'
       'http://www.brother.com/pub/bsc/linux/dlf/dcp9020cdwlpr-1.1.2-1.i386.deb'
      )
sha512sums=(
       '090aa66700dc860712fac645dde5289d316e35b4a68a5d0da0261dc17276e04cc611d57b518e6d778a8f6033a9a0ad77bb4f506d24063149f1060a75b0b2e3ea'
       '17d0934adca787fef15a0a985a6a895f4e1163bf3a4408bba0f6a6c8b324f9b3efcba1d25057050027caac3c545af4c8348d3586468f32d8594f0b098b67f3fb'
       )

build(){
cd "$srcdir/dcp9020cdw_cupswrapper_GPL_source_$pkgver-0"
cd brcupsconfig
make
}

package(){
    cd $pkgdir
    tar xf "$srcdir/data.tar.gz"
    install -Dm755 "$srcdir/dcp9020cdw_cupswrapper_GPL_source_$pkgver-0/brcupsconfig/brcupsconfpt1" opt/brother/Printers/dcp9020cdw/cupswrapper/brcupsconfpt1
    install -Dm755 "$srcdir/dcp9020cdw_cupswrapper_GPL_source_$pkgver-0/cupswrapper/cupswrapperdcp9020cdw" opt/brother/Printers/dcp9020cdw/cupswrapper/cupswrapperdcp9020cdw
    install -Dm644 "$srcdir/dcp9020cdw_cupswrapper_GPL_source_$pkgver-0/PPD/brother_dcp9020cdw_printer_en.ppd" usr/share/cups/model/Brother/brother_dcp9020cdw_printer_en.ppd
    install -Dm644 "$srcdir/dcp9020cdw_cupswrapper_GPL_source_$pkgver-0/PPD/brother_dcp9020cdw_printer_en.ppd" usr/share/ppd/Brother/brother_dcp9020cdw_printer_en.ppd
    install -d usr/lib/cups/filter/
    sed -ne '21,26p' -ne '26 a cat << !ENDOFWFILTER!' -ne '110,262p' opt/brother/Printers/dcp9020cdw/cupswrapper/cupswrapperdcp9020cdw|sh > usr/lib/cups/filter/brother_lpdwrapper_dcp9020cdw
    chmod 755 usr/lib/cups/filter/brother_lpdwrapper_dcp9020cdw
    rm opt/brother/Printers/dcp9020cdw/cupswrapper/cupswrapperdcp9020cdw

}

Offline

#2 2017-03-24 08:56:56

parchd
Member
Registered: 2014-03-08
Posts: 421

Re: Feedback requested for PKGBUILD

Just realised this is in the wrong subforum - never ventured into "Creating & Modifying Packages" before, so I didn't realise it was full of review requests like this. Sorry.
It seems to have had quite a few views though, so unless I'm suddenly flooded with critiques I'm going to assume nothing is glaringly wrong and will upload over the weekend.

Offline

#3 2017-03-24 12:17:21

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,846
Website

Re: Feedback requested for PKGBUILD

Just realised this is in the wrong subforum

Please let the mod team know if you ever do this by using the report function, we'll move it to the right place.


Moving to Creating/Modifying packages.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#4 2017-03-24 12:21:41

parchd
Member
Registered: 2014-03-08
Posts: 421

Re: Feedback requested for PKGBUILD

Thanks WorMzy smile

Offline

#5 2017-03-24 12:59:10

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,846
Website

Re: Feedback requested for PKGBUILD

The only concerns I have are 1) that you are using tar, but haven't listed it as a makedepends. The annual debate about whether packages in base should be listed in *depends arrays is apparently raging on at the moment, and the likely outcome is that some people will continue to not include them, others will, and there will be no censensus about which is correct. Personally, I would use bsdtar instead, since it's a dep of pacman (libarchive) and people are more likely to have it installed.

2) this line in package():

sed -ne '21,26p' -ne '26 a cat << !ENDOFWFILTER!' -ne '110,262p' opt/brother/Printers/dcp9020cdw/cupswrapper/cupswrapperdcp9020cdw|sh > usr/lib/cups/filter/brother_lpdwrapper_dcp9020cdw

If running this script is necessary, then ideally, it should be in build(). What I would consider doing is extracting just the script from the data tarball and modifying it with sed -i in prepare(), then calling the script in build(). Since you ended up removing the script in the package function, you can prevent it's extraction in the first place using --exclude (both bsdtar and tar support it)

3) Minor one, but

cd "$srcdir/dcp9020cdw_cupswrapper_GPL_source_$pkgver-0"
cd brcupsconfig

can just be written as

cd "$srcdir/dcp9020cdw_cupswrapper_GPL_source_$pkgver-0/brcupsconfig"

4) Your indentation is all over the place.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#6 2017-03-24 13:47:14

parchd
Member
Registered: 2014-03-08
Posts: 421

Re: Feedback requested for PKGBUILD

Thanks for the feedback. I'll switch to using bsdtar instead, and will fix the indentation.
Regarding 2): the file I am running sed on is Brother's big and ugly management script, which creates and removes files that would ideally be managed either by pacman or by the administrator. The one useful thing that it does is write out a necessary cups filter. In that sed line, I'm leaving behind just what is necessary to create that filter. I think if I was to extract it and modify it, and then run it with the original filename, it could lead to confusion about what was happening. That said, I can see why either of prepare or build might be better places for it.

Offline

#7 2017-03-27 20:37:48

severach
Member
Registered: 2015-05-23
Posts: 192

Re: Feedback requested for PKGBUILD

Have a look at my Brother packages. Sure they're large and complex. I did it to compile what little source Brother makes available and eliminate the need for users to run the Brother install script to write files all over, sometimes in the wrong places, sometimes conflicting with other Brother packages, and sometimes with broken defaults. Turning Brother drivers into well behaved packages can be done, it's just a lot of work.

The problem is that since no other distro has anything like the AUR, admins crap up their systems with 'configure && make && make install' or 'sudo install.sh' scripts. They must because there's no other way. The AUR is a one distro pony so it isn't targeted by script writers who just assume you're good with crapping up your system with unmanaged files.

The good news is that there's very little bad script writing that the PKGBUILD can't overcome.

Offline

#8 2017-03-27 21:58:16

parchd
Member
Registered: 2014-03-08
Posts: 421

Re: Feedback requested for PKGBUILD

Thanks - I definitely will have a look at yours. In the mean time, I uploaded this one at the weekend (although with further edits). I'm pretty happy with it for the moment. More so than I was before.

Offline

Board footer

Powered by FluxBB