Fix hardcoded signature of db, editor

This commit is contained in:
Stephen Seo 2022-06-02 16:45:50 +09:00
parent 5d3561e08e
commit 4f957ba5f9
3 changed files with 14 additions and 7 deletions

View file

@ -82,7 +82,8 @@ For example, if your repo's name is `MyAURRepo`, then `repo` should be set to
`.../MyAURRepo.db.tar`. `.../MyAURRepo.db.tar`.
You must also create symlinks such that `MyAURRepo.db` points to You must also create symlinks such that `MyAURRepo.db` points to
`MyAURRepo.db.tar` and `MyAURRepo.files` points to `MyAURRepo.files.tar`. `MyAURRepo.db.tar` and `MyAURRepo.files` points to `MyAURRepo.files.tar`, and
`MyAURRepo.db.sig` points to `MyAURRepo.db.tar.sig`.
To use the repository, you can add an entry to your `/etc/pacman.conf` with the To use the repository, you can add an entry to your `/etc/pacman.conf` with the
following: following:

View file

@ -7,6 +7,7 @@ gpg_dir = "/home/stephen/Downloads/aur/checkingGPG"
logs_dir = "/home/stephen/Downloads/aur/logs" logs_dir = "/home/stephen/Downloads/aur/logs"
signing_gpg_dir = "/home/stephen/Downloads/aur/signingGPG" signing_gpg_dir = "/home/stephen/Downloads/aur/signingGPG"
signing_gpg_key_fp = "04D9E3A2880F6418EC4BA70EA0F3F8FAA2088E62" signing_gpg_key_fp = "04D9E3A2880F6418EC4BA70EA0F3F8FAA2088E62"
editor = "/usr/bin/vim"
########## END OF MANDATORY VARIABLES ########## END OF MANDATORY VARIABLES
# Each [[entry]] needs a "name". # Each [[entry]] needs a "name".

View file

@ -786,13 +786,13 @@ def update_pkg_list(
pkg_state[pkg]["build_status"] = "add_fail" pkg_state[pkg]["build_status"] = "add_fail"
continue continue
log_print('Signing "custom.db"...') log_print(f'Signing "{repo}"...')
try: try:
subprocess.run( subprocess.run(
[ [
"/usr/bin/rm", "/usr/bin/rm",
"-f", "-f",
str(os.path.join(pkg_out_dir, "custom.db.sig")), str(os.path.join(pkg_out_dir, f"{repo}.sig")),
] ]
) )
subprocess.run( subprocess.run(
@ -806,7 +806,7 @@ def update_pkg_list(
"--default-key", "--default-key",
signing_gpg_key_fp, signing_gpg_key_fp,
"--detach-sign", "--detach-sign",
str(os.path.join(pkg_out_dir, "custom.db")), str(os.path.join(pkg_out_dir, f"{repo}")),
], ],
check=True, check=True,
input=signing_gpg_pass, input=signing_gpg_pass,
@ -814,7 +814,7 @@ def update_pkg_list(
env={"GNUPGHOME": signing_gpg_dir}, env={"GNUPGHOME": signing_gpg_dir},
) )
except subprocess.CalledProcessError: except subprocess.CalledProcessError:
log_print('WARNING: Failed to sign "custom.db"') log_print(f'WARNING: Failed to sign "{repo}"')
pkg_state[pkg]["build_status"] = "success" pkg_state[pkg]["build_status"] = "success"
@ -940,7 +940,7 @@ if __name__ == "__main__":
parser.add_argument( parser.add_argument(
"-e", "-e",
"--editor", "--editor",
default="vim", default=None,
help="editor to use when viewing PKGBUILDs", help="editor to use when viewing PKGBUILDs",
metavar="editor", metavar="editor",
) )
@ -1076,10 +1076,15 @@ if __name__ == "__main__":
args_signing_gpg_pass, args_signing_gpg_pass,
): ):
sys.exit(1) sys.exit(1)
if "editor" in d:
editor = d["editor"]
else: else:
log_print('ERROR: At least "--config" or "--pkg" must be specified') log_print('ERROR: At least "--config" or "--pkg" must be specified')
sys.exit(1) sys.exit(1)
if args.editor is not None:
editor = args.editor
os.putenv("CHROOT", os.path.realpath(args_chroot)) os.putenv("CHROOT", os.path.realpath(args_chroot))
os.putenv("GNUPGHOME", os.path.realpath(args_gpg_home)) os.putenv("GNUPGHOME", os.path.realpath(args_gpg_home))
if not os.path.exists(args_logs_dir): if not os.path.exists(args_logs_dir):
@ -1123,7 +1128,7 @@ if __name__ == "__main__":
i += 1 i += 1
continue continue
else: else:
check_pkg_build_result = check_pkg_build(pkg_list[i], args.editor) check_pkg_build_result = check_pkg_build(pkg_list[i], editor)
if check_pkg_build_result == "ok": if check_pkg_build_result == "ok":
pass pass
elif check_pkg_build_result == "not_ok": elif check_pkg_build_result == "not_ok":