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

OS X can't built rpm with noarch and linux as the target #707

Closed
alanthing opened this Issue May 16, 2014 · 13 comments

Comments

Projects
None yet
4 participants
@alanthing
Contributor

alanthing commented May 16, 2014

I'm writing simple bash scripts on my OS X machine that will ultimately be installed on Linux servers but ran into this problem. I isolated it down to where it breaks down.

Using OS X as the build host, you can specify --rpm-os linux:

$ fpm --rpm-os linux -t rpm -s dir -n test -v 1.0 testdir
no value for epoch is set, defaulting to nil {:level=>:warn}
no value for epoch is set, defaulting to nil {:level=>:warn}
Created package {:path=>"test-1.0-1.x86_64.rpm"}

You can specify --architecture all:

$ fpm --architecture all -t rpm -s dir -n test -v 1.0 testdir
no value for epoch is set, defaulting to nil {:level=>:warn}
no value for epoch is set, defaulting to nil {:level=>:warn}
Created package {:path=>"test-1.0-1.noarch.rpm"}

But, they don't work together:

$ fpm --rpm-os linux --architecture all -t rpm -s dir -n test -v 1.0 testdir
no value for epoch is set, defaulting to nil {:level=>:warn}
no value for epoch is set, defaulting to nil {:level=>:warn}
Process failed: rpmbuild failed (exit code 1). Full command was:["rpmbuild", "-bb", "--target", "noarch", "--target", "noarch-unknown-linux", "--define", "buildroot /var/folders/97/qtcflz1s6_q54cp2blsl06n80000gn/T/package-rpm-build20140516-55088-e2srjo/BUILD", "--define", "_topdir /var/folders/97/qtcflz1s6_q54cp2blsl06n80000gn/T/package-rpm-build20140516-55088-e2srjo", "--define", "_sourcedir /var/folders/97/qtcflz1s6_q54cp2blsl06n80000gn/T/package-rpm-build20140516-55088-e2srjo", "--define", "_rpmdir /var/folders/97/qtcflz1s6_q54cp2blsl06n80000gn/T/package-rpm-build20140516-55088-e2srjo/RPMS", "/var/folders/97/qtcflz1s6_q54cp2blsl06n80000gn/T/package-rpm-build20140516-55088-e2srjo/SPECS/test.spec"] {:level=>:error}

The debug output is in this gist: https://gist.github.com/alanthing/5d8313a0645919faba01

I built rpm with Homebrew, which I have installed in /Users/alan/.homebrew instead of /usr/local/ but that hasn't been a problem and I doubt it's what's going on here. Also, I'm using fpm 1.1, installed via gem. I'm using ruby 1.9.3 via RVM and a gemset specifically for fpm.

@alanthing

This comment has been minimized.

Contributor

alanthing commented May 16, 2014

Looks like --rpm-os can't be set to anything on OS X (meaning, not just a problem when using 'linux') when also using -a all...

$ fpm --rpm-os darwin --architecture all -t rpm -s dir -n test -v 1.0 testdir
Process failed: rpmbuild failed (exit code 1). Full command was:["rpmbuild", "-bb", "--target", "noarch", "--target", "noarch-unknown-darwin", "--define", "buildroot /var/folders/97/qtcflz1s6_q54cp2blsl06n80000gn/T/package-rpm-build20140516-55820-1d9oui/BUILD", "--define", "_topdir /var/folders/97/qtcflz1s6_q54cp2blsl06n80000gn/T/package-rpm-build20140516-55820-1d9oui", "--define", "_sourcedir /var/folders/97/qtcflz1s6_q54cp2blsl06n80000gn/T/package-rpm-build20140516-55820-1d9oui", "--define", "_rpmdir /var/folders/97/qtcflz1s6_q54cp2blsl06n80000gn/T/package-rpm-build20140516-55820-1d9oui/RPMS", "/var/folders/97/qtcflz1s6_q54cp2blsl06n80000gn/T/package-rpm-build20140516-55820-1d9oui/SPECS/test.spec"] {:level=>:error}
$ fpm --rpm-os darwin --architecture noarch -t rpm -s dir -n test -v 1.0 testdir
Process failed: rpmbuild failed (exit code 1). Full command was:["rpmbuild", "-bb", "--target", "noarch", "--target", "noarch-unknown-darwin", "--define", "buildroot /var/folders/97/qtcflz1s6_q54cp2blsl06n80000gn/T/package-rpm-build20140516-55880-vn0sr/BUILD", "--define", "_topdir /var/folders/97/qtcflz1s6_q54cp2blsl06n80000gn/T/package-rpm-build20140516-55880-vn0sr", "--define", "_sourcedir /var/folders/97/qtcflz1s6_q54cp2blsl06n80000gn/T/package-rpm-build20140516-55880-vn0sr", "--define", "_rpmdir /var/folders/97/qtcflz1s6_q54cp2blsl06n80000gn/T/package-rpm-build20140516-55880-vn0sr/RPMS", "/var/folders/97/qtcflz1s6_q54cp2blsl06n80000gn/T/package-rpm-build20140516-55880-vn0sr/SPECS/test.spec"] {:level=>:error}
$ fpm --rpm-os darwin --architecture x86_64 -t rpm -s dir -n test -v 1.0 testdir
Created package {:path=>"test-1.0-1.x86_64.rpm"}
@jordansissel

This comment has been minimized.

Owner

jordansissel commented May 16, 2014

Can you include the output when running this with the --verbose flag?

@alanthing

This comment has been minimized.

Contributor

alanthing commented May 16, 2014

The gist link includes --debug, should I still run with --verbose?

@jordansissel

This comment has been minimized.

Owner

jordansissel commented May 17, 2014

doh, I didn't see that, thanks!

@jordansissel

This comment has been minimized.

Owner

jordansissel commented May 17, 2014

Ok so here's where rpmbuild is complaining:

Processing files: test-1.0-1.noarch {:level=>:info, :file=>"cabin/mixins/pipe.rb", :line=>"46"}
{:level=>:info, :file=>"cabin/mixins/pipe.rb", :line=>"46"}
error: File not found: /var/folders/97/qtcflz1s6_q54cp2blsl06n80000gn/T/package-rpm-build20140516-55110-b1gyy/BUILD/testdir/testfile {:level=>:info, :file=>"cabin/mixins/pipe.rb", :line=>"46"}
{:level=>:info, :file=>"cabin/mixins/pipe.rb", :line=>"46"}
File not found: /var/folders/97/qtcflz1s6_q54cp2blsl06n80000gn/T/package-rpm-build20140516-55110-b1gyy/BUILD/testdir/testfile {:level=>:info, :file=>"cabin/mixins/pipe.rb", :line=>"46"}
RPM build errors: {:level=>:info, :file=>"cabin/mixins/pipe.rb", :line=>"46"}
@jordansissel

This comment has been minimized.

Owner

jordansissel commented May 17, 2014

Based on this, I don't believe it to be an architecture issue, but instead something about how fpm is writing files, I guess? I have a mac laptop so I will try to reproduce.

@r4um r4um added the rpm label May 17, 2014

@alanthing

This comment has been minimized.

Contributor

alanthing commented May 19, 2014

On the debug gist, lines 153 and 158 are missing the arch. I wonder if it's getting stripped by accident before those steps?

@kikitux

This comment has been minimized.

kikitux commented Jun 8, 2014

@alanthing any news ? i am interested on building rpms on mac

@alanthing

This comment has been minimized.

Contributor

alanthing commented Jun 9, 2014

Nothing yet, but I'm not much of a rubyist. I'll see if I can set up an environment here locally and get something going.

@alanthing

This comment has been minimized.

Contributor

alanthing commented Jun 9, 2014

If I comment out lines 315-319 of lib/fpm/package/rpm.rb I am able to run fpm --rpm-os linux --architecture all -t rpm -s dir -n test -v 1.0 testdir.

I'll see if I can clean up that block so it works as intended but still allows --rpm-os to be set with --architecture changes and submit a PR.

@alanthing

This comment has been minimized.

Contributor

alanthing commented Jun 9, 2014

It also works if I comment out 311-313. Also, this is from my debug output from the original comment:

Running rpmbuild {:args=>["rpmbuild", "-bb", "--target", "noarch", "--target", "noarch-unknown-linux", "--define", "buildroot /var/folders/97/qtcflz1s6_q54cp2blsl06n80000gn/T/package-rpm-build20140516-55110-b1gyy/BUILD", "--define", "_topdir /var/folders/97/qtcflz1s6_q54cp2blsl06n80000gn/T/package-rpm-build20140516-55110-b1gyy", "--define", "_sourcedir /var/folders/97/qtcflz1s6_q54cp2blsl06n80000gn/T/package-rpm-build20140516-55110-b1gyy", "--define", "_rpmdir /var/folders/97/qtcflz1s6_q54cp2blsl06n80000gn/T/package-rpm-build20140516-55110-b1gyy/RPMS", "/var/folders/97/qtcflz1s6_q54cp2blsl06n80000gn/T/package-rpm-build20140516-55110-b1gyy/SPECS/test.spec"], :level=>:info, :file=>"fpm/package/rpm.rb", :line=>"387"}
Running command {:args=>["rpmbuild", "-bb", "--target", "noarch", "--target", "noarch-unknown-linux", "--define", "buildroot /var/folders/97/qtcflz1s6_q54cp2blsl06n80000gn/T/package-rpm-build20140516-55110-b1gyy/BUILD", "--define", "_topdir /var/folders/97/qtcflz1s6_q54cp2blsl06n80000gn/T/package-rpm-build20140516-55110-b1gyy", "--define", "_sourcedir /var/folders/97/qtcflz1s6_q54cp2blsl06n80000gn/T/package-rpm-build20140516-55110-b1gyy", "--define", "_rpmdir /var/folders/97/qtcflz1s6_q54cp2blsl06n80000gn/T/package-rpm-build20140516-55110-b1gyy/RPMS", "/var/folders/97/qtcflz1s6_q54cp2blsl06n80000gn/T/package-rpm-build20140516-55110-b1gyy/SPECS/test.spec"], :level=>:debug, :file=>"fpm/util.rb", :line=>"59"}

At this point, I'm thinking it's because --target is defined twice. I'll see if I can get a resolution.

@alanthing

This comment has been minimized.

Contributor

alanthing commented Jun 9, 2014

This seems to do it, pull request coming shortly...

if %x{uname -m}.chomp != self.architecture
  rpm_target = self.architecture
end

# issue #309
if !attributes[:rpm_os].nil?
  rpm_target = "#{architecture}-unknown-#{attributes[:rpm_os]}"
end

# issue #707
if !rpm_target.nil?
  args += ["--target", rpm_target]
end
@alanthing

This comment has been minimized.

Contributor

alanthing commented Jun 9, 2014

Pull request #716 submitted. Hopefully this works out @jordansissel

vStone added a commit to vStone/fpm that referenced this issue Jun 11, 2014

vStone added a commit to vStone/fpm that referenced this issue Jun 11, 2014

Fixes jordansissel#707
With rpms, if `--architecture` and `--rpm-os` are specified and
different than the host, `--target` would be passed to `rpmbuild` twice,
causing an error.

Example: an OS X host (`uname -s` = "Darwin") with x86_64 architecture
building for `--rpm-os linux` and `--architecture noarch`.

This change only adds `--target` to the `rpmbuild` args once, fixing
this specific error.

vStone added a commit to vStone/fpm that referenced this issue Jun 11, 2014

jordansissel added a commit that referenced this issue Jun 13, 2014

prof-milki pushed a commit to prof-milki/xpm that referenced this issue Dec 18, 2014

alanivey
Fixes jordansissel#707
With rpms, if `--architecture` and `--rpm-os` are specified and
different than the host, `--target` would be passed to `rpmbuild` twice,
causing an error.

Example: an OS X host (`uname -s` = "Darwin") with x86_64 architecture
building for `--rpm-os linux` and `--architecture noarch`.

This change only adds `--target` to the `rpmbuild` args once, fixing
this specific error.

prof-milki pushed a commit to prof-milki/xpm that referenced this issue Dec 18, 2014

prof-milki pushed a commit to prof-milki/xpm that referenced this issue Dec 27, 2014

Fixes jordansissel#707
With rpms, if `--architecture` and `--rpm-os` are specified and
different than the host, `--target` would be passed to `rpmbuild` twice,
causing an error.

Example: an OS X host (`uname -s` = "Darwin") with x86_64 architecture
building for `--rpm-os linux` and `--architecture noarch`.

This change only adds `--target` to the `rpmbuild` args once, fixing
this specific error.

prof-milki pushed a commit to prof-milki/xpm that referenced this issue Dec 27, 2014

jordansissel pushed a commit that referenced this issue Apr 24, 2015

Fixes #707
With rpms, if `--architecture` and `--rpm-os` are specified and
different than the host, `--target` would be passed to `rpmbuild` twice,
causing an error.

Example: an OS X host (`uname -s` = "Darwin") with x86_64 architecture
building for `--rpm-os linux` and `--architecture noarch`.

This change only adds `--target` to the `rpmbuild` args once, fixing
this specific error.

jordansissel added a commit that referenced this issue Apr 24, 2015

jordansissel pushed a commit that referenced this issue Jun 20, 2016

Fixes #707
With rpms, if `--architecture` and `--rpm-os` are specified and
different than the host, `--target` would be passed to `rpmbuild` twice,
causing an error.

Example: an OS X host (`uname -s` = "Darwin") with x86_64 architecture
building for `--rpm-os linux` and `--architecture noarch`.

This change only adds `--target` to the `rpmbuild` args once, fixing
this specific error.

jordansissel added a commit that referenced this issue Jun 20, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment