Print error messages when necessary
This commit is contained in:
parent
d683c08889
commit
7bedb53f65
@ -1,6 +1,14 @@
|
|||||||
Changelog for packaging-scripts
|
Changelog for packaging-scripts
|
||||||
===============================
|
===============================
|
||||||
|
|
||||||
|
Version 1.6.0
|
||||||
|
-------------
|
||||||
|
|
||||||
|
* pug2
|
||||||
|
|
||||||
|
* Print error messages from gist when necessary
|
||||||
|
|
||||||
|
|
||||||
Version 1.5.3
|
Version 1.5.3
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
|
21
bin/pug2
21
bin/pug2
@ -82,20 +82,39 @@ if __name__ == "__main__":
|
|||||||
gist_id = config.get(CONFIG_SECTION, CONFIG_OPTION_ID)
|
gist_id = config.get(CONFIG_SECTION, CONFIG_OPTION_ID)
|
||||||
|
|
||||||
if gist_id == "":
|
if gist_id == "":
|
||||||
|
try:
|
||||||
print("No gist ID detected, creating new.")
|
print("No gist ID detected, creating new.")
|
||||||
gist_process = subprocess.run(
|
gist_process = subprocess.run(
|
||||||
f"pacman -Qqen | gist --filename {gist_filename} --description {gist_description}",
|
f"pacman -Qqen | gist --filename {gist_filename} --description {gist_description}",
|
||||||
capture_output=True,
|
capture_output=True,
|
||||||
|
text=True,
|
||||||
shell=True,
|
shell=True,
|
||||||
|
check=True,
|
||||||
)
|
)
|
||||||
config[CONFIG_SECTION][CONFIG_OPTION_ID] = extract_gist_id(gist_process.stdout)
|
except subprocess.CalledProcessError as e:
|
||||||
|
print(e.stdout.strip(), file=sys.stderr)
|
||||||
|
sys.exit(e.returncode)
|
||||||
|
else:
|
||||||
|
config[CONFIG_SECTION][CONFIG_OPTION_ID] = extract_gist_id(
|
||||||
|
gist_process.stdout
|
||||||
|
)
|
||||||
|
print("Gist creation complete.")
|
||||||
|
|
||||||
elif package_lists_match(gist_id):
|
elif package_lists_match(gist_id):
|
||||||
print("Package lists match, no update necessary.")
|
print("Package lists match, no update necessary.")
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
else:
|
else:
|
||||||
|
try:
|
||||||
print("Package lists differ, updating.")
|
print("Package lists differ, updating.")
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
f"pacman -Qqen | gist --update {gist_id} --filename {gist_filename} --description {gist_description}",
|
f"pacman -Qqen | gist --update {gist_id} --filename {gist_filename} --description {gist_description}",
|
||||||
capture_output=True,
|
capture_output=True,
|
||||||
|
text=True,
|
||||||
shell=True,
|
shell=True,
|
||||||
|
check=True,
|
||||||
)
|
)
|
||||||
|
except subprocess.CalledProcessError as e:
|
||||||
|
print(e.stdout.strip(), file=sys.stderr)
|
||||||
|
sys.exit(e.returncode)
|
||||||
|
else:
|
||||||
|
print("Update complete.")
|
||||||
|
@ -7,5 +7,6 @@ Target = *
|
|||||||
|
|
||||||
[Action]
|
[Action]
|
||||||
Depends = coreutils
|
Depends = coreutils
|
||||||
|
Depends = packaging-scripts
|
||||||
When = PostTransaction
|
When = PostTransaction
|
||||||
Exec = /usr/bin/pug2
|
Exec = /usr/bin/pug2
|
||||||
|
Loading…
x
Reference in New Issue
Block a user