e0f6a1
%global homedir %{_datadir}/%{name}
e0f6a1
%global bindir %{homedir}/bin
e0f6a1
%global hash 373601b4e608ea622b2fec947824b99cd0edb124
e0f6a1
%global __requires_exclude ^mvn\(.*\)$
e0f6a1
e0f6a1
Name:             byteman
e0f6a1
Version:          2.1.4.1
e0f6a1
Release:          3%{?dist}
e0f6a1
Summary:          Java agent-based bytecode injection tool
e0f6a1
License:          LGPLv2+
e0f6a1
URL:              http://www.jboss.org/byteman
e0f6a1
Source0:          https://github.com/bytemanproject/byteman/archive/%{hash}.tar.gz
e0f6a1
e0f6a1
BuildArch:        noarch
e0f6a1
e0f6a1
BuildRequires:    jpackage-utils
e0f6a1
BuildRequires:    javapackages-tools
e0f6a1
BuildRequires:    java-devel
e0f6a1
BuildRequires:    maven-local
e0f6a1
BuildRequires:    maven-shade-plugin
e0f6a1
BuildRequires:    maven-failsafe-plugin
e0f6a1
BuildRequires:    maven-jar-plugin
e0f6a1
BuildRequires:    maven-surefire-plugin
e0f6a1
BuildRequires:    maven-surefire-provider-testng
e0f6a1
BuildRequires:    maven-surefire-provider-junit4
e0f6a1
BuildRequires:    maven-verifier-plugin
e0f6a1
BuildRequires:    java_cup
e0f6a1
BuildRequires:    jarjar
e0f6a1
BuildRequires:    objectweb-asm
e0f6a1
BuildRequires:    junit4
e0f6a1
BuildRequires:    testng
e0f6a1
e0f6a1
Requires:         jpackage-utils
e0f6a1
Requires:         java-devel
e0f6a1
e0f6a1
# Bundled at build time
e0f6a1
Provides:         bundled(java_cup) = 1:0.11a-16
e0f6a1
Provides:         bundled(objectweb-asm) = 0:3.3.1-9
e0f6a1
e0f6a1
%description
e0f6a1
Byteman is a tool which simplifies tracing and testing of Java programs.
e0f6a1
Byteman allows you to insert extra Java code into your application,
e0f6a1
either as it is loaded during JVM startup or even after it has already
e0f6a1
started running. The injected code is allowed to access any of your data
e0f6a1
and call any application methods, including where they are private.
e0f6a1
You can inject code almost anywhere you want and there is no need to
e0f6a1
prepare the original source code in advance nor do you have to recompile,
e0f6a1
repackage or redeploy your application. In fact you can remove injected
e0f6a1
code and reinstall different code while the application continues to execute.
e0f6a1
e0f6a1
%package javadoc
e0f6a1
Summary:          Javadocs for %{name}
e0f6a1
e0f6a1
%description javadoc
e0f6a1
This package contains the API documentation for %{name}.
e0f6a1
e0f6a1
%prep
e0f6a1
%setup -q -n byteman-%{hash}
e0f6a1
e0f6a1
# Fix the gid:aid for java_cup
e0f6a1
sed -i "s|net.sf.squirrel-sql.thirdparty-non-maven|java_cup|" agent/pom.xml
e0f6a1
sed -i "s|java-cup|java_cup|" agent/pom.xml
e0f6a1
e0f6a1
# com.sun:tools dependency has scope "system", which should not used
e0f6a1
# in RHEL.
e0f6a1
%pom_remove_dep com.sun:tools
e0f6a1
e0f6a1
%pom_xpath_inject  "pom:plugin[pom:artifactId = 'maven-javadoc-plugin']/pom:configuration" "<additionalparam>\${doclintparam}</additionalparam>"
e0f6a1
%pom_xpath_inject  "pom:profiles" "<profile>
e0f6a1
        <id>disable-java-8-doclint</id>
e0f6a1
        <activation>
e0f6a1
            <jdk>[1.8,)</jdk>
e0f6a1
        </activation>
e0f6a1
        <properties>
e0f6a1
            <doclintparam>-Xdoclint:none</doclintparam>
e0f6a1
        </properties>
e0f6a1
      </profile>"
e0f6a1
e0f6a1
%build
e0f6a1
%mvn_build
e0f6a1
e0f6a1
%install
e0f6a1
%mvn_install
e0f6a1
e0f6a1
install -d -m 755 $RPM_BUILD_ROOT%{_bindir}
e0f6a1
e0f6a1
install -d -m 755 $RPM_BUILD_ROOT%{homedir}
e0f6a1
install -d -m 755 $RPM_BUILD_ROOT%{homedir}/lib
e0f6a1
install -d -m 755 $RPM_BUILD_ROOT%{bindir}
e0f6a1
e0f6a1
install -m 755 bin/bmsubmit.sh $RPM_BUILD_ROOT%{bindir}/bmsubmit
e0f6a1
install -m 755 bin/bminstall.sh  $RPM_BUILD_ROOT%{bindir}/bminstall
e0f6a1
install -m 755 bin/bmjava.sh  $RPM_BUILD_ROOT%{bindir}/bmjava
e0f6a1
install -m 755 bin/bmcheck.sh  $RPM_BUILD_ROOT%{bindir}/bmcheck
e0f6a1
e0f6a1
for f in bmsubmit bmjava bminstall bmcheck; do
e0f6a1
cat > $RPM_BUILD_ROOT%{_bindir}/${f} << EOF
e0f6a1
#!/bin/sh
e0f6a1
e0f6a1
export BYTEMAN_HOME=/usr/share/byteman
e0f6a1
export JAVA_HOME=/usr/lib/jvm/java
e0f6a1
e0f6a1
\$BYTEMAN_HOME/bin/${f} \$*
e0f6a1
EOF
e0f6a1
done
e0f6a1
e0f6a1
chmod 755 $RPM_BUILD_ROOT%{_bindir}/*
e0f6a1
e0f6a1
for m in bmunit dtest install sample submit; do
e0f6a1
  ln -s %{_javadir}/byteman/byteman-${m}.jar $RPM_BUILD_ROOT%{homedir}/lib/byteman-${m}.jar
e0f6a1
done
e0f6a1
e0f6a1
ln -s %{_javadir}/byteman/byteman.jar $RPM_BUILD_ROOT%{homedir}/lib/byteman.jar
e0f6a1
e0f6a1
%files -f .mfiles
e0f6a1
%dir %{_javadir}/%{name}
e0f6a1
%{homedir}/*
e0f6a1
%{_bindir}/*
e0f6a1
%doc README docs/ProgrammersGuide.pdf docs/copyright.txt
e0f6a1
e0f6a1
%files javadoc -f .mfiles-javadoc
e0f6a1
%doc docs/copyright.txt
e0f6a1
e0f6a1
%changelog
e0f6a1
* Mon Jul 02 2018 Severin Gehwolf <sgehwolf@redhat.com> - 2.1.4.1-3
e0f6a1
- Allow rebuild with JDK-8.
e0f6a1
e0f6a1
* Wed Jun 06 2018 Severin Gehwolf <sgehwolf@redhat.com> - 2.1.4.1-2
e0f6a1
- Don't filter provides. Update bundled java_cup and
e0f6a1
  asm versions.
e0f6a1
e0f6a1
* Wed May 30 2018 Severin Gehwolf <sgehwolf@redhat.com> - 2.1.4.1-1
e0f6a1
- Rebase to version 2.1.4.1. Resolves RHBZ#1408898.
e0f6a1
e0f6a1
* Fri Dec 27 2013 Daniel Mach <dmach@redhat.com> - 2.0.4-5
e0f6a1
- Mass rebuild 2013-12-27
e0f6a1
e0f6a1
* Wed Nov 13 2013 Mikolaj Izdebski <mizdebsk@redhat.com> - 2.0.4-4
e0f6a1
- Remove system-scoped dependency on tools.jar
e0f6a1
e0f6a1
* Thu Apr 25 2013 Marek Goldmann <mgoldman@redhat.com> - 2.0.4-3
e0f6a1
- Fixes to the launch scripts
e0f6a1
e0f6a1
* Wed Apr 24 2013 Marek Goldmann <mgoldman@redhat.com> - 2.0.4-2
e0f6a1
- Added bmsubmit, bminstall and bmjava scripts, RHBZ#951560
e0f6a1
e0f6a1
* Thu Feb 21 2013 Marek Goldmann <mgoldman@redhat.com> - 2.0.4-1
e0f6a1
- Upstream release 2.0.4
e0f6a1
- Switched to Maven
e0f6a1
- Bundling java_cup and objectweb-asm (fpc#226)
e0f6a1
e0f6a1
* Wed Feb 13 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.5.2-6
e0f6a1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
e0f6a1
e0f6a1
* Wed Jul 18 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.5.2-5
e0f6a1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
e0f6a1
e0f6a1
* Thu Jan 12 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.5.2-4
e0f6a1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
e0f6a1
e0f6a1
* Tue Sep 20 2011 Marek Goldmann <mgoldman@redhat.com> 1.5.2-3
e0f6a1
- Removed binary files from src.rpm
e0f6a1
e0f6a1
* Mon Sep 19 2011 Marek Goldmann <mgoldman@redhat.com> 1.5.2-2
e0f6a1
- Cleaned spec file
e0f6a1
e0f6a1
* Wed Jul 27 2011 Marek Goldmann <mgoldman@redhat.com> 1.5.2-1
e0f6a1
- Upstream release: 1.5.2
e0f6a1
e0f6a1
* Thu Jul 21 2011 Marek Goldmann <mgoldman@redhat.com> 1.5.1-1
e0f6a1
- Initial packaging
e0f6a1