jordansissel / fpm

Effing package management! Build packages for multiple platforms (deb, rpm, etc) with great ease and sanity.
http://fpm.readthedocs.io/en/latest/
Other
11.14k stars 1.07k forks source link

fpm does not really generate a "package" #1507

Closed Steap closed 6 years ago

Steap commented 6 years ago

Hello,

I installed fpm from the git repository, by running the following commands:

$ mkdir fpm-install
$ bundle install --path ./fpm-install/
$ gem install -i ./fpm-install/ruby/2.5.0/gems/ fpm

Then I tried creating a FreeBSD package for the "requests" Python library:

$ GEM_PATH=$(pwd)/fpm-install/ruby/2.5.0/gems/ ./fpm-install/ruby/2.5.0/bin/fpm -s python -t freebsd requests DEPRECATION NOTICE: XZ::StreamWriter#close will automatically close the wrapped IO in the future. Use #finish to prevent that. /home/cyril/code/upt/fpm/fpm-install/ruby/2.5.0/gems/gems/ruby-xz-0.2.3/lib/xz/stream_writer.rb:185:in initialize' /home/cyril/code/upt/fpm/fpm-install/ruby/2.5.0/gems/gems/fpm-1.10.0/lib/fpm/package/freebsd.rb:85:innew' /home/cyril/code/upt/fpm/fpm-install/ruby/2.5.0/gems/gems/fpm-1.10.0/lib/fpm/package/freebsd.rb:85:in block in output' /home/cyril/code/upt/fpm/fpm-install/ruby/2.5.0/gems/gems/fpm-1.10.0/lib/fpm/package/freebsd.rb:84:inopen' /home/cyril/code/upt/fpm/fpm-install/ruby/2.5.0/gems/gems/fpm-1.10.0/lib/fpm/package/freebsd.rb:84:in output' /home/cyril/code/upt/fpm/fpm-install/ruby/2.5.0/gems/gems/fpm-1.10.0/lib/fpm/command.rb:487:inexecute' /home/cyril/code/upt/fpm/fpm-install/ruby/2.5.0/gems/gems/clamp-1.0.1/lib/clamp/command.rb:68:in run' /home/cyril/code/upt/fpm/fpm-install/ruby/2.5.0/gems/gems/fpm-1.10.0/lib/fpm/command.rb:574:inrun' /home/cyril/code/upt/fpm/fpm-install/ruby/2.5.0/gems/gems/clamp-1.0.1/lib/clamp/command.rb:133:in run' /home/cyril/code/upt/fpm/fpm-install/ruby/2.5.0/gems/gems/fpm-1.10.0/bin/fpm:7:in<top (required)>' ./fpm-install/ruby/2.5.0/bin/fpm:23:in load' ./fpm-install/ruby/2.5.0/bin/fpm:23:in

' Created package {:path=>"python-requests-2.19.1.txz"}

I was expecting to find "distinfo", "pkg-descr" and "Makefile" inside the tarball, but got this instead:

$ tar tf python-requests-2.19.1.txz +COMPACT_MANIFEST +MANIFEST tar: Removing leading `/' from member names /usr/local/lib/python2.7/dist-packages/requests/init.py /usr/local/lib/python2.7/dist-packages/requests/init.pyc /usr/local/lib/python2.7/dist-packages/requests/version.py /usr/local/lib/python2.7/dist-packages/requests/version.pyc /usr/local/lib/python2.7/dist-packages/requests/_internal_utils.py /usr/local/lib/python2.7/dist-packages/requests/_internal_utils.pyc /usr/local/lib/python2.7/dist-packages/requests/adapters.py /usr/local/lib/python2.7/dist-packages/requests/adapters.pyc /usr/local/lib/python2.7/dist-packages/requests/api.py /usr/local/lib/python2.7/dist-packages/requests/api.pyc /usr/local/lib/python2.7/dist-packages/requests/auth.py /usr/local/lib/python2.7/dist-packages/requests/auth.pyc /usr/local/lib/python2.7/dist-packages/requests/certs.py /usr/local/lib/python2.7/dist-packages/requests/certs.pyc /usr/local/lib/python2.7/dist-packages/requests/compat.py /usr/local/lib/python2.7/dist-packages/requests/compat.pyc /usr/local/lib/python2.7/dist-packages/requests/cookies.py /usr/local/lib/python2.7/dist-packages/requests/cookies.pyc /usr/local/lib/python2.7/dist-packages/requests/exceptions.py /usr/local/lib/python2.7/dist-packages/requests/exceptions.pyc /usr/local/lib/python2.7/dist-packages/requests/help.py /usr/local/lib/python2.7/dist-packages/requests/help.pyc /usr/local/lib/python2.7/dist-packages/requests/hooks.py /usr/local/lib/python2.7/dist-packages/requests/hooks.pyc /usr/local/lib/python2.7/dist-packages/requests/models.py /usr/local/lib/python2.7/dist-packages/requests/models.pyc /usr/local/lib/python2.7/dist-packages/requests/packages.py /usr/local/lib/python2.7/dist-packages/requests/packages.pyc /usr/local/lib/python2.7/dist-packages/requests/sessions.py /usr/local/lib/python2.7/dist-packages/requests/sessions.pyc /usr/local/lib/python2.7/dist-packages/requests/status_codes.py /usr/local/lib/python2.7/dist-packages/requests/status_codes.pyc /usr/local/lib/python2.7/dist-packages/requests/structures.py /usr/local/lib/python2.7/dist-packages/requests/structures.pyc /usr/local/lib/python2.7/dist-packages/requests/utils.py /usr/local/lib/python2.7/dist-packages/requests/utils.pyc /usr/local/lib/python2.7/dist-packages/requests-2.19.1.egg-info/PKG-INFO /usr/local/lib/python2.7/dist-packages/requests-2.19.1.egg-info/SOURCES.txt /usr/local/lib/python2.7/dist-packages/requests-2.19.1.egg-info/dependency_links.txt /usr/local/lib/python2.7/dist-packages/requests-2.19.1.egg-info/not-zip-safe /usr/local/lib/python2.7/dist-packages/requests-2.19.1.egg-info/requires.txt /usr/local/lib/python2.7/dist-packages/requests-2.19.1.egg-info/top_level.txt

I then tried to package the same library for Debian:

$ GEM_PATH=$(pwd)/fpm-install/ruby/2.5.0/gems/ ./fpm-install/ruby/2.5.0/bin/fpm -s python -t deb requests Debian packaging tools generally labels all files in /etc as config files, as mandated by policy, so fpm defaults to this behavior for deb packages. You can disable this default behavior with --deb-no-default-config-files flag {:level=>:warn} Created package {:path=>"python-requests_2.19.1_all.deb"}

I would expect this deb file to contain a "rules" files, a "control" file, etc.

$ dpkg -x python-requests_2.19.1_all.deb /tmp/out $ tree /tmp/out /tmp/out/ └── usr ├── local │   └── lib │   └── python2.7 │   └── dist-packages │   ├── requests │   │   ├── adapters.py │   │   ├── adapters.pyc │   │   ├── api.py │   │   ├── api.pyc │   │   ├── auth.py │   │   ├── auth.pyc │   │   ├── certs.py │   │   ├── certs.pyc │   │   ├── compat.py │   │   ├── compat.pyc │   │   ├── cookies.py │   │   ├── cookies.pyc │   │   ├── exceptions.py │   │   ├── exceptions.pyc │   │   ├── help.py │   │   ├── help.pyc │   │   ├── hooks.py │   │   ├── hooks.pyc │   │   ├── init.py │   │   ├── init.pyc │   │   ├── _internal_utils.py │   │   ├── _internal_utils.pyc │   │   ├── models.py │   │   ├── models.pyc │   │   ├── packages.py │   │   ├── packages.pyc │   │   ├── sessions.py │   │   ├── sessions.pyc │   │   ├── status_codes.py │   │   ├── status_codes.pyc │   │   ├── structures.py │   │   ├── structures.pyc │   │   ├── utils.py │   │   ├── utils.pyc │   │   ├── version.py │   │   └── version.pyc │   └── requests-2.19.1.egg-info │   ├── dependency_links.txt │   ├── not-zip-safe │   ├── PKG-INFO │   ├── requires.txt │   ├── SOURCES.txt │   └── top_level.txt └── share └── doc └── python-requests └── changelog.gz

10 directories, 43 files

This is not what I expected. Am I doing something wrong or am I mistaken as to what fpm actually does?

mathieu-aubin commented 6 years ago

The files are there, dpkg is just not showing them for some reason.

Try using

dpkg-deb --info python-requests_2.19.1_all.deb
dpkg-deb -R python-requests_2.19.1_all.deb /tmp/out_

then the output of tree (some nodejs variation)

/tmp/out_
|-- DEBIAN
|   |-- control
|   `-- md5sums
`-- usr
    |-- local
    |   `-- lib
    |       `-- python2.7
    |           `-- dist-packages
    |               |-- requests
    |               |   |-- adapters.py
    |               |   |-- adapters.pyc
    |               |   |-- api.py
    |               |   |-- api.pyc
    |               |   |-- auth.py
    |               |   |-- auth.pyc
    |               |   |-- certs.py
    |               |   |-- certs.pyc
    |               |   |-- compat.py
    |               |   |-- compat.pyc
    |               |   |-- cookies.py
    |               |   |-- cookies.pyc
    |               |   |-- exceptions.py
    |               |   |-- exceptions.pyc
    |               |   |-- help.py
    |               |   |-- help.pyc
    |               |   |-- hooks.py
    |               |   |-- hooks.pyc
    |               |   |-- __init__.py
    |               |   |-- __init__.pyc
    |               |   |-- _internal_utils.py
    |               |   |-- _internal_utils.pyc
    |               |   |-- models.py
    |               |   |-- models.pyc
    |               |   |-- packages.py
    |               |   |-- packages.pyc
    |               |   |-- sessions.py
    |               |   |-- sessions.pyc
    |               |   |-- status_codes.py
    |               |   |-- status_codes.pyc
    |               |   |-- structures.py
    |               |   |-- structures.pyc
    |               |   |-- utils.py
    |               |   |-- utils.pyc
    |               |   |-- __version__.py
    |               |   `-- __version__.pyc
    |               `-- requests-2.19.1-py2.7.egg-info
    |                   |-- dependency_links.txt
    |                   |-- not-zip-safe
    |                   |-- PKG-INFO
    |                   |-- requires.txt
    |                   |-- SOURCES.txt
    |                   `-- top_level.txt
    `-- share
        `-- doc
            `-- python-requests
                `-- changelog.gz

11 directories, 45 files
edit: removed --contents command +++
jordansissel commented 6 years ago

I think the FreeBSD packages being empty is a bug.

On Mon, Jun 25, 2018 at 5:15 PM Mathieu Aubin notifications@github.com wrote:

The files are there, dpkg is just not showing them for some reason.

Try using

dpkg-deb --info python-requests_2.19.1_all.deb or dpkg-deb --contents python-requests_2.19.1_all.deb

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jordansissel/fpm/issues/1507#issuecomment-400135084, or mute the thread https://github.com/notifications/unsubscribe-auth/AAIC6ogfhd7g8n3-SW-eYYFCp6D4Te4Gks5uAX0kgaJpZM4U1XB2 .

Steap commented 6 years ago

Yeah, the .deb file is valid, my bad. Maybe the FreeBSD output is a bug, but the Debian package creation works.

I am still wondering whether fpm can generate something that can be contributed to an upstream repo, like https://salsa.debian.org/python-team/modules/requests/tree/master/debian . This means I'd like to generate debian/* for Debian, a spec file rather than an RPM on Red Hat-like distros, etc. Is this possible?

mathieu-aubin commented 6 years ago

" Yeah, the .deb file is valid, my bad. "

Thanks for this, i was starting to think i'm dumb, specially after running your exact same commands

mathieu-aubin commented 6 years ago

Also, as far as bsd package goes, i do not get an empty package running fpm -s python -t freebsd requests and i can see some control files in there.

root control files

Then same as you, the package content

package content

edit: removed asciicast link that was no longer valid

pombredanne commented 6 years ago

@Steap I think you may be confusing two different things:

  1. a built packages such as a gem, wheel, deb of FreeBSD pkg archives
  2. the source or repo that is used to create such a package

fpm creates built packages converting one formats to another Afaik it does not generate the "spec" files that are used to build such a package. Hence why you have a .deb with its control file but not all its other debian/ files, or a a FreeBSD pkg package tarball with its manifests (+COMPACT_MANIFES and +MANIFEST) but not its FreeBSD Makefile.

So fpm does really generate a "package", but fpm does not really generate the files needed by a package manager to rebuild a "package" from sources.

Steap commented 6 years ago

@pombredanne Yep, you understood what I meant (and wrote in more details on the mailing-list https://groups.google.com/forum/#!topic/fpm-users/uc1GN7-RNK4).

So fpm is only useful for people who wish to install a piece of software, but it cannot make a packager's life easier, i see. Thanks for clearing things up.

I'll close this bug since it is irrelevant.

davidnewhall commented 4 years ago

As a package maintainer, it sure made my life easier. I'm able to package my software for my consumers across multiple operating systems with ease! Thanks for the wonderful software!