rgem2rpm 1.4.5 → 1.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/conf/template.spec CHANGED
@@ -5,6 +5,7 @@
5
5
  /usr/lib/rpm/brp-strip-comment-note %{__strip} %{__objdump} \
6
6
  %{nil}
7
7
 
8
+ %define _binaries_in_noarch_packages_terminate_build 0
8
9
  %define distnum %{expand:%%(/usr/lib/rpm/redhat/dist.sh --distnum)}
9
10
  %define disttype %{expand:%%(/usr/lib/rpm/redhat/dist.sh --disttype)}
10
11
  %define name <%=name%>
data/lib/rgem2rpm/gem.rb CHANGED
@@ -36,8 +36,6 @@ class RGem2Rpm::Gem
36
36
  Dir["#{@installdir}/*"].each {|name| FileUtils.rm_rf(name) unless name =~ /bin|gems|specifications/ }
37
37
  # get file list
38
38
  files
39
- # alter executables first line
40
- shebang
41
39
  # build tar.gz
42
40
  build_source
43
41
  end
@@ -106,7 +104,7 @@ class RGem2Rpm::Gem
106
104
  @spec[:files][:directories] << 'bin'
107
105
  # get files and directories
108
106
  Dir.glob("gems/**/*") do |file|
109
- key = File.directory?(file) ? :directories : :files
107
+ key = File.directory?(file) ? :directories : (File.executable?(file) || file.end_with?('.sh') ? :executables : :files)
110
108
  @spec[:files][key] << file
111
109
  end
112
110
  # get gem path
@@ -120,19 +118,16 @@ class RGem2Rpm::Gem
120
118
  # get executable files
121
119
  Dir.glob("bin/*") do |file|
122
120
  @spec[:files][:executables] << file
121
+ shebang(file)
123
122
  end
124
123
  end
125
124
  end
126
125
 
127
- def shebang
128
- # check if gem has executables
129
- return if @spec[:executables].nil? or @spec[:executables].empty?
126
+ def shebang(filename)
130
127
  # alter first line of all executables
131
- @spec[:executables].each do |file|
132
- file_arr = File.readlines("#{@installdir}/bin/#{file}")
133
- file_arr[0] = "#!/usr/bin/env #{@platform}\n"
134
- File.open("#{@installdir}/bin/#{file}", 'w') { |f| f.write(file_arr.join) }
135
- end
128
+ file_arr = File.readlines(filename)
129
+ file_arr[0] = "#!/usr/bin/env #{@platform}\n"
130
+ File.open(filename, 'w') { |f| f.write(file_arr.join) }
136
131
  end
137
132
 
138
133
  def build_source
data/lib/rgem2rpm/rpm.rb CHANGED
@@ -35,26 +35,21 @@ class RGem2Rpm::Rpm
35
35
  install_str << "rm -rf %{buildroot}\n"
36
36
  # get directories
37
37
  @files[:directories].each { |directory|
38
- directory.gsub!(/%/, '%%')
39
- install_str << "install -d \"#{directory}\" %{buildroot}%{prefix}/\"#{directory}\"\n"
38
+ escaped_str = directory.gsub(/%/, '%%')
39
+ install_str << "install -d \"#{escaped_str}\" %{buildroot}%{prefix}/\"#{escaped_str}\"\n"
40
40
  }
41
41
  # get files
42
42
  @files[:files].each { |file|
43
- if file.end_with?('.sh')
44
- @files[:files].delete(file)
45
- @files[:executables] << file
46
- else
47
- file.gsub!(/%/, '%%')
48
- install_str << "install -m 644 \"#{file}\" %{buildroot}%{prefix}/\"#{file}\"\n"
49
- end
43
+ escaped_str = file.gsub(/%/, '%%')
44
+ install_str << "install -m 644 \"#{escaped_str}\" %{buildroot}%{prefix}/\"#{escaped_str}\"\n"
50
45
  }
51
46
  # get specification
52
- specfile = @files[:specification].gsub(/%/, '%%')
53
- install_str << "install -m 644 \"#{specfile}\" %{buildroot}%{prefix}/\"#{specfile}\"\n"
47
+ escaped_str = @files[:specification].gsub(/%/, '%%')
48
+ install_str << "install -m 644 \"#{escaped_str}\" %{buildroot}%{prefix}/\"#{escaped_str}\"\n"
54
49
  # get executables
55
50
  @files[:executables].each { |executable|
56
- executable.gsub!(/%/, '%%')
57
- install_str << "install -m 0755 \"#{executable}\" %{buildroot}%{prefix}/\"#{executable}\"\n"
51
+ escaped_str = executable.gsub(/%/, '%%')
52
+ install_str << "install -m 0755 \"#{escaped_str}\" %{buildroot}%{prefix}/\"#{escaped_str}\"\n"
58
53
  }
59
54
  # return install string
60
55
  install_str.string
@@ -69,7 +64,11 @@ class RGem2Rpm::Rpm
69
64
  files_str << "%dir %{prefix}/#{@files[:gempath]}\n"
70
65
  files_str << "%dir %{prefix}/specifications\n"
71
66
  files_str << "%{prefix}/#{@files[:specification]}\n"
72
- files_str << "%{prefix}/#{@files[:gempath]}/*\n" unless @files[:files].empty?
67
+
68
+ @files[:files].each { |file|
69
+ escaped_str = file.gsub(/%/, '*')
70
+ files_str << "\"%{prefix}/#{escaped_str}\"\n"
71
+ }
73
72
 
74
73
  # get executables
75
74
  @files[:executables].each { |executable|
@@ -1,3 +1,3 @@
1
1
  module RGem2Rpm
2
- VERSION = '1.4.5'
2
+ VERSION = '1.4.6'
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: rgem2rpm
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.4.5
5
+ version: 1.4.6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Joao Peixoto
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-10-26 00:00:00 Z
13
+ date: 2012-11-09 00:00:00 Z
14
14
  dependencies: []
15
15
 
16
16
  description: Application that enables conversion of rubygems to rpms.