This repository was archived by the owner on Apr 7, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathpackage.py
More file actions
executable file
·91 lines (66 loc) · 2.11 KB
/
package.py
File metadata and controls
executable file
·91 lines (66 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/usr/bin/env python3
# SPDX-FileCopyrightText: 2023 Oxhead Alpha
# SPDX-License-Identifier: LicenseRef-MIT-OA
import os
import sys
import shlex
import shutil
import subprocess
from typing import Optional, List
from package.package_generator import make_ubuntu_parser
from build.util.build import parser
from build.ubuntu.build import build_ubuntu
from build.fedora.build import build_fedora
from build.ubuntu.sign import sign_ubuntu
from build.fedora.sign import sign_fedora
import build.util.sign as sign
from build.ubuntu.sign import sign_ubuntu
from build.fedora.sign import sign_fedora
import build.util.upload as upload
from build.ubuntu.upload import upload_ubuntu
from build.fedora.upload import upload_fedora
parser.add_argument(
"--gpg-sign",
"-s",
help="provide an identity to sign packages",
type=str,
)
# --upload will perform upload to regular repositories
# --upload epel will upload for epel-x86_64 chroot on copr
parser.add_argument(
"--upload",
help="upload packages to the specified repository",
default=None,
const="regular",
nargs="?",
)
def build_wrapper(args) -> List[str]:
if args.os == "ubuntu":
artifacts = build_ubuntu(args)
elif args.os == "fedora":
artifacts = build_fedora(args)
return artifacts
def sign_wrapper(args: sign.Arguments):
if args.os == "ubuntu":
sign_ubuntu(args)
elif args.os == "fedora":
sign_fedora(args)
def upload_wrapper(args: upload.Arguments):
if args.os == "ubuntu":
upload_ubuntu(args)
elif args.os == "fedora":
upload_fedora(args)
args, _ = parser.parse_known_args()
if args.os == "ubuntu":
args = make_ubuntu_parser(parser).parse_args()
elif args.os == "fedora":
args = parser.parse_args()
artifacts = build_wrapper(args)
if args.gpg_sign:
sign_wrapper(sign.Arguments(args.os, args.output_dir, artifacts, args.gpg_sign))
if args.upload:
upload_wrapper(
upload.Arguments(args.os, args.output_dir, artifacts, args.upload, False)
)
elif args.upload:
raise Exception("You have to sign packages before uploading them.")