Check-in [d9329acfbb]
Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | fix issues when packaging links in dir package and rpm template * lib/fpm/package/dir.rb: File.directory? returns true if source is a link to a directory. This is not the desired behavior, a link should be kept as a link, whether it is a link for a file or a directory. * templates/rpm.erb: check whether we are copying a link, if so, only copy the link not a new file. For the same reason as lib/fpm/package/dir.rb, links to directories were rejected. So, do not reject links to directories. |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
d9329acfbbad0ad2d581813c7415f8ca |
| User & Date: | aleix@oblong.com 2012-03-21 01:49:22 |
Context
|
2012-03-21
| ||
| 06:53 | Merge pull request #177 from aconchillo/master fix issues when packaging links in dir package and rpm template check-in: 7e3a09c8ef user: jls@semicomplete.com tags: trunk | |
| 01:49 | fix issues when packaging links in dir package and rpm template * lib/fpm/package/dir.rb: File.directory? returns true if source is a link to a directory. This is not the desired behavior, a link should be kept as a link, whether it is a link for a file or a directory. * templates/rpm.erb: check whether we are copying a link, if so, only copy the link not a new file. For the same reason as lib/fpm/package/dir.rb, links to directories were rejected. So, do not reject links to directories. check-in: d9329acfbb user: aleix@oblong.com tags: trunk | |
|
2012-03-19
| ||
| 21:39 | - tell travis to run on more rubies check-in: b8ede3fd72 user: jls@semicomplete.com tags: trunk, v0.4.1 | |
Changes
Changes to lib/fpm/package/dir.rb.
| ︙ | ︙ | |||
87 88 89 90 91 92 93 |
def copy(source, destination)
directory = File.dirname(destination)
if !File.directory?(directory)
FileUtils.mkdir_p(directory)
end
# Create a directory if this path is a directory
| | < > > | 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
def copy(source, destination)
directory = File.dirname(destination)
if !File.directory?(directory)
FileUtils.mkdir_p(directory)
end
# Create a directory if this path is a directory
if File.directory?(source) and !File.symlink?(source)
@logger.debug("Creating", :directory => destination)
FileUtils.mkdir(destination)
else
# Otherwise try copying the file.
begin
@logger.debug("Linking", :source => source, :destination => destination)
File.link(source, destination)
rescue Errno::EXDEV
# Hardlink attempt failed, copy it instead
@logger.debug("Copying", :source => source, :destination => destination)
FileUtils.copy(source, destination)
end
end
end # def copy
public(:input, :output)
end # class FPM::Package::Dir
|
Changes to templates/rpm.erb.
| ︙ | ︙ | |||
52 53 54 55 56 57 58 | %install <% files.each do |path| -%> <% source = File.join(staging_path, path) -%> <% # Copy to the build_path/BUILD/ to make rpmbuild happy -%> <% target = File.join(build_path, "BUILD", path) -%> <% dir = File.dirname(target) %> mkdir -p "<%= dir %>" | | | | 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | %install <% files.each do |path| -%> <% source = File.join(staging_path, path) -%> <% # Copy to the build_path/BUILD/ to make rpmbuild happy -%> <% target = File.join(build_path, "BUILD", path) -%> <% dir = File.dirname(target) %> mkdir -p "<%= dir %>" if [ -f "<%= source %>" ] || [ -h "<%= source %>" ] ; then cp -d "<%= source %>" "<%= target %>" elif [ -d "<%= source %>" ] ; then mkdir "<%= target %>" fi <% end %> %clean # noop |
| ︙ | ︙ | |||
92 93 94 95 96 97 98 | <% config_files.each do |path| -%> %config <%= path %> <% end -%> <%# list only files, not directories? -%> <%= # Reject directories or config files already listed, then prefix files with # "/", then make sure paths with spaces are quoted. I hate rpm so much. | | | 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
<% config_files.each do |path| -%>
%config <%= path %>
<% end -%>
<%# list only files, not directories? -%>
<%=
# Reject directories or config files already listed, then prefix files with
# "/", then make sure paths with spaces are quoted. I hate rpm so much.
files.reject { |f| x = File.join(staging_path, f); File.directory?(x) && !File.symlink?(x) } \
.collect { |f| "/#{f}" } \
.reject { |f| config_files.include?(f) } \
.collect { |f| f[/\s/] and "\"#{f}\"" or f } \
.join("\n")
%>
%changelog
|