forked from Mirror/pmbootstrap
build: use get_pkgver() again (MR 2353)
During rework this got lost, re-incorporate it so packages built with --src have a relevant pkgver. Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
This commit is contained in:
parent
319d9681f3
commit
c5135ac62a
2 changed files with 11 additions and 5 deletions
|
@ -94,7 +94,7 @@ def get_depends(context: Context, apkbuild):
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|
||||||
def get_pkgver(original_pkgver, original_source=False, now=None):
|
def get_pkgver(original_pkgver: str, original_source=False):
|
||||||
"""Get the original pkgver when using the original source.
|
"""Get the original pkgver when using the original source.
|
||||||
|
|
||||||
Otherwise, get the pkgver with an appended suffix of current date and time.
|
Otherwise, get the pkgver with an appended suffix of current date and time.
|
||||||
|
@ -112,7 +112,7 @@ def get_pkgver(original_pkgver, original_source=False, now=None):
|
||||||
|
|
||||||
# Append current date
|
# Append current date
|
||||||
no_suffix = original_pkgver.split("_", 1)[0]
|
no_suffix = original_pkgver.split("_", 1)[0]
|
||||||
now = now if now else datetime.datetime.now()
|
now = datetime.datetime.now()
|
||||||
new_suffix = "_p" + now.strftime("%Y%m%d%H%M%S")
|
new_suffix = "_p" + now.strftime("%Y%m%d%H%M%S")
|
||||||
return no_suffix + new_suffix
|
return no_suffix + new_suffix
|
||||||
|
|
||||||
|
@ -194,6 +194,7 @@ class BuildQueueItem(TypedDict):
|
||||||
arch: Arch # Arch to build for
|
arch: Arch # Arch to build for
|
||||||
aports: str
|
aports: str
|
||||||
apkbuild: dict[str, Any]
|
apkbuild: dict[str, Any]
|
||||||
|
pkgver: str
|
||||||
output_path: Path
|
output_path: Path
|
||||||
channel: str
|
channel: str
|
||||||
depends: list[str]
|
depends: list[str]
|
||||||
|
@ -353,14 +354,16 @@ def packages(
|
||||||
pkg_arch = pmb.build.autodetect.arch(apkbuild) if arch is None else arch
|
pkg_arch = pmb.build.autodetect.arch(apkbuild) if arch is None else arch
|
||||||
chroot = pmb.build.autodetect.chroot(apkbuild, pkg_arch)
|
chroot = pmb.build.autodetect.chroot(apkbuild, pkg_arch)
|
||||||
cross = cross or pmb.build.autodetect.crosscompile(apkbuild, pkg_arch)
|
cross = cross or pmb.build.autodetect.crosscompile(apkbuild, pkg_arch)
|
||||||
|
pkgver = get_pkgver(apkbuild["pkgver"], src is None)
|
||||||
build_queue.append(
|
build_queue.append(
|
||||||
{
|
{
|
||||||
"name": name,
|
"name": name,
|
||||||
"arch": pkg_arch,
|
"arch": pkg_arch,
|
||||||
"aports": aports.name, # the pmaports source repo (e.g. "systemd")
|
"aports": aports.name, # the pmaports source repo (e.g. "systemd")
|
||||||
"apkbuild": apkbuild,
|
"apkbuild": apkbuild,
|
||||||
|
"pkgver": pkgver,
|
||||||
"output_path": output_path(
|
"output_path": output_path(
|
||||||
pkg_arch, apkbuild["pkgname"], apkbuild["pkgver"], apkbuild["pkgrel"]
|
pkg_arch, apkbuild["pkgname"], pkgver, apkbuild["pkgrel"]
|
||||||
),
|
),
|
||||||
"channel": pmb.config.pmaports.read_config(aports)["channel"],
|
"channel": pmb.config.pmaports.read_config(aports)["channel"],
|
||||||
"depends": depends,
|
"depends": depends,
|
||||||
|
@ -455,6 +458,7 @@ def packages(
|
||||||
run_abuild(
|
run_abuild(
|
||||||
context,
|
context,
|
||||||
pkg["apkbuild"],
|
pkg["apkbuild"],
|
||||||
|
pkg["pkgver"],
|
||||||
channel,
|
channel,
|
||||||
pkg_arch,
|
pkg_arch,
|
||||||
strict,
|
strict,
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import enum
|
import enum
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from typing import Any
|
||||||
from pmb.core.pkgrepo import pkgrepo_paths
|
from pmb.core.pkgrepo import pkgrepo_paths
|
||||||
import pmb.helpers.run
|
import pmb.helpers.run
|
||||||
import pmb.chroot
|
import pmb.chroot
|
||||||
|
@ -180,7 +181,8 @@ def handle_csum_failure(apkbuild, chroot: Chroot):
|
||||||
|
|
||||||
def run_abuild(
|
def run_abuild(
|
||||||
context: Context,
|
context: Context,
|
||||||
apkbuild,
|
apkbuild: dict[str, Any],
|
||||||
|
pkgver: str,
|
||||||
channel,
|
channel,
|
||||||
arch: Arch,
|
arch: Arch,
|
||||||
strict=False,
|
strict=False,
|
||||||
|
@ -283,7 +285,7 @@ def run_abuild(
|
||||||
if src and strict:
|
if src and strict:
|
||||||
logging.debug(f"({suffix}) Ensuring previous build artifacts are removed")
|
logging.debug(f"({suffix}) Ensuring previous build artifacts are removed")
|
||||||
pmb.chroot.root(["rm", "-rf", "/tmp/pmbootstrap-local-source-copy"], suffix)
|
pmb.chroot.root(["rm", "-rf", "/tmp/pmbootstrap-local-source-copy"], suffix)
|
||||||
override_source(apkbuild, apkbuild["pkgver"], src, suffix)
|
override_source(apkbuild, pkgver, src, suffix)
|
||||||
link_to_git_dir(suffix)
|
link_to_git_dir(suffix)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue