Skip to content
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

Fix for Provides section with underscores #591

Merged
merged 6 commits into from
Dec 6, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,46 @@ That said, some basic guidelines, which you are free to ignore :)
irc.freenode.org) is a good place for this as is the
[mailing list](http://groups.google.com/group/fpm-users)

### Contributing by forking from GitHub

First, create a github account if you do not already have one. Log in to
github and go to [the main fpm github page](https://github.com/jordansissel/fpm).

At the top right, click on the button labeled "Fork". This will put a forked
copy of the main fpm repo into your account. Next, clone your account's github
repo of fpm. For example:

$ git clone git@github.com:yourusername/fpm.git

If you don't already have the bundler gem installed, install it now:

$ gem install bundler

Now change to the root of the fpm repo and run:

$ bundle install

This will install all of the dependencies required for running fpm from source.
Most importantly, you should see the following output from the bundle command
when it lists the fpm gem:

...
Using json (1.8.1)
Using fpm (0.4.42) from source at .
Using hitimes (1.2.1)
...

Next, run make in root of the fpm repo. If there are any problems (such as
missing dependencies) you should receive an error

At this point, the fpm command should run directly from the code in your cloned
repo. Now simply make whatever changes you want, commit the code, and push
your commit back to master.

If you think your changes are ready to be merged back to the main fpm repo, you
can generate a pull request on the github website for your repo and send it in
for review.

## More Documentation

[See the wiki for more docs](https://github.com/jordansissel/fpm/wiki)
Expand Down
23 changes: 22 additions & 1 deletion lib/fpm/package/deb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,10 @@ def converted_from(origin)
self.dependencies = self.dependencies.collect do |dep|
fix_dependency(dep)
end.flatten
self.provides = self.provides.collect do |provides|
fix_provides(provides)
end.flatten

end # def converted_from

def debianize_op(op)
Expand Down Expand Up @@ -440,7 +444,7 @@ def fix_dependency(dep)
end

if dep.include?("_")
@logger.warn("Replacing underscores with dashes in '#{dep}' because " \
@logger.warn("Replacing dependency underscores with dashes in '#{dep}' because " \
"debs don't like underscores")
dep = dep.gsub("_", "-")
end
Expand Down Expand Up @@ -478,6 +482,23 @@ def fix_dependency(dep)
end
end # def fix_dependency

def fix_provides(provides)
name_re = /^[^ \(]+/
name = provides[name_re]
if name =~ /[A-Z]/
@logger.warn("Downcasing provides '#{name}' because deb packages " \
" don't work so good with uppercase names")
provides = provides.gsub(name_re) { |n| n.downcase }
end

if provides.include?("_")
@logger.warn("Replacing 'provides' underscores with dashes in '#{provides}' because " \
"debs don't like underscores")
provides = provides.gsub("_", "-")
end
return provides.rstrip
end

def control_path(path=nil)
@control_path ||= build_path("control")
FileUtils.mkdir(@control_path) if !File.directory?(@control_path)
Expand Down