Skip to content

Commit

Permalink
adding --fingerprint option for autoproj versions
Browse files Browse the repository at this point in the history
  • Loading branch information
sbolivarm committed Mar 14, 2019
1 parent 71f4cde commit 3ebce73
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 3 deletions.
2 changes: 2 additions & 0 deletions lib/autoproj/cli/main.rb
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,8 @@ def osdeps(*packages)
desc: 'whether we should access the remote server to verify that the snapshotted state is present'
option :save, type: :string,
desc: 'save to the given file instead of displaying it on the standard output'
option :fingerprint, type: :boolean, default: false,
desc: 'calculate unique fingerprint for each package'
def versions(*packages)
run_autoproj_cli(:versions, :Versions, Hash[], *packages, deps: true)
end
Expand Down
5 changes: 4 additions & 1 deletion lib/autoproj/cli/versions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ def run(user_selection, options)
versions += ops.snapshot_package_sets(nil, only_local: options[:only_local])
end
if snapshot_packages
versions += ops.snapshot_packages(packages, nil, only_local: options[:only_local])
versions += ops.snapshot_packages(packages,
nil,
only_local: options[:only_local],
fingerprint: options[:fingerprint])
end

if output_file = options[:save]
Expand Down
6 changes: 4 additions & 2 deletions lib/autoproj/ops/snapshot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def error_or_warn(package, error)
end
end

def snapshot_packages(packages, target_dir = nil, only_local: true)
def snapshot_packages(packages, target_dir = nil, only_local: true, fingerprint: false)
result = Array.new
packages.each do |package_name|
package = manifest.find_package_definition(package_name)
Expand All @@ -140,7 +140,9 @@ def snapshot_packages(packages, target_dir = nil, only_local: true)
next
end

vcs_info['fingerprint'] = package.autobuild.fingerprint
if fingerprint
vcs_info['fingerprint'] = package.autobuild.fingerprint
end

if vcs_info
result << Hash[package_name, vcs_info]
Expand Down
1 change: 1 addition & 0 deletions shell/completion/autoproj_bash
Original file line number Diff line number Diff line change
Expand Up @@ -1062,6 +1062,7 @@ __autoproj_versions() {
--local
--no-local
--save
--fingerprint
"

case "$cur" in
Expand Down
1 change: 1 addition & 0 deletions shell/completion/autoproj_zsh
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,7 @@ __autoproj_versions() {
{--deps,--no-deps}'[whether both packages and their dependencies should be versioned, or only the selected packages (the latter is the default)]' \
{--local,--no-local}'[whether we should access the remote server to verify that the snapshotted state is present]' \
--save'[save to the given file instead of displaying it on the standard output]' \
--fingerprint'[calculate unique fingerprint for each package]' \
'*:arg:_autoproj_installed_packages'
}

Expand Down

0 comments on commit 3ebce73

Please sign in to comment.