Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for BuildArch SPEC configuration #112

Closed
peter-svensson opened this issue Dec 18, 2013 · 6 comments
Closed

Support for BuildArch SPEC configuration #112

peter-svensson opened this issue Dec 18, 2013 · 6 comments
Labels

Comments

@peter-svensson
Copy link

When running rpm:package-bin on OsX the rpmbuild tool seems to be slightly different than when running on a linux (Ubuntu/Centos). This might be due to some configuration error on my OsX rpmbuild of course...
I'm trying to package a "noarch" rpm but on OsX it insists on building a "x86_64" rpm file even though the "noarch" flag is passed to rpmbuild.

[debug] Executing rpmbuild with: rpmbuild -bb --buildroot /Users/peterl/Source/test/target/rpm/buildroot --define _topdir /Users/peterl/Source/test/target/rpm --target noarch-Peter-linux test.spec
[info] Building target platforms: noarch-Peter-linux
[info] Executing(%install): /bin/sh -e /usr/local/var/tmp/rpm-tmp.78161
[error] + umask 022
[error] + cd /Users/peterl/Source/test/target/rpm/BUILD
[error] + /bin/rm -rf /Users/peterl/Source/test/target/rpm/buildroot
[error] + /bin/mkdir -p /Users/peterl/Source/test/target/rpm/buildroot
[error] + '[' -e /Users/peterl/Source/test/target/rpm/buildroot ']'
[error] + mv /Users/peterl/Source/test/target/rpm/tmp-buildroot/etc /Users/peterl/Source/test/target/rpm/tmp-buildroot/usr /Users/peterl/Source/test/target/rpm/buildroot
[info] Processing files: test-0.8-snapshot.x86_64

If I edit the generated SPEC file adding:

BuildArch: noarch

And then running the rpmbuild command I get the correct "noarch".

rpmbuild -bb -v --buildroot /Users/peterl/Source/test/target/rpm/buildroot --define '_topdir /Users/peterl/Source/test/target/rpm' --target noarch target/rpm/SPECS/test.spec

Building target platforms: noarch
Executing(%install): /bin/sh -e /usr/local/var/tmp/rpm-tmp.96006
+ umask 022
+ cd /Users/peterl/Source/test/target/rpm/BUILD
+ /bin/rm -rf /Users/peterl/Source/test/target/rpm/buildroot
+ /bin/mkdir -p /Users/peterl/Source/test/target/rpm/buildroot
+ '[' -e /Users/peterl/Source/test/target/rpm/buildroot ']'
+ mv /Users/peterl/Source/test/target/rpm/tmp-buildroot/peter /Users/peterl/Source/test/target/rpm/buildroot
+ exit 0
Processing files: schematron-service-0.8-snapshot.noarch

Perhaps we could add support for "BuildArch" in RpmMetdata.writeSpec as well?

@jsuereth
Copy link
Member

You may have nailed a long standing bug from the differences between OSX rpmbuild and linux-y versions. I think you're on to something here. If this doesn't break the linux building, then I'm more than willing to make the change.

The first rule of the native packager is that building the natives on the native platform should work. The second is that we should try to support any platform building for any other if reasonable methods exist.

@peter-svensson
Copy link
Author

"The first rule of the native packager is that building the natives on the native platform should work. The second is that we should try to support any platform building for any other if reasonable methods exist."

I totally agree, but it would be nice to be able to build linux distributable components on a "linux-like" platform like OsX :)

A possible solution might be to introduce another configuration key in Keys to support setting the value (which will not be set at all by default). This would not break current working builds? Might even name it to experimental-somethingsomething to be clear that it is a test feature.

I'm not good enough using rpmbuild to actually tell the implications of setting the

BuildArch: noarch

will do to other builds.

How to build rpm packages says:

BuildArch: If you're packaging files that are architecture-independent (e.g. shell scripts, data files), then add "BuildArch: noarch". The architecture for the binary RPM will then be "noarch".

Which suggests that it should most likely be set if one actually is running with --target noarch ?

Let me know if you want help implementing and/or testing this issue and I'll try to help,

@muuki88 muuki88 closed this as completed in 81fa4ad Feb 6, 2014
jsuereth added a commit that referenced this issue Feb 6, 2014
FIX #112 Adding BuildArch to the spec file
@jon-shanks
Copy link

Hey,

I dont have the noarch issue but i do have the issue with the fact that it sees the rpm script as an [error] from your message it seems like this is expected behavior. The rpm gets built but i wanted a way of it not assuming that there are errors in the build. Is this something to do with the return code from the bash each time that it is parsing? or maybe not getting?

@muuki88
Copy link
Contributor

muuki88 commented Feb 25, 2014

Is this something to do with the return code from the bash each time that it is parsing

Yep, I think that's the problem. This is maybe an SBT issue. Confusing, but not harmful :(

@jsuereth
Copy link
Member

It's actually the set -x line which I keep forgetting to remove, but I think you found that bug report.

@jon-shanks
Copy link

I don't think it is, rpmbuild is responsible for creating the scripts from
the corresponding sections, %install on mine doesn't have a set -x option
within it and checking the code i don't see that either in the metadata
scala file. Plus set -x is just bash debug, which just is for debugging and
it goes to stdout as oppose stderr. By default as well rpmbuild does a sh
-e to the actual tmp script it creates for the sections, so that it will
bomb out and stop on any error.

So this has to be something to do with it thinking stdout is infact stderr
or something else?

Jon

On 25 February 2014 18:57, Josh Suereth notifications@github.com wrote:

It's actually the set -x line which I keep forgetting to remove, but I
think you found that bug report.

Reply to this email directly or view it on GitHubhttps://github.com//issues/112#issuecomment-36043955
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants