qrpm 0.7.0 → 0.8.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8e586c518e0a92575d817d0bc83c3a3d5de1355249952535ad0ab9cb3e0c980c
4
- data.tar.gz: 7216415b387f365a3b8979904a8302de92d0b5d18ef5d2c05e1813ce4dbacba2
3
+ metadata.gz: 747c9881ee1882523155861b2f7c5ac9d10a5458051978191d9d83935002abcf
4
+ data.tar.gz: 19fdcbac9b24a81f9bd1ed5d508cdf6c9d0997a04b5e36607a98e85eebc38dcb
5
5
  SHA512:
6
- metadata.gz: cffc3d4360cabdc426ee1fc2a0e74c75faf58f04f2f9eb888738d7505550c87d7ccc37832b1e8b312b13b5fa3c8e14c65253434b7a65468335646e6c3546d3db
7
- data.tar.gz: 111553786fc1513e752816314745bac348d7d2a0c638d71facc00c5edf39ee2ca5db36951730b7998f1afdbf001a76bdfbfd86fd33fdf3b44955b612d65191fd
6
+ metadata.gz: af6edf0f5218d4f1e19cd9f0d09cbfcb478643b80c40c7030b6616d104f3b670cc7828d504175259f2f932bf41c6adaa542382450e82c6b9b48bd9bb337da590
7
+ data.tar.gz: 06024f494107a593549a147fd0f26c837ad1444aa34008e4b71a57e52452504b8e41b30dad83ef700ef10e40afdb6eae48c437ff9cb640a0da8a017d93a97402
data/exe/qrpm CHANGED
@@ -236,6 +236,13 @@ begin
236
236
  -B,force-builddir=PATH?
237
237
  Like --builddir but overwrites the directory if it exists beforehand
238
238
 
239
+ --target=TARGET
240
+ Build the package for another system. The target selects rpm macros
241
+ that make the package installable there and is appended to the
242
+ release, eg. 1.el7, so that the package file shows what it was built
243
+ for. The only target is 'el7' (CentOS/RHEL 7), which makes rpmbuild use
244
+ a gzip payload because rpm 4.11 can't read the default zstd payload
245
+
239
246
  -d,dump
240
247
  Dump internal data and exit. For debug
241
248
 
@@ -314,7 +321,11 @@ begin
314
321
  # relative to the source directory
315
322
  compiler = Qrpm::Compiler.new(overrides)
316
323
  qrpm = compiler.compile(conf)
317
- rpm = qrpm.rpm
324
+ # Check target
325
+ opts.target.nil? || Qrpm::Rpm::TARGETS.key?(opts.target) or
326
+ ShellOpts.error "Unknown target '#{opts.target}', use one of #{Qrpm::Rpm::TARGETS.keys.join(", ")}"
327
+
328
+ rpm = qrpm.rpm(target: opts.target)
318
329
 
319
330
  if opts.subcommand == :show!
320
331
  for variable in show
data/lib/qrpm/rpm.rb CHANGED
@@ -50,6 +50,15 @@ module Qrpm
50
50
 
51
51
  RPM_DIRS = %w(SOURCES BUILD RPMS SPECS SRPMS tmp)
52
52
 
53
+ # Build targets. Maps from target name to the rpm macros that make the
54
+ # package installable on that system. The target is also appended to the
55
+ # release so that the package file shows what it was built for
56
+ TARGETS = {
57
+ # rpm 4.11 on el7 can't read the zstd payload that newer rpmbuild
58
+ # versions emit by default
59
+ "el7" => { "_binary_payload" => "w9.gzdio" }
60
+ }
61
+
53
62
  # Field accessor methods. FIXME Value should have been resolved
54
63
  FIELDS.each { |f,ts|
55
64
  if ts.include? Array
@@ -81,19 +90,28 @@ module Qrpm
81
90
  # The content of the SPEC file
82
91
  attr_reader :spec
83
92
 
93
+ # Build target, a key of TARGETS, or nil
94
+ attr_reader :target
95
+
96
+ # The rpm macros of the target as a hash. Empty if there is no target
97
+ def globals() target ? TARGETS[target] : {} end
98
+
84
99
  def files() @files ||= nodes.select(&:file?) end
85
100
  def dirs() @dirs ||= nodes.select(&:dir?) end
86
101
  def links() @links ||= nodes.select(&:link?) end
87
102
  def reflinks() @reflinks ||= nodes.select(&:reflink?) end
88
103
  def symlinks() @symlinks ||= nodes.select(&:symlink?) end
89
104
 
90
- def initialize(srcdir, fields, nodes, template: QRPM_ERB_FILE)
105
+ def initialize(srcdir, fields, nodes, template: QRPM_ERB_FILE, target: nil)
91
106
  constrain srcdir, String
92
107
  constrain fields, { String => Node }
93
108
  constrain nodes, [FileNode]
109
+ constrain target, String, nil
110
+ target.nil? || TARGETS.key?(target) or raise ArgumentError, "Unknown target '#{target}'"
94
111
  @fields, @nodes = fields, nodes
95
112
  @srcdir = srcdir
96
113
  @template = template
114
+ @target = target
97
115
  end
98
116
 
99
117
  def has_configure?() ::File.exist? "#{srcdir}/configure" end
@@ -172,6 +190,7 @@ module Qrpm
172
190
  def dump
173
191
  puts self.class
174
192
  indent {
193
+ puts "target: #{target}" if target
175
194
  puts "fields"
176
195
  indent { fields.sort_by(&:first).each { |k,v| puts "#{k}: #{v.value}" } }
177
196
  puts "nodes"
@@ -1,7 +1,10 @@
1
+ <% for macro, value in globals -%>
2
+ %global <%= macro %> <%= value %>
3
+ <% end -%>
1
4
  Name: <%= name %>
2
5
  Summary: <%= summary %>
3
6
  Version: <%= version %>
4
- Release: <%= release %>
7
+ Release: <%= release %><%= target ? ".#{target}" : "" %>
5
8
  License: <%= license %>
6
9
  Packager: <%= packager %>
7
10
  <% for pck in require || [] -%>
data/lib/qrpm/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Qrpm
4
- VERSION = "0.7.0"
4
+ VERSION = "0.8.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qrpm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claus Rasmussen