repomate 0.2.2 → 0.2.3

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 CHANGED
@@ -36,7 +36,7 @@ options = Slop.parse do
36
36
  on :c, :component=, "Set the name of the component (main/contrib...)", :default => "main"
37
37
  on :a, :architecture=, "Set the name of the component (main/contrib...)", :argument => true
38
38
  on :r, :category, "Category (stage/pool/dists)", :argument => true
39
- on :force, "Force action", :default => false
39
+ on :yes, "Always answer with yes", :default => false
40
40
  on :h, :help, 'Print this help message', :tail => true do
41
41
  puts help
42
42
  exit
data/lib/repomate/base.rb CHANGED
@@ -15,6 +15,7 @@ module RepoMate
15
15
  @repository = Repository.new
16
16
  @link = Link.new
17
17
  @checkpoint = Checkpoint.new
18
+ @metafile = Metafile.new
18
19
  end
19
20
 
20
21
  # Add's a package to the staging area
@@ -51,6 +52,7 @@ module RepoMate
51
52
  }
52
53
  end
53
54
  end
55
+
54
56
  workload
55
57
  end
56
58
 
@@ -96,6 +98,7 @@ module RepoMate
96
98
  :component => package.component,
97
99
  :architecture => package.architecture
98
100
  }
101
+
99
102
  Dir.glob("#{dists.directory}/#{package.name}*.deb") do |fullname|
100
103
  unlink_workload << {
101
104
  :destination_fullname => fullname,
@@ -104,11 +107,14 @@ module RepoMate
104
107
  :category => 'dists'
105
108
  }
106
109
  end
110
+
107
111
  FileUtils.move(stage_fullname, pool_fullname) unless File.exists?(pool_fullname)
112
+ @link.destroy(unlink_workload) unless unlink_workload.empty?
113
+ @link.create(link_workload) unless link_workload.empty?
108
114
  end
109
115
  end
110
- @link.destroy(unlink_workload)
111
- @link.create(link_workload)
116
+
117
+ @metafile.create unless link_workload.empty?
112
118
  end
113
119
 
114
120
  # Returns a list of packages
@@ -152,7 +158,7 @@ module RepoMate
152
158
  packages
153
159
  end
154
160
 
155
- # Removes a package
161
+ # Activates a package
156
162
  def activate(entry)
157
163
  link_workload = []
158
164
 
@@ -171,10 +177,11 @@ module RepoMate
171
177
  puts "Package already activated"
172
178
  else
173
179
  @link.create(link_workload)
180
+ @metafile.create
174
181
  end
175
182
  end
176
183
 
177
- # Removes a package
184
+ # Deactivates a package
178
185
  def deactivate(entry, mode)
179
186
  unlink_workload = []
180
187
 
@@ -195,6 +202,7 @@ module RepoMate
195
202
 
196
203
  @checkpoint.delete_package(entry) if mode.eql?("remove")
197
204
  @link.destroy(unlink_workload)
205
+ @metafile.create
198
206
  end
199
207
  end
200
208
  end
@@ -13,7 +13,8 @@ module RepoMate
13
13
  @link = Link.new
14
14
  @cpdbfile = File.join(Cfg.rootdir, "checkpoints.db")
15
15
  @cpdb = Database.new(@cpdbfile)
16
-
16
+ @metafile = Metafile.new
17
+
17
18
  create_table
18
19
  end
19
20
 
@@ -93,6 +94,7 @@ module RepoMate
93
94
 
94
95
  @link.destroy(unlink_workload)
95
96
  @link.create(link_workload)
97
+ @metafile.create
96
98
  end
97
99
 
98
100
  # Deletes a package from checkpoint table
data/lib/repomate/cli.rb CHANGED
@@ -41,23 +41,18 @@ 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
+ workload = []
45
45
  @repomate.prepare_publish.each do |entry|
46
- workload = []
47
46
  basename = File.basename(entry[:source_fullname])
48
47
  suitename = entry[:suitename]
49
48
  component = entry[:component]
50
49
 
51
- unless options.force?
50
+ unless options.yes?
52
51
  printf "\n%s", "Link #{basename} to production => #{suitename}/#{component}? [y|yes|n|no]: "
53
52
  input = STDIN.gets
54
53
  end
55
54
 
56
- if options.force? || input =~ /(y|yes)/
57
- @checkpoint.create if action
58
-
59
- action = false
60
-
55
+ if options.yes? || input =~ /(y|yes)/
61
56
  workload << {
62
57
  :source_fullname => entry[:source_fullname],
63
58
  :destination_fullname => entry[:destination_fullname],
@@ -66,9 +61,12 @@ module RepoMate
66
61
  :architecture => entry[:architecture]
67
62
  }
68
63
  end
69
-
70
- @repomate.publish(workload) unless workload.empty?
71
- end
64
+ end
65
+
66
+ unless workload.empty?
67
+ @checkpoint.create
68
+ @repomate.publish(workload)
69
+ end
72
70
  end
73
71
 
74
72
  # Save a checkpoint
@@ -126,7 +124,7 @@ Everything between the last two \"publish (-P) commands\" will be lost if you pr
126
124
  @repomate.listpackages.each do |entry|
127
125
  next if entry[:category].eql?("stage")
128
126
  if mode.eql?("activate")
129
- file = File.join(Cfg.rootdir, "dists", entry[:suitename], entry[:component], "binary-#{entry[:architecture]}", entry[:basename])
127
+ file = File.join(Architecture.new(entry[:architecture], entry[:component], entry[:suitename], "dists").directory, entry[:basename])
130
128
  next if File.exists?(file)
131
129
  elsif mode.eql?("deactivate")
132
130
  next unless entry[:category].eql?("dists")
@@ -167,7 +165,7 @@ Everything between the last two \"publish (-P) commands\" will be lost if you pr
167
165
  if entry[:number].eql?(number)
168
166
  if mode.eql?("activate")
169
167
  @repomate.activate(entry)
170
- else
168
+ elsif mode.eql?("deactivate")
171
169
  @repomate.deactivate(entry, mode)
172
170
  end
173
171
  end
data/lib/repomate/link.rb CHANGED
@@ -19,30 +19,22 @@ module RepoMate
19
19
 
20
20
  # links the workload
21
21
  def create(workload)
22
- action = false
23
-
24
22
  workload.each do |entry|
25
23
  @repository.create(entry[:suitename], entry[:component], entry[:architecture])
26
24
 
27
25
  unless File.exists?(entry[:destination_fullname])
28
26
  package = Package.new(entry[:source_fullname], entry[:suitename], entry[:component])
27
+
29
28
  package.create_checksums
30
29
 
31
30
  File.symlink(entry[:source_fullname], entry[:destination_fullname])
32
31
  puts "Package: #{package.newbasename} linked to production => #{entry[:suitename]}/#{entry[:component]}"
33
- action = true
34
32
  end
35
33
  end
36
-
37
- if action
38
- @metafile.create
39
- end
40
34
  end
41
35
 
42
36
  # unlinks workload
43
37
  def destroy(workload)
44
- action = false
45
-
46
38
  workload.each do |entry|
47
39
  package = Package.new(entry[:destination_fullname], entry[:suitename], entry[:component])
48
40
  package.delete_checksums
@@ -50,16 +42,12 @@ module RepoMate
50
42
  if File.exists?(entry[:destination_fullname])
51
43
  File.unlink(entry[:destination_fullname])
52
44
  puts "Package: #{package.newbasename} unlinked from #{entry[:category]} => #{entry[:suitename]}/#{entry[:component]}"
53
- action = true
54
45
  else
55
46
  puts "Package: #{package.newbasename} was not linked"
56
47
  end
57
48
  end
58
-
59
- if action
60
- cleanup
61
- @metafile.create
62
- end
49
+
50
+ cleanup unless workload.empty?
63
51
  end
64
52
 
65
53
  # cleans up unused directories
@@ -90,9 +78,8 @@ module RepoMate
90
78
  end
91
79
  end
92
80
  end
93
- if action
94
- @metafile.create
95
- end
81
+
82
+ @metafile.create if action
96
83
  end
97
84
  end
98
85
  end
@@ -17,7 +17,7 @@ module RepoMate
17
17
  @repository = Repository.new
18
18
  end
19
19
 
20
- # Returns a lit of all existing metafiles as array
20
+ # Returns a list of all existing metafiles as array
21
21
  def all
22
22
  rootdir = Cfg.rootdir
23
23
  dirlist = ["#{rootdir}/*/*", "#{rootdir}/*/*/*/*"]
@@ -42,6 +42,8 @@ module RepoMate
42
42
 
43
43
  # Creates all metafiles
44
44
  def create
45
+ puts "Creating Metafiles..."
46
+
45
47
  destroy
46
48
  create_packages
47
49
 
@@ -110,8 +112,8 @@ module RepoMate
110
112
  end
111
113
 
112
114
  releasefile = File.join(Cfg.rootdir, source_category, suite, "Release")
113
-
114
115
  File.open(releasefile, 'w') { |file| file.puts suiterelease_template.result(binding).gsub(/^\s+\n|^\n|^\s{3}/, '') }
116
+
115
117
  begin
116
118
  sign(releasefile)
117
119
  rescue
@@ -62,7 +62,7 @@ module RepoMate
62
62
  now = DateTime.now
63
63
  md5 = Digest::MD5.file(@fullname).to_s
64
64
  sha1 = Digest::SHA1.file(@fullname).to_s
65
- sha256 = Digest::SHA256.new(256).file(@fullname).to_s
65
+ sha256 = Digest::SHA2.new(256).file(@fullname).to_s
66
66
  @pkgdb.query("insert into checksums values ( '#{now}', '#{@basename}', '#{@mtime.iso8601}', '#{md5}', '#{sha1}', '#{sha256}' )")
67
67
  end
68
68
 
@@ -33,9 +33,9 @@ SHA256:
33
33
  <% source = Architecture.new(entry[:architecture], entry[:component], entry[:suitename], source_category) %>
34
34
  <% Dir.glob(File.join(entry[:fullpath], "Packages*")).each do |file| %>
35
35
  <% path = File.join(entry[:component], entry[:architecture_dir], File.basename(file)) %>
36
- <%= Digest::SHA256.new(256).file(file) %> <%= File.size(file) %> <%= path %>
36
+ <%= Digest::SHA2.new(256).file(file) %> <%= File.size(file) %> <%= path %>
37
37
  <% end %>
38
38
  <% file = File.join(entry[:fullpath], "Release") %>
39
39
  <% path = File.join(entry[:component], entry[:architecture_dir], File.basename(file)) %>
40
- <%= Digest::SHA256.new(256).file(file) %> <%= File.size(file) %> <%= path %>
40
+ <%= Digest::SHA2.new(256).file(file) %> <%= File.size(file) %> <%= path %>
41
41
  <% 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.2.2
4
+ version: 0.2.3
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-06-09 00:00:00.000000000Z
13
+ date: 2012-07-27 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: slop
17
- requirement: &70135441285600 !ruby/object:Gem::Requirement
17
+ requirement: !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ~>
@@ -22,10 +22,15 @@ dependencies:
22
22
  version: 3.0.4
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *70135441285600
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ~>
29
+ - !ruby/object:Gem::Version
30
+ version: 3.0.4
26
31
  - !ruby/object:Gem::Dependency
27
32
  name: gpgme
28
- requirement: &70135441285080 !ruby/object:Gem::Requirement
33
+ requirement: !ruby/object:Gem::Requirement
29
34
  none: false
30
35
  requirements:
31
36
  - - ~>
@@ -33,10 +38,15 @@ dependencies:
33
38
  version: 2.0.0
34
39
  type: :runtime
35
40
  prerelease: false
36
- version_requirements: *70135441285080
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ~>
45
+ - !ruby/object:Gem::Version
46
+ version: 2.0.0
37
47
  - !ruby/object:Gem::Dependency
38
48
  name: sqlite3
39
- requirement: &70135441284540 !ruby/object:Gem::Requirement
49
+ requirement: !ruby/object:Gem::Requirement
40
50
  none: false
41
51
  requirements:
42
52
  - - ~>
@@ -44,7 +54,12 @@ dependencies:
44
54
  version: 1.3.6
45
55
  type: :runtime
46
56
  prerelease: false
47
- version_requirements: *70135441284540
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ~>
61
+ - !ruby/object:Gem::Version
62
+ version: 1.3.6
48
63
  description: A tool to manage Debian repositories
49
64
  email:
50
65
  - flo@doobie.cc
@@ -93,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
93
108
  version: '0'
94
109
  requirements: []
95
110
  rubyforge_project:
96
- rubygems_version: 1.8.6
111
+ rubygems_version: 1.8.24
97
112
  signing_key:
98
113
  specification_version: 3
99
114
  summary: A tool to manage Debian repositories