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

Restore prior --config-files behavior #1391

Merged
merged 1 commit into from Jul 29, 2017

Conversation

Projects
None yet
1 participant
@jordansissel
Owner

jordansissel commented Jul 29, 2017

PR #1379/#860 introduced a new behavior for --config-files that fetches
config files from the local filesystem. The prior behavior was to
require these files to be provided by the source package (--source
flag).

This patch makes a hybrid solution which does, for any given
--config-files foo flag:

  • does the path foo already exist in the staging area? Do nothing.
    This means the package source (-s gem for example) provided this file.
  • or, does the path foo exist in the local filesystem? If so, copy it
    into the staging area.
  • otherwise, consider this to be an error that the --config-files
    setting cannot find the file, and fpm will fail with an error.
Restore prior --config-files behavior
PR #1379/#860 introduced a new behavior for --config-files that fetches
config files from the local filesystem. The prior behavior was to
require these files to be provided by the source package (`--source`
flag).

This patch makes a hybrid solution which does, for any given
`--config-files foo` flag:

* does the path `foo` already exist in the staging area? Do nothing.
This means the package source (`-s gem` for example) provided this file.
* or, does the path `foo` exist in the local filesystem? If so, copy it
into the staging area.
* otherwise, consider this to be an error that the --config-files
setting cannot find the file, and fpm will fail with an error.
@jordansissel

This comment has been minimized.

Owner

jordansissel commented Jul 29, 2017

I tested this a few ways:

  • fpm -s empty -t rpm -n example --config-files /etc/zshrc -- copies /etc/zshrc from the local filesystem. Good!

And for a -s dir test, I have this layout:

% find /tmp/z
/tmp/z
/tmp/z/foo
/tmp/z/foo/bar
  • fpm -f -s dir -t rpm -n example --config-files /foo/bar /tmp/z/=/ -- correctly uses the foo/bar path in the package path already (provided by -s dir):
% rpm -qpc example-1.0-1.x86_64.rpm
/foo/bar
% rpm -qpl example-1.0-1.x86_64.rpm
/foo/bar
  • fpm -f -s dir -t rpm -n example --config-files /no/such/path /tmp/z/=/
Force flag given. Overwriting package at example-1.0-1.x86_64.rpm {:level=>:warn}
Failed to find given --config-file {:path=>"/no/such/path", :level=>:error}
/home/jls/projects/fpm/lib/fpm/package/rpm.rb:487:in `block in output': Could not find config file '/no/such/path' in staging area or on host. This can happen if you specify `--config-file '/no/such/path'` but this file does not exist in the source package and also does not exist in filesystem. (RuntimeError)

@jordansissel jordansissel merged commit a15f60e into master Jul 29, 2017

0 of 2 checks passed

continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
continuous-integration/travis-ci/push The Travis CI build is in progress
Details
@jordansissel

This comment has been minimized.

Owner

jordansissel commented Jul 29, 2017

I'm ok with the manual tests I did, but I want to write tests for this feature. However, it's the weekend, and I'm not spending my time on that today :)

@jordansissel jordansissel deleted the issue/1390 branch Jul 4, 2018

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