You are not logged in.

#1 2018-07-30 06:47:28

Higlav
Member
Registered: 2016-12-09
Posts: 39

Review on my first package: Audiveris

Hello everyone,

I am currently a co-developer on the Audiveris project and noticed there isn't any package in the aur yet. So I thought I'd write my first aur PKGBUILD for it(I picked the latest 5.1 release - I'll add one for the current dev branch as well in the future). Currently, my code looks like this:

# Maintainer: Raphael Emberger <raphael.emberger@hotmail.ch>
# Contributor: Hervé Bitteur <herve.bitteur@audiveris.com>
pkgname=audiveris
pkgver=5.1.0_rc
pkgrel=1
pkgdesc="Music score OMR engine"
arch=('x86_64')
url="https://github.com/Audiveris/audiveris"
license=('AGPL3')
groups=()
depends=('java-runtime' 'java-environment' 'tesseract-data-eng' 'gradle')
makedepends=()
optdepends=('tesseract-data: For languages other than english')
provides=()
conflicts=('audiveris-git')
replaces=()
backup=()
options=()
install=
changelog=
source=(https://github.com/Audiveris/$pkgname/archive/${pkgver/_/-}.tar.gz)
noextract=()
sha256sums=('1ea51e880c1bb867708ac917801056dd25686389d354d4683eb7ee972811ee1d')

build() {
  cd "$pkgname-${pkgver/_/-}"
  sed -i "s/git rev-parse --short HEAD/echo $pkgver/g" build.gradle
  ./gradlew  distZip
  ./gradlew javadoc
}

package() {
  # Binaries and libraries
  tar -xf "$srcdir/$pkgname-${pkgver/_/-}/build/distributions/Audiveris.tar" \
    -C "$pkgdir"
  mv "$pkgdir/Audiveris" "$pkgdir/usr"
  mv "$pkgdir/usr/bin/Audiveris" "$pkgdir/usr/bin/audiveris"
  rm "$pkgdir/usr/bin/Audiveris.bat"

  # Javadoc
  install -dm644 "$pkgdir/usr/share/audiveris/doc"
  rsync -a "$srcdir/$pkgname-${pkgver/_/-}/build/docs/javadoc/" "$pkgdir/usr/share/audiveris/doc"
}

Now, I need your help: According to the Arch packaging standards I should stow the "binary"(.jar) into /usr/bin, the libraries into /usr/lib and the docs into /usr/share/doc/$pkgname. However, the startup script then would treat /usr as its home directory which I don't think is a good idea. Should I let it be as it is now or should I move everything into /usr/share/audiveris and make a symbolic link from /usr/bin/audiveris to /usr/share/audiveris/audiveris?
I also welcome any criticism regarding other aspects of my PKGBUILD.

Best regards

Last edited by Higlav (2018-07-30 07:37:14)

Offline

#2 2018-07-30 10:34:37

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

Re: Review on my first package: Audiveris

Those are the general guidelines, check Java package guidelines



A few comments* :

- remove empty fields (like groups=() )

- the audiveris site indicates this is an java 7 / java-8 application, thed epedncies should reflect that.

- don't conflict with a VCS version (audiveris-git) , let the vcs version confklict with the stable one.

* these are just the things i noticed in a quick check

Edits : typo

Last edited by Lone_Wolf (2018-07-30 10:36:02)


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

#3 2018-07-30 12:32:45

Higlav
Member
Registered: 2016-12-09
Posts: 39

Re: Review on my first package: Audiveris

Hello Lone_Wolf,

Thank you for your remarks - they were very helpful. I read through the wiki article and changed my PKGBUILD file according to your remarks and the guidelines in the article(I also found some errors):

# Maintainer: Raphael Emberger <raphael.emberger@hotmail.ch>
# Contributor: Hervé Bitteur <herve.bitteur@audiveris.com>
pkgname=audiveris
pkgver=5.1.0_rc
pkgrel=1
pkgdesc="Music score OMR engine"
arch=('x86_64')
url="https://github.com/Audiveris/audiveris"
license=('AGPL3')
depends=(
  'java-runtime>=7'
  'java-runtime<=8'
  'tesseract-data-eng'
)
makedepends=(
  'java-environment>=7'
  'java-environment<=8'
  'gradle'
)
optdepends=('tesseract-data: For languages other than english')
source=(https://github.com/Audiveris/$pkgname/archive/${pkgver/_/-}.tar.gz)
sha256sums=('1ea51e880c1bb867708ac917801056dd25686389d354d4683eb7ee972811ee1d')

build() {
  cd "$pkgname-${pkgver/_/-}"
  sed -i "s/git rev-parse --short HEAD/echo $pkgver/g" build.gradle
  ./gradlew  distZip
  ./gradlew javadoc
}

package() {
  # extract bundle
  tar -xf "$srcdir/$pkgname-${pkgver/_/-}/build/distributions/Audiveris.tar" \
    -C "$pkgdir"

  # libraries
  install -dm755 "$pkgdir/usr/share/java"
  mv "$pkgdir/Audiveris/lib" "$pkgdir/usr/share/java/audiveris"
  
  # start script
  install -dm755 "$pkgdir/usr/bin"
  cat > "$pkgdir/usr/bin/audiveris" <<eof
#!/bin/sh
for name in /usr/share/java/audiveris/*.jar ; do
  CP="\$CP:\$name"
done
exec /usr/bin/java -cp "\${CP:1:\${#CP}}" Audiveris "\$@"
exit \$?
eof
  chmod +x "$pkgdir/usr/bin/audiveris"

  # Javadoc
  install -dm644 "$pkgdir/usr/share/doc/audiveris"
  rsync -a "$srcdir/$pkgname-${pkgver/_/-}/build/docs/javadoc/" "$pkgdir/usr/share/doc/audiveris"

  # clean up
  rm -r "$pkgdir/Audiveris"
}

I'm not sure if specifying ">=7" and "<=8" for java does the trick, but idk how else I could narrow down the version range.

Offline

#4 2018-07-30 18:48:26

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

Re: Review on my first package: Audiveris

That's how you specify revision ranges, yes.

BTW, see the PKGBUILD(5) description of source=() and specifically see:

It is also possible to change the name of the downloaded file, which is helpful with weird URLs and for handling multiple source files
           with the same name. The syntax is: source=('filename::url').

Since the current source url will download a file "5.1.0-rc.tar.gz" which does not play nice with shared $SRCDEST if other packages have the same pkgver, you should explicitly rename the filename to e.g. $pkgname-${pkgver/_/-}.tar.gz::remoteurl

This is necessary, because makepkg does not respect the Content-Disposition header github uses to rename the file... makepkg needs to know what the filename is expected to be without pinging the server every time.

IIRC java programs should be able to run the same binary products on both i686 and x86_64, this would mean the arch should be "any". Alternatively, you should not package architecture-dependent files in /usr/share, but rather in /usr/lib

You use rsync to do file copying, when cp should really be able to do just fine on its own. This is an issue since rsync may not be installed and you don't specify it in makedepends...

You can use --exclude to prevent tar from extracting some files instead of rm'ing them later. BTW you could use bsdtar instead of tar -- they are both in the base group, but bsdtar is the command-line frontend to libarchive which has the advantage of being used in pacman itself  and makepkg uses bsdtar internally.

Also: why are you going to rather clumsy lengths to embed your launcher script in a bash heredoc? Just add the actual file to source+=("audiveris.sh"), and commit it to the AUR together with the PKGBUILD.
Better yet, maybe you could add the file to the upstream repository and write some installation instructions for Linux integration, to aid other distributions in case they wish to package it too. smile


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

Offline

#5 2018-07-31 11:39:29

Higlav
Member
Registered: 2016-12-09
Posts: 39

Re: Review on my first package: Audiveris

Hello Eschwartz,

Thank you for your response. I followed your advises and adjusted the script further. However: The application has to be x86_64, because deeplearning4j only supports 64bit architectures. Also: I don't understand why I should move the architecture-dependent libraries to /usr/lib instead of /usr/share/java/$pkgname, because the latter is the one described by the java package guidelines.

PKGBUILD:

# Maintainer: Raphael Emberger <raphael.emberger@hotmail.ch>
# Contributor: Hervé Bitteur <herve.bitteur@audiveris.com>
pkgname=audiveris
pkgver=5.1.0_rc
pkgrel=1
pkgdesc="Music score OMR engine"
arch=('x86_64')
url="https://github.com/Audiveris/audiveris"
license=('AGPL3')
depends=(
  'java-runtime>=7'
  'java-runtime<=8'
  'tesseract-data-eng'
)
makedepends=(
  'java-environment>=7'
  'java-environment<=8'
  'gradle'
)
optdepends=('tesseract-data: For languages other than english')
source=(
  "$pkgname-${pkgver/_/-}.tar.gz::https://github.com/Audiveris/$pkgname/archive/${pkgver/_/-}.tar.gz"
  "$pkgname"
)
sha256sums=(
  '1ea51e880c1bb867708ac917801056dd25686389d354d4683eb7ee972811ee1d'
  '1ca2821022510b9da4a41d4b0cb5c6511a68644495de89c628ae027cf1291b39'
)

build() {
  cd "$srcdir/$pkgname-${pkgver/_/-}"
  sed -i "s/git rev-parse --short HEAD/echo $pkgver/g" build.gradle
  ./gradlew build
  ./gradlew javadoc
}

package() {
  # extract libraries
  install -dm755 "$pkgdir/usr/share/java/$pkgname"
  bsdtar -C "$pkgdir/usr/share/java/$pkgname" --strip-components=2 \
    -xf "$srcdir/$pkgname-${pkgver/_/-}/build/distributions/Audiveris.tar" \
    Audiveris/lib/*
  
  # start script
  install -Dm755 "$srcdir/$pkgname" "$pkgdir/usr/bin/$pkgname"

  # Javadoc
  install -dm755 "$pkgdir/usr/share/doc"
  cp -r "$srcdir/$pkgname-${pkgver/_/-}/build/docs/javadoc" "$pkgdir/usr/share/doc/$pkgname"
}

audiveris:

#!/bin/sh
for name in /usr/share/java/audiveris/*.jar ; do
  CP="$CP:$name"
done
exec /usr/bin/java -cp "${CP:1:${#CP}}" Audiveris "$@"
exit $?

I think this should be acceptable now. If there are no more problems, I'll upload it to the aur.

Offline

#6 2018-07-31 15:03:49

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

Re: Review on my first package: Audiveris

Nope, not ready yet.

When building without a ~/.gradle folder present, the "./gradlew build" downloads an older binary version of gradle and installs under ~/.gradle .

An archlinux PKGBUILD shouid never touch user folders.


Downloading https://services.gradle.org/distributions/gradle-4.6-bin.zip
......................................................................
Unzipping /home/panoramix/.gradle/wrapper/dists/gradle-4.6-bin/4jp4stjndanmxuerzfseyb6wo/gradle-4.6-bin.zip to /home/panoramix/.gradle/wrapper/dists/gradle-4.6-bin/4jp4stjndanmxuerzfseyb6wo
Set executable permissions for: /home/panoramix/.gradle/wrapper/dists/gradle-4.6-bin/4jp4stjndanmxuerzfseyb6wo/gradle-4.6/bin/gradle
Starting a Gradle Daemon, 1 stopped Daemon could not be reused, use --status for details
targetOS=linux-x86_64
:git_build
:generateProgramId
:compileJava
Download https://jcenter.bintray.com/org/slf4j/slf4j-api/1.7.21/slf4j-api-1.7.21.pom
Download https://jcenter.bintray.com/ch/qos/logback/logback-classic/1.1.7/logback-classic-1.1.7.pom
Download https://jcenter.bintray.com/com/jgoodies/jgoodies-looks/2.7.0/jgoodies-looks-2.7.0.pom
Download https://jcenter.bintray.com/net/jcip/jcip-annotations/1.0/jcip-annotations-1.0.pom
Download https://jcenter.bintray.com/args4j/args4j/2.33/args4j-2.33.pom
Download https://jcenter.bintray.com/org/bushe/eventbus/1.4/eventbus-1.4.pom
Download https://jcenter.bintray.com/com/jgoodies/jgoodies-forms/1.9.0/jgoodies-forms-1.9.0.pom
Download https://jcenter.bintray.com/org/jdesktop/bsaf/bsaf/1.9.2/bsaf-1.9.2.pom
Download https://jcenter.bintray.com/org/slf4j/slf4j-parent/1.7.21/slf4j-parent-1.7.21.pom
Download https://jcenter.bintray.com/ch/qos/logback/logback-parent/1.1.7/logback-parent-1.1.7.pom
Download https://jcenter.bintray.com/args4j/args4j-site/2.33/args4j-site-2.33.pom
Download https://jcenter.bintray.com/net/imagej/ij/1.51f/ij-1.51f.pom
Download https://jcenter.bintray.com/de/intarsys/opensource/jPodRenderer/5.6/jPodRenderer-5.6.pom
Download https://jcenter.bintray.com/org/kohsuke/pom/14/pom-14.pom
Download https://jcenter.bintray.com/org/audiveris/proxymusic/3.0.1/proxymusic-3.0.1.pom
Download https://jcenter.bintray.com/org/jgrapht/jgrapht-core/1.0.1/jgrapht-core-1.0.1.pom
Download https://jcenter.bintray.com/org/jfree/jfreechart/1.0.19/jfreechart-1.0.19.pom
Download https://jcenter.bintray.com/gov/nist/math/jama/1.0.3/jama-1.0.3.pom
Download https://jcenter.bintray.com/org/reflections/reflections/0.9.10/reflections-0.9.10.pom
Download https://jcenter.bintray.com/org/sonatype/oss/oss-parent/9/oss-parent-9.pom
Download https://jcenter.bintray.com/net/imagej/pom-imagej/16.0.0/pom-imagej-16.0.0.pom
Download https://jcenter.bintray.com/org/bytedeco/javacpp/1.3/javacpp-1.3.pom
Download https://jcenter.bintray.com/org/jgrapht/jgrapht/1.0.1/jgrapht-1.0.1.pom
Download https://jcenter.bintray.com/com/github/jai-imageio/jai-imageio-core/1.3.1/jai-imageio-core-1.3.1.pom
Download https://jcenter.bintray.com/org/bytedeco/javacpp-presets/tesseract/3.04.01-1.3/tesseract-3.04.01-1.3.pom
Download https://jcenter.bintray.com/org/apache/directory/studio/org.apache.commons.io/2.4/org.apache.commons.io-2.4.pom
Download https://jcenter.bintray.com/org/scijava/pom-scijava/11.0.0/pom-scijava-11.0.0.pom
Download https://jcenter.bintray.com/org/apache/directory/studio/parent-libraries/2.0.0.v20130125/parent-libraries-2.0.0.v20130125.pom
Download https://jcenter.bintray.com/javax/media/jai-core/1.1.3/jai-core-1.1.3.pom
Download https://jcenter.bintray.com/org/projectlombok/lombok/1.16.20/lombok-1.16.20.pom
Download https://jcenter.bintray.com/org/bytedeco/javacpp-presets/1.3/javacpp-presets-1.3.pom
Download https://jcenter.bintray.com/org/apache/directory/studio/parent/2.0.0.v20130125/parent-2.0.0.v20130125.pom
Download https://jcenter.bintray.com/org/apache/directory/project/project/27/project-27.pom
Download https://jcenter.bintray.com/com/itextpdf/itextpdf/5.5.9/itextpdf-5.5.9.pom
Download https://jcenter.bintray.com/com/itextpdf/itext-parent/1.0.0/itext-parent-1.0.0.pom
Download https://jcenter.bintray.com/org/bytedeco/javacpp-presets/leptonica/1.73-1.3/leptonica-1.73-1.3.pom
Download https://jcenter.bintray.com/ch/qos/logback/logback-core/1.1.7/logback-core-1.1.7.pom
Download https://jcenter.bintray.com/com/jgoodies/jgoodies-common/1.8.1/jgoodies-common-1.8.1.pom
Download https://jcenter.bintray.com/de/intarsys/opensource/isrt/4.11/isrt-4.11.pom
Download https://jcenter.bintray.com/de/intarsys/opensource/jPod/5.6/jPod-5.6.pom
Download https://jcenter.bintray.com/javax/media/jai/com.springsource.javax.media.jai.core/1.1.3/com.springsource.javax.media.jai.core-1.1.3.pom
Download https://jcenter.bintray.com/de/intarsys/opensource/jPodFonts/5.5/jPodFonts-5.5.pom
Download https://jcenter.bintray.com/de/intarsys/opensource/iscwt/5.6/iscwt-5.6.pom
Download https://jcenter.bintray.com/org/jfree/jcommon/1.0.23/jcommon-1.0.23.pom
Download https://jcenter.bintray.com/com/google/code/findbugs/annotations/2.0.1/annotations-2.0.1.pom
Download https://jcenter.bintray.com/org/javassist/javassist/3.18.2-GA/javassist-3.18.2-GA.pom
Download https://jcenter.bintray.com/com/google/guava/guava/18.0/guava-18.0.pom
Download https://jcenter.bintray.com/com/google/guava/guava-parent/18.0/guava-parent-18.0.pom
Download https://jcenter.bintray.com/de/intarsys/opensource/isfreetype/5.6/isfreetype-5.6.pom
Download https://jcenter.bintray.com/de/intarsys/opensource/jbig2/5.5.1/jbig2-5.5.1.pom
Download https://jcenter.bintray.com/javax/media/jai/com.springsource.javax.media.jai.codec/1.1.3/com.springsource.javax.media.jai.codec-1.1.3.pom
Download https://jcenter.bintray.com/de/intarsys/opensource/isnativec/5.6/isnativec-5.6.pom
Download https://jcenter.bintray.com/net/java/dev/jna/jna/3.2.7/jna-3.2.7.pom
Download https://jcenter.bintray.com/org/slf4j/slf4j-api/1.7.21/slf4j-api-1.7.21.jar
Download https://jcenter.bintray.com/args4j/args4j/2.33/args4j-2.33.jar
Download https://jcenter.bintray.com/net/jcip/jcip-annotations/1.0/jcip-annotations-1.0.jar
Download https://jcenter.bintray.com/org/bushe/eventbus/1.4/eventbus-1.4.jar
Download https://jcenter.bintray.com/org/jdesktop/bsaf/bsaf/1.9.2/bsaf-1.9.2.jar
Download https://jcenter.bintray.com/ch/qos/logback/logback-classic/1.1.7/logback-classic-1.1.7.jar
Download https://jcenter.bintray.com/org/audiveris/proxymusic/3.0.1/proxymusic-3.0.1.jar
Download https://jcenter.bintray.com/javax/media/jai-core/1.1.3/jai-core-1.1.3.jar
Download https://jcenter.bintray.com/org/jfree/jfreechart/1.0.19/jfreechart-1.0.19.jar
Download https://jcenter.bintray.com/net/imagej/ij/1.51f/ij-1.51f.jar
Download https://jcenter.bintray.com/de/intarsys/opensource/jPodRenderer/5.6/jPodRenderer-5.6.jar
Download https://jcenter.bintray.com/com/itextpdf/itextpdf/5.5.9/itextpdf-5.5.9.jar
Download https://jcenter.bintray.com/org/jgrapht/jgrapht-core/1.0.1/jgrapht-core-1.0.1.jar
Download https://jcenter.bintray.com/com/jgoodies/jgoodies-looks/2.7.0/jgoodies-looks-2.7.0.jar
Download https://jcenter.bintray.com/gov/nist/math/jama/1.0.3/jama-1.0.3.jar
Download https://jcenter.bintray.com/org/reflections/reflections/0.9.10/reflections-0.9.10.jar
Download https://jcenter.bintray.com/org/bytedeco/javacpp-presets/tesseract/3.04.01-1.3/tesseract-3.04.01-1.3.jar
Download https://jcenter.bintray.com/org/bytedeco/javacpp-presets/leptonica/1.73-1.3/leptonica-1.73-1.3.jar
Download https://jcenter.bintray.com/org/bytedeco/javacpp/1.3/javacpp-1.3.jar
Download https://jcenter.bintray.com/org/apache/directory/studio/org.apache.commons.io/2.4/org.apache.commons.io-2.4.jar
Download https://jcenter.bintray.com/com/github/jai-imageio/jai-imageio-core/1.3.1/jai-imageio-core-1.3.1.jar
Download https://jcenter.bintray.com/org/projectlombok/lombok/1.16.20/lombok-1.16.20.jar
Download https://jcenter.bintray.com/ch/qos/logback/logback-core/1.1.7/logback-core-1.1.7.jar
Download https://jcenter.bintray.com/com/jgoodies/jgoodies-common/1.8.1/jgoodies-common-1.8.1.jar
Download https://jcenter.bintray.com/de/intarsys/opensource/jPod/5.6/jPod-5.6.jar
Download https://jcenter.bintray.com/de/intarsys/opensource/iscwt/5.6/iscwt-5.6.jar
Download https://jcenter.bintray.com/de/intarsys/opensource/isrt/4.11/isrt-4.11.jar
Download https://jcenter.bintray.com/de/intarsys/opensource/isfreetype/5.6/isfreetype-5.6.jar
Download https://jcenter.bintray.com/javax/media/jai/com.springsource.javax.media.jai.codec/1.1.3/com.springsource.javax.media.jai.codec-1.1.3.jar
Download https://jcenter.bintray.com/javax/media/jai/com.springsource.javax.media.jai.core/1.1.3/com.springsource.javax.media.jai.core-1.1.3.jar
Download https://jcenter.bintray.com/com/google/guava/guava/18.0/guava-18.0.jar
Download https://jcenter.bintray.com/org/jfree/jcommon/1.0.23/jcommon-1.0.23.jar
Download https://jcenter.bintray.com/de/intarsys/opensource/jPodFonts/5.5/jPodFonts-5.5.jar
Download https://jcenter.bintray.com/org/javassist/javassist/3.18.2-GA/javassist-3.18.2-GA.jar
Download https://jcenter.bintray.com/com/google/code/findbugs/annotations/2.0.1/annotations-2.0.1.jar
Download https://jcenter.bintray.com/de/intarsys/opensource/jbig2/5.5.1/jbig2-5.5.1.jar
Download https://jcenter.bintray.com/de/intarsys/opensource/isnativec/5.6/isnativec-5.6.jar
Download https://jcenter.bintray.com/net/java/dev/jna/jna/3.2.7/jna-3.2.7.jar
Download https://jcenter.bintray.com/com/jgoodies/jgoodies-forms/1.9.0/jgoodies-forms-1.9.0.jar
warning: [options] bootstrap class path not set in conjunction with -source 1.7
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
:processResources
:classes
:jar
:startScripts
Download https://jcenter.bintray.com/org/bytedeco/javacpp-presets/leptonica/1.73-1.3/leptonica-1.73-1.3-linux-x86_64.jar
Download https://jcenter.bintray.com/org/bytedeco/javacpp-presets/tesseract/3.04.01-1.3/tesseract-3.04.01-1.3-linux-x86_64.jar
:distTar
:distZip
:assemble
:compileTestJava
Download https://jcenter.bintray.com/org/jgrapht/jgrapht-ext/1.0.1/jgrapht-ext-1.0.1.pom
Download https://jcenter.bintray.com/junit/junit/4.10/junit-4.10.pom
Download https://jcenter.bintray.com/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1.pom
Download https://jcenter.bintray.com/org/hamcrest/hamcrest-parent/1.1/hamcrest-parent-1.1.pom
Download https://jcenter.bintray.com/org/tinyjee/jgraphx/jgraphx/2.0.0.1/jgraphx-2.0.0.1.pom
Download https://jcenter.bintray.com/jgraph/jgraph/5.13.0.0/jgraph-5.13.0.0.pom
Download https://jcenter.bintray.com/org/antlr/antlr4-runtime/4.5.3/antlr4-runtime-4.5.3.pom
Download https://jcenter.bintray.com/org/antlr/antlr4-master/4.5.3/antlr4-master-4.5.3.pom
Download https://jcenter.bintray.com/org/jgrapht/jgrapht-ext/1.0.1/jgrapht-ext-1.0.1.jar
Download https://jcenter.bintray.com/junit/junit/4.10/junit-4.10.jar
Download https://jcenter.bintray.com/org/tinyjee/jgraphx/jgraphx/2.0.0.1/jgraphx-2.0.0.1.jar
Download https://jcenter.bintray.com/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1.jar
Download https://jcenter.bintray.com/jgraph/jgraph/5.13.0.0/jgraph-5.13.0.0.jar
Download https://jcenter.bintray.com/org/antlr/antlr4-runtime/4.5.3/antlr4-runtime-4.5.3.jar
warning: [options] bootstrap class path not set in conjunction with -source 1.7
:processTestResources NO-SOURCE
:testClasses
:test
:check
:build

BUILD SUCCESSFUL in 1m 11s
10 actionable tasks: 10 executed
targetOS=linux-x86_64
:git_build
:generateProgramId
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:javadoc/home/panoramix/Temp/test/audiveris/src/audiveris-5.1.0-rc/src/main/org/audiveris/omr/classifier/BasicClassifier.java:356: warning: no description for @throws
     * @throws Exception
       ^
/home/panoramix/Temp/test/audiveris/src/audiveris-5.1.0-rc/src/main/org/audiveris/omr/classifier/BasicClassifier.java:422: warning: no description for @throws
     * @throws Exception
       ^
/home/panoramix/Temp/test/audiveris/src/audiveris-5.1.0-rc/src/main/org/audiveris/omr/math/PoorManAlgebra.java:199: warning: no description for @throws
         * @throws IOException
           ^
/home/panoramix/Temp/test/audiveris/src/audiveris-5.1.0-rc/src/main/org/audiveris/omr/math/PoorManAlgebra.java:223: warning: no description for @throws
         * @throws IOException
           ^

4 warnings

BUILD SUCCESSFUL in 32s
5 actionable tasks: 3 executed, 2 up-to-date

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

#7 2018-07-31 15:16:53

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

Re: Review on my first package: Audiveris

Higlav wrote:

Hello Eschwartz,

Thank you for your response. I followed your advises and adjusted the script further. However: The application has to be x86_64, because deeplearning4j only supports 64bit architectures. Also: I don't understand why I should move the architecture-dependent libraries to /usr/lib instead of /usr/share/java/$pkgname, because the latter is the one described by the java package guidelines.

No especial reason. Essentially you're saying that the libraries are *not* architecture-dependent, and belong in /usr/share/, but you're specifying arch=('x86_64') because the code won't run on other architectures for reasons completely unrelated to the ELF binary format...

I suppose in this case your way makes sense.

audiveris:

#!/bin/sh
for name in /usr/share/java/audiveris/*.jar ; do
  CP="$CP:$name"
done
exec /usr/bin/java -cp "${CP:1:${#CP}}" Audiveris "$@"
exit $?

I think this should be acceptable now. If there are no more problems, I'll upload it to the aur.

I'd make the minor nitpick that it's pointless to "exit $?" in a shellscript right after you used exec, since nothing after the exec will ever run (and, since exec replaces the shell script with the java command, the exit code of /usr/bin/audiveris will come directly from java instead of requiring you to manually exit $?).

On top of which, a shell script which does not use exit $? will still exit with the return code of the last command run, so exit $? is only ever needed if you are doing some looping/branching construct that conditionally requires you to exit early.


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

Offline

#8 2018-07-31 15:21:52

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

Re: Review on my first package: Audiveris

Using systemwide gradle in the PKGBUILD works much better.

gradle build
gradle javadoc

minor issues :
-  the sed line changes the sourcecode and should not be in build() but in a prepare() function.

- Are your contact details "Raphael Emberger <raphael.emberger@hotmail.ch>"  ?
If so, you might want to add a note giving your aur / forum account name to avoid confusion.


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

#9 2018-07-31 15:22:50

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

Re: Review on my first package: Audiveris

Lone_Wolf wrote:

Nope, not ready yet.

When building without a ~/.gradle folder present, the "./gradlew build" downloads an older binary version of gradle and installs under ~/.gradle .

An archlinux PKGBUILD shouid never touch user folders.

So, I googled this "gradlew" thing, and it appears that it is explicitly a thing that is used to download a prebuilt gradle binary and use that as a drop-in replacement for, like, the actual /usr/bin/gradle command.

So, I guess that makes "sense". It's also unpleasant to not use the system gradle for undefined reasons, and doubly silly for the makedepends on a thing which is never used...


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

Offline

#10 2018-07-31 15:38:08

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

Re: Review on my first package: Audiveris

The audiveris wiki https://github.com/Audiveris/audiveris/ … stallation has more details about setting up things, should have checked it sooner.


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

#11 2018-08-01 07:25:54

Higlav
Member
Registered: 2016-12-09
Posts: 39

Re: Review on my first package: Audiveris

Hello you two,

Thank you for your help. This is what I've done so far:

  • I replaced the use of ./gradlew with the actual package gradle. Should I try out different versions of gradle to see which version has to be installed at minimum?

  • Got rid of the redundant exit $? in the starter script.

  • I did not move the sed-line to package, since I need to alter that specific line in order to successfully compile. The reason being that the build command normally takes the current commit hash of the repository(which isn't a git repo anymore after downloading the plain sourcecode) to store it in a generated java file in build/generated-src/org/audiveris/omr/ProgramId.java. I used to just replace that function with an echo command to just return the package version. But after a second consideration, I replaced that with the commit hash of the release instead.

  • I added my aur user name to the header.

This is the current version:

PKGBUILD:

# Maintainer: Raphael Emberger(raember) <raphael.emberger@hotmail.ch>
# Contributor: Hervé Bitteur <herve.bitteur@audiveris.com>
pkgname=audiveris
pkgver=5.1.0_rc
pkgrel=1
pkgdesc="Music score OMR engine"
arch=('x86_64')
url="https://github.com/Audiveris/audiveris"
license=('AGPL3')
depends=(
  'java-runtime>=7'
  'java-runtime<=8'
  'tesseract-data-eng'
)
makedepends=(
  'java-environment>=7'
  'java-environment<=8'
  'gradle'
)
optdepends=('tesseract-data: For languages other than english')
source=(
  "$pkgname-${pkgver/_/-}.tar.gz::https://github.com/Audiveris/$pkgname/archive/${pkgver/_/-}.tar.gz"
  "$pkgname"
)
sha256sums=(
  '1ea51e880c1bb867708ac917801056dd25686389d354d4683eb7ee972811ee1d'
  'c697bdc3ff8b6c6e0efc273778f470e26971f250eeab89208688cf2dd2ef0517'
)

build() {
  cd "$srcdir/$pkgname-${pkgver/_/-}"
  sed -i "s/git rev-parse --short HEAD/echo '0bf68268962228f6993c52e77349fc44e7c17162'/g" build.gradle
  gradle build javadoc
}

package() {
  # extract libraries
  install -dm755 "$pkgdir/usr/share/java/$pkgname"
  bsdtar -C "$pkgdir/usr/share/java/$pkgname" --strip-components=2 \
    -xf "$srcdir/$pkgname-${pkgver/_/-}/build/distributions/Audiveris.tar" \
    Audiveris/lib/*
  
  # start script
  install -Dm755 "$srcdir/$pkgname" "$pkgdir/usr/bin/$pkgname"

  # Javadoc
  install -dm755 "$pkgdir/usr/share/doc"
  cp -r "$srcdir/$pkgname-${pkgver/_/-}/build/docs/javadoc" "$pkgdir/usr/share/doc/$pkgname"
}

audiveris:

#!/bin/sh
for name in /usr/share/java/audiveris/*.jar ; do
  CP="$CP:$name"
done
exec /usr/bin/java -cp "${CP:1:${#CP}}" Audiveris "$@"

Offline

#12 2018-08-01 16:42:55

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

Re: Review on my first package: Audiveris

Higlav wrote:

I replaced the use of ./gradlew with the actual package gradle. Should I try out different versions of gradle to see which version has to be installed at minimum?

Unlikely to be necessary, since Arch Linux does not support old versions of gradle or anything else. smile

I did not move the sed-line to package, since I need to alter that specific line in order to successfully compile. The reason being that the build command normally takes the current commit hash of the repository(which isn't a git repo anymore after downloading the plain sourcecode) to store it in a generated java file in build/generated-src/org/audiveris/omr/ProgramId.java. I used to just replace that function with an echo command to just return the package version. But after a second consideration, I replaced that with the commit hash of the release instead.

The logic behind doing this in prepare vs build, is that:

  • prepare() is meant for things like applying patches, running autoreconf, and other things which modify the source code into a state where it is suitable to be compiled, and should be considered to go along with the tarball extraction itself

  • build() is meant for the actual compilation process itself, or things which don't modify the source code but set options specific to this build, which should be run every time the PKGBUILD is run, for example, cmake, meson, ./configure invocations as well as the `make` command

It would indeed be "more proper" to do it in prepare(). Although this is usually more of a concern for things which are not idempotent, and will actually cause errors if used in build() and the user runs `makepkg --nobuild` once to prepare the build, then runs `makepkg --noextract` multiple times to run the build (perhaps they used CTRL+C halfway through and wish to continue).

Last edited by eschwartz (2018-08-01 16:53:45)


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

Offline

#13 2018-08-01 16:49:08

Higlav
Member
Registered: 2016-12-09
Posts: 39

Re: Review on my first package: Audiveris

Hello Eschwartz,

My bad, I read "package" instead of "prepare". I'll move the sed command into prepare() then.
Anything else I should take care of?

Cheers

Offline

#14 2018-08-02 13:01:27

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

Re: Review on my first package: Audiveris

Arch linux has it's own mechanism , archlinux-java to handle several installed java versions.
Basically it symlinks /usr/bin/java to the appropriate java program in /usr/lib/jvm/ .

If the default version set by the user is java 7 or java 8 everything should work fine.

Now suppose the default is set for a not-supported java version like 10.
What happens then ?

I have no idea and suggest you try it out.


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

#15 2018-08-02 13:31:22

Higlav
Member
Registered: 2016-12-09
Posts: 39

Re: Review on my first package: Audiveris

Hello Lone_Wolf,

I forgot about that possibility. But the user should handle things like that by himself. The only thing I can do is to warn him: I'll just archlinux-java get | egrep '7|8' and if it fails, I warn the user during prepare() about his conflicting setup.

Offline

#16 2018-08-02 14:43:05

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

Re: Review on my first package: Audiveris

It's fairly typical for Arch packages to just let the package dependencies speak for themselves. Looking at the package dependencies when a package does not work, would tend to clarify things (and it's usually sufficient to enforce that the right version is at least installed).

That being said, you could move that check into the audiveris script itself, since the script is already used exclusively by the Arch package, and abort if the wrong java version is set instead of trying to run unsuccessfully.

Last edited by eschwartz (2018-08-02 14:43:46)


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

Offline

#17 2018-08-02 14:59:57

Higlav
Member
Registered: 2016-12-09
Posts: 39

Re: Review on my first package: Audiveris

Hi,

Yes, that sounds like a fairly good idea. I'll incorporate that into the starter script then.
BTW: I already pushed a first version of both audiveris and audiveris-git to the AUR. I made the git version conflict with the release version as advised before. Here are the two repositories: audiveris and audiveris-git.

Offline

#18 2018-08-02 15:38:48

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

Re: Review on my first package: Audiveris

If anything ever depends on the audiveris package, then having audiveris-git should probably be okay too, right? So for -git packages, you typically want to list both provides and conflicts, so that it acts as a drop-in replacement.

Also, the pkgver() function for the git version could use git describe, see the different options at https://wiki.archlinux.org/index.php/VC … elines#Git

(version 5.1.0.rc.r0.g0bf682689 vs r4133.0bf682689, which do you think is easier to make use of big_smile)

Last edited by eschwartz (2018-08-02 15:39:47)


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

Offline

#19 2018-08-02 16:13:27

Higlav
Member
Registered: 2016-12-09
Posts: 39

Re: Review on my first package: Audiveris

Fair enough. I'll change that too then.

Offline

#20 2018-08-02 16:26:04

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

Re: Review on my first package: Audiveris

Also note that - as written - that script should use a bash shebang.  That string indexing is not POSIX compatible.

However, I'm not sure I have any idea what that string indexing is even doing.  Isn't that just to trim the leading : from the string?  There are many simpler ways to do that that would be POSIX-compatible.

EDIT: and besides that, don't you know the names of all the jar files ahead of time?  Why loop over a glob at all?

If you do need the glob (e.g., if other jar files can be added from other packages):

CP=$(find /usr/share/java/audiveris/ -name '*.jar' | paste -s -d:)

Or without a variable:

#!/bin/sh
exec /usr/bin/java \
   -cp $(find /usr/share/java/audiveris/ -name '*.jar' | paste -s -d:) \
   Audiveris "$@"

Last edited by Trilby (2018-08-02 16:36:07)


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

Offline

#21 2018-08-03 06:21:14

Higlav
Member
Registered: 2016-12-09
Posts: 39

Re: Review on my first package: Audiveris

Hello Trilby,

Thank you for your help. The reason I had used /bin/sh instead of /bin/bash and why I iterated over the files was because that's how it had been done in the wiki. So it was just out of convenience tongue. But since your snippet is nicer, I'll change to that.

Cheers

Last edited by Higlav (2018-08-03 06:31:45)

Offline

#22 2018-08-03 13:24:08

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

Re: Review on my first package: Audiveris

It's debatable which is more efficient, the loop or the find/paste pipeline (actually it's silly to debate when one could just test).  I tend to avoid loops whereever possible, but in this case the alternative is using subshells with two new processes while the loop is using all shell built-ins.  So in hind sight the loop may be better.

But the example in the wiki doesn't have the string indexing you had, so it is fine to use with /bin/sh.  The wiki example would also produce a list with a leading ':' , so perhaps that's not a problem (i.e. the colon doesn't need to be trimmed).  If that is the case, it can be even simpler just using `printf ':%s' /usr/whatever/path/*.jar` for CP.

Last edited by Trilby (2018-08-03 13:26:44)


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

Offline

#23 2018-08-03 13:44:03

progandy
Member
Registered: 2012-05-17
Posts: 5,190

Re: Review on my first package: Audiveris

Isn't it completely unnecessary to enumerate all .jar files? As far as I know, the classpath option allows a star for the basename.

exec /usr/bin/java -cp "/usr/share/java/audiveris/*" Audiveris "$@"

https://jlk.fjfi.cvut.cz/arch/manpagesm … rd_Options
...
As a special convenience, a class path element that contains a base name of * is considered equivalent to specifying a list of all the files in the directory with the extension .jar or .JAR. A Java program cannot tell the difference between the two invocations.
...


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#24 2018-08-06 08:28:23

Higlav
Member
Registered: 2016-12-09
Posts: 39

Re: Review on my first package: Audiveris

Haha, we were discussing over something so easily solved. Thanks for pointing this out, progandy.

Offline

Board footer

Powered by FluxBB