~postmarketos/pmbootstrap-devel

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
1

[PATCH pmbootstrap v2] aportgen: remove binutils

Details
Message ID
<20231126121617.3855-1-ollieparanoid@postmarketos.org>
DKIM signature
missing
Download raw message
Patch: +9 -190
Remove the code for generating binutils-aarch64 etc. packages, as these
live upstream in Alpine now. Having the generator scripts for binutils
cross pkgs is therefore not useful anymore and would just bitrot if we
kept it.

Link: https://lists.sr.ht/~postmarketos/pmbootstrap-devel/%3C20231126103348.2849-1-ollieparanoid@postmarketos.org%3E
---
 README.md                                     |   2 +-
 pmb/aportgen/__init__.py                      |   1 -
 pmb/aportgen/binutils.py                      |  33 ----
 pmb/config/__init__.py                        |   6 +-
 test/test_aportgen.py                         |   8 +-
 .../pmaports/cross/binutils-armhf/APKBUILD    | 149 ------------------
 6 files changed, 9 insertions(+), 190 deletions(-)
 delete mode 100644 pmb/aportgen/binutils.py
 delete mode 100644 test/testdata/aportgen/pmaports/cross/binutils-armhf/APKBUILD

diff --git a/README.md b/README.md
index ff782b98..0d3522b9 100644
--- a/README.md
+++ b/README.md
@@ -216,7 +216,7 @@ $ pmbootstrap pkgrel_bump --auto
Generate cross-compiler aports based on the latest version from Alpine's
aports:
```
$ pmbootstrap aportgen binutils-armhf gcc-armhf
$ pmbootstrap aportgen gcc-armhf
```

Manually rebuild package index:
diff --git a/pmb/aportgen/__init__.py b/pmb/aportgen/__init__.py
index 6473f916..9aabdf3b 100644
--- a/pmb/aportgen/__init__.py
+++ b/pmb/aportgen/__init__.py
@@ -2,7 +2,6 @@
# SPDX-License-Identifier: GPL-3.0-or-later
import os
import logging
import pmb.aportgen.binutils
import pmb.aportgen.busybox_static
import pmb.aportgen.device
import pmb.aportgen.gcc
diff --git a/pmb/aportgen/binutils.py b/pmb/aportgen/binutils.py
deleted file mode 100644
index 571fb43a..00000000
--- a/pmb/aportgen/binutils.py
@@ -1,33 +0,0 @@
# Copyright 2023 Oliver Smith
# SPDX-License-Identifier: GPL-3.0-or-later
import pmb.aportgen.core
import pmb.helpers.git
import pmb.helpers.run


def generate(args, pkgname):
    # Copy original aport
    arch = pkgname.split("-")[1]
    upstream = pmb.aportgen.core.get_upstream_aport(args, "binutils")
    pmb.helpers.run.user(args, ["cp", "-r", upstream, args.work + "/aportgen"])

    # Rewrite APKBUILD
    fields = {
        "arch": pmb.config.arch_native,
        "makedepends_host": "zlib-dev jansson-dev zstd-dev",
        "pkgdesc": f"Tools necessary to build programs for {arch} targets",
        "pkgname": pkgname,
    }

    replace_simple = {
        "*--with-bugurl=*": "\t\t--with-bugurl=\"https://postmarketos.org/issues\" \\"
    }

    below_header = """
        CTARGET_ARCH=""" + arch + """
        CTARGET="$(arch_to_hostspec $CTARGET_ARCH)"
    """

    pmb.aportgen.core.rewrite(args, pkgname, "main/binutils", fields,
                              "binutils", replace_simple=replace_simple,
                              below_header=below_header)
diff --git a/pmb/config/__init__.py b/pmb/config/__init__.py
index e26b0661..6f2bbc88 100644
--- a/pmb/config/__init__.py
+++ b/pmb/config/__init__.py
@@ -270,8 +270,8 @@ chroot_outdated = 3600 * 24 * 2
#
# Officially supported host/target architectures for postmarketOS. Only
# specify architectures supported by Alpine here. For cross-compiling,
# we need to generate the "musl-$ARCH", "binutils-$ARCH" and "gcc-$ARCH"
# packages (use "pmbootstrap aportgen musl-armhf" etc.).
# we need to generate the "musl-$ARCH" and "gcc-$ARCH" packages (use
# "pmbootstrap aportgen musl-armhf" etc.).
build_device_architectures = ["armhf", "armv7", "aarch64", "x86_64", "x86", "riscv64"]

# Packages that will be installed in a chroot before it builds packages
@@ -1089,7 +1089,7 @@ git_repo_outdated = 3600 * 24 * 2
#
aportgen = {
    "cross": {
        "prefixes": ["binutils", "busybox-static", "gcc", "musl", "grub-efi"],
        "prefixes": ["busybox-static", "gcc", "musl", "grub-efi"],
        "confirm_overwrite": False,
    },
    "device/testing": {
diff --git a/test/test_aportgen.py b/test/test_aportgen.py
index 8c27b3c5..ceb1515c 100644
--- a/test/test_aportgen.py
+++ b/test/test_aportgen.py
@@ -42,7 +42,7 @@ def test_aportgen_compare_output(args, tmpdir, monkeypatch):
    monkeypatch.setattr(pmb.aportgen.core, "get_upstream_aport", func)

    # Run aportgen and compare output
    pkgnames = ["binutils-armhf", "gcc-armhf"]
    pkgnames = ["gcc-armhf"]
    for pkgname in pkgnames:
        pmb.aportgen.generate(args, pkgname)
        path_new = args.aports + "/cross/" + pkgname + "/APKBUILD"
@@ -87,8 +87,10 @@ def test_aportgen(args, tmpdir):
    pmb.helpers.run.user(args, ["mkdir", "-p", args.work + "/aportgen"])

    # Generate all valid packages (gcc twice -> different code path)
    pkgnames = ["binutils-armv7", "musl-armv7", "busybox-static-armv7",
                "gcc-armv7", "gcc-armv7"]
    pkgnames = ["musl-armv7",
                "busybox-static-armv7",
                "gcc-armv7",
                "gcc-armv7"]
    for pkgname in pkgnames:
        pmb.aportgen.generate(args, pkgname)

diff --git a/test/testdata/aportgen/pmaports/cross/binutils-armhf/APKBUILD b/test/testdata/aportgen/pmaports/cross/binutils-armhf/APKBUILD
deleted file mode 100644
index 566b1442..00000000
--- a/test/testdata/aportgen/pmaports/cross/binutils-armhf/APKBUILD
@@ -1,149 +0,0 @@
# Automatically generated aport, do not edit!
# Generator: pmbootstrap aportgen binutils-armhf
# Based on: main/binutils


CTARGET_ARCH=armhf
CTARGET="$(arch_to_hostspec $CTARGET_ARCH)"

pkgname=binutils-armhf
pkgver=2.39
pkgrel=1
pkgdesc="Tools necessary to build programs for armhf targets"
url="https://www.gnu.org/software/binutils/"
makedepends_build="bison flex texinfo"
makedepends_host="zlib-dev jansson-dev zstd-dev"
makedepends="$makedepends_build $makedepends_host"
arch="x86_64"
license="GPL-2.0 GPL-3.0-or-later LGPL-2.0 BSD"
subpackages="binutils-dev binutils-doc"
source="https://ftp.gnu.org/gnu/binutils/binutils-$pkgver.tar.xz
	binutils-ld-fix-static-linking.patch
	gold-mips.patch
	ld-bfd-mips.patch
	0001-Revert-PR25882-.gnu.attributes-are-not-checked-for-s.patch
	binutils-mips-disable-assert.patch
	"
builddir="$srcdir/binutils-$pkgver"

if [ "$CHOST" = "$CBUILD" ] && [ "$CBUILD" = "$CTARGET" ] && [ "$CTARGET_ARCH" != "riscv64" ]; then
	subpackages="$subpackages binutils-gold"
fi

if [ "$CHOST" != "$CTARGET" ]; then
	pkgname="binutils-$CTARGET_ARCH"
	subpackages=""
	sonameprefix="binutils:"
fi

# secfixes:
#   2.35.2-r1:
#     - CVE-2021-3487
#   2.32-r0:
#     - CVE-2018-19931
#     - CVE-2018-19932
#     - CVE-2018-20002
#     - CVE-2018-20712
#   2.28-r1:
#     - CVE-2017-7614

build() {
	local _sysroot=/
	local _cross_configure="--enable-install-libiberty --enable-shared"
	local _arch_configure=""
	local _gold_configure="--disable-gold"
	local _plugin_configure="--enable-plugins"

	if [ "$CHOST" != "$CTARGET" ]; then
		_sysroot="$CBUILDROOT"
		_cross_configure="--disable-install-libiberty"
		_plugin_configure="--disable-plugins"
	fi

	if [ "$CHOST" = "$CBUILD" ] && [ "$CBUILD" = "$CTARGET" ] && [ "$CTARGET_ARCH" != "riscv64" ]; then
		_gold_configure="--enable-gold"
	fi

	if [ "$CTARGET_ARCH" = "x86_64" ]; then
		_arch_configure="--enable-targets=x86_64-pep"
	fi

	if [ "$CTARGET_ARCH" = "riscv64" ]; then
		_gold_configure="--disable-gold"
	fi

	case "$CTARGET_ARCH" in
	mips*)  _hash_style_configure="--enable-default-hash-style=sysv" ;;
	*)      _hash_style_configure="--enable-default-hash-style=gnu"	;;
	esac

	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--target=$CTARGET \
		--with-build-sysroot="$CBUILDROOT" \
		--with-sysroot=$_sysroot \
		--prefix=/usr \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--disable-multilib \
		--disable-gprofng \
		--enable-ld=default \
		$_gold_configure \
		--enable-64-bit-bfd \
		$_plugin_configure \
		--enable-relro \
		--enable-deterministic-archives \
		--enable-default-execstack=no \
		$_cross_configure \
		$_arch_configure \
		$_hash_style_configure \
		--with-pic \
		--disable-werror \
		--disable-nls \
		--with-mmap \
		--with-system-zlib
	make
}

package() {
	make install DESTDIR="$pkgdir"
	if [ -d "$pkgdir"/usr/lib64 ]; then
		mv "$pkgdir"/usr/lib64/* "$pkgdir"/usr/lib/
		rmdir "$pkgdir"/usr/lib64
	fi
	if [ "$CHOST" != "$CTARGET" ]; then
		# creating cross tools: remove any files that would conflict
		# with the native tools, or other cross tools
		rm -r "${pkgdir:?}"/usr/share
		rm -f "$pkgdir"/usr/lib/libiberty.a
		rm -r "${pkgdir:?}"/usr/lib/bfd-plugins
	fi
}

libs() {
	pkgdesc="Runtime libraries from binutils - libbfd and libopcodes"

	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/lib*.so "$subpkgdir"/usr/lib/
}

gold() {
	pkgdesc="GNU binutils - gold linker"

	if [ -e "$pkgdir"/usr/bin/ld.gold ]; then
		mkdir -p "$subpkgdir"/usr/bin
		mv "$pkgdir"/usr/bin/ld.gold "$subpkgdir"/usr/bin
	fi
	mkdir -p "$subpkgdir"/usr/$CTARGET/bin
	mv "$pkgdir"/usr/$CTARGET/bin/ld.gold "$subpkgdir"/usr/$CTARGET/bin/ld.gold
}

sha512sums="
68e038f339a8c21faa19a57bbc447a51c817f47c2e06d740847c6e9cc3396c025d35d5369fa8c3f8b70414757c89f0e577939ddc0d70f283182504920f53b0a3  binutils-2.39.tar.xz
ecee33b0e435aa704af1c334e560f201638ff79e199aa11ed78a72f7c9b46f85fbb227af5748e735fd681d1965fcc42ac81b0c8824e540430ce0c706c81e8b49  binutils-ld-fix-static-linking.patch
f55cf2e0bf82f97583a1abe10710e4013ecf7d64f1da2ef8659a44a06d0dd8beaf58dab98a183488ea137f03e32d62efc878d95f018f836f8cec870bc448556f  gold-mips.patch
314d2ef9071c89940aa6c8118e8a1e2f191a5d0a4bf596da1ad9cc84f884d8bc7dea8bd7b9fc3f8f1bddd3fd41c6eb017e1e804044b3bf084df1ed9e6e095e2d  ld-bfd-mips.patch
70ec22bd72ef6dddecfd970613387dd4a8cdc8730dd3cbf03d5a0c3a7c4d839383167bb06dad21bf7c235329fd44b5dc4aefe762f68544f17155cf002bf1be4a  0001-Revert-PR25882-.gnu.attributes-are-not-checked-for-s.patch
609cd90d8b334eb309f586b17b9d335a08d3dbb6def7c3eb5c010028fcb681674031e5b9d853aa7a39a50304356a86afc184b85562b3f228f8197f4d29395c8f  binutils-mips-disable-assert.patch
"
-- 
2.43.0

[pmbootstrap/patches/.build.yml] build success

builds.sr.ht <builds@sr.ht>
Details
Message ID
<CX8QTFT1AKVR.17M9HTZ4QHEJW@cirno2>
In-Reply-To
<20231126121617.3855-1-ollieparanoid@postmarketos.org> (view parent)
DKIM signature
missing
Download raw message
pmbootstrap/patches/.build.yml: SUCCESS in 13m37s

[aportgen: remove binutils][0] v2 from [Oliver Smith][1]

[0]: https://lists.sr.ht/~postmarketos/pmbootstrap-devel/patches/47027
[1]: ollieparanoid@postmarketos.org

✓ #1101231 SUCCESS pmbootstrap/patches/.build.yml https://builds.sr.ht/~postmarketos/job/1101231
Reply to thread Export thread (mbox)