qrpm 0.1.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/NOTES +7 -0
- data/TODO +30 -0
- data/doc/pg.yml +37 -0
- data/doc/qrpm2.rb +69 -0
- data/doc/qrpm2.yml +55 -0
- data/example/configure +0 -0
- data/example/make +0 -0
- data/example/my_package_name-1.2.3-4.x86_64.rpm +0 -0
- data/example/my_package_name.spec +49 -0
- data/example.yml +69 -15
- data/exe/qrpm +133 -44
- data/lib/qrpm/compiler.rb +238 -0
- data/lib/qrpm/fragment.rb +177 -0
- data/lib/qrpm/lexer.rb +41 -0
- data/lib/qrpm/node.rb +372 -31
- data/lib/qrpm/qrpm.rb +182 -53
- data/lib/qrpm/rpm.rb +105 -61
- data/lib/qrpm/template.erb +28 -29
- data/lib/qrpm/template.yml +15 -12
- data/lib/qrpm/utils.rb +10 -0
- data/lib/qrpm/version.rb +1 -1
- data/lib/qrpm.rb +107 -1
- data/qrpm.gemspec +3 -3
- metadata +50 -10
- data/lib/qrpm/parser.rb +0 -202
data/lib/qrpm/rpm.rb
CHANGED
@@ -2,64 +2,104 @@ require 'erb'
|
|
2
2
|
require 'fileutils'
|
3
3
|
|
4
4
|
module Qrpm
|
5
|
+
# Knows the following RPM fields:
|
6
|
+
#
|
7
|
+
# name Package name (mandatory)
|
8
|
+
# version Version (mandatory)
|
9
|
+
# release Release
|
10
|
+
# summary Short one-line description of package (mandatory)
|
11
|
+
# description Description
|
12
|
+
# packager Name of the packager (defaults to the name of the user or
|
13
|
+
# $USER@$HOSTNAME if not found)
|
14
|
+
# license License (defaults to GPL)
|
15
|
+
# require Array of required packages
|
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
|
22
|
+
# error if the Makefile is missing
|
23
|
+
# (array of commands)
|
24
|
+
# Runs the commands to build the project
|
25
|
+
#
|
26
|
+
# Each field has a dynamically generated accessor method that can be
|
27
|
+
# referenced in the template file
|
5
28
|
class Rpm
|
6
|
-
|
7
|
-
|
8
|
-
#
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
# null Search the top-level directory for configure or
|
20
|
-
# make files and runs them. Skip building if not
|
21
|
-
# found. This is the default
|
22
|
-
# true Expect the top-level directory to contain
|
23
|
-
# configure make files and runs them. It is an
|
24
|
-
# error if the Makefile is missing
|
25
|
-
# (array of commands)
|
26
|
-
# Runs the commands to build the project
|
27
|
-
#
|
28
|
-
FIELDS = %w(name version release group license summary description packager requires make)
|
29
|
-
MANDATORY_FIELDS = %w(name summary version)
|
30
|
-
TEMPLATE = "#{::File.dirname(__FILE__)}/template.erb"
|
29
|
+
MANDATORY_FIELDS = %w(name version summary)
|
30
|
+
|
31
|
+
# Maps from field name to array of allowed types for that field
|
32
|
+
FIELDS = MANDATORY_FIELDS.map { |f| [f, [String]] }.to_h.merge({
|
33
|
+
"release" => [String],
|
34
|
+
"description" => [String],
|
35
|
+
"packager" => [String],
|
36
|
+
"license" => [String],
|
37
|
+
"group" => [String],
|
38
|
+
"include" => [Array, String],
|
39
|
+
"require" => [Array, String],
|
40
|
+
"make" => [Array, String]
|
41
|
+
})
|
31
42
|
|
32
43
|
RPM_DIRS = %w(SOURCES BUILD RPMS SPECS SRPMS tmp)
|
33
44
|
|
34
|
-
# Field accessor methods
|
35
|
-
FIELDS.each { |f|
|
45
|
+
# Field accessor methods. FIXME Value should have been resolved
|
46
|
+
FIELDS.each { |f,ts|
|
47
|
+
if ts.include? Array
|
48
|
+
eval <<-EOS
|
49
|
+
def #{f}()
|
50
|
+
case v = @fields["#{f}"]
|
51
|
+
when ValueNode
|
52
|
+
v.value
|
53
|
+
when ArrayNode
|
54
|
+
v.values.map(&:value)
|
55
|
+
when NilClass
|
56
|
+
nil
|
57
|
+
else
|
58
|
+
raise ArgumentError, "Can this even happen?"
|
59
|
+
end
|
60
|
+
end
|
61
|
+
EOS
|
62
|
+
else
|
63
|
+
eval "def #{f}() @fields[\"#{f}\"]&.value end"
|
64
|
+
end
|
65
|
+
}
|
36
66
|
|
37
67
|
attr_reader :fields
|
38
68
|
attr_reader :nodes
|
39
69
|
|
70
|
+
# The source directory
|
71
|
+
attr_reader :srcdir
|
72
|
+
|
40
73
|
# The content of the SPEC file
|
41
74
|
attr_reader :spec
|
42
75
|
|
43
76
|
def files() @files ||= nodes.select(&:file?) end
|
44
|
-
def links() @
|
45
|
-
|
46
|
-
def
|
47
|
-
|
48
|
-
def initialize(fields, nodes, template:
|
77
|
+
def links() @links ||= nodes.select(&:link?) end
|
78
|
+
def reflinks() @reflinks ||= nodes.select(&:reflink?) end
|
79
|
+
def symlinks() @symlinks ||= nodes.select(&:symlink?) end
|
80
|
+
|
81
|
+
def initialize(srcdir, fields, nodes, template: QRPM_ERB_FILE)
|
82
|
+
constrain srcdir, String
|
83
|
+
constrain fields, String => Node
|
84
|
+
constrain nodes, [FileNode]
|
49
85
|
@fields, @nodes = fields, nodes
|
86
|
+
@srcdir = srcdir
|
50
87
|
@template = template
|
51
|
-
@verbose = verbose
|
52
|
-
@verb = verbose ? "" : "&>/dev/null"
|
53
88
|
end
|
54
89
|
|
55
|
-
def has_configure?() ::File.exist? "configure" end
|
56
|
-
def has_make?() ::File.exist? "
|
90
|
+
def has_configure?() ::File.exist? "#{srcdir}/configure" end
|
91
|
+
def has_make?() ::File.exist? "#{srcdir}/Makefile" end
|
57
92
|
|
58
|
-
def build(target: :rpm, file: nil, verbose: false, destdir: ".")
|
93
|
+
def build(target: :rpm, file: nil, verbose: false, destdir: ".", builddir: nil)
|
59
94
|
verb = verbose ? "" : "&>/dev/null"
|
60
|
-
|
61
|
-
|
62
|
-
|
95
|
+
begin
|
96
|
+
if builddir
|
97
|
+
rootdir = builddir
|
98
|
+
FileUtils.rm_rf(rootdir)
|
99
|
+
FileUtils.mkdir_p(rootdir)
|
100
|
+
else
|
101
|
+
rootdir = Dir.mktmpdir
|
102
|
+
end
|
63
103
|
|
64
104
|
spec_file = file || "#{name}.spec"
|
65
105
|
tar_file = "#{name}.tar.gz"
|
@@ -69,47 +109,51 @@ module Qrpm
|
|
69
109
|
# Create directories
|
70
110
|
RPM_DIRS.each { |dir| FileUtils.mkdir_p "#{rootdir}/#{dir}" }
|
71
111
|
|
72
|
-
#
|
73
|
-
#
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
#
|
78
|
-
|
79
|
-
|
80
|
-
#
|
81
|
-
system "tar zcf #{tar_path}
|
82
|
-
|
83
|
-
#
|
84
|
-
FileUtils.rm_rf tarroot
|
85
|
-
|
86
|
-
# Create spec file
|
112
|
+
# Roll tarball
|
113
|
+
#
|
114
|
+
# It is a bad idea to use git-archive to roll a tarball because we may
|
115
|
+
# have configuration files/scripts that are not included in the git
|
116
|
+
# repository. If needed then see
|
117
|
+
# https://gist.github.com/arteymix/03702e3eb05c2c161a86b49d4626d21f
|
118
|
+
#
|
119
|
+
# Alternatively use the --add-file option? Then we need to know if
|
120
|
+
# files are in the git repo or not
|
121
|
+
system "tar zcf #{tar_path} --transform=s%^\./%#{name}/% ." # FIXME FIXME
|
122
|
+
|
123
|
+
# Create spec file. Initial blanks are removed from each line in the file
|
87
124
|
renderer = ERB.new(IO.read(@template).sub(/^__END__\n.*/m, ""), trim_mode: "-")
|
88
|
-
@spec = renderer.result(binding)
|
125
|
+
@spec = renderer.result(binding).gsub(/^[[:blank:]]*/, "")
|
89
126
|
|
90
127
|
# Emit spec or build RPM
|
91
128
|
if target == :spec
|
92
|
-
|
129
|
+
destfiles = ["#{destdir}/#{spec_file}"]
|
130
|
+
IO.write(destfiles.first, @spec)
|
93
131
|
else
|
94
132
|
IO.write(spec_path, @spec)
|
95
133
|
system "rpmbuild -v -ba --define \"_topdir #{rootdir}\" #{rootdir}/SPECS/#{name}.spec #{verb}" or
|
96
134
|
raise "Failed building RPM file. Re-run with -v option to see errors"
|
97
135
|
if target == :srpm
|
98
|
-
|
136
|
+
destfiles = Dir["#{rootdir}/SRPMS/*"]
|
137
|
+
!destfiles.empty? or raise Error, "No SRPM file found"
|
99
138
|
elsif target == :rpm
|
100
|
-
|
139
|
+
destfiles = Dir["#{rootdir}/RPMS/*/#{name}-[0-9]*"]
|
140
|
+
!destfiles.empty? or raise Error, "No RPM file found"
|
101
141
|
else
|
102
142
|
raise ArgumentError, "Not a valid value for :target - #{target.inspect}"
|
103
143
|
end
|
144
|
+
system "cp #{destfiles.join " "} #{destdir}" or raise "Failed copying SRPM file"
|
104
145
|
end
|
105
|
-
|
146
|
+
return destfiles
|
147
|
+
ensure
|
148
|
+
FileUtils.remove_entry_secure rootdir if !builddir
|
149
|
+
end
|
106
150
|
end
|
107
151
|
|
108
152
|
def dump
|
109
153
|
puts self.class
|
110
154
|
indent {
|
111
155
|
puts "fields"
|
112
|
-
indent { fields.each { |k,v| puts "#{k}: #{v.
|
156
|
+
indent { fields.sort_by(&:first).each { |k,v| puts "#{k}: #{v.value}" } }
|
113
157
|
puts "nodes"
|
114
158
|
indent { nodes.map(&:dump) }
|
115
159
|
}
|
data/lib/qrpm/template.erb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
Name: <%= name %>
|
3
2
|
Summary: <%= summary %>
|
4
3
|
Version: <%= version %>
|
@@ -6,13 +5,12 @@ Release: <%= release %>
|
|
6
5
|
License: <%= license %>
|
7
6
|
Packager: <%= packager %>
|
8
7
|
<% if group -%>
|
9
|
-
Group: <%= group %>
|
8
|
+
Group: <%= group %>
|
10
9
|
<% end -%>
|
11
|
-
<% for pck in
|
12
|
-
Requires: <%= pck %>
|
10
|
+
<% for pck in require || [] -%>
|
11
|
+
Requires: <%= pck %>
|
13
12
|
<% end -%>
|
14
13
|
Source: %{name}.tar.gz
|
15
|
-
BuildRoot: <%= rootdir %>/tmp/%{name}-%{version}
|
16
14
|
|
17
15
|
%description
|
18
16
|
<%= description %>
|
@@ -21,55 +19,56 @@ BuildRoot: <%= rootdir %>/tmp/%{name}-%{version}
|
|
21
19
|
%setup -n <%= name %>
|
22
20
|
|
23
21
|
%build
|
22
|
+
cd <%= srcdir %>
|
24
23
|
<% if make.nil? -%>
|
25
|
-
<% if has_configure? -%>
|
26
|
-
./configure
|
27
|
-
<% end -%>
|
28
|
-
<% if has_make? -%>
|
29
|
-
make
|
30
|
-
<% end -%>
|
24
|
+
<% if has_configure? -%>
|
25
|
+
./configure
|
26
|
+
<% end -%>
|
27
|
+
<% if has_make? -%>
|
28
|
+
make
|
29
|
+
<% end -%>
|
31
30
|
<% elsif make == false -%>
|
32
31
|
<% elsif make == true -%>
|
33
|
-
<% if has_configure? -%>
|
34
|
-
./configure
|
35
|
-
<% end -%>
|
36
|
-
make
|
32
|
+
<% if has_configure? -%>
|
33
|
+
./configure
|
34
|
+
<% end -%>
|
35
|
+
make
|
37
36
|
<% elsif make.is_a? Array -%>
|
38
|
-
<% for cmd in make -%>
|
39
|
-
<%= cmd
|
40
|
-
<% end -%>
|
37
|
+
<% for cmd in make -%>
|
38
|
+
<%= cmd.value %>
|
39
|
+
<% end -%>
|
41
40
|
<% end -%>
|
42
41
|
|
43
42
|
%install
|
44
43
|
<% if !nodes.empty? -%>
|
45
44
|
mkdir -p <%= nodes.map { |f| "%{buildroot}#{f.directory}" }.uniq.join(" ") %>
|
46
45
|
<% for file in files -%>
|
47
|
-
cp <%= file.
|
46
|
+
cp <%= file.srcpath %> %{buildroot}<%= file.dstpath %>
|
48
47
|
<% end -%>
|
49
48
|
<% for link in links -%>
|
50
|
-
touch %{buildroot}<%= link.
|
49
|
+
touch %{buildroot}<%= link.dstpath %>
|
51
50
|
<% end -%>
|
52
51
|
<% end -%>
|
53
52
|
|
54
53
|
%files
|
55
54
|
<% for file in files -%>
|
56
|
-
<%= file.
|
55
|
+
<%= file.dstpath %>
|
57
56
|
<% end -%>
|
58
57
|
<% for link in links -%>
|
59
|
-
%ghost <%= link.
|
58
|
+
%ghost <%= link.dstpath %>
|
60
59
|
<% end -%>
|
61
60
|
|
62
61
|
%clean
|
63
|
-
|
64
|
-
rm -rf %{_topdir}/BUILD/%{name}
|
65
|
-
[ $(basename %{buildroot}) == "%{name}-%{version}-%{release}.%{_target_cpu}" ] && rm -rf %{buildroot}
|
66
|
-
%endif
|
62
|
+
true # no-op
|
67
63
|
|
68
64
|
%post
|
69
65
|
<% for file in files.select(&:perm) -%>
|
70
|
-
chmod <%= file.perm %> <%= file.
|
66
|
+
chmod <%= file.perm %> <%= file.dstpath %>
|
67
|
+
<% end -%>
|
68
|
+
<% for file in reflinks -%>
|
69
|
+
ln -sf <%= link.reflink %> <%= link.dstpath %>
|
71
70
|
<% end -%>
|
72
|
-
<% for file in
|
73
|
-
ln -sf <%= link.
|
71
|
+
<% for file in symlinks -%>
|
72
|
+
ln -sf <%= link.symlink %> <%= link.dstpath %>
|
74
73
|
<% end -%>
|
75
74
|
|
data/lib/qrpm/template.yml
CHANGED
@@ -45,7 +45,7 @@ make: null # make can be undefined or null (use make if present), false
|
|
45
45
|
#
|
46
46
|
# It is used like this
|
47
47
|
#
|
48
|
-
# /opt/my_files
|
48
|
+
# /opt/my_files:
|
49
49
|
# - name: data
|
50
50
|
# file: src/my_data
|
51
51
|
# perm: 600
|
@@ -53,18 +53,17 @@ make: null # make can be undefined or null (use make if present), false
|
|
53
53
|
# This will copy src/my_data to a 'data' file in the /opt/my_files directory
|
54
54
|
# with permissions 0600
|
55
55
|
#
|
56
|
-
#
|
56
|
+
# Link files are specified using the :link attribute that is a path on the
|
57
|
+
# target system:
|
57
58
|
#
|
58
|
-
#
|
59
|
-
#
|
59
|
+
# /opt/my_files:
|
60
|
+
# - name: linked_data
|
61
|
+
# link: /opt/my_files/data
|
60
62
|
#
|
61
|
-
#
|
63
|
+
# Default name for link files is the basename of of :link
|
62
64
|
#
|
63
|
-
# libdir:
|
64
|
-
# - name: my_app
|
65
|
-
# link: /opt/my_files/data
|
66
65
|
#
|
67
|
-
# The following standard directories are defined:
|
66
|
+
# The following standard directories are defined: FIXME Outdated
|
68
67
|
#
|
69
68
|
# etcdir /etc Configuration files
|
70
69
|
# bindir /usr/bin Executables
|
@@ -72,16 +71,20 @@ make: null # make can be undefined or null (use make if present), false
|
|
72
71
|
# libdir /usr/lib Libraries (both binary and clear text)
|
73
72
|
# libexecdir /usr/libexec Executable subprograms (not meant to be
|
74
73
|
# called indepentently)
|
75
|
-
# sharedir /usr/share Constant data files
|
74
|
+
# sharedir /usr/share Constant data files
|
76
75
|
# vardir /var/lib Variable data files
|
77
76
|
# spooldir /var/spool Spool files
|
78
77
|
# rundir /var/run Run files
|
79
78
|
# lockdir /var/lock Lock files
|
80
79
|
# cachedir /var/cache Cache directory
|
81
|
-
# tmpdir /tmp Temporary directory (deleted
|
82
|
-
#
|
80
|
+
# tmpdir /tmp Temporary directory (deleted between restarts)
|
81
|
+
# vartmpdir /var/tmp TODO
|
83
82
|
# logdir /var/log Log directory
|
84
83
|
#
|
84
|
+
# pckdir <package-name> Name of package directory. It is always the
|
85
|
+
# name of the directory in /usr/share
|
86
|
+
#
|
87
|
+
#
|
85
88
|
# Each standard directory can also be prefixed a 'pck'. That will create a
|
86
89
|
# subdirectory with the package's name in the base standard directory. Eg.
|
87
90
|
# 'pcketcdir' will create the directory '/etc/<name>'
|
data/lib/qrpm/utils.rb
ADDED
data/lib/qrpm/version.rb
CHANGED
data/lib/qrpm.rb
CHANGED
@@ -1,16 +1,122 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'etc'
|
4
|
+
|
5
|
+
require 'indented_io'
|
6
|
+
require "constrain"
|
7
|
+
require "forward_to"
|
8
|
+
|
9
|
+
include Constrain
|
10
|
+
include ForwardTo
|
11
|
+
|
3
12
|
require_relative "qrpm/version"
|
4
13
|
require_relative "qrpm/node.rb"
|
14
|
+
require_relative "qrpm/fragment.rb"
|
15
|
+
require_relative "qrpm/lexer.rb"
|
16
|
+
require_relative "qrpm/compiler.rb"
|
17
|
+
require_relative "qrpm/qrpm.rb"
|
5
18
|
require_relative "qrpm/rpm.rb"
|
6
|
-
require_relative "qrpm/
|
19
|
+
require_relative "qrpm/utils.rb"
|
7
20
|
|
8
21
|
module Qrpm
|
9
22
|
class Error < RuntimeError; end
|
23
|
+
class CompileError < StandardError; end
|
24
|
+
class AbstractMethodError < StandardError; end
|
25
|
+
def abstract_method = raise AbstractMethodError.new "Abstract method called"
|
10
26
|
|
11
27
|
QRPM_CONFIG_FILE = "qrpm.yml"
|
12
28
|
|
13
29
|
QRPM_SHARE_DIR = "#{::File.dirname(__FILE__)}/../lib/qrpm"
|
14
30
|
QRPM_CONFIG_FILE_TEMPLATE = "#{QRPM_SHARE_DIR}/template.yml"
|
15
31
|
QRPM_ERB_FILE = "#{QRPM_SHARE_DIR}/template.erb"
|
32
|
+
|
33
|
+
# Should be defined and non-empty
|
34
|
+
MANDATORY_FIELDS = Rpm::MANDATORY_FIELDS
|
35
|
+
|
36
|
+
# Maps from field name to array of allowed types for that field
|
37
|
+
FIELDS = Rpm::FIELDS.map { |k,ts|
|
38
|
+
nts = ts.map { |t|
|
39
|
+
if t == String
|
40
|
+
ValueNode
|
41
|
+
elsif t == Array
|
42
|
+
ArrayNode
|
43
|
+
else
|
44
|
+
raise ArgumentError, "Illegal type: #{t.inspect}"
|
45
|
+
end
|
46
|
+
}
|
47
|
+
[k, nts]
|
48
|
+
}.to_h
|
49
|
+
|
50
|
+
STANDARD_DIRS = %w(
|
51
|
+
etcdir bindir sbindir libdir libexecdir sharedir docdir vardir spooldir
|
52
|
+
rundir lockdir cachedir logdir tmpdir
|
53
|
+
)
|
54
|
+
|
55
|
+
ROOT_DIRS = {
|
56
|
+
rootdir: "/",
|
57
|
+
rootconfdir: "$rootdir/etc",
|
58
|
+
rootexecdir: "$rootdir/usr",
|
59
|
+
rootlibdir: "$rootdir/usr",
|
60
|
+
rootconstdir: "$rootdir/usr/share",
|
61
|
+
rootdocdir: "$rootconstdir",
|
62
|
+
rootdatadir: "$rootdir/var"
|
63
|
+
}
|
64
|
+
|
65
|
+
SYSTEM_DIRS = {
|
66
|
+
sysetcdir: "$rootconfdir",
|
67
|
+
sysbindir: "$rootexecdir/bin",
|
68
|
+
syssbindir: "$rootexecdir/sbin",
|
69
|
+
syslibdir: "$rootlibdir/lib64",
|
70
|
+
syslibexecdir: "$rootexecdir/libexec",
|
71
|
+
syssharedir: "$rootconstdir/$pckdir", # Always a subdir of /usr/share
|
72
|
+
sysdocdir: "$syssharedir",
|
73
|
+
sysvardir: "$rootdatadir/lib",
|
74
|
+
sysspooldir: "$rootdatadir/spool",
|
75
|
+
sysrundir: "$rootdatadir/run",
|
76
|
+
syslockdir: "$rootdatadir/lock",
|
77
|
+
syscachedir: "$rootdatadir/cache",
|
78
|
+
syslogdir: "$rootdatadir/log",
|
79
|
+
systmpdir: "/tmp" # Always /tmp because of security
|
80
|
+
}
|
81
|
+
|
82
|
+
# There are no package-specific versions of bindir and sbindir
|
83
|
+
PACKAGE_DIRS = {
|
84
|
+
pcketcdir: "$sysetcdir/$pckdir",
|
85
|
+
pckbindir: "$sysbindir", # No subdir
|
86
|
+
pcksbindir: "$syssbindir", # No subdir
|
87
|
+
pcklibdir: "$syslibdir/$pckdir",
|
88
|
+
pcklibexecdir: "$syslibexecdir/$pckdir",
|
89
|
+
pcksharedir: "$syssharedir/$pckdir",
|
90
|
+
pckdocdir: "$sysdocdir/$pckdir",
|
91
|
+
pckvardir: "$sysvardir/$pckdir",
|
92
|
+
pckspooldir: "$sysspooldir/$pckdir",
|
93
|
+
pckrundir: "$sysrundir/$pckdir",
|
94
|
+
pcklockdir: "$syslockdir/$pckdir",
|
95
|
+
pckcachedir: "$syscachedir/$pckdir",
|
96
|
+
pcklogdir: "$syslogdir/$pckdir",
|
97
|
+
pcktmpdir: "$systmpdir/$pckdir"
|
98
|
+
}
|
99
|
+
|
100
|
+
INSTALL_DIRS = ROOT_DIRS.merge SYSTEM_DIRS.merge PACKAGE_DIRS
|
101
|
+
|
102
|
+
DEFAULTS = {
|
103
|
+
"name" => "$(basename $PWD)",
|
104
|
+
"summary" => "The $name RPM package",
|
105
|
+
"version" => "$(cd ${{srcdir}} && git tag -l 2>/dev/null | tail -1 | tr -dc '.0-9' || echo 0.0.0)",
|
106
|
+
"description" => "$summary",
|
107
|
+
"release" => "1",
|
108
|
+
"license" => "GPL",
|
109
|
+
"packager" => ::Qrpm.fullname,
|
110
|
+
"currdir" => ".", # The directory from where the qrpm was run. Initialized by the client program
|
111
|
+
"qrpmdir" => ".", # The directory containing the qrpm file. Initialized by the client program
|
112
|
+
"srcdir" => ".",
|
113
|
+
"pckdir" => "$name",
|
114
|
+
"make" => nil
|
115
|
+
}
|
116
|
+
|
117
|
+
IDENT_RE = /(?:[\w_][\w\d_]*)/
|
118
|
+
PATH_RE = /(?:[\w_][\w\d_.]*)/
|
119
|
+
|
120
|
+
FILE_KEYS = %w(name file symlink reflink perm)
|
16
121
|
end
|
122
|
+
|
data/qrpm.gemspec
CHANGED
@@ -11,8 +11,6 @@ Gem::Specification.new do |spec|
|
|
11
11
|
spec.summary = "Gem qrpm"
|
12
12
|
spec.description = "Gem qrpm"
|
13
13
|
spec.homepage = "http://www.nowhere.com/"
|
14
|
-
spec.required_ruby_version = ">= 2.4.0"
|
15
|
-
|
16
14
|
|
17
15
|
spec.metadata["homepage_uri"] = spec.homepage
|
18
16
|
|
@@ -27,8 +25,10 @@ Gem::Specification.new do |spec|
|
|
27
25
|
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
28
26
|
spec.require_paths = ["lib"]
|
29
27
|
|
30
|
-
spec.add_dependency "shellopts", "~> 2.
|
28
|
+
spec.add_dependency "shellopts", "~> 2.1.1"
|
31
29
|
spec.add_dependency "indented_io"
|
30
|
+
spec.add_dependency "constrain"
|
31
|
+
spec.add_dependency "forward_to"
|
32
32
|
|
33
33
|
# Uncomment to register a new dependency of your gem
|
34
34
|
# spec.add_dependency "example-gem", "~> 1.0"
|
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.1
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Claus Rasmussen
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-07-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: shellopts
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.
|
19
|
+
version: 2.1.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.
|
26
|
+
version: 2.1.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: indented_io
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,6 +38,34 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: constrain
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: forward_to
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
41
69
|
description: Gem qrpm
|
42
70
|
email:
|
43
71
|
- claus.l.rasmussen@gmail.com
|
@@ -49,27 +77,39 @@ files:
|
|
49
77
|
- ".rspec"
|
50
78
|
- ".ruby-version"
|
51
79
|
- Gemfile
|
80
|
+
- NOTES
|
52
81
|
- README.md
|
53
82
|
- Rakefile
|
83
|
+
- TODO
|
54
84
|
- bin/console
|
55
85
|
- bin/setup
|
56
86
|
- clean
|
57
87
|
- cmd
|
88
|
+
- doc/pg.yml
|
89
|
+
- doc/qrpm2.rb
|
90
|
+
- doc/qrpm2.yml
|
58
91
|
- example.yml
|
59
92
|
- example/bin/a_file
|
60
93
|
- example/bin/another_file
|
94
|
+
- example/configure
|
95
|
+
- example/make
|
96
|
+
- example/my_package_name-1.2.3-4.x86_64.rpm
|
97
|
+
- example/my_package_name.spec
|
61
98
|
- example/qrpm.yml
|
62
99
|
- example/share/some_data
|
63
100
|
- example/share/some_other_data
|
64
101
|
- exe/qrpm
|
65
102
|
- lib/qrpm.rb
|
103
|
+
- lib/qrpm/compiler.rb
|
104
|
+
- lib/qrpm/fragment.rb
|
105
|
+
- lib/qrpm/lexer.rb
|
66
106
|
- lib/qrpm/node.rb
|
67
|
-
- lib/qrpm/parser.rb
|
68
107
|
- lib/qrpm/qrpm.rb
|
69
108
|
- lib/qrpm/render.rb
|
70
109
|
- lib/qrpm/rpm.rb
|
71
110
|
- lib/qrpm/template.erb
|
72
111
|
- lib/qrpm/template.yml
|
112
|
+
- lib/qrpm/utils.rb
|
73
113
|
- lib/qrpm/version.rb
|
74
114
|
- packager.sh
|
75
115
|
- packager.yml
|
@@ -79,7 +119,7 @@ homepage: http://www.nowhere.com/
|
|
79
119
|
licenses: []
|
80
120
|
metadata:
|
81
121
|
homepage_uri: http://www.nowhere.com/
|
82
|
-
post_install_message:
|
122
|
+
post_install_message:
|
83
123
|
rdoc_options: []
|
84
124
|
require_paths:
|
85
125
|
- lib
|
@@ -87,15 +127,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
87
127
|
requirements:
|
88
128
|
- - ">="
|
89
129
|
- !ruby/object:Gem::Version
|
90
|
-
version:
|
130
|
+
version: '0'
|
91
131
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
132
|
requirements:
|
93
133
|
- - ">="
|
94
134
|
- !ruby/object:Gem::Version
|
95
135
|
version: '0'
|
96
136
|
requirements: []
|
97
|
-
rubygems_version: 3.
|
98
|
-
signing_key:
|
137
|
+
rubygems_version: 3.3.18
|
138
|
+
signing_key:
|
99
139
|
specification_version: 4
|
100
140
|
summary: Gem qrpm
|
101
141
|
test_files: []
|