diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index e17ef8d..2a4103d 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -14,7 +14,12 @@ jobs: with: python-version: "3.9" - name: Install dependencies - run: sudo apt-get install libcairo2-dev gcc python3-dev libgirepository1.0-dev libostree-dev fuse-overlayfs libcap-dev autoconf && python -m pip install -r requirements.txt && python -m pip install pylint + run: | + sudo apt-get update + sudo apt-get install libcairo2-dev gcc python3-dev libgirepository1.0-dev libostree-dev\ + fuse-overlayfs libcap-dev autoconf + python -m pip install -r requirements.txt + python -m pip install pylint - name: pylint run: pylint --rcfile pylint.toml src/maps diff --git a/CHANGELOG.md b/CHANGELOG.md index b20253c..fa3286c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project tries to adhere to [Semantic Versioning](https://semver.org/spe already installed. ### Changed +- Debugfix: Added some debugging info and mildly rework uninstall. ### Removed diff --git a/src/maps b/src/maps index fad4eaf..ced81ec 100755 --- a/src/maps +++ b/src/maps @@ -752,10 +752,20 @@ def uninstall_runtime(repo, args): opts = '-rvf' else: opts = '-rf' - subprocess.run(f"rm {opts} {DATADIR}".split(), check=True) + + try: + subprocess.run(f"rm {opts} {DATADIR}".split(), check=True) + except subprocess.CalledProcessError as e: + print( + "Removing files failed... This can sometimes happen if maps was killed instead of " + "graceful termination. Check the error message for which directory failed removal. " + f"\n\n{e}" + ) for sruntime in repo.list_refs()[1].keys(): if runtime in sruntime: + if remote == '_local': + remote = None FLAG_REFEXISTS = True if VERBOSE: print("Marking branch for deletion from repo...") @@ -766,8 +776,20 @@ def uninstall_runtime(repo, args): break if not (FLAG_DIREXISTS and FLAG_REFEXISTS): - print(f"Error, {remote}:{runtime} isn't deployed and thus cannot be uninstalled!") - sys.exit(2) + if VERBOSE: + print(f"FLAG_DIREXISTS: {FLAG_DIREXISTS}") + print(f"FLAG_REFEXISTS: {FLAG_REFEXISTS}") + if not remote: + remote = '_local' + if not FLAG_DIREXISTS and not FLAG_REFEXISTS: + print(f"Error, {remote}:{runtime} isn't deployed and thus cannot be uninstalled!") + sys.exit(2) + elif FLAG_DIREXISTS: + print(f"{remote}:{runtime} was not present in the local runtime, but was deployed on " + "the filesystem. Files were removed!") + elif FLAG_REFEXISTS: + print(f"{remote}:{runtime} was not deployed on the filesystem. Pruned from the local " + "repository!") else: print(f"Uninstalled {runtime} !")