You are not logged in.
Hi everyone,
i have a issue with with one of the packages in the AUR that I'm maintaining im using this code as my pkgver function to get the newest build number from Jenkins and setting it as the pkgversion this works when im trying it localy on my computer but fails to work in the AUR.
pkgver() {
printf `wget -qO- https://ci.md-5.net/job/BungeeCord/lastSuccessfulBuild/buildNumber`
}
I would like to know how i would be able to fix this and what im doing wrong.
Cheers Johannes
Offline
pkgver happens after the source is downloaded, so I don't see how getting it remotely is useful.
Offline
Okay when im checking for updates there is no new update found even if there is a new version available (tried with yay pacman and pamac) but when i try to reinstall it finds and installs the newest version. sorry if im missing something im new to creating AUR packages.
Offline
Right, that sounds totally in line with what you've given. The pkgver function doesn't do what you seem to think it does.
Offline
How would i go around doing what i was trying to do or is that not possible.
Offline
You also cannot use a generated pkgver in the source array as the source is downloaded before the pkgver function is run. Your current work-around by using yet-another _pkgver variable will also fail on any system that does not already have wget installed as the PKGBUILD is parsed (and the call to wget in _pkgver is called) before the makedepends get checked / installed.
There also is no reason to force a dynamic source download to have a version number in the download name.
On a related point, the pkgname should end in -dev to indicate this is a dynamic download (like VCS PKGBUILDS).
Now to the original question, you can use bsdtar in the pkgver function to extract a version number from META-INF/MANIFEST.MF and avoid all of the above issues (except still needing to add -dev on the pkgname).
EDIT: I see -dev is not in the current guidelines - I think it used to be. But the pkgname should specify that it is a dynamic source and it isn't from a VCS system. I don't see guidelines for any specific fallback suffix. But I've used -dev before.
EDIT 2: tangential note, also remove the pkgname from the description.
Last edited by Trilby (2020-08-13 02:33:55)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
You can a script to update the PKGBUILD. In general, trying to it automatically like that would be inappropriate for the AUR
Offline
Okay thanks for the help gone fix that now. and gone try making a -dev package.
Offline
# Maintainer: Johannes Joens <johannes@joens.email>
pkgname=bungeecord
pkgver=1530
pkgrel=1
_pkgver=`wget -qO- https://ci.md-5.net/job/BungeeCord/lastSuccessfulBuild/buildNumber`
pkgdesc="BungeeCord is a sophisticated proxy and API designed mainly to teleport players between multiple Minecraft servers."
arch=('any')
url="https://www.spigotmc.org/"
license=('custom')
depends=('java-runtime-headless>=8' 'screen' 'sudo' 'bash' 'awk' 'sed')
optdepends=("tar: needed in order to create backups"
"netcat: required in order to suspend an idle server")
makedepends=('wget')
backup=('etc/conf.d/bungeecord')
install="${pkgname}.install"
source=("${pkgname}.${_pkgver}.jar"::"https://ci.md-5.net/job/BungeeCord/lastSuccessfulBuild/artifact/bootstrap/target/BungeeCord.jar"
"${pkgname}-backup.service"
"${pkgname}-backup.timer"
"${pkgname}.service"
"${pkgname}.conf"
"${pkgname}.sh"
"LICENSE"::"https://raw.githubusercontent.com/SpigotMC/BungeeCord/master/LICENSE")
noextract=("${pkgname}.${_pkgver}.jar")
sha512sums=('SKIP'
'ea8665bae278bbd2207ae3609f9164cd5d0fa31dcda12eba84754d6b2954b13d4f38ddf13646d2cb73bab151f5717882d848a275b0f4b60c6ccbad754d9bd757'
'803d9c85560060c7d655a5a232c59133200eb41127c6043c85c588548c1ed074234f66109475bde66109c5e299a6486ca7979714a2ca9a5122f7e3a40fcb14b8'
'e10652c20caca45d5e353328260ae40bc76b32d37289a21eea93636eb9e4828bb32948bb4eab5a5ebb97dd36dcd62b12e6ab17f49b7ff372111cb33217397aa5'
'ed20e42216c2f69cb7ac2bea5dcd7d39c82d2be52a86d8f6afe197518d299e97aaea3aaf041d4195a46b9ea2fec72b36433f725d5e05b39f0966e6b89158769b'
'54c9b1769a9eadb0834aaca22f36045a1a8c061a833bbc0b6a9fc05e361c2e281590c967f97679119d00daa1e962d8d768356641a3dea43ccf3cd922300b834a'
'SKIP')
pkgver() {
printf `wget -qO- https://ci.md-5.net/job/BungeeCord/lastSuccessfulBuild/buildNumber`
}
_game="${pkgname}"
_server_root="/srv/${pkgname}"
package() {
install -Dm644 ${_game}.conf "${pkgdir}/etc/conf.d/${_game}"
install -Dm755 ${_game}.sh "${pkgdir}/usr/bin/${_game}"
install -Dm644 ${_game}.service "${pkgdir}/usr/lib/systemd/system/${_game}.service"
install -Dm644 ${_game}-backup.service "${pkgdir}/usr/lib/systemd/system/${_game}-backup.service"
install -Dm644 ${_game}-backup.timer "${pkgdir}/usr/lib/systemd/system/${_game}-backup.timer"
install -Dm644 ${_game}.${_pkgver}.jar "${pkgdir}/${_server_root}/${_game}.${_pkgver}.jar"
ln -s "${_game}.${_pkgver}.jar" "${pkgdir}${_server_root}/${_game}_server.jar"
# Link the log files
mkdir -p "${pkgdir}/var/log/"
install -dm2755 "${pkgdir}/${_server_root}/logs"
ln -s "${_server_root}/logs" "${pkgdir}/var/log/${_game}"
# Give the group write permissions and set user or group ID on execution
chmod g+ws "${pkgdir}${_server_root}"
install -D ./LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
extra-x86_64-build
:: Synchronizing package databases...
core is up to date
extra is up to date
community is up to date
:: Starting full system upgrade...
there is nothing to do
==> Building in chroot for [extra] (x86_64)...
==> Synchronizing chroot copy [/var/lib/archbuild/extra-x86_64/root] -> [builduser]...done
==> Making package: bungeecord 1530-1 (Thu Aug 13 02:24:35 2020)
-> Downloading bungeecord.1530.jar...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 10.2M 100 10.2M 0 0 10.4M 0 --:--:-- --:--:-- --:--:-- 10.4M
-> Found bungeecord-backup.service
-> Found bungeecord-backup.timer
-> Found bungeecord.service
-> Found bungeecord.conf
-> Found bungeecord.sh
-> Downloading LICENSE...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1532 100 1532 0 0 5674 0 --:--:-- --:--:-- --:--:-- 5674
==> Validating source files with sha512sums...
bungeecord.1530.jar ... Skipped
bungeecord-backup.service ... Passed
bungeecord-backup.timer ... Passed
bungeecord.service ... Passed
bungeecord.conf ... Passed
bungeecord.sh ... Passed
LICENSE ... Skipped
/startdir/PKGBUILD: line 6: wget: command not found
==> Making package: bungeecord 1530-1 (Thu 13 Aug 2020 02:24:40)
==> Checking runtime dependencies...
==> Installing missing dependencies...
:: There are 3 providers available for java-runtime-headless>=8:
:: Repository extra
1) jre-openjdk-headless 2) jre11-openjdk-headless 3) jre8-openjdk-headless
Enter a number (default=1):
resolving dependencies...
looking for conflicting packages...
warning: dependency cycle detected:
warning: harfbuzz will be installed before its freetype2 dependency
Packages (13) freetype2-2.10.2-1 graphite-1:1.3.14-1 harfbuzz-2.7.0-1 java-runtime-common-3-3 lcms2-2.11-2 libjpeg-turbo-2.0.5-1 libnet-1:1.1.6-1 libpng-1.6.37-3 libtiff-4.1.0-2
nspr-4.27-1 nss-3.55-2 jre-openjdk-headless-14.0.2.u12-1 screen-4.8.0-1
Total Installed Size: 198.77 MiB
:: Proceed with installation? [Y/n]
(13/13) checking keys in keyring [####################################################################] 100%
(13/13) checking package integrity [####################################################################] 100%
(13/13) loading package files [####################################################################] 100%
(13/13) checking for file conflicts [####################################################################] 100%
:: Processing package changes...
( 1/13) installing java-runtime-common [####################################################################] 100%
For the complete set of Java binaries to be available in your PATH,
you need to re-login or source /etc/profile.d/jre.sh
Please note that this package does not support forcing JAVA_HOME as former package java-common did
( 2/13) installing nspr [####################################################################] 100%
( 3/13) installing nss [####################################################################] 100%
( 4/13) installing libjpeg-turbo [####################################################################] 100%
( 5/13) installing libtiff [####################################################################] 100%
Optional dependencies for libtiff
freeglut: for using tiffgt
( 6/13) installing lcms2 [####################################################################] 100%
( 7/13) installing libnet [####################################################################] 100%
( 8/13) installing libpng [####################################################################] 100%
( 9/13) installing graphite [####################################################################] 100%
(10/13) installing harfbuzz [####################################################################] 100%
Optional dependencies for harfbuzz
cairo: hb-view program
(11/13) installing freetype2 [####################################################################] 100%
(12/13) installing jre-openjdk-headless [####################################################################] 100%
Optional dependencies for jre-openjdk-headless
java-rhino: for some JavaScript support
(13/13) installing screen [####################################################################] 100%
:: Running post-transaction hooks...
(1/1) Updating the info directory file...
==> Checking buildtime dependencies...
==> Installing missing dependencies...
resolving dependencies...
looking for conflicting packages...
Packages (2) pcre2-10.35-1 wget-1.20.3-3
Total Installed Size: 6.78 MiB
:: Proceed with installation? [Y/n]
(2/2) checking keys in keyring [####################################################################] 100%
(2/2) checking package integrity [####################################################################] 100%
(2/2) loading package files [####################################################################] 100%
(2/2) checking for file conflicts [####################################################################] 100%
:: Processing package changes...
(1/2) installing pcre2 [####################################################################] 100%
(2/2) installing wget [####################################################################] 100%
Optional dependencies for wget
ca-certificates: HTTPS downloads [installed]
:: Running post-transaction hooks...
(1/1) Updating the info directory file...
==> Retrieving sources...
-> Downloading bungeecord..jar...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 10.2M 100 10.2M 0 0 10.7M 0 --:--:-- --:--:-- --:--:-- 10.7M
-> Found bungeecord-backup.service
-> Found bungeecord-backup.timer
-> Found bungeecord.service
-> Found bungeecord.conf
-> Found bungeecord.sh
-> Found LICENSE
==> WARNING: Skipping all source file integrity checks.
==> Extracting sources...
==> Starting pkgver()...
==> Entering fakeroot environment...
==> Starting package()...
install: cannot stat 'bungeecord.1530.jar': No such file or directory
==> ERROR: A failure occurred in package().
Aborting...
==> ERROR: Build failed, check /var/lib/archbuild/extra-x86_64/builduser/build
Using wget outside of any function which fails when not installed, leaving an unset variable so the source is downloaded again to bungeecord..jar, package then fails due to $_pkgver not matching $pkgver.
Also please use sysusers instead of groupadd / useradd.
Edit:
Beaten by Trilby.
Last edited by loqs (2020-08-13 02:52:41)
Offline
A -dev package is for development releases. Notice, releases, so it's not updated dynamically like a vcs package. You can't treat this that way.
Offline
Here's some excerpts that should help:
pkgname=bungeecord-dev
pkgdesc="A sophisticated proxy and API designed mainly to teleport players between multiple Minecraft servers."
source=("https://ci.md-5.net/job/BungeeCord/lastSuccessfulBuild/artifact/bootstrap/target/BungeeCord.jar" ...)
noextract=("BungeeCord.jar")
sha512sums=('SKIP' ...)
pkgver() {
bsdtar xOf BungeeCord.jar META-INF/MANIFEST.MF | sed -n 's/.* git:BungeeCord-Bootstrap:\([^:]*\).*/\1/p'
}
Note my pkgver extracts what looks like the actual version/revision number. The build number looks to be on the next line if that's really want you wanted to use.
But see Scimmia's comment above for the pkgname.
@Scimmia, what is a good generic suffix for a dynamic source that isn't git, mercurial, etc? Would -dynamic make sense? I'm surprised there isn't a standard for this. EDIT: there is precedent with "-nightly", and while I don't know if that really resembles the timecourse of the upstream changes for this project it might not be a bad option if all else fails.
Last edited by Trilby (2020-08-13 02:47:35)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Okay, updated the package to not use wget anymore or $_pkgver.
Edit: would realy like to know what ending i should use for this
Last edited by jopejoe1 (2020-08-13 03:03:30)
Offline
@Scimmia, what is a good generic suffix for a dynamic source that isn't git, mercurial, etc? Would -dynamic make sense? I'm surprised there isn't a standard for this. EDIT: there is precedent with "-nightly", and while I don't know if that really resembles the timecourse of the upstream changes for this project it might not be a bad option if all else fails.
That's a tough question.
What's a dynamic source that isn't git, mercurial, etc and actually makes sure the downloaded source is re-downloaded when it changes? Notably, the git, mercurial etc. download protocols fundamentally support downloading many versions, extracting the latest one, and "pull"ing recently uploaded versions into the existing cached source.
A dynamic PKGBUILD which updates itself while sourcing it in order to redefine the source=() download url is very different from a dynamic source=().
How exactly do "-nightly" PKGBUILDs sanely cope with this? I genuinely have no idea. I don't think I've run across them before.
Managing AUR repos The Right Way -- aurpublish (now a standalone tool)
Offline
Offline
A dynamic PKGBUILD which updates itself while sourcing it in order to redefine the source=() download url is very different from a dynamic source=().
The former is what the OP initially tried to do, but I doubt that could work at all and seems like a bad idea all around. I was simply asking about the pkgname for when there is a dynamic source. Your response highlighted another issue of repeated builds not pulling down changes if the previous download is already present - while important, that seems to be a different question: this is why VCS sources previously all needed to download their content in prepare() and why currently VCSs not supported by makepkg still do (e.g., fossil). So perhaps downloading the source for this in a prepare function may be the best way to address this secondary question.
But my curiosity was simply what should such a dynamic package be called. It should have a suffix indicating that it is a dynamic source, but none of the predefined ones fit.
Last edited by Trilby (2020-08-13 03:56:11)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline