forked from Mirror/pmbootstrap
WIP: start ripping out args (MR 2252)
Cease merging pmbootstrap.cfg into args, implement a Context type to let us pull globals out of thin air (as an intermediate workaround) and rip args out of a lot of the codebase. This is just a first pass, after this we can split all the state that leaked over into Context into types with narrower scopes (like a BuildContext(), etc). Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
This commit is contained in:
parent
bfea00e03a
commit
34dd9d42ba
129 changed files with 1393 additions and 1300 deletions
|
@ -1,6 +1,7 @@
|
|||
# Copyright 2023 Oliver Smith
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
from pmb.core.types import PmbArgs
|
||||
from pmb.core import get_context
|
||||
from pmb.types import PmbArgs
|
||||
import pmb.helpers.run
|
||||
import pmb.aportgen.core
|
||||
import pmb.parse.apkindex
|
||||
|
@ -105,17 +106,18 @@ def generate_apkbuild(args: PmbArgs, pkgname, deviceinfo, patches):
|
|||
"""
|
||||
|
||||
# Write the file
|
||||
with (pmb.config.work / "aportgen/APKBUILD").open("w", encoding="utf-8") as hndl:
|
||||
with (get_context().config.work / "aportgen/APKBUILD").open("w", encoding="utf-8") as hndl:
|
||||
for line in content.rstrip().split("\n"):
|
||||
hndl.write(line[8:].replace(" " * 4, "\t") + "\n")
|
||||
|
||||
|
||||
def generate(args: PmbArgs, pkgname):
|
||||
device = "-".join(pkgname.split("-")[1:])
|
||||
deviceinfo = pmb.parse.deviceinfo(args, device)
|
||||
deviceinfo = pmb.parse.deviceinfo(device)
|
||||
work = get_context().config.work
|
||||
|
||||
# Symlink commonly used patches
|
||||
pmb.helpers.run.user(["mkdir", "-p", pmb.config.work / "aportgen"])
|
||||
pmb.helpers.run.user(["mkdir", "-p", work / "aportgen"])
|
||||
patches = [
|
||||
"gcc7-give-up-on-ilog2-const-optimizations.patch",
|
||||
"gcc8-fix-put-user.patch",
|
||||
|
@ -125,6 +127,6 @@ def generate(args: PmbArgs, pkgname):
|
|||
for patch in patches:
|
||||
pmb.helpers.run.user(["ln", "-s",
|
||||
"../../.shared-patches/linux/" + patch,
|
||||
(pmb.config.work / "aportgen" / patch)])
|
||||
(work / "aportgen" / patch)])
|
||||
|
||||
generate_apkbuild(args, pkgname, deviceinfo, patches)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue