Ubuntu 16.04 4.4.0-21
fpm 1.5.0
I tried to exclude a file and a directory with multiple syntaxes, none of them works:
@jean-christophe-manciot I got the same problem, and once I got it working using -x "*/.git" I saw the following output (on verbose mode)
Removing excluded path {:path=>"opt/rbenv/.git", :matches=>"*/.git", :level=>:info}
So I suggest you to remove AUTHORS file using --exclude "usr/lib/go/AUTHORS" and git using mine version or usr/lib/go/.git
Hope it helps you
As per the output of --help, exclude takes a pattern to match, not a relative/absolute file name or path. You can also provide a file of patterns to exclude via --exclude-file which takes a path to said file.
OK. With fpm 1.6.0, I was able to exclude a specific file with --exclude "./usr/lib/go/pkg/linux_amd64/libguestfs.org/guestfs/guestfs.a", so I guess the option has been adjusted to a more common behavior.
That behaviour hasn't changed since 2013, it's still an expression. Under the hood it's just calling File.fnmatch. After checking the Ruby docs it says expression (like a regex) but actually uses globbing. The exclude phase runs at both staging and later if any specific packagers want to exclude extra things during their input phases. See lib/fpm/package.rb.
The pattern is applied to the sub-path of the staging directory so a leading slash or period is not required. I can't see any reason your above example would work in 1.6 but your original examples don't work in 1.5. To me it seems none of them should work. @jean-christophe-manciot's suggestion of losing the leading slashes is the normal behaviour.
Most helpful comment
As per the output of
--help, exclude takes a pattern to match, not a relative/absolute file name or path. You can also provide a file of patterns to exclude via--exclude-filewhich takes a path to said file.