dnbert / prm

PRM Allows you to quickly build package repositories, inspired by Jordan Sissels' FPM
MIT License
250 stars 33 forks source link

error 'control.tar.gz' not found in archive #35

Closed jessereynolds closed 10 years ago

jessereynolds commented 10 years ago

prm throws an exception for me when I try and update a repository after copying in a package file. Not sure if I'm doing anything wrong here...

# initialize the deb repo
$ prm --type deb --path pool --component dev,staging --release precise --arch amd64 --gpg

# copy in the latest flapjack deb
$ cp -p ~/src/flpjck/omnibus-flapjack/pkg/flapjack_0.8.2+20140119234113-1.ubuntu.12.04_amd64.deb pool/dists/precise/dev/binary-amd64/

# run npm
$ prm --type deb --path pool --component dev,staging --release precise --arch amd64
Building Path: pool/dists/precise/dev/binary-amd64/
Generating Packages: precise : dev : binary-amd64
ar: control.tar.gz: not found in archive
/Users/jesse/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/prm-0.2.9/lib/prm/repo.rb:133:in `read': No such file or directory - tmp/flapjack_0.8.2+20140119234113-1.ubuntu.12.04_amd64.deb/control (Errno::ENOENT)
    from /Users/jesse/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/prm-0.2.9/lib/prm/repo.rb:133:in `block (2 levels) in generate_packages_gz'
    from /Users/jesse/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/prm-0.2.9/lib/prm/repo.rb:131:in `synchronize'
    from /Users/jesse/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/prm-0.2.9/lib/prm/repo.rb:131:in `block in generate_packages_gz'
    from /Users/jesse/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/peach-0.5.1/lib/peach.rb:22:in `block (2 levels) in peach'
    from /Users/jesse/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/peach-0.5.1/lib/peach.rb:22:in `each'
    from /Users/jesse/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/peach-0.5.1/lib/peach.rb:22:in `block in peach'
    from /Users/jesse/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/peach-0.5.1/lib/peach.rb:13:in `block (2 levels) in _peach_run'
jessereynolds commented 10 years ago

FWIW:

$ ar t pool/dists/precise/dev/binary-amd64/flapjack_0.8.2+20140119234113-1.ubuntu.12.04_amd64.deb
debian-binary/
control.tar.gz/
data.tar.gz/

$ ar p pool/dists/precise/dev/binary-amd64/flapjack_0.8.2+20140119234113-1.ubuntu.12.04_amd64.deb control.tar.gz > tmp/control.tar.gz
ar: control.tar.gz: not found in archive

I'm running ruby 2.0.0p353 (with rbenv) on Mac OS X Mountain Lion - 10.8.5.

dnbert commented 10 years ago

Hi! thanks for the report.

I think this has to do with the archive utility not being available on your box (but I'm not sure yet). I did test on several linux distros and it worked fine. What I believe is happening is the specific ar call that extracts the control tarball from the debian package. While I do some testing on OSX, can you verify if you have ar installed?

In any case, I need to update https://github.com/dnbert/prm/blob/master/lib/prm/repo.rb#L96 because its very embarrassing :)

dnbert commented 10 years ago

Oops, I see ar is installed

dnbert commented 10 years ago

So, I couldn't replicate this on an osx machine: odin$ mkdir test odin$ ar p libmoose-perl_0.93-1_amd64.deb control.tar.gz | tar zx -C test/ odin$ ls -la test/ total 48 drwxr-xr-x 4 brettgailey staff 136 Jan 21 19:27 . drwxr-xr-x 4 brettgailey staff 136 Jan 21 19:27 .. -rw-r--r-- 1 brettgailey staff 603 Aug 13 15:11 control -rw-r--r-- 1 brettgailey staff 18949 Aug 13 15:10 md5sums

I'm running mountain lion OSX 10.8.5 using binutils version 2.24.

fpm -s dir -t deb -n testme -v 0.8.2+20140119234113 --iteration 1.ubuntu.12.04_amd64 ~/tmp/ odin$ ar p testme_0.8.2+20140119234113-1.ubuntu.12.04_amd64_amd64.deb control.tar.gz | tar zx -C test/ odin$ ls test/ control md5sums

This may be a bug in Mac's ar utility, can you try upgrading/downgrading to binutils 2.24; or if you already are on that version can you let me know how to rebuild your package?

jessereynolds commented 10 years ago

Hi, so which ar are you using on the mac? Mind is /bin/ar which doesn't furnish me with any version information. Perhaps you're using a binutils installed by homebrew or otherwise compiled from GNU sources?

I've just tried ar on linux (binutils 2.22) and it works fine there:

~/omnibus-flapjack$ ar p pkg/flapjack_0.8.2+20140122121144-1.ubuntu.12.04_amd64.deb control.tar.gz > tmp/control.tar.gz
~/omnibus-flapjack$ file tmp/control.tar.gz
tmp/control.tar.gz: gzip compressed data, from Unix, last modified: Wed Jan 22 12:32:11 2014
dnbert commented 10 years ago

Hi Jesse,

I'm using binutils from MacPorts: https://trac.macports.org/browser/trunk/dports/devel/binutils/Portfile which is upstream GNU binutils.

I'm still looking for a way just around using ar by using pure ruby implementation for ruby or equivalent, or reorganizing. My big goal is to not use dpkg at all to manipulate the extraction.

jordansissel commented 10 years ago

I think the problem here is not ar but your deb.

Your output follows:

$ ar t pool/dists/precise/dev/binary-amd64/flapjack_0.8.2+20140119234113-1.ubuntu.12.04_amd64.deb
debian-binary/
control.tar.gz/
data.tar.gz/

The trailing / makes me think that your ar includes files literally named "control.tar.gz/" or perhaps a directory simply named that. EIther way, it's not correct for a .deb file.

What created this .deb?

jordansissel commented 10 years ago

For context, here's an example deb package (created by fpm) run through 'ar t' on my OSX laptop:

% ar t fizz_1.0_amd64.deb
debian-binary
control.tar.gz
data.tar.gz

Note no trailing "/" on my output.

dnbert commented 10 years ago

Hey Jesse, I'm going to close this out! Please reopen if you're still having problems.

justincletus commented 4 years ago

I think the problem here is not ar but your deb.

Your output follows:

$ ar t pool/dists/precise/dev/binary-amd64/flapjack_0.8.2+20140119234113-1.ubuntu.12.04_amd64.deb
debian-binary/
control.tar.gz/
data.tar.gz/

The trailing / makes me think that your ar includes files literally named "control.tar.gz/" or perhaps a directory simply named that. EIther way, it's not correct for a .deb file.

What created this .deb?

I have same issue after created using fpm. How to fix this? debian-binary/ control.tar.gz/ data.tar.gz/ bundle exec fpm \ --name "${buildPackage}" \ --input-type dir \ --output-type deb \ --version "1.0.0" \ --chdir "${buildPackage}" \ --license 'Proprietary' \ --vendor 'Self' \ --maintainer 'justinbeckh@gmail.com' \ --architecture 'amd64' \ --description 'Debian App' }

kcrouch commented 7 months ago

For anyone finding this years later, the default darwin-supplied ar binary has issues with some subset of debian files.

using the default darwin-supplied ar:

$ ar t ../filebeat-8.11.1-amd64.deb 
debian-binary/
control.tar.gz/
data.tar.gz/
_gpgelastic

Only the _gpgelastic member can be extracted

$ ar x ../filebeat-8.11.1-amd64.deb 
ar: debian-binary/: No such file or directory
ar: control.tar.gz/: No such file or directory
ar: data.tar.gz/: No such file or directory
$ ls
_gpgelastic
$

using ar from brew's binutils v2.41:

$ ar t ../filebeat-8.11.1-amd64.deb 
debian-binary
control.tar.gz
data.tar.gz
_gpgelastic
$ ar x ../filebeat-8.11.1-amd64.deb 
$ ls
_gpgelastic control.tar.gz  data.tar.gz debian-binary
$ 

All members of the archive are extracted correctly.

EDIT: The debian package I'm testing on is the latest official version of Filebeat which installs as expected on a debian machine. The darwin ar utility definitely has issues with it.