|
8 | 8 | from pathlib import Path |
9 | 9 |
|
10 | 10 | # git repo/ref to use |
11 | | -GIT_REPO = "https://github.com/torvalds/linux" |
12 | | -GIT_REF = "master" |
13 | | -LINUX_NEXT_GIT_REPO = ( |
14 | | - "https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git" |
15 | | -) |
16 | | -LINUX_NEXT_GIT_REF = "master" |
17 | | -QCOM_NEXT_GIT_REPO = "https://github.com/qualcomm-linux/kernel" |
18 | | -QCOM_NEXT_GIT_REF = "qcom-next" |
| 11 | + |
| 12 | +GIT_UPSTREAM = { |
| 13 | + "linux": { |
| 14 | + "repo": "https://github.com/torvalds/linux", |
| 15 | + "ref": "master", |
| 16 | + "ref_prefix": None, |
| 17 | + }, |
| 18 | + "linux-next": { |
| 19 | + "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git", # noqa: E501 |
| 20 | + "ref": "master", |
| 21 | + "ref_prefix": "next-", |
| 22 | + }, |
| 23 | + "qcom-next": { |
| 24 | + "repo": "https://github.com/qualcomm-linux/kernel", |
| 25 | + "ref": "qcom-next", |
| 26 | + "ref_prefix": "qcom-next-", |
| 27 | + }, |
| 28 | +} |
| 29 | + |
19 | 30 | # base config to use |
20 | 31 | BASE_CONFIG = "defconfig" |
21 | 32 | # package set to build |
@@ -144,16 +155,19 @@ def check_dependencies(): |
144 | 155 |
|
145 | 156 |
|
146 | 157 | def main(): |
| 158 | + DEFAULT_REPO = GIT_UPSTREAM["linux"]["repo"] |
| 159 | + DEFAULT_REF = GIT_UPSTREAM["linux"]["ref"] |
| 160 | + |
147 | 161 | parser = argparse.ArgumentParser(description="Build Linux Deb") |
148 | 162 | parser.add_argument( |
149 | 163 | "--repo", |
150 | | - default=GIT_REPO, |
151 | | - help=f"Git repository to clone (default: {GIT_REPO})", |
| 164 | + default=DEFAULT_REPO, |
| 165 | + help=f"Git repository to clone (default: {DEFAULT_REPO})", |
152 | 166 | ) |
153 | 167 | parser.add_argument( |
154 | 168 | "--ref", |
155 | | - default=GIT_REF, |
156 | | - help=f"Git ref (branch/tag) to checkout (default: {GIT_REF})", |
| 169 | + default=DEFAULT_REF, |
| 170 | + help=f"Git ref (branch/tag) to checkout (default: {DEFAULT_REF})", |
157 | 171 | ) |
158 | 172 | parser.add_argument( |
159 | 173 | "--linux-next", |
@@ -187,19 +201,19 @@ def main(): |
187 | 201 | args.fragments = args.fragments + unknown |
188 | 202 |
|
189 | 203 | # default settings for next trees |
190 | | - ref_prefix = None |
| 204 | + git_upstream_key = None |
191 | 205 | if args.linux_next: |
192 | | - if args.repo == GIT_REPO: |
193 | | - args.repo = LINUX_NEXT_GIT_REPO |
194 | | - if args.ref == GIT_REF: |
195 | | - args.ref = LINUX_NEXT_GIT_REF |
196 | | - ref_prefix = "next-" |
| 206 | + git_upstream_key = "linux-next" |
197 | 207 | elif args.qcom_next: |
198 | | - if args.repo == GIT_REPO: |
199 | | - args.repo = QCOM_NEXT_GIT_REPO |
200 | | - if args.ref == GIT_REF: |
201 | | - args.ref = QCOM_NEXT_GIT_REF |
202 | | - ref_prefix = "qcom-next-" |
| 208 | + git_upstream_key = "qcom-next" |
| 209 | + |
| 210 | + ref_prefix = GIT_UPSTREAM["linux"]["ref_prefix"] |
| 211 | + if git_upstream_key is not None: |
| 212 | + if args.repo == DEFAULT_REPO: |
| 213 | + args.repo = GIT_UPSTREAM[git_upstream_key]["repo"] |
| 214 | + if args.ref == DEFAULT_REF: |
| 215 | + args.ref = GIT_UPSTREAM[git_upstream_key]["ref"] |
| 216 | + ref_prefix = GIT_UPSTREAM[git_upstream_key]["ref_prefix"] |
203 | 217 |
|
204 | 218 | if ref_prefix: |
205 | 219 | found_tag = get_latest_dated_tag(args.repo, ref_prefix) |
|
0 commit comments