You are not logged in.

#1 2019-08-07 12:49:34

archifer
Member
Registered: 2019-07-08
Posts: 49

[SOLVED] Grab the latest package version from the pool

I'm using PKGBUILD to grab a .deb package and convert to pkg.tar.xz

This is the beggining of the PKGBUILD

# NordVPN script

pkgname=nordvpn-bin
pkgver=3.2.0_2
pkgrel=1
pkgdesc="NordVPN CLI tool for Linux"
arch=('x86_64')
url="https://nordvpn.com/download/linux/"
license=('custom')
depends=('net-tools' 'libxslt' 'iptables' 'procps' 'iproute2')
provides=('nordvpn')
conflicts=('openvpn-nordvpn')
install=nordvpn-bin.install
source_x86_64=("https://repo.nordvpn.com/deb/nordvpn/debian/pool/main/nordvpn_${pkgver//_/-}_amd64.deb")
sha256sums_x86_64=('508722c2bb4943dad260ebbecd0af8d4d115330f55dbf2bc32f3b74a47f125a7')

package() {
    bsdtar -O -xf *.deb data.tar.xz | bsdtar -C "${pkgdir}" -xJf -

    mv "${pkgdir}/usr/sbin/nordvpnd" "${pkgdir}/usr/bin"
    rm -r "${pkgdir}/etc/init.d"
    rm -r "${pkgdir}/usr/sbin"
}

What my issue is it possible to point pkgver to download the latest package version instead of entering the package version manually? For example version in PKGBUILD pkgver=3.2.0_2 but 3.4.0 is available now in pool if I run makepkg it will grab 3.2.0_2 as it mentioned in PKGBUILD.

I'm trying to read through this https://wiki.archlinux.org/index.php/PKGBUILD#pkgver but obviously don't understand it.

Last edited by archifer (2019-12-12 11:44:15)

Offline

#2 2019-08-07 12:57:00

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,447
Website

Re: [SOLVED] Grab the latest package version from the pool

Please post the full PKGBUILD, nothing can be done with this excerpt.  You are referring to 3.2.0 and 3.4.0, but the url you provided only has a link for 1.0.0.

EDIT: I found it in the AUR.  The pool doesn't have any symlink for the latest version.  So what is it you want to download?  The PKGBUILD looks fine as it is.  Is there a problem?

Last edited by Trilby (2019-08-07 13:01:58)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2019-08-07 12:59:03

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,868

Re: [SOLVED] Grab the latest package version from the pool

looks like someone else already created that package, https://aur.archlinux.org/packages/nordvpn-bin


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#4 2019-08-07 13:03:16

archifer
Member
Registered: 2019-07-08
Posts: 49

Re: [SOLVED] Grab the latest package version from the pool

Trilby wrote:

Please post the full PKGBUILD, nothing can be done with this excerpt.  You are referring to 3.2.0 and 3.4.0, but the url you provided only has a link for 1.0.0.

EDIT: I found it in the AUR.  The pool doesn't have any symlink for the latest version.  So what is it you want to download?  The PKGBUILD looks fine as it is.  Is there a problem?

Added complete script

Offline

#5 2019-08-07 13:04:39

archifer
Member
Registered: 2019-07-08
Posts: 49

Re: [SOLVED] Grab the latest package version from the pool

Lone_Wolf wrote:

looks like someone else already created that package, https://aur.archlinux.org/packages/nordvpn-bin

Yes but I maintain it manually on my system because I receive in terminal notification that new version of NordVPN is availbale but it takes time in AUR to update it.

Offline

#6 2019-08-07 13:05:56

archifer
Member
Registered: 2019-07-08
Posts: 49

Re: [SOLVED] Grab the latest package version from the pool

Trilby wrote:

Please post the full PKGBUILD, nothing can be done with this excerpt.  You are referring to 3.2.0 and 3.4.0, but the url you provided only has a link for 1.0.0.

EDIT: I found it in the AUR.  The pool doesn't have any symlink for the latest version.  So what is it you want to download?  The PKGBUILD looks fine as it is.  Is there a problem?

I download it with the script from here https://repo.nordvpn.com/deb/nordvpn/debian/pool/main/

Offline

#7 2019-08-07 13:07:25

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,447
Website

Re: [SOLVED] Grab the latest package version from the pool

archifer wrote:

What my issue is it possible to point pkgver to download the latest package version instead of entering the package version manually?

Is there any algorithmic process by which the latest package version can be determined?  If not, makepkg is not magic.

It seems the only way to do this would be to download the pool index page, and parse/filter it to get the largest version number.  This would be completely inappropriate in a PKGBUILD.  Even if you did this, you'd then have to change the package name to end in -latest or similar and you'd have to get rid of checksums.

Why do you want to do this?  I suspect there is an X-Y question behind this.

EDIT: please use the edit button rather than posting several times in a row.

archifer wrote:

I maintain it manually on my system because I receive in terminal notification that new version of NordVPN is availbale but it takes time in AUR to update it.

And there is no magic pill to avoid this.  But it is trivial to update, you could even script the updates:

cd /path/to/wherever/package/is/
newver=$(curl -s https://repo.nordvpn.com/deb/nordvpn/debian/pool/main/ | sed -n '/href.*amd64/{s/[^_]*_\([^_]*\).*/\1/;x;};${x;p;}')
sed -i "s/pkgver=.*/pkgver=${newver}/" PKGBUILD
makepkg --printsrcinfo >| .SRCINFO
git commit -m "update to pkgver=${newver}"
git push

Last edited by Trilby (2019-08-07 13:15:06)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#8 2019-08-07 13:12:27

archifer
Member
Registered: 2019-07-08
Posts: 49

Re: [SOLVED] Grab the latest package version from the pool

Trilby wrote:
archifer wrote:

What my issue is it possible to point pkgver to download the latest package version instead of entering the package version manually?

Is there any algorithmic process by which the latest package version can be determined?  If not, makepkg is not magic.

It seems the only way to do this would be to download the pool index page, and parse/filter it to get the largest version number.  This would be completely inappropriate in a PKGBUILD.  Even if you did this, you'd then have to change the package name to end in -latest or similar and you'd have to get rid of checksums.

Why do you want to do this?  I suspect there is an X-Y question behind this.

I just would like it to download the latest version automatically without pointing the exact package version in PKGBUILD

Offline

#9 2019-08-07 13:12:59

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,466

Re: [SOLVED] Grab the latest package version from the pool

This is just for your personal usage, not for the AUR, right?

Just script it.

Online

#10 2019-08-07 13:18:26

archifer
Member
Registered: 2019-07-08
Posts: 49

Re: [SOLVED] Grab the latest package version from the pool

Scimmia wrote:

This is just for your personal usage, not for the AUR, right?

Just script it.

Yes I download it and compile it myself with this script on my system

Last edited by archifer (2019-08-07 13:18:47)

Offline

#11 2019-08-07 13:42:04

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,447
Website

Re: [SOLVED] Grab the latest package version from the pool

In that case, go ahead and put the parsing in the PKGBUILD:

pkgver=$(curl -s https://repo.nordvpn.com/deb/nordvpn/debian/pool/main/ | sed -n '/href.*amd64/{s/[^_]*_\([^_]*\).*/\1/;x;};${x;p;}')

"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#12 2019-08-07 14:06:34

archifer
Member
Registered: 2019-07-08
Posts: 49

Re: [SOLVED] Grab the latest package version from the pool

Trilby wrote:

In that case, go ahead and put the parsing in the PKGBUILD:

pkgver=$(curl -s https://repo.nordvpn.com/deb/nordvpn/debian/pool/main/ | sed -n '/href.*amd64/{s/[^_]*_\([^_]*\).*/\1/;x;};${x;p;}')

Could you point me out where should I place it? Because I receive

==> ERROR: pkgver is not allowed to contain colons, forward slashes, hyphens or whitespace.

Offline

#13 2019-08-07 14:48:53

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,447
Website

Re: [SOLVED] Grab the latest package version from the pool

Ah, right, that sed script gets both the version and release number - you'd need to split it into two in the PKGBUILD.  I can do that later if needed.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#14 2019-08-07 14:51:50

archifer
Member
Registered: 2019-07-08
Posts: 49

Re: [SOLVED] Grab the latest package version from the pool

Trilby wrote:

Ah, right, that sed script gets both the version and release number - you'd need to split it into two in the PKGBUILD.  I can do that later if needed.

Yes please. I would like to try it once you be able to provide it.

Offline

#15 2019-08-07 23:26:50

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,447
Website

Re: [SOLVED] Grab the latest package version from the pool

My first thought would be to split these into pkgver and pkgrel, but that'd be wrong: all of it goes into pkgver.  So just convert the hyphen into something else, e.g. 'r' for the upstream release number:

pkgver=$(curl -s https://repo.nordvpn.com/deb/nordvpn/debian/pool/main/ | sed -n '/href.*amd64/h;${g;s/[^_]*_\([^-]*\)-\([^_]*\).*/\1r\2/p;}')

"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#16 2019-08-08 10:06:50

archifer
Member
Registered: 2019-07-08
Posts: 49

Re: [SOLVED] Grab the latest package version from the pool

Trilby wrote:

My first thought would be to split these into pkgver and pkgrel, but that'd be wrong: all of it goes into pkgver.  So just convert the hyphen into something else, e.g. 'r' for the upstream release number:

pkgver=$(curl -s https://repo.nordvpn.com/deb/nordvpn/debian/pool/main/ | sed -n '/href.*amd64/h;${g;s/[^_]*_\([^-]*\)-\([^_]*\).*/\1r\2/p;}')

Thank you. Will try.

Offline

Board footer

Powered by FluxBB