prm 0.2.3 → 0.2.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.
Files changed (3) hide show
  1. data/bin/prm +8 -1
  2. data/lib/prm/repo.rb +25 -6
  3. metadata +4 -4
data/bin/prm CHANGED
@@ -16,13 +16,17 @@ class Main < Clamp::Command
16
16
  option ["-r", "--release"], "RELEASE", "OS version to create", :required => true
17
17
  option ["-a", "--arch"], "ARCH", "Architecture of repo contents", :required => true
18
18
  option ["-c", "--component"], "COMPONENT", "Component to create [DEB ONLY]"
19
+ option ["--nocache"], :flag, "Don't cache md5 sums [DEB ONLY]"
19
20
  option ["--accesskey"], "ACCESS KEY", "DHO/S3 Access Key", :default => false
20
21
  option ["--secretkey"], "SECRET KEY", "DHO/S3 Secret Key", :default => false
21
22
  option ["-d", "--directory"], "DIRECTORY", "Move packages from directory to target", :default => false
22
23
  option ["-s", "--snapshot"], "COMPONENT", "Creates a snapshot of a component", :default => false
23
24
  option ["-e", "--recent"], :flag, "Snapshot the most recent unique packages", :default => false
24
25
  option ["-k", "--gpg"], :flag, "Sign release files with users GPG key", :default => false
25
- option ["-g", "--generate"], :flag , "Generate new repository"
26
+ option ["-g", "--generate"], :flag , "[DEPRECATED 0.2.4]" do
27
+ warn "WARNING: Generate option (--generate) is deprecated\n" +
28
+ "This option will be removed in next stable release (0.3.0)\n"
29
+ end
26
30
 
27
31
  def execute
28
32
  if recent? && !snapshot
@@ -59,6 +63,9 @@ class Main < Clamp::Command
59
63
  unless directory.nil?
60
64
  r.directory = directory
61
65
  end
66
+ if nocache?
67
+ r.nocache = nocache?
68
+ end
62
69
 
63
70
  r.create
64
71
  end
data/lib/prm/repo.rb CHANGED
@@ -12,7 +12,7 @@ require 'arr-pm'
12
12
  require File.join(File.dirname(__FILE__), 'rpm.rb')
13
13
 
14
14
  module Debian
15
- def build_apt_repo(path, component, arch, release, gpg, silent)
15
+ def build_apt_repo(path, component, arch, release, gpg, silent, nocache)
16
16
  release.each { |r|
17
17
  component.each { |c|
18
18
  arch.each { |a|
@@ -90,18 +90,36 @@ module Debian
90
90
  md5sum_path = path + "/dists/" + r + "/" + c + "/" + "binary-" + a + "/md5-results/" + tdeb
91
91
 
92
92
  FileUtils.mkdir_p "tmp/#{tdeb}/"
93
- FileUtils.mkdir_p path + "/dists/" + r + "/" + c + "/" + "binary-" + a + "/md5-results/"
93
+ if not nocache
94
+ FileUtils.mkdir_p path + "/dists/" + r + "/" + c + "/" + "binary-" + a + "/md5-results/"
95
+ end
94
96
  `ar p #{deb} control.tar.gz | tar zx -C tmp/#{tdeb}/`
95
97
 
96
98
  init_size = `wc -c < #{deb}`
97
99
 
98
- if File.exists? md5sum_path
100
+ if deb.split("/").last.to_s == md5sum_path.split("/").last.to_s
101
+
102
+ end
103
+
104
+ if File.exists?("#{md5sum_path}") && nocache.nil?
99
105
  file = File.open(md5sum_path, 'r')
100
106
  md5sum = file.read
101
107
  file.close
102
108
  else
103
109
  md5sum = Digest::MD5.file(deb)
104
- File.open(md5sum_path, 'w') { |file| file.write(md5sum) }
110
+ if nocache.nil?
111
+ File.open(md5sum_path, 'w') { |file| file.write(md5sum) }
112
+ end
113
+ end
114
+
115
+ if File.exists?("#{md5sum_path}") && nocache
116
+ file = File.open(md5sum_path, 'r')
117
+ temp_md5sum = file.read
118
+ file.close
119
+
120
+ if md5sum != temp_md5sum
121
+ puts "WARN: md5sum mismatch on #{deb}\n"
122
+ end
105
123
  end
106
124
 
107
125
  package_info = [
@@ -330,6 +348,7 @@ module PRM
330
348
  attr_accessor :snapshot
331
349
  attr_accessor :directory
332
350
  attr_accessor :recent
351
+ attr_accessor :nocache
333
352
 
334
353
  def create
335
354
  if "#{@type}" == "deb"
@@ -340,13 +359,13 @@ module PRM
340
359
  end
341
360
  if directory
342
361
  silent = true
343
- build_apt_repo(path,pcomponent,parch,prelease,gpg,silent)
362
+ build_apt_repo(path,pcomponent,parch,prelease,gpg,silent,nocache)
344
363
  if move_packages(path,pcomponent,parch,prelease,directory) == false
345
364
  return
346
365
  end
347
366
  end
348
367
  silent = false
349
- build_apt_repo(path,pcomponent,parch,prelease,gpg,silent)
368
+ build_apt_repo(path,pcomponent,parch,prelease,gpg,silent,nocache)
350
369
  elsif "#{@type}" == "sync"
351
370
  sync_to_dho(path, accesskey, secretkey,pcomponent,prelease)
352
371
  elsif "#{@type}" == "rpm"
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: 17
4
+ hash: 29
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 3
10
- version: 0.2.3
9
+ - 5
10
+ version: 0.2.5
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-08-18 00:00:00 -07:00
18
+ date: 2013-09-17 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency