-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathf21.rb
More file actions
executable file
·29 lines (22 loc) · 872 Bytes
/
f21.rb
File metadata and controls
executable file
·29 lines (22 loc) · 872 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/ruby
changelog = false
gem_install = false
ARGF.each_line do |line|
changelog ||= line =~ /%changelog/
comment = line =~ /\s*#/
unless changelog or comment
# Remove Requires, which are now autogenerated.
next if line =~ /\bRequires:.*ruby.*/
# Remove rubygem virtual provide, which is now autogenerated.
next if line =~ /\bProvides:.*rubygem\(.*\).*/
# Simplify binary extensions.
line.gsub!(/(mkdir -p %{buildroot}%{gem_extdir_mri}).*/, '\1')
line.gsub!(/mv %{buildroot}%{gem_(inst|lib)dir}\/.*\.so.*/, \
"cp -a .%{gem_extdir_mri}/{gem.build_complete,*.so} %{buildroot}%{gem_extdir_mri}/\n\n" +
"# Prevent dangling symlink in -debuginfo.\n" +
"rm -rf %{buildroot}%{gem_instdir}/ext\n")
# Always remove binary extension dir.
next if line =~ /%exclude %{gem_instdir}\/ext/
end
puts line
end