You are not logged in.

#1 2021-12-10 02:36:22

plitter
Member
Registered: 2010-10-07
Posts: 33

PKGBUILD review request: maven-git

Stolen for the most part from asp smile

pkgname=maven-git
pkgver=4.0.0.1
pkgrel=1
pkgdesc='Java project management and project comprehension tool'
url='https://maven.apache.org'
arch=('any')
license=('APACHE')
depends=('java-environment>=7' 'bash' 'procps-ng')
makedepends=('maven' 'java-environment=8' 'xmlstarlet')
backup=('opt/maven/conf/settings.xml')
source=("${pkgname}::git+https://github.com/apache/maven.git")
md5sums=(SKIP)

prepare() {
	cat <<eof > "${pkgname}.sh"
#!/bin/bash

#export MAVEN_OPTS=-Xmx1g
#export M2_HOME=/opt/maven
#export PATH=$PATH:$M2_HOME/bin
eof
}

build() {
	cd "$pkgname"

	export PATH="/usr/lib/jvm/java-8-openjdk/bin:${PATH}"
	mvn package \
		-Dmaven.repo.local="${srcdir}/repo" \
		-Dproject.build.sourceEncoding=UTF-8 -T1C -e
}

package() {
	cd "$pkgname"

	install -Dm 755 "../${pkgname}.sh" -t "${pkgdir}/etc/profile.d"
	install -d "${pkgdir}/opt/${pkgname}"

	# skip tests as they were already executed
	export PATH="/usr/lib/jvm/java-8-openjdk/bin:${PATH}"
	mvn install \
		-Dmaven.repo.local="${srcdir}/repo" \
		-Dproject.build.sourceEncoding=UTF-8 -e \
		-DdistributionTargetDir="${pkgdir}/opt/${pkgname}" \
		-DskipTests -Dmaven.test.skip=true -T1C

	install -d "${pkgdir}/usr/bin"
	ln -s /opt/${pkgname}/bin/mvn "${pkgdir}/usr/bin/mvnGit"
	ln -s /opt/${pkgname}/bin/mvnDebug "${pkgdir}/usr/bin/mvnDebugGit"
}

pkgver() {
	cd "$pkgname"
	xml sel -N x=http://maven.apache.org/POM/4.0.0 -t -v '/x:project/x:version' -n pom.xml | sed 's/[[:alpha:]]//g;s/-\+/./;s/-\+$//'
}
# vim: ts=2 sw=2 sts=2:

The xml sel command gives currently 4.0.0-alpha-1-SNAPSHOT and it gets reduced to 4.0.0.1. What happens if someone updates the repo with a branch on master without updating the version number will it get rebuilt when I do makepkg -sic again?

Last edited by plitter (2021-12-10 14:49:21)

Offline

#2 2021-12-10 19:41:22

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,680
Website

Re: PKGBUILD review request: maven-git

plitter wrote:
prepare() {
	cat <<eof > "${pkgname}.sh"
#!/bin/bash

#export MAVEN_OPTS=-Xmx1g
#export M2_HOME=/opt/maven
#export PATH=$PATH:$M2_HOME/bin
eof
}

Just supply the maven.sh script (and add the appropriate checksum to the PKGBUILD) instead of creating it in the prepare() function.

plitter wrote:
pkgver() {
	cd "$pkgname"
	xml sel -N x=http://maven.apache.org/POM/4.0.0 -t -v '/x:project/x:version' -n pom.xml | sed 's/[[:alpha:]]//g;s/-\+/./;s/-\+$//'
}

Why not follow the VCS package guide instead (and remove the xmlstarlet build dependency)?

I think you should also add

conflicts=('maven')
provides=('maven')

But maven apparently needs itself as a build dependency, which is weird, so I might be wrong. Wait for better advice on this point.

And add git to the makedepends array. Try building the package in a clean chroot to ensure all dependencies are listed.

plitter wrote:
# vim: ts=2 sw=2 sts=2:

3 space tabs are clearly better tongue

Offline

#3 2021-12-11 00:20:36

plitter
Member
Registered: 2010-10-07
Posts: 33

Re: PKGBUILD review request: maven-git

Head_on_a_Stick wrote:

Just supply the maven.sh script (and add the appropriate checksum to the PKGBUILD) instead of creating it in the prepare() function.

I'll see if I can manage that.

Head_on_a_Stick wrote:

Why not follow the VCS package guide instead (and remove the xmlstarlet build dependency)?

When I tested the commands for the tags approach they referred to older tags... and since there is a version in the pom I thought we could use it, but I do some extra stuff that might not be as safe if they reset the last number and go to beta. I'll go for this one then smile

  printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
Head_on_a_Stick wrote:

I think you should also add

conflicts=('maven')
provides=('maven')

Since this is bleeding edge I want to have both packages so I can switch between the commands easily. So unless there is a good reason for it I would leave that one, and if that is the case I'm not sure that provides is useful either. Neither is used in the official maven build either. Interestingly it also uses maven inside smile The offical one also only has what I put in depends (except for xmlstarlet in makedepends).

Head_on_a_Stick wrote:

3 space tabs are clearly better tongue

I disrespectfully decline, 7 is the number of the gods! tongue

Offline

#4 2022-01-09 17:48:10

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

Re: PKGBUILD review request: maven-git

plitter wrote:
Head_on_a_Stick wrote:

3 space tabs are clearly better

I disrespectfully decline, 7 is the number of the gods!

But vi is the editor of the beast! Look at the name , it is a roman 6. So 6 (666 is too big) would be the best choice! smile

Offline

Board footer

Powered by FluxBB