You are not logged in.

#1 2020-11-05 14:49:42

PeterBB
Member
Registered: 2014-11-06
Posts: 10

[SOLVED] PKGBUILD review request: xbrzscale

# Maintainer: Peter blackman <peter at pblackman dot plus dot com>
# Build xbrzscale with latest version (1.8) of xbrz library

pkgname=xbrzscale
pkgver=1.8
pkgrel=1
pkgdesc="New Generation Image Upscaling Tool"
arch=('i686' 'x86_64' 'aarch64')
url="https://sourceforge.net/projects/xbrz/files/xBRZ/"
url="https://github.com/atheros/xbrzscale"
license=('GPL3')
depends=(sdl2_image)
options=(buildflags)
source=("$pkgname.tar.gz::https://github.com/atheros/xbrzscale/tarball/master"
	"xbrz-$pkgver.zip::https://sourceforge.net/projects/xbrz/files/xBRZ/xBRZ_1.8.zip/download"
	001-makefile.patch)
sha256sums=('d9175f17781608f472de47265a5c399fc003cc468fd584c11de08b17385d488e'
            'e4e2513801c7097fe9a391b481a48b1890f80e696549d8cf27884bd223a4cba9'
            '1fcd854678da773a1ef87d8e94da1d71604bc64f62d84bdd70339e2945480ebf')


# Replace /xbrz contents
# Apply makefile patch
prepare() {
  rm -fr "$pkgname"
  mv "atheros-$pkgname-b719c2c" "$pkgname"

  rm "$pkgname"/xbrz/*
  mv xbrz.cpp      "$pkgname/xbrz/"
  mv xbrz.h        "$pkgname/xbrz/"
  mv xbrz_config.h "$pkgname/xbrz/"
  mv xbrz_tools.h  "$pkgname/xbrz/"
  mv Changelog.txt "$pkgname/xbrz/"

  cd "$pkgname"
  patch -Np1 < ../../001-makefile.patch
}


build() {
  cd "$pkgname"
  make
}


package() {
  cd "$pkgname"
  install -Dm 755 "$pkgname"         -t "$pkgdir/usr/bin"
  install -Dm 644 xbrz/Changelog.txt -t "$pkgdir/usr/share/doc/$pkgname"
}

I'm hoping its OK, namcap seems happy, but its my first, so I may have missed somthing. Guess I'm still a bit confused about when to use quotes, and what sort.

About the package; xBRZ is a new generation upscaling algorithm that produces better results than simple filters, especially with images such as low res pixel art. xbrzscale is a command line wrapper for the xBRZ library.

xbrzscale upstream is stuck at version 1.4, so I have incorporated the latest xBRZ version 1.8, and fixed the makefile.

PB

Last edited by PeterBB (2020-11-10 19:43:53)

Offline

#2 2020-11-05 14:55:27

Scimmia
Bug Wrangler
Registered: 2012-09-01
Posts: 8,047

Re: [SOLVED] PKGBUILD review request: xbrzscale

few things I notice right away.

'url' is defined twice, so the first one does nothing.
grabbing a tarball of master is unacceptable. It need to grab a version specific tarball.
the buildflag option is default, don't use it here.
mv can move more than one file at a time.

Offline

#3 2020-11-05 15:36:39

Stefan Husmann
Member
From: Germany
Registered: 2007-08-07
Posts: 1,138

Re: [SOLVED] PKGBUILD review request: xbrzscale

Do not use ../.. in

patch -Np1 < ../../001-makefile.patch

,
use $srcdir instead.

I prefer quoting only the variable that needs to be quoted, i.e. "$pkgdir"/usr/bin instead of "$pkgdir/usr/bin", but that may be personal taste.

"depends" and "options" should be arrays, but for options also read the previous answer.

Offline

#4 2020-11-05 15:46:47

Scimmia
Bug Wrangler
Registered: 2012-09-01
Posts: 8,047

Re: [SOLVED] PKGBUILD review request: xbrzscale

Stefan Husmann wrote:

Do not use ../.. in

patch -Np1 < ../../001-makefile.patch

,
use $srcdir instead.

I prefer quoting only the variable that needs to be quoted, i.e. "$pkgdir"/usr/bin instead of "$pkgdir/usr/bin", but that may be personal taste.

Both are personal taste.

Stefan Husmann wrote:

"depends" and "options" should be arrays, but for options also read the previous answer.

???
They already are arrays?

Offline

#5 2020-11-05 20:52:43

PeterBB
Member
Registered: 2014-11-06
Posts: 10

Re: [SOLVED] PKGBUILD review request: xbrzscale

Thanks for your comments.

Scimmia wrote:

'url' is defined twice, so the first one does nothing.

Removed


Scimmia wrote:

grabbing a tarball of master is unacceptable. It need to grab a version specific tarball (zip file).

Can't find one to use. However, xbrz uses a versioned tarball, and should xbrzscale change, the checksum will fail.


Scimmia wrote:

the buildflag option is default, don't use it here.

Removed


Scimmia wrote:

mv can move more than one file at a time.

Fixed


PB

Last edited by PeterBB (2020-11-05 20:59:30)

Offline

#6 2020-11-05 20:55:49

PeterBB
Member
Registered: 2014-11-06
Posts: 10

Re: [SOLVED] PKGBUILD review request: xbrzscale

Thanks for your comments. There is more to get wrong that I thought!


Stefan Husmann wrote:

Do not use ../.. in

patch -Np1 < ../../001-makefile.patch

,
use $srcdir instead.

Fixed


Stefan Husmann wrote:

"depends" and "options" should be arrays

Added the quotes. I assume that is what you meant here.


PB

Offline

#7 2020-11-05 20:57:56

PeterBB
Member
Registered: 2014-11-06
Posts: 10

Re: [SOLVED] PKGBUILD review request: xbrzscale

Latest version;

# Maintainer: Peter blackman <peter at pblackman dot plus dot com>
# Build xbrzscale with latest version (1.8) of xbrz library

pkgname=xbrzscale
pkgver=1.8
pkgrel=1
pkgdesc="New Generation Image Upscaling Tool"
arch=('i686' 'x86_64' 'aarch64')
url="https://github.com/atheros/xbrzscale"
license=('GPL3')
depends=('sdl2_image')
source=("$pkgname.tar.gz::https://github.com/atheros/xbrzscale/tarball/master"
	"xbrz-$pkgver.zip::https://sourceforge.net/projects/xbrz/files/xBRZ/xBRZ_1.8.zip/download"
	001-makefile.patch)
sha256sums=('d9175f17781608f472de47265a5c399fc003cc468fd584c11de08b17385d488e'
            'e4e2513801c7097fe9a391b481a48b1890f80e696549d8cf27884bd223a4cba9'
            '1fcd854678da773a1ef87d8e94da1d71604bc64f62d84bdd70339e2945480ebf')


# Replace /xbrz contents
# Apply makefile patch
prepare() {
  rm -fr "$pkgname"
  mv "atheros-$pkgname-b719c2c" "$pkgname"

  rm "$pkgname"/xbrz/*
  mv xbrz.cpp xbrz.h xbrz_config.h xbrz_tools.h Changelog.txt "$pkgname/xbrz/"
 
  cd "$pkgname"
  patch -Np1 < "$srcdir/001-makefile.patch"
}


build() {
  cd "$pkgname"
  make
}


package() {
  cd "$pkgname"
  install -Dm 755 "$pkgname"         -t "$pkgdir/usr/bin"
  install -Dm 644 xbrz/Changelog.txt -t "$pkgdir/usr/share/doc/$pkgname"
}

Offline

#8 2020-11-05 21:31:26

loqs
Member
Registered: 2014-03-06
Posts: 12,094

Re: [SOLVED] PKGBUILD review request: xbrzscale

Please post or link to 001-makefile.patch.  I am assuming this will fix the build failure I am seeing.
You are still using a tarball of the git master See Scimmia's comment in post #2.
If you want to track master,  you can make it a git package and track the git itself.
Edit:
Alternative way to change the path inside the archive:

noextract=($pkgname.tar.gz xbrz-$pkgver.zip)

prepare() {
  bsdtar -xf $pkgname.tar.gz -s /atheros-$pkgname-b719c2c/$pkgname/
  bsdtar -xf xbrz-$pkgver.zip -C "$pkgname"/xbrz 
 
  cd "$pkgname"
  patch -Np1 < "$srcdir/001-makefile.patch"
}

Last edited by loqs (2020-11-05 21:54:48)

Offline

#9 2020-11-05 22:19:23

PeterBB
Member
Registered: 2014-11-06
Posts: 10

Re: [SOLVED] PKGBUILD review request: xbrzscale

The patch is in git here
https://aur.archlinux.org/cgit/aur.git/ … =xbrzscale

or you can just use download snapshot from here, and it should build fine.
https://aur.archlinux.org/packages/xbrzscale

Thanks for the no-extract suggestion.


P.B.

Offline

#10 2020-11-05 23:30:52

loqs
Member
Registered: 2014-03-06
Posts: 12,094

Re: [SOLVED] PKGBUILD review request: xbrzscale

Pin to the current github master

makedepends=('git')
source=("git+https://github.com/atheros/xbrzscale.git#commit=b719c2c898edf464bfab727c44d21de5e7122fc4"
        "xbrz-$pkgver.zip::https://sourceforge.net/projects/xbrz/files/xBRZ/xBRZ_1.8.zip/download"
         001-makefile.patch)
sha256sums=('SKIP'
            'e4e2513801c7097fe9a391b481a48b1890f80e696549d8cf27884bd223a4cba9'
            '1fcd854678da773a1ef87d8e94da1d71604bc64f62d84bdd70339e2945480ebf')
noextract=(xbrz-$pkgver.zip)


# Replace /xbrz contents
# Apply makefile patch
prepare() {
  bsdtar -xf xbrz-$pkgver.zip -C "$pkgname"/xbrz 

  cd "$pkgname"
  patch -Np1 < "$srcdir/001-makefile.patch"
}

Offline

#11 2020-11-05 23:38:03

PeterBB
Member
Registered: 2014-11-06
Posts: 10

Re: [SOLVED] PKGBUILD review request: xbrzscale

Thanks, I get it now.

Will try again tomorrow, (nearly midnight this side of the pond!)


PB

Offline

#12 2020-11-06 03:32:42

eschwartz
Trusted User/Bug Wrangler
Registered: 2014-08-08
Posts: 3,768

Re: [SOLVED] PKGBUILD review request: xbrzscale

Excuse me what. where did you get https://github.com/atheros/xbrzscale/tarball/master from? The standard, current urls for downloading from github are of the form https://github.com/atheros/xbrzscale/ar … ter.tar.gz

The old tarball/$ref form is a *bad* API and should never be used, hence why Github does not advertise it...

Note that the "master" part of either url is just a git ref, it could be anything that git accepts -- a commit, a branch, a tag -- but the branch "master" is simply very commonly used.

The AUR policy *requires* you use a tag or commit, not a branch. Please fix this.

...

loqs, what on earth is the point of switching to git for this? Given it must pin the source, there is no benefit to pinning it as a it checkout vs. pinning it as a normal file download.


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

Offline

#13 2020-11-06 04:11:05

loqs
Member
Registered: 2014-03-06
Posts: 12,094

Re: [SOLVED] PKGBUILD review request: xbrzscale

eschwartz wrote:

loqs, what on earth is the point of switching to git for this? Given it must pin the source, there is no benefit to pinning it as a it checkout vs. pinning it as a normal file download.

I could not find how to produce https://github.com/atheros/xbrzscale/ar … 122fc4.zip at the time.
Edit:
Better?

# Maintainer: Peter blackman <peter at pblackman dot plus dot com>
# Build xbrzscale with latest version (1.8) of xbrz library

pkgname=xbrzscale
pkgver=1.8
pkgrel=1
pkgdesc="New Generation Image Upscaling Tool"
arch=('i686' 'x86_64' 'aarch64')
url="https://github.com/atheros/xbrzscale"
license=('GPL3')
depends=('sdl2_image')
_commit=b719c2c898edf464bfab727c44d21de5e7122fc4
source=("$pkgname.zip::https://github.com/atheros/xbrzscale/archive/$_commit.zip"
        "xbrz-$pkgver.zip::https://sourceforge.net/projects/xbrz/files/xBRZ/xBRZ_1.8.zip/download"
         001-makefile.patch)
sha256sums=('5195b2f44833411f6e413e138c84b3e9042ac69c346b1c896772a75d5c061271'
            'e4e2513801c7097fe9a391b481a48b1890f80e696549d8cf27884bd223a4cba9'
            '1fcd854678da773a1ef87d8e94da1d71604bc64f62d84bdd70339e2945480ebf')
noextract=($pkgname.tar.gz xbrz-$pkgver.zip)


# Replace /xbrz contents
# Apply makefile patch
prepare() {
  bsdtar -xf $pkgname.zip -s /$pkgname-$_commit/$pkgname/
  bsdtar -xf xbrz-$pkgver.zip -C "$pkgname"/xbrz 
 
  cd "$pkgname"
  patch -Np1 < "$srcdir/001-makefile.patch"
}


build() {
  cd "$pkgname"
  make
}


package() {
  cd "$pkgname"
  install -Dm 755 "$pkgname"         -t "$pkgdir/usr/bin"
  install -Dm 644 xbrz/Changelog.txt -t "$pkgdir/usr/share/doc/$pkgname"
}

Last edited by loqs (2020-11-06 04:53:55)

Offline

#14 2020-11-06 08:34:09

Stefan Husmann
Member
From: Germany
Registered: 2007-08-07
Posts: 1,138

Re: [SOLVED] PKGBUILD review request: xbrzscale

PeterBB wrote:

Added the quotes. I assume that is what you meant here.

exactly

Looks good now.

Offline

#15 2020-11-06 10:36:20

PeterBB
Member
Registered: 2014-11-06
Posts: 10

Re: [SOLVED] PKGBUILD review request: xbrzscale

eschwartz wrote:

The AUR policy *requires* you use a tag or commit, not a branch. Please fix this.

There are no tags here, and I did not know the syntax to specify a GitHub commit.
loqs has nailed it in post 13.

I'm using the following;
https://wiki.archlinux.org/index.php/Ar … guidelines
https://wiki.archlinux.org/index.php/PKGBUILD
https://wiki.archlinux.org/index.php/Creating_packages

Is there another important page?  I missed the bit about not using master.


PB

Offline

#16 2020-11-06 10:43:35

PeterBB
Member
Registered: 2014-11-06
Posts: 10

Re: [SOLVED] PKGBUILD review request: xbrzscale

# Maintainer: Peter blackman <peter at pblackman dot plus dot com>
# Build xbrzscale with latest version (1.8) of xbrz library

pkgname=xbrzscale
pkgver=1.8
pkgrel=1
pkgdesc="New Generation Image Upscaling Tool"
arch=('i686' 'x86_64' 'aarch64')
url="https://github.com/atheros/xbrzscale"
license=('GPL3')
depends=('sdl2_image')
_commit=b719c2c898edf464bfab727c44d21de5e7122fc4
source=("$pkgname.zip::https://github.com/atheros/xbrzscale/archive/$_commit.zip"
	"xbrz-$pkgver.zip::https://sourceforge.net/projects/xbrz/files/xBRZ/xBRZ_1.8.zip/download"
	001-makefile.patch)
sha256sums=('5195b2f44833411f6e413e138c84b3e9042ac69c346b1c896772a75d5c061271'
            'e4e2513801c7097fe9a391b481a48b1890f80e696549d8cf27884bd223a4cba9'
            '1fcd854678da773a1ef87d8e94da1d71604bc64f62d84bdd70339e2945480ebf')
noextract=($pkgname.zip xbrz-$pkgver.zip)


# Unpack source files
# Replace /xbrz contents
# Apply makefile patch
prepare() {
  bsdtar -xf $pkgname.zip -s /$pkgname-$_commit/$pkgname/
  bsdtar -xf xbrz-$pkgver.zip -C "$pkgname"/xbrz 

  cd "$pkgname"
  patch -Np1 < "$srcdir/001-makefile.patch"
}

build() {
  cd "$pkgname"
  make
}

package() {
  cd "$pkgname"
  install -Dm 755 "$pkgname"         -t "$pkgdir/usr/bin"
  install -Dm 644 xbrz/Changelog.txt -t "$pkgdir/usr/share/doc/$pkgname"
}

PB


edit

noextract=($pkgname.zip xbrz-$pkgver.zip)

Last edited by PeterBB (2020-11-06 10:51:03)

Offline

#17 2020-11-06 14:00:41

Scimmia
Bug Wrangler
Registered: 2012-09-01
Posts: 8,047

Re: [SOLVED] PKGBUILD review request: xbrzscale

PeterBB wrote:
Scimmia wrote:

grabbing a tarball of master is unacceptable. It need to grab a version specific tarball (zip file).

Can't find one to use. However, xbrz uses a versioned tarball, and should xbrzscale change, the checksum will fail.

Stop right there.

There are no versioned releases of this software! The pkgver you've got right now is completely wrong, then, you can't base the pkgver on the version of some *other* software. You need to read this: https://wiki.archlinux.org/index.php/VC … guidelines , even your pkgname is wrong in this case.

Offline

#18 2020-11-06 15:13:21

Scimmia
Bug Wrangler
Registered: 2012-09-01
Posts: 8,047

Re: [SOLVED] PKGBUILD review request: xbrzscale

Stefan Husmann wrote:
PeterBB wrote:

Added the quotes. I assume that is what you meant here.

exactly

Looks good now.

It looked good before, too, the quotes do nothing. The only issue would be consistency.

Offline

#19 2020-11-06 16:38:43

loqs
Member
Registered: 2014-03-06
Posts: 12,094

Re: [SOLVED] PKGBUILD review request: xbrzscale

Scimmia wrote:
PeterBB wrote:
Scimmia wrote:

grabbing a tarball of master is unacceptable. It need to grab a version specific tarball (zip file).

Can't find one to use. However, xbrz uses a versioned tarball, and should xbrzscale change, the checksum will fail.

Stop right there.

There are no versioned releases of this software! The pkgver you've got right now is completely wrong, then, you can't base the pkgver on the version of some *other* software. You need to read this: https://wiki.archlinux.org/index.php/VC … guidelines , even your pkgname is wrong in this case.

Could the lib xbrz be split out and dynamically linked to the application xbrzscale?

Offline

#20 2020-11-10 19:43:09

PeterBB
Member
Registered: 2014-11-06
Posts: 10

Re: [SOLVED] PKGBUILD review request: xbrzscale

Thanks for the responses, several useful suggestions.

Marking this 'solved'

Cheers,
Peter

Offline

Board footer

Powered by FluxBB