Skip to content

Commit

Permalink
Add exist command for batch of packages verification
Browse files Browse the repository at this point in the history
  • Loading branch information
dkijania committed Oct 28, 2024
1 parent 8978b96 commit 5b368b2
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/deb/s3.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- encoding : utf-8 -*-
module Deb
module S3
VERSION = "0.11.6"
VERSION = "0.11.7"
end
end
34 changes: 33 additions & 1 deletion lib/deb/s3/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ def list
desc "show PACKAGE VERSION ARCH", "Shows information about a package."

def show(package_name, version, arch)
if version.nil?
if package_name.nil?
error "You must specify the name of the package to show."
end
if version.nil?
Expand All @@ -366,6 +366,38 @@ def show(package_name, version, arch)
puts package.generate(options[:codename])
end

desc "exist PACKAGES VERSION ARCH", "Check if packages exists in repository."

def exist(package_names, version, arch)
if package_names.nil?
error "You must specify the named of the packages to verify."
end
if version.nil?
error "You must specify the version of the packages to verify."
end
if arch.nil?
error "You must specify the architecture of the packages to verify."
end

configure_s3_client

# retrieve the existing manifests
manifest = Deb::S3::Manifest.retrieve(options[:codename], component, arch,
options[:cache_control], false, false)

package_names.split.each{ |package_name|
package = manifest.packages.detect { |p|
p.name == package_name && p.full_version == version
}
if package.nil?
puts "#{package_name} : Missing"
else
puts "#{package_name} : Found"
end
}
end


desc "copy PACKAGE TO_CODENAME TO_COMPONENT ",
"Copy the package named PACKAGE to given codename and component. If --versions is not specified, copy all versions of PACKAGE. Otherwise, only the specified versions will be copied. Source codename and component is given by --codename and --component options."

Expand Down

0 comments on commit 5b368b2

Please sign in to comment.