reaper-man 0.1.2 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b65c616d8cb213ea551b5f0b2cf1a426544f6b6c
4
- data.tar.gz: 6082d657d10e1db68a2adca5e00e950b25505a46
3
+ metadata.gz: 2a9fa742e2b634580a7bbcf8c2fecec0f4aa7475
4
+ data.tar.gz: e5fbbbef5da442fbf19d79eae0076e09461222c6
5
5
  SHA512:
6
- metadata.gz: ea0688fa54abfef33864fa2830c040c8891cd0948f4ff5dd3db26253fcdaf36e793708921f05ddb66d80023f9bd50b37f7be6579afd0884c13133b6a593aee04
7
- data.tar.gz: 889dc2c1f5159d243f4ab52ba60e0e1be259075b5ffac13b8723e8fddd80c03d2eda0f6092ffe2c8a08848e96d49da58610921891ecb514f3e70e2ab0d4207e0
6
+ metadata.gz: a4adefa68d4ade7620ac4d88151f361bef6b6e31beccd24bc1f08a4a90225527ec8b80e8dd7ef259e2da01520655e2bf6d1849cddb264d2eaebb9c3fe3b6b5c4
7
+ data.tar.gz: f5c489deda65dbb86073cb34b7b247a4fd32fc8261d0920c97b02eeca2d0def7bb18239da10902ed415ef6ac29b6ca7fea0bc263c9b4d95d946af4d4a7b8655c
@@ -1,3 +1,7 @@
1
+ # v0.1.4
2
+ * [fix] fix package and repository signing for deb/apt
3
+ * [enhancement] allow passing mix of files/directories for signing
4
+
1
5
  # v0.1.2
2
6
  * [fix] properly prefix generated deb package path (GH#1)
3
7
 
data/README.md CHANGED
@@ -6,10 +6,12 @@ Grow code, harvest packages
6
6
 
7
7
  ### Harvests
8
8
 
9
- Package repository is maintained via `JSON` file. Packages are added or removed
10
- from the `JSON` registry. Repository generation will result in skeleton repository
11
- with the proper `Release` and `Packages` files. Package paths will be not exist
12
- within the generated repository. Resolving that issue is left to the reader.
9
+ Reaper man generates a `JSON` registry that describes one or more package repositories
10
+ that can be used to generate the expected repository file system. Packages are added
11
+ or removed from the registry, and regeneration of the repository file system is fast
12
+ and simple. The generated repository file system will refer to the referenced packages
13
+ but will not actually contain the referenced packages. Storage of the actual package
14
+ assets (and the delivery of said assets) is left to the reader.
13
15
 
14
16
  ### Support
15
17
 
@@ -50,6 +52,14 @@ or remove a specific version
50
52
 
51
53
  This can also be used to update an existing repository structure.
52
54
 
55
+ ### Dependencies
56
+
57
+ Commands that must be available within the path:
58
+
59
+ * `gpg`
60
+ * `debsigs`
61
+ * `expect`
62
+
53
63
  ## Infos
54
64
  * Repository: https://github.com/hw-labs/reaper-man
55
65
  * IRC: Freenode @ #heavywater
@@ -71,7 +71,7 @@ Bogo::Cli::Setup.define do
71
71
 
72
72
  command :sign do
73
73
  description 'Sign package(s)'
74
-
74
+ instance_exec(&common_options)
75
75
  on :S, :'package-system=', 'Packaging system to generate repository (apt/yum/rubygems/supermarket)', :required => true
76
76
  on :Z, :'signing-chunk-size=', 'Number of packages to sign at once', :default => 20, :as => Integer
77
77
 
@@ -13,7 +13,8 @@ module ReaperMan
13
13
  Smash.new(
14
14
  :package_config => MultiJson.load(
15
15
  File.read(config[:packages_file])
16
- ).to_smash
16
+ ).to_smash,
17
+ :signer => config[:sign] ? Signer.new(config) : nil
17
18
  )
18
19
  )
19
20
  ).generate!
@@ -5,15 +5,27 @@ module ReaperMan
5
5
  class Sign < Command
6
6
 
7
7
  def execute!
8
+ files = arguments.map do |item|
9
+ if(File.file?(item))
10
+ item
11
+ else
12
+ File.directory?(item)
13
+ i_files = Dir.glob(File.join(item, '**', '*'))
14
+ i_files.delete_if do |path|
15
+ !File.file?(path)
16
+ end
17
+ i_files
18
+ end
19
+ end.flatten.compact.uniq
8
20
  run_action 'Signing file(s)' do
9
21
  signer = Signer.new(config)
10
- files = Dir.glob(File.join(arguments.first, '**', '*'))
11
- files.delete_if do |path|
12
- !File.file?(path)
13
- end
14
22
  signer.package(*files)
15
23
  nil
16
24
  end
25
+ ui.info "Files signed:"
26
+ files.sort.each do |path|
27
+ ui.puts " #{ui.color(File.expand_path(path), :yellow)}"
28
+ end
17
29
  end
18
30
 
19
31
  end
@@ -36,6 +36,15 @@ module ReaperMan
36
36
  end.compact
37
37
  ]
38
38
  release_headers['Components'] = dist_args[:components].keys.join(' ')
39
+ signed = sign_file_if_setup('--clearsign') do
40
+ release_file(origin_name, dist_name, release_headers)
41
+ end
42
+ if(File.exists?("#{signed}.gpg"))
43
+ FileUtils.mv(
44
+ "#{signed}.gpg",
45
+ File.join(File.dirname(signed), 'InRelease')
46
+ )
47
+ end
39
48
  sign_file_if_setup do
40
49
  release_file(origin_name, dist_name, release_headers)
41
50
  end
@@ -48,10 +57,10 @@ module ReaperMan
48
57
  #
49
58
  # @yield block returning file path
50
59
  # @return [String] file path
51
- def sign_file_if_setup
60
+ def sign_file_if_setup(opts=nil)
52
61
  path = yield
53
62
  if(signer && options[:sign])
54
- signer.file(path)
63
+ signer.file(path, nil, opts)
55
64
  end
56
65
  path
57
66
  end
@@ -16,6 +16,12 @@ module ReaperMan
16
16
  attr_reader :package_system
17
17
  attr_reader :key_password
18
18
 
19
+ # command to use for file signing
20
+ HELPER_COMMAND = File.join(
21
+ File.expand_path(File.dirname(__FILE__)),
22
+ 'util-scripts/auto-helper'
23
+ )
24
+
19
25
  # Create new instance
20
26
  #
21
27
  # @param args [Hash]
@@ -48,12 +54,21 @@ module ReaperMan
48
54
  # @param src [String] path to source file
49
55
  # @param dst [String] path for destination file
50
56
  # @return [String] destination file path
51
- def file(src, dst=nil)
52
- opts = ['--detach-sign', '--armor']
57
+ def file(src, dst=nil, sign_opts=nil)
58
+ opts = sign_opts ? [sign_opts].flatten.compact : ['--detach-sign', '--armor']
53
59
  dst ||= src.sub(/#{Regexp.escape(File.extname(src))}$/, '.gpg')
54
60
  opts << "--output '#{dst}'"
55
- cmd = (['gpg'] + opts + [src]).join(' ')
56
- shellout!(cmd)
61
+ cmd = (["gpg --default-key #{key_id}"] + opts + [src]).join(' ')
62
+ if(key_password)
63
+ shellout(
64
+ "#{HELPER_COMMAND} #{cmd}",
65
+ :environment => {
66
+ 'REAPER_KEY_PASSWORD' => key_password
67
+ }
68
+ )
69
+ else
70
+ shellout(cmd)
71
+ end
57
72
  dst
58
73
  end
59
74
 
@@ -5,12 +5,6 @@ module ReaperMan
5
5
  # Signing methods for deb files
6
6
  module Deb
7
7
 
8
- # command to use for file signing
9
- SIGN_COMMAND = File.join(
10
- File.expand_path(File.join(File.dirname(__FILE__), '..')),
11
- 'util-scripts/auto-debsigs'
12
- )
13
-
14
8
  # Sign given files
15
9
  #
16
10
  # @param pkgs [String] list of file paths
@@ -18,15 +12,16 @@ module ReaperMan
18
12
  def package(*pkgs)
19
13
  pkgs = valid_packages(*pkgs)
20
14
  pkgs.each_slice(sign_chunk_size) do |pkgs|
15
+ cmd = %(debsigs --sign="#{sign_type}" --default-key="#{key_id}" #{pkgs.join(' ')})
21
16
  if(key_password)
22
17
  shellout(
23
- "#{SIGN_COMMAND} #{sign_type} #{key_id} #{pkgs.join(' ')}",
18
+ "#{Signer::HELPER_COMMAND} #{cmd}",
24
19
  :environment => {
25
20
  'REAPER_KEY_PASSWORD' => key_password
26
21
  }
27
22
  )
28
23
  else
29
- shellout(%w(debsigs --sign="#{sign_type}" --default-key="#{key_id}" #{pkgs.join(' ')}))
24
+ shellout(cmd)
30
25
  end
31
26
  end
32
27
  true
@@ -4,14 +4,12 @@ log_user 0
4
4
 
5
5
  set timeout 3
6
6
 
7
- set signtype [lindex $argv 0]
8
- set signkey [lindex $argv 1]
9
- set package [join [lrange $argv 2 [llength $argv]] " "]
7
+ set commandstring [join [lrange $argv 0 [llength $argv]] " "]
10
8
 
11
9
  spawn /bin/bash
12
10
  expect {
13
11
  -re ".*\$ *$" {
14
- send "/usr/bin/debsigs --sign=\"$signtype\" --default-key=\"$signkey\" $package\r"
12
+ send "$commandstring\r"
15
13
  }
16
14
  timeout { exit 1 }
17
15
  }
@@ -1,4 +1,4 @@
1
1
  module ReaperMan
2
2
  # current library version
3
- VERSION = Gem::Version.new('0.1.2')
3
+ VERSION = Gem::Version.new('0.1.4')
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reaper-man
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Roberts
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-15 00:00:00.000000000 Z
11
+ date: 2015-07-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bogo-cli
@@ -84,7 +84,7 @@ files:
84
84
  - lib/reaper-man/signer.rb
85
85
  - lib/reaper-man/signer/deb.rb
86
86
  - lib/reaper-man/signer/rubygems.rb
87
- - lib/reaper-man/util-scripts/auto-debsigs
87
+ - lib/reaper-man/util-scripts/auto-helper
88
88
  - lib/reaper-man/utils.rb
89
89
  - lib/reaper-man/utils/process.rb
90
90
  - lib/reaper-man/version.rb