Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix version causing build signature issues #445

Merged
merged 2 commits into from
Sep 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 16 additions & 9 deletions charmtools/build/tactics.py
Original file line number Diff line number Diff line change
Expand Up @@ -955,6 +955,7 @@ def __init__(self, charm, target, layer, next_config):
super(VersionTactic, self).__init__(
charm / self.FILENAME, target, layer, next_config)
self.charm = charm
self.wrote_sha = False

def read(self):
if self.entity.isfile():
Expand All @@ -973,7 +974,7 @@ def trigger(cls, entity, target, layer, next_config):

def _try_to_get_current_sha(self):
cmds = (
('git', 'describe', '--dirty'),
('git', 'describe', '--dirty', '--always'),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For reference:

[johnsca@murdoch:~ … layers/vault/src] $ git describe --dirty
fatal: No names found, cannot describe anything.
[johnsca@murdoch:~ … layers/vault/src] $ git describe --dirty --always
f5ba548-dirty

('bzr', 'version-info'),
('hg', 'id', '-n'),
)
Expand All @@ -995,21 +996,27 @@ def __call__(self):
if new_sha and old_sha and new_sha != old_sha:
log.warn(
("version {} is out of update, new sha {} "
"will be used!").format(old_sha, new_sha))
"will be used!").format(old_sha, new_sha))
sha = new_sha or old_sha
if sha:
self.target_file.write_bytes(sha.encode())
self.wrote_sha = True
else:
self.wrote_sha = False

def sign(self):
"""return sign in the form {relpath: (origin layer, SHA256)}
"""
return {
self.target_file.relpath(self.target.directory): (
self.layer.url,
self.kind,
utils.sign(self.target_file)
)
}
if self.wrote_sha:
return {
self.target_file.relpath(self.target.directory): (
self.layer.url,
"dynamic",
utils.sign(self.target_file)
)
}
else:
return {}

def __str__(self):
return "Ensuring {}".format(self.entity)
Expand Down
1 change: 1 addition & 0 deletions helpers/snap-wrappers/charm
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ warn "from strict to classic. For security reasons, updates will be blocked unti
warn "you manually refresh to authorize the new confinement by doing the following:"
warn ""
warn " sudo snap refresh charm --classic"
warn ""

exec "$SNAP/bin/charm" "$@"