repomate 0.1.4 → 0.1.5
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.
- data/bin/repomate +8 -2
- data/lib/repomate/base.rb +26 -7
- data/lib/repomate/checkpoint.rb +5 -0
- data/lib/repomate/cli.rb +32 -3
- data/lib/repomate/configuration.rb +0 -1
- data/lib/repomate/link.rb +1 -0
- data/lib/repomate/metafile.rb +2 -3
- metadata +9 -24
data/bin/repomate
CHANGED
@@ -9,6 +9,9 @@ require 'repomate'
|
|
9
9
|
require 'rubygems'
|
10
10
|
require 'slop'
|
11
11
|
|
12
|
+
# check for dpkg
|
13
|
+
raise "dpkg is not installed or configured" unless File.exists?(RepoMate::Cfg.dpkg)
|
14
|
+
|
12
15
|
options = Slop.parse do
|
13
16
|
banner "RepoMate (A simple debian repository management tool)
|
14
17
|
|
@@ -23,12 +26,13 @@ options = Slop.parse do
|
|
23
26
|
load - Load a checkpoint
|
24
27
|
listpackages - List packages
|
25
28
|
setup - Setup the pool
|
29
|
+
remove - Removes a package from production
|
26
30
|
|
27
31
|
Options:"
|
28
32
|
on :s, :suitename=, "Set the name of the suite (lenny/squeeze...)", :argument => true
|
29
33
|
on :c, :component=, "Set the name of the component (main/contrib...)", :default => "main"
|
30
34
|
on :a, :architecture=, "Set the name of the component (main/contrib...)", :argument => true
|
31
|
-
on :r, :repodir, "Type of pool/category (stage/pool/
|
35
|
+
on :r, :repodir, "Type of pool/category (stage/pool/dists)", :argument => true
|
32
36
|
on :force, "Force action", :default => false
|
33
37
|
on :h, :help, 'Print this help message', :tail => true do
|
34
38
|
puts help
|
@@ -56,8 +60,10 @@ elsif ARGV.include?("save")
|
|
56
60
|
cli.save_checkpoint
|
57
61
|
elsif ARGV.include?("load")
|
58
62
|
cli.choose_checkpoint
|
63
|
+
elsif ARGV.include?("remove")
|
64
|
+
cli.choose_package("remove")
|
59
65
|
elsif ARGV.include?("listpackages")
|
60
|
-
cli.list_packages(options)
|
66
|
+
cli.list_packages(options[:repodir])
|
61
67
|
elsif ARGV.include?("setup")
|
62
68
|
cli.setup(options)
|
63
69
|
else
|
data/lib/repomate/base.rb
CHANGED
@@ -13,8 +13,8 @@ module RepoMate
|
|
13
13
|
FileUtils.mkdir_p(Cfg.rootdir)
|
14
14
|
|
15
15
|
@repository = Repository.new
|
16
|
-
@checkpoint = Checkpoint.new
|
17
16
|
@link = Link.new
|
17
|
+
@checkpoint = Checkpoint.new
|
18
18
|
end
|
19
19
|
|
20
20
|
# Add's a package to the staging area
|
@@ -73,20 +73,16 @@ module RepoMate
|
|
73
73
|
FileUtils.move(entry[:source_fullname], entry[:destination_fullname])
|
74
74
|
end
|
75
75
|
workload = newworkload
|
76
|
-
|
77
|
-
@checkpoint.create
|
78
76
|
check_versions(workload)
|
79
77
|
end
|
80
78
|
|
81
79
|
# Does the link job after checking versions through dpkg
|
82
80
|
def check_versions(workload)
|
83
|
-
dpkg = Cfg.dpkg
|
84
|
-
|
85
|
-
raise "dpkg is not installed" unless File.exists?(dpkg)
|
86
|
-
|
87
81
|
link_workload = []
|
88
82
|
unlink_workload = []
|
89
83
|
|
84
|
+
dpkg = Cfg.dpkg
|
85
|
+
|
90
86
|
workload.each do |entry|
|
91
87
|
source_package = Package.new(entry[:source_fullname], entry[:suitename], entry[:component])
|
92
88
|
destination_fullname = File.join(entry[:destination_dir], source_package.newbasename)
|
@@ -124,14 +120,19 @@ module RepoMate
|
|
124
120
|
# Returns a list of packages
|
125
121
|
def list_packages(category)
|
126
122
|
packages = []
|
123
|
+
number = 0
|
127
124
|
if category.eql?("stage")
|
128
125
|
Component.dataset(category).each do |entry|
|
129
126
|
source = Component.new(entry[:component], entry[:suitename], category)
|
130
127
|
source.files.each do |fullname|
|
131
128
|
package = Package.new(fullname, entry[:suitename], entry[:component])
|
132
129
|
|
130
|
+
number += 1
|
131
|
+
|
133
132
|
packages << {
|
133
|
+
:number => number,
|
134
134
|
:fullname => fullname,
|
135
|
+
:basename => File.basename(fullname),
|
135
136
|
:controlfile => package.controlfile,
|
136
137
|
:component => entry[:component],
|
137
138
|
:suitename => entry[:suitename]
|
@@ -144,8 +145,12 @@ module RepoMate
|
|
144
145
|
source.files.each do |fullname|
|
145
146
|
package = Package.new(fullname, entry[:suitename], entry[:component])
|
146
147
|
|
148
|
+
number += 1
|
149
|
+
|
147
150
|
packages << {
|
151
|
+
:number => number,
|
148
152
|
:fullname => fullname,
|
153
|
+
:basename => File.basename(fullname),
|
149
154
|
:controlfile => package.controlfile,
|
150
155
|
:component => entry[:component],
|
151
156
|
:suitename => entry[:suitename],
|
@@ -156,6 +161,20 @@ module RepoMate
|
|
156
161
|
end
|
157
162
|
packages
|
158
163
|
end
|
164
|
+
|
165
|
+
# Removes a package
|
166
|
+
def remove(package)
|
167
|
+
unlink_workload = []
|
168
|
+
|
169
|
+
path = File.join(Cfg.rootdir, "*", package[:suitename], package[:component], "*", package[:basename])
|
170
|
+
|
171
|
+
Dir.glob(path).each do |fullname|
|
172
|
+
unlink_workload << { :destination_fullname => fullname }
|
173
|
+
end
|
174
|
+
|
175
|
+
@checkpoint.delete_package(package)
|
176
|
+
@link.destroy(unlink_workload)
|
177
|
+
end
|
159
178
|
end
|
160
179
|
end
|
161
180
|
|
data/lib/repomate/checkpoint.rb
CHANGED
@@ -87,6 +87,11 @@ module RepoMate
|
|
87
87
|
@link.create(link_workload)
|
88
88
|
end
|
89
89
|
|
90
|
+
# Deletes a package from checkpoint table
|
91
|
+
def delete_package(package)
|
92
|
+
@cpdb.query("delete from checkpoints where basename = '#{package[:basename]}' and suitename = '#{package[:suitename]}' and component = '#{package[:component]}' and architecture = '#{package[:architecture]}'")
|
93
|
+
end
|
94
|
+
|
90
95
|
# Returns a list of checkpoints for the cli
|
91
96
|
def list
|
92
97
|
order = 0
|
data/lib/repomate/cli.rb
CHANGED
@@ -41,6 +41,7 @@ module RepoMate
|
|
41
41
|
|
42
42
|
# Get's all packages from the staging area. Packages need to be confirmed here.
|
43
43
|
def publish(options)
|
44
|
+
action = true
|
44
45
|
@repomate.prepare_publish.each do |entry|
|
45
46
|
workload = []
|
46
47
|
basename = File.basename(entry[:source_fullname])
|
@@ -53,6 +54,10 @@ module RepoMate
|
|
53
54
|
end
|
54
55
|
|
55
56
|
if options.force? || input =~ /(y|yes)/
|
57
|
+
@checkpoint.create if action
|
58
|
+
|
59
|
+
action = false
|
60
|
+
|
56
61
|
workload << {
|
57
62
|
:source_fullname => entry[:source_fullname],
|
58
63
|
:destination_fullname => entry[:destination_fullname],
|
@@ -61,6 +66,7 @@ module RepoMate
|
|
61
66
|
:architecture => entry[:architecture]
|
62
67
|
}
|
63
68
|
end
|
69
|
+
|
64
70
|
@repomate.publish(workload) unless workload.empty?
|
65
71
|
end
|
66
72
|
end
|
@@ -72,11 +78,11 @@ module RepoMate
|
|
72
78
|
end
|
73
79
|
|
74
80
|
# List all packages, see cli output
|
75
|
-
def list_packages(
|
76
|
-
if
|
81
|
+
def list_packages(repodir)
|
82
|
+
if repodir
|
77
83
|
architecture = "unknown"
|
78
84
|
|
79
|
-
packages = @repomate.list_packages(
|
85
|
+
packages = @repomate.list_packages(repodir)
|
80
86
|
packages.each do |package|
|
81
87
|
architecture = package[:architecture] if package[:architecture]
|
82
88
|
printf "%-50s%-20s%s\n", package[:controlfile]['Package'], package[:controlfile]['Version'], "#{package[:suitename]}/#{package[:component]}/#{architecture}"
|
@@ -119,6 +125,29 @@ Everything between the last two \"publish (-P) commands\" will be lost if you pr
|
|
119
125
|
@checkpoint.load(number)
|
120
126
|
end
|
121
127
|
end
|
128
|
+
|
129
|
+
# Choose a package
|
130
|
+
def choose_package(action)
|
131
|
+
packages = @repomate.list_packages("dists")
|
132
|
+
packages.each do |package|
|
133
|
+
printf "%d) %-50s%-20s%s\n", package[:number], package[:controlfile]['Package'], package[:controlfile]['Version'], "#{package[:suitename]}/#{package[:component]}"
|
134
|
+
end
|
135
|
+
|
136
|
+
printf "\n%s", "Enter number or [q|quit] to abord: "
|
137
|
+
input = STDIN.gets
|
138
|
+
number = input.to_i
|
139
|
+
|
140
|
+
if input =~ /(q|quit)/
|
141
|
+
puts "Aborting..."
|
142
|
+
exit 0
|
143
|
+
else
|
144
|
+
packages.each do |package|
|
145
|
+
if package[:number].eql?(number)
|
146
|
+
@repomate.remove(package) if action.eql?("remove")
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
122
151
|
end
|
123
152
|
end
|
124
153
|
|
data/lib/repomate/link.rb
CHANGED
data/lib/repomate/metafile.rb
CHANGED
@@ -45,7 +45,7 @@ module RepoMate
|
|
45
45
|
destroy
|
46
46
|
create_packages
|
47
47
|
|
48
|
-
if Cfg.gpg_enable
|
48
|
+
if Cfg.gpg_enable.eql?(true)
|
49
49
|
if Cfg.gpg_password.nil? || Cfg.gpg_email.nil?
|
50
50
|
puts "Configure password and email for GPG!"
|
51
51
|
exit 1
|
@@ -85,7 +85,6 @@ module RepoMate
|
|
85
85
|
def create_release
|
86
86
|
source_category = "dists"
|
87
87
|
suites = []
|
88
|
-
|
89
88
|
archrelease_template = ERB.new File.new(File.join(File.dirname(__FILE__), "templates/archrelease.erb")).read, nil, "%"
|
90
89
|
suiterelease_template = ERB.new File.new(File.join(File.dirname(__FILE__), "templates/suiterelease.erb")).read, nil, "%"
|
91
90
|
|
@@ -118,7 +117,7 @@ module RepoMate
|
|
118
117
|
rescue
|
119
118
|
destroy
|
120
119
|
create_packages
|
121
|
-
puts "GPG email/password incorrect"
|
120
|
+
puts "GPG email/password incorrect or gpg is not installed!"
|
122
121
|
return
|
123
122
|
end
|
124
123
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: repomate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-06-06 00:00:00.000000000Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: slop
|
17
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirement: &70248180314500 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ~>
|
@@ -22,15 +22,10 @@ dependencies:
|
|
22
22
|
version: 3.0.4
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements:
|
26
|
-
none: false
|
27
|
-
requirements:
|
28
|
-
- - ~>
|
29
|
-
- !ruby/object:Gem::Version
|
30
|
-
version: 3.0.4
|
25
|
+
version_requirements: *70248180314500
|
31
26
|
- !ruby/object:Gem::Dependency
|
32
27
|
name: gpgme
|
33
|
-
requirement: !ruby/object:Gem::Requirement
|
28
|
+
requirement: &70248180314020 !ruby/object:Gem::Requirement
|
34
29
|
none: false
|
35
30
|
requirements:
|
36
31
|
- - ~>
|
@@ -38,15 +33,10 @@ dependencies:
|
|
38
33
|
version: 2.0.0
|
39
34
|
type: :runtime
|
40
35
|
prerelease: false
|
41
|
-
version_requirements:
|
42
|
-
none: false
|
43
|
-
requirements:
|
44
|
-
- - ~>
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version: 2.0.0
|
36
|
+
version_requirements: *70248180314020
|
47
37
|
- !ruby/object:Gem::Dependency
|
48
38
|
name: sqlite3
|
49
|
-
requirement: !ruby/object:Gem::Requirement
|
39
|
+
requirement: &70248180313420 !ruby/object:Gem::Requirement
|
50
40
|
none: false
|
51
41
|
requirements:
|
52
42
|
- - ~>
|
@@ -54,12 +44,7 @@ dependencies:
|
|
54
44
|
version: 1.3.6
|
55
45
|
type: :runtime
|
56
46
|
prerelease: false
|
57
|
-
version_requirements:
|
58
|
-
none: false
|
59
|
-
requirements:
|
60
|
-
- - ~>
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version: 1.3.6
|
47
|
+
version_requirements: *70248180313420
|
63
48
|
description: A tool to manage Debian repositories
|
64
49
|
email:
|
65
50
|
- flo@doobie.cc
|
@@ -108,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
93
|
version: '0'
|
109
94
|
requirements: []
|
110
95
|
rubyforge_project:
|
111
|
-
rubygems_version: 1.8.
|
96
|
+
rubygems_version: 1.8.6
|
112
97
|
signing_key:
|
113
98
|
specification_version: 3
|
114
99
|
summary: A tool to manage Debian repositories
|