Add bindings for XMvn toolchains

Bootstrap build.

Related: RHEL-71059
Related: RHEL-71062
This commit is contained in:
Mikolaj Izdebski 2024-12-18 11:56:52 +01:00
parent 36f26757bb
commit 3f9204f87f
5 changed files with 29 additions and 102 deletions

View File

@ -1,59 +0,0 @@
#!/bin/bash -ex
resultdir="/var/lib/mock/xmvn-rawhide/result"
# create directories
repo=RPM/latest/
[[ ! -d ${repo} ]] && mkdir -p ${repo}
# update version and release tag in spec file
version=$(sed -n '/<version>/{s/.*>\(.*\)<.*/\1/;s/-SNAPSHOT$//;p;q}' pom.xml)
release=$(git describe --match="[^(jenkins)].*" --tags | sed 's/[^-]*-/0./;s/-/./;s/g/git/')
sed -i "s/^Version:\s\+[0-9.]*$/Version: ${version}/" xmvn.spec
sed -i "s/^Release:\s\+[0-9.]*%{?dist}$/Release: ${release}/" xmvn.spec
# Skip patch application on Jenkins - it is supposed to always use the
# latest vanilla upstream snapshot.
sed -i "/^Patch[0-9]*:/d" xmvn.spec
sed -i "/^%patch[0-9]* -p/d" xmvn.spec
# make tarball
git archive -v --prefix=xmvn-${version}/ HEAD | xz > xmvn-${version}.tar.xz
# crate srpm
rm -f SRPMS/*
rpmbuild -bs --clean --define "_topdir `pwd`" --define "_sourcedir `pwd`" xmvn.spec
# build RPM with custom mock config
rm -Rf ${resultdir}/*
# print root.log and build.log in case of failure
trap "cat ${resultdir}/{root,build}.log || :" 0
mock -r ../..$PWD/fedora-rawhide-x86_64 SRPMS/*.src.rpm
# remove unneeded stuff
rm -f xmvn-*.tar.xz
last_bn=`grep "Build number" ${repo}/info.log | awk '{ print $3 }'`
if [ -n "${last_bn}" ]; then
mkdir -p RPM/${last_bn}
mv ${repo}/* RPM/${last_bn}
# we only want keep RPMs from last 10 builds
blist=`find ./RPM/ -maxdepth 1 -name "[0-9]*"`
for bn in $blist; do
if [ `basename $bn` -lt `expr $last_bn - 10` ]; then
rm -Rf $bn
fi
done
fi
# copy resulting RPMs to RPM/latest
cp ${resultdir}/* ${repo}
tail -n 50 ${resultdir}/build.log
createrepo ${repo}
# store current build number into the file
echo "Build number: $BUILD_NUMBER" >> ${repo}/info.log

View File

@ -1,37 +0,0 @@
config_opts['root'] = 'xmvn-rawhide'
config_opts['target_arch'] = 'x86_64'
config_opts['legal_host_arches'] = ('x86_64',)
config_opts['chroot_setup_cmd'] = 'install @buildsys-build'
config_opts['dist'] = 'rawhide' # only useful for --resultdir variable subst
config_opts['extra_chroot_dirs'] = [ '/run/lock', ]
config_opts['releasever'] = '21'
config_opts['yum.conf'] = """
[main]
logfile=/var/log/yum.log
retries=20
gpgcheck=0
assumeyes=1
syslog_ident=mock
syslog_device=
metadata_expire=1
mirrorlist_expire=1
debuglevel=2
[mock-rawhide]
name=mock-rawhide
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=rawhide&arch=x86_64
failovermethod=priority
cost=1000
[mock-koji]
name=mock-koji
baseurl=http://kojipkgs.fedoraproject.org/repos/rawhide/latest/x86_64/
cost=2000
[mock-override]
name=mock-override
baseurl=http://people.redhat.com/~mizdebsk/jenkins-extra-repo/
gpgcheck=0
cost=500
"""

View File

@ -2,5 +2,8 @@ summary: XMvn smoke test
description: |
Test basic functionality of XMvn.
require:
- xmvn
- xmvn-minimal
- xmvn-tools
- maven-dependency-plugin
- junit

11
toolchains-openjdk21.xml Normal file
View File

@ -0,0 +1,11 @@
<toolchains>
<toolchain>
<type>jdk</type>
<provides>
<xmvn>xmvn</xmvn>
</provides>
<configuration>
<jdkHome>/usr/lib/jvm/java-21-openjdk</jdkHome>
</configuration>
</toolchain>
</toolchains>

View File

@ -1,4 +1,4 @@
%bcond_with bootstrap
%bcond_without bootstrap
%if %{with bootstrap}
%global mbi 1
@ -6,7 +6,7 @@
Name: xmvn
Version: 4.2.0
Release: 13%{?dist}
Release: 14%{?dist}
Summary: Local Extensions for Apache Maven
License: Apache-2.0
URL: https://fedora-java.github.io/xmvn/
@ -15,6 +15,8 @@ ExclusiveArch: %{java_arches} noarch
Source0: https://github.com/fedora-java/xmvn/releases/download/%{version}/xmvn-%{version}.tar.xz
Source21: toolchains-openjdk21.xml
%if %{with bootstrap}
BuildRequires: javapackages-bootstrap
%else
@ -59,7 +61,6 @@ creating RPM packages containing Maven artifacts.
Summary: Dependency-reduced version of XMvn
Requires: %{name}-core = %{version}-%{release}
Requires: apache-commons-cli
Requires: apache-commons-lang3
Requires: atinject
Requires: google-guice
Requires: guava
@ -125,7 +126,7 @@ Summary: API documentation for %{name}
This package provides %{summary}.
%prep
%setup -q
%autosetup -p1
%mvn_package ::tar.gz: __noinstall
%mvn_package ":{xmvn,xmvn-connector}" xmvn
@ -139,7 +140,7 @@ This package provides %{summary}.
# Copy Maven home packaged as RPM instead of unpacking Maven binary
# tarball with maven-dependency-plugin
%pom_remove_plugin :maven-dependency-plugin
maven_home=$(realpath $(dirname $(realpath $(%{?jpb_env} which mvn)))/..)
maven_home=$(realpath $(dirname $(realpath $(%{?jpb_env} type -p mvn)))/..)
mver=$(sed -n '/<mavenVersion>/{s/.*>\(.*\)<.*/\1/;p}' \
xmvn-parent/pom.xml)
mkdir -p target/dependency/
@ -170,7 +171,7 @@ rm -f %{name}-${version}/bin/*
%mvn_install
version=4.*
maven_home=$(realpath $(dirname $(realpath $(%{?jpb_env} which mvn)))/..)
maven_home=$(realpath $(dirname $(realpath $(%{?jpb_env} type -p mvn)))/..)
install -d -m 755 %{buildroot}%{_datadir}/%{name}
cp -r%{?mbi:L} %{name}-${version}/* %{buildroot}%{_datadir}/%{name}/
@ -212,6 +213,11 @@ cp -P ${maven_home}/bin/m2.conf %{buildroot}%{_datadir}/%{name}/bin/
# Make sure javapackages config is not bundled
rm -rf %{buildroot}%{_datadir}/%{name}/{configuration.xml,config.d/,conf/toolchains.xml,maven-metadata/}
# Toolchains
ln -sf %{_jpbindingdir}/xmvn-toolchains.xml %{buildroot}%{_datadir}/%{name}/conf/toolchains.xml
install -p -m 644 %{SOURCE21} %{buildroot}%{_datadir}/%{name}/conf/toolchains-openjdk21.xml
%jp_binding --verbose --base-pkg xmvn-minimal --binding-pkg xmvn-toolchain-openjdk21 --variant openjdk21 --ghost xmvn-toolchains.xml --target %{_datadir}/%{name}/conf/toolchains-openjdk21.xml --requires java-21-openjdk-devel
%files
%{_bindir}/mvn-local
@ -244,6 +250,9 @@ rm -rf %{buildroot}%{_datadir}/%{name}/{configuration.xml,config.d/,conf/toolcha
%license LICENSE NOTICE
%changelog
* Mon Dec 23 2024 Mikolaj Izdebski <mizdebsk@redhat.com> - 4.2.0-14
- Add bindings for XMvn toolchains
* Tue Oct 29 2024 Troy Dawson <tdawson@redhat.com> - 4.2.0-13
- Bump release for October 2024 mass rebuild:
Resolves: RHEL-64018