Skip to content

Commit

Permalink
Add --dirty to git describe
Browse files Browse the repository at this point in the history
  • Loading branch information
carlcsaposs-canonical committed Oct 13, 2023
1 parent d5e90e9 commit ec1d987
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ allowlist_externals =
{[testenv]allowlist_externals}
charmcraft
mv
cp
commands_pre =
poetry export --only main,charm-libs --output requirements.txt
# Workaround to add unique identifier (git hash) to charm version while specification
# DA053 - Charm versioning
# (https://docs.google.com/document/d/1Jv1jhWLl8ejK3iJn7Q3VbCIM9GIhp8926bgXpdtx-Sg/edit?pli=1)
# is pending review.
cp charm_version charm_version.backup
python -c 'import pathlib; import subprocess; file = pathlib.Path("charm_version"); version = file.read_text().strip(); git_hash=subprocess.run(["git", "describe", "--always"], capture_output=True, check=True, encoding="utf-8").stdout; file.write_text(f"{version}+{git_hash}")'
python -c 'import pathlib; import shutil; import subprocess; git_hash=subprocess.run(["git", "describe", "--always", "--dirty"], capture_output=True, check=True, encoding="utf-8").stdout; file = pathlib.Path("charm_version"); shutil.copy(file, pathlib.Path("charm_version.backup")); version = file.read_text().strip(); file.write_text(f"{version}+{git_hash}")'

poetry export --only main,charm-libs --output requirements.txt
commands =
build: charmcraft pack {posargs}
commands_post =
Expand Down

0 comments on commit ec1d987

Please sign in to comment.