deb-s3 0.9.3 → 0.10.0

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: 9e8dbe12df60c668bf2f6469b90d6cdd1cd81325
4
- data.tar.gz: 0107fe0bd5e38e79a39046ebeb19566b647e3865
3
+ metadata.gz: 49885adda26d9a194e593feb9db2ff154d697951
4
+ data.tar.gz: 65f61dd1e945500c9ead7bc772932d8769c7c45a
5
5
  SHA512:
6
- metadata.gz: 79b208495ff06a5e68a0a6ccb6829fc8bf0b7ef99a78eb33959e688e27ac9407e9f19d1ab6af3e4c90056fb46dd6b354de43e26b1d43df16ed76a586a057c7de
7
- data.tar.gz: 720fc4fc1585841872a49e1572a88107adad1b404e65be6984fff915062aa30f9e63ba31215020606e082cbba108506750c63d30a01bdcbd4437c392dec689aa
6
+ metadata.gz: 78d6217e6414568658bc3b2707fc53865bb52a6ec5fdf48d43d496ad888dd5e96f5882a0d0e7c22b9ff92162a62f7387590b1434deb1ea392a5bc5482c859d5d
7
+ data.tar.gz: f33a94764a6b2d6e92984a99e9458a11b8dea8148b48285936a41bfd743b9c6f631611246bb56ea87fee124c5dedae6311773a4796a1ece4d81abf0aa0651c7a
data/README.md CHANGED
@@ -64,7 +64,7 @@ Options:
64
64
  -a, [--arch=ARCH] # The architecture of the package in the APT repository.
65
65
  -p, [--preserve-versions], [--no-preserve-versions] # Whether to preserve other versions of a package in the repository when uploading one.
66
66
  -l, [--lock], [--no-lock] # Whether to check for an existing lock on the repository to prevent simultaneous updates
67
- [--fail-if-exists], [--no-fail-if-exists] # Whether to overwrite any existing package that has the same filename in the pool or the same name and version in the manifest.
67
+ [--fail-if-exists], [--no-fail-if-exists] # Whether to overwrite any existing package that has the same filename in the pool or the same name and version in the manifest but different contents.
68
68
  [--skip-package-upload], [--no-skip-package-upload] # Whether to skip all package uploads.This is useful when hosting .deb files outside of the bucket.
69
69
  -b, [--bucket=BUCKET] # The name of the S3 bucket to upload to.
70
70
  [--prefix=PREFIX] # The path prefix to use when storing on S3.
@@ -1,6 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module Deb
3
3
  module S3
4
- VERSION = "0.9.3"
4
+ VERSION = "0.10.0"
5
5
  end
6
6
  end
@@ -138,7 +138,8 @@ class Deb::S3::CLI < Thor
138
138
  :default => false,
139
139
  :type => :boolean,
140
140
  :desc => "Whether to overwrite any existing package that has the same " +
141
- "filename in the pool or the same name and version in the manifest."
141
+ "filename in the pool or the same name and version in the manifest but " +
142
+ "different contents."
142
143
 
143
144
  option :skip_package_upload,
144
145
  :default => false,
@@ -62,11 +62,11 @@ class Deb::S3::Manifest
62
62
  packages.each { |p|
63
63
  next unless p.name == pkg.name && \
64
64
  p.full_version == pkg.full_version && \
65
- File.basename(p.url_filename) != \
66
- File.basename(pkg.url_filename)
65
+ File.basename(p.url_filename(@codename)) != \
66
+ File.basename(pkg.url_filename(@codename))
67
67
  raise AlreadyExistsError,
68
68
  "package #{pkg.name}_#{pkg.full_version} already exists " \
69
- "with different filename (#{p.url_filename})"
69
+ "with different filename (#{p.url_filename(@codename)})"
70
70
  }
71
71
  end
72
72
  if preserve_versions
@@ -96,7 +96,7 @@ class Deb::S3::Manifest
96
96
  end
97
97
 
98
98
  def generate
99
- @packages.collect { |pkg| pkg.generate }.join("\n")
99
+ @packages.collect { |pkg| pkg.generate(@codename) }.join("\n")
100
100
  end
101
101
 
102
102
  def write_to_s3
@@ -105,8 +105,8 @@ class Deb::S3::Manifest
105
105
  unless self.skip_package_upload
106
106
  # store any packages that need to be stored
107
107
  @packages_to_be_upload.each do |pkg|
108
- yield pkg.url_filename if block_given?
109
- s3_store(pkg.filename, pkg.url_filename, 'application/octet-stream; charset=binary', self.cache_control, self.fail_if_exists)
108
+ yield pkg.url_filename(@codename) if block_given?
109
+ s3_store(pkg.filename, pkg.url_filename(@codename), 'application/octet-stream; charset=binary', self.cache_control, self.fail_if_exists)
110
110
  end
111
111
  end
112
112
 
@@ -116,7 +116,7 @@ class Deb::S3::Manifest
116
116
  pkgs_temp.close
117
117
  f = "dists/#{@codename}/#{@component}/binary-#{@architecture}/Packages"
118
118
  yield f if block_given?
119
- s3_store(pkgs_temp.path, f, 'text/plain; charset=UTF-8', self.cache_control)
119
+ s3_store(pkgs_temp.path, f, 'text/plain; charset=utf-8', self.cache_control)
120
120
  @files["#{@component}/binary-#{@architecture}/Packages"] = hashfile(pkgs_temp.path)
121
121
  pkgs_temp.unlink
122
122
 
@@ -127,15 +127,15 @@ class Deb::S3::Package
127
127
  @filename
128
128
  end
129
129
 
130
- def url_filename
131
- @url_filename || "pool/#{self.name[0]}/#{self.name[0..1]}/#{File.basename(self.filename)}"
130
+ def url_filename(codename)
131
+ @url_filename || "pool/#{codename}/#{self.name[0]}/#{self.name[0..1]}/#{File.basename(self.filename)}"
132
132
  end
133
133
 
134
- def url_filename_encoded
135
- @url_filename || "pool/#{self.name[0]}/#{self.name[0..1]}/#{s3_escape(File.basename(self.filename))}"
134
+ def url_filename_encoded(codename)
135
+ @url_filename || "pool/#{codename}/#{self.name[0]}/#{self.name[0..1]}/#{s3_escape(File.basename(self.filename))}"
136
136
  end
137
137
 
138
- def generate
138
+ def generate(codename)
139
139
  template("package.erb").result(binding)
140
140
  end
141
141
 
@@ -98,7 +98,7 @@ class Deb::S3::Release
98
98
  release_tmp.puts self.generate
99
99
  release_tmp.close
100
100
  yield self.filename if block_given?
101
- s3_store(release_tmp.path, self.filename, 'text/plain; charset=UTF-8', self.cache_control)
101
+ s3_store(release_tmp.path, self.filename, 'text/plain; charset=utf-8', self.cache_control)
102
102
 
103
103
  # sign the file, if necessary
104
104
  if Deb::S3::Utils.signing_key
@@ -40,7 +40,7 @@ Origin: <%= attributes[:deb_origin] %>
40
40
  <% end -%>
41
41
  Priority: <%= attributes[:deb_priority] %>
42
42
  Homepage: <%= url or "http://nourlgiven.example.com/" %>
43
- Filename: <%= url_filename_encoded %>
43
+ Filename: <%= url_filename_encoded(codename) %>
44
44
  <% if size -%>
45
45
  Size: <%= size %>
46
46
  <% end -%>
@@ -82,7 +82,7 @@ module Deb::S3::Utils
82
82
  # check if the object already exists
83
83
  if obj != false
84
84
  return if (file_md5.to_s == obj[:etag].gsub('"', '') or file_md5.to_s == obj[:metadata]['md5'])
85
- raise AlreadyExistsError, "file #{obj.public_url} already exists with different contents" if fail_if_exists
85
+ raise AlreadyExistsError, "file #{filename} already exists with different contents" if fail_if_exists
86
86
  end
87
87
 
88
88
  options = {
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deb-s3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.3
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ken Robertson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-17 00:00:00.000000000 Z
11
+ date: 2018-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor