Bug 837204 - %pom_xpath_remove does not work with simple queries
Summary: %pom_xpath_remove does not work with simple queries
Keywords:
Status: CLOSED CANTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: javapackages-tools
Version: rawhide
Hardware: All
OS: Linux
high
high
Target Milestone: ---
Assignee: Mikolaj Izdebski
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-07-03 07:17 UTC by Krzysztof Daniel
Modified: 2014-01-13 00:27 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-07-09 09:10:50 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Krzysztof Daniel 2012-07-03 07:17:52 UTC
pom files use a default namespace. XPath does not work well with default namespaces, and simple queries like

/module

do not work at all. it is necessary to use functions which are complicated and unreadable
%pom_xpath_remove "*[local-name() = 'environment' and namespace-uri() = 'http://maven.apache.org/POM/4.0.0']/*[local-name() = 'os' and not(text() = 'linux')]

Comment 1 Mikolaj Izdebski 2012-07-09 09:10:50 UTC
Implicit POM namespace can't be easily implemented because of XPath limitations.
POM namespace has to be specified explicitly for every node.

The expression from comment #1 could be written as:
%pom_xpath_remove "pom:environment/pom:os[not(text() = 'linux')]"
(or similar) which is much better, but yet not perfect. As far as I know
the pom: prefix can't be easily eliminated from XPath expressions.

To clarify this, the following comment was added upstream:

# NOTE: POM files use a specific namespace - http://maven.apache.org/POM/4.0.0.
# The easiest way to respect this namespace in XPath expressions is prefixing
# all node names with "pom:". For example, "pom:environment/pom:os" will work
# because it selects nodes from pom namespace, but "environment/os" won't find
# anything because it looks for nodes that don't belong to any XML namespace.

Comment 2 Fedora Update System 2012-07-09 14:40:46 UTC
jpackage-utils-1.7.5-18.1.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/jpackage-utils-1.7.5-18.1.fc17

Comment 3 Fedora Update System 2012-07-23 20:27:49 UTC
jpackage-utils-1.7.5-18.1.fc17 has been pushed to the Fedora 17 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.