simp-rake-helpers 3.5.1 → 3.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 +4 -4
- data/.travis.yml +21 -6
- data/CHANGELOG.md +6 -0
- data/Gemfile +1 -1
- data/lib/simp/rake/build/code.rb +2 -2
- data/lib/simp/rake/helpers/assets/rpm_spec/simp6.spec +1 -0
- data/lib/simp/rake/helpers/version.rb +1 -1
- data/lib/simp/rake/pupmod/helpers.rb +66 -0
- data/spec/lib/simp/files/build/testpackage.spec +1 -0
- metadata +3 -3
- data/lib/simp/rake/helpers/assets/rpm_spec/simp6.spec +0 -356
- data/spec/lib/simp/files/build/testpackage.spec +0 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f87a58cc38f4d236c1c66e94f9145377b430546
|
4
|
+
data.tar.gz: 1f2c7a736e3974a0ce72a65d778b8cd28c75f318
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2649f7dc066a02e254e531bd3901b568f0e846892418276a30a5ccd190c3cadbcdb468372038aaf4df245512f6b4b2f4d5931729cb1505b0083db63eed49fea2
|
7
|
+
data.tar.gz: eea647a6d2f28d9ace0458b12119888a179cacb248807842486339cd04bd83bd9ddef879a5ffd3bfefec9187d371fd6b8d3ea2694902b0fd941e8465cd05ba90
|
data/.travis.yml
CHANGED
@@ -1,17 +1,32 @@
|
|
1
|
-
---
|
2
1
|
language: ruby
|
3
2
|
sudo: required
|
4
3
|
before_install:
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
bundler_args: --without development
|
4
|
+
- sudo apt-get update -qq
|
5
|
+
- sudo apt-get install -y rpm
|
6
|
+
- rm Gemfile.lock || true
|
7
|
+
bundler_args: "--without development --path .vendor"
|
9
8
|
notifications:
|
10
9
|
email: false
|
11
10
|
rvm:
|
12
11
|
- 2.1.9
|
13
12
|
- 2.3.3
|
14
13
|
script:
|
15
|
-
-
|
14
|
+
- 'bundle exec rake spec'
|
16
15
|
matrix:
|
17
16
|
fast_finish: true
|
17
|
+
allow_failures:
|
18
|
+
- rvm: 2.3.3
|
19
|
+
before_deploy:
|
20
|
+
- 'bundle exec rake clobber'
|
21
|
+
- "export GEM_VERSION=`ruby -r ./lib/simp/rake/helpers/version.rb -e 'puts Simp::Rake::Helpers::VERSION'`"
|
22
|
+
- '[[ $TRAVIS_TAG =~ ^${GEM_VERSION}$ ]]'
|
23
|
+
deploy:
|
24
|
+
provider: rubygems
|
25
|
+
gemspec: simp-rake-helpers.gemspec
|
26
|
+
gem: simp-rake-helpers
|
27
|
+
on:
|
28
|
+
tags: true
|
29
|
+
rvm: 2.1.9
|
30
|
+
condition: '($SKIP_PUBLISH != true)'
|
31
|
+
api_key:
|
32
|
+
secure: aoPmOZ3WgjNJ56UXmamKxaRv37iUaxKekAeS8n2fPk78X/nU2qGjdDHFH+SBrfl33PyzsGnS3WAANMKaIkAgssvKoaII/sAC+Sl6q1eyVUprZqloXrG+cHlnHY4GnziWEH3JrkHDChW0xoJq7hhpj7qTRKrEIp6nA25MjozjveoL+HH4kKy/ACJhiEdsYTFaDLYYFY50gGUL9KjIkwN6g9d+dIzG9JqcYoDbneQlO6/23yr4GiAHQ8HM1j5tUoBqJad+CWjWhSY7pbfYBy2ziwVhFy1qoOS4/bhlasRCsLTtz0AjjR0YWOhJap1vJqYhrSxtvhmVuzScmDkueAem/PfWS3XCQvbmjdmFMzPOxo0aRRJMlaeVWRsZ/aVFC7ngpRzokq1duZEKI47xZC27vJSOp3RZMmYl/7GsykoYkqHHsTvzSALEQiVtQq8sIOtN0JOTFI8H4LSMirXuqGq+SgCJiAQ3mQzSgh50TXiZaA2UPPcQaw4AzY36BRKs1cgw3cEWuL38O2cWUTAzEE4SUh499wrU5x+N0PsYL0AvMFONsRaq5epOYrlIL9UPSL/qZRLmzpcEWZRfOX4Ni5N6Aa9ZR8juenR6UmE79S2dupBxQeinkdfXuWznUZH7BcnUDoz8rErABpJGHNVY60dUO/s055WCr7Y95Gi+H75X9/I=
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
#
|
3
3
|
# SIMP_GEM_SERVERS | a space/comma delimited list of rubygem servers
|
4
4
|
# PUPPET_VERSION | specifies the version of the puppet gem to load
|
5
|
-
puppetversion = ENV.key?('PUPPET_VERSION') ? "#{ENV['PUPPET_VERSION']}" :
|
5
|
+
puppetversion = ENV.key?('PUPPET_VERSION') ? "#{ENV['PUPPET_VERSION']}" : '~> 4'
|
6
6
|
gem_sources = ENV.key?('SIMP_GEM_SERVERS') ? ENV['SIMP_GEM_SERVERS'].split(/[, ]+/) : ['https://rubygems.org']
|
7
7
|
|
8
8
|
gem_sources.each { |gem_source| source gem_source }
|
data/lib/simp/rake/build/code.rb
CHANGED
@@ -86,7 +86,7 @@ module Simp::Rake::Build
|
|
86
86
|
loc["spec"] = 0
|
87
87
|
loc["other"] = 0
|
88
88
|
|
89
|
-
File.open("#{
|
89
|
+
File.open("#{@base_dir}/Rakefile","r").each do |line|
|
90
90
|
if encode_line(line) !~ /^\s*$/
|
91
91
|
loc["rake"] = loc["rake"] + 1
|
92
92
|
end
|
@@ -94,7 +94,7 @@ module Simp::Rake::Build
|
|
94
94
|
|
95
95
|
other_ext = Array.new
|
96
96
|
|
97
|
-
Find.find(
|
97
|
+
Find.find(@src_dir) do |path|
|
98
98
|
if (
|
99
99
|
( File.basename(path)[0] == ?. ) or
|
100
100
|
( path =~ /src\/rsync/ ) or
|
@@ -0,0 +1 @@
|
|
1
|
+
lib/simp/rake/helpers/assets/rpm_spec/simpdefault.spec
|
@@ -80,6 +80,72 @@ class Simp::Rake::Pupmod::Helpers < ::Rake::TaskLib
|
|
80
80
|
sh "metadata-json-lint metadata.json"
|
81
81
|
end
|
82
82
|
|
83
|
+
desc <<-EOM
|
84
|
+
Generate an appropriate annotated tag entry from a CHANGELOG.
|
85
|
+
|
86
|
+
ARGS:
|
87
|
+
* :quiet => Set to 'true' if you want to suppress warning messages
|
88
|
+
|
89
|
+
NOTES:
|
90
|
+
* The entries are extracted from a match with the version from the
|
91
|
+
module's metadata.json
|
92
|
+
* If no match is found, the task will fail
|
93
|
+
* Changelog entries must follow the format:
|
94
|
+
* Wed Jul 05 2017 UserName <username@simp.com> - 1.2.3-4
|
95
|
+
- The entry must start with *. Any line beginning with * will be
|
96
|
+
interpreted as an entry.
|
97
|
+
- The dates must be RPM compatible, in chronological order
|
98
|
+
- The user email must be contained in < >
|
99
|
+
- The entry must be terminated by the release
|
100
|
+
* Any entry that does not follow the prescribed format will not be
|
101
|
+
annotated properly
|
102
|
+
EOM
|
103
|
+
# TODO: Hook in a query of the auto-generated specfile:
|
104
|
+
# `rpm -q --specfile dist/tmp/*.spec --changelog`
|
105
|
+
# That will give Travis a way of warning us if the changelog
|
106
|
+
# will prevent the rpm from building.
|
107
|
+
task :changelog_annotation, [:quiet] do |t,args|
|
108
|
+
require 'json'
|
109
|
+
|
110
|
+
quiet = true if args[:quiet].to_s == 'true'
|
111
|
+
|
112
|
+
module_version = JSON.parse(File.read('metadata.json'))['version']
|
113
|
+
|
114
|
+
changelog = Hash.new
|
115
|
+
delim = nil
|
116
|
+
ignore_line = false
|
117
|
+
|
118
|
+
File.read('CHANGELOG').each_line do |line|
|
119
|
+
if line =~ /^\*/
|
120
|
+
if /^\*\s+((?:Mon|Tue|Wed|Thu|Fri|Sat|Sun) (?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) \d{2} \d{4})\s+(.+<.+>)(?:\s+|\s*-\s*)?(\d+\.\d+\.\d+)/.match(line).nil?
|
121
|
+
warn "WARNING: invalid changelog entry: #{line}" unless quiet
|
122
|
+
# Don't add anything to the annotation until we reach the next
|
123
|
+
# valid entry
|
124
|
+
ignore_line = true
|
125
|
+
else
|
126
|
+
ignore_line = false
|
127
|
+
delim = Hash.new
|
128
|
+
delim[:date] = $1
|
129
|
+
delim[:user] = $2
|
130
|
+
delim[:release] = $3
|
131
|
+
|
132
|
+
changelog[delim[:release]] ||= Array.new
|
133
|
+
changelog[delim[:release]] << line
|
134
|
+
end
|
135
|
+
|
136
|
+
next
|
137
|
+
end
|
138
|
+
|
139
|
+
if delim && delim[:release]
|
140
|
+
changelog[delim[:release]] << ' ' + line unless ignore_line
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
fail "Did not find any changelog entries for version #{module_version}" if changelog[module_version].nil?
|
145
|
+
puts "\nRelease of #{module_version}\n\n"
|
146
|
+
puts changelog[module_version]
|
147
|
+
end
|
148
|
+
|
83
149
|
|
84
150
|
desc "Run syntax, lint, and spec tests."
|
85
151
|
task :test => [
|
@@ -0,0 +1 @@
|
|
1
|
+
spec/lib/simp/files/build/../testpackage.spec
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simp-rake-helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Tessmer
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-07-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -504,7 +504,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
504
504
|
version: '0'
|
505
505
|
requirements: []
|
506
506
|
rubyforge_project:
|
507
|
-
rubygems_version: 2.
|
507
|
+
rubygems_version: 2.6.11
|
508
508
|
signing_key:
|
509
509
|
specification_version: 4
|
510
510
|
summary: SIMP rake helpers
|
@@ -1,356 +0,0 @@
|
|
1
|
-
%{lua:
|
2
|
-
|
3
|
-
--
|
4
|
-
-- When you build you must to pass this along so that we know how
|
5
|
-
-- to get the preliminary information.
|
6
|
-
-- This directory should hold the following items:
|
7
|
-
-- * 'build/rpm_metadata/requires' <- optional list of 'Requires', 'Provides',
|
8
|
-
-- and 'Obsoletes' to supplement those auto-generated in this spec file
|
9
|
-
-- * 'build/rpm_metadata/release' <- optional RPM release number to use in
|
10
|
-
-- lieu of number hard-coded in this spec file
|
11
|
-
-- * 'CHANGELOG' <- optional RPM formatted Changelog to use in lieu of minimal,
|
12
|
-
-- changelog entry auto-generated in this spec file
|
13
|
-
-- * 'metadata.json' <- required file that must contain the following metadata:
|
14
|
-
-- - 'name' - package name
|
15
|
-
-- - 'version' - package version
|
16
|
-
-- - 'license' - package license
|
17
|
-
-- - 'summary' - package summary
|
18
|
-
-- - 'source' - package source
|
19
|
-
--
|
20
|
-
-- Example:
|
21
|
-
-- rpmbuild -D 'pup_module_info_dir /home/user/project/puppet_module' -ba SPECS/specfile.spec
|
22
|
-
--
|
23
|
-
-- If this is not found, we will look in %{_sourcedir} for the files and fall
|
24
|
-
-- back to the current directory
|
25
|
-
--
|
26
|
-
|
27
|
-
src_dir = rpm.expand('%{pup_module_info_dir}')
|
28
|
-
|
29
|
-
if string.match(src_dir, '^%%') or (posix.stat(src_dir, 'type') ~= 'directory') then
|
30
|
-
src_dir = rpm.expand('%{_sourcedir}')
|
31
|
-
|
32
|
-
if (posix.stat((src_dir .. "/metadata.json"), 'type') ~= 'regular') then
|
33
|
-
src_dir = './'
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
-- These UNKNOWN entries should break the build if something bad happens
|
38
|
-
|
39
|
-
package_name = "UNKNOWN"
|
40
|
-
package_version = "UNKNOWN"
|
41
|
-
module_license = "UNKNOWN"
|
42
|
-
|
43
|
-
--
|
44
|
-
-- Default to 2016
|
45
|
-
-- This was done due to the change in naming scheme across all of the modules.
|
46
|
-
-- The '.1' bump is there for the SIMP 6 path changes
|
47
|
-
--
|
48
|
-
|
49
|
-
package_release = '2016.1'
|
50
|
-
|
51
|
-
}
|
52
|
-
|
53
|
-
%{lua:
|
54
|
-
-- Pull the Relevant Metadata out of the Puppet module metadata.json.
|
55
|
-
|
56
|
-
metadata = ''
|
57
|
-
metadata_file = io.open(src_dir .. "/metadata.json","r")
|
58
|
-
if metadata_file then
|
59
|
-
metadata = metadata_file:read("*all")
|
60
|
-
|
61
|
-
-- Ignore the first curly brace
|
62
|
-
metadata = metadata:gsub("{}?", '|', 1)
|
63
|
-
|
64
|
-
-- Ignore all keys that are below the first level
|
65
|
-
metadata = metadata:gsub("{.-}", '')
|
66
|
-
metadata = metadata:gsub("%[.-%]", '')
|
67
|
-
else
|
68
|
-
error("Could not open 'metadata.json'", 0)
|
69
|
-
end
|
70
|
-
|
71
|
-
-- This starts as an empty string so that we can build it later
|
72
|
-
module_requires = ''
|
73
|
-
|
74
|
-
}
|
75
|
-
|
76
|
-
%{lua:
|
77
|
-
|
78
|
-
-- Get the Module Name and put it in the correct format
|
79
|
-
|
80
|
-
local name_match = string.match(metadata, '"name":%s+"(.-)"%s*,')
|
81
|
-
|
82
|
-
module_author = ''
|
83
|
-
module_name = ''
|
84
|
-
|
85
|
-
if name_match then
|
86
|
-
package_name = ('pupmod-' .. name_match)
|
87
|
-
|
88
|
-
local i = 0
|
89
|
-
for str in string.gmatch(name_match,'[^-]+') do
|
90
|
-
if i == 0 then
|
91
|
-
module_author = str
|
92
|
-
else
|
93
|
-
if module_name == '' then
|
94
|
-
module_name = str
|
95
|
-
else
|
96
|
-
module_name = (module_name .. '-' .. str)
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
i = i+1
|
101
|
-
end
|
102
|
-
else
|
103
|
-
error("Could not find valid package name in 'metadata.json'", 0)
|
104
|
-
end
|
105
|
-
|
106
|
-
}
|
107
|
-
|
108
|
-
%{lua:
|
109
|
-
|
110
|
-
-- Get the Module Version
|
111
|
-
|
112
|
-
local version_match = string.match(metadata, '"version":%s+"(.-)"%s*,')
|
113
|
-
|
114
|
-
if version_match then
|
115
|
-
package_version = version_match
|
116
|
-
else
|
117
|
-
error("Could not find valid package version in 'metadata.json'", 0)
|
118
|
-
end
|
119
|
-
|
120
|
-
}
|
121
|
-
|
122
|
-
%{lua:
|
123
|
-
|
124
|
-
-- Get the Module License
|
125
|
-
|
126
|
-
local license_match = string.match(metadata, '"license":%s+"(.-)"%s*,')
|
127
|
-
|
128
|
-
if license_match then
|
129
|
-
module_license = license_match
|
130
|
-
else
|
131
|
-
error("Could not find valid package license in 'metadata.json'", 0)
|
132
|
-
end
|
133
|
-
|
134
|
-
}
|
135
|
-
|
136
|
-
%{lua:
|
137
|
-
|
138
|
-
-- Get the Module Summary
|
139
|
-
|
140
|
-
local summary_match = string.match(metadata, '"summary":%s+"(.-)"%s*,')
|
141
|
-
|
142
|
-
if summary_match then
|
143
|
-
module_summary = summary_match
|
144
|
-
else
|
145
|
-
error("Could not find valid package summary in 'metadata.json'", 0)
|
146
|
-
end
|
147
|
-
|
148
|
-
}
|
149
|
-
|
150
|
-
%{lua:
|
151
|
-
|
152
|
-
-- Get the Module Source line for the URL string
|
153
|
-
|
154
|
-
local source_match = string.match(metadata, '"source":%s+"(.-)"%s*,')
|
155
|
-
|
156
|
-
if source_match then
|
157
|
-
module_source = source_match
|
158
|
-
else
|
159
|
-
error("Could not find valid package source in 'metadata.json'", 0)
|
160
|
-
end
|
161
|
-
|
162
|
-
}
|
163
|
-
|
164
|
-
%{lua:
|
165
|
-
|
166
|
-
-- Snag the RPM-specific items out of the 'build/rpm_metadata' directory
|
167
|
-
|
168
|
-
-- First, the Release Number
|
169
|
-
|
170
|
-
rel_file = io.open(src_dir .. "/build/rpm_metadata/release", "r")
|
171
|
-
|
172
|
-
if not rel_file then
|
173
|
-
-- Need this for the SRPM case
|
174
|
-
rel_file = io.open(src_dir .. "/release", "r")
|
175
|
-
end
|
176
|
-
|
177
|
-
if rel_file then
|
178
|
-
for line in rel_file:lines() do
|
179
|
-
is_comment = string.match(line, "^%s*#")
|
180
|
-
is_blank = string.match(line, "^%s*$")
|
181
|
-
|
182
|
-
if not (is_comment or is_blank) then
|
183
|
-
package_release = line
|
184
|
-
break
|
185
|
-
end
|
186
|
-
end
|
187
|
-
end
|
188
|
-
|
189
|
-
}
|
190
|
-
|
191
|
-
%{lua:
|
192
|
-
|
193
|
-
-- Next, the Requirements
|
194
|
-
req_file = io.open(src_dir .. "/build/rpm_metadata/requires", "r")
|
195
|
-
|
196
|
-
if not req_file then
|
197
|
-
-- Need this for the SRPM case
|
198
|
-
req_file = io.open(src_dir .. "/requires", "r")
|
199
|
-
end
|
200
|
-
|
201
|
-
if req_file then
|
202
|
-
for line in req_file:lines() do
|
203
|
-
valid_line = (string.match(line, "^Requires: ") or string.match(line, "^Obsoletes: ") or string.match(line, "^Provides: "))
|
204
|
-
|
205
|
-
if valid_line then
|
206
|
-
module_requires = (module_requires .. "\n" .. line)
|
207
|
-
end
|
208
|
-
end
|
209
|
-
end
|
210
|
-
}
|
211
|
-
|
212
|
-
%define module_name %{lua: print(module_name)}
|
213
|
-
%define package_name %{lua: print(package_name)}
|
214
|
-
|
215
|
-
Summary: %{module_name} Puppet Module
|
216
|
-
Name: %{package_name}
|
217
|
-
|
218
|
-
Version: %{lua: print(package_version)}
|
219
|
-
Release: %{lua: print(package_release)}
|
220
|
-
License: %{lua: print(module_license)}
|
221
|
-
Group: Applications/System
|
222
|
-
Source0: %{package_name}-%{version}-%{release}.tar.gz
|
223
|
-
Source1: %{lua: print("metadata.json")}
|
224
|
-
%{lua:
|
225
|
-
-- Include our sources as appropriate
|
226
|
-
changelog = io.open(src_dir .. "/CHANGELOG","r")
|
227
|
-
if changelog then
|
228
|
-
print("Source2: " .. "CHANGELOG\n")
|
229
|
-
end
|
230
|
-
|
231
|
-
if rel_file then
|
232
|
-
print("Source3: " .. "release\n")
|
233
|
-
end
|
234
|
-
if req_file then
|
235
|
-
print("Source4: " .. "requires\n")
|
236
|
-
end
|
237
|
-
}
|
238
|
-
URL: %{lua: print(module_source)}
|
239
|
-
BuildRoot: %{_tmppath}/%{package_name}-%{version}-%{release}-buildroot
|
240
|
-
BuildArch: noarch
|
241
|
-
|
242
|
-
Requires(pre,preun,post,postun): simp-adapter >= 0.0.1
|
243
|
-
|
244
|
-
%if ("%{package_name}" != "pupmod-simp-simplib") && ("%{package_name}" != "pupmod-puppetlabs-stdlib")
|
245
|
-
Requires: pupmod-simp-simplib >= 1.2.6
|
246
|
-
%endif
|
247
|
-
|
248
|
-
%if "%{package_name}" != "pupmod-puppetlabs-stdlib"
|
249
|
-
Requires: pupmod-puppetlabs-stdlib >= 4.9.0
|
250
|
-
Requires: pupmod-puppetlabs-stdlib < 6.0.0
|
251
|
-
%endif
|
252
|
-
|
253
|
-
%{lua: print(module_requires)}
|
254
|
-
|
255
|
-
Provides: pupmod-%{lua: print(module_name)} = %{lua: print(package_version .. "-" .. package_release)}
|
256
|
-
Obsoletes: pupmod-%{lua: print(module_name)} < %{lua: print(package_version .. "-" .. package_release)}
|
257
|
-
|
258
|
-
%{lua:
|
259
|
-
|
260
|
-
-- This is a workaround for the 'simp-rsync' real RPM conflict but is
|
261
|
-
-- required by some external modules.
|
262
|
-
-- This should be removed when SIMP 6 is stable
|
263
|
-
|
264
|
-
author_rpm_name = module_author .. "-" .. module_name
|
265
|
-
|
266
|
-
if author_rpm_name ~= 'simp-rsync' then
|
267
|
-
print("Provides: " .. author_rpm_name .. " = " .. package_version .. "-" .. package_release .. "\n")
|
268
|
-
print("Obsoletes: " .. author_rpm_name .. " < " .. package_version .. "-" .. package_release .. "\n")
|
269
|
-
end
|
270
|
-
}
|
271
|
-
|
272
|
-
Prefix: /usr/share/simp/modules
|
273
|
-
|
274
|
-
%description
|
275
|
-
%{lua: print(module_summary)}
|
276
|
-
|
277
|
-
%prep
|
278
|
-
%setup -q -n %{package_name}-%{version}
|
279
|
-
|
280
|
-
%build
|
281
|
-
|
282
|
-
%install
|
283
|
-
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}
|
284
|
-
|
285
|
-
mkdir -p %{buildroot}/%{prefix}
|
286
|
-
|
287
|
-
curdir=`pwd`
|
288
|
-
dirname=`basename $curdir`
|
289
|
-
cp -r ../$dirname %{buildroot}/%{prefix}/%{module_name}
|
290
|
-
rm -rf %{buildroot}/%{prefix}/%{module_name}/.git
|
291
|
-
rm -f %{buildroot}/%{prefix}/*.lock
|
292
|
-
rm -rf %{buildroot}/%{prefix}/spec/fixtures/modules
|
293
|
-
rm -rf %{buildroot}/%{prefix}/dist
|
294
|
-
rm -rf %{buildroot}/%{prefix}/junit
|
295
|
-
rm -rf %{buildroot}/%{prefix}/log
|
296
|
-
|
297
|
-
%clean
|
298
|
-
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}
|
299
|
-
|
300
|
-
mkdir -p %{buildroot}/%{prefix}
|
301
|
-
|
302
|
-
%files
|
303
|
-
%defattr(0640,root,root,0750)
|
304
|
-
%{prefix}/%{module_name}
|
305
|
-
|
306
|
-
# when $1 = 1, this is an install
|
307
|
-
# when $1 = 2, this is an upgrade
|
308
|
-
%pre
|
309
|
-
/usr/local/sbin/simp_rpm_helper --rpm_dir=%{prefix}/%{module_name} --rpm_section='pre' --rpm_status=$1
|
310
|
-
|
311
|
-
# when $1 = 1, this is an install
|
312
|
-
# when $1 = 2, this is an upgrade
|
313
|
-
%post
|
314
|
-
/usr/local/sbin/simp_rpm_helper --rpm_dir=%{prefix}/%{module_name} --rpm_section='post' --rpm_status=$1
|
315
|
-
|
316
|
-
# when $1 = 1, this is the uninstall of the previous version during an upgrade
|
317
|
-
# when $1 = 0, this is the uninstall of the only version during an erase
|
318
|
-
%preun
|
319
|
-
/usr/local/sbin/simp_rpm_helper --rpm_dir=%{prefix}/%{module_name} --rpm_section='preun' --rpm_status=$1
|
320
|
-
|
321
|
-
# when $1 = 1, this is the uninstall of the previous version during an upgrade
|
322
|
-
# when $1 = 0, this is the uninstall of the only version during an erase
|
323
|
-
%postun
|
324
|
-
/usr/local/sbin/simp_rpm_helper --rpm_dir=%{prefix}/%{module_name} --rpm_section='postun' --rpm_status=$1
|
325
|
-
|
326
|
-
%changelog
|
327
|
-
%{lua:
|
328
|
-
-- Finally, the CHANGELOG
|
329
|
-
|
330
|
-
-- A default CHANGELOG in case we cannot find a real one
|
331
|
-
|
332
|
-
default_changelog = [===[
|
333
|
-
* $date Auto Changelog <auto@no.body> - $version-$release
|
334
|
-
- Latest release of $name
|
335
|
-
]===]
|
336
|
-
|
337
|
-
default_lookup_table = {
|
338
|
-
date = os.date("%a %b %d %Y"),
|
339
|
-
version = package_version,
|
340
|
-
release = package_release,
|
341
|
-
name = package_name
|
342
|
-
}
|
343
|
-
|
344
|
-
changelog = io.open(src_dir .. "/CHANGELOG","r")
|
345
|
-
if changelog then
|
346
|
-
first_line = changelog:read()
|
347
|
-
if string.match(first_line, "^*%s+%a%a%a%s+%a%a%a%s+%d%d?%s+%d%d%d%d%s+.+") then
|
348
|
-
changelog:seek("set",0)
|
349
|
-
print(changelog:read("*all"))
|
350
|
-
else
|
351
|
-
print((default_changelog:gsub('$(%w+)', default_lookup_table)))
|
352
|
-
end
|
353
|
-
else
|
354
|
-
print((default_changelog:gsub('$(%w+)', default_lookup_table)))
|
355
|
-
end
|
356
|
-
}
|
@@ -1,32 +0,0 @@
|
|
1
|
-
Name: testpackage
|
2
|
-
Version: 1
|
3
|
-
Release: 0
|
4
|
-
Summary: dummy test package
|
5
|
-
BuildArch: noarch
|
6
|
-
|
7
|
-
License: Apache-2.0
|
8
|
-
URL: http://foo.bar
|
9
|
-
|
10
|
-
%description
|
11
|
-
A dummy package used to test Simp::RPM methods
|
12
|
-
|
13
|
-
%prep
|
14
|
-
exit 0
|
15
|
-
|
16
|
-
%build
|
17
|
-
exit 0
|
18
|
-
|
19
|
-
|
20
|
-
%install
|
21
|
-
exit 0
|
22
|
-
|
23
|
-
%clean
|
24
|
-
exit 0
|
25
|
-
|
26
|
-
%files
|
27
|
-
%doc
|
28
|
-
|
29
|
-
|
30
|
-
%changelog
|
31
|
-
* Wed Jun 10 2015 nobody
|
32
|
-
- some comment
|