bin/tpkg in tpkg-2.2.1 vs bin/tpkg in tpkg-2.2.2

- old
+ new

@@ -1,8 +1,10 @@ #!/usr/bin/ruby -w ############################################################################## -# tpkg package management and deployment tool +# tpkg package management system +# Copyright 2009, 2010, 2011 AT&T Interactive +# License: MIT (http://www.opensource.org/licenses/mit-license.php) ############################################################################## # Ensure we can find tpkg.rb $:.unshift File.join(File.dirname(__FILE__), "..", "lib") @@ -453,13 +455,13 @@ ret_val = 0 case @action when :make @other_options[:force] = @force @other_options[:compress] = @compress - pkgfile = Tpkg::make_package(@action_value, passphrase_callback, @other_options) - if pkgfile - puts "Package is #{pkgfile}" + madepkg = Tpkg::make_package(@action_value, passphrase_callback, @other_options) + if madepkg + puts "Package is #{madepkg}" else puts "Package build aborted or failed" end when :extract Tpkg::extract_metadata(@action_value) @@ -504,26 +506,26 @@ raise "You didn't specify what init command to run" end ret_val = tpkg.execute_init(@init_options) when :query_installed tpkg = instantiate_tpkg(@tpkg_options) - req = nil + queryreq = nil matches = [] if @action_value @action_value.each do | value | - req = Tpkg::parse_request(value, tpkg.installed_directory) - match = tpkg.installed_packages_that_meet_requirement(req) + queryreq = Tpkg::parse_request(value, tpkg.installed_directory) + match = tpkg.installed_packages_that_meet_requirement(queryreq) # If the user requested specific packages and we found no matches # then exit with a non-zero value to indicate failure. This allows # command-line syntax like "tpkg -q foo || tpkg -i foo" to ensure # that a package is installed. ret_val = 1 if match.empty? matches |= match end else - matches = tpkg.installed_packages_that_meet_requirement(req) + matches = tpkg.installed_packages_that_meet_requirement(queryreq) end if !@quiet matches.sort(&Tpkg::SORT_PACKAGES).each do |pkg| puts pkg[:metadata][:filename] @@ -569,27 +571,27 @@ end when :query_list_files tpkg = instantiate_tpkg(@tpkg_options) pkgfiles = nil if File.exist?(@action_value) - fip = Tpkg::files_in_package(@action_value) - tpkg.normalize_paths(fip) + fipfile = Tpkg::files_in_package(@action_value) + tpkg.normalize_paths(fipfile) puts "#{@action_value}:" - fip[:normalized].each { |file| puts file } + fipfile[:normalized].each { |file| puts file } else pkgfiles = [] metadatas = [] requirements = [] packages = {} - req = Tpkg::parse_request(@action_value) - pkgs = tpkg.installed_packages_that_meet_requirement(req) - if pkgs.nil? or pkgs.empty? + queryreq = Tpkg::parse_request(@action_value) + instpkgs = tpkg.installed_packages_that_meet_requirement(queryreq) + if instpkgs.nil? or instpkgs.empty? ret_val = 1 puts "Could not find any installed packages that meet the request \"#{@action_value}\"" end - pkgs.each do | pkg | + instpkgs.each do | pkg | pkgfiles << pkg[:metadata][:filename] end files = tpkg.files_for_installed_packages(pkgfiles) files.each do |pkgfile, fip| @@ -606,15 +608,15 @@ end end end when :query_available tpkg = instantiate_tpkg(@tpkg_options) - req = nil + queryreq = nil if @action_value - req = Tpkg::parse_request(@action_value) + queryreq = Tpkg::parse_request(@action_value) end - tpkg.available_packages_that_meet_requirement(req).each do |pkg| + tpkg.available_packages_that_meet_requirement(queryreq).each do |pkg| next if pkg[:source] == :native_installed next if pkg[:source] == :native_available puts "#{pkg[:metadata][:filename]} (#{pkg[:source]})" end when :query_requires @@ -647,12 +649,12 @@ end end end when :query_local_depends tpkg = instantiate_tpkg(@tpkg_options) - req = Tpkg::parse_request(@action_value) - pkgs = tpkg.installed_packages_that_meet_requirement(req) - pkgs.each do | pkg | + queryreq = Tpkg::parse_request(@action_value) + instpkgs = tpkg.installed_packages_that_meet_requirement(queryreq) + instpkgs.each do | pkg | puts pkg[:metadata][:filename] + ':' if pkg[:metadata][:dependencies] pkg[:metadata][:dependencies].each do |req| puts " Requires #{req[:name]}" req.each do |field, value|