You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Consider the example in the following archive: pluginbug.zip
It contains sources for building a simple RPM containing:
the directory /opt/test, and
the file /opt/test/README.md.
There's a pom.xml file for building the RPM via the Maven RPM plugin, and a .spec file for building the same RPM using the rpmbuild command (by running rpmbuild --define="%_topdir $PWD" -bb SPECS/rpm-plugin-test.spec).
In the example, %dir /opt/test is specified after the file, and this causes the Maven plugin to generate an RPM that can't be installed:
$ sudo rpm -i target/rpm-plugin-test-0.1.0-1-noarch.rpm
error: unpacking of archive failed on file /opt/test/README.md;59198b61: cpio: open failed - No such file or directory
error: rpm-plugin-test-0.1.0-1.noarch: install failed
The same RPM generated using rpmbuild installs without issue. Looking at the entries in the cpio archive within the two RPMs seems revealing:
The problem seems to be that the RPM generated by the plugin fails to install because cpio can't write the README.md file because the folder it should be in doesn't exist yet. The Maven plugin should order entries in the archive in such a way that it can always be installed, like the rpmbuild command.
Consider the example in the following archive:
pluginbug.zip
It contains sources for building a simple RPM containing:
/opt/test
, and/opt/test/README.md
.There's a
pom.xml
file for building the RPM via the Maven RPM plugin, and a .spec file for building the same RPM using therpmbuild
command (by runningrpmbuild --define="%_topdir $PWD" -bb SPECS/rpm-plugin-test.spec
).In the example,
%dir /opt/test
is specified after the file, and this causes the Maven plugin to generate an RPM that can't be installed:The same RPM generated using
rpmbuild
installs without issue. Looking at the entries in the cpio archive within the two RPMs seems revealing:The problem seems to be that the RPM generated by the plugin fails to install because cpio can't write the README.md file because the folder it should be in doesn't exist yet. The Maven plugin should order entries in the archive in such a way that it can always be installed, like the
rpmbuild
command.Fixing the given example is trivial, of course - just swap the order of the entries. However, for more complicated builds, this may not be possible, especially when profiles are used to contribute independent parts of the RPM plugin config using stuff like http://blog.sonatype.com/2011/01/maven-how-to-merging-plugin-configuration-in-complex-projects/ .
The text was updated successfully, but these errors were encountered: