lib/autoproj/ops/cache.rb in autoproj-2.3.1 vs lib/autoproj/ops/cache.rb in autoproj-2.4.0
- old
+ new
@@ -45,11 +45,11 @@
with_retry(10) do
Autobuild::Subprocess.run('autoproj-cache', :import, Autobuild.tool('git'), '--git-dir', pkg.importdir, 'remote', 'update', 'autobuild')
end
with_retry(10) do
- Autobuild::Subprocess.run('autoproj-cache', :import, Autobuild.tool('git'), '--git-dir', pkg.importdir, 'fetch', '--tags')
+ Autobuild::Subprocess.run('autoproj-cache', :import, Autobuild.tool('git'), '--git-dir', pkg.importdir, 'fetch', 'autobuild', '--tags')
end
Autobuild::Subprocess.run('autoproj-cache', :import, Autobuild.tool('git'), '--git-dir', pkg.importdir, 'gc', '--prune=all')
end
def archive_cache_dir
@@ -61,20 +61,31 @@
with_retry(10) do
pkg.importer.update_cache(pkg)
end
end
- def create_or_update(options = Hash.new)
- options = Kernel.validate_options options,
- keep_going: false,
- checkout_only: false
- keep_going = options[:keep_going]
- checkout_only = options[:checkout_only]
-
+ def create_or_update(*package_names, all: true, keep_going: false, checkout_only: false)
FileUtils.mkdir_p cache_dir
- packages = manifest.each_autobuild_package.
- sort_by(&:name)
+ if package_names.empty?
+ packages =
+ if all
+ manifest.each_autobuild_package
+ else
+ manifest.all_selected_source_packages.map(&:autobuild)
+ end
+ else
+ packages = package_names.map do |name|
+ if pkg = manifest.find_autobuild_package(name)
+ pkg
+ else
+ raise PackageNotFound, "no package named #{name}"
+ end
+ end
+ end
+
+ packages = packages.sort_by(&:name)
+
total = packages.size
Autoproj.message "Handling #{total} packages"
packages.each_with_index do |pkg, i|
next if pkg.srcdir != pkg.importdir # No need to process this one, it is uses another package's import
begin