问题描述:

I have java project with building rpm by maven. Required create noarch packets, but i see concrete arch.

I install rpm(4.4.9 or 5.2.0) via macports at MacOsX, and run command from maven rpm plugin:

sudo rpmbuild -bb -v --buildroot /path/to/project/buildroot --target noarch java-search-qt.spec

Building target platforms: noarch

Executing(%install): /bin/bash -e /tmp/rpm-tmp.69257

+ umask 022

+ cd /opt/local/src/macports/BUILD

+ /bin/rm -rf /path/to/project/target/rpm/project/buildroot

+ /bin/rm -rf /path/to/project/target/rpm/project/buildroot

+ '[' -e /path/to/project/target/rpm/project/buildroot ']'

+ mv /path/to/project/target/rpm/project/tmp-buildroot /path/to/project/target/rpm/project/buildroot

+ /opt/local/lib/rpm/brp-compress

+ /opt/local/lib/rpm/brp-strip

+ /opt/local/lib/rpm/brp-strip-static-archive

+ /opt/local/lib/rpm/brp-strip-comment-note

+ /opt/local/lib/rpm/brp-nobuildrootpath

Processing files: java-search-qt-1.0.17-1

Finding Provides: /opt/local/lib/rpm/find-provides

Finding Requires: /opt/local/lib/rpm/find-requires

Requires(interp): /bin/bash /bin/bash /bin/bash /bin/bash

Requires(verify): /bin/bash

Requires(pre): /bin/bash

Requires(post): /bin/bash

Requires(postun): /bin/bash

Checking for unpackaged file(s): /opt/local/lib/rpm/check-files /path/to/project/target/rpm/project/buildroot

Wrote: /opt/local/src/macports/RPMS/i386/project.i386.rpm

Maven plugin use option "--target noarch", but rpmbuild fully ignore it's. Expected noarch.rpm file, why rpmbuild create i386 at 4.4.9 version and x86?

Update

I found one working variant of call rpmbuilder, builds *.noarch.rpm file:

rpmbuild -bb --target noarch-linux-pc project.spec

Another variants, build *.i386.rpm file:

rpmbuild -bb --buildroot /path/to/buildroot --target noarch-linux-pc project.spec

rpmbuild -bb --define '_topdir /path/to/topdir' --target noarch-linux-pc project.spec

I can't understand. Any ideas?

P.S. Sorry for my english, it's difficult language for me.

网友答案:

I found the mistake!

The maven-rpm-plugin tool sucks. This package contains class RPMHelper, and uses bash command builder. The rpmbuild tool requires strong param ordering, and this class ignore all rules. I changed param ordering, and now I have correctly builded rpm packet. From what I see, codehaus command is no longer support. I think that need we need a fork on github.

网友答案:

I have different versions of everything, but on OS X, using RPM 5.4.14 and rpm-maven-plugin 2.1-alpha-3, I can create a noarch RPM for Linux by specifying:

<needarch>noarch</needarch>
<targetOS>linux</targetOS>

rpm-maven-plugin says:

[INFO] Building target platforms: noarch-apple-linux

From the command line, checking the package, all looks well:

rpm -qp --qf 'Arch:%{ARCH} OS:%{OS}\n' my-rpm-0.0.1-1.noarch.rpm 
Arch:noarch OS:linux

... and the result installs happily on Linux.

网友答案:

I don't have any experience with building on MacOSX but I thought I'd post our pom.xml file here as a reference:

http://pastebin.com/dHVA4yZ1

The maven command line we use under CentOS Linux is:

mvn clean compile rpm:attached-rpm deploy

This deploys our RPMs and also creates:

target/rpm/mprew-behavior/RPMS/noarch/mprew-behavior-2.12.0s-19068.noarch.rpm

Hope this helps somewhat.

相关阅读:
Top