You are not logged in.
Stolen for the most part from asp
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
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.
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.
# vim: ts=2 sw=2 sts=2:
3 space tabs are clearly better
Jin, Jîyan, Azadî
Offline
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.
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
printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
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 The offical one also only has what I put in depends (except for xmlstarlet in makedepends).
3 space tabs are clearly better
I disrespectfully decline, 7 is the number of the gods!
Offline
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!
Offline