prm 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/prm +5 -1
- data/lib/prm/repo.rb +41 -7
- metadata +4 -4
data/bin/prm
CHANGED
@@ -10,7 +10,7 @@ rescue LoadError
|
|
10
10
|
require 'prm'
|
11
11
|
end
|
12
12
|
|
13
|
-
version_info = "0.1.
|
13
|
+
version_info = "0.1.1"
|
14
14
|
|
15
15
|
class Main < Clamp::Command
|
16
16
|
option ["-t", "--type"], "TYPE", "Type of repo to create", :required => true
|
@@ -20,6 +20,7 @@ class Main < Clamp::Command
|
|
20
20
|
option ["-a", "--arch"], "ARCH", "Architecture of repo contents", :required => true
|
21
21
|
option ["--accesskey"], "ACCESS KEY", "DHO/S3 Access Key", :default => false
|
22
22
|
option ["--secretkey"], "SECRET KEY", "DHO/S3 Secret Key", :default => false
|
23
|
+
option ["-d", "--directory"], "DIRECTORY", "Move packages from directory to target", :default => false
|
23
24
|
option ["-s", "--snapshot"], "COMPONENT", "Creates a snapshot of a component", :default => false
|
24
25
|
option ["-k", "--gpg"], :flag, "Sign release files with users GPG key", :default => false
|
25
26
|
option ["-g", "--generate"], :flag , "Generate new repository"
|
@@ -43,6 +44,9 @@ class Main < Clamp::Command
|
|
43
44
|
unless snapshot.nil?
|
44
45
|
r.snapshot = snapshot
|
45
46
|
end
|
47
|
+
unless directory.nil?
|
48
|
+
r.directory = directory
|
49
|
+
end
|
46
50
|
|
47
51
|
r.create
|
48
52
|
end
|
data/lib/prm/repo.rb
CHANGED
@@ -8,20 +8,22 @@ require 'find'
|
|
8
8
|
require 'aws/s3'
|
9
9
|
|
10
10
|
module Debian
|
11
|
-
def build_apt_repo(path, component, arch, release, gpg)
|
11
|
+
def build_apt_repo(path, component, arch, release, gpg, silent)
|
12
12
|
release.each { |r|
|
13
13
|
component.each { |c|
|
14
14
|
arch.each { |a|
|
15
15
|
fpath = path + "/dists/" + r + "/" + c + "/" + "binary-" + a + "/"
|
16
16
|
pfpath = fpath + "Packages"
|
17
17
|
rfpath = fpath + "Release"
|
18
|
-
|
19
|
-
|
18
|
+
|
19
|
+
unless silent == true
|
20
|
+
puts "Building Path: #{fpath}"
|
21
|
+
end
|
20
22
|
|
21
23
|
FileUtils.mkpath(fpath)
|
22
24
|
FileUtils.touch(pfpath)
|
23
25
|
FileUtils.touch(rfpath)
|
24
|
-
generate_packages_gz(fpath,pfpath,path,rfpath,r,c,a)
|
26
|
+
generate_packages_gz(fpath,pfpath,path,rfpath,r,c,a, silent)
|
25
27
|
}
|
26
28
|
}
|
27
29
|
generate_release(path,r,component,arch)
|
@@ -32,8 +34,31 @@ module Debian
|
|
32
34
|
}
|
33
35
|
end
|
34
36
|
|
35
|
-
def
|
36
|
-
|
37
|
+
def move_packages(path,component,arch,release,directory)
|
38
|
+
unless File.exists?(directory)
|
39
|
+
puts "ERROR: #{directory} doesn't exist... not doing anything\n"
|
40
|
+
return false
|
41
|
+
end
|
42
|
+
|
43
|
+
release.each { |r|
|
44
|
+
component.each { |c|
|
45
|
+
arch.each { |a|
|
46
|
+
Dir.glob(directory + "/*.deb") do |file|
|
47
|
+
if file =~ /^.*#{a}.*\.deb$/i
|
48
|
+
FileUtils.mv(file, "#{path}/dists/#{r}/#{c}/binary-#{a}/")
|
49
|
+
end
|
50
|
+
end
|
51
|
+
}
|
52
|
+
}
|
53
|
+
}
|
54
|
+
# Regex?
|
55
|
+
#/^.*#{arch}.*\.deb$/i
|
56
|
+
end
|
57
|
+
|
58
|
+
def generate_packages_gz(fpath,pfpath,path,rfpath,r,c,a,silent)
|
59
|
+
unless silent == true
|
60
|
+
puts "Generating Packages: #{r} : #{c} : binary-#{a}"
|
61
|
+
end
|
37
62
|
|
38
63
|
d = File.open(pfpath, "w+")
|
39
64
|
npath = "dists/" + r + "/" + c + "/" + "binary-" + a + "/"
|
@@ -230,6 +255,7 @@ module PRM
|
|
230
255
|
attr_accessor :secretkey
|
231
256
|
attr_accessor :accesskey
|
232
257
|
attr_accessor :snapshot
|
258
|
+
attr_accessor :directory
|
233
259
|
|
234
260
|
def create
|
235
261
|
parch,pcomponent,prelease = _parse_vars(arch,component,release)
|
@@ -238,7 +264,15 @@ module PRM
|
|
238
264
|
if snapshot
|
239
265
|
snapshot_to(path,pcomponent,prelease,snapshot,type)
|
240
266
|
else
|
241
|
-
|
267
|
+
if directory
|
268
|
+
silent = true
|
269
|
+
build_apt_repo(path,pcomponent,parch,prelease,gpg,silent)
|
270
|
+
if move_packages(path,pcomponent,parch,prelease,directory) == false
|
271
|
+
return
|
272
|
+
end
|
273
|
+
end
|
274
|
+
silent = false
|
275
|
+
build_apt_repo(path,pcomponent,parch,prelease,gpg,silent)
|
242
276
|
end
|
243
277
|
elsif "#{@type}" == "sync"
|
244
278
|
sync_to_dho(path, accesskey, secretkey,pcomponent,prelease)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Brett Gailey
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2013-04-
|
18
|
+
date: 2013-04-28 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|