[jenkins] Spec file cleanup
by Michal Srb
commit 4e0b07316a0de5435e7c31640f6e2492eae5222e
Author: Michal Srb <msrb(a)redhat.com>
Date: Fri Apr 4 09:19:52 2014 +0200
Spec file cleanup
fix-in-AuthenticationProcessingFilter2.patch | 61 -
fix-in-HttpSessionContextIntegrationFilter2.patch | 60 -
jenkins.spec | 20 +-
spring-security-in-SecurityListener.patch | 27 -
use-spring-security.patch | 2301 ---------------------
5 files changed, 5 insertions(+), 2464 deletions(-)
---
diff --git a/jenkins.spec b/jenkins.spec
index af8a307..7c0bb10 100644
--- a/jenkins.spec
+++ b/jenkins.spec
@@ -5,7 +5,7 @@
Name: jenkins
Version: 1.557
-Release: 6%{?dist}
+Release: 7%{?dist}
Summary: An extendable open source continuous integration server
# The project's primary license is MIT
@@ -28,8 +28,6 @@ Source3: BSD-LICENSE
Source4: jenkins-sysconfig
Source5: context.xml
-# we don't have legacy acegi security framework in Fedora
-#Patch0: use-spring-security.patch
# animal sniffer is not really useful in Fedora
Patch1: remove-animal-sniffer-annotations.patch
# build agaist pristine trilead-ssh2 library
@@ -43,11 +41,9 @@ Patch5: remove-solaris-support-in-su.patch
# jna-posix library is not in Fedora, we use jnr-posix
Patch6: drop-jna-posix-compatibility.patch
# build against newer commons fileupload
-Patch8: use-commons-fileupload-1.3.patch
+Patch8: use-commons-fileupload-1.3.patch
# newer args4j
Patch10: use-args4j-2.0.25.patch
-# switch to spring security in groovy scripts
-#Patch11: groovy-scripts-to-spring-security.patch
# build against newer guava
Patch12: use-guava-13.0.patch
# remove windows support (for now)
@@ -57,10 +53,6 @@ Patch15: remove-dotnet-support.patch
Patch16: remove-windows-installer-support.patch
# exclude pristine xstream from build (Fedora specific, we use different lib than upstream)
Patch17: exclude-xstream.patch
-# spring security related patches
-#Patch18: spring-security-in-SecurityListener.patch
-#Patch19: fix-in-HttpSessionContextIntegrationFilter2.patch
-#Patch20: fix-in-AuthenticationProcessingFilter2.patch
BuildArch: noarch
@@ -369,7 +361,6 @@ This package contains API documentation for %{name}.
%prep
%setup -q -n %{name}-%{name}-%{version}
-#%%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
@@ -378,16 +369,12 @@ This package contains API documentation for %{name}.
%patch6 -p1
%patch8 -p1
%patch10 -p1
-#%%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1 -F3
-#%%patch18 -p1
-#%%patch19 -p1
-#%%patch20 -p1
# Remove bundled JARs and classes
find . -name "*.jar" -delete
@@ -587,6 +574,9 @@ cp -p %{SOURCE5} %{buildroot}/%{homedir}/webapp/META-INF/context.xml
%doc LICENSE.txt
%changelog
+* Fri Apr 04 2014 Michal Srb <msrb(a)redhat.com> - 1.557-7
+- Spec file cleanup
+
* Fri Apr 04 2014 Michal Srb <msrb(a)redhat.com> - 1.557-6
- Remove superfluous JARs from cli jpackage script
10 years, 1 month
[jenkins] Remove superfluous JARs from cli jpackage script
by Michal Srb
commit bea0bf8e9791ed06fd1e8120001259055aea5744
Author: Michal Srb <msrb(a)redhat.com>
Date: Fri Apr 4 09:13:37 2014 +0200
Remove superfluous JARs from cli jpackage script
jenkins.spec | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/jenkins.spec b/jenkins.spec
index 268361d..af8a307 100644
--- a/jenkins.spec
+++ b/jenkins.spec
@@ -5,7 +5,7 @@
Name: jenkins
Version: 1.557
-Release: 5%{?dist}
+Release: 6%{?dist}
Summary: An extendable open source continuous integration server
# The project's primary license is MIT
@@ -506,7 +506,7 @@ cp %{SOURCE3} LICENSE-BSD.txt
# wrapper script for CLI
-%jpackage_script hudson.cli.CLI "" "" trilead-ssh2:commons-codec:jenkins-remoting/remoting:localizer/localizer:jfreechart/jfreechart:groovy18-1.8:jmdns/jmdns:jenkins/cli %{name}-cli true
+%jpackage_script hudson.cli.CLI "" "" trilead-ssh2:commons-codec:jenkins-remoting/remoting:localizer/localizer:jfreechart/jfreechart:jenkins/cli %{name}-cli true
%if !%{bootstrap}
@@ -587,6 +587,9 @@ cp -p %{SOURCE5} %{buildroot}/%{homedir}/webapp/META-INF/context.xml
%doc LICENSE.txt
%changelog
+* Fri Apr 04 2014 Michal Srb <msrb(a)redhat.com> - 1.557-6
+- Remove superfluous JARs from cli jpackage script
+
* Fri Apr 04 2014 Michal Srb <msrb(a)redhat.com> - 1.557-5
- Use jline1
10 years, 1 month
[jenkins] Use jline1
by Michal Srb
commit 31f5f5ebec7d637f0caae3c76845689d52b3859a
Author: Michal Srb <msrb(a)redhat.com>
Date: Fri Apr 4 09:01:46 2014 +0200
Use jline1
groovy needs jline1 so this patch for Jenkins causes only trouble for
now.
jenkins.spec | 16 ++++++++++------
use-jline2.patch | 34 ----------------------------------
2 files changed, 10 insertions(+), 40 deletions(-)
---
diff --git a/jenkins.spec b/jenkins.spec
index e833aae..268361d 100644
--- a/jenkins.spec
+++ b/jenkins.spec
@@ -5,7 +5,7 @@
Name: jenkins
Version: 1.557
-Release: 4%{?dist}
+Release: 5%{?dist}
Summary: An extendable open source continuous integration server
# The project's primary license is MIT
@@ -42,8 +42,6 @@ Patch4: fix-objectweb-asm-namespace.patch
Patch5: remove-solaris-support-in-su.patch
# jna-posix library is not in Fedora, we use jnr-posix
Patch6: drop-jna-posix-compatibility.patch
-# move to jline2
-Patch7: use-jline2.patch
# build against newer commons fileupload
Patch8: use-commons-fileupload-1.3.patch
# newer args4j
@@ -92,7 +90,7 @@ BuildRequires: mvn(javax.mail:mail)
BuildRequires: mvn(javax.servlet:jstl)
BuildRequires: mvn(javax.servlet:servlet-api)
BuildRequires: mvn(jaxen:jaxen)
-BuildRequires: mvn(jline:jline)
+BuildRequires: mvn(jline:jline:1)
BuildRequires: mvn(junit:junit)
BuildRequires: mvn(net.java.dev.jna:jna)
BuildRequires: mvn(net.java.sezpoz:sezpoz)
@@ -221,7 +219,7 @@ Requires: apache-sshd
Requires: xpp3-minimal
Requires: bouncycastle
Requires: easymock
-Requires: jline
+Requires: jline1
Requires: objectweb-asm
Requires: jaxen
Requires: jnr-constants
@@ -378,7 +376,6 @@ This package contains API documentation for %{name}.
%patch4 -p1
%patch5 -p1
%patch6 -p1
-%patch7 -p1
%patch8 -p1
%patch10 -p1
#%%patch11 -p1
@@ -497,6 +494,10 @@ cp %{SOURCE3} LICENSE-BSD.txt
%pom_remove_dep org.jvnet.hudson:commons-jelly-tags-define core
%pom_add_dep commons-jelly:commons-jelly-tags-define core
+# jline 1.x is a compat package
+%pom_remove_dep jline:jline core
+%pom_add_dep jline:jline:1 core
+
%build
%mvn_build -f
@@ -586,6 +587,9 @@ cp -p %{SOURCE5} %{buildroot}/%{homedir}/webapp/META-INF/context.xml
%doc LICENSE.txt
%changelog
+* Fri Apr 04 2014 Michal Srb <msrb(a)redhat.com> - 1.557-5
+- Use jline1
+
* Thu Apr 03 2014 Michal Srb <msrb(a)redhat.com> - 1.557-4
- Symlink remoting and cli JAR
10 years, 1 month
[jetty] Revert execmem scriptlet
by Michael Šimáček
commit 9da6e415feb2d09cc69fce49bd578067abab7ed9
Author: Michael Simacek <msimacek(a)redhat.com>
Date: Thu Apr 3 18:21:56 2014 +0200
Revert execmem scriptlet
jetty.spec | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)
---
diff --git a/jetty.spec b/jetty.spec
index 70c5602..3ea49d2 100644
--- a/jetty.spec
+++ b/jetty.spec
@@ -751,7 +751,6 @@ fi
exit 0
%post
-setsebool -P httpd_execmem 1
%systemd_post jetty.service
%preun
@@ -759,7 +758,6 @@ setsebool -P httpd_execmem 1
%postun
%systemd_postun_with_restart jetty.service
-setsebool -P httpd_execmem 0
%triggerun -- jetty < 8.1.0-3
@@ -856,7 +854,6 @@ setsebool -P httpd_execmem 0
%changelog
* Tue Apr 01 2014 Michael Simacek <msimacek(a)redhat.com> - 9.1.3-4
- Simplify (and fix) jetty startup script and use systemd features
-- Allow execmem access for jetty
* Thu Mar 06 2014 Erinn Looney-Triggs <erinn.looneytriggs(a)gmail.com> - 9.1.3-3
- Adjust useradd to be more flexible as shown here:
10 years, 1 month
[jetty] Simplify jetty startup script and use systemd features
by Michael Šimáček
commit fbf022988b8f28b759b93136b4807a22e32ee9ad
Author: Michael Simacek <msimacek(a)redhat.com>
Date: Tue Apr 1 19:29:55 2014 +0200
Simplify jetty startup script and use systemd features
djetty.script | 30 -------------
jetty.service | 7 ++-
jetty.sh | 136 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
jetty.spec | 25 +++++++----
4 files changed, 156 insertions(+), 42 deletions(-)
---
diff --git a/jetty.service b/jetty.service
index 97652c1..ae69ebf 100644
--- a/jetty.service
+++ b/jetty.service
@@ -9,9 +9,10 @@ Description=Jetty Web Application Server
After=syslog.target network.target
[Service]
-Type=forking
-ExecStart=/usr/bin/jetty start
-ExecStop=/usr/bin/jetty stop
+Type=simple
+ExecStart=/usr/share/jetty/bin/jetty.sh
+User=jetty
+Group=jetty
[Install]
WantedBy=multi-user.target
diff --git a/jetty.sh b/jetty.sh
new file mode 100644
index 0000000..5f44bbb
--- /dev/null
+++ b/jetty.sh
@@ -0,0 +1,136 @@
+#!/usr/bin/env bash
+# Configuration files
+#
+# /etc/default/jetty
+# If it exists, this is read at the start of script. It may perform any
+# sequence of shell commands, like setting relevant environment variables.
+#
+# /etc/jetty.conf
+# If found, and no configurations were given on the command line,
+# the file will be used as this script's configuration.
+# Each line in the file may contain:
+# - A comment denoted by the pound (#) sign as first non-blank character.
+# - The path to a regular file, which will be passed to jetty as a
+# config.xml file.
+# - The path to a directory. Each *.xml file in the directory will be
+# passed to jetty as a config.xml file.
+# - All other lines will be passed, as-is to the start.jar
+#
+# The files will be checked for existence before being passed to jetty.
+#
+# Configuration variables
+#
+# JAVA
+# Command to invoke Java. If not set, java (from the PATH) will be used.
+#
+# JAVA_OPTIONS
+# Extra options to pass to the JVM
+#
+# JETTY_HOME
+# Where Jetty is installed. If not set, the script will try go
+# guess it by first looking at the invocation path for the script,
+# and then by looking in standard locations as $HOME/opt/jetty
+# and /opt/jetty. The java system property "jetty.home" will be
+# set to this value for use by configure.xml files, f.e.:
+#
+# <Arg><Property name="jetty.home" default="."/>/webapps/jetty.war</Arg>
+#
+# JETTY_BASE
+# Where your Jetty base directory is. If not set, the value from
+# $JETTY_HOME will be used.
+#
+# JETTY_ARGS
+# The default arguments to pass to jetty.
+# For example
+# JETTY_ARGS=jetty.port=8080 jetty.spdy.port=8443 jetty.secure.port=443
+#
+
+set -e -C
+trap "exit 0" 15
+
+readConfig()
+{
+ echo "Reading $1.."
+ source "$1"
+}
+
+CONFIGS=()
+
+if [ -f /etc/default/jetty ]; then
+ readConfig /etc/default/jetty
+fi
+
+if [ -z "$JETTY_HOME" ]; then
+ JETTY_HOME=/usr/share/jetty
+fi
+
+if [ -z "$JETTY_BASE" ]; then
+ JETTY_BASE="$JETTY_HOME"
+fi
+
+cd "$JETTY_BASE"
+JETTY_BASE="$PWD"
+
+if [ -z "$JETTY_CONF" ]
+then
+ JETTY_CONF=/etc/jetty.conf
+fi
+
+if [ -f "$JETTY_CONF" ] && [ -r "$JETTY_CONF" ]
+then
+ while read -r CONF
+ do
+ if expr "$CONF" : '#' >/dev/null ; then
+ continue
+ fi
+
+ if [ -d "$CONF" ]
+ then
+ # assume it's a directory with configure.xml files
+ # for example: /etc/jetty.d/
+ # sort the files before adding them to the list of JETTY_ARGS
+ for XMLFILE in "$CONF/"*.xml
+ do
+ if [ -r "$XMLFILE" ] && [ -f "$XMLFILE" ]
+ then
+ JETTY_ARGS+=("$XMLFILE")
+ else
+ echo "** WARNING: Cannot read '$XMLFILE' specified in '$JETTY_CONF'"
+ fi
+ done
+ else
+ # assume it's a command line parameter (let start.jar deal with its validity)
+ JETTY_ARGS+=("$CONF")
+ fi
+ done < "$JETTY_CONF"
+fi
+
+if [ -z "$JAVA" ]
+then
+ . /usr/share/java-utils/java-functions
+ set_jvm
+ set_javacmd
+ JAVA="$JAVACMD"
+fi
+
+if [ -z "$JETTY_LOGS" ] && [ -d $JETTY_BASE/logs ]
+then
+ JETTY_LOGS=/var/log/jetty/logs
+fi
+JAVA_OPTIONS+=("-Djetty.logs=$JETTY_LOGS")
+
+JAVA_OPTIONS+=("-Djetty.home=$JETTY_HOME" "-Djetty.base=$JETTY_BASE")
+
+JETTY_START="$JETTY_HOME/start.jar"
+START_INI="$JETTY_BASE/start.ini"
+if [ ! -f "$START_INI" ]
+then
+ echo "Cannot find a start.ini in your JETTY_BASE directory: $JETTY_BASE" 2>&2
+ exit 1
+fi
+
+RUN_ARGS=(${JAVA_OPTIONS[@]} -jar "$JETTY_START" ${JETTY_ARGS[*]})
+RUN_CMD=("$JAVA" ${RUN_ARGS[@]})
+
+echo -n "Starting Jetty: "
+${RUN_CMD[*]}
diff --git a/jetty.spec b/jetty.spec
index dbde52b..70c5602 100644
--- a/jetty.spec
+++ b/jetty.spec
@@ -55,14 +55,14 @@
Name: jetty
Version: 9.1.3
-Release: 3%{?dist}
+Release: 4%{?dist}
Summary: Java Webserver and Servlet Container
# Jetty is dual licensed under both ASL 2.0 and EPL 1.0, see NOTICE.txt
License: ASL 2.0 or EPL
URL: http://www.eclipse.org/jetty/
Source0: http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/snapshot/jet...
-Source1: djetty.script
+Source1: jetty.sh
Source3: jetty.logrotate
Source5: %{name}.service
# MIT license text taken from Utf8Appendable.java
@@ -598,16 +598,18 @@ find . -name "*.class" -exec rm {} \;
%pom_remove_dep :org.eclipse.jdt.core jetty-jsp
-cp %{SOURCE1} djetty
cp %{SOURCE6} .
+# the default location is not allowed by SELinux
+sed -i '/<SystemProperty name="jetty.state"/d' \
+ jetty-distribution/src/main/resources/etc/jetty-started.xml
+
+
# Looks like all CDDL licensed content in tarball has been replaced,
# we don't need to install this license
rm LICENSE-CONTRIBUTOR/CDDLv1.0.txt
%build
-sed -i -e "s|/usr/share|%{_datadir}|g" djetty
-
%mvn_package :jetty-distribution __noinstall
# Separate package for main POM file
%mvn_package :jetty-project project
@@ -642,6 +644,9 @@ install -dm 755 %{buildroot}%{_unitdir}
# systemd unit file
cp %{SOURCE5} %{buildroot}%{_unitdir}/
+# replace the startup script with ours
+cp -p %{SOURCE1} %{buildroot}%{homedir}/
+
# main pkg
tar xvf jetty-distribution/target/%{name}-distribution-%{version}.%{addver}.tar.gz -C %{buildroot}%{homedir}
mv %{buildroot}%{homedir}/%{name}-distribution-%{version}.%{addver}/* %{buildroot}%{homedir}/
@@ -652,9 +657,6 @@ rm -f %{buildroot}%{homedir}/bin/*cygwin*
cp jetty-distribution/target/distribution/etc/* %{buildroot}%{homedir}/etc/
cp jetty-distribution/target/distribution/modules/* %{buildroot}%{homedir}/modules/
-chmod +x djetty
-mv djetty %{buildroot}%{_bindir}/djetty
-ln -s %{homedir}/bin/jetty.sh %{buildroot}%{_bindir}/%{name}
install -pm 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
echo '# Placeholder configuration file. No default is provided.' > \
%{buildroot}%{confdir}/jetty.conf
@@ -749,6 +751,7 @@ fi
exit 0
%post
+setsebool -P httpd_execmem 1
%systemd_post jetty.service
%preun
@@ -756,6 +759,7 @@ exit 0
%postun
%systemd_postun_with_restart jetty.service
+setsebool -P httpd_execmem 0
%triggerun -- jetty < 8.1.0-3
@@ -774,7 +778,6 @@ exit 0
%if %{with service}
%config(noreplace) %{_sysconfdir}/tmpfiles.d/%{name}.conf
%config(noreplace) %attr(644, root, root) %{_sysconfdir}/logrotate.d/%{name}
-%{_bindir}/*
%config(noreplace) %{confdir}
%dir %{jettylibdir}
%dir %{jettycachedir}
@@ -851,6 +854,10 @@ exit 0
%doc NOTICE.txt LICENSE*
%changelog
+* Tue Apr 01 2014 Michael Simacek <msimacek(a)redhat.com> - 9.1.3-4
+- Simplify (and fix) jetty startup script and use systemd features
+- Allow execmem access for jetty
+
* Thu Mar 06 2014 Erinn Looney-Triggs <erinn.looneytriggs(a)gmail.com> - 9.1.3-3
- Adjust useradd to be more flexible as shown here:
https://fedoraproject.org/wiki/Packaging:UsersAndGroups
10 years, 1 month
[javapackages/pom_editor.py] [pom_editor] pom_xpath_* can manipulate arbitrary XML files
by Michael Šimáček
commit 970e3d9316de6780a42e4e9490d3808307d016b2
Author: Michael Simacek <msimacek(a)redhat.com>
Date: Thu Apr 3 18:00:49 2014 +0200
[pom_editor] pom_xpath_* can manipulate arbitrary XML files
java-utils/pom_editor.py | 300 +++++++++++---------
test/data/pom_editor/build.xml | 26 ++
test/data/pom_editor/simple_ivy.xml | 11 +
test/data/pom_editor/want/build_attr.xml | 26 ++
test/data/pom_editor/want/build_set.xml | 25 ++
test/data/pom_editor/want/build_with_lib.xml | 27 ++
test/data/pom_editor/want/build_without_dist.xml | 19 ++
.../pom_editor/want/simple_ivy_added_foo_bar.xml | 12 +
test/data/pom_macros/pom_xpath_set_nons.xml-want | 8 +-
test/pom_editor_paths_test.py | 4 +-
test/pom_macros_test.py | 4 +-
test/test_common.py | 10 +-
12 files changed, 330 insertions(+), 142 deletions(-)
---
diff --git a/java-utils/pom_editor.py b/java-utils/pom_editor.py
index c4d653c..c79a3e4 100644
--- a/java-utils/pom_editor.py
+++ b/java-utils/pom_editor.py
@@ -12,6 +12,12 @@ from textwrap import dedent
# all macro fuctions that can be called from external world
macros = {}
+
+BEGIN_COMMENT = "<!-- begin of code added by maintainer -->"
+END_COMMENT = "<!-- end of code added by maintainer -->"
+COMMENT = (BEGIN_COMMENT, END_COMMENT)
+
+
class PomException(Exception):
pass
class PomQueryNoMatch(PomException):
@@ -80,24 +86,27 @@ def MetaArtifact(specification, **defaults):
return Artifact
-def find_pom(pompath):
- if path.isfile(pompath):
- return pompath
- if path.isdir(pompath):
- subpompath = path.join(pompath, 'pom.xml')
- if path.isfile(subpompath):
- return subpompath
- raise PomException("Couldn't locate POM file using pattern '{0}'"\
- .format(pompath))
-
-def find_poms_recursive(pomspec):
- modules = [find_pom(pomspec)]
+def find_xml(xmlpath):
+ if path.isfile(xmlpath):
+ return xmlpath
+ if path.isdir(xmlpath):
+ subxmlpath = path.join(xmlpath, 'pom.xml')
+ if path.isfile(subxmlpath):
+ return subxmlpath
+ subxmlpath = path.join(xmlpath, 'ivy.xml')
+ if path.isfile(subxmlpath):
+ return subxmlpath
+ raise PomException("Couldn't locate XML file using pattern '{0}'"\
+ .format(xmlpath))
+
+def find_xml_recursive(xmlspec):
+ modules = [find_xml(xmlspec)]
found = set(modules)
- module_xpath = '/pom:project/pom:modules/pom:module |\
- /pom:project/pom:profile/pom:modules/pom:module'
+ module_xpath = '/pom:project/pom:modules/pom:module |'\
+ '/pom:project/pom:profile/pom:modules/pom:module'
try:
while modules:
- pompath = find_pom(modules.pop())
+ pompath = find_xml(modules.pop())
found.add(pompath)
pom_xml = etree.parse(pompath)
modules += [path.join(path.dirname(pompath), node.text.strip())
@@ -127,7 +136,6 @@ def parse_args(function, args):
min_arg_count = len(arglist) - len(defaults)
fnargs = dict(zip(arglist, arguments[:min_arg_count]))
poms = arguments[min_arg_count:]
- print defaults
if len(defaults or [] > 1) and poms:
last = poms[-1]
if '<' in last:
@@ -137,86 +145,44 @@ def parse_args(function, args):
poms = ['.']
return options, fnargs, poms
-def macro():
- def decorator(function):
- def decorated(*args):
- try:
- pompath = None
- options, fnargs, poms = parse_args(function, args)
-
- for pomspec in poms:
- if options.recursive:
- pompaths = find_poms_recursive(pomspec)
- else:
- pompaths = [find_pom(pomspec)]
+class XmlFile(object):
+ default_name = None
+ NSMAP = {}
+ XMLNS = ''
- matches = 0
- for pompath in pompaths:
- try:
- pom = Pom(pompath)
- fnargs['pom'] = pom
- pom.patch(function, fnargs)
- matches += 1
- except PomQueryNoMatch as exception:
- pass
- if matches == 0 and not options.force:
- raise exception
-
- except (PomException, etree.XMLSyntaxError, IOError, TypeError) as exception:
- if pompath:
- print >> sys.stderr, "Error in processing {0}".format(pompath)
- print >> sys.stderr, exception.message
- print_usage(function)
- sys.exit(3)
-
- macros[function.__name__] = decorated
- return decorated
- return decorator
-
-class Pom(object):
- NSMAP = {'pom': 'http://maven.apache.org/POM/4.0.0',
- 'xsi': 'http://www.w3.org/2001/XMLSchema-instance'}
- NS = '{' + NSMAP['pom'] + '}'
- XMLNS = ('xmlns="http://maven.apache.org/POM/4.0.0"'
- 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"'
- 'xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 '
- 'http://maven.apache.org/xsd/maven-4.0.0.xsd"')
-
- BEGIN_COMMENT = "<!-- begin of code added by maintainer -->"
- END_COMMENT = "<!-- end of code added by maintainer -->"
-
- def __init__(self, pompath):
- with open(pompath) as pomfile:
- pom = re.sub(r'\<\s*project\s*\>',
- ('<project {ns}>').format(ns=self.XMLNS), pomfile.read())
- self.pompath = pompath
- self.root = etree.fromstring(pom)
+ def __init__(self, xmlpath):
+ self.xmlpath = xmlpath
+ self.root = None
+ self._load_file()
self.tab = get_indent(self.root)
+ def _load_file(self):
+ self.root = etree.parse(self.xmlpath).getroot()
+
def write(self, filename):
- with open(filename, 'w') as pomfile:
- pomfile.write(etree.tostring(self.root))
- pomfile.write('\n')
+ with open(filename, 'w') as xmlfile:
+ xmlfile.write(etree.tostring(self.root))
+ xmlfile.write('\n')
def patch(self, function, fnargs):
- pomdir = path.dirname(self.pompath)
- pomfile = path.basename(self.pompath)
+ xmldir = path.dirname(self.xmlpath)
+ xmlfile = path.basename(self.xmlpath)
try:
- self.write(path.join(pomdir, pomfile + '.tmp'))
+ self.write(path.join(xmldir, xmlfile + '.tmp'))
function(**fnargs)
finally:
- origfile = path.join(pomdir, pomfile + '.orig')
- shutil.move(self.pompath, origfile)
- self.write(self.pompath)
+ origfile = path.join(xmldir, xmlfile + '.orig')
+ shutil.move(self.xmlpath, origfile)
+ self.write(self.xmlpath)
- def inject_xml(self, parent, content):
- content = self.subtree_from_string(content)
+ def inject_xml(self, parent, content, comment=''):
+ content = self.subtree_from_string(content, comment)
items = len(content)
parent[:0] = content
self.reformat(parent, parent[:items])
- def replace_xml(self, replaced, content):
- content = self.subtree_from_string(content)
+ def replace_xml(self, replaced, content='', comment=''):
+ content = self.subtree_from_string(content, comment)
parent = replaced.getparent()
parent.text = content.text
if not isinstance(replaced, etree._Element):
@@ -229,32 +195,16 @@ class Pom(object):
parent.insert(idx + i, element)
self.reformat(parent, parent[idx: idx + items])
- def replace_xml_content(self, parent, content):
- content = self.subtree_from_string(content)
+ def replace_xml_content(self, parent, content, comment=''):
+ if hasattr(parent, 'is_attribute'):
+ if parent.is_attribute:
+ parent.getparent().attrib[parent.attrname] = content
+ return
+ content = self.subtree_from_string(content, comment)
parent[:] = content
parent.text = content.text
self.reformat(parent, parent)
- def make_path(self, node, elements):
- if elements:
- child = node.find(elements[0], namespaces=self.NSMAP)
- if child is None:
- name = re.sub(r'pom:', self.NS, elements[0])
- child = etree.Element(name)
- node.insert(0, child)
- node.insert(0, etree.Comment(" section added by maintainer "))
- self.reformat(node, node[:2])
- return self.make_path(child, elements[1:])
- return node
-
- def inject_artifact(self, where, node_name, artifact, aux_content=''):
- path_parts = [part for part in where.split('/') if part]
- parent = self.make_path(self.root, path_parts)
- self.inject_xml(parent, Pom.comment("<{name}>{content} {aux}</{name}>")\
- .format(name=node_name,
- content=artifact.get_xml(),
- aux=aux_content))
-
def reformat(self, parent_node, elements):
level = 0
element = parent_node
@@ -281,11 +231,7 @@ class Pom(object):
if len(query_result) > 1:
raise PomQueryAmbigous("XPath query '{0}' matched more than one nodes."\
.format(query))
- parent = query_result[0]
- if not isinstance(parent, etree._Element):
- raise PomQueryNoMatch("XPath query '{0}': matched node is not an element"\
- .format(query))
- return parent
+ return query_result[0]
def xpath_query(self, query):
if not query.startswith('/'):
@@ -301,17 +247,63 @@ class Pom(object):
(Did you forget to specify 'pom:' namespace?)""").format(query))
return query_result
- def subtree_from_string(self, xml_string, root='root'):
- document = "<{root} {ns}>{0}</{root}>".format(xml_string, root=root, ns=self.XMLNS)
+ def subtree_from_string(self, xml_string, comment=('', ''), root='root'):
+ if type(comment) == tuple:
+ begin, end = comment
+ else:
+ begin, end = comment, ''
+ document = "<{root} {ns}>{begin}{0}{end}</{root}>".format(xml_string,
+ root=root, ns=self.XMLNS, begin=begin, end=end)
try:
tree = etree.fromstring(document)
except etree.XMLSyntaxError as error:
raise PomException("Syntax error in injected XML: {0}.".format(error))
return tree
- @staticmethod
- def comment(content):
- return Pom.BEGIN_COMMENT + content + Pom.END_COMMENT
+ def make_path(self, node, elements):
+ if elements:
+ child = node.find(elements[0], namespaces=self.NSMAP)
+ if child is None:
+ name = elements[0]
+ for ns, url in self.NSMAP.iteritems():
+ ns_token = ns + ':'
+ url_token = '{' + url + '}'
+ name = name.replace(ns_token, url_token)
+ child = etree.Element(name)
+ node.insert(0, child)
+ node.insert(0, etree.Comment(" section added by maintainer "))
+ self.reformat(node, node[:2])
+ return self.make_path(child, elements[1:])
+ return node
+
+class Pom(XmlFile):
+ default_name = 'pom.xml'
+ NSMAP = {'pom': 'http://maven.apache.org/POM/4.0.0',
+ 'xsi': 'http://www.w3.org/2001/XMLSchema-instance'}
+ NS = '{' + NSMAP['pom'] + '}'
+ XMLNS = ('xmlns="http://maven.apache.org/POM/4.0.0"'
+ 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"'
+ 'xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 '
+ 'http://maven.apache.org/xsd/maven-4.0.0.xsd"')
+
+ def __init__(self, pompath):
+ super(Pom, self).__init__(pompath)
+
+ def _load_file(self):
+ with open(self.xmlpath) as pomfile:
+ pom = re.sub(r'\<\s*project\s*\>',
+ ('<project {ns}>').format(ns=self.XMLNS), pomfile.read())
+ self.root = etree.fromstring(pom)
+
+
+ def inject_artifact(self, where, node_name, artifact, aux_content=''):
+ path_parts = [part for part in where.split('/') if part]
+ parent = self.make_path(self.root, path_parts)
+ self.inject_xml(parent, "<{name}>{content} {aux}</{name}>"\
+ .format(name=node_name,
+ content=artifact.get_xml(),
+ aux=aux_content),
+ comment=COMMENT)
artifact_spec = 'groupId:artifactId:version'
artifact_spec_scoped = artifact_spec + ':scope'
@@ -320,30 +312,80 @@ DefaultVersionedArtifact = MetaArtifact(artifact_spec, version='any')
ScopedArtifact = MetaArtifact(artifact_spec_scoped)
DefaultScopedArtifact = MetaArtifact(artifact_spec_scoped, version='any')
+def create_xml_object(filepath):
+ tree = etree.parse(filepath)
+ root = tree.getroot()
+ pom_detect = '/pom:project/pom:modelVersion|/project/modelVersion'
+ if root.xpath(pom_detect, namespaces=Pom.NSMAP):
+ return Pom(filepath)
+ if root.tag == 'ivy-module':
+ pass
+ return XmlFile(filepath)
+
+def macro(types=(XmlFile,)):
+ def decorator(function):
+ def decorated(*args):
+ try:
+ xmlpath = None
+ options, fnargs, xmls = parse_args(function, args)
+
+ for xmlspec in xmls:
+ if options.recursive:
+ xmlpaths = find_xml_recursive(xmlspec)
+ else:
+ xmlpaths = [find_xml(xmlspec)]
+
+ matches = 0
+ for xmlpath in xmlpaths:
+ try:
+ xml = create_xml_object(xmlpath)
+ if not any(isinstance(xml, allowed) for allowed in types):
+ raise PomException('Operation not supported on '
+ 'given file type.')
+ fnargs['pom'] = xml
+ xml.patch(function, fnargs)
+ matches += 1
+ except PomQueryNoMatch as exception:
+ pass
+ if matches == 0 and not options.force:
+ raise exception
+
+ except (PomException, etree.XMLSyntaxError, IOError, TypeError) as exception:
+ if xmlpath:
+ print >> sys.stderr, "Error in processing {0}".format(xmlpath)
+ print >> sys.stderr, exception.message
+ print_usage(function)
+ sys.exit(3)
+
+ macros[function.__name__] = decorated
+ return decorated
+ return decorator
+
+
@macro()
def pom_xpath_inject(where, xml_string, pom=None):
"""<XPath> [XML code] [POM location]"""
for element in pom.xpath_query(where):
- pom.inject_xml(element, Pom.comment(xml_string))
+ pom.inject_xml(element, xml_string, comment=COMMENT)
@macro()
def pom_xpath_replace(where, xml_string, pom=None):
"""<XPath> <XML code> [POM location]"""
for element in pom.xpath_query(where):
- pom.replace_xml(element, Pom.comment(xml_string))
+ pom.replace_xml(element, xml_string, comment=COMMENT)
@macro()
def pom_xpath_remove(where, pom=None):
"""<XPath> [POM location]"""
for element in pom.xpath_query(where):
pom.replace_xml(element,
- "<!-- element removed by maintainer: {0} -->".format(where))
+ comment="<!-- element removed by maintainer: {0} -->".format(where))
@macro()
def pom_xpath_set(where, content, pom=None):
"""<XPath> <new contents> [POM location]"""
for element in pom.xpath_query(where):
- pom.replace_xml_content(element, Pom.comment(content))
+ pom.replace_xml_content(element, content, comment=COMMENT)
@macro()
def pom_remove_dep(dep, pom=None):
@@ -354,11 +396,11 @@ def pom_remove_dep(dep, pom=None):
elements = pom.xpath_query(xpath)
for element in elements:
pom.replace_xml(element,
- "<!-- dependency removed by maintainer: {0} -->".format(dep))
+ comment="<!-- dependency removed by maintainer: {0} -->".format(dep))
except PomQueryNoMatch:
raise PomQueryNoMatch("Dependency '{0}' not found.".format(dep))
-@macro()
+@macro(types=(Pom,))
def pom_remove_plugin(plugin, pom=None):
"""[groupId]:[artifactId] [POM location]"""
try:
@@ -367,11 +409,11 @@ def pom_remove_plugin(plugin, pom=None):
elements = pom.xpath_query(xpath)
for element in elements:
pom.replace_xml(element,
- "<!-- plugin removed by maintainer: {0} -->".format(plugin))
+ comment="<!-- plugin removed by maintainer: {0} -->".format(plugin))
except PomQueryNoMatch:
raise PomQueryNoMatch("Plugin '{0}' not found.".format(plugin))
-@macro()
+@macro(types=(Pom,))
def pom_disable_module(module, pom=None):
"""<module name> [POM location]"""
try:
@@ -379,11 +421,11 @@ def pom_disable_module(module, pom=None):
elements = pom.xpath_query(xpath)
for element in elements:
pom.replace_xml(element,
- "<!-- module removed by maintainer: {0} -->".format(module))
+ comment="<!-- module removed by maintainer: {0} -->".format(module))
except PomQueryNoMatch:
raise PomQueryNoMatch("Module '{0}' not found.".format(module))
-@macro()
+@macro(types=(Pom,))
def pom_add_parent(parent, pom=None):
"""groupId:artifactId[:version] [POM location]"""
if pom.root.find('pom:parent', namespaces=Pom.NSMAP) is not None:
@@ -391,16 +433,16 @@ def pom_add_parent(parent, pom=None):
artifact = DefaultVersionedArtifact.from_mvn_str(parent)
pom.inject_artifact('', 'parent', artifact)
-@macro()
+@macro(types=(Pom,))
def pom_remove_parent(pom=None):
"""[POM location]"""
try:
pom.replace_xml(pom.xpath_query_element("/pom:project/pom:parent"),
- "<!-- parent POM reference removed by maintainer -->")
+ comment="<!-- parent POM reference removed by maintainer -->")
except PomQueryNoMatch:
raise PomQueryNoMatch("POM doesn't specify parent.")
-@macro()
+@macro(types=(Pom,))
def pom_set_parent(parent, pom=None):
"""groupId:artifactId[:version] [POM location]"""
try:
@@ -417,14 +459,14 @@ def pom_add_dep(dep, pom=None, xml_string=''):
pom.inject_artifact('pom:dependencies', 'dependency', artifact,
xml_string)
-@macro()
+@macro(types=(Pom,))
def pom_add_dep_mgmt(dep, pom=None, xml_string=''):
"""groupId:artifactId[:version[:scope]] [POM location] [extra XML]"""
artifact = DefaultScopedArtifact.from_mvn_str(dep)
pom.inject_artifact('pom:dependencyManagement/pom:dependencies',
'dependency', artifact, xml_string)
-@macro()
+@macro(types=(Pom,))
def pom_add_plugin(plugin, pom=None, xml_string=''):
"""groupId:artifactId[:version] [POM location] [extra XML]"""
artifact = MetaArtifact(artifact_spec, version='any',
diff --git a/test/data/pom_editor/build.xml b/test/data/pom_editor/build.xml
new file mode 100644
index 0000000..b85dd3c
--- /dev/null
+++ b/test/data/pom_editor/build.xml
@@ -0,0 +1,26 @@
+<project name="MyProject" default="dist" basedir=".">
+ <property name="src" location="src"/>
+ <property name="build" location="build"/>
+ <property name="dist" location="dist"/>
+
+ <target name="init" description="Create build directory">
+ <mkdir dir="${build}"/>
+ </target>
+
+ <target name="compile" depends="init"
+ description="Compile the source">
+ <javac srcdir="${src}" destdir="${build}"/>
+ </target>
+
+ <target name="dist" depends="compile"
+ description="Generate jar">
+ <mkdir dir="${dist}/lib"/>
+
+ <jar jarfile="${dist}/myproject.jar" basedir="${build}"/>
+ </target>
+
+ <target name="clean" description="Clean build files">
+ <delete dir="${build}"/>
+ <delete dir="${dist}"/>
+ </target>
+</project>
diff --git a/test/data/pom_editor/simple_ivy.xml b/test/data/pom_editor/simple_ivy.xml
new file mode 100644
index 0000000..0b6621c
--- /dev/null
+++ b/test/data/pom_editor/simple_ivy.xml
@@ -0,0 +1,11 @@
+<ivy-module version="2.0">
+ <info organisation="org.apache.lucene" module="benchmark"/>
+ <dependencies>
+ <dependency org="org.apache.commons" name="commons-compress" rev="${/org.apache.commons/commons-compress}" transitive="false"/>
+ <dependency org="xerces" name="xercesImpl" rev="${/xerces/xercesImpl}" transitive="false"/>
+ <dependency org="net.sourceforge.nekohtml" name="nekohtml" rev="${/net.sourceforge.nekohtml/nekohtml}" transitive="false"/>
+ <dependency org="com.ibm.icu" name="icu4j" rev="${/com.ibm.icu/icu4j}" transitive="false"/>
+ <dependency org="com.spatial4j" name="spatial4j" rev="${/com.spatial4j/spatial4j}" transitive="false"/>
+ <exclude org="*" ext="*" matcher="regexp" type="${ivy.exclude.types}"/>
+ </dependencies>
+</ivy-module>
diff --git a/test/data/pom_editor/want/build_attr.xml b/test/data/pom_editor/want/build_attr.xml
new file mode 100644
index 0000000..2583065
--- /dev/null
+++ b/test/data/pom_editor/want/build_attr.xml
@@ -0,0 +1,26 @@
+<project name="MyProject" default="dist" basedir=".">
+ <property name="src" location="src"/>
+ <property name="build" location="build"/>
+ <property name="dist" location="dist"/>
+
+ <target name="init" description="Create build directory">
+ <mkdir dir="${build}"/>
+ </target>
+
+ <target name="compile" depends="init"
+ description="Compile the source">
+ <javac srcdir="${src}" destdir="${build}"/>
+ </target>
+
+ <target name="dist" depends="compile"
+ description="Generate jar">
+ <mkdir dir="${dist}/lib"/>
+
+ <jar jarfile="${dist}/other.jar" basedir="${build}"/>
+ </target>
+
+ <target name="clean" description="Clean build files">
+ <delete dir="${build}"/>
+ <delete dir="${dist}"/>
+ </target>
+</project>
diff --git a/test/data/pom_editor/want/build_set.xml b/test/data/pom_editor/want/build_set.xml
new file mode 100644
index 0000000..6d609df
--- /dev/null
+++ b/test/data/pom_editor/want/build_set.xml
@@ -0,0 +1,25 @@
+<project name="MyProject" default="dist" basedir=".">
+ <property name="src" location="src"/>
+ <property name="build" location="build"/>
+ <property name="dist" location="dist"/>
+
+ <target name="init" description="Create build directory">
+ <mkdir dir="${build}"/>
+ </target>
+
+ <target name="compile" depends="init"
+ description="Compile the source">
+ <javac srcdir="${src}" destdir="${build}"/>
+ </target>
+
+ <target name="dist" depends="compile"
+ description="Generate jar">
+ <mkdir dir="${dist}/lib"/>
+
+ <jar jarfile="${dist}/myproject.jar" basedir="${build}"/>
+ </target>
+
+ <target name="clean" description="Clean build files">
+ <echo/>
+ </target>
+</project>
diff --git a/test/data/pom_editor/want/build_with_lib.xml b/test/data/pom_editor/want/build_with_lib.xml
new file mode 100644
index 0000000..9cdfca3
--- /dev/null
+++ b/test/data/pom_editor/want/build_with_lib.xml
@@ -0,0 +1,27 @@
+<project name="MyProject" default="dist" basedir=".">
+ <property name="src" location="src"/>
+ <property name="build" location="build"/>
+ <property name="dist" location="dist"/>
+
+ <target name="init" description="Create build directory">
+ <mkdir dir="lib"/>
+ <mkdir dir="${build}"/>
+ </target>
+
+ <target name="compile" depends="init"
+ description="Compile the source">
+ <javac srcdir="${src}" destdir="${build}"/>
+ </target>
+
+ <target name="dist" depends="compile"
+ description="Generate jar">
+ <mkdir dir="${dist}/lib"/>
+
+ <jar jarfile="${dist}/myproject.jar" basedir="${build}"/>
+ </target>
+
+ <target name="clean" description="Clean build files">
+ <delete dir="${build}"/>
+ <delete dir="${dist}"/>
+ </target>
+</project>
diff --git a/test/data/pom_editor/want/build_without_dist.xml b/test/data/pom_editor/want/build_without_dist.xml
new file mode 100644
index 0000000..09e289a
--- /dev/null
+++ b/test/data/pom_editor/want/build_without_dist.xml
@@ -0,0 +1,19 @@
+<project name="MyProject" default="dist" basedir=".">
+ <property name="src" location="src"/>
+ <property name="build" location="build"/>
+ <property name="dist" location="dist"/>
+
+ <target name="init" description="Create build directory">
+ <mkdir dir="${build}"/>
+ </target>
+
+ <target name="compile" depends="init"
+ description="Compile the source">
+ <javac srcdir="${src}" destdir="${build}"/>
+ </target>
+
+ <target name="clean" description="Clean build files">
+ <delete dir="${build}"/>
+ <delete dir="${dist}"/>
+ </target>
+</project>
diff --git a/test/data/pom_editor/want/simple_ivy_added_foo_bar.xml b/test/data/pom_editor/want/simple_ivy_added_foo_bar.xml
new file mode 100644
index 0000000..27b23b3
--- /dev/null
+++ b/test/data/pom_editor/want/simple_ivy_added_foo_bar.xml
@@ -0,0 +1,12 @@
+<ivy-module version="2.0">
+ <info organisation="org.apache.lucene" module="benchmark"/>
+ <dependencies>
+ <dependency org="foo" name="bar" transitive="false"/>
+ <dependency org="org.apache.commons" name="commons-compress" rev="${/org.apache.commons/commons-compress}" transitive="false"/>
+ <dependency org="xerces" name="xercesImpl" rev="${/xerces/xercesImpl}" transitive="false"/>
+ <dependency org="net.sourceforge.nekohtml" name="nekohtml" rev="${/net.sourceforge.nekohtml/nekohtml}" transitive="false"/>
+ <dependency org="com.ibm.icu" name="icu4j" rev="${/com.ibm.icu/icu4j}" transitive="false"/>
+ <dependency org="com.spatial4j" name="spatial4j" rev="${/com.spatial4j/spatial4j}" transitive="false"/>
+ <exclude org="*" ext="*" matcher="regexp" type="${ivy.exclude.types}"/>
+ </dependencies>
+</ivy-module>
diff --git a/test/data/pom_macros/pom_xpath_set_nons.xml-want b/test/data/pom_macros/pom_xpath_set_nons.xml-want
index d39228c..e75cc01 100644
--- a/test/data/pom_macros/pom_xpath_set_nons.xml-want
+++ b/test/data/pom_macros/pom_xpath_set_nons.xml-want
@@ -2,10 +2,10 @@
<parent>
<groupId>org.apache.commons</groupId>
<artifactId>
-<!-- begin of code added by maintainer -->
-a-Id
-
-<!-- end of code added by maintainer --></artifactId>
+ <!-- begin of code added by maintainer -->
+ a-Id
+ <!-- end of code added by maintainer -->
+ </artifactId>
<version>2.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/test/pom_editor_paths_test.py b/test/pom_editor_paths_test.py
index e699727..a4383fd 100644
--- a/test/pom_editor_paths_test.py
+++ b/test/pom_editor_paths_test.py
@@ -9,12 +9,12 @@ class TestPomPath(WorkdirTestCase):
def test_default_nonexistent(self):
return_value, stderr, _ = exec_pom_macro('%pom_remove_parent', {})
- self.assertIn("Couldn't locate POM file", stderr)
+ self.assertIn("Couldn't locate ", stderr)
self.assertNotEqual(0, return_value)
def test_submodule_nonexistent(self):
return_value, stderr, _ = exec_pom_macro('%pom_remove_parent submodule', {})
- self.assertIn("Couldn't locate POM file", stderr)
+ self.assertIn("Couldn't locate ", stderr)
self.assertNotEqual(0, return_value)
def test_default(self):
diff --git a/test/pom_macros_test.py b/test/pom_macros_test.py
index 8b1d8ea..bded78c 100644
--- a/test/pom_macros_test.py
+++ b/test/pom_macros_test.py
@@ -534,7 +534,7 @@ class PomMacrosTest(unittest.TestCase):
_, stderr, returncode = package.run_prep()
self.assertEqual(returncode, 1, stderr)
- self.assertIn("Couldn't locate POM file using pattern", stderr)
+ self.assertIn("Couldn't locate ", stderr)
def test_no_pom_explicit(self):
package = Package("nonexistent_pom_explicit")
@@ -542,7 +542,7 @@ class PomMacrosTest(unittest.TestCase):
_, stderr, returncode = package.run_prep()
self.assertEqual(returncode, 1, stderr)
- self.assertIn("Couldn't locate POM file using pattern", stderr)
+ self.assertIn("Couldn't locate ", stderr)
if __name__ == '__main__':
unittest.main()
diff --git a/test/test_common.py b/test/test_common.py
index 4bab110..f92c6e4 100644
--- a/test/test_common.py
+++ b/test/test_common.py
@@ -166,7 +166,7 @@ class WorkdirTestCase(unittest.TestCase):
pass
os.chdir(self.olddir)
-def exec_pom_macro(line, poms_tree, want_tree=None):
+def exec_pom_macro(line, poms_tree, want_tree=None, filename='pom.xml'):
"""
Parameters:
line::
@@ -186,7 +186,7 @@ def exec_pom_macro(line, poms_tree, want_tree=None):
pack = Package('test')
pack.append_to_prep(line)
for destpath, sourcepath in poms_tree.iteritems():
- pack.add_source(path.join(DATADIR, sourcepath), path.join(destpath, 'pom.xml'))
+ pack.add_source(path.join(DATADIR, sourcepath), path.join(destpath, filename))
_, stderr, return_value = pack.run_prep()
reports = []
if return_value == 0:
@@ -196,9 +196,9 @@ def exec_pom_macro(line, poms_tree, want_tree=None):
else:
expected_pom = pom
expected_pom = path.join(DATADIR, expected_pom)
- actual_pom = path.join(pack.buildpath, filepath, 'pom.xml')
+ actual_pom = path.join(pack.buildpath, filepath, filename)
reports.append(compare_xml_files(actual_pom, expected_pom))
return return_value, stderr, '\n'.join(reports).strip()
-def exec_pom_macro_simple(line, pom, want=None):
- return exec_pom_macro(line, {'': pom}, {'': want} if want else None)
+def exec_pom_macro_simple(line, pom, want=None, filename='pom.xml'):
+ return exec_pom_macro(line, {'': pom}, {'': want} if want else None, filename=filename)
10 years, 1 month