repomate 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
data/bin/repomate CHANGED
@@ -32,7 +32,7 @@ options = Slop.parse do
32
32
  on :s, :suitename=, "Set the name of the suite (lenny/squeeze...)", :argument => true
33
33
  on :c, :component=, "Set the name of the component (main/contrib...)", :default => "main"
34
34
  on :a, :architecture=, "Set the name of the component (main/contrib...)", :argument => true
35
- on :r, :repodir, "Type of pool/category (stage/pool/dists)", :argument => true
35
+ on :r, :category, "Category (stage/pool/dists)", :argument => true
36
36
  on :force, "Force action", :default => false
37
37
  on :h, :help, 'Print this help message', :tail => true do
38
38
  puts help
@@ -63,7 +63,7 @@ elsif ARGV.include?("load")
63
63
  elsif ARGV.include?("remove")
64
64
  cli.choose_package("remove")
65
65
  elsif ARGV.include?("listpackages")
66
- cli.list_packages(options[:repodir])
66
+ cli.list_packages(options)
67
67
  elsif ARGV.include?("setup")
68
68
  cli.setup(options)
69
69
  else
data/lib/repomate/base.rb CHANGED
@@ -25,7 +25,7 @@ module RepoMate
25
25
  package = Package.new(entry[:package_fullname], entry[:suitename], entry[:component])
26
26
  destination = Component.new(entry[:component], entry[:suitename], "stage")
27
27
 
28
- FileUtils.copy(entry[:package_fullname], File.join(destination.directory, package.newbasename))
28
+ FileUtils.move(entry[:package_fullname], File.join(destination.directory, package.newbasename))
29
29
  end
30
30
  end
31
31
 
@@ -94,7 +94,9 @@ module RepoMate
94
94
  puts "Package: #{target_package.newbasename} will be replaced with #{source_package.newbasename}"
95
95
  unlink_workload << {
96
96
  :destination_fullname => target_fullname,
97
- :newbasename => target_package.newbasename
97
+ :newbasename => target_package.newbasename,
98
+ :suitename => target_package.suitename,
99
+ :component => target_package.component
98
100
  }
99
101
  elsif system("#{dpkg} --compare-versions #{source_package.version} eq #{target_package.version}")
100
102
  puts "Package: #{source_package.newbasename} already exists with same version"
@@ -166,10 +168,17 @@ module RepoMate
166
168
  def remove(package)
167
169
  unlink_workload = []
168
170
 
169
- path = Dir.glob(File.join(Cfg.rootdir, "dists", package[:suitename], package[:component], "*", package[:basename]))
171
+ @repository.categories.each do |category|
172
+ path = Dir.glob(File.join(Cfg.rootdir, category, package[:suitename], package[:component], "*", package[:basename]))
170
173
 
171
- Dir.glob(path).each do |fullname|
172
- unlink_workload << { :destination_fullname => fullname }
174
+ Dir.glob(path).each do |fullname|
175
+ unlink_workload << {
176
+ :destination_fullname => fullname,
177
+ :category => category,
178
+ :suitename => package[:suitename],
179
+ :component => package[:component]
180
+ }
181
+ end
173
182
  end
174
183
 
175
184
  @checkpoint.delete_package(package)
data/lib/repomate/cli.rb CHANGED
@@ -78,17 +78,17 @@ module RepoMate
78
78
  end
79
79
 
80
80
  # List all packages, see cli output
81
- def list_packages(repodir)
82
- if repodir
81
+ def list_packages(options)
82
+ if options.category?
83
83
  architecture = "unknown"
84
84
 
85
- packages = @repomate.list_packages(repodir)
85
+ packages = @repomate.list_packages(options[:category])
86
86
  packages.each do |package|
87
87
  architecture = package[:architecture] if package[:architecture]
88
88
  printf "%-50s%-20s%s\n", package[:controlfile]['Package'], package[:controlfile]['Version'], "#{package[:suitename]}/#{package[:component]}/#{architecture}"
89
89
  end
90
90
  else
91
- STDERR.puts "Specify a category with [-r|--repodir]"
91
+ STDERR.puts "Specify a category with [-r|--category]"
92
92
  exit 1
93
93
  end
94
94
  end
data/lib/repomate/link.rb CHANGED
@@ -49,7 +49,7 @@ module RepoMate
49
49
 
50
50
  if File.exists?(entry[:destination_fullname])
51
51
  File.unlink(entry[:destination_fullname])
52
- puts "Package: #{package.newbasename} unlinked"
52
+ puts "Package: #{package.newbasename} unlinked from category #{entry[:category]}"
53
53
  action = true
54
54
  else
55
55
  puts "Package: #{package.newbasename} was not linked"
@@ -8,7 +8,7 @@ module RepoMate
8
8
 
9
9
  # Init
10
10
  def initialize
11
- @categories = ["stage", "pool", "dists"]
11
+ @categories = ["dists", "pool", "stage"]
12
12
  end
13
13
 
14
14
  # Creates the base structure
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.6
4
+ version: 0.1.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -14,7 +14,7 @@ date: 2012-06-06 00:00:00.000000000Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: slop
17
- requirement: &70318586454540 !ruby/object:Gem::Requirement
17
+ requirement: &70268983483820 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ~>
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: 3.0.4
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *70318586454540
25
+ version_requirements: *70268983483820
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: gpgme
28
- requirement: &70318586453940 !ruby/object:Gem::Requirement
28
+ requirement: &70268983483220 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ~>
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: 2.0.0
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *70318586453940
36
+ version_requirements: *70268983483220
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: sqlite3
39
- requirement: &70318586453340 !ruby/object:Gem::Requirement
39
+ requirement: &70268983482620 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ~>
@@ -44,7 +44,7 @@ dependencies:
44
44
  version: 1.3.6
45
45
  type: :runtime
46
46
  prerelease: false
47
- version_requirements: *70318586453340
47
+ version_requirements: *70268983482620
48
48
  description: A tool to manage Debian repositories
49
49
  email:
50
50
  - flo@doobie.cc