pkg-wizard 0.1.27 → 0.1.28
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/pkg-wizard.rb +1 -1
- data/lib/pkg-wizard/commands/build_bot.rb +79 -18
- data/lib/pkg-wizard/commands/download_sources.rb +69 -0
- data/lib/pkg-wizard/commands/init_env.rb +1 -1
- data/lib/pkg-wizard/commands/remote_build.rb +9 -1
- data/lib/pkg-wizard/rpm.rb +157 -5
- data/lib/pkg-wizard/streaming_downloader.rb +9 -4
- data/resources/init-scripts/pkgwiz-buildbot +5 -9
- data/test/test_specfile.rb +79 -0
- metadata +32 -32
data/lib/pkg-wizard.rb
CHANGED
@@ -13,6 +13,7 @@ require 'term/ansicolor'
|
|
13
13
|
require 'pp'
|
14
14
|
require 'yaml'
|
15
15
|
require 'daemons'
|
16
|
+
require 'singleton'
|
16
17
|
|
17
18
|
module FakeColor
|
18
19
|
def red; "<span style='color: red'>#{self}</span>"; end
|
@@ -48,6 +49,15 @@ module PKGWizard
|
|
48
49
|
end
|
49
50
|
end
|
50
51
|
|
52
|
+
class BuildBotConfig
|
53
|
+
include Singleton
|
54
|
+
attr_accessor :mock_profile
|
55
|
+
|
56
|
+
def initialize
|
57
|
+
@mock_profile = "epel-5-x86_64"
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
51
61
|
class BuildBot < Command
|
52
62
|
|
53
63
|
registry << { :name => 'build-bot', :klass => self }
|
@@ -63,7 +73,8 @@ module PKGWizard
|
|
63
73
|
|
64
74
|
option :mock_profile,
|
65
75
|
:short => '-m PROF',
|
66
|
-
:long => '--mock-profile PROF'
|
76
|
+
:long => '--mock-profile PROF',
|
77
|
+
:description => 'Default Mock Profile'
|
67
78
|
|
68
79
|
option :port,
|
69
80
|
:short => '-p PORT',
|
@@ -99,12 +110,17 @@ module PKGWizard
|
|
99
110
|
|
100
111
|
post '/tag/:name' do
|
101
112
|
name = params[:name]
|
113
|
+
profile = params[:mock_profile]
|
114
|
+
meta = {
|
115
|
+
:name => name,
|
116
|
+
:mock_profile => profile
|
117
|
+
}
|
102
118
|
if name.nil? or name.strip.chomp.empty?
|
103
119
|
status 400
|
104
120
|
'Invalid tag'
|
105
121
|
else
|
106
122
|
File.open('tags/.tag', 'w') do |f|
|
107
|
-
f.puts
|
123
|
+
f.puts meta.to_yaml
|
108
124
|
end
|
109
125
|
"Tagging #{name}..."
|
110
126
|
end
|
@@ -134,6 +150,11 @@ module PKGWizard
|
|
134
150
|
|
135
151
|
post '/build/' do
|
136
152
|
pkg = params[:pkg]
|
153
|
+
build_profile = params[:mock_profile] || BuildBotConfig.instance.mock_profile
|
154
|
+
metadata = {
|
155
|
+
:mock_profile => build_profile
|
156
|
+
}
|
157
|
+
|
137
158
|
if pkg.nil?
|
138
159
|
Logger.instance.error '400: Invalid arguments. Needs pkg in post request'
|
139
160
|
status 400
|
@@ -142,6 +163,9 @@ module PKGWizard
|
|
142
163
|
incoming_file = "incoming/#{pkg[:filename]}"
|
143
164
|
puts "* incoming file".ljust(40) + "#{pkg[:filename]}"
|
144
165
|
FileUtils.cp pkg[:tempfile].path, incoming_file
|
166
|
+
File.open("incoming/#{pkg[:filename]}.metadata", 'w') do |f|
|
167
|
+
f.puts metadata.to_yaml
|
168
|
+
end
|
145
169
|
end
|
146
170
|
end
|
147
171
|
|
@@ -314,6 +338,7 @@ module PKGWizard
|
|
314
338
|
end
|
315
339
|
|
316
340
|
mock_profile = cli.config[:mock_profile]
|
341
|
+
BuildBotConfig.instance.mock_profile = mock_profile
|
317
342
|
if not mock_profile
|
318
343
|
$stderr.puts 'Invalid mock profile.'
|
319
344
|
$stderr.puts cli.opt_parser.help
|
@@ -367,20 +392,40 @@ module PKGWizard
|
|
367
392
|
tag_sched = Rufus::Scheduler.start_new
|
368
393
|
tag_sched.every '2s', :blocking => true do
|
369
394
|
if File.exist?('tags/.tag')
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
395
|
+
tag_meta = YAML.load_file 'tags/.tag' rescue nil
|
396
|
+
if tag_meta
|
397
|
+
tag_dir = "tags/#{tag_meta[:name]}"
|
398
|
+
tag_mock_profile = tag_meta[:mock_profile]
|
399
|
+
|
400
|
+
tag_pkgs = []
|
401
|
+
Dir["output/*/result/*.rpm"].sort.each do |rpm|
|
402
|
+
p = YAML.load_file(File.join(File.dirname(rpm), '/../meta.yml'))[:mock_profile]
|
403
|
+
if p == tag_mock_profile or tag_mock_profile.nil?
|
404
|
+
tag_pkgs << rpm
|
405
|
+
end
|
406
|
+
end
|
407
|
+
|
408
|
+
if not tag_pkgs.empty?
|
409
|
+
puts "* create tag #{tag_meta[:name]} repo START"
|
410
|
+
Dir.mkdir(tag_dir) if not File.exist?(tag_dir)
|
411
|
+
tag_pkgs.each do |rpm|
|
412
|
+
FileUtils.cp rpm, tag_dir
|
413
|
+
end
|
414
|
+
output = `createrepo -q -o #{tag_dir} --update -d #{tag_dir} 2>&1`
|
415
|
+
if $? != 0
|
416
|
+
puts "create tag #{tag_meta[:name]} operation failed: #{output}".red.bold
|
417
|
+
else
|
418
|
+
puts "* create tag #{tag_meta[:name]} DONE"
|
419
|
+
end
|
420
|
+
else
|
421
|
+
puts "* WARNING: trying to create a tag with no packages."
|
422
|
+
end
|
423
|
+
FileUtils.rm 'tags/.tag'
|
380
424
|
else
|
381
|
-
puts "*
|
425
|
+
puts "* ERROR: error creating tag, could not parse tag metadata."
|
382
426
|
end
|
383
|
-
|
427
|
+
else
|
428
|
+
|
384
429
|
end
|
385
430
|
end
|
386
431
|
|
@@ -429,6 +474,7 @@ module PKGWizard
|
|
429
474
|
scheduler = Rufus::Scheduler.start_new
|
430
475
|
scheduler.every '2s', :blocking => true do
|
431
476
|
meta[:start_time] = Time.now
|
477
|
+
meta[:mock_profile] = mock_profile
|
432
478
|
queue = Dir['incoming/*.src.rpm'].sort_by {|filename| File.mtime(filename) }
|
433
479
|
if not queue.empty?
|
434
480
|
# Clean workspace first
|
@@ -436,7 +482,22 @@ module PKGWizard
|
|
436
482
|
FileUtils.rm_rf j
|
437
483
|
end
|
438
484
|
job_dir = "workspace/job_#{Time.now.strftime '%Y%m%d_%H%M%S'}"
|
485
|
+
imeta_file = "#{queue.first}.metadata"
|
439
486
|
qfile = File.join(job_dir, File.basename(queue.first))
|
487
|
+
if File.exist?(imeta_file)
|
488
|
+
begin
|
489
|
+
imeta = YAML.load_file(imeta_file)
|
490
|
+
if imeta
|
491
|
+
m = YAML.load_file(imeta_file)
|
492
|
+
meta[:mock_profile] = m[:mock_profile] || BuildBotConfig.mock_profile
|
493
|
+
end
|
494
|
+
rescue Exception
|
495
|
+
puts "* ERROR: parsing #{queue.first} metadata"
|
496
|
+
end
|
497
|
+
FileUtils.rm imeta_file
|
498
|
+
else
|
499
|
+
puts "* WARNING: #{queue.first} does not have metadata!"
|
500
|
+
end
|
440
501
|
job_time = Time.now.strftime '%Y%m%d_%H%M%S'
|
441
502
|
result_dir = job_dir + '/result'
|
442
503
|
FileUtils.mkdir_p result_dir
|
@@ -446,18 +507,18 @@ module PKGWizard
|
|
446
507
|
f.puts meta.to_yaml
|
447
508
|
end
|
448
509
|
FileUtils.mv queue.first, qfile
|
449
|
-
puts "Building pkg [job_#{job_time}]".ljust(40).yellow.bold + "#{File.basename(qfile)}"
|
510
|
+
puts "Building pkg [job_#{job_time}][#{meta[:mock_profile]}] ".ljust(40).yellow.bold + "#{File.basename(qfile)}"
|
450
511
|
|
451
512
|
rdir = nil
|
452
513
|
begin
|
453
|
-
PKGWizard::Mock.srpm :srpm => qfile, :profile => mock_profile, :resultdir => result_dir
|
514
|
+
PKGWizard::Mock.srpm :srpm => qfile, :profile => meta[:mock_profile], :resultdir => result_dir
|
454
515
|
meta[:status] = 'ok'
|
455
516
|
meta[:end_time] = Time.now
|
456
517
|
meta[:build_time] = meta[:end_time] - meta[:start_time]
|
457
|
-
puts "Build OK [job_#{job_time}]
|
518
|
+
puts "Build OK [job_#{job_time}][#{meta[:mock_profile]}] ".ljust(40).green.bold + "#{File.basename(qfile)}"
|
458
519
|
rescue Exception => e
|
459
520
|
meta[:status] = 'error'
|
460
|
-
puts "Build FAILED [job_#{job_time}]".ljust(40).red.bold + "#{File.basename(qfile)}"
|
521
|
+
puts "Build FAILED [job_#{job_time}][#{meta[:mock_profile]}]".ljust(40).red.bold + "#{File.basename(qfile)}"
|
461
522
|
File.open(job_dir + '/buildbot.log', 'w') do |f|
|
462
523
|
f.puts "#{e.backtrace.join("\n")}"
|
463
524
|
f.puts "#{e.message}"
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require 'pkg-wizard/command'
|
2
|
+
require 'pkg-wizard/rpm'
|
3
|
+
require 'tmpdir'
|
4
|
+
require 'fileutils'
|
5
|
+
require 'pkg-wizard/streaming_downloader'
|
6
|
+
require 'uri'
|
7
|
+
|
8
|
+
module PKGWizard
|
9
|
+
class DownloadSources < Command
|
10
|
+
registry << { :name => 'download-sources', :klass => self }
|
11
|
+
|
12
|
+
option :help,
|
13
|
+
:short => "-h",
|
14
|
+
:long => "--help",
|
15
|
+
:description => "Show this message",
|
16
|
+
:on => :tail,
|
17
|
+
:boolean => true,
|
18
|
+
:show_options => true,
|
19
|
+
:exit => 0
|
20
|
+
|
21
|
+
option :define,
|
22
|
+
:short => '-d MACRO',
|
23
|
+
:long => '--define MACRO',
|
24
|
+
:description => 'Define macro that will be replaced in the sources'
|
25
|
+
|
26
|
+
option :spec,
|
27
|
+
:short => '-s SPEC',
|
28
|
+
:long => '--spec SPEC',
|
29
|
+
:description => 'Spec file where the sources are declared'
|
30
|
+
|
31
|
+
def self.perform
|
32
|
+
cmd = DownloadSources.new
|
33
|
+
cmd.banner = "\nUsage: pkgwiz download-sources (options)\n\n"
|
34
|
+
cmd.parse_options
|
35
|
+
|
36
|
+
spec = nil
|
37
|
+
if cmd.config[:spec]
|
38
|
+
spec = PKGWizard::SpecFile.parse cmd.config[:spec]
|
39
|
+
else
|
40
|
+
files = Dir["*.spec"]
|
41
|
+
if files.size > 1
|
42
|
+
$stderr.puts 'Multiple spec files found in current dir. Use --spec option.'
|
43
|
+
exit 1
|
44
|
+
elsif files.empty?
|
45
|
+
$stderr.puts 'No spec files found in current dir. Use --spec option.'
|
46
|
+
exit 1
|
47
|
+
else
|
48
|
+
spec = PKGWizard::SpecFile.parse files[0]
|
49
|
+
end
|
50
|
+
end
|
51
|
+
define = cmd.config[:define]
|
52
|
+
spec.download_source_files(define) do |s|
|
53
|
+
puts "Downloading #{s}..."
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def self.download_from_url(url, tmpdir = '.')
|
58
|
+
uri = URI.parse(url)
|
59
|
+
remote_pkg = uri.path.split('/').last
|
60
|
+
d = StreamingDownloader.new
|
61
|
+
f = "#{tmpdir}/#{remote_pkg}"
|
62
|
+
tmpfile = File.new(f, 'w')
|
63
|
+
d.download!(url, tmpfile)
|
64
|
+
tmpfile.close
|
65
|
+
f
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
end
|
@@ -30,7 +30,7 @@ module PKGWizard
|
|
30
30
|
end
|
31
31
|
if File.exist?('/etc/redhat-release')
|
32
32
|
puts '* Installing RHEL/Fedora requirements... '
|
33
|
-
rhel_ver = File.readlines('/etc/redhat-release').first.match(/release\s+(\d)
|
33
|
+
rhel_ver = File.readlines('/etc/redhat-release').first.match(/release\s+(\d+)/)[1] rescue nil
|
34
34
|
if not rhel_ver
|
35
35
|
$stderr.puts "Unsupported RHEL/Fedora distribution"
|
36
36
|
exit 1
|
@@ -47,6 +47,11 @@ module PKGWizard
|
|
47
47
|
:description => 'Directory for downloaded files to be put',
|
48
48
|
:default => '/tmp'
|
49
49
|
|
50
|
+
option :mock_profile,
|
51
|
+
:short => '-m ',
|
52
|
+
:long => '--mock-profile PROFILE',
|
53
|
+
:description => 'Mock profile to use for building'
|
54
|
+
|
50
55
|
def self.perform
|
51
56
|
cli = RemoteBuild.new
|
52
57
|
cli.banner = "\nUsage: pkgwiz remote-build (options)\n\n"
|
@@ -124,9 +129,12 @@ module PKGWizard
|
|
124
129
|
count = 0
|
125
130
|
$stdout.sync = true
|
126
131
|
line_reset = "\r\e[0K"
|
132
|
+
params = {}
|
133
|
+
params[:mock_profile] = cli.config[:mock_profile] if cli.config[:mock_profile]
|
134
|
+
params[:pkg] = fo
|
127
135
|
res = StreamingUploader.post(
|
128
136
|
bbot_url + '/build/',
|
129
|
-
|
137
|
+
params
|
130
138
|
) do |size|
|
131
139
|
count += size
|
132
140
|
per = (100*count)/fsize
|
data/lib/pkg-wizard/rpm.rb
CHANGED
@@ -1,27 +1,179 @@
|
|
1
1
|
require 'fileutils'
|
2
|
+
require 'pkg-wizard/streaming_downloader'
|
3
|
+
require 'uri'
|
2
4
|
|
3
5
|
module PKGWizard
|
4
6
|
class NoSpecFound < Exception; end
|
5
7
|
class RPMBuildError < Exception; end
|
6
8
|
|
7
9
|
class RPM
|
10
|
+
|
11
|
+
def initialize(pkg)
|
12
|
+
@pkg = pkg.strip.chomp
|
13
|
+
raise ArgumentError.new("Invalid package.") if pkg !~ /.*\.rpm$/
|
14
|
+
raise ArgumentError.new("Invalid package.") if not File.exist?(pkg)
|
15
|
+
end
|
16
|
+
|
17
|
+
def source_package_name
|
18
|
+
info = `rpm -qi -qp #{@pkg} 2>/dev/null`.lines
|
19
|
+
info.find do |s|
|
20
|
+
s =~ /^Source RPM\s*:(.*)$/
|
21
|
+
end
|
22
|
+
$1.strip.chomp
|
23
|
+
end
|
24
|
+
|
8
25
|
end
|
9
26
|
|
10
27
|
class SpecFile
|
11
|
-
attr_accessor :
|
28
|
+
attr_accessor :spec
|
12
29
|
|
13
30
|
def self.parse(file)
|
14
|
-
f =
|
31
|
+
f = ''
|
32
|
+
if File.exist?(file)
|
33
|
+
f = File.read(file)
|
34
|
+
else
|
35
|
+
f = file
|
36
|
+
end
|
15
37
|
spec = SpecFile.new
|
16
|
-
spec.
|
17
|
-
spec.version = f.match(/Version:(.*?)$/)[1].strip.chomp
|
18
|
-
spec.release = f.match(/Release:(.*?)$/)[1].strip.chomp.gsub(/%\{\?.*\}/, '')
|
38
|
+
spec.spec = f
|
19
39
|
spec
|
20
40
|
end
|
21
41
|
|
42
|
+
def files
|
43
|
+
buf = []
|
44
|
+
in_files = false
|
45
|
+
@spec.each_line do |l|
|
46
|
+
if l =~ /^\s*%files/
|
47
|
+
in_files = true
|
48
|
+
next
|
49
|
+
end
|
50
|
+
if l =~ /^\s*%(changelog|pre|pro|prep|preun|postun|post|install|clean|build|define)/ and in_files
|
51
|
+
break
|
52
|
+
end
|
53
|
+
if in_files
|
54
|
+
buf << l.strip.chomp if not l.strip.chomp.empty?
|
55
|
+
end
|
56
|
+
end
|
57
|
+
buf
|
58
|
+
end
|
59
|
+
|
60
|
+
def release
|
61
|
+
@spec.match(/Release:(.*?)$/i)[1].strip.chomp.gsub(/%\{\?.*\}/, '') rescue nil
|
62
|
+
end
|
63
|
+
|
64
|
+
def name
|
65
|
+
@spec.match(/Name:(.*?)$/i)[1].strip.chomp rescue nil
|
66
|
+
end
|
67
|
+
|
68
|
+
def version
|
69
|
+
@spec.match(/Version:(.*?)$/i)[1].strip.chomp rescue nil
|
70
|
+
end
|
71
|
+
|
72
|
+
def sources
|
73
|
+
s = []
|
74
|
+
@spec.each_line do |line|
|
75
|
+
if line =~ /^\s*Source\d*:(.*)$/i
|
76
|
+
s << $1.strip.chomp
|
77
|
+
end
|
78
|
+
end
|
79
|
+
s
|
80
|
+
end
|
81
|
+
|
82
|
+
def build_requires
|
83
|
+
build_requires = []
|
84
|
+
@spec.each_line do |l|
|
85
|
+
if l =~ /^\s*buildrequires:(.*)$/i
|
86
|
+
build_requires = $1.split
|
87
|
+
build_requires.reject! { |i| i !~ /^[a-zA-Z0-9]/ }
|
88
|
+
end
|
89
|
+
end
|
90
|
+
build_requires
|
91
|
+
end
|
92
|
+
|
93
|
+
def requires
|
94
|
+
requires = []
|
95
|
+
@spec.each_line do |l|
|
96
|
+
if l =~ /^\s*requires:(.*)$/i
|
97
|
+
requires = $1.split
|
98
|
+
requires.reject! { |i| i !~ /^[a-zA-Z0-9]/ }
|
99
|
+
end
|
100
|
+
end
|
101
|
+
requires
|
102
|
+
end
|
103
|
+
|
104
|
+
def changelog
|
105
|
+
buf = ""
|
106
|
+
in_changelog = false
|
107
|
+
@spec.each_line do |l|
|
108
|
+
if l =~ /%changelog/
|
109
|
+
in_changelog = true
|
110
|
+
next
|
111
|
+
end
|
112
|
+
if in_changelog
|
113
|
+
buf += l
|
114
|
+
end
|
115
|
+
end
|
116
|
+
return buf
|
117
|
+
end
|
118
|
+
|
119
|
+
def changelog_entries
|
120
|
+
entries = []
|
121
|
+
cursor = -1
|
122
|
+
changelog.each_line do |l|
|
123
|
+
if l =~ /^\*/
|
124
|
+
cursor += 1
|
125
|
+
entries[cursor] = l
|
126
|
+
else
|
127
|
+
entries[cursor] += l if not l.strip.chomp.empty?
|
128
|
+
end
|
129
|
+
end
|
130
|
+
entries
|
131
|
+
end
|
132
|
+
|
133
|
+
def download_source_files(defines = [], dest_dir = '.')
|
134
|
+
define = ''
|
135
|
+
if defines.is_a? Array and defines.size >= 1
|
136
|
+
define = defines[0]
|
137
|
+
elsif defines.is_a? String
|
138
|
+
define = defines
|
139
|
+
else
|
140
|
+
define = nil
|
141
|
+
end
|
142
|
+
if define
|
143
|
+
if define !~ /\w\s+\w/
|
144
|
+
raise ArgumentError.new "Invalid --define syntax. Use 'macro_name macro_value'"
|
145
|
+
else
|
146
|
+
new_sources = []
|
147
|
+
def_tokens = define.split
|
148
|
+
sources.each do |s|
|
149
|
+
new_sources << s.gsub(/%\{\??#{def_tokens[0]}\}/, def_tokens[1])
|
150
|
+
end
|
151
|
+
end
|
152
|
+
else
|
153
|
+
new_sources = sources
|
154
|
+
end
|
155
|
+
new_sources.each do |s|
|
156
|
+
next if s !~ /http:\/\//
|
157
|
+
yield s if block_given?
|
158
|
+
download_from_url s, dest_dir
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
22
162
|
def pkgname
|
23
163
|
"#{name}-#{version}-#{release}"
|
24
164
|
end
|
165
|
+
|
166
|
+
private
|
167
|
+
def download_from_url(url, tmpdir = '.')
|
168
|
+
uri = URI.parse(url)
|
169
|
+
remote_pkg = uri.path.split('/').last
|
170
|
+
d = StreamingDownloader.new
|
171
|
+
f = "#{tmpdir}/#{remote_pkg}"
|
172
|
+
tmpfile = File.new(f, 'w')
|
173
|
+
d.download!(url, tmpfile)
|
174
|
+
tmpfile.close
|
175
|
+
f
|
176
|
+
end
|
25
177
|
|
26
178
|
end
|
27
179
|
|
@@ -1,3 +1,7 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
require 'openssl'
|
3
|
+
require 'uri'
|
4
|
+
|
1
5
|
module PKGWizard
|
2
6
|
|
3
7
|
#
|
@@ -54,9 +58,10 @@ module PKGWizard
|
|
54
58
|
destination_file.write(segment)
|
55
59
|
end
|
56
60
|
end
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
+
end
|
62
|
+
puts
|
63
|
+
rescue SocketError
|
64
|
+
raise Errors::DownloaderHTTPSocketError.new
|
65
|
+
end
|
61
66
|
end
|
62
67
|
end
|
@@ -14,21 +14,17 @@
|
|
14
14
|
# Source networking configuration.
|
15
15
|
. /etc/sysconfig/network
|
16
16
|
|
17
|
-
|
18
|
-
|
17
|
+
MOCK_PROFILE='epel-5-x86_64'
|
18
|
+
|
19
|
+
if [ -f /etc/sysconfig/pkg-wizard ];then
|
20
|
+
. /etc/sysconfig/pkg-wizard
|
19
21
|
else
|
20
|
-
echo "
|
21
|
-
exit 1
|
22
|
+
echo "WARNING: /etc/sysconfig/pkg-wizard config missing"
|
22
23
|
fi
|
23
24
|
|
24
25
|
# Check that networking is up.
|
25
26
|
[ "$NETWORKING" = "no" ] && exit 0
|
26
27
|
|
27
|
-
if [ -z "$MOCK_PROFILE" ]; then
|
28
|
-
echo "Mock profile not defined in /etc/sysconfig/pkgwiz-buildbot. Aborting."
|
29
|
-
exit 1
|
30
|
-
fi
|
31
|
-
|
32
28
|
pkgwiz="/usr/bin/pkgwiz"
|
33
29
|
workingdir=/home/buildbot
|
34
30
|
user="buildbot"
|
@@ -0,0 +1,79 @@
|
|
1
|
+
require 'pkg-wizard'
|
2
|
+
require 'pkg-wizard/rpm'
|
3
|
+
require 'test/unit'
|
4
|
+
|
5
|
+
include PKGWizard
|
6
|
+
|
7
|
+
class SpecFileTest < Test::Unit::TestCase
|
8
|
+
|
9
|
+
|
10
|
+
def test_sources
|
11
|
+
assert SpecFile.parse('').sources.empty?
|
12
|
+
assert SpecFile.parse("""
|
13
|
+
Source: foobar
|
14
|
+
Source1: stuff
|
15
|
+
Source0: bar
|
16
|
+
""").sources.size == 3
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_name
|
20
|
+
assert SpecFile.parse('').name.nil?
|
21
|
+
assert SpecFile.parse('Name: package-foo').name == 'package-foo'
|
22
|
+
assert SpecFile.parse('name: package-foo').name == 'package-foo'
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_version
|
26
|
+
assert SpecFile.parse('').version.nil?
|
27
|
+
assert SpecFile.parse('Version: 1.1').version == '1.1'
|
28
|
+
assert SpecFile.parse('version: 1.1').version == '1.1'
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_release
|
32
|
+
assert SpecFile.parse('').release.nil?
|
33
|
+
assert SpecFile.parse('Release: 1').release == '1'
|
34
|
+
assert SpecFile.parse('release: 1').release == '1'
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_files
|
38
|
+
assert SpecFile.parse('').files.empty?
|
39
|
+
assert SpecFile.parse("""
|
40
|
+
Source: foobar
|
41
|
+
Source1: stuff
|
42
|
+
Source0: bar
|
43
|
+
Name: foo
|
44
|
+
Release: 1
|
45
|
+
Version: 1.1
|
46
|
+
%pre
|
47
|
+
foo
|
48
|
+
%install
|
49
|
+
%post
|
50
|
+
foo
|
51
|
+
%files
|
52
|
+
/foo/bar
|
53
|
+
%config /etc/foo
|
54
|
+
%defattr(-,root,root)
|
55
|
+
|
56
|
+
%changelog
|
57
|
+
""").files.size == 3
|
58
|
+
assert SpecFile.parse("""
|
59
|
+
Source: foobar
|
60
|
+
Source1: stuff
|
61
|
+
Source0: bar
|
62
|
+
Name: foo
|
63
|
+
Release: 1
|
64
|
+
Version: 1.1
|
65
|
+
%pre
|
66
|
+
foo
|
67
|
+
%install
|
68
|
+
%post
|
69
|
+
foo
|
70
|
+
%files
|
71
|
+
/foo/bar
|
72
|
+
%config /etc/foo
|
73
|
+
%defattr(-,root,root)
|
74
|
+
|
75
|
+
%changelog
|
76
|
+
""").files.first == '/foo/bar'
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pkg-wizard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 35
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 28
|
10
|
+
version: 0.1.28
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Sergio Rubio
|
@@ -15,12 +15,9 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
19
|
-
default_executable: pkgwiz
|
18
|
+
date: 2011-07-20 00:00:00 Z
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
22
|
-
type: :development
|
23
|
-
name: bundler
|
24
21
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|
25
22
|
none: false
|
26
23
|
requirements:
|
@@ -32,11 +29,11 @@ dependencies:
|
|
32
29
|
- 0
|
33
30
|
- 0
|
34
31
|
version: 1.0.0
|
32
|
+
type: :development
|
35
33
|
requirement: *id001
|
36
34
|
prerelease: false
|
35
|
+
name: bundler
|
37
36
|
- !ruby/object:Gem::Dependency
|
38
|
-
type: :development
|
39
|
-
name: jeweler
|
40
37
|
version_requirements: &id002 !ruby/object:Gem::Requirement
|
41
38
|
none: false
|
42
39
|
requirements:
|
@@ -48,11 +45,11 @@ dependencies:
|
|
48
45
|
- 5
|
49
46
|
- 2
|
50
47
|
version: 1.5.2
|
48
|
+
type: :development
|
51
49
|
requirement: *id002
|
52
50
|
prerelease: false
|
51
|
+
name: jeweler
|
53
52
|
- !ruby/object:Gem::Dependency
|
54
|
-
type: :runtime
|
55
|
-
name: SystemTimer
|
56
53
|
version_requirements: &id003 !ruby/object:Gem::Requirement
|
57
54
|
none: false
|
58
55
|
requirements:
|
@@ -62,11 +59,11 @@ dependencies:
|
|
62
59
|
segments:
|
63
60
|
- 0
|
64
61
|
version: "0"
|
62
|
+
type: :runtime
|
65
63
|
requirement: *id003
|
66
64
|
prerelease: false
|
65
|
+
name: SystemTimer
|
67
66
|
- !ruby/object:Gem::Dependency
|
68
|
-
type: :runtime
|
69
|
-
name: resque
|
70
67
|
version_requirements: &id004 !ruby/object:Gem::Requirement
|
71
68
|
none: false
|
72
69
|
requirements:
|
@@ -76,11 +73,11 @@ dependencies:
|
|
76
73
|
segments:
|
77
74
|
- 0
|
78
75
|
version: "0"
|
76
|
+
type: :runtime
|
79
77
|
requirement: *id004
|
80
78
|
prerelease: false
|
79
|
+
name: resque
|
81
80
|
- !ruby/object:Gem::Dependency
|
82
|
-
type: :runtime
|
83
|
-
name: git
|
84
81
|
version_requirements: &id005 !ruby/object:Gem::Requirement
|
85
82
|
none: false
|
86
83
|
requirements:
|
@@ -90,11 +87,11 @@ dependencies:
|
|
90
87
|
segments:
|
91
88
|
- 0
|
92
89
|
version: "0"
|
90
|
+
type: :runtime
|
93
91
|
requirement: *id005
|
94
92
|
prerelease: false
|
93
|
+
name: git
|
95
94
|
- !ruby/object:Gem::Dependency
|
96
|
-
type: :runtime
|
97
|
-
name: sinatra
|
98
95
|
version_requirements: &id006 !ruby/object:Gem::Requirement
|
99
96
|
none: false
|
100
97
|
requirements:
|
@@ -104,11 +101,11 @@ dependencies:
|
|
104
101
|
segments:
|
105
102
|
- 0
|
106
103
|
version: "0"
|
104
|
+
type: :runtime
|
107
105
|
requirement: *id006
|
108
106
|
prerelease: false
|
107
|
+
name: sinatra
|
109
108
|
- !ruby/object:Gem::Dependency
|
110
|
-
type: :runtime
|
111
|
-
name: thin
|
112
109
|
version_requirements: &id007 !ruby/object:Gem::Requirement
|
113
110
|
none: false
|
114
111
|
requirements:
|
@@ -118,11 +115,11 @@ dependencies:
|
|
118
115
|
segments:
|
119
116
|
- 0
|
120
117
|
version: "0"
|
118
|
+
type: :runtime
|
121
119
|
requirement: *id007
|
122
120
|
prerelease: false
|
121
|
+
name: thin
|
123
122
|
- !ruby/object:Gem::Dependency
|
124
|
-
type: :runtime
|
125
|
-
name: rufus-scheduler
|
126
123
|
version_requirements: &id008 !ruby/object:Gem::Requirement
|
127
124
|
none: false
|
128
125
|
requirements:
|
@@ -132,11 +129,11 @@ dependencies:
|
|
132
129
|
segments:
|
133
130
|
- 0
|
134
131
|
version: "0"
|
132
|
+
type: :runtime
|
135
133
|
requirement: *id008
|
136
134
|
prerelease: false
|
135
|
+
name: rufus-scheduler
|
137
136
|
- !ruby/object:Gem::Dependency
|
138
|
-
type: :runtime
|
139
|
-
name: term-ansicolor
|
140
137
|
version_requirements: &id009 !ruby/object:Gem::Requirement
|
141
138
|
none: false
|
142
139
|
requirements:
|
@@ -146,11 +143,11 @@ dependencies:
|
|
146
143
|
segments:
|
147
144
|
- 0
|
148
145
|
version: "0"
|
146
|
+
type: :runtime
|
149
147
|
requirement: *id009
|
150
148
|
prerelease: false
|
149
|
+
name: term-ansicolor
|
151
150
|
- !ruby/object:Gem::Dependency
|
152
|
-
type: :runtime
|
153
|
-
name: mixlib-cli
|
154
151
|
version_requirements: &id010 !ruby/object:Gem::Requirement
|
155
152
|
none: false
|
156
153
|
requirements:
|
@@ -160,11 +157,11 @@ dependencies:
|
|
160
157
|
segments:
|
161
158
|
- 0
|
162
159
|
version: "0"
|
160
|
+
type: :runtime
|
163
161
|
requirement: *id010
|
164
162
|
prerelease: false
|
163
|
+
name: mixlib-cli
|
165
164
|
- !ruby/object:Gem::Dependency
|
166
|
-
type: :runtime
|
167
|
-
name: daemons
|
168
165
|
version_requirements: &id011 !ruby/object:Gem::Requirement
|
169
166
|
none: false
|
170
167
|
requirements:
|
@@ -174,8 +171,10 @@ dependencies:
|
|
174
171
|
segments:
|
175
172
|
- 0
|
176
173
|
version: "0"
|
174
|
+
type: :runtime
|
177
175
|
requirement: *id011
|
178
176
|
prerelease: false
|
177
|
+
name: daemons
|
179
178
|
description: Tools to manage,create and build distribution packages
|
180
179
|
email: rubiojr@frameos.org
|
181
180
|
executables:
|
@@ -205,6 +204,7 @@ files:
|
|
205
204
|
- lib/pkg-wizard/command.rb
|
206
205
|
- lib/pkg-wizard/commands/build_bot.rb
|
207
206
|
- lib/pkg-wizard/commands/create_srpm.rb
|
207
|
+
- lib/pkg-wizard/commands/download_sources.rb
|
208
208
|
- lib/pkg-wizard/commands/init_env.rb
|
209
209
|
- lib/pkg-wizard/commands/remote_build.rb
|
210
210
|
- lib/pkg-wizard/git.rb
|
@@ -229,7 +229,7 @@ files:
|
|
229
229
|
- resources/public/screen.css
|
230
230
|
- resources/public/server.js.tmpl
|
231
231
|
- resources/public/ws.js
|
232
|
-
|
232
|
+
- test/test_specfile.rb
|
233
233
|
homepage: http://github.com/rubiojr/pkg-wizard
|
234
234
|
licenses:
|
235
235
|
- MIT
|
@@ -259,9 +259,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
259
259
|
requirements: []
|
260
260
|
|
261
261
|
rubyforge_project:
|
262
|
-
rubygems_version: 1.
|
262
|
+
rubygems_version: 1.8.5
|
263
263
|
signing_key:
|
264
264
|
specification_version: 3
|
265
265
|
summary: Package Wizards Tools
|
266
|
-
test_files:
|
267
|
-
|
266
|
+
test_files:
|
267
|
+
- test/test_specfile.rb
|