8

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.

mitallast
  • 183
  • 2
  • 8

3 Answers3

6

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.

PaoloC
  • 519
  • 5
  • 5
5

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.

Shawn Chin
  • 84,080
  • 19
  • 162
  • 191
mitallast
  • 183
  • 2
  • 8
1

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.

Gray
  • 115,027
  • 24
  • 293
  • 354
  • Thanks, but threre's no problem of plugin - binary tool [rpmbuild](http://www.rpm.org/max-rpm-snapshot/rpmbuild.8.html) have strange behavior at '--target' option – mitallast Nov 08 '11 at 14:52
  • According to the RPM plugin the default is `noarch`. What version of rpmbuild are you using? WE're using RPM version 4.4.2. http://mojo.codehaus.org/rpm-maven-plugin/ident-params.html#needarch – Gray Nov 08 '11 at 15:10
  • And you are not specifying a source architecture, right? http://mojo.codehaus.org/rpm-maven-plugin/source-params.html#targetArchitecture – Gray Nov 08 '11 at 15:14
  • Current available macport rpm version is 4.4.9, and I use it . As I know, latest version 5.3.x. Yes, I'm not specifying architecture, because I need noarch! At linux works correctly, as result I see *.noarch.rpm file. But only on mac rpmbuild create *.i386.rpm file. I'm try set targetArchitecture as noarch, but it's ignored by builder. – mitallast Nov 08 '11 at 15:39
  • Sounds like you are doing it all correctly. Sorry to not be of help. This is an interesting thread. They use: `--target 'noarch-apple-mac os x' with * on either side. Good luck. http://old.nabble.com/-jira--Created%3A-(MRPM-67)-rpm-goal-always-fails-on-Mac-OS-X-td27844879.html – Gray Nov 08 '11 at 15:55