d624c0
# Note to the interested reader:
d624c0
#   fedpkg mockbuild --without tests
d624c0
# will make mvn_build macro skip tests.
d624c0
# See: https://github.com/fedora-java/javapackages/issues/62
d624c0
d624c0
%global javacup_or_asm java_cup:java_cup|org\\.ow2\\.asm:asm.*
d624c0
# Don't have generated mvn()-style requires for java_cup or asm
d624c0
%global mvn_javacup_or_asm_matcher .*mvn\\(%{javacup_or_asm}\\)
d624c0
# Don't have generated requires for java-headless >= 1:1.9
d624c0
%global java_headless_matcher java-headless >= 1:(1\\.9|9)
d624c0
%global __requires_exclude ^%{mvn_javacup_or_asm_matcher}|%{java_headless_matcher}$
d624c0
d624c0
%global homedir %{_datadir}/%{name}
d624c0
%global bindir %{homedir}/bin
d624c0
d624c0
Name:             byteman
d624c0
Version:          4.0.16
d624c0
Release:          2%{?dist}
d624c0
Summary:          Java agent-based bytecode injection tool
d624c0
License:          LGPLv2+
d624c0
URL:              http://www.jboss.org/byteman
d624c0
# wget -O 4.0.16.tar.gz https://github.com/bytemanproject/byteman/archive/4.0.16.tar.gz
d624c0
Source0:          https://github.com/bytemanproject/byteman/archive/%{version}.tar.gz
d624c0
d624c0
BuildArch:        noarch
d624c0
d624c0
# Byteman 4.x requires JDK 9+ to build. Require JDK 10 explicitly.
d624c0
BuildRequires:    java-11-openjdk-devel
d624c0
BuildRequires:    maven-local
d624c0
BuildRequires:    maven-shade-plugin
d624c0
BuildRequires:    maven-source-plugin
d624c0
BuildRequires:    maven-plugin-plugin
d624c0
BuildRequires:    maven-plugin-bundle
d624c0
BuildRequires:    maven-assembly-plugin
d624c0
BuildRequires:    maven-failsafe-plugin
d624c0
BuildRequires:    maven-jar-plugin
d624c0
BuildRequires:    maven-surefire-plugin
d624c0
BuildRequires:    maven-surefire-provider-testng
d624c0
BuildRequires:    maven-surefire-provider-junit
d624c0
BuildRequires:    maven-surefire-provider-junit5
d624c0
BuildRequires:    maven-verifier-plugin
d624c0
BuildRequires:    maven-dependency-plugin
d624c0
BuildRequires:    java_cup
d624c0
BuildRequires:    objectweb-asm
d624c0
BuildRequires:    junit
d624c0
BuildRequires:    junit5
d624c0
BuildRequires:    testng
d624c0
d624c0
Provides:         bundled(objectweb-asm) = 9.1
d624c0
Provides:         bundled(java_cup) = 1:0.11b-19
d624c0
# We are filtering java-headless >= 1:1.9 requirement. Add
d624c0
# JDK 8 requirement here explicitly which shouldn't match the filter.
d624c0
Requires:         java-headless >= 1:1.8
d624c0
d624c0
# Related pieces removed via pom_xpath_remove macros
d624c0
Patch1:           remove_submit_integration_test_verification.patch
d624c0
Patch2:           testng7_port.patch
d624c0
d624c0
%description
d624c0
Byteman is a tool which simplifies tracing and testing of Java programs.
d624c0
Byteman allows you to insert extra Java code into your application,
d624c0
either as it is loaded during JVM startup or even after it has already
d624c0
started running. The injected code is allowed to access any of your data
d624c0
and call any application methods, including where they are private.
d624c0
You can inject code almost anywhere you want and there is no need to
d624c0
prepare the original source code in advance nor do you have to recompile,
d624c0
repackage or redeploy your application. In fact you can remove injected
d624c0
code and reinstall different code while the application continues to execute.
d624c0
d624c0
%package javadoc
d624c0
Summary:          Javadoc for %{name}
d624c0
d624c0
%description javadoc
d624c0
This package contains the API documentation for %{name}.
d624c0
d624c0
%package rulecheck-maven-plugin
d624c0
Summary:          Maven plugin for checking Byteman rules.
d624c0
d624c0
%description rulecheck-maven-plugin
d624c0
This package contains the Byteman rule check maven plugin.
d624c0
d624c0
%package bmunit
d624c0
Summary:          TestNG and JUnit integration for Byteman.
d624c0
d624c0
%description bmunit
d624c0
The Byteman bmunit jar provides integration of Byteman into
d624c0
TestNG and JUnit tests.
d624c0
d624c0
%package dtest
d624c0
Summary:          Remote byteman instrumented testing.
d624c0
d624c0
%description dtest
d624c0
The Byteman dtest jar supports instrumentation of test code executed on
d624c0
remote server hosts and validation of assertions describing the expected
d624c0
operation of the instrumented methods.
d624c0
d624c0
%prep
d624c0
%setup -q -n byteman-%{version}
d624c0
d624c0
# Fix the gid:aid for java_cup
d624c0
sed -i "s|net.sf.squirrel-sql.thirdparty-non-maven|java_cup|" agent/pom.xml
d624c0
sed -i "s|java-cup|java_cup|" agent/pom.xml
d624c0
sed -i "s|net.sf.squirrel-sql.thirdparty-non-maven|java_cup|" tests/pom.xml
d624c0
sed -i "s|java-cup|java_cup|" tests/pom.xml
d624c0
d624c0
# Remove Submit integration test invocations (agent)
d624c0
%pom_xpath_remove "pom:build/pom:plugins/pom:plugin[pom:artifactId='maven-failsafe-plugin']/pom:executions/pom:execution[pom:id='submit.TestSubmit']" agent
d624c0
%pom_xpath_remove "pom:build/pom:plugins/pom:plugin[pom:artifactId='maven-failsafe-plugin']/pom:executions/pom:execution[pom:id='submit.TestSubmit.compiled']" agent
d624c0
%patch1 -p2
d624c0
%patch2 -p2
d624c0
d624c0
# Remove Submit integration test invocations (tests)
d624c0
%pom_xpath_remove "pom:build/pom:plugins/pom:plugin[pom:artifactId='maven-failsafe-plugin']/pom:executions/pom:execution[pom:id='submit.TestSubmit']" tests
d624c0
%pom_xpath_remove "pom:build/pom:plugins/pom:plugin[pom:artifactId='maven-failsafe-plugin']/pom:executions/pom:execution[pom:id='submit.TestSubmit.compiled']" tests
d624c0
d624c0
# Remove scope=system and systemPath for com.sun:tools
d624c0
%pom_xpath_remove "pom:profiles/pom:profile/pom:dependencies/pom:dependency[pom:artifactId='tools']/pom:scope" install
d624c0
%pom_xpath_remove "pom:profiles/pom:profile/pom:dependencies/pom:dependency[pom:artifactId='tools']/pom:systemPath" install
d624c0
%pom_xpath_remove "pom:profiles/pom:profile/pom:dependencies/pom:dependency[pom:artifactId='tools']/pom:scope" contrib/bmunit
d624c0
%pom_xpath_remove "pom:profiles/pom:profile/pom:dependencies/pom:dependency[pom:artifactId='tools']/pom:systemPath" contrib/bmunit
d624c0
d624c0
# Some tests fail intermittently during builds. Disable them.
d624c0
%pom_xpath_remove "pom:build/pom:plugins/pom:plugin[pom:artifactId='maven-surefire-plugin']/pom:executions" contrib/bmunit
d624c0
%pom_xpath_set "pom:build/pom:plugins/pom:plugin[pom:artifactId='maven-surefire-plugin']/pom:configuration" '<skip>true</skip>' contrib/bmunit
d624c0
d624c0
# Don't build download, docs modules
d624c0
%pom_disable_module download
d624c0
%pom_disable_module docs
d624c0
d624c0
# Don't use javadoc plugin, use XMvn for javadocs
d624c0
%pom_remove_plugin -r :maven-javadoc-plugin
d624c0
%pom_remove_dep 'org.apache.maven:maven-project' contrib/rulecheck-maven-plugin
d624c0
%pom_xpath_remove 'pom:execution[pom:id="make-javadoc-assembly"]' byteman
d624c0
d624c0
# Put byteman-rulecheck-maven-plugin into a separate package
d624c0
%mvn_package ":byteman-rulecheck-maven-plugin" rulecheck-maven-plugin
d624c0
d624c0
# CNFE being thrown without this for bmunit5 in rawhide and with tests enabled
d624c0
%pom_add_dep "org.apache.commons:commons-lang3" contrib/bmunit5
d624c0
# Put byteman-bmunit/byteman-dtest into a separate packages since they
d624c0
# runtime require junit
d624c0
%mvn_package ":byteman-bmunit" bmunit
d624c0
%mvn_package ":byteman-dtest" dtest
d624c0
d624c0
%build
d624c0
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk
d624c0
# Use --xmvn-javadoc so as to avoid maven-javadoc-plugin issue
d624c0
# (fixed in 3.1.0, fedora has 3.0.1):
d624c0
# See https://issues.apache.org/jira/browse/MJAVADOC-555
d624c0
#     https://bugs.openjdk.java.net/browse/JDK-8212233
d624c0
%mvn_build --xmvn-javadoc
d624c0
d624c0
%install
d624c0
%mvn_install
d624c0
d624c0
install -d -m 755 $RPM_BUILD_ROOT%{_bindir}
d624c0
d624c0
install -d -m 755 $RPM_BUILD_ROOT%{homedir}
d624c0
install -d -m 755 $RPM_BUILD_ROOT%{homedir}/lib
d624c0
install -d -m 755 $RPM_BUILD_ROOT%{bindir}
d624c0
d624c0
install -m 755 bin/bmsubmit.sh $RPM_BUILD_ROOT%{bindir}/bmsubmit
d624c0
install -m 755 bin/bminstall.sh  $RPM_BUILD_ROOT%{bindir}/bminstall
d624c0
install -m 755 bin/bmjava.sh  $RPM_BUILD_ROOT%{bindir}/bmjava
d624c0
install -m 755 bin/bmcheck.sh  $RPM_BUILD_ROOT%{bindir}/bmcheck
d624c0
d624c0
for f in bmsubmit bmjava bminstall bmcheck; do
d624c0
cat > $RPM_BUILD_ROOT%{_bindir}/${f} << EOF
d624c0
#!/bin/sh
d624c0
d624c0
export BYTEMAN_HOME=/usr/share/byteman
d624c0
export JAVA_HOME=/usr/lib/jvm/java
d624c0
d624c0
\$BYTEMAN_HOME/bin/${f} \$*
d624c0
EOF
d624c0
done
d624c0
d624c0
chmod 755 $RPM_BUILD_ROOT%{_bindir}/*
d624c0
d624c0
for m in bmunit dtest install sample submit; do
d624c0
  ln -s %{_javadir}/byteman/byteman-${m}.jar $RPM_BUILD_ROOT%{homedir}/lib/byteman-${m}.jar
d624c0
done
d624c0
d624c0
# Create contrib/jboss-module-system structure since bminstall expects it
d624c0
# for the -m option.
d624c0
install -d -m 755 $RPM_BUILD_ROOT%{homedir}/contrib
d624c0
install -d -m 755 $RPM_BUILD_ROOT%{homedir}/contrib/jboss-modules-system
d624c0
ln -s %{_javadir}/byteman/byteman-jboss-modules-plugin.jar $RPM_BUILD_ROOT%{homedir}/contrib/jboss-modules-system/byteman-jboss-modules-plugin.jar
d624c0
d624c0
ln -s %{_javadir}/byteman/byteman.jar $RPM_BUILD_ROOT%{homedir}/lib/byteman.jar
d624c0
d624c0
%files -f .mfiles
d624c0
%{homedir}/lib/byteman.jar
d624c0
%{homedir}/lib/byteman-install.jar
d624c0
%{homedir}/lib/byteman-sample.jar
d624c0
%{homedir}/lib/byteman-submit.jar
d624c0
%{homedir}/contrib/*
d624c0
%{bindir}/*
d624c0
%{_bindir}/*
d624c0
%doc README
d624c0
%license docs/copyright.txt
d624c0
d624c0
%files javadoc -f .mfiles-javadoc
d624c0
%license docs/copyright.txt
d624c0
d624c0
%files rulecheck-maven-plugin -f .mfiles-rulecheck-maven-plugin
d624c0
%license docs/copyright.txt
d624c0
d624c0
%files bmunit -f .mfiles-bmunit
d624c0
%license docs/copyright.txt
d624c0
%{homedir}/lib/byteman-bmunit.jar
d624c0
d624c0
%files dtest -f .mfiles-dtest
d624c0
%license docs/copyright.txt
d624c0
%{homedir}/lib/byteman-dtest.jar
d624c0
d624c0
%changelog
d624c0
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 4.0.16-2
d624c0
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
d624c0
  Related: rhbz#1991688
d624c0
d624c0
* Fri Jun 18 2021 Severin Gehwolf <sgehwolf@redhat.com> - 4.0.16-1
d624c0
- Update to latest upstream 4.0.16 release for JDK 17 support.
d624c0
- Drop not-needed jboss-modules BR.
d624c0
d624c0
* Thu Apr 15 2021 Mohan Boddu <mboddu@redhat.com> - 4.0.11-5
d624c0
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
d624c0
d624c0
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 4.0.11-4
d624c0
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
d624c0
d624c0
* Mon Jul 27 2020 Fedora Release Engineering <releng@fedoraproject.org> - 4.0.11-3
d624c0
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
d624c0
d624c0
* Fri Jul 10 2020 Jiri Vanek <jvanek@redhat.com> - 4.0.11-2
d624c0
- Rebuilt for JDK-11, see https://fedoraproject.org/wiki/Changes/Java11
d624c0
d624c0
* Tue Mar 03 2020 Jayashree Huttanagoudar <jhuttana@redhat.com> - 4.0.11-1
d624c0
- Upgrated to latest upstream version 4.0.11
d624c0
- Added a patch to fix rpm build issue caused due to misconfiguration in upstream
d624c0
- Added required additional plugins required for build
d624c0
d624c0
* Tue Jan 28 2020 Severin Gehwolf <sgehwolf@redhat.com> - 4.0.5-5
d624c0
- Drop not needed BR jarjar. Fixes FTBFS.
d624c0
d624c0
* Tue Jan 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 4.0.5-5
d624c0
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
d624c0
d624c0
* Wed Jul 24 2019 Fedora Release Engineering <releng@fedoraproject.org> - 4.0.5-4
d624c0
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
d624c0
d624c0
* Mon May 06 2019 Severin Gehwolf <sgehwolf@redhat.com> - 4.0.5-3
d624c0
- Use XMvn javadoc so as to work-around maven-javadoc-plugin issue.
d624c0
- Fixes FTBFS.
d624c0
d624c0
* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 4.0.5-2
d624c0
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
d624c0
d624c0
* Wed Nov 21 2018 Severin Gehwolf <sgehwolf@redhat.com> - 4.0.5-1
d624c0
- Update to latest upstream 4.0.5 release.
d624c0
d624c0
* Thu Jul 12 2018 Fedora Release Engineering <releng@fedoraproject.org> - 4.0.4-2
d624c0
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
d624c0
d624c0
* Tue Jul 10 2018 Severin Gehwolf <sgehwolf@redhat.com> - 4.0.4-1
d624c0
- Update to latest upstream 4.0.4 release.
d624c0
- Split junit-dependent packages into sub-packages:
d624c0
  byteman-dtest, byteman-bmunit
d624c0
- Fix automatically generated requirements:
d624c0
  - ASM is BR-only and bundled.
d624c0
  - java-headless >= 1:1.9 would get generated, but byteman 4.x
d624c0
    runs on JDK 8 too (would even work for JDK 6)
d624c0
d624c0
* Thu Jul 05 2018 Severin Gehwolf <sgehwolf@redhat.com> - 4.0.3-2
d624c0
- Don't use maven-javadoc-plugin. Use XMvn instead.
d624c0
d624c0
* Tue Jul 03 2018 Severin Gehwolf <sgehwolf@redhat.com> - 4.0.3-1
d624c0
- Update to latest upstream 4.0.3 release.
d624c0
d624c0
* Fri Apr 27 2018 Severin Gehwolf <sgehwolf@redhat.com> - 4.0.2-1
d624c0
- Update to latest upstream 4.0.2 release.
d624c0
- Adds support for modular JDKs.
d624c0
d624c0
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.6-5
d624c0
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
d624c0
d624c0
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.6-4
d624c0
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
d624c0
d624c0
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.6-3
d624c0
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
d624c0
d624c0
* Fri Dec 09 2016 Severin Gehwolf <sgehwolf@redhat.com> - 3.0.6-2
d624c0
- Add BRs, maven-plugin-bundle, maven-source-plugin and
d624c0
  maven-plugin-plugin, fixing FTBFS.
d624c0
- Resolves: RHBZ#1402998
d624c0
d624c0
* Mon Jun 13 2016 Severin Gehwolf <sgehwolf@redhat.com> - 3.0.6-1
d624c0
- Update to latest upstream release.
d624c0
d624c0
* Mon Mar 14 2016 Severin Gehwolf <sgehwolf@redhat.com> - 3.0.4-2
d624c0
- Enable some tests during build
d624c0
- Fix generated requires by filtering requires for bundled libs.
d624c0
- Split maven plugin into separate package.
d624c0
d624c0
* Thu Feb 18 2016 Severin Gehwolf <sgehwolf@redhat.com> - 3.0.4-1
d624c0
- Update to latest upstream 3.0.4 release.
d624c0
d624c0
* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2.1.4.1-8
d624c0
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
d624c0
d624c0
* Thu Aug 06 2015 gil cattaneo <puntogil@libero.it> 2.1.4.1-7
d624c0
- Fix FTBFS rhbz#1239392
d624c0
- Remove duplicate files
d624c0
- Introduce license macro
d624c0
d624c0
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.1.4.1-6
d624c0
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
d624c0
d624c0
* Fri Feb 27 2015 Michal Srb <msrb@redhat.com> - 2.1.4.1-5
d624c0
- Fix FTBFS
d624c0
- Rebuild to generate new metadata
d624c0
d624c0
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.1.4.1-4
d624c0
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
d624c0
d624c0
* Fri Apr 18 2014 Marek Goldmann <mgoldman@redhat.com> - 2.1.4.1-3
d624c0
- Rebuilding for objectweb-asm update, RHBZ#1083570
d624c0
d624c0
* Fri Mar 28 2014 Michael Simacek <msimacek@redhat.com> - 2.1.4.1-2
d624c0
- Use Requires: java-headless rebuild (#1067528)
d624c0
d624c0
* Fri Feb 14 2014 Marek Goldmann <mgoldman@redhat.com> - 2.1.4.1-1
d624c0
- Upstream release 2.1.4.1
d624c0
d624c0
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.1.2-2
d624c0
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
d624c0
d624c0
* Thu Jul 04 2013 Marek Goldmann <mgoldman@redhat.com> - 2.1.2-1
d624c0
- Upstream release 2.1.2
d624c0
d624c0
* Wed Jun  5 2013 Mikolaj Izdebski <mizdebsk@redhat.com> - 2.0.4-5
d624c0
- Remove tools.jar from dependencyManagement
d624c0
d624c0
* Wed May 29 2013 Marek Goldmann <mgoldman@redhat.com> - 2.0.4-4
d624c0
- New guidelines
d624c0
d624c0
* Thu Apr 25 2013 Marek Goldmann <mgoldman@redhat.com> - 2.0.4-3
d624c0
- Fixes to the launch scripts
d624c0
d624c0
* Wed Apr 24 2013 Marek Goldmann <mgoldman@redhat.com> - 2.0.4-2
d624c0
- Added bmsubmit, bminstall and bmjava scripts, RHBZ#951560
d624c0
d624c0
* Thu Feb 21 2013 Marek Goldmann <mgoldman@redhat.com> - 2.0.4-1
d624c0
- Upstream release 2.0.4
d624c0
- Switched to Maven
d624c0
- Bundling java_cup and objectweb-asm (fpc#226)
d624c0
d624c0
* Wed Feb 13 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.5.2-6
d624c0
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
d624c0
d624c0
* Wed Jul 18 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.5.2-5
d624c0
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
d624c0
d624c0
* Thu Jan 12 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.5.2-4
d624c0
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
d624c0
d624c0
* Tue Sep 20 2011 Marek Goldmann <mgoldman@redhat.com> 1.5.2-3
d624c0
- Removed binary files from src.rpm
d624c0
d624c0
* Mon Sep 19 2011 Marek Goldmann <mgoldman@redhat.com> 1.5.2-2
d624c0
- Cleaned spec file
d624c0
d624c0
* Wed Jul 27 2011 Marek Goldmann <mgoldman@redhat.com> 1.5.2-1
d624c0
- Upstream release: 1.5.2
d624c0
d624c0
* Thu Jul 21 2011 Marek Goldmann <mgoldman@redhat.com> 1.5.1-1
d624c0
- Initial packaging
d624c0