qrpm 0.5.3 → 0.6.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: 5f18febdc69d52be520720e7279961f03469e6011ae6a149a2aeee6151dd5dda
4
- data.tar.gz: 7ac4f4b7ec4cbfd1633378ad6794a26761af9eb13e6e64643384738297d24c41
3
+ metadata.gz: 449228e498e0856af0253472dd643db07f548cccece91096ab858651facf7d77
4
+ data.tar.gz: d476f3ada3fc7502a422c7a5454383e46c5a7d880020d291e71cf313c8c4929b
5
5
  SHA512:
6
- metadata.gz: 69504c36e66243663c420b1728643733ad06f781e01d6365b6e56b91bd3e6f6f0c5587c68a89c96a656ebf0596a65d9cd023873ce3e10b92c3a98716f1905adf
7
- data.tar.gz: 93a16bf658e128f970f94cb78ce5ae61fecd87c8504cb9beab14c4d50b9d515bcf1bb0c195decd365d1b11b3f27cdc2b5e5eb78e2a7c3d63585f2a3ee281778e
6
+ metadata.gz: '099a87257e60bbe0aa18164d1a09bc62961bc4352a2ca607ce7c9d5f8cc377560eea20398af5f8a0bfb71ad4fa84423f6a501e723cd40cad7a8e6cbdb5e391e2'
7
+ data.tar.gz: cbd7563e7ebd7153f228168b87f43bc2f6af453a58642445efb03936e7ae93b0ff2fc09eb952471c824bd14c0a106fa52466eb5ee6a40c5e9bb4b6aa168d1e86
data/example/qrpm.yml CHANGED
@@ -10,8 +10,8 @@ require:
10
10
  - httpd
11
11
  - postgresql13
12
12
 
13
- make: # List of commands to build project
14
- - echo "Hej du" > bin/another_file
13
+ make: |
14
+ echo "Hej du" > bin/another_file
15
15
 
16
16
  $bindir:
17
17
  - bin/a_file
data/example.yml CHANGED
@@ -68,8 +68,8 @@ pg:
68
68
  # - git submodule init
69
69
  # - git submodule update
70
70
 
71
- make:
72
- - cd $srcdir; make
71
+ make: |
72
+ cd $srcdir; make
73
73
 
74
74
  ${pg.sharedir}/extension:
75
75
  - $srcdir/url_encode.control
data/exe/qrpm CHANGED
@@ -34,7 +34,15 @@ begin
34
34
  is set to the name of the current directory and version to the latest tag
35
35
  in git (which needs to be present). Other defaults are detailed below
36
36
 
37
- VARIABLES
37
+ SETUP
38
+
39
+ Use qrpm -t to generate a template qrpm.yml file:
40
+
41
+ qrpm -t [TEMPLATE-FILE]
42
+
43
+ Then customize as needed
44
+
45
+ VARIABLES
38
46
 
39
47
  The configuration file can define and use variables. They are defined by
40
48
  key/value definitions and the value can refer to values of other
@@ -46,6 +54,21 @@ begin
46
54
  part of the command so only one command is allowed. This restriction keeps
47
55
  the parser simple, it may change in the future
48
56
 
57
+ The special 'make' variable takes a string and executes it before packaing
58
+ the project
59
+
60
+ STANDARD VARIABLES
61
+
62
+ The following RPM variables are recognized:
63
+
64
+ name
65
+ summary
66
+ description
67
+ version
68
+ release
69
+ packager
70
+ requires
71
+
49
72
  INCLUDE FILES
50
73
 
51
74
  The qrpm file can include other files that are searched for in a list of
@@ -55,7 +78,7 @@ begin
55
78
 
56
79
  BUILT-IN VARIABLES
57
80
 
58
- There are the following built-in variables. They are listed below with their
81
+ There are the following built-in variables. They are listed below with their
59
82
  default values:
60
83
 
61
84
  rootdir /
@@ -104,7 +127,7 @@ begin
104
127
 
105
128
  -f,force
106
129
  Create package even if repository is dirty. Normally qrpm checks if the
107
- current directory is clean
130
+ current (git) directory is clean
108
131
 
109
132
  -C,directory=EDIR
110
133
  Change to directory before doing anything else but include the current
@@ -184,9 +207,9 @@ begin
184
207
  # Compute builddir
185
208
  if opts.builddir? && opts.force_builddir?
186
209
  ShellOpts.error "Can't use both --builddir and --force-builddir"
187
- elsif opts.builddir? || opts.force_builddir?
210
+ elsif opts.builddir? || opts.force_builddir?
188
211
  builddir = opts.builddir || opts.force_builddir || "builddir"
189
- opts.force_builddir? || !File.exist?(builddir) or
212
+ opts.force_builddir? || !File.exist?(builddir) or
190
213
  ShellOpts.error "Build directory 'builddir' exists - use -B to override"
191
214
  builddir = File.expand_path(builddir)
192
215
  else
@@ -194,7 +217,7 @@ begin
194
217
  end
195
218
 
196
219
  # Check if repository is clean
197
- opts.force? || opts.dump? || `cd #{qrpmdir}; git status --porcelain | grep -v '??' 2>/dev/null` == "" or
220
+ opts.force? || opts.dump? || `cd #{qrpmdir}; git status --porcelain | grep -v '??' 2>/dev/null` == "" or
198
221
  ShellOpts.error "Repository is dirty"
199
222
 
200
223
  # Create lexer
@@ -240,10 +263,10 @@ begin
240
263
  # Create spec/srpm/rpm file
241
264
  target = (opts.spec? ? :spec : (opts.source? ? :srpm : :rpm))
242
265
  files = rpm.build(
243
- target: target,
244
- file: opts.spec,
245
- verbose: opts.verbose?,
246
- destdir: currdir,
266
+ target: target,
267
+ file: opts.spec,
268
+ verbose: opts.verbose?,
269
+ destdir: currdir,
247
270
  builddir: builddir)
248
271
 
249
272
  puts "Built #{files.map { |f| File.basename(f) }.join(" ")}" if !opts.quiet?
data/lib/qrpm/node.rb CHANGED
@@ -47,9 +47,9 @@ module Qrpm
47
47
  # Interpolate variables in Node. Note that interpolation is not recursive
48
48
  # except for DirectoryNode objects that interpolates both key and elements.
49
49
  # #interpolate sets the interpolated flag and returns self
50
- def interpolate(dict)
50
+ def interpolate(dict)
51
51
  @interpolated = true
52
- self
52
+ self
53
53
  end
54
54
 
55
55
  # True if object has been interpolated
@@ -116,7 +116,7 @@ module Qrpm
116
116
 
117
117
  class ValueNode < Node
118
118
  # Source code of expression
119
- def source() @expr.source end
119
+ def source() @expr.source end
120
120
 
121
121
  # Override Qrpm#value. Initially nil, initialized by #interpolate
122
122
  attr_reader :value
@@ -129,10 +129,10 @@ module Qrpm
129
129
 
130
130
  # Override Qrpm methods
131
131
  def variables() @variables ||= expr.variables end
132
-
133
- def interpolate(dict)
132
+
133
+ def interpolate(dict)
134
134
  @value ||= expr.interpolate(dict) # Allows StandardDirNode to do its own assignment
135
- super
135
+ super
136
136
  end
137
137
 
138
138
  def signature() "#{class_name}(#{name},#{expr.source})" end
@@ -185,7 +185,7 @@ module Qrpm
185
185
  # Override ContainerNode#exprs
186
186
  def exprs() expr.values end
187
187
 
188
- def initialize(parent, name, hash = {})
188
+ def initialize(parent, name, hash = {})
189
189
  constrain hash, Hash
190
190
  super(parent, name, hash.dup)
191
191
  end
@@ -195,7 +195,7 @@ module Qrpm
195
195
  def dump
196
196
  puts "{"
197
197
  indent {
198
- expr.each { |k,v|
198
+ expr.each { |k,v|
199
199
  print "#{k}: "
200
200
  v.dump
201
201
  }
@@ -213,8 +213,8 @@ module Qrpm
213
213
 
214
214
  # Override Node#interpolate. Only interpolates contained DirectoryNode
215
215
  # objects (TODO doubtfull - this is a Qrpm-level problem not a Node problem)
216
- def interpolate(dict)
217
- exprs.each { |e| e.is_a?(DirectoryNode) and e.interpolate(dict) }
216
+ def interpolate(dict)
217
+ exprs.each { |e| e.is_a?(DirectoryNode) and e.interpolate(dict) }
218
218
  super
219
219
  end
220
220
 
@@ -241,7 +241,7 @@ module Qrpm
241
241
  # Exactly one of 'file', 'symlink', and 'reflink' must be defined. 'perm'
242
242
  # can't be used together with 'symlink' or 'reflink'
243
243
  #
244
- # When interpolated the following methods are defined on a FileNode:
244
+ # When interpolated the following methods are defined on a FileNode:
245
245
  #
246
246
  # srcpath Path to source file
247
247
  # dstpath Path to destination file
@@ -288,7 +288,7 @@ module Qrpm
288
288
 
289
289
  def interpolate(dict)
290
290
  super
291
- exprs.each { |e| e.interpolate(dict) }
291
+ exprs.each { |e| e.interpolate(dict) }
292
292
  @srcpath = value[%w(file symlink reflink).find { |k| expr.key?(k) }].value
293
293
  @dstname = value["name"]&.value || File.basename(srcpath)
294
294
  @dstpath = "#{parent.directory}/#{@dstname}"
@@ -337,7 +337,7 @@ module Qrpm
337
337
  # Override ContainerNode#exprs
338
338
  def exprs() expr end
339
339
 
340
- def initialize(parent, name, array = [])
340
+ def initialize(parent, name, array = [])
341
341
  constrain array, Array
342
342
  super(parent, name, array.dup)
343
343
  end
@@ -371,7 +371,7 @@ module Qrpm
371
371
  class DirectoryNode < ArrayNode
372
372
  # Override Qrpm#key
373
373
  attr_reader :key
374
-
374
+
375
375
  # File system path to the directory. An alias for uuid/key
376
376
  def directory() key end
377
377
 
@@ -387,7 +387,7 @@ module Qrpm
387
387
  def interpolate(dict)
388
388
  # #key is used by the embedded files to compute their paths so it has be
389
389
  # interpolated before we interpolate the files through the +super+ method
390
- @key = name.interpolate(dict)
390
+ @key = name.interpolate(dict)
391
391
  super
392
392
  end
393
393
  end
data/lib/qrpm/rpm.rb CHANGED
@@ -9,19 +9,16 @@ module Qrpm
9
9
  # release Release
10
10
  # summary Short one-line description of package (mandatory)
11
11
  # description Description
12
- # packager Name of the packager (defaults to the name of the user or
12
+ # packager Name of the packager (defaults to the name of the user or
13
13
  # $USER@$HOSTNAME if not found)
14
14
  # license License (defaults to GPL)
15
15
  # require Array of required packages
16
16
  # make Controls the build process:
17
- # null Search the top-level directory for configure or
18
- # make files and runs them. Skip building if not
19
- # found. This is the default
20
- # true Expect the top-level directory to contain
21
- # configure or make files and runs them. It is an
17
+ # true Expect the top-level directory to contain
18
+ # configure or make files and runs them. It is an
22
19
  # error if the Makefile is missing
23
- # (array of commands)
24
- # Runs the commands to build the project
20
+ # (possibly multiline command)
21
+ # Runs the command to build the project
25
22
  #
26
23
  # Each field has a dynamically generated accessor method that can be
27
24
  # referenced in the template file
@@ -37,16 +34,16 @@ module Qrpm
37
34
  "group" => [String],
38
35
  "include" => [Array, String],
39
36
  "require" => [Array, String],
40
- "make" => [Array, String]
37
+ "make" => [String]
41
38
  })
42
39
 
43
40
  RPM_DIRS = %w(SOURCES BUILD RPMS SPECS SRPMS tmp)
44
41
 
45
42
  # Field accessor methods. FIXME Value should have been resolved
46
- FIELDS.each { |f,ts|
43
+ FIELDS.each { |f,ts|
47
44
  if ts.include? Array
48
45
  eval <<-EOS
49
- def #{f}()
46
+ def #{f}()
50
47
  case v = @fields["#{f}"]
51
48
  when ValueNode
52
49
  v.value
@@ -15,28 +15,21 @@ Source: %{name}.tar.gz
15
15
  %description
16
16
  <%= description %>
17
17
 
18
+ %global debug_package %{nil}
19
+
18
20
  %prep
19
21
  %setup -n <%= name %>
20
22
 
21
23
  %build
22
24
  cd <%= srcdir %>
23
- <% if make.nil? -%>
24
- <% if has_configure? -%>
25
- ./configure
26
- <% end -%>
27
- <% if has_make? -%>
28
- make
29
- <% end -%>
30
- <% elsif make == false -%>
31
- <% elsif make == true -%>
25
+ <% if make.nil? || make == false -%>
26
+ <% elsif make == true %>
32
27
  <% if has_configure? -%>
33
28
  ./configure
34
29
  <% end -%>
35
30
  make
36
- <% elsif make.is_a? Array -%>
37
- <% for cmd in make -%>
38
- <%= cmd %>
39
- <% end -%>
31
+ <% elsif make.is_a? String -%>
32
+ <%= make %>
40
33
  <% end -%>
41
34
 
42
35
  %install
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.5.3"
4
+ VERSION = "0.6.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qrpm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claus Rasmussen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-07-09 00:00:00.000000000 Z
11
+ date: 2025-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: shellopts
@@ -111,7 +111,6 @@ files:
111
111
  - lib/qrpm/template.yml
112
112
  - lib/qrpm/utils.rb
113
113
  - lib/qrpm/version.rb
114
- - packager.sh
115
114
  - packager.yml
116
115
  - program.sh
117
116
  - qrpm.gemspec
data/packager.sh DELETED
@@ -1,65 +0,0 @@
1
- #!/usr/bin/bash
2
-
3
- # This scripts creates and build a simple RPM package
4
- #
5
- # Prerequisites:
6
- # - rpm-build, make and gcc (as it's a c file) packages must be installed
7
- #
8
-
9
- # Ref. http://aerostitch.github.io/linux_and_unix/RedHat/build_sample_rpm.html
10
-
11
- # Holds the name of the root directory containing the necessary structure to
12
- # build RPM packages.
13
- RPM_ROOT_DIR=~/rpm_factory
14
-
15
- PKG_NAME=dummy_package
16
- PKG_TAR=/tmp/${PKG_NAME}.tar.gz
17
- BINARY_FILE=hello_world
18
- # Recreate the root directory and its structure if necessary
19
- mkdir -p ${RPM_ROOT_DIR}/{SOURCES,BUILD,RPMS,SPECS,SRPMS,tmp}
20
- pushd $RPM_ROOT_DIR
21
- cp ${PKG_TAR} ${RPM_ROOT_DIR}/SOURCES/
22
-
23
- # Creating a basic spec file
24
- cat << __EOF__ > ${RPM_ROOT_DIR}/SPECS/${PKG_NAME}.spec
25
- Summary: This package is a sample for quickly build dummy RPM package.
26
- Name: $PKG_NAME
27
- Version: 1.0
28
- Release: 0
29
- License: GPL
30
- Packager: $USER
31
- Group: Development/Tools
32
- Source: %{name}.tar.gz
33
- BuildRequires: coreutils
34
- BuildRoot: ${RPM_ROOT_DIR}/tmp/%{name}-%{version}
35
-
36
- %description
37
- %{summary}
38
-
39
- %prep
40
- %setup -n ${PKG_NAME}
41
-
42
- %build
43
- make $BINARY_FILE
44
-
45
- %install
46
- mkdir -p "%{buildroot}/opt/${PKG_NAME}"
47
- cp $BINARY_FILE "%{buildroot}/opt/${PKG_NAME}/"
48
-
49
- %files
50
- /opt/${PKG_NAME}/hello_world
51
-
52
- %clean
53
- %if "%{clean}" != ""
54
- rm -rf %{_topdir}/BUILD/%{name}
55
- [ $(basename %{buildroot}) == "%{name}-%{version}-%{release}.%{_target_cpu}" ] && rm -rf %{buildroot}
56
- %endif
57
-
58
- %post
59
- chmod 755 -R /opt/${PKG_NAME}
60
- __EOF__
61
-
62
- rpmbuild -v -bb --define "_topdir ${RPM_ROOT_DIR}" SPECS/${PKG_NAME}.spec
63
- popd
64
-
65
-