[packages/rpm] gem_helper: add spec-dump to write self contained .gemspec

glen glen at pld-linux.org
Thu Jun 2 00:22:07 CEST 2016


commit d2eb086f435776799b4bde76f34ecd5f67eb171f
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Thu Jun 2 01:20:56 2016 +0300

    gem_helper: add spec-dump to write self contained .gemspec

 gem_helper.rb | 23 +++++++++++++++++------
 rpm.spec      |  2 +-
 2 files changed, 18 insertions(+), 7 deletions(-)
---
diff --git a/rpm.spec b/rpm.spec
index 1c6d227..ecdf9d2 100644
--- a/rpm.spec
+++ b/rpm.spec
@@ -51,7 +51,7 @@ Summary(ru.UTF-8):	Менеджер пакетов от RPM
 Summary(uk.UTF-8):	Менеджер пакетів від RPM
 Name:		rpm
 Version:	5.4.15
-Release:	34
+Release:	35
 License:	LGPL v2.1
 Group:		Base
 # http://rpm5.org/files/rpm/rpm-5.4/rpm-5.4.15-0.20140824.src.rpm
diff --git a/gem_helper.rb b/gem_helper.rb
index 2a6bfab..11de3be 100755
--- a/gem_helper.rb
+++ b/gem_helper.rb
@@ -8,6 +8,22 @@
 require 'optparse'
 require 'rubygems'
 
+# Write the .gemspec specification (in Ruby)
+def writespec(spec)
+	file_name = spec.full_name.untaint + '.gemspec'
+	File.open(file_name, "w") do |file|
+		file.puts spec.to_ruby_for_cache
+	end
+	print "Wrote: %s\n" % file_name
+end
+
+# make gemspec self-contained
+if ARGV[0] == "spec-dump"
+	spec = eval(File.read(ARGV[1]))
+	writespec(spec)
+	exit(0)
+end
+
 if ARGV[0] == "build" or ARGV[0] == "install" or ARGV[0] == "spec"
   require 'yaml'
   require 'zlib'
@@ -69,12 +85,7 @@ if ARGV[0] == "build" or ARGV[0] == "install" or ARGV[0] == "spec"
   spec = Gem::Specification.from_yaml(YAML.dump(header))
 
   if ARGV[0] == "spec"
-    # Write the .gemspec specification (in Ruby)
-    file_name = spec.full_name.untaint + '.gemspec'
-    File.open(file_name, "w") do |file|
-      file.puts spec.to_ruby_for_cache
-    end
-    print "Wrote: %s\n" % file_name
+    writespec(spec)
     exit(0)
   end
 
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/rpm.git/commitdiff/d2eb086f435776799b4bde76f34ecd5f67eb171f



More information about the pld-cvs-commit mailing list