qrpm 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/qrpm +4 -3
- data/lib/qrpm/parser.rb +12 -2
- data/lib/qrpm/rpm.rb +3 -3
- data/lib/qrpm/template.erb +2 -0
- data/lib/qrpm/template.yml +1 -0
- data/lib/qrpm/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 84aec760efd4d34c3de41e77edeeb5cc925ee195bea84243dad283c2ec50005e
|
4
|
+
data.tar.gz: 99a8f384f3913952ce99ad80f0be8718d3cb4a91d882a5eb82675a5cc63b41b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7416eba4e7747d1fb5603d62a985671e2b8ba40c90d95636c737dbd1c998a3431d2ffeba919e5cff1575efe8dd88b3f43173bddf48e22a3de7cae2e5c30ed868
|
7
|
+
data.tar.gz: 17108a42af16ffe022c72dda457d4d868e16e98a807e1e61296df1a9f2da02cf7a0ef3322334d04b30b85e782723587bad7b6bb15b537fc4d339fba1c14bc6ae
|
data/exe/qrpm
CHANGED
@@ -12,6 +12,7 @@ require 'indented_io'
|
|
12
12
|
# TODO
|
13
13
|
# o Fix BuildRoot (contains absolute path)
|
14
14
|
# o Enable escape of $
|
15
|
+
# o Separate standard variable from user-variables in dump
|
15
16
|
|
16
17
|
begin
|
17
18
|
SPEC = %(
|
@@ -76,9 +77,6 @@ begin
|
|
76
77
|
file ||= Qrpm::QRPM_CONFIG_FILE
|
77
78
|
::File.exist?(file) or raise "Can't find '#{file}'"
|
78
79
|
|
79
|
-
# Check if repository is clean
|
80
|
-
opts.force? || `git status --porcelain 2>/dev/null` == "" or raise "Repository is dirty"
|
81
|
-
|
82
80
|
# Load the qrpm configuration file
|
83
81
|
yaml = YAML.load(IO.read(file).sub(/^__END__\s*$/m, ""))
|
84
82
|
|
@@ -90,6 +88,9 @@ begin
|
|
90
88
|
exit
|
91
89
|
end
|
92
90
|
|
91
|
+
# Check if repository is clean
|
92
|
+
opts.force? || `git status --porcelain 2>/dev/null` == "" or raise "Repository is dirty"
|
93
|
+
|
93
94
|
target = (opts.spec? ? :spec : (opts.source? ? :srpm : :rpm))
|
94
95
|
rpm.build(target: target, file: opts.spec)
|
95
96
|
|
data/lib/qrpm/parser.rb
CHANGED
@@ -32,9 +32,15 @@ module Qrpm
|
|
32
32
|
fields.key?(f) or raise "Missing mandatory variable: #{f}"
|
33
33
|
}
|
34
34
|
|
35
|
+
# Get full name of user
|
36
|
+
fullname = Etc.getpwnam(ENV['USER'])&.gecos
|
37
|
+
if fullname.nil? || fullname == ""
|
38
|
+
fullname = ENV['USER']
|
39
|
+
end
|
40
|
+
|
35
41
|
# Defaults for description and packager fields
|
36
42
|
fields["description"] ||= fields["summary"]
|
37
|
-
fields["packager"] ||=
|
43
|
+
fields["packager"] ||= fullname
|
38
44
|
fields["release"] ||= "0"
|
39
45
|
fields["license"] ||= "GPL"
|
40
46
|
|
@@ -42,6 +48,10 @@ module Qrpm
|
|
42
48
|
# of the variables
|
43
49
|
expand_fields
|
44
50
|
|
51
|
+
# Expand variables in directory entries. The algorithm is simpler than in
|
52
|
+
# #expand_fields because no further variable defitinitions can happend
|
53
|
+
expand_dirs
|
54
|
+
|
45
55
|
# Replace symbolic directory names
|
46
56
|
@dirs = dirs.map { |dir, files|
|
47
57
|
if DIRS.key?(dir)
|
@@ -122,7 +132,7 @@ module Qrpm
|
|
122
132
|
|
123
133
|
# Expand variables in the given string
|
124
134
|
#
|
125
|
-
# The method takes
|
135
|
+
# The method takes care to substite left-to-rigth to avoid a variable expansion
|
126
136
|
# to infer with the name of an immediately preceding variable. Eg. $a$b; if $b
|
127
137
|
# is resolved to 'c' then a search would otherwise be made for a variable named
|
128
138
|
# '$ac'
|
data/lib/qrpm/rpm.rb
CHANGED
@@ -11,8 +11,9 @@ module Qrpm
|
|
11
11
|
# license License (defaults to GPL)
|
12
12
|
# summary Short one-line description of package
|
13
13
|
# description Description
|
14
|
-
# packager Name of the packager (defaults to the
|
15
|
-
# environment variable
|
14
|
+
# packager Name of the packager (defaults to the name of the current
|
15
|
+
# user or the value of the $USER environment variable if not
|
16
|
+
# found)
|
16
17
|
# require Array of required packages
|
17
18
|
# make Controls the build process:
|
18
19
|
# null Search the top-level directory for configure or
|
@@ -52,7 +53,6 @@ module Qrpm
|
|
52
53
|
|
53
54
|
def build(target: :rpm, file: nil)
|
54
55
|
Dir.mktmpdir { |rootdir|
|
55
|
-
rootdir = "/home/clr/prj/qrpm/tmp"
|
56
56
|
FileUtils.rm_rf(rootdir)
|
57
57
|
FileUtils.mkdir_p(rootdir)
|
58
58
|
|
data/lib/qrpm/template.erb
CHANGED
@@ -41,6 +41,7 @@ make
|
|
41
41
|
<% end -%>
|
42
42
|
|
43
43
|
%install
|
44
|
+
<% if !nodes.empty? -%>
|
44
45
|
mkdir -p <%= nodes.map { |f| "%{buildroot}#{f.directory}" }.uniq.join(" ") %>
|
45
46
|
<% for file in files -%>
|
46
47
|
cp <%= file.file %> %{buildroot}<%= file.path %>
|
@@ -48,6 +49,7 @@ cp <%= file.file %> %{buildroot}<%= file.path %>
|
|
48
49
|
<% for link in links -%>
|
49
50
|
touch %{buildroot}<%= link.path %>
|
50
51
|
<% end -%>
|
52
|
+
<% end -%>
|
51
53
|
|
52
54
|
%files
|
53
55
|
<% for file in files -%>
|
data/lib/qrpm/template.yml
CHANGED
data/lib/qrpm/version.rb
CHANGED