lib/autoproj/ops/snapshot.rb in autoproj-1.13.7 vs lib/autoproj/ops/snapshot.rb in autoproj-2.0.0.b1
- old
+ new
@@ -163,37 +163,32 @@
raise ArgumentError, "cannot use autoproj auto-import feature if the main configuration is not managed under git"
end
pkg
end
- def import_state_log_ref
+ def self.import_state_log_ref
"refs/autoproj"
end
DEFAULT_VERSIONS_FILE_BASENAME = "50-versions.yml"
def import_state_log_file
- File.join(OVERRIDES_DIR, DEFAULT_VERSIONS_FILE_BASENAME)
+ File.join(Workspace::OVERRIDES_DIR, DEFAULT_VERSIONS_FILE_BASENAME)
end
def current_import_state
main = import_state_log_package
# Try to resolve the log ref, and extract the version file from it
begin
- #package importer might be nil during bootstrapping
- if main.importer.nil?
- return Array.new
- end
- yaml = main.importer.show(main, import_state_log_ref, import_state_log_file)
+ yaml = main.importer.show(main, self.class.import_state_log_ref, import_state_log_file)
YAML.load(yaml) || Array.new
rescue Autobuild::PackageException
Array.new
end
end
def update_package_import_state(name, packages)
- return if import_state_log_package.importer.nil? #We cannot create states for packages without a importer
current_versions = current_import_state
if current_versions.empty?
# Do a full snapshot this time only
Autoproj.message " building initial autoproj import log, this may take a while"
packages = manifest.all_selected_packages.
@@ -209,16 +204,16 @@
versions = sort_versions(versions)
main = import_state_log_package
git_dir = main.importer.git_dir(main, false)
# Ensure that our ref is being logged
- FileUtils.touch File.join(git_dir, 'logs', *import_state_log_ref.split("/"))
+ FileUtils.touch File.join(git_dir, 'logs', *self.class.import_state_log_ref.split("/"))
# Create the commit with the versions info
commit_id = Snapshot.create_commit(main, import_state_log_file, name) do |io|
YAML.dump(versions, io)
end
# And save it in our reflog
- main.importer.run_git_bare(main, "update-ref", '-m', name, import_state_log_ref, commit_id)
+ main.importer.run_git_bare(main, "update-ref", '-m', name, self.class.import_state_log_ref, commit_id)
end
# Create a git commit in which a file contains provided content
#
# The target git repository's current index and history is left