289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
|
# File 'lib/prm/repo.rb', line 289
def sync_to_dho(path, accesskey, secretkey,pcomponent,prelease)
component = pcomponent.join
release = prelease.join
AWS::S3::Base.establish_connection!(
:server => 'objects.dreamhost.com',
:use_ssl => true,
:access_key_id => accesskey,
:secret_access_key => secretkey
)
AWS::S3::Service.buckets.each do |bucket|
unless bucket == path
AWS::S3::Bucket.create(path)
end
end
new_content = Array.new
Find.find(path + "/") do |object|
object.slice!(path + "/")
if (object =~ /deb$/) || (object =~ /Release$/) || (object =~ /Packages.gz$/) || (object =~ /Packages$/) || (object =~ /gpg$/)
f = path + "/" + object
new_content << object
AWS::S3::S3Object.store(
object,
open(f),
path
)
policy = AWS::S3::S3Object.acl(object, path)
policy.grants = [ AWS::S3::ACL::Grant.grant(:public_read) ]
AWS::S3::S3Object.acl(object,path,policy)
end
end
bucket_info = AWS::S3::Bucket.find(path)
bucket_info.each do |obj|
o = obj.key
if (o =~ /deb$/) || (o =~ /Release$/) || (o =~ /Packages.gz$/) || (o =~ /Packages$/) || (o =~ /gpg$/)
unless new_content.include?(o)
AWS::S3::S3Object.delete(o,path)
end
end
end
puts "Your apt repository is located at http://objects.dreamhost.com/#{path}/"
puts "Add the following to your apt sources.list"
puts "deb http://objects.dreamhost.com/#{path}/ #{release} #{component}"
end
|