Compare commits
No commits in common. "b10442ae3572e417fcec69435626ca0e6cebc976" and "90eec890c7cb63c2bafcce906ebc858198d259d4" have entirely different histories.
b10442ae35
...
90eec890c7
2 changed files with 6 additions and 36 deletions
|
@ -232,9 +232,3 @@ specifying `sccache_rust_only`:
|
||||||
link_cargo_registry = true
|
link_cargo_registry = true
|
||||||
sccache_dir="/home/user/aur/sccache_helix-git"
|
sccache_dir="/home/user/aur/sccache_helix-git"
|
||||||
sccache_rust_only = true
|
sccache_rust_only = true
|
||||||
|
|
||||||
## Signal Handling
|
|
||||||
|
|
||||||
The script is set up to handle `SIGINT` and `SIGUSR1`. `SIGINT` will print the
|
|
||||||
known package list and status, and exit. `SIGUSR1` will also print the known
|
|
||||||
package list and status, but will not stop the script.
|
|
||||||
|
|
36
update.py
36
update.py
|
@ -17,7 +17,6 @@ import tempfile
|
||||||
import threading
|
import threading
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any, Union
|
from typing import Any, Union
|
||||||
import signal
|
|
||||||
|
|
||||||
# SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
|
# SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
|
||||||
SUDO_PROC = False
|
SUDO_PROC = False
|
||||||
|
@ -28,8 +27,6 @@ DEFAULT_EDITOR = "/usr/bin/nano"
|
||||||
IS_DIGIT_REGEX = re.compile("^[0-9]+$")
|
IS_DIGIT_REGEX = re.compile("^[0-9]+$")
|
||||||
STRFTIME_FORMAT = "%Y-%m-%dT%H:%M:%SZ"
|
STRFTIME_FORMAT = "%Y-%m-%dT%H:%M:%SZ"
|
||||||
STRFTIME_LOCAL_FORMAT = "%Y-%m-%dT%H:%M:%S"
|
STRFTIME_LOCAL_FORMAT = "%Y-%m-%dT%H:%M:%S"
|
||||||
PKG_STATE = None
|
|
||||||
OTHER_STATE = None
|
|
||||||
|
|
||||||
|
|
||||||
class ArchPkgVersion:
|
class ArchPkgVersion:
|
||||||
|
@ -1588,9 +1585,7 @@ def confirm_result(pkg: str, state_result: str):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
||||||
def print_state_info_and_get_update_list(
|
def print_state_info_and_get_update_list(pkg_state: dict[str, Any]):
|
||||||
other_state: dict[str, Any], pkg_state: dict[str, Any]
|
|
||||||
):
|
|
||||||
"""Prints the current "checked" state of all pkgs in the config."""
|
"""Prints the current "checked" state of all pkgs in the config."""
|
||||||
|
|
||||||
to_update = []
|
to_update = []
|
||||||
|
@ -1706,22 +1701,7 @@ def validate_and_verify_paths(other_state: dict[str, Union[None, str]]):
|
||||||
clones_dir_path.mkdir(parents=True)
|
clones_dir_path.mkdir(parents=True)
|
||||||
|
|
||||||
|
|
||||||
def signal_handler(sig, frame):
|
|
||||||
"""Handle SIGINT and SIGUSR1."""
|
|
||||||
global OTHER_STATE, PKG_STATE
|
|
||||||
if OTHER_STATE is not None and PKG_STATE is not None:
|
|
||||||
print_state_info_and_get_update_list(OTHER_STATE, PKG_STATE)
|
|
||||||
if signal.Signals(sig) is not signal.SIGINT:
|
|
||||||
return
|
|
||||||
sys.exit(0)
|
|
||||||
if signal.Signals(sig) is not signal.SIGINT:
|
|
||||||
return
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
signal.signal(signal.SIGINT, signal_handler)
|
|
||||||
signal.signal(signal.SIGUSR1, signal_handler)
|
|
||||||
editor = None
|
editor = None
|
||||||
parser = argparse.ArgumentParser(description="Update AUR pkgs")
|
parser = argparse.ArgumentParser(description="Update AUR pkgs")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
|
@ -1781,8 +1761,6 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
pkg_state = {}
|
pkg_state = {}
|
||||||
other_state = {}
|
other_state = {}
|
||||||
PKG_STATE = pkg_state
|
|
||||||
OTHER_STATE = other_state
|
|
||||||
other_state["logs_dir"] = None
|
other_state["logs_dir"] = None
|
||||||
other_state["log_limit"] = 1024 * 1024 * 1024
|
other_state["log_limit"] = 1024 * 1024 * 1024
|
||||||
other_state["error_on_limit"] = False
|
other_state["error_on_limit"] = False
|
||||||
|
@ -2015,7 +1993,7 @@ if __name__ == "__main__":
|
||||||
if i > furthest_checked:
|
if i > furthest_checked:
|
||||||
furthest_checked = i
|
furthest_checked = i
|
||||||
if not ensure_pkg_dir_exists(pkg_list[i], pkg_state, other_state):
|
if not ensure_pkg_dir_exists(pkg_list[i], pkg_state, other_state):
|
||||||
print_state_info_and_get_update_list(other_state, pkg_state)
|
print_state_info_and_get_update_list(pkg_state)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
if (
|
if (
|
||||||
"repo_path" not in pkg_state[pkg_list[i]]
|
"repo_path" not in pkg_state[pkg_list[i]]
|
||||||
|
@ -2039,7 +2017,7 @@ if __name__ == "__main__":
|
||||||
pkg_list[i],
|
pkg_list[i],
|
||||||
other_state=other_state,
|
other_state=other_state,
|
||||||
)
|
)
|
||||||
print_state_info_and_get_update_list(other_state, pkg_state)
|
print_state_info_and_get_update_list(pkg_state)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
if skip_on_same_ver and i >= furthest_checked:
|
if skip_on_same_ver and i >= furthest_checked:
|
||||||
check_pkg_version_result = check_pkg_version(
|
check_pkg_version_result = check_pkg_version(
|
||||||
|
@ -2073,7 +2051,7 @@ if __name__ == "__main__":
|
||||||
i -= 1
|
i -= 1
|
||||||
continue
|
continue
|
||||||
else: # check_pkg_build_result == "abort":
|
else: # check_pkg_build_result == "abort":
|
||||||
print_state_info_and_get_update_list(other_state, pkg_state)
|
print_state_info_and_get_update_list(pkg_state)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
while True:
|
while True:
|
||||||
if (
|
if (
|
||||||
|
@ -2109,7 +2087,7 @@ if __name__ == "__main__":
|
||||||
going_back = True
|
going_back = True
|
||||||
break
|
break
|
||||||
else: # confirm_result_result == "abort"
|
else: # confirm_result_result == "abort"
|
||||||
print_state_info_and_get_update_list(other_state, pkg_state)
|
print_state_info_and_get_update_list(pkg_state)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
if going_back:
|
if going_back:
|
||||||
going_back = False
|
going_back = False
|
||||||
|
@ -2117,9 +2095,7 @@ if __name__ == "__main__":
|
||||||
i += 1
|
i += 1
|
||||||
|
|
||||||
log_print("Showing current actions:", other_state=other_state)
|
log_print("Showing current actions:", other_state=other_state)
|
||||||
pkgs_to_update = print_state_info_and_get_update_list(
|
pkgs_to_update = print_state_info_and_get_update_list(pkg_state)
|
||||||
other_state, pkg_state
|
|
||||||
)
|
|
||||||
if len(pkgs_to_update) > 0:
|
if len(pkgs_to_update) > 0:
|
||||||
log_print("Continue? [Y/n]", other_state=other_state)
|
log_print("Continue? [Y/n]", other_state=other_state)
|
||||||
user_input = sys.stdin.buffer.readline().decode().strip().lower()
|
user_input = sys.stdin.buffer.readline().decode().strip().lower()
|
||||||
|
|
Loading…
Reference in a new issue