how to add arbitrary external files to "fpm -s python -t rpm"

587 views
Skip to first unread message

Florin Andrei

unread,
Mar 3, 2015, 8:40:48 PM3/3/15
to fpm-...@googlegroups.com
I am building RPM packages from Python (specifically, Graphite packages for CentOS 7). I may need to add files to these packages that are not actually contained in the Python bundle. Some of these files are init scripts, some are config files, some are just files.

For init scripts I believe the right option is --rpm-init (correct me if I'm wrong), and it appears as if I can supply my own init script(s) there.

For config files I've found the --config-files option, but it only appears to use files that are already in the package. I can't seem to find a way to supply my own files from a local dir in the build environment.

Finally, for regular files, again, I can't find a way to just add my own files to the package. Something like "--add-file SOURCE DEST" would be awesome, where SOURCE is the path to the file in the build environment, and DEST is the path within the package. Maybe I missed something, fpm --help is pretty big.

A possible workaround would be to build an "fpm -s dir -t rpm" package with all the configs and whatnot, and name it ${packagename}-config.....rpm, but it's ugly.

Help please?

Florin Andrei

unread,
Mar 4, 2015, 3:32:43 PM3/4/15
to fpm-...@googlegroups.com
Per the discussion on IRC this is not currently doable, although plans exist to add this feature. I will create separate packages for config files, and will use dependencies to pull them for install.

Jordan Sissel

unread,
Mar 4, 2015, 3:38:28 PM3/4/15
to fpm-...@googlegroups.com
Yep! I have plans (but no designs yet) on making fpm take multiple sources from the command line. For now, two packages is a usable workaround for some situations :)

-Jordan

--
You received this message because you are subscribed to the Google Groups "fpm-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fpm-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Allan Espinosa

unread,
May 25, 2016, 1:33:37 AM5/25/16
to fpm-users
(Was Re: [fpm-users] Re: how to add arbitrary external files to "fpm -s python -t rpm")

Hi,

I messed around with Package#staging_path to insert arbitrary files. Here's what I used for my case:


irb(main):001:0> require 'fpm'

=> true

irb(main):002:0> mq = FPM::Package::Gem.new

=> <FPM::Package::Gem(@19137060) @attributes={:gem_bin_path=>nil, :gem_package_prefix=>nil, :gem_package_name_prefix=>"rubygem", :gem_gem=>"gem", :gem_fix_name?=>true, :gem_fix_de

pendencies?=>true, :gem_env_shebang?=>true, :gem_prerelease?=>false, :gem_disable_dependency=>nil, :gem_version_bins?=>false} @maintainer="<vagrant@test-debian-84>" @name=nil @arc

hitecture="native" @description="no description given" @version=nil @epoch=nil @iteration=nil @url=nil @category="default" @license="unknown" @vendor="none" @provides=[] @conflict

s=[] @replaces=[] @dependencies=[] @scripts={} @config_files=[] @directories=[] @attrs={} @staging_path="/tmp/package-gem-staging20160525-10395-14uczoo" @build_path="/tmp/package-

gem-build20160525-10395-ufiwab" >

irb(main):003:0> mq.input 'ffi-rzmq-core'

=> nil

irb(main):007:0> FileUtils.mkdir_p mq.staging_path 'var/lib/gems/2.1.0/gems/ffi-rzmq-core-1.0.5/ext'

=> ["/tmp/package-gem-staging20160525-10395-14uczoo/var/lib/gems/2.1.0/gems/ffi-rzmq-core-1.0.5/ext"]

irb(main):013:0> FileUtils.ln_s '/usr/lib/x86_64-linux-gnu/libzmq.so.3.1.0', mq.staging_path('var/lib/gems/2.1.0/gems/ffi-rzmq-core-1.0.5/ext/libzmq.so')

irb(main):016:0> mq.dependencies << "libzmq3"

irb(main):018:0> mq.convert(FPM::Package::Deb).output './foo.deb'

=> "/home/vagrant/foo.deb"


And with that my foo.deb package contains the symlink I made earlier


There maybe some design that can emerge around sharing staging_paths from multiple inputs. But I have yet to try that. 

I hope others find this useful.

Regards,
Allan
Reply all
Reply to author
Forward
0 new messages