Compare commits
233
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4d1daf1284 | ||
|
|
ac04ea9cbe | ||
|
|
8dea71d8d0 | ||
|
|
fe97c1d251 | ||
|
|
4fecaf175b | ||
|
|
56e85ace24 | ||
|
|
b722efffec | ||
|
|
e1a31d0b87 | ||
|
|
45a87426b9 | ||
|
|
cd61d4c886 | ||
|
|
612e75d101 | ||
|
|
3f9e48f8bf | ||
|
|
45fc77a340 | ||
|
|
243c7dfded | ||
|
|
1fb3e4c683 | ||
|
|
03819009f0 | ||
|
|
56e9fddd3d | ||
|
|
19befb57a7 | ||
|
|
5b40d46305 | ||
|
|
4a501bf5d7 | ||
|
|
524a2a0c8c | ||
|
|
aed9cb8c61 | ||
|
|
17a4e81351 | ||
|
|
c84da8b9e7 | ||
|
|
3fe97a1782 | ||
|
|
2b5810e70f | ||
|
|
d2447be5a6 | ||
|
|
374ef4e2df | ||
|
|
8aebe26812 | ||
|
|
ef83711c9b | ||
|
|
d4ca755e30 | ||
|
|
dd63008a4e | ||
|
|
5b4fb8542c | ||
|
|
e7905b328a | ||
|
|
5a5d6488bb | ||
|
|
8e1f7a3cc4 | ||
|
|
ee4de8c670 | ||
|
|
f223201e07 | ||
|
|
d51dd5d246 | ||
|
|
02abe53648 | ||
|
|
d8cf0ad87b | ||
|
|
5c8496f1a2 | ||
|
|
cbedc8df98 | ||
|
|
ffdd72294b | ||
|
|
2d9ec1c316 | ||
|
|
000be63779 | ||
|
|
3f7e0869b6 | ||
|
|
6f1f630c0d | ||
|
|
c493b9a1f7 | ||
|
|
e1d8242824 | ||
|
|
e9b03af55a | ||
|
|
932d29e06f | ||
|
|
1e487c6506 | ||
|
|
6e5b8d2001 | ||
|
|
c32a290a41 | ||
|
|
984f471dca | ||
|
|
f7deaea6bc | ||
|
|
0a08543643 | ||
|
|
1f69350b09 | ||
|
|
eaa602c250 | ||
|
|
05b19e10ef | ||
|
|
886b38d743 | ||
|
|
cb2fd66419 | ||
|
|
17b1d6e7fd | ||
|
|
92b2a92e13 | ||
|
|
4632512575 | ||
|
|
d1fe56f9b2 | ||
|
|
c8b5e7f7e7 | ||
|
|
2c8dc39f98 | ||
|
|
e9f1867ba2 | ||
|
|
21b19f3e73 | ||
|
|
46a7328a70 | ||
|
|
02e57bf26d | ||
|
|
f7c529df74 | ||
|
|
ae20cc2023 | ||
|
|
f49acab29e | ||
|
|
ed6b102be2 | ||
|
|
74c9896229 | ||
|
|
cb51fa37cb | ||
|
|
b4c4564818 | ||
|
|
1a7cfcff5a | ||
|
|
ca0b7120e0 | ||
|
|
befecdea7d | ||
|
|
c73ee8dfb7 | ||
|
|
1ea1fcf308 | ||
|
|
a401ac45a1 | ||
|
|
c2aad75c01 | ||
|
|
2c9f9d6b71 | ||
|
|
95656cc972 | ||
|
|
f5980658a8 | ||
|
|
cf1fdbb878 | ||
|
|
0e903fcbc3 | ||
|
|
1911873bf3 | ||
|
|
9d356dfcc1 | ||
|
|
3a1b7c1ebf | ||
|
|
2bec070724 | ||
|
|
ea032b6495 | ||
|
|
eb2a91cea8 | ||
|
|
0da59a20b2 | ||
|
|
1769f571d1 | ||
|
|
e7d62d3cfd | ||
|
|
8d2ea508d9 | ||
|
|
dc9761a5df | ||
|
|
02916d7108 | ||
|
|
68377bd71e | ||
|
|
81b7d90da9 | ||
|
|
a23f8e22ef | ||
|
|
5359f3cb73 | ||
|
|
d685ec0d22 | ||
|
|
2727c0e058 | ||
|
|
bf4241c60a | ||
|
|
d1ea683925 | ||
|
|
4e47eaf0d4 | ||
|
|
ab64210154 | ||
|
|
91cd491198 | ||
|
|
b29fdc330d | ||
|
|
184f526e4e | ||
|
|
4916d20f5f | ||
|
|
b92dc46a88 | ||
|
|
1a46bceeb4 | ||
|
|
3e886c0558 | ||
|
|
9baa082d3b | ||
|
|
33f22085d6 | ||
|
|
1e6cfad4b9 | ||
|
|
a33af3bd40 | ||
|
|
7e8e8e4687 | ||
|
|
67276aa805 | ||
|
|
ed0a6a2bd9 | ||
|
|
e8d3783b8c | ||
|
|
4f16b338e0 | ||
|
|
fd49945f47 | ||
|
|
40505b8803 | ||
|
|
e24e82443f | ||
|
|
2d1f5bf8b2 | ||
|
|
34e22cb939 | ||
|
|
16512a06c8 | ||
|
|
23a0ccac75 | ||
|
|
72a1d5cc6e | ||
|
|
cfb0e81698 | ||
|
|
0535a704ea | ||
|
|
fdac48e3bd | ||
|
|
9e077dfca5 | ||
|
|
315bf8350b | ||
|
|
96d2d60df3 | ||
|
|
1cc5c192d3 | ||
|
|
e38e6a0c8c | ||
|
|
02ed23ec5d | ||
|
|
3715067e6d | ||
|
|
0d7ca6dc0b | ||
|
|
fd1465f8e5 | ||
|
|
3f018e1b46 | ||
|
|
886f9b81ca | ||
|
|
08dce59438 | ||
|
|
82b148d524 | ||
|
|
df02a4e638 | ||
|
|
ec5f4b5f92 | ||
|
|
0f8f3f7f67 | ||
|
|
eae9b0c799 | ||
|
|
927cce84ce | ||
|
|
cf0b1cfdb4 | ||
|
|
bcf99616f6 | ||
|
|
c8f8aca85c | ||
|
|
4046592a2c | ||
|
|
f294787e82 | ||
|
|
ccf058bfeb | ||
|
|
90dd205cc9 | ||
|
|
0a247a99df | ||
|
|
60d778f638 | ||
|
|
b04616f1c0 | ||
|
|
36a0d6540f | ||
|
|
3bfa0b7218 | ||
|
|
a944471e77 | ||
|
|
e18927a5a9 | ||
|
|
7925ae149d | ||
|
|
7006ca6bd8 | ||
|
|
f9d642a809 | ||
|
|
3354e533d7 | ||
|
|
fd94316f39 | ||
|
|
905215af0c | ||
|
|
bb8582053b | ||
|
|
4970ecea80 | ||
|
|
6b10ef1a4b | ||
|
|
3a6b3e5de0 | ||
|
|
6365b48559 | ||
|
|
9b83700c8a | ||
|
|
498184915a | ||
|
|
7d10062dd4 | ||
|
|
40b9622b08 | ||
|
|
aca9bf242e | ||
|
|
461a4de0f2 | ||
|
|
9a05f5018a | ||
|
|
fff8af8339 | ||
|
|
1368557349 | ||
|
|
a7cee68985 | ||
|
|
60dbcab90f | ||
|
|
1450ebd82f | ||
|
|
3ec086ea2d | ||
|
|
4af171bcf5 | ||
|
|
380da3898f | ||
|
|
f413039e7d | ||
|
|
ef8109a562 | ||
|
|
4437950524 | ||
|
|
27b0786947 | ||
|
|
f1be5c5989 | ||
|
|
596084d2f6 | ||
|
|
541f93d1fd | ||
|
|
84681f407c | ||
|
|
4e04feb7c8 | ||
|
|
704eaec45d | ||
|
|
0d9db5fb14 | ||
|
|
555a645106 | ||
|
|
8429725fe0 | ||
|
|
47940333e0 | ||
|
|
13b8bd0af8 | ||
|
|
3da6ba2ec1 | ||
|
|
ff83c78dc2 | ||
|
|
3b99a2e4b2 | ||
|
|
5f79d3169c | ||
|
|
6b1f1e485f | ||
|
|
1482f0e873 | ||
|
|
6c44e90a1f | ||
|
|
f105e65abb | ||
|
|
13873321c7 | ||
|
|
276795f1e0 | ||
|
|
3703a3d1c9 | ||
|
|
066301a635 | ||
|
|
020beb210d | ||
|
|
0ff77ff232 | ||
|
|
e0a0819735 | ||
|
|
aeec251697 | ||
|
|
90e32dfb84 | ||
|
|
1c50d0be24 | ||
|
|
a715b621a3 |
No files matched your search
@@ -1,12 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
# Description: run apkbuild-lint on modified APKBUILDs
|
||||
# Options: with-dot-git
|
||||
# https://postmarketos.org/pmb-ci
|
||||
|
||||
if [ "$(id -u)" = 0 ]; then
|
||||
set -x
|
||||
apk add atools git python3
|
||||
exec su "${TESTUSER:-build}" -c "sh -e $0"
|
||||
fi
|
||||
|
||||
.ci/lib/apkbuild_linting.py
|
||||
@@ -1,106 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
if [ "$(id -u)" = 0 ]; then
|
||||
set -x
|
||||
apk add git openssh-keygen grep curl
|
||||
wget "https://gitlab.postmarketos.org/postmarketOS/ci-common/-/raw/master/install_pmbootstrap.sh"
|
||||
sh ./install_pmbootstrap.sh
|
||||
exec su "${TESTUSER:-pmos}" -c "sh -e $0 $*"
|
||||
fi
|
||||
|
||||
git config --global --add safe.directory "$CI_PROJECT_DIR"
|
||||
git config --global user.name "postmarketOS CI"
|
||||
# The username for the bot associated with the access token
|
||||
# e.g. project_226_bot_bfa19b84bf7f559c8ff7438a01fd29b9
|
||||
git config --global user.email "$PMAPORTS_TOKEN_BOT@noreply.gitlab.postmarketos.org"
|
||||
|
||||
# Configure SSH key for signing
|
||||
mkdir -p ~/.ssh
|
||||
cp "$PMAPORTS_SSH_KEY" ~/.ssh/pmaports
|
||||
chmod 600 ~/.ssh/pmaports
|
||||
# Generate public key from private
|
||||
ssh-keygen -t ecdsa -f ~/.ssh/pmaports -y > ~/.ssh/pmaports.pub
|
||||
|
||||
git config --global gpg.format ssh
|
||||
git config --global user.signingkey ~/.ssh/pmaports.pub
|
||||
|
||||
export PYTHONUNBUFFERED=1
|
||||
|
||||
PKGS="$1"
|
||||
if [ -z "$PKGS" ]; then
|
||||
echo "Usage: $0 <packages>"
|
||||
exit 1
|
||||
fi
|
||||
echo "Checking for new versions of packages: $PKGS"
|
||||
|
||||
update_linux_next() {
|
||||
# Check for the latest -next tag
|
||||
local latest
|
||||
local pkgver
|
||||
local new_pkgver
|
||||
|
||||
# Get the current version
|
||||
# shellcheck source=/dev/null
|
||||
pkgver=$(. device/testing/linux-next/APKBUILD; echo "$pkgver")
|
||||
|
||||
curl -s https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/refs/tags/ | grep -oE "<a href='.*'>(.*)</a>.*\.tar\.gz</a>" | awk -F'[<>]' '{print $3}' > /tmp/tags
|
||||
|
||||
latest=$(grep -v "v" < /tmp/tags | head -n1)
|
||||
if [ -z "$latest" ]; then
|
||||
echo "Failed to get the latest -next tag"
|
||||
exit 1
|
||||
fi
|
||||
echo "Latest -next tag: $latest"
|
||||
|
||||
new_pkgver=$(grep "v" < /tmp/tags | head -n1)
|
||||
if [ -z "$new_pkgver" ]; then
|
||||
echo "Failed to get the latest mainline tag from atom feed, reusing current pkgver"
|
||||
new_pkgver="${pkgver%_git*}"
|
||||
else
|
||||
echo "Latest mainline tag: $new_pkgver"
|
||||
# new_pkgver is like 'v6.9-rc1' but we want '6.9'
|
||||
new_pkgver=$(echo "$new_pkgver" | sed -e 's/^v//' -e 's/-.*//')
|
||||
fi
|
||||
|
||||
new_pkgver="${new_pkgver}_git${latest#*-}"
|
||||
|
||||
if [ "$pkgver" = "$new_pkgver" ]; then
|
||||
echo "No new version of linux-next"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "Updating linux-next from $pkgver to $new_pkgver..."
|
||||
sed -i -e "s/pkgver=$pkgver/pkgver=$new_pkgver/" device/testing/linux-next/APKBUILD
|
||||
sed -i -e "s/^pkgrel=.*/pkgrel=0/" device/testing/linux-next/APKBUILD
|
||||
|
||||
# Update the checksums
|
||||
pmbootstrap checksum linux-next
|
||||
|
||||
# Ensure it builds
|
||||
pmbootstrap --details-to-stdout build linux-next
|
||||
|
||||
# Commit
|
||||
git add device/testing/linux-next/APKBUILD
|
||||
git commit -S -m "linux-next: upgrade to $latest"
|
||||
}
|
||||
|
||||
# For testing
|
||||
#git remote add gitlab https://pmos-ci:"$PMAPORTS_PUSH_TOKEN"@gitlab.postmarketos.org/postmarketOS/pmaports-autoupdate-test.git
|
||||
|
||||
git remote add gitlab https://pmos-ci:"$PMAPORTS_PUSH_TOKEN"@gitlab.postmarketos.org/postmarketOS/pmaports.git
|
||||
git fetch gitlab
|
||||
git checkout --track gitlab/master
|
||||
|
||||
for pkg in $PKGS; do
|
||||
case "$pkg" in
|
||||
linux-next)
|
||||
update_linux_next
|
||||
;;
|
||||
*)
|
||||
echo "Unknown package: $pkg"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
git push
|
||||
@@ -1 +0,0 @@
|
||||
lib/build_changed_aports.sh
|
||||
@@ -1 +0,0 @@
|
||||
lib/build_changed_aports.sh
|
||||
@@ -1 +0,0 @@
|
||||
lib/build_changed_aports.sh
|
||||
@@ -1,20 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
# Copyright 2025 Pablo Correa Gomez
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
# Description: create documentation with antora
|
||||
# Options: with-dot-git
|
||||
# Artifacts: build/site
|
||||
# https://postmarketos.org/pmb-ci
|
||||
|
||||
|
||||
# Install dependencies
|
||||
if [ "$(id -u)" = 0 ]; then
|
||||
set -x
|
||||
apk -q add py3-pip make git
|
||||
apk add dint --allow-untrusted --repository=https://mirror.postmarketos.org/postmarketos/master
|
||||
exec su "${TESTUSER:-build}" -c "sh -e $0"
|
||||
fi
|
||||
|
||||
cd docs/
|
||||
make venv
|
||||
make
|
||||
@@ -1,142 +0,0 @@
|
||||
image: alpine:latest
|
||||
stages:
|
||||
- build
|
||||
- hardware tests
|
||||
|
||||
variables:
|
||||
CI_TRON_TEMPLATE_PROJECT: &ci-tron-template-project postmarketOS/ci-common
|
||||
CI_TRON_JOB_TEMPLATE_PROJECT_URL: $CI_SERVER_URL/$CI_TRON_TEMPLATE_PROJECT
|
||||
CI_TRON_JOB_TEMPLATE_COMMIT: &ci-tron-template-commit 7c95b5f2d53533e8722abf57c73e558168e811f3
|
||||
|
||||
include:
|
||||
- project: *ci-tron-template-project
|
||||
ref: *ci-tron-template-commit
|
||||
file: '/ci-tron/common.yml'
|
||||
|
||||
workflow:
|
||||
rules:
|
||||
- if: $CI_PIPELINE_SOURCE == "parent_pipeline"
|
||||
|
||||
.build:
|
||||
# Create jobs, but do not run them unless this is
|
||||
# overriden in jobs that extend it
|
||||
stage: build
|
||||
interruptible: true
|
||||
before_script:
|
||||
# upgrade is mostly needed for "qemu" runners that run edge based on a VM
|
||||
# The other build jobs run natively in docker on latest alpine stable and
|
||||
# those should always have whatever we need
|
||||
- apk upgrade -U
|
||||
- .ci/lib/gitlab_prepare_ci.sh
|
||||
after_script:
|
||||
- cp -r /home/pmos/.local/var/pmbootstrap/packages/ packages/ || true
|
||||
- mkdir -p keys
|
||||
- cp /home/pmos/.local/var/pmbootstrap/config_apk_keys/pmos@local*.pub keys/ || true
|
||||
- .ci/lib/move_logs.sh $CI_PROJECT_DIR
|
||||
artifacts:
|
||||
expire_in: 1 week
|
||||
paths:
|
||||
- packages/
|
||||
- keys/
|
||||
timeout: 10 h
|
||||
|
||||
build:
|
||||
extends: .build
|
||||
parallel:
|
||||
matrix:
|
||||
{% for arch in archs %}
|
||||
- ARCH: {{ arch }}
|
||||
TAG: {{ archtag[arch] }}
|
||||
{% endfor %}
|
||||
{% if archs|length == 0 %}
|
||||
- ARCH: placeholder
|
||||
TAG: shared
|
||||
{% endif %}
|
||||
tags:
|
||||
- $TAG
|
||||
script:
|
||||
# Needed because gitlab fails if no jobs are ran:
|
||||
# - https://gitlab.com/gitlab-org/gitlab/-/issues/368248
|
||||
{% if archs|length == 0 %}
|
||||
- 'true'
|
||||
{% else %}
|
||||
- .ci/build-$ARCH.sh
|
||||
{% endif %}
|
||||
|
||||
# Hardware testing
|
||||
|
||||
# Define here all the gitlab-ci snippets that could be common between the
|
||||
# different packages
|
||||
|
||||
# Extends from this job if the the build job generates a kernel and initramfs
|
||||
# artifact for your target device. This will not work if your device generates
|
||||
# boot images.
|
||||
.device-boot-flow-separate-artifacts:
|
||||
variables:
|
||||
CI_TRON_KERNEL__URL: "glartifact://${CI_TRON__PMB_BUILD_JOB}/${CI_TRON__PMB_EXPORT_PATH}/${KERNEL_NAME}"
|
||||
CI_TRON_INITRAMFS__INITRAMFS__URL: "glartifact://${CI_TRON__PMB_BUILD_JOB}/${CI_TRON__PMB_EXPORT_PATH}/initramfs"
|
||||
|
||||
# NOTE: For fastboot devices, we will need to use something like this
|
||||
# .ci-tron-device-boot-flow-fastboot-image:
|
||||
# variables:
|
||||
# CI_TRON_FASTBOOT__BOOT_IMAGE: "glartifact://${CI_TRON__PMB_BUILD_JOB}/${CI_TRON__PMB_EXPORT_PATH}/bootimg"
|
||||
|
||||
# Include all the devices that need and can to be tested
|
||||
|
||||
{% for device in devices_under_test if device.is_present_in_ci %}
|
||||
prepare-{{ device.name }}:
|
||||
stage: hardware tests
|
||||
extends:
|
||||
.pmos-ci-tron-build-boot-artifacts
|
||||
{%- if device.has_kernel_variants %}
|
||||
# Let's build all the boot artifacts for all the supported kernels in
|
||||
# different jobs, but hide them behind a single job name so as not to pollute
|
||||
# the pipeline.
|
||||
parallel:
|
||||
matrix:
|
||||
- KERNEL_VARIANT:
|
||||
{%- for kernel in device.kernels %}
|
||||
- {{ kernel }}
|
||||
{%- endfor %}
|
||||
{%- endif %}
|
||||
needs:
|
||||
- job: "build"
|
||||
parallel:
|
||||
matrix:
|
||||
- ARCH: "{{ device.arch }}"
|
||||
TAG: "{{ archtag[device.arch] }}"
|
||||
variables:
|
||||
DEVICE_NAME: {{ device.name }}
|
||||
# NOTE: All the packages that may influence testing should have an
|
||||
# `install-if postmarketos-mkinitfs-hook-ci`, so no need to add them here
|
||||
INSTALL_PACKAGES: {{ device.pkgname }} {{ device.pkgname }}-kernel-${KERNEL_VARIANT} postmarketos-mkinitfs-hook-ci
|
||||
|
||||
.test-{{ device.name }}:
|
||||
stage: hardware tests
|
||||
extends:
|
||||
- .pmos-ci-tron-initramfs-test
|
||||
{%- if device.has_kernel_variants %}
|
||||
# Let's test all the kernels in different jobs, but hide them behind a single
|
||||
# job name so as not to pollute the pipeline.
|
||||
parallel:
|
||||
matrix:
|
||||
- KERNEL_VARIANT:
|
||||
{%- for kernel in device.kernels %}
|
||||
- {{ kernel }}
|
||||
{%- endfor %}
|
||||
{%- endif %}
|
||||
dependencies: []
|
||||
needs:
|
||||
- job: 'prepare-{{ device.name }}'
|
||||
artifacts: false
|
||||
# NOTE: We can't wait for a particular job in the matrix until GitLab implements support for it:
|
||||
# https://gitlab.com/gitlab-org/gitlab/-/issues/423553
|
||||
variables:
|
||||
CI_TRON__PMB_BUILD_JOB: "prepare-{{ device.name }}{% if device.has_kernel_variants %}: [$KERNEL_VARIANT]{% endif %}"
|
||||
CI_TRON_KERNEL_CMDLINE__DEVICEINFO: '{{ device.deviceinfo.kernel_cmdline }}'
|
||||
|
||||
# Include the gitlab ci yml fragment, as found in
|
||||
# `device/$category/device-$devicename/gitlab-ci.yml.j2` which defines the jobs
|
||||
{{ device.gitlab_ci_fragment }}
|
||||
|
||||
{% endfor %}
|
||||
@@ -1 +0,0 @@
|
||||
lib/build_changed_aports.sh
|
||||
@@ -1 +0,0 @@
|
||||
lib/build_changed_aports.sh
|
||||
@@ -1 +0,0 @@
|
||||
lib/build_changed_aports.sh
|
||||
@@ -1 +0,0 @@
|
||||
lib/build_changed_aports.sh
|
||||
@@ -1,20 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
# Copyright 2023 Oliver Smith
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
# Description: check pkgver/pkgrel bumps, amount of changed pkgs etc
|
||||
# Options: native
|
||||
# Use 'native' because it requires git commit history.
|
||||
# https://postmarketos.org/pmb-ci
|
||||
|
||||
if [ "$(id -u)" = 0 ]; then
|
||||
set -x
|
||||
# In .gitlab-ci.yml currently .ci/pytest.sh runs before this and
|
||||
# already downloads and runs install_pmbootstrap.sh.
|
||||
if ! [ -e install_pmbootstrap.sh ]; then
|
||||
wget "https://gitlab.postmarketos.org/postmarketOS/ci-common/-/raw/master/install_pmbootstrap.sh"
|
||||
sh ./install_pmbootstrap.sh
|
||||
fi
|
||||
exec su "${TESTUSER:-pmos}" -c "sh -e $0"
|
||||
fi
|
||||
|
||||
.ci/lib/check_changed_aports_versions.py
|
||||
-13
@@ -1,13 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
# Description: Validate and lint deviceinfo files
|
||||
# Options: with-dot-git
|
||||
# https://postmarketos.org/pmb-ci
|
||||
|
||||
if [ "$(id -u)" = 0 ]; then
|
||||
set -x
|
||||
apk add git python3
|
||||
apk add dint --allow-untrusted --repository=https://mirror.postmarketos.org/postmarketos/master
|
||||
exec su "${TESTUSER:-build}" -c "sh -e $0"
|
||||
fi
|
||||
|
||||
.ci/lib/deviceinfo_linting.py
|
||||
@@ -1,13 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
# Description: editorconfig-checker: lint for trailing whitespaces etc.
|
||||
# https://postmarketos.org/pmb-ci
|
||||
|
||||
if [ "$(id -u)" = 0 ]; then
|
||||
set -x
|
||||
apk -q add \
|
||||
editorconfig-checker
|
||||
exec su "${TESTUSER:-build}" -c "sh -e $0"
|
||||
fi
|
||||
|
||||
set -x
|
||||
ec
|
||||
-113
@@ -1,113 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
# Description: check various bad patterns with grep
|
||||
# https://postmarketos.org/pmb-ci
|
||||
|
||||
exit_code=0
|
||||
|
||||
if [ "$(id -u)" = 0 ]; then
|
||||
set -x
|
||||
apk -q add grep
|
||||
exec su "${TESTUSER:-build}" -c "sh -e $0"
|
||||
fi
|
||||
|
||||
# Find CHANGEMEs in APKBUILDs
|
||||
if grep -qr '(CHANGEME!)' -- *; then
|
||||
echo "ERROR: Please replace '(CHANGEME!)' in the following files:"
|
||||
grep --color=always -r '(CHANGEME!)' -- *
|
||||
exit_code=1
|
||||
fi
|
||||
|
||||
# DTBs installed to /usr/share/db
|
||||
# shellcheck disable=SC2016
|
||||
if grep -qr 'INSTALL_DTBS_PATH="$pkgdir"/usr/share/dtb' device/; then
|
||||
echo 'ERROR: Please do not install dtbs to /usr/share/dtb!'
|
||||
echo 'ERROR: Unless you have a good reason not to, please put them in /boot/dtbs'
|
||||
echo 'ERROR: Files that need fixing:'
|
||||
# shellcheck disable=SC2016
|
||||
grep --color=always -r 'INSTALL_DTBS_PATH="$pkgdir"/usr/share/dtb' device/
|
||||
exit_code=1
|
||||
fi
|
||||
|
||||
|
||||
# Find old mkinitfs paths (pre mkinitfs 2.0)
|
||||
if grep -qr '/etc/postmarketos-mkinitfs' -- *; then
|
||||
echo "ERROR: Please replace '/etc/postmarketos-mkinitfs' with '/usr/share/mkinitfs' in the following files:"
|
||||
grep --color=always -r '/etc/postmarketos-mkinitfs' -- *
|
||||
exit_code=1
|
||||
fi
|
||||
if grep -qr '/usr/share/postmarketos-mkinitfs' -- *; then
|
||||
echo "ERROR: Please replace '/usr/share/postmarketos-mkinitfs' with '/usr/share/mkinitfs' in the following files:"
|
||||
grep --color=always -r '/usr/share/postmarketos-mkinitfs' -- *
|
||||
exit_code=1
|
||||
fi
|
||||
|
||||
# Direct sourcing of deviceinfo
|
||||
if grep --exclude='source_deviceinfo' -qEr 'source /etc/deviceinfo|\. /etc/deviceinfo' -- *; then
|
||||
echo 'ERROR: Please source the source_deviceinfo script instead of sourcing deviceinfo directly!'
|
||||
grep --color=always --exclude='rootfs-usr-share-misc-source_deviceinfo' -Er 'source /etc/deviceinfo|\. /etc/deviceinfo' -- *
|
||||
exit_code=1
|
||||
fi
|
||||
|
||||
# Removed deviceinfo variable
|
||||
if grep -qr 'deviceinfo_modules_initfs' -- *; then
|
||||
echo 'ERROR: deviceinfo_modules_initfs variable has been removed. Use "modules-initfs" file instead.'
|
||||
grep --color=always -r 'deviceinfo_modules_initfs' -- *
|
||||
exit_code=1
|
||||
fi
|
||||
|
||||
POSTMARKETOS_WALLPAPER_PATH='/usr/share/wallpapers/postmarketos.jpg'
|
||||
# The excluded devices are "grandfathered in". New devices should not be added here.
|
||||
# See https://gitlab.postmarketos.org/postmarketOS/pmaports/-/issues/2529
|
||||
if grep -qr $POSTMARKETOS_WALLPAPER_PATH \
|
||||
--exclude-dir='device-pine64-pinetab' \
|
||||
--exclude-dir='device-oneplus-kebab' \
|
||||
--exclude-dir='device-xiaomi-willow' \
|
||||
-- device; then
|
||||
echo "ERROR: Please don't include configuration files that set the default wallpaper in device-specific packages!"
|
||||
grep --color=always -r $POSTMARKETOS_WALLPAPER_PATH \
|
||||
--exclude-dir='device-pine64-pinetab' \
|
||||
--exclude-dir='device-oneplus-kebab' \
|
||||
--exclude-dir='device-xiaomi-willow' \
|
||||
-- device
|
||||
exit_code=1
|
||||
fi
|
||||
|
||||
OPENRC_SERVICE_FILES=$(find . -name '*.initd')
|
||||
# shellcheck disable=SC2086
|
||||
if grep -q 'before wpa_supplicant' $OPENRC_SERVICE_FILES; then
|
||||
echo "ERROR: Please use 'before wlan' in OpenRC service files! This ensures compatibility with both wpa_supplicant and iwd."
|
||||
grep --color=always 'before wpa_supplicant' $OPENRC_SERVICE_FILES
|
||||
exit_code=1
|
||||
fi
|
||||
|
||||
if grep -qEr 'PMOS_NO_OUTPUT_REDIRECT' -- *; then
|
||||
echo "ERROR: PMOS_NO_OUTPUT_REDIRECT is deprecated and doesn't do anything."
|
||||
echo "Please remove it from the following files:"
|
||||
grep --color=always -Er 'PMOS_NO_OUTPUT_REDIRECT' -- *
|
||||
exit_code=1
|
||||
fi
|
||||
|
||||
if grep -qEr '^deviceinfo_kernel_cmdline.*[\"\s]console=null' -- device/; then
|
||||
echo "ERROR: Do not use console=null in the kernel command line."
|
||||
echo "Use these params to quiet console on boot: quiet loglevel=2"
|
||||
echo "For more information, see: https://gitlab.postmarketos.org/postmarketOS/pmaports/-/issues/2989"
|
||||
exit_code=1
|
||||
fi
|
||||
|
||||
# Disallow installation of files to /etc/modules-load.d and /etc/modprobe.d
|
||||
if grep -qr '/etc/modules-load.d' --exclude-dir='device-samsung-golden-downstream' -- *; then
|
||||
echo "ERROR: Please replace '/etc/modules-load.d' with '/usr/lib/modules-load.d' in the following files:"
|
||||
grep --color=always -r '/etc/modules-load.d' --exclude-dir='device-samsung-golden-downstream' -- *
|
||||
exit_code=1
|
||||
fi
|
||||
# n900 is excluded because the string is in a comment linking to a repo.
|
||||
# No other non-archived devices should be excluded.
|
||||
if grep -qr '/etc/modprobe.d' --exclude-dir='archived' \
|
||||
--exclude-dir='device-nokia-n900' -- *; then
|
||||
echo "ERROR: Please replace '/etc/modprobe.d' with '/usr/lib/modprobe.d' in the following files:"
|
||||
grep --color=always -r '/etc/modprobe.d' --exclude-dir='device-nokia-n900' \
|
||||
--exclude-dir='archived' -- *
|
||||
exit_code=1
|
||||
fi
|
||||
|
||||
exit "$exit_code"
|
||||
@@ -1,16 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
# Description: check modified kernel configs
|
||||
# Options: native
|
||||
# Use 'native' because it requires running pmbootstrap.
|
||||
# https://postmarketos.org/pmb-ci
|
||||
|
||||
if [ "$(id -u)" = 0 ]; then
|
||||
set -x
|
||||
wget "https://gitlab.postmarketos.org/postmarketOS/ci-common/-/raw/master/install_pmbootstrap.sh"
|
||||
sh ./install_pmbootstrap.sh
|
||||
exec su "${TESTUSER:-pmos}" -c "sh -e $0"
|
||||
fi
|
||||
|
||||
export PYTHONUNBUFFERED=1
|
||||
|
||||
.ci/lib/check_changed_kernels.py
|
||||
@@ -1 +0,0 @@
|
||||
../testcases/add_pmbootstrap_to_import_path
|
||||
@@ -1,63 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
import common
|
||||
import os
|
||||
import sys
|
||||
import subprocess
|
||||
import tomllib
|
||||
|
||||
|
||||
custom_valid_options = [
|
||||
"!pmb:crossdirect",
|
||||
"!pmb:kconfigcheck",
|
||||
"pmb:cross-native",
|
||||
"pmb:cross-native2",
|
||||
"pmb:drm",
|
||||
"pmb:gpu-accel", # deprecated
|
||||
"pmb:strict",
|
||||
"pmb:systemd",
|
||||
"pmb:systemd-never",
|
||||
]
|
||||
|
||||
|
||||
def get_kconfigcheck_categories() -> list [str]:
|
||||
with open("kconfigcheck.toml", "rb") as kconfigcheck_config:
|
||||
kconfigcheck_data = tomllib.load(kconfigcheck_config)
|
||||
|
||||
kconfigcheck_categories = []
|
||||
|
||||
for category_name in kconfigcheck_data:
|
||||
if category_name == "aliases":
|
||||
for alias_name in kconfigcheck_data["aliases"]:
|
||||
kconfigcheck_categories.append(f"pmb:kconfigcheck-{alias_name}")
|
||||
else:
|
||||
kconfigcheck_categories.append(category_name)
|
||||
|
||||
return [item.replace("category:", "pmb:kconfigcheck-") for item in kconfigcheck_categories]
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
kconfigcheck_categories = get_kconfigcheck_categories()
|
||||
custom_valid_options += kconfigcheck_categories
|
||||
os.environ["CUSTOM_VALID_OPTIONS"] = " ".join(custom_valid_options)
|
||||
|
||||
apkbuilds = {file for file in common.get_changed_files(removed=False)
|
||||
if os.path.basename(file) == "APKBUILD"}
|
||||
if len(apkbuilds) < 1:
|
||||
print("No APKBUILDs to lint")
|
||||
sys.exit(0)
|
||||
|
||||
apkbuilds_filtered = []
|
||||
for apkbuild in apkbuilds:
|
||||
if apkbuild.startswith("temp/") or apkbuild.startswith("cross/"):
|
||||
print(f"NOTE: Skipping linting of {apkbuild}")
|
||||
continue
|
||||
apkbuilds_filtered.append(apkbuild)
|
||||
if len(apkbuilds_filtered) < 1:
|
||||
print("No APKBUILDs to lint")
|
||||
sys.exit(0)
|
||||
try:
|
||||
subprocess.run(["apkbuild-lint", *apkbuilds_filtered], text=True, check=True)
|
||||
except subprocess.CalledProcessError as exception:
|
||||
sys.exit(exception.returncode)
|
||||
@@ -1,106 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# Copyright 2021 Oliver Smith
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
import sys
|
||||
import os
|
||||
import pathlib
|
||||
|
||||
# Same dir
|
||||
import common
|
||||
|
||||
# pmbootstrap
|
||||
import add_pmbootstrap_to_import_path
|
||||
import pmb.core
|
||||
import pmb.parse
|
||||
import pmb.parse._apkbuild
|
||||
import pmb.helpers.pmaports
|
||||
from pmb.core.context import get_context
|
||||
|
||||
|
||||
def build_strict(packages, arch):
|
||||
common.run_pmbootstrap(["build_init"])
|
||||
# We set the timeout to 1 hour because linking the Linux kernel with
|
||||
# ThinLTO on our aarch64 runners takes slightly over 30 minutes
|
||||
common.run_pmbootstrap(["--details-to-stdout", "--no-ccache",
|
||||
"--timeout", "3600",
|
||||
"build",
|
||||
"--strict", "--force",
|
||||
"--arch", arch, ] + list(packages))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Architecture to build for (as in build-{arch})
|
||||
if len(sys.argv) != 2:
|
||||
print("usage: build_changed_aports.py ARCH")
|
||||
sys.exit(1)
|
||||
arch = sys.argv[1]
|
||||
|
||||
# Get and print modified packages
|
||||
packages = common.get_changed_packages(skip_archived=True)
|
||||
|
||||
# Load context
|
||||
sys.argv = ["pmbootstrap.py", "chroot"]
|
||||
args = pmb.parse.arguments()
|
||||
context = get_context()
|
||||
|
||||
# Get set of all buildable packages for the enabled repos, for skipping unbuildable
|
||||
# aports later. We might be given a changed aport from e.g. extra-repos/systemd when
|
||||
# that repo is not enabled
|
||||
buildable_pkgs = set()
|
||||
for path in pmb.core.pkgrepo.pkgrepo_iter_package_dirs():
|
||||
buildable_pkgs.add(os.path.basename(path))
|
||||
|
||||
# To store a list of packages from extra-repos/systemd for special handling later:
|
||||
systemd_pkgs = list()
|
||||
|
||||
# Filter out packages that either:
|
||||
# 1. can't be built for given arch
|
||||
# 2. are not found in enabled repos
|
||||
# (Iterate over copy of packages, because we modify it in this loop)
|
||||
for package in packages.copy():
|
||||
if package not in buildable_pkgs:
|
||||
print(f"{package}: not in any available repos, skipping")
|
||||
packages.remove(package)
|
||||
# FIXME: this should probably be more generic, if other repos are added later?
|
||||
# This just tosses the package into the list of packages to try building later w/ systemd enabled, and assumes it'll be found there.
|
||||
systemd_pkgs.append(package)
|
||||
continue
|
||||
|
||||
apkbuild_path = pmb.helpers.pmaports.find(package)
|
||||
apkbuild = pmb.parse._apkbuild.apkbuild(pathlib.Path(apkbuild_path, "APKBUILD"))
|
||||
|
||||
if not pmb.helpers.pmaports.check_arches(apkbuild["arch"], arch):
|
||||
print(f"{package}: not enabled for {arch}, skipping")
|
||||
packages.remove(package)
|
||||
|
||||
# No packages: skip build
|
||||
if len(packages) == 0:
|
||||
print(f"no packages changed, which can be built for {arch}")
|
||||
sys.exit(0)
|
||||
|
||||
build_strict(packages, arch)
|
||||
|
||||
# Build packages in extra-repos/systemd
|
||||
# FIXME: this should probably be more generic, if other repos are added later?
|
||||
if systemd_pkgs:
|
||||
common.run_pmbootstrap(["config", "systemd", "always"])
|
||||
# To fix the ERROR: Chroot 'native' is for the 'edge' channel, but you are on the
|
||||
# 'systemd-edge' channel. Run 'pmbootstrap zap' to delete your chroots and try again.
|
||||
# To do this automatically, run 'pmbootstrap config auto_zap_misconfigured_chroots yes'.
|
||||
common.run_pmbootstrap(["config", "auto_zap_misconfigured_chroots", "yes"])
|
||||
|
||||
# filter out packages that can't be built for arch
|
||||
# (Iterate over copy of `systemd_pkgs`, because we modify it in this loop)
|
||||
for package in systemd_pkgs.copy():
|
||||
apkbuild_path = pmb.helpers.pmaports.find(package, True, True, with_extra_repos="enabled")
|
||||
apkbuild = pmb.parse._apkbuild.apkbuild(pathlib.Path(apkbuild_path, "APKBUILD"))
|
||||
if not pmb.helpers.pmaports.check_arches(apkbuild["arch"], arch):
|
||||
print(f"(extra-repos/systemd) {package}: not enabled for {arch}, skipping")
|
||||
systemd_pkgs.remove(package)
|
||||
|
||||
# No packages: skip build
|
||||
if len(systemd_pkgs) == 0:
|
||||
print(f"no packages changed, which can be built for {arch}")
|
||||
sys.exit(0)
|
||||
|
||||
build_strict(systemd_pkgs, arch)
|
||||
@@ -1,19 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
# Description: build modified packages for this architecture
|
||||
# Options: native slow
|
||||
# https://postmarketos.org/pmb-ci
|
||||
|
||||
if [ "$(id -u)" = 0 ]; then
|
||||
set -x
|
||||
wget "https://gitlab.postmarketos.org/postmarketOS/ci-common/-/raw/master/install_pmbootstrap.sh"
|
||||
sh ./install_pmbootstrap.sh
|
||||
exec su "${TESTUSER:-pmos}" -c "sh -e $0"
|
||||
fi
|
||||
|
||||
export PYTHONUNBUFFERED=1
|
||||
|
||||
# Get the architecture from the symlink we are running
|
||||
arch="$(echo "$0" | cut -d '-' -f 2 | cut -d '.' -f 1)"
|
||||
|
||||
set -x
|
||||
.ci/lib/build_changed_aports.py "$arch"
|
||||
@@ -1,247 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# Copyright 2021 Oliver Smith
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
import glob
|
||||
import pathlib
|
||||
import tempfile
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
# Same dir
|
||||
import common
|
||||
|
||||
# pmbootstrap
|
||||
import add_pmbootstrap_to_import_path # noqa
|
||||
import pmb.parse
|
||||
import pmb.parse.version
|
||||
import pmb.helpers.logging
|
||||
from pmb.core.context import get_context
|
||||
|
||||
def get_package_contents(package, revision, check=True):
|
||||
# Redirect stderr to /dev/null, so git doesn't complain about files not
|
||||
# existing in upstream branch for new packages
|
||||
stderr = None
|
||||
if not check:
|
||||
stderr = subprocess.DEVNULL
|
||||
|
||||
# Run something like "git show upstream/master:main/hello-world/APKBUILD"
|
||||
pmaports_dir = common.get_pmaports_dir()
|
||||
pattern = pmaports_dir + "/**/" + package + "/APKBUILD"
|
||||
path = glob.glob(pattern, recursive=True)[0][len(pmaports_dir + "/"):]
|
||||
apkbuild_content = common.run_git(["show", revision + ":" + path], check,
|
||||
stderr)
|
||||
if not apkbuild_content:
|
||||
return None
|
||||
|
||||
# Save APKBUILD to a temporary path and parse it from there. (Not the best
|
||||
# way to do things, but good enough for this CI script.)
|
||||
with tempfile.TemporaryDirectory() as tempdir:
|
||||
with open(tempdir + "/APKBUILD", "w", encoding="utf-8") as handle:
|
||||
handle.write(apkbuild_content)
|
||||
parsed = pmb.parse.apkbuild(pathlib.Path(tempdir, "APKBUILD"),
|
||||
False, False)
|
||||
|
||||
return parsed
|
||||
|
||||
|
||||
def get_package_version(package, revision, check=True):
|
||||
""" returns version in the format "{pkgver}-r{pkgrel}", or None if no
|
||||
matching package is found """
|
||||
parsed = get_package_contents(package, revision, check)
|
||||
if parsed is None:
|
||||
return None
|
||||
return parsed["pkgver"] + "-r" + parsed["pkgrel"]
|
||||
|
||||
|
||||
def version_compare_operator(result):
|
||||
""" :param result: return value from pmb.parse.version.compare() """
|
||||
if result == -1:
|
||||
return "<"
|
||||
elif result == 0:
|
||||
return "=="
|
||||
elif result == 1:
|
||||
return ">"
|
||||
|
||||
raise RuntimeError("Unexpected version_compare_operator input: " + result)
|
||||
|
||||
|
||||
def exit_with_error_message():
|
||||
branch = common.get_upstream_branch()
|
||||
print()
|
||||
print("ERROR: Modified package(s) don't have an increased version or a")
|
||||
print("new package has a nonzero pkgrel!")
|
||||
print()
|
||||
print("This can happen if you added a new package with a nonzero")
|
||||
print("pkgrel, or if you did not change the pkgver/pkgrel")
|
||||
print("variables in the APKBUILDs. Or you did change them, but the")
|
||||
print(f"packages have been updated in the official '{branch}' branch, and")
|
||||
print("now your versions are not higher anymore.")
|
||||
print()
|
||||
print("Your options:")
|
||||
print("a) If you made changes to the packages, and did not increase the")
|
||||
print(" pkgrel/pkgver: increase them now, and force push your branch.")
|
||||
print(" => https://postmarketos.org/howto-bump-pkgrel-pkgver")
|
||||
print("b) If you had already increased the package versions, rebase on")
|
||||
print(f" '{branch}', increase the versions again and then force push:")
|
||||
print(" => https://postmarketos.org/rebase")
|
||||
print("c) If you made a change, that does not require rebuilding the")
|
||||
print(" packages, such as only changing the arch=... line: you can")
|
||||
print(" disable this check by adding '[ci:skip-vercheck]' to the")
|
||||
print(" latest commit message, then force push.")
|
||||
print()
|
||||
print("Thank you and sorry for the inconvenience.")
|
||||
exit(1)
|
||||
|
||||
|
||||
def check_versions(packages):
|
||||
error = False
|
||||
|
||||
# Get relevant commits: compare HEAD against upstream branch or HEAD~1
|
||||
# (the latter if this CI check is running on upstream branch). Note that
|
||||
# for the common.get_changed_files() code, we don't check against
|
||||
# upstream branch HEAD, but against the latest common ancestor. This is not
|
||||
# desired here, since we already know what packages changed, and really
|
||||
# want to check if the version was increased towards *current* upstream
|
||||
# branch HEAD.
|
||||
common.run_git(["remote", "add", "upstream",
|
||||
"https://gitlab.postmarketos.org/postmarketOS/pmaports.git"], False)
|
||||
common.run_git(["fetch", "-q", "upstream"])
|
||||
commit = f"upstream/{common.get_upstream_branch()}"
|
||||
if common.run_git(["rev-parse", "HEAD"]) == common.run_git(["rev-parse",
|
||||
commit]):
|
||||
print(f"NOTE: {commit} is on same commit as HEAD, comparing"
|
||||
" HEAD against HEAD~1.")
|
||||
commit = "HEAD~1"
|
||||
|
||||
# Exclude linux-next from pkgrel checks, as it is updated automatically.
|
||||
#
|
||||
# Without this, .ci/commits.sh complains about the following:
|
||||
# ERROR: Modified package(s) don't have an increased version or a new
|
||||
# package has a nonzero pkgrel!
|
||||
if "linux-next" in packages:
|
||||
packages.remove("linux-next")
|
||||
|
||||
for package in packages:
|
||||
# Get versions, skip new packages
|
||||
head = get_package_version(package, "HEAD")
|
||||
upstream = get_package_version(package, commit, False)
|
||||
if not upstream:
|
||||
if head.rpartition('r')[2] != "0":
|
||||
print(f"- {package}: {head} (HEAD) (new package) [ERROR]")
|
||||
error = True
|
||||
else:
|
||||
print(f"- {package}: {head} (HEAD) (new package)")
|
||||
continue
|
||||
|
||||
# Check pkgver follows expected format for device packages
|
||||
pkgver = head.rpartition('-r')[0]
|
||||
if package.startswith('device-') and not pkgver.isdigit():
|
||||
print(f" - {package}: invalid pkgver \"{pkgver}\""
|
||||
"See: https://wiki.postmarketos.org/wiki/Packaging#device_packages_and_other_packages_without_sources")
|
||||
error = True
|
||||
|
||||
# Additional checks for device packages
|
||||
if package.startswith('device-'):
|
||||
head_parsed = get_package_contents(package, "HEAD", False)
|
||||
upstream_parsed = get_package_contents(package, commit, False)
|
||||
|
||||
# checksums did not change
|
||||
if head_parsed["sha512sums"] == upstream_parsed["sha512sums"]:
|
||||
# Check that pkgver did not change
|
||||
if head_parsed["pkgver"] != upstream_parsed["pkgver"]:
|
||||
print(f" - {package}: pkgver should not change when package source checksums did not change."
|
||||
"See: https://wiki.postmarketos.org/wiki/Packaging#device_packages_and_other_packages_without_sources")
|
||||
error = True
|
||||
# We do not check for a bumped pkgrel, because not everything
|
||||
# needs it, e.g: pmb_recommends
|
||||
# checksums changed
|
||||
else:
|
||||
# Check that pkgrel was reset to 0
|
||||
if head_parsed["pkgrel"] != "0":
|
||||
print(f" - {package}: pkgrel should be 0 when package source checksums change."
|
||||
"See: https://wiki.postmarketos.org/wiki/Packaging#device_packages_and_other_packages_without_sources")
|
||||
error = True
|
||||
# Check that pkgver was changed
|
||||
if head_parsed["pkgver"] == upstream_parsed["pkgver"]:
|
||||
print(f" - {package}: pkgver should change when package source checksums change."
|
||||
"See: https://wiki.postmarketos.org/wiki/Packaging#device_packages_and_other_packages_without_sources")
|
||||
error = True
|
||||
|
||||
# Compare head and upstream versions
|
||||
result = pmb.parse.version.compare(head, upstream)
|
||||
if result != 1:
|
||||
error = True
|
||||
|
||||
# Print result line ("- hello-world: 1-r2 (HEAD) > 1-r1 (HEAD~1)")
|
||||
formatstr = "- {}: {} (HEAD) {} {} ({})"
|
||||
if result != 1:
|
||||
formatstr += " [ERROR]"
|
||||
operator = version_compare_operator(result)
|
||||
print(formatstr.format(package, head, operator, upstream, commit))
|
||||
|
||||
if error:
|
||||
exit_with_error_message()
|
||||
|
||||
def check_package_count(count):
|
||||
for mark in ["[ci:ignore-count]", "[ci:skip-build]"]:
|
||||
if common.commit_message_has_string(mark):
|
||||
print("NOTE: package count sanity check skipped (" + mark + ").")
|
||||
return
|
||||
if count <= 10:
|
||||
return
|
||||
|
||||
branch = common.get_upstream_branch()
|
||||
print(f"""
|
||||
ERROR: Too many packages have changed!
|
||||
|
||||
This is a sanity check, so we don't end up building packages that
|
||||
have not been modified. CI won't run for more than three hours
|
||||
anyway.
|
||||
|
||||
Your options:
|
||||
a) If you *did not* modify everything listed above, then rebase
|
||||
your branch on the official postmarketOS/pmaports.git {branch}
|
||||
branch. Feel free to ask in the chat for help if you need any.
|
||||
b) If you *did* modify all these packages, and you assume that
|
||||
they will build within one hour: skip this sanity check by
|
||||
adding '[ci:ignore-count]' to the commit message of the last
|
||||
commit in the merge request (then force push).
|
||||
c) If you *did* modify all these packages, and you are sure that
|
||||
they won't build in time, please add '[ci:skip-build]' to the
|
||||
commit message (then force push). Make sure that all packages
|
||||
build with 'pmbootstrap build --strict'!
|
||||
|
||||
Thank you and sorry for the inconvenience.
|
||||
""")
|
||||
|
||||
exit(1)
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Get and print modified packages
|
||||
packages = common.get_changed_packages()
|
||||
if len(packages) == 0:
|
||||
print("no aports changed in this branch")
|
||||
exit(0)
|
||||
|
||||
print(f"Changed packages: {packages}")
|
||||
check_package_count(len(packages))
|
||||
|
||||
# Potentially skip this check
|
||||
if common.commit_message_has_string("[ci:skip-vercheck]"):
|
||||
print("WARNING: not checking for changed package versions"
|
||||
" ([ci:skip-vercheck])!")
|
||||
exit(0)
|
||||
|
||||
# Initialize args (so we can use pmbootstrap's APKBUILD parsing)
|
||||
sys.argv = ["pmbootstrap.py", "chroot"]
|
||||
args = pmb.parse.arguments()
|
||||
context = get_context()
|
||||
|
||||
# pmb.helpers.logging.init(args)
|
||||
pmb.helpers.logging.init(context.log, args.verbose, context.details_to_stdout)
|
||||
|
||||
|
||||
# Verify package versions
|
||||
print("checking changed package versions...")
|
||||
check_versions(packages)
|
||||
@@ -1,99 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# Copyright 2024 Oliver Smith
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
import glob
|
||||
import tempfile
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
# Same dir
|
||||
import common
|
||||
|
||||
|
||||
def check_kconfig(pkgnames):
|
||||
last_failed = None
|
||||
for i in range(len(pkgnames)):
|
||||
pkgname = pkgnames[i]
|
||||
print(f" ({i+1}/{len(pkgnames)}) {pkgname}")
|
||||
|
||||
p = subprocess.run(["pmbootstrap", "kconfig", "check", "--keep-going", pkgname],
|
||||
check=False)
|
||||
|
||||
if p.returncode:
|
||||
last_failed = pkgname
|
||||
|
||||
return last_failed
|
||||
|
||||
|
||||
def check_kconfig_all():
|
||||
p = subprocess.run(["pmbootstrap", "kconfig", "check", "--keep-going"], check=False)
|
||||
return p.returncode == 0
|
||||
|
||||
|
||||
def show_error(last_failed):
|
||||
print("")
|
||||
print("---")
|
||||
print("")
|
||||
print("Please adjust your kernel config. This is required for getting your"
|
||||
" patch merged.")
|
||||
print("")
|
||||
print("Edit your kernel config:")
|
||||
print(f" pmbootstrap kconfig edit {last_failed}")
|
||||
print("")
|
||||
print("Test this kernel config again:")
|
||||
print(f" pmbootstrap kconfig check {last_failed}")
|
||||
print("")
|
||||
print("Run this check again (on all kernels you modified):")
|
||||
print(" pmbootstrap ci kconfig")
|
||||
print("")
|
||||
print("---")
|
||||
print("")
|
||||
|
||||
|
||||
def show_error_all():
|
||||
print("")
|
||||
print("---")
|
||||
print("")
|
||||
print("Please adjust the failed kernel configs. This is required for")
|
||||
print("getting your patch merged.")
|
||||
print("")
|
||||
print("If a kernel in the testing category failed, and fixing is too much")
|
||||
print("effort, remove 'pmb:kconfigcheck-community' from the APKBUILD.")
|
||||
print("")
|
||||
print("Edit a kernel config:")
|
||||
print(" pmbootstrap kconfig edit <PACKAGE NAME>")
|
||||
print("")
|
||||
print("Test a specific kernel config again:")
|
||||
print(" pmbootstrap kconfig check <PACKAGE NAME>")
|
||||
print("")
|
||||
print("Run this check again (on all kernels you modified):")
|
||||
print(" pmbootstrap ci kconfig")
|
||||
print("")
|
||||
print("---")
|
||||
print("")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if "kconfigcheck.toml" in common.get_changed_files():
|
||||
print("kconfigcheck.toml changed -> checking all kernels")
|
||||
if not check_kconfig_all():
|
||||
show_error_all()
|
||||
exit(1)
|
||||
exit(0)
|
||||
|
||||
pkgnames = common.get_changed_kernels(skip_archived=True)
|
||||
print(f"Changed kernels: {pkgnames}")
|
||||
|
||||
if len(pkgnames) == 0:
|
||||
print("No kernels changed in this branch")
|
||||
exit(0)
|
||||
elif common.commit_message_has_string("[ci:skip-kconfigcheck]"):
|
||||
print("WARNING: not checking kernel configs ([ci:skip-kconfigcheck])")
|
||||
exit(0)
|
||||
|
||||
last_failed = check_kconfig(pkgnames)
|
||||
|
||||
if last_failed:
|
||||
show_error(last_failed)
|
||||
exit(1)
|
||||
@@ -1,147 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# Copyright 2023 Oliver Smith
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
from pathlib import Path
|
||||
import argparse
|
||||
import sys
|
||||
import urllib.request
|
||||
|
||||
# Same dir
|
||||
import common
|
||||
|
||||
def get_devices() -> list[str]:
|
||||
""":returns: list of all devices"""
|
||||
ret = []
|
||||
pmaports = Path(__file__).resolve().parents[2]
|
||||
for path in pmaports.glob("device/*/device-*/"):
|
||||
device = path.name.split("device-", 1)[1]
|
||||
|
||||
# -downstream suffix is used when packaging the downstream kernel for
|
||||
# devices that have a working mainline kernel. Those are usually
|
||||
# unmaintained and therefore might not appear in the wiki. However,
|
||||
# the main device should be documented (remove the -downstream suffix).
|
||||
if device.endswith('-downstream'):
|
||||
device = device[:-len('-downstream')]
|
||||
|
||||
ret.append(device)
|
||||
return sorted(ret)
|
||||
|
||||
|
||||
def get_wiki_devices_html(path: Path | None) -> dict[str, str]:
|
||||
""":param path: to a local file with the saved content of the devices wiki
|
||||
page or None to download a fresh copy
|
||||
:returns: HTML of the page, split into booting and not booting:
|
||||
{"booting": "<!DOCTYPE HTML>\n<html..."
|
||||
"not_booting": "Not booting</span></h2>\n<p>These..."}"""
|
||||
content = ""
|
||||
if path:
|
||||
# Read file
|
||||
with open(path, encoding="utf-8") as handle:
|
||||
content = handle.read()
|
||||
else:
|
||||
# Download wiki page
|
||||
url = "https://wiki.postmarketos.org/wiki/Devices"
|
||||
with urllib.request.urlopen(url) as f:
|
||||
content = f.read().decode("utf-8")
|
||||
|
||||
# Split into booting and not booting
|
||||
split = content.split("<span class=\"mw-headline\" id=\"Non-booting_devices\">")
|
||||
|
||||
if len(split) != 2:
|
||||
print("*** Failed to parse wiki page")
|
||||
sys.exit(2)
|
||||
return {"booting": split[0], "not_booting": split[1]}
|
||||
|
||||
|
||||
def get_wiki_renamed_devices_html() -> str:
|
||||
""":returns: HTML of the page"""
|
||||
# Download wiki page
|
||||
url = "https://wiki.postmarketos.org/wiki/Renamed_Devices"
|
||||
with urllib.request.urlopen(url) as f:
|
||||
res: bytes = f.read()
|
||||
return res.decode("utf-8")
|
||||
|
||||
|
||||
def check_device(device: str, html: dict[str, str], is_booting: bool) -> bool:
|
||||
""":param is_booting: require the device to be in the booting section, not
|
||||
just anywhere in the page (i.e. in the not booting
|
||||
table).
|
||||
:returns: True when the device is in the appropriate section."""
|
||||
if device in html["booting"]:
|
||||
return True
|
||||
if device in html["not_booting"]:
|
||||
if is_booting:
|
||||
print(device + ": still in 'not booting' section (if this is a"
|
||||
" merge request, your device should be in the booting"
|
||||
" section already)")
|
||||
return False
|
||||
return True
|
||||
if device in html["renamed"]:
|
||||
print(f"WARNING: {device} was renamed in the wiki")
|
||||
return True
|
||||
|
||||
print(device + ": not in the wiki yet.")
|
||||
return False
|
||||
|
||||
|
||||
def main() -> int:
|
||||
# Parse arguments
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--booting", help="devices must be in the upper table,"
|
||||
" being in the 'not booting' table below is not"
|
||||
" enough (all devices in pmaports master and stable"
|
||||
" branches and should be in the upper table)",
|
||||
action="store_true")
|
||||
parser.add_argument("--path", help="instead of downloading the devices"
|
||||
" page from the wiki, use a local HTML file",
|
||||
type=Path, default=None)
|
||||
parser.add_argument("--all", help="check all devices (default: check only"
|
||||
" devices changed from branch point)",
|
||||
action="store_true")
|
||||
args = parser.parse_args()
|
||||
|
||||
html = get_wiki_devices_html(args.path)
|
||||
html["renamed"] = get_wiki_renamed_devices_html()
|
||||
error = False
|
||||
devices = []
|
||||
if args.all:
|
||||
devices = get_devices()
|
||||
else:
|
||||
devices = common.get_changed_devices()
|
||||
# remove 'device-' prefix
|
||||
devices = [d[7:] for d in devices]
|
||||
devices = [d.removesuffix("-downstream") for d in devices]
|
||||
for device in devices:
|
||||
if not check_device(device, html, args.booting):
|
||||
error = True
|
||||
|
||||
# Ask to adjust the wiki
|
||||
if error:
|
||||
print("*** Wiki check failed!")
|
||||
print("Thank you for porting postmarketOS to a new device! \\o/")
|
||||
print("")
|
||||
print("Now it's time to add some documentation:")
|
||||
print("1) Create a device specific wiki page as described here:")
|
||||
print(" https://wiki.postmarketos.org/wiki/Help:Device_Page")
|
||||
print("2) Set 'booting = yes' in the infobox of your device page.")
|
||||
print("3) Run these tests again with an empty commit in your MR:")
|
||||
print(" $ git commit --allow-empty -m 'run tests again'")
|
||||
print("")
|
||||
print("Please take the time to do these steps. It will make your")
|
||||
print("precious porting efforts visible for others, and allow them")
|
||||
print("not only to use what you have created, but also to build upon")
|
||||
print("it more easily. Many times one person did a port with basic")
|
||||
print("functionality, and then someone else jumped in and")
|
||||
print("contributed major new features.")
|
||||
print("")
|
||||
print("NOTE: if you renamed a device in pmaports, rename it in the")
|
||||
print("wiki as well and make sure to add it here:")
|
||||
print("https://postmarketos.org/renamed")
|
||||
return 1
|
||||
|
||||
print("*** Wiki check successful!")
|
||||
return 0
|
||||
|
||||
|
||||
sys.exit(main())
|
||||
@@ -1,193 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# Copyright 2021 Oliver Smith
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
# Various functions used in CI scripts
|
||||
|
||||
import configparser
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
|
||||
cache = {}
|
||||
|
||||
|
||||
def get_pmaports_dir():
|
||||
global cache
|
||||
if "pmaports_dir" in cache:
|
||||
return cache["pmaports_dir"]
|
||||
ret = os.path.realpath(os.path.join(os.path.dirname(__file__) + "/../.."))
|
||||
cache["pmaports_dir"] = ret
|
||||
return ret
|
||||
|
||||
|
||||
def run_git(parameters, check=True, stderr=None):
|
||||
""" Run git in the pmaports dir and return the output """
|
||||
cmd = ["git", "-C", get_pmaports_dir()] + parameters
|
||||
try:
|
||||
return subprocess.check_output(cmd, stderr=stderr).decode()
|
||||
except subprocess.CalledProcessError:
|
||||
if check:
|
||||
raise
|
||||
return None
|
||||
|
||||
|
||||
def commit_message_has_string(needle):
|
||||
base_commit = get_base_commit()
|
||||
|
||||
return needle in run_git(["log", "--pretty=format:%B", f"{base_commit}..HEAD"])
|
||||
|
||||
|
||||
def all_committed_by_merge_bot():
|
||||
base_commit = get_base_commit()
|
||||
commit_emails = run_git(["log", "--pretty=format:%ce", f"{base_commit}..HEAD"]).splitlines()
|
||||
bot_email = os.getenv("PMOS_MERGE_BOT_EMAIL", "merge-bot@postmarketos.org")
|
||||
return all(bot_email == ce for ce in commit_emails)
|
||||
|
||||
|
||||
def run_pmbootstrap(parameters):
|
||||
""" Run pmbootstrap with the pmaports dir as --aports """
|
||||
cmd = ["pmbootstrap", "--aports", get_pmaports_dir()] + parameters
|
||||
subprocess.run(cmd, universal_newlines=True, check=True)
|
||||
|
||||
|
||||
def get_upstream_branch():
|
||||
""" Use pmaports.cfg from current branch (e.g. "v20.05_fix-ci") and
|
||||
channels.cfg from master to retrieve the upstream branch.
|
||||
|
||||
:returns: branch name, e.g. "v20.05" """
|
||||
|
||||
# Prefer gitlab CI target branch name if it's set (i.e. running in gitlab CI)
|
||||
if target_branch := os.environ.get("CI_MERGE_REQUEST_TARGET_BRANCH_NAME"):
|
||||
return target_branch
|
||||
|
||||
global cache
|
||||
if "upstream_branch" in cache:
|
||||
return cache["upstream_branch"]
|
||||
|
||||
# Get channel (e.g. "stable") from pmaports.cfg
|
||||
# https://postmarketos.org/pmaports.cfg
|
||||
pmaports_dir = get_pmaports_dir()
|
||||
pmaports_cfg = configparser.ConfigParser()
|
||||
pmaports_cfg.read(f"{pmaports_dir}/pmaports.cfg")
|
||||
channel = pmaports_cfg["pmaports"]["channel"]
|
||||
|
||||
# Get branch_pmaports (e.g. "v20.05") from channels.cfg
|
||||
# https://postmarketos.org/channels.cfg
|
||||
channels_cfg_str = run_git(["show", "upstream/master:channels.cfg"])
|
||||
channels_cfg = configparser.ConfigParser()
|
||||
channels_cfg.read_string(channels_cfg_str)
|
||||
assert channel in channels_cfg, \
|
||||
f"Channel '{channel}' from pmaports.cfg in your branch is unknown." \
|
||||
" This appears to be an old branch, consider recreating your change" \
|
||||
" on top of master."
|
||||
|
||||
ret = channels_cfg[channel]["branch_pmaports"]
|
||||
cache["upstream_branch"] = ret
|
||||
return ret
|
||||
|
||||
|
||||
def get_base_commit() -> str:
|
||||
"""Get the base commit that can be compared with HEAD to get all commits in the
|
||||
given branch/merge request."""
|
||||
|
||||
commit = os.getenv("CI_MERGE_REQUEST_DIFF_BASE_SHA")
|
||||
if commit is not None:
|
||||
return commit
|
||||
|
||||
# Add a remote pointing to postmarketOS/pmaports
|
||||
run_git(["remote", "add", "upstream",
|
||||
"https://gitlab.postmarketos.org/postmarketOS/pmaports.git"], False)
|
||||
run_git(["fetch", "-q", "upstream"])
|
||||
|
||||
branch_upstream = f"upstream/{get_upstream_branch()}"
|
||||
commit_head = run_git(["rev-parse", "HEAD"])[:-1]
|
||||
commit_upstream = run_git(["rev-parse", branch_upstream])[:-1]
|
||||
print("commit HEAD: " + commit_head)
|
||||
print(f"commit {branch_upstream}: {commit_upstream}")
|
||||
|
||||
# Check if we are HEAD on the upstream branch
|
||||
if commit_head == commit_upstream:
|
||||
# then compare with previous commit
|
||||
commit = "HEAD~1"
|
||||
else:
|
||||
# otherwise compare with latest common ancestor
|
||||
commit = run_git(["merge-base", branch_upstream, "HEAD"])[:-1]
|
||||
print("comparing HEAD with: " + commit)
|
||||
|
||||
return commit
|
||||
|
||||
|
||||
def get_changed_files(removed=True):
|
||||
""" Get all changed files and print them, as well as the branch and the
|
||||
commit that was used for the diff.
|
||||
:param removed: also return removed files (default: True)
|
||||
:returns: set of changed files
|
||||
"""
|
||||
commit = get_base_commit()
|
||||
|
||||
# Changed files
|
||||
ret = set()
|
||||
print("changed file(s):")
|
||||
for file in run_git(["diff", "--name-only", commit, "HEAD"]).splitlines():
|
||||
message = " " + file
|
||||
if not os.path.exists(file):
|
||||
message += " (deleted)"
|
||||
if removed:
|
||||
ret.add(file)
|
||||
else:
|
||||
ret.add(file)
|
||||
print(message)
|
||||
return ret
|
||||
|
||||
|
||||
def get_changed_packages(skip_archived: bool = False):
|
||||
ret = set()
|
||||
for file in get_changed_files():
|
||||
dirname, filename = os.path.split(file)
|
||||
|
||||
# Skip files:
|
||||
# * in the root dir of pmaports (e.g. README.md)
|
||||
# * path with a dot (e.g. .ci/, device/.shared-patches/)
|
||||
if not dirname or file.startswith(".") or "/." in file or skip_archived and dirname.startswith("device/archived"):
|
||||
continue
|
||||
|
||||
if filename != "APKBUILD":
|
||||
# Walk up directories until we (eventually) find the package
|
||||
# the file belongs to (could be in a subdirectory of a package)
|
||||
while dirname and not os.path.exists(os.path.join(dirname, "APKBUILD")):
|
||||
dirname = os.path.dirname(dirname)
|
||||
|
||||
# Unable to find APKBUILD the file belong to
|
||||
if not dirname:
|
||||
# ... maybe the package was deleted entirely?
|
||||
if not os.path.exists(file):
|
||||
continue
|
||||
|
||||
# Weird, file does not belong to any package?
|
||||
# Here we just warn, there is an extra check
|
||||
# to make sure that files are organized properly.
|
||||
print(f"WARNING: Changed file {file} does not belong to any package")
|
||||
continue
|
||||
|
||||
elif not os.path.exists(file):
|
||||
continue # APKBUILD was deleted
|
||||
|
||||
ret.add(os.path.basename(dirname))
|
||||
|
||||
return ret
|
||||
|
||||
|
||||
def get_changed_kernels(skip_archived: bool = False):
|
||||
ret = []
|
||||
for pkgname in get_changed_packages(skip_archived):
|
||||
if pkgname.startswith("linux-"):
|
||||
ret += [pkgname]
|
||||
return ret
|
||||
|
||||
def get_changed_devices():
|
||||
ret = []
|
||||
for pkgname in get_changed_packages():
|
||||
if pkgname.startswith("device-"):
|
||||
ret += [pkgname]
|
||||
return ret
|
||||
@@ -1,20 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# Copyright 2025 Stefan Hansson
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
import common
|
||||
import os.path
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
if __name__ == "__main__":
|
||||
if common.commit_message_has_string("[ci:skip-dint]"):
|
||||
print("WARNING: not linting deviceinfo files ([ci:skip-dint])")
|
||||
exit(0)
|
||||
deviceinfo_files = {file for file in common.get_changed_files(removed=False)
|
||||
if os.path.basename(file) == "deviceinfo"}
|
||||
|
||||
try:
|
||||
subprocess.run(["dint", "check", *deviceinfo_files], text=True, check=True)
|
||||
except subprocess.CalledProcessError as exception:
|
||||
sys.exit(exception.returncode)
|
||||
@@ -1,239 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# Copyright 2025 Pablo Correa Gomez
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
from functools import cached_property
|
||||
from pathlib import Path
|
||||
from typing import Self
|
||||
import sys
|
||||
import traceback
|
||||
|
||||
from jinja2 import Template
|
||||
import pmb.parse
|
||||
from pmb.parse.deviceinfo import Deviceinfo
|
||||
from pmb.types import Apkbuild
|
||||
import pmb.helpers.devices
|
||||
import pmb.helpers.logging
|
||||
import pmb.helpers.package
|
||||
from pmb.core.arch import Arch
|
||||
|
||||
# Same dir
|
||||
import common
|
||||
|
||||
|
||||
class Device:
|
||||
def __init__(self, codename: str):
|
||||
self.codename = codename
|
||||
self.full_path = pmb.helpers.devices.find_path(codename)
|
||||
|
||||
def __repr__(self):
|
||||
return f"Device({self.codename})"
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
return self.full_path.name.removeprefix("device-")
|
||||
|
||||
@cached_property
|
||||
def gitlab_ci_fragment(self) -> str | None:
|
||||
fragment_path = self.full_path / "gitlab-ci.yml.j2"
|
||||
try:
|
||||
fragment_tmpl = fragment_path.read_text()
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
return Template(fragment_tmpl).render(device=self)
|
||||
|
||||
@property
|
||||
def is_present_in_ci(self):
|
||||
return bool(self.gitlab_ci_fragment)
|
||||
|
||||
@cached_property
|
||||
def pmaports_path(self) -> Path:
|
||||
# Find the root of pmaports
|
||||
pmaports_root = self.full_path.parent
|
||||
while (not (pmaports_root / "pmaports.cfg").exists() and
|
||||
pmaports_root != pmaports_root.root):
|
||||
pmaports_root = pmaports_root.parent
|
||||
assert pmaports_root != pmaports_root.root
|
||||
|
||||
return self.full_path.relative_to(pmaports_root)
|
||||
|
||||
@cached_property
|
||||
def apkbuild(self) -> Apkbuild:
|
||||
return pmb.parse.apkbuild(self.full_path)
|
||||
|
||||
@property
|
||||
def pkgname(self) -> str:
|
||||
return self.apkbuild['pkgname']
|
||||
|
||||
@property
|
||||
def arch(self) -> Arch:
|
||||
return Arch(self.apkbuild['arch'][0])
|
||||
|
||||
@property
|
||||
def testing_dependencies(self) -> set[str]:
|
||||
# TODO: Source this from the APKGBUILD
|
||||
return {"postmarketos-mkinitfs-hook-ci"}
|
||||
|
||||
@cached_property
|
||||
def package_dependencies(self) -> list[str]:
|
||||
# HACK: Work around a bug in depends_recurse which prevents listing all the dependencies
|
||||
# Bug: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/issues/2623
|
||||
return {"postmarketos-initramfs"}
|
||||
# return pmb.helpers.package.depends_recurse(pkgname=self.pkgname,
|
||||
# arch=self.arch)
|
||||
|
||||
@cached_property
|
||||
def dependencies(self) -> set[str]:
|
||||
return self.package_dependencies | self.testing_dependencies
|
||||
|
||||
@cached_property
|
||||
def kernels(self) -> list[str] | None:
|
||||
kernels = []
|
||||
|
||||
subpackage_prefix = f"device-{self.codename}-kernel-"
|
||||
for subpkgname in self.apkbuild.get('subpackages', []):
|
||||
if not subpkgname.startswith(subpackage_prefix):
|
||||
continue
|
||||
kernel_name = subpkgname.removeprefix(subpackage_prefix)
|
||||
|
||||
# Ignore `none` kernels as they are not bootable
|
||||
if kernel_name != "none":
|
||||
kernels.append(kernel_name)
|
||||
|
||||
if kernels:
|
||||
return kernels
|
||||
else:
|
||||
return None
|
||||
|
||||
@cached_property
|
||||
def deviceinfo(self) -> dict[str, Deviceinfo] | Deviceinfo:
|
||||
# NOTE: deviceinfo files that have different values per kernel are
|
||||
# currently unsupported due to a gitlab-ci issue which prevents us
|
||||
# from having a per-kernel list of variables that would be selected
|
||||
# using `.extends`:
|
||||
# https://gitlab.com/gitlab-org/gitlab/-/issues/299423
|
||||
return Deviceinfo(self.full_path / "deviceinfo", None)
|
||||
|
||||
@property
|
||||
def has_kernel_variants(self):
|
||||
return len(self.kernels) > 0
|
||||
|
||||
@classmethod
|
||||
def supported_devices(cls) -> dict[Path, Self]:
|
||||
# NOTE: Not sure I like relying on pmboostrap just to avoid listing
|
||||
# devices ourselves, but since we need it to parse the APKBUILD, then
|
||||
# let's avoid duplicating the logic?
|
||||
supported_devices = {}
|
||||
for vendor in pmb.helpers.devices.list_vendors():
|
||||
for device in pmb.helpers.devices.list_codenames(vendor):
|
||||
try:
|
||||
dev = cls(device.codename)
|
||||
|
||||
# Ignore devices that do not have a gitlab ci fragment,
|
||||
# since we won't be able to make use of them
|
||||
if not dev.gitlab_ci_fragment:
|
||||
continue
|
||||
|
||||
supported_devices[dev.pmaports_path] = dev
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
return supported_devices
|
||||
|
||||
|
||||
class ArchTagSet(set):
|
||||
supported_arches = [
|
||||
Arch.x86_64,
|
||||
Arch.x86,
|
||||
Arch.aarch64,
|
||||
Arch.armv7,
|
||||
Arch.armhf,
|
||||
Arch.riscv64,
|
||||
Arch.ppc64le,
|
||||
]
|
||||
|
||||
def update(self, iterable):
|
||||
# This ignores things like !armv7, that could be a follow-up optimization
|
||||
if 'noarch' in iterable or 'all' in iterable:
|
||||
iterable = [arch for arch in self.supported_arches]
|
||||
super().update([Arch(arch) for arch in iterable if Arch(arch) in self.supported_arches])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Needs input to output if we should create the jobs
|
||||
if len(sys.argv) != 3:
|
||||
print("usage: generate_build_jobs.py TEMPLATE CHILD_PIPELINE")
|
||||
print(sys.argv)
|
||||
sys.exit(1)
|
||||
template = sys.argv[1]
|
||||
child_pipeline = sys.argv[2]
|
||||
|
||||
# pmb logging has to be initialized for later pmb commands to work, setting
|
||||
# to /dev/null since we don't care about the output. Later this could
|
||||
# be changed to a file and added as a CI artifact if we need to debug
|
||||
# something.
|
||||
pmb.logging.init(Path("/dev/null"), False)
|
||||
|
||||
# Load context
|
||||
sys.argv = ["pmbootstrap.py", "chroot"]
|
||||
args = pmb.parse.arguments()
|
||||
|
||||
# Get the list of supported devices
|
||||
supported_devices = Device.supported_devices()
|
||||
|
||||
archs = ArchTagSet()
|
||||
devices_under_test = set()
|
||||
packages_modified = set()
|
||||
# Get and print modified packages
|
||||
for file in common.get_changed_files():
|
||||
path = Path(file)
|
||||
|
||||
# Check if the modified's file parent folder is one of a supported dev
|
||||
if device := supported_devices.get(path.parent):
|
||||
devices_under_test.add(device)
|
||||
|
||||
if path.name != "APKBUILD":
|
||||
continue
|
||||
elif not path.exists():
|
||||
continue # APKBUILD was deleted
|
||||
apkbuild = pmb.parse.apkbuild(path)
|
||||
packages_modified.add(apkbuild['pkgname'])
|
||||
archs.update(apkbuild["arch"])
|
||||
|
||||
# Add all the devices found in CI that depend on the package that got
|
||||
# modified
|
||||
for device in supported_devices.values():
|
||||
if apkbuild['pkgname'] in device.dependencies:
|
||||
devices_under_test.add(device)
|
||||
|
||||
skip = False
|
||||
if common.commit_message_has_string("[ci:skip-build]"):
|
||||
print("User requested skipping build, skipping build")
|
||||
skip = True
|
||||
if common.all_committed_by_merge_bot():
|
||||
print("All commits in branch committed by merge bot, skipping build")
|
||||
skip = True
|
||||
if skip:
|
||||
archs = ArchTagSet()
|
||||
devices_under_test = set()
|
||||
|
||||
print(f"Architectures to build: {archs}")
|
||||
print(f"Devices under test: {devices_under_test}")
|
||||
|
||||
with open(template) as f:
|
||||
rendered = Template(f.read()).render(
|
||||
archs=archs,
|
||||
devices_under_test=devices_under_test,
|
||||
packages_modified=packages_modified,
|
||||
archtag={
|
||||
Arch.x86_64: "shared",
|
||||
Arch.x86: "shared",
|
||||
Arch.aarch64: "arm64",
|
||||
Arch.armv7: "qemu",
|
||||
Arch.armhf: "qemu",
|
||||
Arch.riscv64: "qemu",
|
||||
Arch.ppc64le: "ppc64le",
|
||||
},
|
||||
)
|
||||
with open(child_pipeline, "w") as fw:
|
||||
fw.write(rendered)
|
||||
@@ -1,17 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
# Copyright 2023 Oliver Smith
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
if ! mount | grep -q /proc/sys/fs/binfmt_misc; then
|
||||
echo "Mounting binfmt_misc"
|
||||
mount -t binfmt_misc none /proc/sys/fs/binfmt_misc
|
||||
fi
|
||||
|
||||
if id "build" > /dev/null 2>&1; then
|
||||
echo "User 'build' exists already"
|
||||
else
|
||||
echo "Creating build user"
|
||||
adduser -D build
|
||||
chown -R build:build .
|
||||
echo 'build ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
|
||||
fi
|
||||
@@ -1,16 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
# Copyright 2021 Oliver Smith
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "usage: $(basename "$0") \$CI_PROJECT_DIR"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for log in \
|
||||
/home/pmos/.local/var/pmbootstrap/log.txt \
|
||||
/home/pmos/.local/var/pmbootstrap/log_testsuite_pmaports.txt \
|
||||
/home/pmos/.config/pmbootstrap.cfg \
|
||||
; do
|
||||
[ -e "$log" ] && mv "$log" "$1"
|
||||
done
|
||||
@@ -1,283 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Unit testing framework for shell scripts
|
||||
# Invoke with the path to a tests/ subdir of a package and the
|
||||
# package name as arguments. Or source it with the following
|
||||
# variables set:
|
||||
# * results_dir - second argument to the test script
|
||||
|
||||
set -e
|
||||
|
||||
# Colors :D
|
||||
RED="\e[31m"
|
||||
GREEN="\e[32m"
|
||||
YELLOW="\e[33m"
|
||||
BLUE="\e[34m"
|
||||
BOLDBLUE="\e[1;34m"
|
||||
RESET="\e[0m"
|
||||
|
||||
testlib_path="$(realpath "$0")"
|
||||
|
||||
_test_assert_failed=""
|
||||
_test_testn=1
|
||||
_test_passedn=0
|
||||
_test_failedn=0
|
||||
_test_current_test=""
|
||||
_test_statefile="$(mktemp)"
|
||||
_test_original_pwd=""
|
||||
_test_temp_root=""
|
||||
# Set by each test
|
||||
results_dir="${results_dir:-}"
|
||||
|
||||
test_log() {
|
||||
# ash supports echo -e
|
||||
# shellcheck disable=SC3037
|
||||
echo -e "$*" >&2
|
||||
}
|
||||
|
||||
test_info() {
|
||||
# shellcheck disable=SC3037
|
||||
echo -e "${BLUE}$*${RESET}" >&2
|
||||
}
|
||||
|
||||
test_debug() {
|
||||
# shellcheck disable=SC3037
|
||||
echo -e "${YELLOW}$*${RESET}" >&2
|
||||
}
|
||||
|
||||
create_test_root() {
|
||||
_test_original_pwd="$(pwd)"
|
||||
_test_temp_root="$(mktemp -d)"
|
||||
cd "$_test_temp_root"
|
||||
}
|
||||
|
||||
cleanup_test_root() {
|
||||
if [ -n "$_test_original_pwd" ]; then
|
||||
cd "$_test_original_pwd"
|
||||
fi
|
||||
if [ -n "$_test_temp_root" ] && [ -d "$_test_temp_root" ]; then
|
||||
rm -rf "$_test_temp_root"
|
||||
fi
|
||||
_test_original_pwd=""
|
||||
_test_temp_root=""
|
||||
}
|
||||
|
||||
assert_strequal() {
|
||||
# $1: first string
|
||||
# $2: second string
|
||||
if [ -z "$1" ] || [ -z "$2" ]; then
|
||||
test_log "ERROR: assert_equal: not enough arguments given"
|
||||
exit 1
|
||||
fi
|
||||
if [ "$1" != "$2" ]; then
|
||||
_test_assert_failed="$1 != $2"
|
||||
test_log " ❌ $_test_assert_failed"
|
||||
return
|
||||
fi
|
||||
test_log " ✅ $1 == $2"
|
||||
}
|
||||
|
||||
assert_equal() {
|
||||
# $1: name of variable
|
||||
# $2: value to compare
|
||||
if [ -z "$1" ] || [ -z "$2" ]; then
|
||||
test_log "ERROR: assert_equal: not enough arguments given"
|
||||
exit 1
|
||||
fi
|
||||
val="$(eval echo "\$$1")"
|
||||
if [ "$val" != "$2" ]; then
|
||||
_test_assert_failed="\$$1 != $2 (got $val)"
|
||||
test_log " ❌ $_test_assert_failed"
|
||||
return
|
||||
fi
|
||||
test_log " ✅ \$$1 == $2"
|
||||
}
|
||||
|
||||
assert_unset() {
|
||||
if [ -z "$1" ]; then
|
||||
test_log "ERROR: assert_unset: not enough arguments given"
|
||||
exit 1
|
||||
fi
|
||||
val="$(eval echo \$"$1")"
|
||||
if [ -n "$val" ]; then
|
||||
_test_assert_failed="\$$1 should be unset (has value '$val')"
|
||||
test_log " ❌ $_test_assert_failed"
|
||||
return
|
||||
fi
|
||||
test_log " ✅ \$$1 is unset"
|
||||
}
|
||||
|
||||
assert_exists() {
|
||||
# $1: filename to test
|
||||
if [ -z "$1" ]; then
|
||||
test_log "ERROR: assert_exists: not enough arguments given"
|
||||
exit 1
|
||||
fi
|
||||
if ! [ -e "$1" ]; then
|
||||
_test_assert_failed="\$$1 should exist but does not"
|
||||
test_log " ❌ $_test_assert_failed"
|
||||
return
|
||||
fi
|
||||
test_log " ✅ \$$1 exists"
|
||||
}
|
||||
|
||||
assert_not_exists() {
|
||||
if [ -z "$1" ]; then
|
||||
test_log "ERROR: assert_not_exists: not enough arguments given"
|
||||
exit 1
|
||||
fi
|
||||
if [ -e "$1" ]; then
|
||||
_test_assert_failed="\$$1 should NOT exist but does"
|
||||
test_log " ❌ $_test_assert_failed"
|
||||
return
|
||||
fi
|
||||
test_log " ✅ \$$1 does not exist"
|
||||
}
|
||||
|
||||
assert_contains() {
|
||||
# $1: string to search in
|
||||
# $2: substring to find
|
||||
if [ -z "$1" ] || [ -z "$2" ]; then
|
||||
test_log "ERROR: assert_contains: not enough arguments given"
|
||||
exit 1
|
||||
fi
|
||||
case "$1" in
|
||||
*"$2"*)
|
||||
test_log " ✅ '$2' found in '$1'"
|
||||
;;
|
||||
*)
|
||||
_test_assert_failed="'$2' not found in '$1'"
|
||||
test_log " ❌ $_test_assert_failed"
|
||||
return
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
assert_not_contains() {
|
||||
# $1: string to search in
|
||||
# $2: substring that should not be found
|
||||
if [ -z "$1" ] || [ -z "$2" ]; then
|
||||
test_log "ERROR: assert_not_contains: not enough arguments given"
|
||||
exit 1
|
||||
fi
|
||||
case "$1" in
|
||||
*"$2"*)
|
||||
_test_assert_failed="'$2' found in '$1' but should not be"
|
||||
test_log " ❌ $_test_assert_failed"
|
||||
return
|
||||
;;
|
||||
*)
|
||||
test_log " ✅ '$2' not found in '$1'"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Log some expression and evaluate it
|
||||
logeval() {
|
||||
eval "$*"
|
||||
test_log "${YELLOW}+ $*${RESET}"
|
||||
}
|
||||
|
||||
# Start a test. Shell scripts involved in the test should be sourced AFTER calling this function!
|
||||
start_test() {
|
||||
if [ -n "$_test_current_test" ]; then
|
||||
test_log "ERROR: multiple calls to start_test without calling end_test first!"
|
||||
test_log "Current test: $_test_current_test"
|
||||
exit 1
|
||||
fi
|
||||
test_log "==> Test $_test_testn: $1"
|
||||
_test_current_test="$1"
|
||||
set > "$_test_statefile"
|
||||
}
|
||||
|
||||
# End a test and reset the environment.
|
||||
end_test() {
|
||||
local msg
|
||||
local save_assert_failed
|
||||
|
||||
# Restore environment
|
||||
save_assert_failed="$_test_assert_failed"
|
||||
|
||||
# Splitting is intentional
|
||||
# shellcheck disable=SC2046
|
||||
unset $(set | grep "='" | cut -d= -f1 | grep -vE "(PATH|IFS|TERM|LANG|HOME|PWD|SHELL|USER|save_assert_failed|_test_statefile)" )
|
||||
|
||||
# shellcheck disable=SC1090
|
||||
. "$_test_statefile"
|
||||
_test_assert_failed="$save_assert_failed"
|
||||
|
||||
if [ -n "$_test_assert_failed" ]; then
|
||||
msg="${RED}Failed! ❌ ${_test_assert_failed}${RESET}"
|
||||
echo "Test $_test_testn: $_test_assert_failed" >> "$results_dir/failed"
|
||||
_test_failedn=$((_test_failedn+1))
|
||||
echo "$_test_failedn" > "$results_dir/failedn"
|
||||
unset _test_assert_failed
|
||||
else
|
||||
msg="${GREEN}Passed!${RESET}"
|
||||
_test_passedn=$((_test_passedn+1))
|
||||
echo "$_test_passedn" > "$results_dir/passedn"
|
||||
fi
|
||||
test_log "<== Test $_test_testn: $msg $_test_current_test\n"
|
||||
_test_testn=$((_test_testn+1))
|
||||
_test_current_test=""
|
||||
}
|
||||
|
||||
# Call at the end of each testsuite shell script
|
||||
end_testsuite() {
|
||||
if [ -n "$_test_current_test" ]; then
|
||||
test_log "${RED}ERROR: end_testsuite called without calling end_test first!${RESET}"
|
||||
test_log "${RED}Current test: $_test_current_test${RESET}"
|
||||
exit 1
|
||||
fi
|
||||
if [ -f "$results_dir/failed" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
||||
}
|
||||
|
||||
run_tests() {
|
||||
local failed test_results_base
|
||||
local test name total passedn failedn t_passed t_failed
|
||||
|
||||
test_results_base="$(mktemp -d)"
|
||||
test_log "Running tests for $2"
|
||||
|
||||
# FIXME: yeah this isn't quite the best way to iterate the files
|
||||
# shellcheck disable=SC2010
|
||||
for name in $(ls "$1" | grep "\.sh$"); do
|
||||
test="$1/$name"
|
||||
mkdir "$test_results_base/$name"
|
||||
echo 0 > "$test_results_base/$name/passedn"
|
||||
echo 0 > "$test_results_base/$name/failedn"
|
||||
test_log
|
||||
test_log "${BOLDBLUE}# Test suite ${name}${RESET}"
|
||||
$test "$testlib_path" "$test_results_base/$name" || failed="$failed $name"
|
||||
t_passed=$(cat "$test_results_base/$name/passedn")
|
||||
t_failed=$(cat "$test_results_base/$name/failedn")
|
||||
passedn=$((passedn+t_passed))
|
||||
failedn=$((failedn+t_failed))
|
||||
total=$((total+t_passed+t_failed))
|
||||
done
|
||||
if [ -n "$failed" ]; then
|
||||
test_log
|
||||
test_log "Some tests failed:"
|
||||
for test in $failed; do
|
||||
test_log "❌ $test"
|
||||
test_log " ${RED}$(cat "$test_results_base/$test/failed")${RESET}"
|
||||
done
|
||||
fi
|
||||
|
||||
if [ $passedn -lt $total ]; then
|
||||
test_log "[${RED}$passedn/$total tests passed${RESET}]"
|
||||
else
|
||||
test_log "[${GREEN}$passedn/$total tests passed!${RESET}]"
|
||||
fi
|
||||
test_log
|
||||
|
||||
if [ -n "$failed" ]; then exit 1; else exit 0; fi
|
||||
}
|
||||
|
||||
# FIXME: probably not the best way to determine if this was sourced
|
||||
if [ $# -gt 0 ]; then
|
||||
run_tests "$1" "$2"
|
||||
fi
|
||||
@@ -1,81 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# Copyright 2025 Pablo Correa Gomez
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
import os
|
||||
import sys
|
||||
|
||||
# Same dir
|
||||
import common
|
||||
|
||||
# pmbootstrap
|
||||
import add_pmbootstrap_to_import_path
|
||||
import pmb.core
|
||||
from pmb.core.context import get_context
|
||||
|
||||
|
||||
def verify_checksums(packages):
|
||||
if len(packages) == 0:
|
||||
print("no packages changed, not doing any checksums verification")
|
||||
return
|
||||
|
||||
print("verifying checksums: " + ", ".join(packages))
|
||||
common.run_pmbootstrap(["build_init"])
|
||||
common.run_pmbootstrap(["--details-to-stdout", "checksum", "--verify"] +
|
||||
list(packages))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Get and print modified packages
|
||||
packages = common.get_changed_packages()
|
||||
|
||||
# Load context
|
||||
sys.argv = ["pmbootstrap.py", "chroot"]
|
||||
args = pmb.parse.arguments()
|
||||
context = get_context()
|
||||
|
||||
# Get set of all buildable packages for the enabled repos, for skipping unbuildable
|
||||
# aports later. We might be given a changed aport from e.g. extra-repos/systemd when
|
||||
# that repo is not enabled
|
||||
buildable_pkgs = set()
|
||||
for path in pmb.core.pkgrepo.pkgrepo_iter_package_dirs():
|
||||
buildable_pkgs.add(os.path.basename(path))
|
||||
|
||||
# To store a list of packages from extra-repos/systemd for special handling
|
||||
# later:
|
||||
systemd_pkgs = list()
|
||||
|
||||
# Filter out packages are not found in enabled repos
|
||||
# (Iterate over copy of packages, because we modify it in this loop)
|
||||
for package in packages.copy():
|
||||
if package not in buildable_pkgs:
|
||||
print(f"{package}: not in current repo, skipping")
|
||||
packages.remove(package)
|
||||
# FIXME: this should probably be more generic, if other repos are added
|
||||
# later?
|
||||
# This just tosses the package into the list of packages to try
|
||||
# building later w/ systemd enabled, and assumes it'll be found
|
||||
# there.
|
||||
print(f"{package}: adding to list of packages to check in systemd repo")
|
||||
systemd_pkgs.append(package)
|
||||
continue
|
||||
|
||||
# No packages: skip build
|
||||
if len(packages) == 0:
|
||||
print("no packages to check for the current repo")
|
||||
else:
|
||||
verify_checksums(packages)
|
||||
|
||||
# FIXME: this should probably be more generic, if other repos are added later?
|
||||
if systemd_pkgs:
|
||||
common.run_pmbootstrap(["config", "systemd", "always"])
|
||||
# To fix the ERROR: Chroot 'native' is for the 'edge' channel, but you are on the
|
||||
# 'systemd-edge' channel. Run 'pmbootstrap zap' to delete your chroots and try again.
|
||||
# To do this automatically, run 'pmbootstrap config auto_zap_misconfigured_chroots yes'.
|
||||
common.run_pmbootstrap(["config", "auto_zap_misconfigured_chroots", "yes"])
|
||||
|
||||
# No packages: skip build
|
||||
if len(systemd_pkgs) == 0:
|
||||
print("no packages to check for the systemd repo")
|
||||
|
||||
else:
|
||||
verify_checksums(systemd_pkgs)
|
||||
@@ -1,32 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
# Copyright 2023 Oliver Smith
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
# Description: lint with various python tests
|
||||
# Options: native
|
||||
# Use 'native' because it requires pmbootstrap.
|
||||
# https://postmarketos.org/pmb-ci
|
||||
|
||||
if [ "$(id -u)" = 0 ]; then
|
||||
set -x
|
||||
wget "https://gitlab.postmarketos.org/postmarketOS/ci-common/-/raw/master/install_pmbootstrap.sh"
|
||||
sh ./install_pmbootstrap.sh pytest
|
||||
exec su "${TESTUSER:-pmos}" -c "sh -e $0"
|
||||
fi
|
||||
|
||||
# Require pytest to be installed on the host system
|
||||
if [ -z "$(command -v pytest)" ]; then
|
||||
echo "ERROR: pytest command not found, make sure it is in your PATH."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
pmaports="$(cd "$(dirname "$0")"/..; pwd -P)"
|
||||
# Make sure that the work folder format is up to date, and that there are no
|
||||
# mounts from aborted test cases (pmbootstrap#1595)
|
||||
pmbootstrap work_migrate
|
||||
pmbootstrap config aports "$pmaports"
|
||||
pmbootstrap -q shutdown
|
||||
|
||||
# Needed to import "common"
|
||||
export PYTHONPATH=".ci/lib"
|
||||
# Run testcases
|
||||
pytest -vv --tb=native "$pmaports/.ci/testcases" "$@"
|
||||
-14
@@ -1,14 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
# Description: lint CI related python scripts/tests
|
||||
# https://postmarketos.org/pmb-ci
|
||||
|
||||
if [ "$(id -u)" = 0 ]; then
|
||||
set -x
|
||||
apk -q add ruff
|
||||
exec su "${TESTUSER:-build}" -c "sh -e $0"
|
||||
fi
|
||||
|
||||
set -x
|
||||
|
||||
# shellcheck disable=SC2046
|
||||
ruff check --ignore E501,F401,E722,W605 $(find .ci -name '*.py')
|
||||
@@ -1,51 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
# Copyright 2023 Oliver Smith
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
# Description: lint all shell scripts
|
||||
# https://postmarketos.org/pmb-ci
|
||||
|
||||
DIR="$(cd "$(dirname "$0")/.." && pwd -P)"
|
||||
|
||||
if [ "$(id -u)" = 0 ]; then
|
||||
set -x
|
||||
apk -q add shellcheck
|
||||
exec su "${TESTUSER:-build}" -c "sh -e $0"
|
||||
fi
|
||||
|
||||
# Shell: shellcheck
|
||||
sh_files="
|
||||
./main/mdss-fb-init-hack/mdss-fb-init-hack.sh
|
||||
./main/postmarketos-base-ui/rootfs-usr-lib-NetworkManager-dispatcher.d-50-dns-filter.sh
|
||||
./main/postmarketos-base-ui/rootfs-usr-lib-NetworkManager-dispatcher.d-50-tethering.sh
|
||||
./main/postmarketos-installkernel/installkernel-pmos
|
||||
./main/postmarketos-initramfs/init.sh
|
||||
./main/postmarketos-initramfs/init_functions.sh
|
||||
./main/postmarketos-mkinitfs-hook-netboot/netboot.sh
|
||||
./main/postmarketos-ui-os-installer/rootfs-usr-bin-pmos_setup.sh
|
||||
./main/ttyescape/*.post-install
|
||||
./main/unl0kr/unlock.sh
|
||||
./device/community/soc-qcom/call_audio_idle_suspend_workaround.sh
|
||||
./device/testing/device-apple-mac-aarch64/*.sh
|
||||
./extra-repos/systemd/postmarketos-base-systemd/rootfs-usr-libexec-systemd-apk-trigger
|
||||
|
||||
$(find . -path './main/postmarketos-ui-*/*.sh')
|
||||
$(find . -path './main/postmarketos-ui-*/*.pre-install')
|
||||
$(find . -path './main/postmarketos-ui-*/*.post-install')
|
||||
$(find . -path './main/postmarketos-ui-*/*.pre-upgrade')
|
||||
$(find . -path './main/postmarketos-ui-*/*.post-upgrade')
|
||||
$(find . -path './main/postmarketos-ui-*/*.pre-deinstall')
|
||||
$(find . -path './main/postmarketos-ui-*/*.post-deinstall')
|
||||
|
||||
$(find . -name '*.trigger')
|
||||
$(find . -path './main/devicepkg-dev/*.sh')
|
||||
$(find . -path './main/postmarketos-mvcfg/*.sh')
|
||||
|
||||
$(find . -path './.ci/**.sh')
|
||||
$(find . -path '**/tests/*.sh')
|
||||
"
|
||||
|
||||
for file in $sh_files; do
|
||||
echo "Test with shellcheck: $file"
|
||||
cd "$DIR/$(dirname "$file")"
|
||||
shellcheck -S warning -e SC1008 -e SC3043 -x "$(basename "$file")"
|
||||
done
|
||||
@@ -1,44 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# Copyright 2021 Oliver Smith
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
import shutil
|
||||
import sys
|
||||
import os
|
||||
import importlib
|
||||
import importlib.util
|
||||
from site import getsitepackages
|
||||
|
||||
|
||||
def path_pmbootstrap():
|
||||
""" Find the pmbootstrap installation folder, so we can import the Python
|
||||
code from there.
|
||||
returns: pmbootstrap installation folder
|
||||
"""
|
||||
# This variable is set by pmbootstrap 1.52 and later
|
||||
# If it's undefined, try to find 'pmbootstrap' in path
|
||||
bin = os.environ.get("PMBOOTSTRAP_CMD") or shutil.which("pmbootstrap")
|
||||
|
||||
if not bin:
|
||||
print("ERROR: 'pmbootstrap' not found in $PATH")
|
||||
sys.exit(1)
|
||||
|
||||
# Resolve the symlink and verify the folder
|
||||
directory = os.path.dirname(os.path.realpath(bin))
|
||||
if os.path.exists(directory + "/pmb/__init__.py"):
|
||||
return directory
|
||||
|
||||
directories = getsitepackages()
|
||||
for directory in directories:
|
||||
if os.path.exists(directory + "/pmb/__init__.py"):
|
||||
return directory
|
||||
|
||||
# Symlink not set up properly
|
||||
print("ERROR: unable to find path to pmbootstrap.py. Try setting 'PMBOOTSTRAP_CMD'.")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
# Check if pmb module can be imported
|
||||
if importlib.util.find_spec("pmb") is None:
|
||||
# Add pmbootstrap dir to import path
|
||||
sys.path.append(os.path.realpath(path_pmbootstrap()))
|
||||
@@ -1,34 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# Copyright 2021 Oliver Smith
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
from pathlib import Path
|
||||
import add_pmbootstrap_to_import_path
|
||||
import pmb.parse
|
||||
from pmb.helpers.args import init as init_args
|
||||
from pmb.types import PmbArgs
|
||||
import pmb.config
|
||||
from pmb.core.pkgrepo import pkgrepo_default_path
|
||||
import pytest
|
||||
import sys
|
||||
import os
|
||||
|
||||
@pytest.fixture(scope="session", autouse=True)
|
||||
def args(request):
|
||||
# Initialize args
|
||||
pmaports = Path(os.path.realpath(f"{os.path.dirname(__file__)}/../.."))
|
||||
args = PmbArgs()
|
||||
args.aports = [pmaports]
|
||||
args.config = pmb.config.defaults["config"]
|
||||
args.timeout = 900
|
||||
args.details_to_stdout = False
|
||||
args.quiet = False
|
||||
args.verbose = True
|
||||
args.offline = False
|
||||
args.action = "init"
|
||||
args.cross = False
|
||||
args.log = None
|
||||
|
||||
init_args(args)
|
||||
request.addfinalizer(pmb.helpers.logging.logfd.close)
|
||||
return args
|
||||
@@ -1,132 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# Copyright 2024 Oliver Smith
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
import fnmatch
|
||||
import glob
|
||||
import os
|
||||
import pytest
|
||||
import sys
|
||||
|
||||
import add_pmbootstrap_to_import_path
|
||||
import pmb.parse
|
||||
import pmb.parse._apkbuild
|
||||
from pmb.core.pkgrepo import pkgrepo_default_path, pkgrepo_iglob, pkgrepo_relative_path
|
||||
from pmb.core.arch import Arch
|
||||
|
||||
# Don't complain if these nicknames are the only maintainers of an APKBUILD,
|
||||
# because they are actually a group of people
|
||||
gitlab_groups = [
|
||||
"@sdm845-mainline",
|
||||
]
|
||||
|
||||
|
||||
def device_dependency_check(apkbuild, path):
|
||||
""" Raise an error if a device package has a dependency that is not allowed
|
||||
(e.g. because it should be in a subpackage instead). """
|
||||
|
||||
for depend in apkbuild["depends"]:
|
||||
if depend == "mesa-dri-gallium":
|
||||
raise RuntimeError(f"{path}: mesa-dri-gallium shouldn't be in"
|
||||
" depends anymore (see pmaports!3478)")
|
||||
|
||||
|
||||
def test_aports_device():
|
||||
"""
|
||||
Various tests performed on the /device/*/device-* aports.
|
||||
"""
|
||||
for path in pkgrepo_iglob("device/*/device-*/APKBUILD"):
|
||||
apkbuild = pmb.parse.apkbuild(path)
|
||||
|
||||
# Depends: Require "postmarketos-base"
|
||||
depend_flag = False
|
||||
for dependency in apkbuild["depends"]:
|
||||
if "postmarketos-base" == dependency or "postmarketos-base>" in dependency:
|
||||
depend_flag = True
|
||||
if not depend_flag:
|
||||
raise RuntimeError(f"Missing 'postmarketos-base' in depends of {path}")
|
||||
|
||||
# Depends: Must not have specific packages
|
||||
for depend in apkbuild["depends"]:
|
||||
device_dependency_check(apkbuild, path)
|
||||
|
||||
# Architecture
|
||||
device = apkbuild["pkgname"][len("device-"):]
|
||||
deviceinfo = pmb.parse.deviceinfo(device)
|
||||
if Arch.from_str("".join(apkbuild["arch"])) != deviceinfo.arch:
|
||||
raise RuntimeError("wrong architecture, please change to arch=\""
|
||||
f"{deviceinfo.arch}\": {path}")
|
||||
if "!archcheck" not in apkbuild["options"]:
|
||||
raise RuntimeError(f"!archcheck missing in options= line: {path}")
|
||||
|
||||
|
||||
def test_aports_device_kernel():
|
||||
"""
|
||||
Verify the kernels specified in the device packages:
|
||||
* Kernel must not be in depends when kernels are in subpackages
|
||||
* Check if only one kernel is defined in depends
|
||||
"""
|
||||
aports = pkgrepo_default_path()
|
||||
# Iterate over device aports
|
||||
for path in aports.glob("device/*/device-*/APKBUILD"):
|
||||
# Parse apkbuild and kernels from subpackages
|
||||
apkbuild = pmb.parse.apkbuild(path)
|
||||
device = apkbuild["pkgname"][len("device-"):]
|
||||
kernels_subpackages = pmb.parse._apkbuild.kernels(device)
|
||||
|
||||
# Parse kernels from depends
|
||||
kernels_depends = []
|
||||
for depend in apkbuild["depends"]:
|
||||
if not depend.startswith("linux-") or depend.startswith("linux-firmware-"):
|
||||
continue
|
||||
kernels_depends.append(depend)
|
||||
|
||||
# Kernel in subpackages *and* depends
|
||||
if kernels_subpackages:
|
||||
raise RuntimeError(f"Kernel package '{depend}' needs to"
|
||||
" be removed when using kernel" +
|
||||
f" subpackages: {path}")
|
||||
|
||||
# No kernel
|
||||
if not kernels_depends and not kernels_subpackages:
|
||||
raise RuntimeError("Device doesn't have a kernel in depends or"
|
||||
f" subpackages: {path}")
|
||||
|
||||
# Multiple kernels in depends
|
||||
if len(kernels_depends) > 1:
|
||||
raise RuntimeError("Please use kernel subpackages instead of"
|
||||
" multiple kernels in depends (see"
|
||||
f" <https://postmarketos.org/devicepkg>): {path}")
|
||||
|
||||
|
||||
# @pytest.mark.xfail # Not all aports have been updated yet
|
||||
def test_aports_maintained():
|
||||
"""
|
||||
Ensure that aports in /device/{main,community} have "Maintainer:" and
|
||||
"Co-Maintainer:" (only required for main) listed in their APKBUILDs.
|
||||
"""
|
||||
|
||||
for path in pkgrepo_iglob("device/main/*/APKBUILD"):
|
||||
if 'firmware-' in path.parent.name:
|
||||
continue
|
||||
maintainers = pmb.parse._apkbuild.maintainers(path)
|
||||
assert maintainers and len(maintainers) >= 2, \
|
||||
f"{path} in main needs at least 1 Maintainer and 1 Co-Maintainer"
|
||||
|
||||
for path in pkgrepo_iglob("device/community/*/APKBUILD"):
|
||||
if 'firmware-' in path.parent.name:
|
||||
continue
|
||||
maintainers = pmb.parse._apkbuild.maintainers(path)
|
||||
assert maintainers, f"{path} in community needs at least 1 Maintainer"
|
||||
|
||||
|
||||
def test_aports_archived():
|
||||
"""
|
||||
Ensure that aports in /device/archived have an "Archived:" comment
|
||||
that describes why the aport is archived.
|
||||
"""
|
||||
|
||||
for path in pkgrepo_iglob("device/archived/*/APKBUILD"):
|
||||
archived = pmb.parse._apkbuild.archived(path)
|
||||
assert archived, f"{path} should have an Archived: " +\
|
||||
"comment that describes why the package is archived"
|
||||
@@ -1,66 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# Copyright 2021 Oliver Smith
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
import glob
|
||||
import os
|
||||
import pytest
|
||||
import re
|
||||
import sys
|
||||
|
||||
import add_pmbootstrap_to_import_path
|
||||
import pmb.parse
|
||||
from pmb.core.pkgrepo import pkgrepo_iglob
|
||||
|
||||
|
||||
def test_deviceinfo():
|
||||
"""
|
||||
Parse all deviceinfo files successfully and run checks on the parsed data.
|
||||
"""
|
||||
# Iterate over all devices
|
||||
last_exception = None
|
||||
count = 0
|
||||
pattern = re.compile("^deviceinfo_[a-zA-Z0-9_]*=\".*\"(\\s*# .*)?$")
|
||||
|
||||
for folder in pkgrepo_iglob("device/*/device-*"):
|
||||
device = folder.name.split("-", 1)[1]
|
||||
|
||||
f = open(folder / "deviceinfo")
|
||||
lines = f.read().split("\n")
|
||||
f.close()
|
||||
|
||||
try:
|
||||
for line in lines:
|
||||
# Skip empty lines and comments
|
||||
if not line or line.startswith("# "):
|
||||
continue
|
||||
|
||||
# Check line against regex (can't use multiple lines etc.)
|
||||
if not pattern.match(line) or line.endswith("\\\""):
|
||||
raise RuntimeError("Line looks invalid, maybe missing"
|
||||
" quotes/multi-line string/malformed"
|
||||
f" inline comment? {line}")
|
||||
|
||||
# Successful deviceinfo parsing / obsolete options
|
||||
info = pmb.parse.deviceinfo(device)
|
||||
|
||||
# deviceinfo_name must start with manufacturer
|
||||
name = info.name
|
||||
manufacturer = info.manufacturer
|
||||
if not name.startswith(manufacturer) and \
|
||||
not name.startswith("Google") and \
|
||||
not name.startswith("Jolla"):
|
||||
raise RuntimeError("Please add the manufacturer in front of"
|
||||
" the deviceinfo_name, e.g.: '" +
|
||||
manufacturer + " " + name + "'")
|
||||
|
||||
# Don't abort on first error
|
||||
except Exception as e:
|
||||
last_exception = e
|
||||
count += 1
|
||||
print(device + ": " + str(e))
|
||||
|
||||
# Raise the last exception
|
||||
if last_exception:
|
||||
print("deviceinfo error count: " + str(count))
|
||||
raise last_exception
|
||||
@@ -1,78 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
import glob
|
||||
import os
|
||||
import stat
|
||||
|
||||
expected_directories = [
|
||||
"cross",
|
||||
"device/archived",
|
||||
"device/community",
|
||||
"device/downstream",
|
||||
"device/main",
|
||||
"device/testing",
|
||||
"extra-repos/systemd",
|
||||
"main",
|
||||
"modem",
|
||||
"non-free",
|
||||
"sxmo",
|
||||
"temp",
|
||||
]
|
||||
|
||||
|
||||
# pmbootstrap allows placing APKBUILDs in arbitrarily nested directories.
|
||||
# This test makes sure all of them are in one of the expected locations.
|
||||
def test_directories():
|
||||
apkbuilds = set(glob.iglob("**/APKBUILD", recursive=True))
|
||||
expected = set(f for d in expected_directories for f in glob.iglob(d + "/*/APKBUILD"))
|
||||
assert apkbuilds == expected, "Found APKBUILD in unexpected directory. " \
|
||||
"Note that we moved firmware/* to device/{main,community,testing}/*."
|
||||
|
||||
|
||||
# Ensure no file in pmaports are executable.
|
||||
# see https://gitlab.postmarketos.org/postmarketOS/pmaports/-/issues/593.
|
||||
def test_executable_files():
|
||||
for file in glob.iglob("[!temp]**/**/*", recursive=True):
|
||||
if os.path.isdir(file) or os.path.islink(file):
|
||||
continue
|
||||
# still check other less common inode types
|
||||
permissions = os.stat(file).st_mode
|
||||
executable_bits = stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH
|
||||
if permissions & executable_bits != 0:
|
||||
raise RuntimeError(f"\"{file}\" is executable. Files in pmaports" +
|
||||
" should not be executables. post-* files" +
|
||||
" don't need to be executable and executables" +
|
||||
" should be installed using `install -D" +
|
||||
"m0755` or a variation thereof.")
|
||||
|
||||
|
||||
# Make sure files belong to a package (below a directory with APKBUILD)
|
||||
def test_files_belong_to_package():
|
||||
# Walk directories and set package_dir when we find an APKBUILD
|
||||
# This allows matching files in subdirectories to the package directory.
|
||||
package_dir = None
|
||||
for dirpath, dirs, files in os.walk("."):
|
||||
# Skip "hidden" directories (.ci/, device/.shared-patches/)
|
||||
dirs[:] = [d for d in dirs if not d.startswith(".")]
|
||||
# Ignore files in root directory (README.md)
|
||||
if dirpath == '.':
|
||||
continue
|
||||
# Ignore files under docs/
|
||||
if dirpath.startswith('./docs'):
|
||||
continue
|
||||
|
||||
# Switched to another directory?
|
||||
if package_dir and not dirpath.startswith(package_dir + os.sep):
|
||||
package_dir = None
|
||||
|
||||
if 'APKBUILD' in files:
|
||||
assert not package_dir, f"Nested packages: {package_dir} and {dirpath} " \
|
||||
"both contain an APKBUILD"
|
||||
package_dir = dirpath
|
||||
|
||||
# Skip specific ".gitlab-ci.yml" files outside of usual structure
|
||||
if dirpath in ["./cross"]:
|
||||
files[:] = [f for f in files if f != ".gitlab-ci.yml"]
|
||||
|
||||
assert not files or package_dir, "Found files that do not belong to any package: " \
|
||||
f"{dirpath}/{files}"
|
||||
@@ -1,52 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# Copyright 2021 Johannes Marbach
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
import glob
|
||||
import os
|
||||
|
||||
import add_pmbootstrap_to_import_path
|
||||
import pmb.parse
|
||||
from pmb.core.pkgrepo import pkgrepo_default_path, pkgrepo_iglob
|
||||
|
||||
|
||||
def test_aports_firmware():
|
||||
"""
|
||||
Various tests performed on the /**/firmware-* aports.
|
||||
"""
|
||||
|
||||
excluded = [
|
||||
"firmware-motorola-ali", # Depends on firmware-qcom-adreno-a530
|
||||
"firmware-motorola-potter", # Depends on soc-qcom-msm8916-ucm
|
||||
"firmware-oneplus-msm8998", # Depends on soc-qcom-sdm845-nonfree-firmware
|
||||
"firmware-xiaomi-sagit", # Depends on soc-qcom-sdm845-nonfree-firmware
|
||||
"firmware-samsung-baffinlite", # Depends on firmware-aosp-broadcom-wlan
|
||||
"firmware-samsung-crespo", # Depends on firmware-aosp-broadcom-wlan
|
||||
"firmware-samsung-maguro", # Depends on firmware-aosp-broadcom-wlan
|
||||
"firmware-xiaomi-ferrari", # Depends on soc-qcom-msm8916
|
||||
"firmware-xiaomi-willow", # Doesn't build, source link is dead (pma#1212)
|
||||
"firmware-samsung-i9105p", # Depends on firmware-aosp-broadcom-wlan
|
||||
]
|
||||
|
||||
for path in pkgrepo_iglob("**/firmware-*/APKBUILD", recursive=True):
|
||||
apkbuild = pmb.parse.apkbuild(path)
|
||||
aport_name = os.path.basename(path.parent)
|
||||
|
||||
if aport_name not in excluded:
|
||||
if "pmb:cross-native" not in apkbuild["options"]:
|
||||
raise RuntimeError(f"{aport_name}: \"pmb:cross-native\" missing in"
|
||||
" options= line. The pmb:cross-native option is"
|
||||
" preferred because it results in significantly"
|
||||
" lower build times. If the package doesn't build"
|
||||
" with the option, you can add an exemption in"
|
||||
" .gitlab-ci/testcases/test_firmware.py.")
|
||||
|
||||
if "!tracedeps" not in apkbuild["options"]:
|
||||
raise RuntimeError(f"{aport_name}: \"!tracedeps\" missing in"
|
||||
" options= line. The tracedeps option is superfluous"
|
||||
" for firmware packages.")
|
||||
|
||||
if "noarch" in apkbuild["arch"]:
|
||||
raise RuntimeError(f"{aport_name}: \"arch\" must not be \"noarch\"!"
|
||||
" Please limit this firmware package to the"
|
||||
" required architectures only!")
|
||||
@@ -1,119 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# Copyright 2021 Oliver Smith
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
""" Make sure that components of frameworks (Qt, KDE, ...) have the same
|
||||
version in all packages. We scan all packages, categorize them by URL
|
||||
and then compare the versions of all packages in each category. """
|
||||
|
||||
import glob
|
||||
import logging
|
||||
import os
|
||||
import pytest
|
||||
import sys
|
||||
|
||||
import add_pmbootstrap_to_import_path
|
||||
import pmb.config
|
||||
import pmb.parse
|
||||
from pmb.core.pkgrepo import pkgrepo_iter_package_dirs
|
||||
|
||||
|
||||
def get_categorized_packages():
|
||||
"""
|
||||
Parse all aports and categorize them.
|
||||
|
||||
:returns: {"plasma": {"kwin": "5.13.3", ...},
|
||||
"kde": {"kcrash": "5.48.0", ...},
|
||||
"qt": {"qt5-qtbase": "5.12.0", ...},
|
||||
"other": {"konsole": "1234", ...}}
|
||||
"""
|
||||
ret = {}
|
||||
|
||||
for path in pkgrepo_iter_package_dirs():
|
||||
# Parse APKBUILD
|
||||
apkbuild = pmb.parse.apkbuild(path)
|
||||
url = apkbuild["url"]
|
||||
pkgname = apkbuild["pkgname"]
|
||||
pkgver = apkbuild["pkgver"]
|
||||
if pkgver == "9999":
|
||||
pkgver = apkbuild["_pkgver"]
|
||||
|
||||
if "_git" in pkgver:
|
||||
continue
|
||||
|
||||
# Categorize by URL
|
||||
category = "other"
|
||||
if "https://www.kde.org/workspaces/plasmadesktop" in url:
|
||||
category = "plasma"
|
||||
elif "https://community.kde.org/Frameworks" in url:
|
||||
category = "kde"
|
||||
elif url in ["http://qt-project.org/",
|
||||
"https://www.qt.io/developers/"]:
|
||||
category = "qt"
|
||||
|
||||
# Remove hotfix number (i.e. 5.16.90.1 becomes 5.16.90)
|
||||
if category in ["kde", "plasma"]:
|
||||
pkgver = ".".join(pkgver.split(".")[0:3])
|
||||
|
||||
# Save result
|
||||
if category not in ret:
|
||||
ret[category] = {}
|
||||
ret[category][pkgname] = pkgver
|
||||
return ret
|
||||
|
||||
|
||||
def check_categories(categories):
|
||||
"""
|
||||
Make sure that all packages in one framework (kde, plasma, ...) have the
|
||||
same package version (and that there is at least one package in each
|
||||
category).
|
||||
|
||||
:param categories: see return of get_categorized_packages()
|
||||
:returns: True when the check passed, False otherwise
|
||||
"""
|
||||
ret = True
|
||||
for category, packages in categories.items():
|
||||
reference = None
|
||||
for pkgname, pkgver in packages.items():
|
||||
|
||||
# Use the first package as reference and print a summary
|
||||
if not reference:
|
||||
logging.info("---")
|
||||
logging.info("Package category: " + category)
|
||||
logging.info("Packages count: " + str(len(packages)))
|
||||
|
||||
# Category "other": done after printing the basic summary, no
|
||||
# need to print each package or compare the package versions
|
||||
if category == "other":
|
||||
reference = True
|
||||
break
|
||||
|
||||
# Print all packages
|
||||
logging.info("Packages: " + ", ".join(sorted(packages.keys())))
|
||||
|
||||
# Print the reference and skip checking it against itself
|
||||
reference = {"pkgname": pkgname, "pkgver": pkgver}
|
||||
logging.info("Reference pkgver: " + pkgver + " (from '" +
|
||||
pkgname + "')")
|
||||
continue
|
||||
|
||||
# Check version against reference
|
||||
if pkgver != reference["pkgver"]:
|
||||
logging.info("ERROR: " + pkgname + " has version " + pkgver)
|
||||
ret = False
|
||||
|
||||
# Each category must at least have one package
|
||||
if not reference:
|
||||
logging.info("ERROR: could not find any packages in category: " +
|
||||
category)
|
||||
ret = False
|
||||
return ret
|
||||
|
||||
|
||||
def test_framework_versions():
|
||||
"""
|
||||
Make sure that packages of the same framework have the same version.
|
||||
"""
|
||||
categories = get_categorized_packages()
|
||||
if not check_categories(categories):
|
||||
raise RuntimeError("Framework version check failed!")
|
||||
@@ -1,55 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# Copyright 2021 Oliver Smith
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
import glob
|
||||
import pytest
|
||||
import sys
|
||||
import os
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
||||
import add_pmbootstrap_to_import_path
|
||||
import pmb.parse
|
||||
from pmb.core.pkgrepo import pkgrepo_iglob, pkgrepo_relative_path
|
||||
|
||||
|
||||
def test_aports_kernel():
|
||||
"""
|
||||
Various tests performed on the /**/linux-* aports.
|
||||
"""
|
||||
|
||||
for path in pkgrepo_iglob("**/linux-*/APKBUILD", recursive=True):
|
||||
apkbuild = pmb.parse.apkbuild(path)
|
||||
aport_name = os.path.basename(os.path.dirname(path))
|
||||
|
||||
if aport_name == "linux-pam-pmos":
|
||||
continue # This package isn't a linux kernel!
|
||||
|
||||
if "pmb:cross-native" not in apkbuild["options"]:
|
||||
raise RuntimeError(f"{aport_name}: \"pmb:cross-native\" missing in"
|
||||
" options= line")
|
||||
|
||||
# cross-compilers should not be in makedepends
|
||||
for ccc in ["gcc-armv7", "gcc-armhf", "gcc-aarch64",
|
||||
"gcc4-armv7", "gcc4-armhf", "gcc4-aarch64",
|
||||
"gcc6-armv7", "gcc6-armhf", "gcc6-aarch64"]:
|
||||
if ccc in apkbuild["makedepends"]:
|
||||
raise RuntimeError(f"{aport_name}: Cross-compiler ({ccc}) should"
|
||||
" not be explicitly specified in makedepends!"
|
||||
" pmbootstrap installs cross-compiler"
|
||||
" automatically.")
|
||||
|
||||
# check some options only for main and community devices
|
||||
_, relpath = pkgrepo_relative_path(path)
|
||||
for part in ["main", "community"]:
|
||||
if part in relpath.parts:
|
||||
if "pmb:kconfigcheck-community" not in apkbuild["options"]:
|
||||
raise RuntimeError(f"{aport_name}: \"pmb:kconfigcheck-community\" missing in"
|
||||
" options= line, required for all community/main devices.")
|
||||
|
||||
# check for postmarketos-installkernel in makedepends when installing kernel with make
|
||||
if bool(re.search("make z?install", path.read_text(encoding="utf-8"))):
|
||||
if "postmarketos-installkernel" not in apkbuild["makedepends"]:
|
||||
raise RuntimeError(f"{aport_name}: \"postmarketos-installkernel\" missing in"
|
||||
" makedepends, required when using make install/zinstall.")
|
||||
@@ -1,94 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# Copyright 2023 Oliver Smith
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
import glob
|
||||
import logging
|
||||
import os
|
||||
import pytest
|
||||
import sys
|
||||
import re
|
||||
|
||||
import add_pmbootstrap_to_import_path
|
||||
import pmb.parse
|
||||
import pmb.parse._apkbuild
|
||||
from pmb.core.pkgrepo import pkgrepo_iter_package_dirs, pkgrepo_relative_path
|
||||
|
||||
|
||||
def apkbuild_check_provides(path, apkbuild, version, pkgname, subpkgname=None):
|
||||
"""
|
||||
Verify that a package or subpackage is using provides correctly.
|
||||
|
||||
:param path: to the APKBUILD for the error message
|
||||
:param apkbuild: either the full return of pmb.parse.apkbuild() or a
|
||||
subpackage of it (apkbuild["subpackages"][$subpkgname])
|
||||
:param version: like 1.0.0-r3 so we can check against it
|
||||
:param pkgname: package name
|
||||
:param subpkgname: subpackage name, if we are looking at a subpackage
|
||||
:returns: list of error strings
|
||||
"""
|
||||
name = pkgname
|
||||
if subpkgname:
|
||||
name = f"{pkgname}:{subpkgname}"
|
||||
|
||||
logging.info(f"{name}: checking provides")
|
||||
ret = []
|
||||
|
||||
if not apkbuild["provides"]:
|
||||
return ret
|
||||
|
||||
for provide in apkbuild["provides"]:
|
||||
# Having provides entries without version is valid if the
|
||||
# provider_priorty is also set (pma#1766)
|
||||
if apkbuild["provider_priority"]:
|
||||
continue
|
||||
# Otherwise the version =$pkgver-r$pkgrel needs to be set. pmbootstrap
|
||||
# already replaces the variables, so we check against the inserted
|
||||
# values here.
|
||||
if not provide.endswith(f"={version}"):
|
||||
# Valid version strings, per the APKBUILD reference, are fine. This regex
|
||||
# attempts to detect those.
|
||||
pattern = r'^\d+(\.\d+)*[a-z]?(_(?:alpha|beta|pre|rc|cvs|svn|git|hg|p)\d*)*-r\d+$'
|
||||
[provide_no_ver, provide_ver] = provide.split("=", 1)
|
||||
if not re.match(pattern, provide_ver):
|
||||
error = f"error in , provide_ver{path}:\n"
|
||||
if subpkgname:
|
||||
error += f"in subpackage:\n {subpkgname}\n"
|
||||
else:
|
||||
error += f"in package:\n {pkgname}\n"
|
||||
error += f"broken provides entry:\n {provide_no_ver}\n"
|
||||
error += "\n"
|
||||
error += "This provides entry needs to be changed to"
|
||||
error += f" '{provide_no_ver}=$pkgver-r$pkgrel'"
|
||||
error += " (do not replace the variables, without '').\n"
|
||||
error += "\n"
|
||||
error += "If you know what you are doing and didn't add the"
|
||||
error += " version on purpose, you also need to set a"
|
||||
error += " provider_priority (pma#1766).\n"
|
||||
error += "Reference:"
|
||||
error += " https://wiki.alpinelinux.org/wiki/APKBUILD_Reference#provides"
|
||||
error += f"\nVERSION: {provide_no_ver}"
|
||||
ret += [error]
|
||||
return ret
|
||||
|
||||
|
||||
def test_provides():
|
||||
errors = []
|
||||
for path in pkgrepo_iter_package_dirs():
|
||||
path = path / "APKBUILD"
|
||||
apkbuild = pmb.parse.apkbuild(path)
|
||||
pkgname = apkbuild["pkgname"]
|
||||
version = f"{apkbuild['pkgver']}-r{apkbuild['pkgrel']}"
|
||||
_, path_rel = pkgrepo_relative_path(path)
|
||||
errors += apkbuild_check_provides(path_rel, apkbuild, version, pkgname)
|
||||
|
||||
for subpkg, subpkg_data in apkbuild["subpackages"].items():
|
||||
if not subpkg_data:
|
||||
# default packaging function like -doc
|
||||
continue
|
||||
errors += apkbuild_check_provides(path_rel, subpkg_data, version,
|
||||
pkgname, subpkg)
|
||||
|
||||
if errors:
|
||||
for error in errors:
|
||||
logging.error(error)
|
||||
raise RuntimeError(f"test_provides failed with {len(errors)} errors")
|
||||
@@ -1,158 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# Copyright 2023 Oliver Smith
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
# Various checks on source= in the APKBUILDs
|
||||
|
||||
import glob
|
||||
import logging
|
||||
import os
|
||||
import pytest
|
||||
import sys
|
||||
|
||||
import add_pmbootstrap_to_import_path
|
||||
import pmb.parse
|
||||
import pmb.parse._apkbuild
|
||||
import pmb.parse.apkindex
|
||||
import pmb.helpers.repo
|
||||
from pmb.core.pkgrepo import pkgrepo_iter_package_dirs, pkgrepo_relative_path
|
||||
|
||||
|
||||
def parse_source_from_checksums(apkbuild_path):
|
||||
"""
|
||||
Read the APKBUILD file and parse source files from the checksums at the
|
||||
bottom. This has always the same format, even if $source is built with hard
|
||||
to parse shell code (like in postmarketos-base).
|
||||
|
||||
:param apkbuild_path: full path to the APKBUILD
|
||||
:returns: dict of parsed "source" filenames and checksums, e.g.:
|
||||
{"first.patch": "b4dc4f3…",
|
||||
"second.patch": "b4dc4f3…"}
|
||||
"""
|
||||
start = 'sha512sums="'
|
||||
in_block = False
|
||||
ret = {}
|
||||
|
||||
with open(apkbuild_path, encoding="utf-8") as handle:
|
||||
for line in handle.readlines():
|
||||
# Find start
|
||||
if not in_block:
|
||||
if line.startswith(start):
|
||||
in_block = True
|
||||
else:
|
||||
continue
|
||||
|
||||
# sha512sums may have lines without checksums:
|
||||
# https://gitlab.alpinelinux.org/alpine/abuild/-/merge_requests/73
|
||||
if " " not in line:
|
||||
continue
|
||||
|
||||
try:
|
||||
checksum, filename = line.rstrip().split(" ", 2)
|
||||
except ValueError:
|
||||
raise ValueError("Failed to parse checksums. Try to delete the"
|
||||
" checksums and generate them again with"
|
||||
f" 'pmbootstrap checksum': {apkbuild_path}")
|
||||
|
||||
# Cut off 'sha512sums="' if the first checksum is in that line
|
||||
if checksum.startswith(start):
|
||||
checksum = checksum[len(start):]
|
||||
|
||||
# Find end
|
||||
if filename.endswith('"'):
|
||||
filename = filename[:-1]
|
||||
|
||||
ret[filename] = checksum
|
||||
return ret
|
||||
|
||||
|
||||
def test_aports_unreferenced_files():
|
||||
"""
|
||||
Raise an error if an unreferenced file is found
|
||||
"""
|
||||
for apkbuild_path in pkgrepo_iter_package_dirs():
|
||||
# pmbootstrap parser has some issues with complicated APKBUILDs, skip those.
|
||||
_, relpath = pkgrepo_relative_path(apkbuild_path)
|
||||
if relpath.parts[0] == "cross":
|
||||
continue
|
||||
|
||||
apkbuild_path = apkbuild_path / "APKBUILD"
|
||||
|
||||
apkbuild = pmb.parse.apkbuild(apkbuild_path)
|
||||
sources_chk = parse_source_from_checksums(apkbuild_path)
|
||||
|
||||
# Collect files from subpackages
|
||||
subpackage_installs = []
|
||||
subpackage_triggers = []
|
||||
if apkbuild["subpackages"]:
|
||||
for subpackage in apkbuild["subpackages"].values():
|
||||
if not subpackage:
|
||||
continue
|
||||
subpackage_installs += subpackage.get("install", [])
|
||||
subpackage_triggers += subpackage.get("triggers", [])
|
||||
|
||||
# Collect trigger files
|
||||
trigger_sources = []
|
||||
for trigger in apkbuild["triggers"] + subpackage_triggers:
|
||||
trigger_sources.append(trigger.split("=")[0])
|
||||
|
||||
dirname = os.path.dirname(apkbuild_path)
|
||||
for file in glob.iglob(dirname + "/**", recursive=True):
|
||||
rel_file_path = os.path.relpath(file, dirname)
|
||||
# Skip APKBUILDs and directories
|
||||
if rel_file_path in ["APKBUILD", "gitlab-ci.yml.j2"] or os.path.isdir(file):
|
||||
continue
|
||||
|
||||
if os.path.basename(rel_file_path) not in sources_chk \
|
||||
and rel_file_path not in apkbuild["install"] \
|
||||
and rel_file_path not in subpackage_installs \
|
||||
and rel_file_path not in trigger_sources \
|
||||
and not rel_file_path.startswith("tests/"):
|
||||
raise RuntimeError(f"{apkbuild_path}: found unreferenced file: {rel_file_path}")
|
||||
|
||||
|
||||
def test_distfiles_conflict():
|
||||
"""
|
||||
Make sure that each filename mentioned in any source= of any APKBUILD
|
||||
always has the same checksum. This is important because apk caches
|
||||
downloaded source files in a flat distfiles directory. So if two APKBUILDs
|
||||
both download a file with the same filename but different checksum, and the
|
||||
user builds both after each other, abuild will fail on the second build
|
||||
with a checksum error.
|
||||
"""
|
||||
source_all = {}
|
||||
for apkbuild_path in pkgrepo_iter_package_dirs():
|
||||
apkbuild_path = apkbuild_path / "APKBUILD"
|
||||
source = parse_source_from_checksums(apkbuild_path)
|
||||
dir_path = os.path.dirname(apkbuild_path)
|
||||
_, apkbuild_rel = pkgrepo_relative_path(apkbuild_path)
|
||||
for filename, checksum in source.items():
|
||||
# Files bundled with the APKBUILD don't get copied to the distfiles
|
||||
# cache, so not relevant for this check. Use glob.glob here and not
|
||||
# iglob, because we don't want an iterator.
|
||||
if glob.glob(f"{dir_path}/**/{filename}", recursive=True):
|
||||
continue
|
||||
|
||||
# First time seeing this file
|
||||
if filename not in source_all:
|
||||
source_all[filename] = {"checksum": checksum,
|
||||
"apkbuild_rel": apkbuild_rel}
|
||||
continue
|
||||
|
||||
# Saw this file already with same checksum
|
||||
if checksum == source_all[filename]["checksum"]:
|
||||
continue
|
||||
|
||||
# Saw this file already with different checksum
|
||||
logging.error("")
|
||||
logging.error(f"ERROR: the source file '{filename}' has different"
|
||||
" checksums in the following files:")
|
||||
logging.error(f"- {source_all[filename]['apkbuild_rel']}:")
|
||||
logging.error(f" {source_all[filename]['checksum']}")
|
||||
logging.error(f"- {apkbuild_rel}:")
|
||||
logging.error(f" {checksum}")
|
||||
logging.error("")
|
||||
logging.error("Fix this by setting a different target filename in"
|
||||
" the package you modified:")
|
||||
logging.error("https://wiki.alpinelinux.org/wiki/APKBUILD_Reference#source")
|
||||
logging.error("")
|
||||
raise RuntimeError(f"Conflict with source file '{filename}'")
|
||||
@@ -1,25 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# Copyright 2025 Oliver Smith
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
import logging
|
||||
import os
|
||||
|
||||
import pmb.parse
|
||||
from pmb.core.context import get_context
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def test_systemd_stage0_version():
|
||||
"""Ensure systemd-stage0 and systemd have the same pkgver."""
|
||||
# Don't clutter output with verbose APKBUILD parsing messages
|
||||
logging.getLogger().setLevel(logging.DEBUG)
|
||||
|
||||
config = get_context().config
|
||||
pma_systemd = os.path.join(config.aports[0], "extra-repos/systemd")
|
||||
|
||||
sd0 = pmb.parse.apkbuild(Path(os.path.join(pma_systemd, "systemd-stage0/APKBUILD")))
|
||||
sd1 = pmb.parse.apkbuild(Path(os.path.join(pma_systemd, "systemd/APKBUILD")))
|
||||
|
||||
assert sd0["pkgver"] == sd1["pkgver"], (
|
||||
f"systemd-stage0 pkgver ({sd0['pkgver']}) doesn't match systemd pkgver ({sd1['pkgver']})!"
|
||||
)
|
||||
@@ -1,47 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# Copyright 2021 Oliver Smith
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
import common
|
||||
import pmb.parse
|
||||
|
||||
|
||||
def test_aports_ui():
|
||||
"""
|
||||
Raise an error if package in _pmb_recommends is not found
|
||||
"""
|
||||
pmaports_cfg = pmb.config.pmaports.read_config()
|
||||
for arch in pmaports_cfg["supported_arches"].split(","):
|
||||
for path in common.get_changed_files():
|
||||
path = Path(path)
|
||||
|
||||
if path.name != "APKBUILD":
|
||||
continue
|
||||
if not path.parent.name.startswith("postmarketos-ui"):
|
||||
continue
|
||||
|
||||
apkbuild = pmb.parse.apkbuild(path)
|
||||
# Skip if arch isn't enabled
|
||||
if not pmb.helpers.package.check_arch(apkbuild["pkgname"], arch, False):
|
||||
continue
|
||||
|
||||
for package in apkbuild["_pmb_recommends"]:
|
||||
depend = pmb.helpers.package.get(
|
||||
package, arch, must_exist=False, try_other_arches=False
|
||||
)
|
||||
if depend is None:
|
||||
raise RuntimeError(f"{path}: package '{package}' from"
|
||||
f" _pmb_recommends not found for arch '{arch}'")
|
||||
|
||||
# Check packages from "_pmb_recommends" of -extras subpackage if one exists
|
||||
if f"{apkbuild['pkgname']}-extras" in apkbuild["subpackages"]:
|
||||
apkbuild = apkbuild["subpackages"][f"{apkbuild['pkgname']}-extras"]
|
||||
for package in apkbuild["_pmb_recommends"]:
|
||||
depend = pmb.helpers.package.get(
|
||||
package, arch, must_exist=False, try_other_arches=False
|
||||
)
|
||||
if depend is None:
|
||||
raise RuntimeError(f"{path}: package '{package}' from _pmb_recommends "
|
||||
f"of -extras subpackage is not found for arch '{arch}'")
|
||||
@@ -1,19 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
# Description: run unit-tests for packages
|
||||
# https://postmarketos.org/pmb-ci
|
||||
#
|
||||
# This script only exists to allow running unit-tests locally.
|
||||
# In actual CI the package tests/ subdir has it's own YAML
|
||||
# fine defining a job which calls testlib for that package.
|
||||
# This way we can run all the package unit-tests locally but
|
||||
# have them be individual jobs in GitLab.
|
||||
|
||||
if [ "$(id -u)" = 0 ]; then
|
||||
set -x
|
||||
exec su "${TESTUSER:-build}" -c "sh -e $0"
|
||||
fi
|
||||
|
||||
find . -type d -name "tests" | while read -r testdir; do
|
||||
pkg="$(basename "$(dirname "$testdir")")"
|
||||
.ci/lib/testlib.sh "$testdir" "$pkg"
|
||||
done
|
||||
@@ -1,16 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
# Description: verify checksums of modified packages
|
||||
# Options: native
|
||||
# Use 'native' because it requires running pmbootstrap.
|
||||
# https://postmarketos.org/pmb-ci
|
||||
|
||||
if [ "$(id -u)" = 0 ]; then
|
||||
set -x
|
||||
wget "https://gitlab.postmarketos.org/postmarketOS/ci-common/-/raw/master/install_pmbootstrap.sh"
|
||||
sh ./install_pmbootstrap.sh
|
||||
exec su "${TESTUSER:-pmos}" -c "sh -e $0"
|
||||
fi
|
||||
|
||||
export PYTHONUNBUFFERED=1
|
||||
|
||||
.ci/lib/verify_checksums.py
|
||||
-17
@@ -1,17 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
# Description: verify devices are documented in the wiki
|
||||
# Options: native
|
||||
# Run natively so we don't need to set up a chroot, python3 is the only dep.
|
||||
# https://postmarketos.org/pmb-ci
|
||||
|
||||
if [ "$(id -u)" = 0 ]; then
|
||||
set -x
|
||||
apk -q add \
|
||||
git \
|
||||
python3
|
||||
exec su "${TESTUSER:-build}" -c "sh -e $0"
|
||||
fi
|
||||
|
||||
set -x
|
||||
# shellcheck disable=SC2068
|
||||
.ci/lib/check_devices_in_wiki.py --booting $@
|
||||
@@ -1,9 +0,0 @@
|
||||
---
|
||||
# C and C++ code
|
||||
Language: Cpp
|
||||
BasedOnStyle: WebKit
|
||||
DerivePointerAlignment: false
|
||||
PointerAlignment: Right
|
||||
TabWidth: 4
|
||||
UseTab: Always
|
||||
...
|
||||
@@ -1,26 +0,0 @@
|
||||
; This file is for unifying the coding style for different editors and IDEs.
|
||||
; Plugins are available for notepad++, emacs, vim, gedit,
|
||||
; textmate, visual studio, and more.
|
||||
;
|
||||
; See http://editorconfig.org for details.
|
||||
|
||||
# Top-most EditorConfig file.
|
||||
root = true
|
||||
|
||||
[{**.{ini,sh,rules,nft},**/APKBUILD,CODEOWNERS}]
|
||||
indent_style = tab
|
||||
end_of_line = lf
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[**.md]
|
||||
# No indent_size since space size has meaning in markdown
|
||||
indent_style = space
|
||||
end_of_line = lf
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
# Forked from Alpine
|
||||
[extra-repos/systemd/networkmanager/networkmanager.rules]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
@@ -1,129 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# This hook checks that all local sources specified in the staged APKBUILDs
|
||||
# are staged too or already committed and that checksums are correct.
|
||||
#
|
||||
set -eu
|
||||
|
||||
# Maximal allowed size (in bytes) of a file.
|
||||
FILE_SIZE_LIMIT=262144 # 256 kiB
|
||||
|
||||
|
||||
if ! command -v sha512sum >/dev/null; then
|
||||
# macOS / BSDs (?) don't have sha512sum, but shasum.
|
||||
alias sha512sum='shasum -a 512'
|
||||
fi
|
||||
|
||||
error() {
|
||||
printf '\033[0;31mpre-commit:\033[0m %s\n' "$1" >&2 # red
|
||||
}
|
||||
|
||||
# Prints paths of created or modified files being committed.
|
||||
changed_files() {
|
||||
git diff-index \
|
||||
--name-only \
|
||||
--cached \
|
||||
--diff-filter=ACMR HEAD \
|
||||
-- "$@"
|
||||
}
|
||||
|
||||
# Prints file names and checksums (in format <SHA-512>:<filename>) of local
|
||||
# sources specified in the APKBUILD ($1).
|
||||
apkbuild_local_sources() {
|
||||
apkbuild="$1"
|
||||
|
||||
set +eu
|
||||
. "$apkbuild" || {
|
||||
error "$apkbuild is invalid"
|
||||
return 1
|
||||
}
|
||||
set -eu
|
||||
|
||||
status=0
|
||||
: ${source:=""}
|
||||
for src in $source; do
|
||||
# Skip remote sources.
|
||||
case "$src" in */*) continue;; esac
|
||||
|
||||
echo "$sha512sums" | awk -v src="$src" '
|
||||
{ if ($2 == src) { ok=1; print($2 ":" $1) } }
|
||||
END { if (ok != 1) exit 1 }' || {
|
||||
status=1
|
||||
error "${apkbuild%/*}: file \"$src\" is missing in \$sha512sums (hint: run pmbootstrap checksum)"
|
||||
}
|
||||
done
|
||||
|
||||
return $status
|
||||
}
|
||||
|
||||
# check if given object is a symlink
|
||||
is_symlink() {
|
||||
test "$(git ls-files --stage "$1" | awk '{print $1}')" = "120000"
|
||||
}
|
||||
|
||||
# Checks that all local sources specified in the APKBUILD file ($1) are
|
||||
# available in git tree and checksums are correct.
|
||||
check_local_sources() {
|
||||
local apkbuild="$1"
|
||||
local startdir="$2"
|
||||
local status=0
|
||||
local checksum_act checksum_exp content filename line sources
|
||||
|
||||
sources=$(apkbuild_local_sources "$apkbuild")
|
||||
for line in $sources; do
|
||||
filename=${line%%:*}
|
||||
checksum_exp=${line#*:}
|
||||
|
||||
if ! git cat-file -e ":$startdir/$filename" 2>/dev/null; then
|
||||
error "$startdir: missing file \"$filename\""
|
||||
status=1
|
||||
continue
|
||||
fi
|
||||
|
||||
if is_symlink ":$startdir/$filename"; then
|
||||
continue
|
||||
fi
|
||||
|
||||
checksum_act=$(git show ":$startdir/$filename" | sha512sum)
|
||||
if [ "$checksum_act" != "$checksum_exp -" ]; then
|
||||
local cmd="pmbootstrap checksum $(basename "$startdir")"
|
||||
error "$startdir: bad checksum for file \"$filename\" (hint: run $cmd)"
|
||||
status=1
|
||||
fi
|
||||
done
|
||||
|
||||
return $status
|
||||
}
|
||||
|
||||
# Checks if the file ($1) being committed is not bigger than FILE_SIZE_LIMIT.
|
||||
check_file_size() {
|
||||
local path="$1"
|
||||
local size
|
||||
|
||||
size=$(git cat-file -s ":$path")
|
||||
if [ $size -gt $FILE_SIZE_LIMIT ]; then
|
||||
local size_kb=$(( size / 1024 ))
|
||||
|
||||
error "file \"$path\" is quite big ($(( size / 1024 )) kiB), better put a remote url in source="
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
cleanup() {
|
||||
[ -f "$_staged" ] && rm "$_staged"
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
for apkbuild in $(changed_files '**/APKBUILD'); do
|
||||
_staged="$(mktemp)"
|
||||
git show ":$apkbuild" >"$_staged"
|
||||
check_local_sources "$_staged" "${apkbuild%/*}"
|
||||
cleanup
|
||||
done
|
||||
|
||||
for path in $(changed_files); do
|
||||
check_file_size "$path"
|
||||
done
|
||||
|
||||
trap - EXIT
|
||||
@@ -1,72 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# This hook adds prefix "<repo>/<pkgname>: " to the commit message when
|
||||
# committing changes of a single package.
|
||||
#
|
||||
MSG_FILE="$1"
|
||||
SOURCE="$2"
|
||||
|
||||
longest_common_prefix() {
|
||||
awk -F/ '
|
||||
(NR == 1) { split($0, prefix); prefix_len = NF }
|
||||
(NR > 1) {
|
||||
for (i = 1; i <= prefix_len; i++) {
|
||||
if (prefix[i] != $i) {
|
||||
prefix_len = i - 1; break
|
||||
}
|
||||
}
|
||||
}
|
||||
(prefix_len == 0) { exit }
|
||||
END {
|
||||
res = prefix[1]
|
||||
for (i = 2; i <= prefix_len; i++) {
|
||||
res = res FS prefix[i]
|
||||
}
|
||||
print(res)
|
||||
}'
|
||||
}
|
||||
|
||||
prepend_msg() {
|
||||
local prefix="$1"
|
||||
|
||||
printf '%s\n%s\n' "$prefix" "$(cat "$MSG_FILE")" > "$MSG_FILE"
|
||||
}
|
||||
|
||||
|
||||
# Do nothing if message has been given using -m, template, merge etc.
|
||||
[ -z "$SOURCE" ] || exit 0
|
||||
|
||||
lcp=$(git diff-index --name-only --cached HEAD | longest_common_prefix)
|
||||
prefix=""
|
||||
|
||||
case "$lcp" in
|
||||
extra-repos/systemd/systemd/*)
|
||||
prefix="systemd"
|
||||
;;
|
||||
extra-repos/systemd/*)
|
||||
prefix="systemd/$(echo "$lcp" | cut -d/ -f3)"
|
||||
;;
|
||||
device/*/*)
|
||||
prefix="$(echo "$lcp" | cut -d/ -f3)"
|
||||
;;
|
||||
docs/*.adoc)
|
||||
prefix="docs/$(basename $lcp .adoc)"
|
||||
;;
|
||||
docs/*)
|
||||
prefix="docs"
|
||||
;;
|
||||
device/*)
|
||||
# Multiple packages touched for same device category. More
|
||||
# logic could be added to detect if they all belong to same
|
||||
# device.
|
||||
;;
|
||||
[^.]*/*)
|
||||
prefix="$(echo "$lcp" | cut -d/ -f1-2)"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -n "$prefix" ]; then
|
||||
prepend_msg "$prefix: "
|
||||
fi
|
||||
|
||||
exit 0
|
||||
+2
-118
@@ -4,121 +4,5 @@
|
||||
*.rej
|
||||
*.orig
|
||||
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
env/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
*.manifest
|
||||
*.spec
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*.cover
|
||||
.hypothesis/
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
local_settings.py
|
||||
|
||||
# Flask stuff:
|
||||
instance/
|
||||
.webassets-cache
|
||||
|
||||
# Scrapy stuff:
|
||||
.scrapy
|
||||
|
||||
# Documentation
|
||||
public
|
||||
docs/deviceinfo-reference.md
|
||||
|
||||
# PyBuilder
|
||||
target/
|
||||
|
||||
# Jupyter Notebook
|
||||
.ipynb_checkpoints
|
||||
|
||||
# pyenv
|
||||
.python-version
|
||||
|
||||
# celery beat schedule file
|
||||
celerybeat-schedule
|
||||
|
||||
# SageMath parsed files
|
||||
*.sage.py
|
||||
|
||||
# dotenv
|
||||
.env
|
||||
|
||||
# virtualenv
|
||||
.venv
|
||||
venv/
|
||||
ENV/
|
||||
|
||||
# Spyder project settings
|
||||
.spyderproject
|
||||
.spyproject
|
||||
|
||||
# Rope project settings
|
||||
.ropeproject
|
||||
|
||||
# mkdocs documentation
|
||||
/site
|
||||
|
||||
# mypy
|
||||
.mypy_cache/
|
||||
|
||||
# Visual Studio Code
|
||||
.vscode/
|
||||
|
||||
# Pytest
|
||||
.pytest_cache
|
||||
|
||||
# JetBrains IDEs (PyCharm, etc)
|
||||
.idea
|
||||
|
||||
# Sources as unpacked and built by abuild
|
||||
**/src/
|
||||
|
||||
# Allow having untracked packages in aports using a custom-something directory
|
||||
/custom-*/
|
||||
|
||||
# child pipeline
|
||||
.ci/build-jobs.yaml
|
||||
clones
|
||||
tarballs
|
||||
-250
@@ -1,250 +0,0 @@
|
||||
---
|
||||
|
||||
# global settings
|
||||
image: alpine:latest
|
||||
after_script:
|
||||
- .ci/lib/move_logs.sh $CI_PROJECT_DIR
|
||||
stages:
|
||||
- lint
|
||||
- prepare
|
||||
- build
|
||||
- autoupdate
|
||||
- test
|
||||
- deploy
|
||||
variables:
|
||||
# Default of 20 is pretty small, sometimes MRs have >20 commits in them. 100
|
||||
# seems like a reasonable balance. If this is too low, git merge-base (from ci/
|
||||
# common.py) can fail
|
||||
GIT_DEPTH: 100
|
||||
|
||||
# This defines the rules for when a pipeline should run.
|
||||
workflow:
|
||||
rules:
|
||||
# Run for merge requests
|
||||
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
||||
# Some things have to run in the default branch
|
||||
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
||||
# Run scheduled pipeline for autoupdate or manually triggered pipeline
|
||||
- if: $CI_PIPELINE_SOURCE == "schedule" || $CI_PIPELINE_SOURCE == "web"
|
||||
|
||||
# Some packages have their own yaml files defining tests. All of these should contain
|
||||
# only jobs which extend the .package-test job!
|
||||
include: "**/.gitlab-ci.yml"
|
||||
|
||||
# device documentation
|
||||
wiki:
|
||||
stage: lint
|
||||
rules:
|
||||
- if: &mr_rule $CI_PIPELINE_SOURCE == "merge_request_event"
|
||||
changes:
|
||||
- .ci/**/*
|
||||
- .ci/build-jobs.yaml.j2
|
||||
- .gitlab-ci.yml
|
||||
- device/*/device-*/*
|
||||
script:
|
||||
- .ci/lib/gitlab_prepare_ci.sh
|
||||
- .ci/wiki.sh
|
||||
|
||||
# testcases linting
|
||||
ruff:
|
||||
stage: lint
|
||||
rules:
|
||||
- if: *mr_rule
|
||||
changes:
|
||||
- .ci/*
|
||||
- .ci/*/*
|
||||
- .ci/build-jobs.yaml.j2
|
||||
- .gitlab-ci.yml
|
||||
script:
|
||||
- .ci/lib/gitlab_prepare_ci.sh
|
||||
- .ci/ruff.sh
|
||||
|
||||
# shellcheck and various grep checks
|
||||
shellcheck-grep:
|
||||
stage: lint
|
||||
rules:
|
||||
- if: *mr_rule
|
||||
script:
|
||||
- .ci/lib/gitlab_prepare_ci.sh
|
||||
- .ci/shellcheck.sh
|
||||
- .ci/grep.sh
|
||||
|
||||
editor-config:
|
||||
stage: lint
|
||||
rules:
|
||||
- if: *mr_rule
|
||||
script:
|
||||
- .ci/lib/gitlab_prepare_ci.sh
|
||||
- .ci/ec.sh
|
||||
|
||||
# aports checks (generic)
|
||||
pytest-commits:
|
||||
stage: lint
|
||||
rules:
|
||||
- if: *mr_rule
|
||||
script:
|
||||
- .ci/lib/gitlab_prepare_ci.sh
|
||||
- .ci/pytest.sh
|
||||
- .ci/commits.sh
|
||||
artifacts:
|
||||
when: on_failure
|
||||
paths:
|
||||
- log.txt
|
||||
- log_testsuite_pmaports.txt
|
||||
- pmbootstrap.cfg
|
||||
expire_in: 1 week
|
||||
|
||||
# APKBUILD linting
|
||||
aport-lint:
|
||||
stage: lint
|
||||
rules:
|
||||
- if: *mr_rule
|
||||
script:
|
||||
- .ci/lib/gitlab_prepare_ci.sh
|
||||
- .ci/apkbuild-lint.sh
|
||||
allow_failure: true
|
||||
|
||||
# deviceinfo linting
|
||||
dint:
|
||||
stage: lint
|
||||
rules:
|
||||
- if: *mr_rule
|
||||
changes:
|
||||
- .ci/**/*
|
||||
- .gitlab-ci.yml
|
||||
- device/*/device-*/deviceinfo
|
||||
script:
|
||||
- .ci/lib/gitlab_prepare_ci.sh
|
||||
- .ci/dint.sh
|
||||
allow_failure:
|
||||
exit_codes:
|
||||
- 2 # returned by dint on non-fatal warning
|
||||
|
||||
# kernel kconfig check
|
||||
kernel-kconfig:
|
||||
stage: lint
|
||||
rules:
|
||||
- if: *mr_rule
|
||||
changes:
|
||||
- kconfigcheck.toml
|
||||
allow_failure: true
|
||||
- if: *mr_rule
|
||||
changes:
|
||||
- device/*/linux-*/config-*
|
||||
script:
|
||||
- .ci/lib/gitlab_prepare_ci.sh
|
||||
- .ci/kconfig.sh
|
||||
|
||||
# Verify checksums
|
||||
verify-checksums:
|
||||
stage: lint
|
||||
rules:
|
||||
- if: *mr_rule
|
||||
script:
|
||||
- .ci/lib/gitlab_prepare_ci.sh
|
||||
- .ci/verify-checksums.sh
|
||||
|
||||
# MR settings
|
||||
# (Checks for "Allow commits from members who can merge to the target branch")
|
||||
mr-settings:
|
||||
stage: lint
|
||||
rules:
|
||||
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
||||
before_script:
|
||||
- apk -q add python3
|
||||
script:
|
||||
- wget -q "https://gitlab.postmarketos.org/postmarketOS/ci-common/-/raw/master/check_mr_settings.py"
|
||||
- python3 ./check_mr_settings.py
|
||||
|
||||
# Calculate build of changed aports using a dynamic downstream pipelines:
|
||||
# https://docs.gitlab.com/ci/pipelines/downstream_pipelines/#dynamic-child-pipelines
|
||||
# For those to work, we need two jobs:
|
||||
# * First one (this one) that generates a valid yaml file with the job yaml as
|
||||
# an artifact
|
||||
# * Second one (build-jobs) that has a "trigger" key with the yaml file from
|
||||
# which to trigger pipelines
|
||||
# To avoid reworking the whole CI file, for now we are re-using this same file
|
||||
# to trigger the downstream pipeline. In that case, $CI_PIPELINE_SOURCE will
|
||||
# be set to "parent_pipeline", and only the jobs that extend .build will run
|
||||
generate-build-jobs:
|
||||
stage: prepare
|
||||
before_script:
|
||||
- .ci/lib/gitlab_prepare_ci.sh
|
||||
needs: []
|
||||
script:
|
||||
- wget "https://gitlab.postmarketos.org/postmarketOS/ci-common/-/raw/master/install_pmbootstrap.sh"
|
||||
- sh ./install_pmbootstrap.sh py3-jinja2
|
||||
|
||||
# HACK: Make the pmb library happy to use the currently-cloned pmaports repo
|
||||
- mkdir -p /root/.local/var/pmbootstrap/cache_git/ && ln -s $PWD /root/.local/var/pmbootstrap/cache_git/pmaports
|
||||
|
||||
- PYTHONPATH=/tmp/pmbootstrap/ .ci/lib/generate_build_jobs.py .ci/build-jobs.yaml.j2 .ci/build-jobs.yaml
|
||||
|
||||
artifacts:
|
||||
paths:
|
||||
- .ci/build-jobs.yaml
|
||||
rules:
|
||||
- if: *mr_rule
|
||||
|
||||
build-jobs:
|
||||
stage: build
|
||||
trigger:
|
||||
include:
|
||||
- artifact: .ci/build-jobs.yaml
|
||||
job: generate-build-jobs
|
||||
strategy: depend
|
||||
forward:
|
||||
# So that we don't have to duplicate GIT_DEPTH
|
||||
pipeline_variables: true
|
||||
rules:
|
||||
- if: *mr_rule
|
||||
|
||||
build-docs:
|
||||
stage: build
|
||||
before_script:
|
||||
- adduser -D build
|
||||
script:
|
||||
- .ci/build-docs.sh
|
||||
rules:
|
||||
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
||||
changes:
|
||||
- docs/**
|
||||
|
||||
deploy-docs:
|
||||
stage: deploy
|
||||
trigger:
|
||||
project: postmarketOS/docs.postmarketos.org
|
||||
strategy: depend
|
||||
rules:
|
||||
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PROJECT_NAMESPACE == "postmarketOS"
|
||||
changes:
|
||||
- docs/**
|
||||
- if: $CI_PIPELINE_SOURCE == "schedule"
|
||||
when: never
|
||||
|
||||
auto-update:
|
||||
stage: autoupdate
|
||||
rules:
|
||||
# This variable is set in the scheduled pipeline configuration. It should be a space separated list of
|
||||
# package names to update.
|
||||
- if: $AUTOUPDATE_PACKAGES != null && $CI_PIPELINE_SOURCE == "schedule" || $CI_PIPELINE_SOURCE == "web"
|
||||
before_script:
|
||||
- .ci/lib/gitlab_prepare_ci.sh
|
||||
script:
|
||||
- .ci/autoupdate.sh "$AUTOUPDATE_PACKAGES"
|
||||
after_script:
|
||||
- .ci/lib/move_logs.sh $CI_PROJECT_DIR
|
||||
artifacts:
|
||||
when: on_failure
|
||||
paths:
|
||||
- log.txt
|
||||
- log_testsuite_pmaports.txt
|
||||
- pmbootstrap.cfg
|
||||
|
||||
# Template for package test jobs defined per-package
|
||||
.package-test:
|
||||
stage: test
|
||||
rules:
|
||||
- if: *mr_rule
|
||||
before_script:
|
||||
- .ci/lib/gitlab_prepare_ci.sh
|
||||
@@ -1,31 +0,0 @@
|
||||
<!-- Use this template to kick off the discussion for changing one or more
|
||||
related kernel config options.
|
||||
-->
|
||||
|
||||
### Read the fine manual, please :)
|
||||
|
||||
- [ ] I have read https://postmarketos.org/kconfig-adjust-multiple
|
||||
|
||||
### What benefit does the change have?
|
||||
|
||||
### Which option(s) would you like to change?
|
||||
|
||||
<!-- Make sure to specify if you would like to enable/disable/set a value. -->
|
||||
|
||||
### Did you already test that this works as expected?
|
||||
|
||||
<!-- Not required, but recommended. If you did test it, please list which
|
||||
device you have tested it with. -->
|
||||
|
||||
### For which kernel configs would you do the change?
|
||||
|
||||
<!-- If it makes sense, we encourage to adjust all kernels used by devices in
|
||||
the main and community categories, so devices behave consistently. -->
|
||||
|
||||
- [ ] all in main and community
|
||||
- [ ] certain SoC(s):
|
||||
- [ ] other (please specify):
|
||||
|
||||
|
||||
<!-- leave this, so it applies the correct label in gitlab -->
|
||||
/label ~"change-kernel-config"
|
||||
@@ -1,66 +0,0 @@
|
||||
<!--
|
||||
Thank you for using postmarketOS! In order to speed up process of resolving your issue,
|
||||
we would like you to fill in the following form.
|
||||
|
||||
*** NOTE FOR CONFIDENTIAL ISSUES: ***
|
||||
A lot of people can read confidential pmaports issues! If you want to
|
||||
submit something that only the postmarketOS Core Team can see, write to
|
||||
team@postmarketos.org
|
||||
instead of opening an issue here!
|
||||
-->
|
||||
### Describe your issue
|
||||
#### What's the expected behaviour?
|
||||
|
||||
#### What's the current behaviour?
|
||||
|
||||
#### How to reproduce your issue?
|
||||
|
||||
### What device are you using?
|
||||
<!--
|
||||
Leave name of your device in vendor-codename format.
|
||||
If unsure, check name in the device package or leave full name of device
|
||||
PinePhone: which revision exactly? See https://wiki.pine64.org/index.php/PinePhone#Hardware_revisions
|
||||
-->
|
||||
|
||||
### On what postmarketOS version did you encounter the issue?
|
||||
<!--
|
||||
Replace space inside `[ ]` with `x` to fill the checkbox
|
||||
-->
|
||||
* [ ] edge (`master` branch)
|
||||
* [ ] `v25.06`
|
||||
|
||||
* [ ] I confirm that the issue still is present after running `sudo apk upgrade -a`
|
||||
|
||||
### On what environment did you encounter the issue?
|
||||
#### Environments
|
||||
* [ ] COSMIC
|
||||
* [ ] GNOME Shell on Mobile
|
||||
* [ ] Phosh
|
||||
* [ ] Plasma Mobile
|
||||
* [ ] Sxmo (Wayland/Sway) **Please post the output of `sxmo_version.sh`**
|
||||
* [ ] Other: **Please fill out**
|
||||
### Which init system are you using?
|
||||
* [ ] OpenRC
|
||||
* [ ] systemd
|
||||
### How did you get postmarketOS image?
|
||||
* [ ] from https://images.postmarketos.org
|
||||
* [ ] I built it using pmbootstrap
|
||||
* [ ] It was preinstalled on my device
|
||||
### What's the build date of the image? (in yyyy-mm-dd format)
|
||||
<!--
|
||||
Notes:
|
||||
can be left empty if unsure
|
||||
If you downloaded image from images.postmarketos.org, date will be in yyyymmdd format
|
||||
-->
|
||||
|
||||
### Additional information
|
||||
<!--
|
||||
logs, etc. -- make use <details> for long listings
|
||||
|
||||
If your device displays an error message on boot or drops to the debug
|
||||
shell, attaching it to your PC with a USB cable may show a removable USB
|
||||
drive. You can drag and drop the .tar.gz file or otherwise upload it
|
||||
here.
|
||||
|
||||
Refer to the README file on the device for more information.
|
||||
-->
|
||||
@@ -1,3 +0,0 @@
|
||||
Casey Connolly <casey.connolly@linaro.org> <caleb.connolly@linaro.org>
|
||||
Casey Connolly <kcxt@postmarketos.org> <caleb@postmarketos.org>
|
||||
Achill Gilgenast <achill@achill.org> <fossdd@pwned.life>
|
||||
@@ -1 +0,0 @@
|
||||
https://postmarketos.org/funding.json
|
||||
-102
@@ -1,102 +0,0 @@
|
||||
# Policy for commits in pmaports
|
||||
|
||||
This document defines policy for organising and titling commits for
|
||||
inclusion in pmaports.
|
||||
|
||||
## Definitions
|
||||
|
||||
### Device-specific package
|
||||
|
||||
A device-specific package is used to apply configuration and
|
||||
functionality specifically for device support in postmarketOS.
|
||||
This is in contrast to other packages
|
||||
(e.g. main/postmarketos-ui-phosh) in postmarketOS that are used
|
||||
for configuring the distribution without consideration of the
|
||||
target device.
|
||||
|
||||
## General policy
|
||||
|
||||
We follow Alpine's aports commit style with some minor exceptions
|
||||
and additions. Alpine's commit style can be found here:
|
||||
https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/COMMITSTYLE.md
|
||||
|
||||
## Exceptions
|
||||
|
||||
### Changes to packages inside of the device directory
|
||||
|
||||
While Alpine has the policy of always prefixing package names with
|
||||
the name of the repository they are in, in the case of pmaports
|
||||
this can lead to excessively long commit titles due to the nested
|
||||
subfolders of the device directory. As such, commits changing
|
||||
packages inside of the device directory should omit the directory
|
||||
prefix, for example:
|
||||
|
||||
device-pine64-pinephone: description of change
|
||||
|
||||
Or:
|
||||
|
||||
soc-qcom-msm8996: description of change
|
||||
|
||||
If the commit only makes device-specific changes, the
|
||||
commit title can opt to use the following format:
|
||||
|
||||
manufacturer-codename: description of change
|
||||
|
||||
### Changes to packages inside of the systemd directory
|
||||
|
||||
We also shorten the prefixes for packages in `extra-repos/systemd`.
|
||||
When the `systemd` package itself gets changed, use `systemd: ` as
|
||||
prefix. For example:
|
||||
|
||||
systemd: add triggers for reloading/restarting services
|
||||
|
||||
When another package inside the systemd directory gets changed, use
|
||||
`systemd/$pkgname: ` as prefix. For example:
|
||||
|
||||
systemd/cups: restart on upgrade
|
||||
|
||||
### Moving devices between categories
|
||||
|
||||
As we do not include directory prefixes in device-related commits,
|
||||
Alpine's commit style for moving packages does not apply. Instead,
|
||||
we do the following:
|
||||
|
||||
manufacturer-codename: move from category to category
|
||||
|
||||
For example:
|
||||
|
||||
samsung-m0: move from testing to community
|
||||
|
||||
## Additions
|
||||
|
||||
### Forking packages from Alpine
|
||||
|
||||
Run `pmbootstrap aportgen --fork-alpine package` and modify it.
|
||||
|
||||
#### Template
|
||||
|
||||
- temp/package-name: fork from Alpine
|
||||
|
||||
Example: temp/pulseaudio: fork from Alpine
|
||||
|
||||
#### Rules
|
||||
|
||||
One commit per forked package.
|
||||
|
||||
### Adding new devices
|
||||
|
||||
Adding a new device package and optionally also a device-specific
|
||||
Linux and firmware package.
|
||||
|
||||
#### Template
|
||||
|
||||
- manufacturer-codename: new device
|
||||
|
||||
Example: htc-m8qlul: new device
|
||||
|
||||
#### Rules
|
||||
|
||||
If the device has the option of making use of a device-specific
|
||||
kernel and/or firmware package, those packages should be included
|
||||
in the same commit that adds the device package. One device per
|
||||
commit.
|
||||
@@ -1,674 +0,0 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
{one line to give the program's name and a brief idea of what it does.}
|
||||
Copyright (C) {year} {name of author}
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
{project} Copyright (C) {year} {fullname}
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
@@ -1,23 +1,18 @@
|
||||
# postmarketOS aports repository
|
||||
# KDE Nightly
|
||||
|
||||
This repository contains the APKBUILD files for postmarketOS-specific packages, along with the required patches and scripts, if any.
|
||||
This branch includes APKBUILDs to build all of KDE nightly straight from git master.
|
||||
It's not intended to be used on systems that people rely on, rather it's meant to ease development and for easy testing.
|
||||
|
||||
There are many more packages defined in the [Alpine Linux aports](https://gitlab.alpinelinux.org/alpine/aports/) on which these packages depend.
|
||||
See https://wiki.postmarketos.org/Nightly for more details.
|
||||
|
||||
Helpful resources:
|
||||
* [How to create a package](https://wiki.postmarketos.org/wiki/Create_a_package)
|
||||
* [APKBUILD reference](https://wiki.alpinelinux.org/wiki/APKBUILD_Reference)
|
||||
* [pmaports commit style](./COMMITSTYLE.md)
|
||||
* [Review and merging guidelines](./docs/modules/ROOT/pages/merging-rules.adoc)
|
||||
* [Alpine Linux aports](https://gitlab.alpinelinux.org/alpine/aports/)
|
||||
* [Alpine Linux package search](https://pkgs.alpinelinux.org/packages)
|
||||
* [postmarketOS package search](https://pkgs.postmarketos.org/packages)
|
||||
## Disabled packages
|
||||
|
||||
## Git Hooks
|
||||
Sometimes packages don't build due to various external reasons.
|
||||
These are removed from the repo to allow building the rest of the repository but will have to be re-added once they're fixed.
|
||||
They can be restored with `git checkout <commit they were removed in>^ -- packages/<package name>`).
|
||||
|
||||
You can find some useful git hooks in the `.githooks` directory.
|
||||
To use them, run the following command after cloning this repository:
|
||||
|
||||
```sh
|
||||
git config --local core.hooksPath .githooks
|
||||
```
|
||||
Here is the current list:
|
||||
- `akonadiconsole`, it's dependency `xapian-bindings` is currently disabled in Alpine
|
||||
- `oxygen`, requires currently unmerged PR's
|
||||
- `kimagemapeditor`, currently incompatible with `kio`
|
||||
- `k3b`, currently incompatible with `kbookmarks`
|
||||
@@ -1,81 +0,0 @@
|
||||
# Reference: https://postmarketos.org/channels.cfg
|
||||
[channels.cfg]
|
||||
recommended=edge
|
||||
|
||||
[edge]
|
||||
description=Rolling release / Most devices / Occasional breakage: https://postmarketos.org/edge
|
||||
branch_pmaports=master
|
||||
branch_aports=master
|
||||
mirrordir_alpine=edge
|
||||
|
||||
[v25.12]
|
||||
description=Upcoming stable release (DO NOT USE)
|
||||
branch_pmaports=v25.12
|
||||
branch_aports=master
|
||||
mirrordir_alpine=v3.23
|
||||
|
||||
[v25.06]
|
||||
description=Latest release / Recommended for best stability
|
||||
branch_pmaports=v25.06
|
||||
branch_aports=3.22-stable
|
||||
mirrordir_alpine=v3.22
|
||||
|
||||
[v24.12]
|
||||
description=Old release (unsupported)
|
||||
branch_pmaports=v24.12
|
||||
branch_aports=3.21-stable
|
||||
mirrordir_alpine=v3.21
|
||||
|
||||
[v24.06]
|
||||
description=Old release (unsupported)
|
||||
branch_pmaports=v24.06
|
||||
branch_aports=3.20-stable
|
||||
mirrordir_alpine=v3.20
|
||||
|
||||
[v23.12]
|
||||
description=Old release (unsupported)
|
||||
branch_pmaports=v23.12
|
||||
branch_aports=3.19-stable
|
||||
mirrordir_alpine=v3.19
|
||||
|
||||
[v23.06]
|
||||
description=Old release (unsupported)
|
||||
branch_pmaports=v23.06
|
||||
branch_aports=3.18-stable
|
||||
mirrordir_alpine=v3.18
|
||||
|
||||
[v22.12]
|
||||
description=Old release (unsupported)
|
||||
branch_pmaports=v22.12
|
||||
branch_aports=3.17-stable
|
||||
mirrordir_alpine=v3.17
|
||||
|
||||
[v22.06]
|
||||
description=Old release (unsupported)
|
||||
branch_pmaports=v22.06
|
||||
branch_aports=3.16-stable
|
||||
mirrordir_alpine=v3.16
|
||||
|
||||
[v21.12]
|
||||
description=Old release (unsupported)
|
||||
branch_pmaports=v21.12
|
||||
branch_aports=3.15-stable
|
||||
mirrordir_alpine=v3.15
|
||||
|
||||
[v21.06]
|
||||
description=Old release (unsupported)
|
||||
branch_pmaports=v21.06
|
||||
branch_aports=3.14-stable
|
||||
mirrordir_alpine=v3.14
|
||||
|
||||
[v21.03]
|
||||
description=Old release (unsupported)
|
||||
branch_pmaports=v21.03
|
||||
branch_aports=3.13-stable
|
||||
mirrordir_alpine=v3.13
|
||||
|
||||
[v20.05]
|
||||
description=Old release (unsupported)
|
||||
branch_pmaports=v20.05
|
||||
branch_aports=3.12-stable
|
||||
mirrordir_alpine=v3.12
|
||||
@@ -1,21 +0,0 @@
|
||||
cross-gcc-tests:
|
||||
extends: .package-test
|
||||
tags: [qemu]
|
||||
before_script:
|
||||
- wget "https://gitlab.postmarketos.org/postmarketOS/ci-common/-/raw/master/install_pmbootstrap.sh"
|
||||
- sh ./install_pmbootstrap.sh
|
||||
script:
|
||||
- su pmos -c "pmbootstrap build gcc-aarch64"
|
||||
- su pmos -c "pmbootstrap build --arch=aarch64 hello-world --force"
|
||||
- su pmos -c "pmbootstrap build --arch=aarch64 iskey --force"
|
||||
- su pmos -c "pmbootstrap build --arch=aarch64 pbsplash --force"
|
||||
- su pmos -c "pmbootstrap build --arch=aarch64 gcc-x86_64"
|
||||
rules:
|
||||
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
||||
changes:
|
||||
- cross/gcc-x86_64/APKBUILD
|
||||
artifacts:
|
||||
when: always
|
||||
paths:
|
||||
- log.txt
|
||||
expire_in: 1 week
|
||||
@@ -1,43 +0,0 @@
|
||||
# This package gets installed in the native and foreign arch chroots.
|
||||
# It creates files like /usr/lib/arch-bin-masquerade/armhf/gcc, which
|
||||
# point in the native chroot to the armhf-cross-compiler, and in the
|
||||
# armhf chroot to /usr/bin/gcc. That way compilation works fine, even
|
||||
# when distcc gets the absolute path to the compiler passed (ccache does
|
||||
# that).
|
||||
|
||||
pkgname=arch-bin-masquerade
|
||||
pkgver=2
|
||||
pkgrel=0
|
||||
pkgdesc="Wrappers for ccache + distcc (native and foreign chroots)"
|
||||
url="https://postmarketOS.org"
|
||||
arch="all"
|
||||
license="MIT"
|
||||
options="!check !tracedeps pmb:cross-native"
|
||||
|
||||
package() {
|
||||
# Architectures and binaries
|
||||
_archs="x86_64 armhf armv7 aarch64"
|
||||
_bins="c++ cc cpp g++ gcc"
|
||||
|
||||
# Iterate over architectures
|
||||
for _arch in $_archs; do
|
||||
# Create the arch-specific bin folder
|
||||
_hostspec="$(arch_to_hostspec $_arch)"
|
||||
_bindir="$pkgdir/usr/lib/arch-bin-masquerade/$_arch"
|
||||
mkdir -p "$_bindir"
|
||||
cd "$_bindir"
|
||||
|
||||
# Iterate over binaries and create wrappers
|
||||
for _bin in $_bins; do
|
||||
{
|
||||
echo "#!/bin/sh"
|
||||
if [ "$_arch" == "$CARCH" ]; then
|
||||
echo "exec /usr/bin/${_bin} \"\$@\""
|
||||
else
|
||||
echo "exec /usr/bin/${_hostspec}-${_bin} \"\$@\""
|
||||
fi
|
||||
} > "$_bin"
|
||||
chmod +x "$_bin"
|
||||
done
|
||||
done
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
# This package gets installed in the native chroot only. When cross-
|
||||
# compiling packages in the native chroot (e.g. kernel packages), the
|
||||
# cross-compiler does not get called directly, but wrapped through
|
||||
# ccache, which can then cache the results.
|
||||
|
||||
pkgname=ccache-cross-symlinks
|
||||
pkgver=3
|
||||
pkgrel=3
|
||||
pkgdesc="Enable ccache for cross-compilers with symlinks"
|
||||
url="https://ccache.samba.org/"
|
||||
arch="noarch"
|
||||
license="MIT"
|
||||
depends="ccache"
|
||||
options="!check"
|
||||
|
||||
package() {
|
||||
# Keep in sync with pmb.config.build_device_architectures
|
||||
local _archs="armhf armv7 aarch64 x86_64 x86 riscv64 ppc64le loongarch64"
|
||||
|
||||
local _bins="c++ cc cpp g++ gcc clang clang++"
|
||||
mkdir -p "$pkgdir/usr/lib/ccache/bin"
|
||||
cd "$pkgdir/usr/lib/ccache/bin"
|
||||
for _arch in $_archs; do
|
||||
if [ "$_arch" = "$CARCH" ]; then
|
||||
continue
|
||||
fi
|
||||
_hostspec="$(arch_to_hostspec $_arch)"
|
||||
for _bin in $_bins; do
|
||||
# Relative symlink, so it works with crossdirect (pointing to
|
||||
# /native/usr/bin/ccache)
|
||||
ln -v -s ../../../bin/ccache ${_hostspec}-${_bin}
|
||||
done
|
||||
|
||||
ln -v -s ../../../bin/ccache gcc4-${_hostspec}-gcc
|
||||
ln -v -s ../../../bin/ccache gcc6-${_hostspec}-gcc
|
||||
done
|
||||
|
||||
ln -v -s ../../../bin/ccache gcc4-gcc
|
||||
ln -v -s ../../../bin/ccache gcc6-gcc
|
||||
}
|
||||
@@ -1,135 +0,0 @@
|
||||
# Maintainer: Oliver Smith <ollieparanoid@postmarketos.org>
|
||||
# https://docs.postmarketos.org/pmbootstrap/cross_compiling.html
|
||||
#
|
||||
# Wrapper for the "crossdirect" compilation method.
|
||||
# pmbootstrap mounts the native chroot in the foreign arch (e.g. armhf) chroot
|
||||
# as /native. This package gets installed into the native chroot, and creates
|
||||
# wrappers like:
|
||||
#
|
||||
# /native/usr/lib/crossdirect/armhf/gcc
|
||||
# -> /native/usr/bin/armv6-alpine-linux-muslgnueabihf-gcc
|
||||
# /native/usr/lib/crossdirect/armhf/rustc
|
||||
# -> /native/usr/bin/rustc --target=armv6-alpine-linux-musleabihf ...
|
||||
#
|
||||
# When building packages in the armhf chroot, PATH will get prepended with
|
||||
# "/native/usr/lib/crossdirect/armhf". The end game is of course invoking
|
||||
# programs such as cross compilers and archivers from the native chroot,
|
||||
# running at native speed, whenever they get called from the foreign arch
|
||||
# chroot. See crossdirect.c for implementation details of the C version (llvm,
|
||||
# fakeroot, rpath). The rust version and redirect for archivers are implemented
|
||||
# as simple shell wrappers.
|
||||
|
||||
pkgname=crossdirect
|
||||
pkgver=5.3.1
|
||||
pkgrel=1
|
||||
pkgdesc="Wrappers to launch native programs (e.g. cross compilers) in foreign chroots"
|
||||
url="https://postmarketOS.org"
|
||||
arch="all"
|
||||
license="MIT"
|
||||
options="!check"
|
||||
source="
|
||||
cargo.sh
|
||||
crossdirect.c
|
||||
exec_native.sh
|
||||
rust-qemu-linker.sh
|
||||
rustc.sh
|
||||
"
|
||||
|
||||
build() {
|
||||
cd "$srcdir"
|
||||
# Architectures and binaries
|
||||
_archs="x86_64 armhf armv7 aarch64 loongarch64 ppc64le riscv64"
|
||||
for _arch in $_archs; do
|
||||
[ "$_arch" == "$CARCH" ] && continue
|
||||
_hostspec="$(arch_to_hostspec $_arch)"
|
||||
|
||||
# Build with -Werror, because we maintain this short program. (If
|
||||
# upstream is elsewhere, having -Werror is usually not desired.)
|
||||
$CC -o "crossdirect-$_arch" \
|
||||
-static \
|
||||
-Werror \
|
||||
-DHOSTSPEC="\"$_hostspec\"" \
|
||||
crossdirect.c
|
||||
done
|
||||
}
|
||||
|
||||
package() {
|
||||
# Architectures and binaries
|
||||
_archs="
|
||||
aarch64
|
||||
armhf
|
||||
armv7
|
||||
loongarch64
|
||||
ppc64le
|
||||
riscv64
|
||||
x86_64
|
||||
"
|
||||
_bin_compilers="
|
||||
c++
|
||||
cc
|
||||
clang
|
||||
clang++
|
||||
cpp
|
||||
g++
|
||||
gcc
|
||||
"
|
||||
_bin_archivers="
|
||||
bzip2
|
||||
gunzip
|
||||
gzip
|
||||
lzip
|
||||
lzma
|
||||
lzop
|
||||
pigz
|
||||
unlzma
|
||||
unpigz
|
||||
unxz
|
||||
unzip
|
||||
xz
|
||||
"
|
||||
|
||||
# Rust wrappers
|
||||
install -Dm755 "$srcdir/rust-qemu-linker.sh" \
|
||||
"$pkgdir/usr/lib/crossdirect/rust-qemu-linker"
|
||||
install -Dm755 "$srcdir/cargo.sh" "$pkgdir/usr/lib/crossdirect/cargo.sh"
|
||||
install -Dm755 "$srcdir/rustc.sh" "$pkgdir/usr/lib/crossdirect/rustc.sh"
|
||||
|
||||
# For archivers
|
||||
install -Dm755 "$srcdir/exec_native.sh" -t "$pkgdir/usr/lib/crossdirect/"
|
||||
|
||||
# Iterate over architectures
|
||||
for _arch in $_archs; do
|
||||
[ "$_arch" == "$CARCH" ] && continue
|
||||
|
||||
# GCC: put arch-specific crossdirect wrapper in arch-specific
|
||||
# bin folder
|
||||
_bindir="$pkgdir/usr/lib/crossdirect/$_arch"
|
||||
_hostspec="$(arch_to_hostspec $_arch)"
|
||||
mkdir -p "$_bindir"
|
||||
cd "$_bindir"
|
||||
cp "$srcdir/crossdirect-$_arch" "./"
|
||||
|
||||
# GCC: create compiler symlinks
|
||||
for _bin in $_bin_compilers; do
|
||||
ln -s "crossdirect-$_arch" "$_bin"
|
||||
ln -s "crossdirect-$_arch" "$_hostspec-$_bin"
|
||||
done
|
||||
|
||||
# Archivers
|
||||
for _bin in $_bin_archivers; do
|
||||
ln -s ../exec_native.sh "$_bin"
|
||||
done
|
||||
|
||||
# Rust
|
||||
ln -s ../cargo.sh cargo
|
||||
ln -s ../rustc.sh rustc
|
||||
done
|
||||
}
|
||||
|
||||
sha512sums="
|
||||
0f4b48f250425dc57f63955fc8b38477d23db793bee367c3fbe03c3d2a559ba576434d07518310db4cae9d90d501af4051b80038b10fae94b980e537fc9374ad cargo.sh
|
||||
b2e602b7fc95ed403d29f0d754879d5f773c39ee33e726bb10cff17b3c088406dac84f2ca6d8ad563c64370007d98af805d6ee9cd4a06fe3d4c61c0cb90c5c0c crossdirect.c
|
||||
73e2b5d2d8ef7c6002b3a787d14945586991493b8d81f59e5c0beda0d3b290543e1fdc6f288da726c5dd121c0861d2a894410b7b749a537df0df5b409e102330 exec_native.sh
|
||||
ea9bf8db3810d03d0a7395057f3d6e57f7127d87c55deaedc171c255288f5f3cc6fbcc680a5a1b92786cf573875d5dc22521173799fe2639acc97d0715ff905b rust-qemu-linker.sh
|
||||
de2aa6929bbff5db9132673e667f4525b333d062cb1f7a0597dd924de9e5c7215a9f8e2e6263b6fb5ace06f2c4b64f4ebfd0ede9b78add07c2cd08ec8613e98f rustc.sh
|
||||
"
|
||||
@@ -1,66 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
if [ -n "$CROSSDIRECT_DEBUG" ]; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
native_version=$(LD_LIBRARY_PATH=/native/lib:/native/usr/lib /native/usr/bin/rustc -V)
|
||||
target_version=$(/usr/bin/rustc -V)
|
||||
|
||||
if [ "$target_version" != "$native_version" ]; then
|
||||
echo "ERROR: crossdirect: rustc version mismatch between native and build chroot. Please update your chroots and try again." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
triplet=$(/usr/bin/rustc -vV | sed -n 's/host: //p')
|
||||
cmd=$1
|
||||
shift
|
||||
|
||||
case "$cmd" in
|
||||
build|test|run)
|
||||
;;
|
||||
*)
|
||||
echo "WARNING: crossdirect: 'cargo $cmd $*' command not supported, running in QEMU (slow!)" >&2
|
||||
export PATH="$(echo "$PATH" | sed 's,/native/usr/lib/crossdirect/[^:]*:,,')"
|
||||
exec /usr/bin/cargo "$cmd" "$@"
|
||||
;;
|
||||
esac
|
||||
|
||||
target_dir=${CARGO_TARGET_DIR:-target}
|
||||
target_already_specified=${CARGO_BUILD_TARGET:+1}
|
||||
|
||||
if [ -z "$target_specified" ]; then
|
||||
for arg in "$@"; do
|
||||
if [ "$arg_target_dir" = 1 ]; then
|
||||
target_dir=$arg
|
||||
arg_target_dir=0
|
||||
fi
|
||||
case "$arg" in
|
||||
--target|--target=*)
|
||||
target_already_specified=1
|
||||
break
|
||||
;;
|
||||
--target-dir)
|
||||
arg_target_dir=1
|
||||
;;
|
||||
--target-dir=*)
|
||||
target_dir=${arg##--target-dir=}
|
||||
;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -n "$target_already_specified" ]; then
|
||||
exec /usr/bin/cargo "$cmd" "$@"
|
||||
fi
|
||||
|
||||
/usr/bin/cargo "$cmd" --target=$triplet "$@"
|
||||
|
||||
# copy target/$triplet/{release,debug,...} to target/{release,debug,...}
|
||||
if [ -d "$target_dir/$triplet" ]; then
|
||||
for dir in "$target_dir/$triplet"/*/; do
|
||||
build=$(basename "$dir")
|
||||
rm -rf "$target_dir/$build"
|
||||
cp -r "$target_dir/$triplet/$build" "$target_dir/$build"
|
||||
done
|
||||
fi
|
||||
@@ -1,141 +0,0 @@
|
||||
/* Copyright 2020 Zhuowei Zhang, Oliver Smith
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*
|
||||
* This program gets built to a set of wrapper executables, which launch native
|
||||
* cross compilers inside foreign arch chroots. Speeds up cross compilation a
|
||||
* lot, compared to using just qemu user mode emulation or using the previous
|
||||
* distcc-based methods.
|
||||
*
|
||||
* How this program gets called:
|
||||
* - pmbootstrap creates one native arch chroot and one foreign arch chroot.
|
||||
* - The native chroot gets mounted as /native in the foreign chroot.
|
||||
* - When calling "abuild", pmbootstrap sets PATH to:
|
||||
* /native/usr/lib/crossdirect/<ARCH>:$PATH
|
||||
* - That crossdirect directory contains a crossdirect-<ARCH> binary built with
|
||||
* the matching HOSTSPEC (e.g. crossdirect-aarch64 binary with HOSTSPEC
|
||||
* aarch64-alpine-linux-musl). This binary is symlinked to:
|
||||
* - <HOSTSPEC>-c++
|
||||
* - <HOSTSPEC>-cc
|
||||
* - <HOSTSPEC>-clang
|
||||
* - <HOSTSPEC>-clang++
|
||||
* - <HOSTSPEC>-cpp
|
||||
* - <HOSTSPEC>-g++
|
||||
* - <HOSTSPEC>-gcc
|
||||
* - c++
|
||||
* - cc
|
||||
* - clang
|
||||
* - clang++
|
||||
* - cpp
|
||||
* - g++
|
||||
* - gcc
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <libgen.h>
|
||||
#include <limits.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define NATIVE_BIN_DIR "/native/usr/lib/ccache/bin"
|
||||
|
||||
void exit_userfriendly()
|
||||
{
|
||||
fprintf(stderr, "Please report this at: https://gitlab.postmarketos.org/postmarketOS/pmaports/issues\n");
|
||||
fprintf(stderr, "As a workaround, you can compile without crossdirect with options=\"!pmb:crossdirect\".\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
bool argv_has_arg(int argc, char **argv, const char *arg)
|
||||
{
|
||||
size_t arg_len = strlen(arg);
|
||||
|
||||
for (int i = 1; i < argc; i++) {
|
||||
if (strlen(argv[i]) < arg_len)
|
||||
continue;
|
||||
|
||||
if (!memcmp(argv[i], arg, arg_len))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
// we have a max of four extra args ("-target", "HOSTSPEC", "--sysroot=/", "-Wl,-rpath-link=/lib:/usr/lib"), plus one ending null
|
||||
char *newargv[argc + 5];
|
||||
char *executableName = basename(argv[0]);
|
||||
char newExecutable[PATH_MAX];
|
||||
bool isClang = (strcmp(executableName, "clang") == 0 || strcmp(executableName, "clang++") == 0);
|
||||
bool startsWithHostSpec = (strncmp(HOSTSPEC, executableName, sizeof(HOSTSPEC) - 1) == 0);
|
||||
|
||||
// linker is involved: just use qemu binary (to avoid broken cross-ld, pmaports#227)
|
||||
if (!argv_has_arg(argc, argv, "-c")) {
|
||||
snprintf(newExecutable, sizeof(newExecutable), "/usr/bin/%s", executableName);
|
||||
if (execv(newExecutable, argv) == -1) {
|
||||
fprintf(stderr, "ERROR: crossdirect: failed to execute %s: %s\n", newExecutable, strerror(errno));
|
||||
fprintf(stderr, "NOTE: this is a foreign arch binary that would run with qemu (linker is involved).\n");
|
||||
exit_userfriendly();
|
||||
}
|
||||
}
|
||||
|
||||
// Translate "cc" to "gcc": /usr/bin/cc is a symlink to /usr/bin/gcc,
|
||||
// but there is no <HOSTSPEC>-cc symlink (pmaports#732)
|
||||
if (strcmp(executableName, "cc") == 0)
|
||||
executableName = "gcc";
|
||||
|
||||
// prepend the HOSTSPEC to GCC binaries
|
||||
if (isClang || startsWithHostSpec) {
|
||||
snprintf(newExecutable, sizeof(newExecutable), NATIVE_BIN_DIR "/%s", executableName);
|
||||
} else {
|
||||
snprintf(newExecutable, sizeof(newExecutable), NATIVE_BIN_DIR "/" HOSTSPEC "-%s", executableName);
|
||||
}
|
||||
|
||||
// prepare new arguments for GCC / clang
|
||||
char **newArgsPtr = newargv;
|
||||
*newArgsPtr++ = newExecutable;
|
||||
if (isClang) {
|
||||
// clang does not use a HOSTSPEC prefix for the cross compiler
|
||||
// binary, but instead have a -target argument
|
||||
*newArgsPtr++ = "-target";
|
||||
*newArgsPtr++ = HOSTSPEC;
|
||||
}
|
||||
*newArgsPtr++ = "--sysroot=/";
|
||||
|
||||
// add all arguments passed to this executable to GCC / clang and set
|
||||
// the last arg in newargv to NULL to mark its end
|
||||
memcpy(newArgsPtr, argv + 1, sizeof(char *) * (argc - 1));
|
||||
newArgsPtr += (argc - 1);
|
||||
*newArgsPtr = NULL;
|
||||
|
||||
// new arguments prepared; now setup environmental vars
|
||||
char *env[] = { "LD_PRELOAD=",
|
||||
"LD_LIBRARY_PATH=/native/lib:/native/usr/lib",
|
||||
"CCACHE_PATH=/native/usr/bin",
|
||||
NULL };
|
||||
char *ldPreload = getenv("LD_PRELOAD");
|
||||
if (ldPreload) {
|
||||
if (strstr(ldPreload, "libfakeroot.so")) {
|
||||
fprintf(stderr, "============================================================================================\n");
|
||||
fprintf(stderr, "ERROR: crossdirect was called with: LD_PRELOAD=%s\n", ldPreload);
|
||||
fprintf(stderr, "This means your package tried to run a compiler during package().\n");
|
||||
fprintf(stderr, "This is not supported by crossdirect, and usually not a good idea.\n");
|
||||
fprintf(stderr, "* Try to fix your APKBUILD so it does not run the compiler during package(), only in build()\n");
|
||||
fprintf(stderr, " * If you're using 'meson install', try to add '--no-rebuild'\n");
|
||||
fprintf(stderr, "* If this is not possible, you can work around it by setting options=\"!pmb:crossdirect\"\n");
|
||||
fprintf(stderr, " (compilation will be slower!)\n");
|
||||
fprintf(stderr, "============================================================================================\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
// finally exec GCC / clang
|
||||
if (execve(newExecutable, newargv, env) == -1) {
|
||||
fprintf(stderr, "ERROR: crossdirect: failed to execute %s: %s\n", newExecutable, strerror(errno));
|
||||
fprintf(stderr, "Maybe the target arch is missing in the ccache-cross-symlinks package?\n");
|
||||
exit_userfriendly();
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
# Execute the binary from the native chroot if it is installed there. This is
|
||||
# done for archiver tools such as unxz, so they don't need to go through QEMU.
|
||||
BASENAME="$(basename "$0")"
|
||||
|
||||
if [ -n "$LD_PRELOAD" ]; then
|
||||
# The archiver tool gets called during package(), which abuild runs
|
||||
# with libfakeroot.so. Some packages do this, like bootchart2, which
|
||||
# compresses man pages in its "make install". We can't run the native
|
||||
# binary here due to the LD_PRELOAD, so run the foreign arch one.
|
||||
export PATH="/usr/bin:/usr/sbin:/sbin:/bin"
|
||||
exec "$BASENAME" "$@"
|
||||
fi
|
||||
|
||||
# Try /native first, then the foreign arch paths. Never try
|
||||
# /native/usr/lib/crossdirect as this would result in a loop.
|
||||
UNWRAPPED_PATH="/native/usr/bin:/native/usr/sbin:/native/sbin:/native/bin:/usr/bin:/usr/sbin:/sbin:/bin"
|
||||
UNWRAPPED_BIN="$(PATH="$UNWRAPPED_PATH" command -v "$BASENAME")"
|
||||
|
||||
case "$UNWRAPPED_BIN" in
|
||||
/native/*)
|
||||
export LD_LIBRARY_PATH="/native/usr/lib:/native/lib"
|
||||
export PATH="$UNWRAPPED_PATH"
|
||||
;;
|
||||
esac
|
||||
|
||||
exec "$UNWRAPPED_BIN" "$@"
|
||||
@@ -1,8 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
# This wrapper gets called from the native rustc, and runs the qemu gcc for
|
||||
# linking, with LD_LIBRARY_PATH reset so it does not point to /native anymore.
|
||||
# It isn't possible to use the native cross compiler's linker with crossdirect
|
||||
# currently (pmaports#233).
|
||||
|
||||
LD_LIBRARY_PATH=/lib:/usr/lib \
|
||||
gcc "$@"
|
||||
@@ -1,38 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
if [ -n "$CROSSDIRECT_DEBUG" ]; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
# return the correct host architecture when cargo requests it
|
||||
if [ "$*" = "-vV" ] || [ "$*" = "-V" ]; then
|
||||
exec /usr/bin/rustc "$*"
|
||||
fi
|
||||
|
||||
# pmbootstrap installs sccache when building a rust program, unless --no-ccache
|
||||
# is set. In that case it also sets CCACHE_DISABLE.
|
||||
SCCACHE=/native/usr/bin/sccache
|
||||
if ! [ -e "$SCCACHE" ] || [ -n "$CCACHE_DISABLE" ]; then
|
||||
SCCACHE=""
|
||||
fi
|
||||
|
||||
# We expect the right target to be set in the arguments if compiling for the
|
||||
# target architecture. Our cargo wrapper passes the right "--target" argument
|
||||
# automatically. If no target is provided, this is probably a macro or a
|
||||
# build script, so it should be compiled for the native architecture.
|
||||
if echo "$*" | grep -qFe "--target"; then
|
||||
# Not using sccache when building for foreign architecture, as it
|
||||
# doesn't cache the output with "Non-cacheable reasons: --sysroot"
|
||||
LD_LIBRARY_PATH=/native/lib:/native/usr/lib \
|
||||
/native/usr/bin/rustc \
|
||||
-Clinker=/native/usr/lib/crossdirect/rust-qemu-linker \
|
||||
--sysroot=/usr \
|
||||
"$@"
|
||||
else
|
||||
PATH=/native/usr/bin:/native/bin \
|
||||
LD_LIBRARY_PATH=/native/lib:/native/usr/lib \
|
||||
$SCCACHE \
|
||||
/native/usr/bin/rustc \
|
||||
-Clink-arg=-Wl,-rpath,/native/lib:/native/usr/lib \
|
||||
"$@"
|
||||
fi
|
||||
@@ -1,130 +0,0 @@
|
||||
From 824eae920f0f64dd7687c969a2436b129161fdc9 Mon Sep 17 00:00:00 2001
|
||||
From: Jinyang He <hejinyang@loongson.cn>
|
||||
Date: Wed, 29 Oct 2025 16:07:35 +0800
|
||||
Subject: [PATCH] LoongArch: Only allow valid binary op when optimize
|
||||
conditional move
|
||||
|
||||
It is wrong that optimize from `if (cond) dest op= 1 << shift` to
|
||||
`dest op= (cond ? 1 : 0) << shift` when `dest op 0 != dest`.
|
||||
Like `and`, `mul` or `div`.
|
||||
And in this optimization `mul` and `div` is optimized to shift.
|
||||
|
||||
gcc/ChangeLog:
|
||||
|
||||
* config/loongarch/loongarch.cc
|
||||
(loongarch_expand_conditional_move): Only allow valid binary
|
||||
op when optimize conditional move.
|
||||
|
||||
gcc/testsuite/ChangeLog:
|
||||
|
||||
* gcc.target/loongarch/conditional-move-opt-1.c: Remove mul.
|
||||
* gcc.target/loongarch/conditional-move-opt-2.c: Remove and.
|
||||
* gcc.target/loongarch/conditional-move-opt-3.c: New test.
|
||||
|
||||
Co-Authored-By: Peng Fan <fanpeng@loongson.cn>
|
||||
---
|
||||
gcc/config/loongarch/loongarch.cc | 26 ++++++++++++++++---
|
||||
.../loongarch/conditional-move-opt-1.c | 4 +--
|
||||
.../loongarch/conditional-move-opt-2.c | 2 +-
|
||||
.../loongarch/conditional-move-opt-3.c | 14 ++++++++++
|
||||
4 files changed, 40 insertions(+), 6 deletions(-)
|
||||
create mode 100644 gcc/testsuite/gcc.target/loongarch/conditional-move-opt-3.c
|
||||
|
||||
diff --git a/gcc/config/loongarch/loongarch.cc b/gcc/config/loongarch/loongarch.cc
|
||||
index bdf290654..740c8611a 100644
|
||||
--- a/gcc/config/loongarch/loongarch.cc
|
||||
+++ b/gcc/config/loongarch/loongarch.cc
|
||||
@@ -5533,12 +5533,32 @@ loongarch_expand_conditional_move (rtx *operands)
|
||||
}
|
||||
}
|
||||
|
||||
+ auto is_binary_op_0_keep_orig = [](enum rtx_code code)
|
||||
+ {
|
||||
+ switch (code)
|
||||
+ {
|
||||
+ case PLUS:
|
||||
+ case MINUS:
|
||||
+ case IOR:
|
||||
+ case XOR:
|
||||
+ case ROTATE:
|
||||
+ case ROTATERT:
|
||||
+ case ASHIFT:
|
||||
+ case ASHIFTRT:
|
||||
+ case LSHIFTRT:
|
||||
+ return true;
|
||||
+ default:
|
||||
+ return false;
|
||||
+ }
|
||||
+ };
|
||||
+
|
||||
/* Check if the optimization conditions are met. */
|
||||
if (value_if_true_insn
|
||||
&& value_if_false_insn
|
||||
- /* Make sure that value_if_false and var are the same. */
|
||||
- && BINARY_P (value_if_true_insn_src
|
||||
- = SET_SRC (single_set (value_if_true_insn)))
|
||||
+ /* Make sure that the orig value OP 0 keep orig. */
|
||||
+ && (value_if_true_insn_src
|
||||
+ = SET_SRC (single_set (value_if_true_insn)))
|
||||
+ && is_binary_op_0_keep_orig ( GET_CODE (value_if_true_insn_src))
|
||||
/* Make sure that both value_if_true and value_if_false
|
||||
has the same var. */
|
||||
&& rtx_equal_p (XEXP (value_if_true_insn_src, 0),
|
||||
diff --git a/gcc/testsuite/gcc.target/loongarch/conditional-move-opt-1.c b/gcc/testsuite/gcc.target/loongarch/conditional-move-opt-1.c
|
||||
index ed13471aa..47802aa96 100644
|
||||
--- a/gcc/testsuite/gcc.target/loongarch/conditional-move-opt-1.c
|
||||
+++ b/gcc/testsuite/gcc.target/loongarch/conditional-move-opt-1.c
|
||||
@@ -27,7 +27,7 @@ void
|
||||
test_lt ()
|
||||
{
|
||||
if (lm < ln)
|
||||
- lr *= (1 << 16);
|
||||
+ lr += (1 << 16);
|
||||
lr += lm;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ void
|
||||
test_le ()
|
||||
{
|
||||
if (lm <= ln)
|
||||
- lr = lm * ((long)1 << 32);
|
||||
+ lr = lm + ((long)1 << 32);
|
||||
else
|
||||
lr = lm;
|
||||
lr += lm;
|
||||
diff --git a/gcc/testsuite/gcc.target/loongarch/conditional-move-opt-2.c b/gcc/testsuite/gcc.target/loongarch/conditional-move-opt-2.c
|
||||
index ac72d4d93..743fd5e67 100644
|
||||
--- a/gcc/testsuite/gcc.target/loongarch/conditional-move-opt-2.c
|
||||
+++ b/gcc/testsuite/gcc.target/loongarch/conditional-move-opt-2.c
|
||||
@@ -29,7 +29,7 @@ void
|
||||
test_lez ()
|
||||
{
|
||||
if (lm <= 0)
|
||||
- lr &= (1 << 16);
|
||||
+ lr |= (1 << 16);
|
||||
lr += lm;
|
||||
}
|
||||
|
||||
diff --git a/gcc/testsuite/gcc.target/loongarch/conditional-move-opt-3.c b/gcc/testsuite/gcc.target/loongarch/conditional-move-opt-3.c
|
||||
new file mode 100644
|
||||
index 000000000..95887980c
|
||||
--- /dev/null
|
||||
+++ b/gcc/testsuite/gcc.target/loongarch/conditional-move-opt-3.c
|
||||
@@ -0,0 +1,14 @@
|
||||
+/* { dg-do compile } */
|
||||
+/* { dg-options "-O2" } */
|
||||
+/* { dg-final { scan-assembler "maskeqz" } } */
|
||||
+/* { dg-final { scan-assembler "masknez" } } */
|
||||
+
|
||||
+extern long lm, ln, lr;
|
||||
+
|
||||
+void
|
||||
+test_and ()
|
||||
+{
|
||||
+ if (lm < 0)
|
||||
+ lr &= (1 << 16);
|
||||
+ lr += lm;
|
||||
+}
|
||||
--
|
||||
2.51.1
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
From 94cf7d2b3514ed3a4401861a519ead450e022afc Mon Sep 17 00:00:00 2001
|
||||
From: Szabolcs Nagy <nsz@port70.net>
|
||||
Date: Fri, 26 Jan 2018 20:32:50 +0000
|
||||
Subject: [PATCH] posix_memalign
|
||||
|
||||
---
|
||||
gcc/config/i386/pmm_malloc.h | 9 +++++----
|
||||
1 file changed, 5 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/gcc/config/i386/pmm_malloc.h b/gcc/config/i386/pmm_malloc.h
|
||||
index d1d79a32fc9..069c3bb8324 100644
|
||||
--- a/gcc/config/i386/pmm_malloc.h
|
||||
+++ b/gcc/config/i386/pmm_malloc.h
|
||||
@@ -27,12 +27,13 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
/* We can't depend on <stdlib.h> since the prototype of posix_memalign
|
||||
- may not be visible. */
|
||||
+ may not be visible and we can't pollute the namespace either. */
|
||||
#ifndef __cplusplus
|
||||
-extern int posix_memalign (void **, size_t, size_t);
|
||||
+extern int _mm_posix_memalign (void **, size_t, size_t)
|
||||
#else
|
||||
-extern "C" int posix_memalign (void **, size_t, size_t) throw ();
|
||||
+extern "C" int _mm_posix_memalign (void **, size_t, size_t) throw ()
|
||||
#endif
|
||||
+__asm__("posix_memalign");
|
||||
|
||||
static __inline void *
|
||||
_mm_malloc (size_t __size, size_t __alignment)
|
||||
@@ -42,7 +43,7 @@ _mm_malloc (size_t __size, size_t __alignment)
|
||||
return malloc (__size);
|
||||
if (__alignment == 2 || (sizeof (void *) == 8 && __alignment == 4))
|
||||
__alignment = sizeof (void *);
|
||||
- if (posix_memalign (&__ptr, __alignment, __size) == 0)
|
||||
+ if (_mm_posix_memalign (&__ptr, __alignment, __size) == 0)
|
||||
return __ptr;
|
||||
else
|
||||
return NULL;
|
||||
--
|
||||
2.50.1
|
||||
|
||||
@@ -1,77 +0,0 @@
|
||||
From 21b7d08714c4964403848db4144003835ff5245a Mon Sep 17 00:00:00 2001
|
||||
From: Linsen Zhou <i@lin.moe>
|
||||
Date: Fri, 17 Oct 2025 11:05:04 +0800
|
||||
Subject: [PATCH] tree-object-size.cc: Fix assert constant offset in
|
||||
check_for_plus_in_loops [PR122012]
|
||||
|
||||
After commit 51b85dfeb19652bf3e0aaec08828ba7cee1e641c, when the
|
||||
pointer offset is a variable in the loop, the object size of the
|
||||
pointer may also need to be reexamined.
|
||||
Which make gcc_assert in the check_for_plus_in_loops failed.
|
||||
|
||||
gcc/ChangeLog:
|
||||
|
||||
PR tree-optimization/122012
|
||||
* tree-object-size.cc (check_for_plus_in_loops): Skip check
|
||||
for the variable offset
|
||||
|
||||
gcc/testsuite/ChangeLog:
|
||||
|
||||
PR tree-optimization/122012
|
||||
* gcc.dg/torture/pr122012.c: New test.
|
||||
|
||||
Signed-off-by: Linsen Zhou <i@lin.moe>
|
||||
(cherry picked from commit 82cefc4898d4ccabe76e28d6626b91ca9e998923)
|
||||
---
|
||||
gcc/testsuite/gcc.dg/torture/pr122012.c | 18 ++++++++++++++++++
|
||||
gcc/tree-object-size.cc | 7 +++----
|
||||
2 files changed, 21 insertions(+), 4 deletions(-)
|
||||
create mode 100644 gcc/testsuite/gcc.dg/torture/pr122012.c
|
||||
|
||||
diff --git a/gcc/testsuite/gcc.dg/torture/pr122012.c b/gcc/testsuite/gcc.dg/torture/pr122012.c
|
||||
new file mode 100644
|
||||
index 00000000000..055915a1e98
|
||||
--- /dev/null
|
||||
+++ b/gcc/testsuite/gcc.dg/torture/pr122012.c
|
||||
@@ -0,0 +1,18 @@
|
||||
+/* { dg-do compile } */
|
||||
+#include <stdlib.h>
|
||||
+
|
||||
+void foo();
|
||||
+
|
||||
+void test(size_t step) {
|
||||
+ char *buf = malloc(64);
|
||||
+ char *p = buf;
|
||||
+ size_t i;
|
||||
+
|
||||
+ for(i = 0; i < 64; ++i) {
|
||||
+ p += 4;
|
||||
+ if (__builtin_object_size (p, 2) != 0)
|
||||
+ foo();
|
||||
+ p += step;
|
||||
+ }
|
||||
+ free(buf);
|
||||
+}
|
||||
diff --git a/gcc/tree-object-size.cc b/gcc/tree-object-size.cc
|
||||
index 2d13ab79a84..76dc2446059 100644
|
||||
--- a/gcc/tree-object-size.cc
|
||||
+++ b/gcc/tree-object-size.cc
|
||||
@@ -2153,12 +2153,11 @@ check_for_plus_in_loops (struct object_size_info *osi, tree var)
|
||||
&& gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR)
|
||||
{
|
||||
tree basevar = gimple_assign_rhs1 (stmt);
|
||||
- tree cst = gimple_assign_rhs2 (stmt);
|
||||
-
|
||||
- gcc_assert (TREE_CODE (cst) == INTEGER_CST);
|
||||
+ tree offset = gimple_assign_rhs2 (stmt);
|
||||
|
||||
/* Skip non-positive offsets. */
|
||||
- if (integer_zerop (cst) || compare_tree_int (cst, offset_limit) > 0)
|
||||
+ if (TREE_CODE (offset) != INTEGER_CST
|
||||
+ || integer_zerop (offset) || compare_tree_int (offset, offset_limit) > 0)
|
||||
return;
|
||||
|
||||
osi->depths[SSA_NAME_VERSION (basevar)] = 1;
|
||||
--
|
||||
2.51.0
|
||||
|
||||
@@ -1,258 +0,0 @@
|
||||
From 0d5e04099a3d2609105719f7396a4ff941b873b6 Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Thu, 23 Jan 2025 17:12:51 -0800
|
||||
Subject: [PATCH] gcc: poison-system-directories
|
||||
|
||||
Add /sw/include and /opt/include based on the original
|
||||
zecke-no-host-includes.patch patch. The original patch checked for
|
||||
/usr/include, /sw/include and /opt/include and then triggered a failure and
|
||||
aborted.
|
||||
|
||||
Instead, we add the two missing items to the current scan. If the user
|
||||
wants this to be a failure, they can add "-Werror=poison-system-directories".
|
||||
|
||||
Upstream-Status: Inappropriate [OE configuration]
|
||||
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
|
||||
Signed-off-by: sunil dora <sunilkumar.dora@windriver.com>
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
---
|
||||
gcc/common.opt | 4 ++++
|
||||
gcc/config.in | 10 ++++++++++
|
||||
gcc/configure | 19 +++++++++++++++++++
|
||||
gcc/configure.ac | 16 ++++++++++++++++
|
||||
gcc/doc/invoke.texi | 9 +++++++++
|
||||
gcc/gcc.cc | 12 ++++++++++--
|
||||
gcc/incpath.cc | 25 +++++++++++++++++++++++++
|
||||
7 files changed, 93 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/gcc/common.opt b/gcc/common.opt
|
||||
index e3fa0dacec4..bea1adc0940 100644
|
||||
--- a/gcc/common.opt
|
||||
+++ b/gcc/common.opt
|
||||
@@ -729,6 +729,10 @@ Wreturn-local-addr
|
||||
Common Var(warn_return_local_addr) Init(1) Warning
|
||||
Warn about returning a pointer/reference to a local or temporary variable.
|
||||
|
||||
+Wpoison-system-directories
|
||||
+Common Var(flag_poison_system_directories) Init(1) Warning
|
||||
+Warn for -I and -L options using system directories if cross compiling
|
||||
+
|
||||
Wshadow
|
||||
Common Var(warn_shadow) Warning
|
||||
Warn when one variable shadows another. Same as -Wshadow=global.
|
||||
diff --git a/gcc/config.in b/gcc/config.in
|
||||
index a79c51adb2b..8a531ed591c 100644
|
||||
--- a/gcc/config.in
|
||||
+++ b/gcc/config.in
|
||||
@@ -249,6 +249,16 @@
|
||||
#endif
|
||||
|
||||
|
||||
+/* Define to warn for use of native system header directories */
|
||||
+#ifndef USED_FOR_TARGET
|
||||
+#undef ENABLE_POISON_SYSTEM_DIRECTORIES
|
||||
+#endif
|
||||
+/* Define to warn for use of native system header directories */
|
||||
+#ifndef USED_FOR_TARGET
|
||||
+#undef POISON_BY_DEFAULT
|
||||
+#endif
|
||||
+
|
||||
+
|
||||
/* Define if you want all operations on RTL (the basic data structure of the
|
||||
optimizer and back end) to be checked for dynamic type safety at runtime.
|
||||
This is quite expensive. */
|
||||
diff --git a/gcc/configure b/gcc/configure
|
||||
index 16965953f05..0f4a5d52c30 100755
|
||||
--- a/gcc/configure
|
||||
+++ b/gcc/configure
|
||||
@@ -1051,6 +1051,7 @@ enable_maintainer_mode
|
||||
enable_link_mutex
|
||||
enable_link_serialization
|
||||
enable_version_specific_runtime_libs
|
||||
+enable_poison_system_directories
|
||||
enable_plugin
|
||||
enable_host_shared
|
||||
enable_host_pie
|
||||
@@ -1828,6 +1829,8 @@ Optional Features:
|
||||
--enable-version-specific-runtime-libs
|
||||
specify that runtime libraries should be installed
|
||||
in a compiler-specific directory
|
||||
+ --enable-poison-system-directories
|
||||
+ warn for use of native system header directories
|
||||
--enable-plugin enable plugin support
|
||||
--enable-host-shared build host code as shared libraries
|
||||
--enable-host-pie build host code as PIE
|
||||
@@ -34027,6 +34030,22 @@ if test "${enable_version_specific_runtime_libs+set}" = set; then :
|
||||
fi
|
||||
|
||||
|
||||
+# Check whether --enable-poison-system-directories was given.
|
||||
+if test "${enable_poison_system_directories+set}" = set; then :
|
||||
+ enableval=$enable_poison_system_directories;
|
||||
+else
|
||||
+ enable_poison_system_directories=no
|
||||
+fi
|
||||
+
|
||||
+if test "x${enable_poison_system_directories}" != "xno"; then
|
||||
+
|
||||
+$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h
|
||||
+if test "$enable_poison_system_directories" = "error"; then
|
||||
+$as_echo "#define POISON_BY_DEFAULT 1" >>confdefs.h
|
||||
+fi
|
||||
+
|
||||
+fi
|
||||
+
|
||||
# Substitute configuration variables
|
||||
|
||||
|
||||
diff --git a/gcc/configure.ac b/gcc/configure.ac
|
||||
index 9f67e62950a..b0e3615e5aa 100644
|
||||
--- a/gcc/configure.ac
|
||||
+++ b/gcc/configure.ac
|
||||
@@ -7502,6 +7502,22 @@ AC_ARG_ENABLE(version-specific-runtime-libs,
|
||||
[specify that runtime libraries should be
|
||||
installed in a compiler-specific directory])])
|
||||
|
||||
+AC_ARG_ENABLE([poison-system-directories],
|
||||
+ AS_HELP_STRING([--enable-poison-system-directories],
|
||||
+ [warn for use of native system header directories (no/yes/error)]),,
|
||||
+ [enable_poison_system_directories=no])
|
||||
+AC_MSG_NOTICE([poisoned directories $enable_poison_system_directories])
|
||||
+if test "x${enable_poison_system_directories}" != "xno"; then
|
||||
+ AC_MSG_NOTICE([poisoned directories enabled])
|
||||
+ AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES],
|
||||
+ [1],
|
||||
+ [Define to warn for use of native system header directories])
|
||||
+ if test $enable_poison_system_directories = "error"; then
|
||||
+ AC_MSG_NOTICE([poisoned directories are fatal])
|
||||
+ AC_DEFINE([POISON_BY_DEFAULT], [1], [Define to make poison warnings errors])
|
||||
+ fi
|
||||
+fi
|
||||
+
|
||||
# Substitute configuration variables
|
||||
AC_SUBST(subdirs)
|
||||
AC_SUBST(srcdir)
|
||||
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
|
||||
index 72009c33cd0..29aea724731 100644
|
||||
--- a/gcc/doc/invoke.texi
|
||||
+++ b/gcc/doc/invoke.texi
|
||||
@@ -405,6 +405,7 @@ Objective-C and Objective-C++ Dialects}.
|
||||
-Wpacked -Wno-packed-bitfield-compat -Wpacked-not-aligned -Wpadded
|
||||
-Wparentheses -Wno-pedantic-ms-format
|
||||
-Wpointer-arith -Wno-pointer-compare -Wno-pointer-to-int-cast
|
||||
+-Wno-poison-system-directories
|
||||
-Wno-pragmas -Wno-pragma-once-outside-header -Wno-prio-ctor-dtor
|
||||
-Wno-psabi
|
||||
-Wredundant-decls -Wrestrict
|
||||
@@ -10727,6 +10728,14 @@ an error. @option{Wint-to-pointer-cast} is enabled by default.
|
||||
Suppress warnings from casts from a pointer to an integer type of a
|
||||
different size.
|
||||
|
||||
+@opindex Wno-poison-system-directories
|
||||
+@item -Wno-poison-system-directories
|
||||
+Do not warn for @option{-I} or @option{-L} options using system
|
||||
+directories such as @file{/usr/include} when cross compiling. This
|
||||
+option is intended for use in chroot environments when such
|
||||
+directories contain the correct headers and libraries for the target
|
||||
+system rather than the host.
|
||||
+
|
||||
@opindex Winvalid-pch
|
||||
@opindex Wno-invalid-pch
|
||||
@item -Winvalid-pch
|
||||
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
|
||||
index 4fd87f2c4a1..79d4920a047 100644
|
||||
--- a/gcc/gcc.cc
|
||||
+++ b/gcc/gcc.cc
|
||||
@@ -909,6 +909,12 @@ proper position among the other output files. */
|
||||
#define ASM_MAP ""
|
||||
#endif
|
||||
|
||||
+#ifdef POISON_BY_DEFAULT
|
||||
+#define POISON_IS_ERROR " -Werror=poison-system-directories"
|
||||
+#else
|
||||
+#define POISON_IS_ERROR
|
||||
+#endif
|
||||
+
|
||||
/* Assembler options for compressed debug sections. */
|
||||
#if HAVE_LD_COMPRESS_DEBUG == 0
|
||||
/* Reject if the linker cannot write compressed debug sections. */
|
||||
@@ -1166,6 +1172,8 @@ proper position among the other output files. */
|
||||
"%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \
|
||||
"%X %{o*} %{e*} %{N} %{n} %{r}\
|
||||
%{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!r:%{!nostartfiles:%S}}} \
|
||||
+ %{Wno-poison-system-directories:--no-poison-system-directories} \
|
||||
+ %{Werror=poison-system-directories:--error-poison-system-directories} \
|
||||
%{static|no-pie|static-pie:} %@{L*} %(link_libgcc) " \
|
||||
VTABLE_VERIFICATION_SPEC " " SANITIZER_EARLY_SPEC " %o "" \
|
||||
%{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
|
||||
@@ -1268,7 +1276,7 @@ static const char *cpp_options =
|
||||
"%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w}\
|
||||
%{f*} %{g*:%{%:debug-level-gt(0):%{g*}\
|
||||
%{!fno-working-directory:-fworking-directory}}} %{O*}\
|
||||
- %{undef} %{save-temps*:-fpch-preprocess}";
|
||||
+ %{undef} %{save-temps*:-fpch-preprocess}" POISON_IS_ERROR;
|
||||
|
||||
/* Pass -d* flags, possibly modifying -dumpdir, -dumpbase et al.
|
||||
|
||||
@@ -1297,7 +1305,7 @@ static const char *cc1_options =
|
||||
%{coverage:-fprofile-arcs -ftest-coverage}\
|
||||
%{fprofile-arcs|fcondition-coverage|fpath-coverage|fprofile-generate*|coverage:\
|
||||
%{!fprofile-update=single:\
|
||||
- %{pthread:-fprofile-update=prefer-atomic}}}";
|
||||
+ %{pthread:-fprofile-update=prefer-atomic}}}" POISON_IS_ERROR;
|
||||
|
||||
static const char *asm_options =
|
||||
"%{-target-help:%:print-asm-header()} "
|
||||
diff --git a/gcc/incpath.cc b/gcc/incpath.cc
|
||||
index c1bbfd3872a..2cdbebc4c50 100644
|
||||
--- a/gcc/incpath.cc
|
||||
+++ b/gcc/incpath.cc
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "intl.h"
|
||||
#include "incpath.h"
|
||||
#include "cppdefault.h"
|
||||
+#include "diagnostic-core.h"
|
||||
|
||||
/* Microsoft Windows does not natively support inodes.
|
||||
VMS has non-numeric inodes. */
|
||||
@@ -273,6 +274,10 @@ remove_duplicates (cpp_reader *pfile, struct cpp_dir *head,
|
||||
cur->name, xstrerror (errno));
|
||||
reason = REASON_NOENT;
|
||||
}
|
||||
+#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES
|
||||
+ pcur = &cur->next;
|
||||
+ continue;
|
||||
+#endif
|
||||
}
|
||||
else if (!S_ISDIR (st.st_mode))
|
||||
cpp_error_with_line (pfile, CPP_DL_WARNING, 0, 0,
|
||||
@@ -411,6 +416,26 @@ merge_include_chains (const char *sysroot, cpp_reader *pfile, int verbose)
|
||||
fprintf (stderr, _("End of #embed search list.\n"));
|
||||
}
|
||||
}
|
||||
+
|
||||
+#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES
|
||||
+ if (flag_poison_system_directories)
|
||||
+ {
|
||||
+ struct cpp_dir *p;
|
||||
+
|
||||
+ for (p = heads[INC_QUOTE]; p; p = p->next)
|
||||
+ {
|
||||
+ if ((!strncmp (p->name, "/usr/include", 12))
|
||||
+ || (!strncmp (p->name, "/usr/local/include", 18))
|
||||
+ || (!strncmp (p->name, "/usr/X11R6/include", 18))
|
||||
+ || (!strncmp (p->name, "/sw/include", 11))
|
||||
+ || (!strncmp (p->name, "/opt/include", 12)))
|
||||
+ warning (OPT_Wpoison_system_directories,
|
||||
+ "include location \"%s\" is unsafe for "
|
||||
+ "cross-compilation",
|
||||
+ p->name);
|
||||
+ }
|
||||
+ }
|
||||
+#endif
|
||||
}
|
||||
|
||||
/* Use given -I paths for #include "..." but not #include <...>, and
|
||||
--
|
||||
2.50.1
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
From 90e8697dd88fd99ce2cf8739e95494853005377e Mon Sep 17 00:00:00 2001
|
||||
From: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Date: Fri, 21 Aug 2020 06:45:49 +0000
|
||||
Subject: [PATCH] specs: turn on -Wl,-z,now by default
|
||||
|
||||
Previously, we also used to turn on -z relro here, but we now build
|
||||
binutils with --enable-relro, which is functionally equivalent.
|
||||
|
||||
Binutils does not appear to have a similar option for enabling -z
|
||||
now by default.
|
||||
---
|
||||
gcc/doc/invoke.texi | 3 +++
|
||||
gcc/gcc.cc | 1 +
|
||||
2 files changed, 4 insertions(+)
|
||||
|
||||
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
|
||||
index 29aea724731..6fb3ab70cc7 100644
|
||||
--- a/gcc/doc/invoke.texi
|
||||
+++ b/gcc/doc/invoke.texi
|
||||
@@ -19477,6 +19477,9 @@ For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
|
||||
linker. When using the GNU linker, you can also get the same effect with
|
||||
@option{-Wl,-Map=output.map}.
|
||||
|
||||
+NOTE: In Alpine Linux, for LDFLAGS, the option
|
||||
+@option{-Wl,-z,now} is used. To disable, use @option{-Wl,-z,nonow}.
|
||||
+
|
||||
@opindex u
|
||||
@item -u @var{symbol}
|
||||
Pretend the symbol @var{symbol} is undefined, to force linking of
|
||||
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
|
||||
index 79d4920a047..74a356fdf5e 100644
|
||||
--- a/gcc/gcc.cc
|
||||
+++ b/gcc/gcc.cc
|
||||
@@ -1170,6 +1170,7 @@ proper position among the other output files. */
|
||||
"%{flto|flto=*:%<fcompare-debug*} \
|
||||
%{flto} %{fno-lto} %{flto=*} %l " LINK_PIE_SPEC \
|
||||
"%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \
|
||||
+ "-z now " \
|
||||
"%X %{o*} %{e*} %{N} %{n} %{r}\
|
||||
%{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!r:%{!nostartfiles:%S}}} \
|
||||
%{Wno-poison-system-directories:--no-poison-system-directories} \
|
||||
--
|
||||
2.50.1
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
From 17c9cf9272077bc7ac784daffd4c68ba1ce67a0d Mon Sep 17 00:00:00 2001
|
||||
From: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Date: Fri, 21 Aug 2020 06:46:22 +0000
|
||||
Subject: [PATCH] Turn on -D_FORTIFY_SOURCE=2 by default for C, C++, ObjC,
|
||||
ObjC++, if the optimization level is > 0
|
||||
|
||||
---
|
||||
gcc/c-family/c-cppbuiltin.cc | 4 ++++
|
||||
gcc/doc/invoke.texi | 6 ++++++
|
||||
2 files changed, 10 insertions(+)
|
||||
|
||||
diff --git a/gcc/c-family/c-cppbuiltin.cc b/gcc/c-family/c-cppbuiltin.cc
|
||||
index 4589ee4a3a6..9edf095384c 100644
|
||||
--- a/gcc/c-family/c-cppbuiltin.cc
|
||||
+++ b/gcc/c-family/c-cppbuiltin.cc
|
||||
@@ -1581,6 +1581,10 @@ c_cpp_builtins (cpp_reader *pfile)
|
||||
builtin_define_with_value ("__REGISTER_PREFIX__", REGISTER_PREFIX, 0);
|
||||
builtin_define_with_value ("__USER_LABEL_PREFIX__", user_label_prefix, 0);
|
||||
|
||||
+ /* Fortify Source enabled by default for optimization levels > 0 */
|
||||
+ if (optimize)
|
||||
+ builtin_define_with_int_value ("_FORTIFY_SOURCE", 2);
|
||||
+
|
||||
/* Misc. */
|
||||
if (flag_gnu89_inline)
|
||||
cpp_define (pfile, "__GNUC_GNU_INLINE__");
|
||||
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
|
||||
index 6fb3ab70cc7..799ce073dbf 100644
|
||||
--- a/gcc/doc/invoke.texi
|
||||
+++ b/gcc/doc/invoke.texi
|
||||
@@ -12840,6 +12840,12 @@ also turns on the following optimization flags:
|
||||
Please note the warning under @option{-fgcse} about
|
||||
invoking @option{-O2} on programs that use computed gotos.
|
||||
|
||||
+NOTE: In Alpine Linux, @option{-D_FORTIFY_SOURCE=2} is
|
||||
+set by default, and is activated when @option{-O} is set to 2 or higher.
|
||||
+This enables additional compile-time and run-time checks for several libc
|
||||
+functions. To disable, specify either @option{-U_FORTIFY_SOURCE} or
|
||||
+@option{-D_FORTIFY_SOURCE=0}.
|
||||
+
|
||||
@opindex O3
|
||||
@item -O3
|
||||
Optimize yet more. @option{-O3} turns on all optimizations specified
|
||||
--
|
||||
2.50.1
|
||||
|
||||
@@ -1,286 +0,0 @@
|
||||
From 95d8fac6247b2cba1142261cc95c21063539112a Mon Sep 17 00:00:00 2001
|
||||
From: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Date: Fri, 21 Aug 2020 06:46:56 +0000
|
||||
Subject: [PATCH] On linux targets pass --as-needed by default to the linker,
|
||||
but always link the sanitizer libraries with --no-as-needed.
|
||||
|
||||
---
|
||||
gcc/config/aarch64/aarch64-linux.h | 1 +
|
||||
gcc/config/alpha/linux-elf.h | 2 +-
|
||||
gcc/config/arm/linux-elf.h | 1 +
|
||||
gcc/config/gnu-user.h | 6 +++---
|
||||
gcc/config/i386/gnu-user.h | 2 +-
|
||||
gcc/config/i386/gnu-user64.h | 1 +
|
||||
gcc/config/ia64/linux.h | 2 +-
|
||||
gcc/config/loongarch/gnu-user.h | 2 +-
|
||||
gcc/config/mips/gnu-user.h | 1 +
|
||||
gcc/config/riscv/linux.h | 1 +
|
||||
gcc/config/rs6000/linux64.h | 4 ++--
|
||||
gcc/config/rs6000/sysv4.h | 2 +-
|
||||
gcc/config/s390/linux.h | 2 +-
|
||||
gcc/config/sparc/linux.h | 2 +-
|
||||
gcc/gcc.cc | 28 ++++++++++++++++++++--------
|
||||
15 files changed, 37 insertions(+), 20 deletions(-)
|
||||
|
||||
diff --git a/gcc/config/aarch64/aarch64-linux.h b/gcc/config/aarch64/aarch64-linux.h
|
||||
index 116bb4e69f3..daf99f8dce9 100644
|
||||
--- a/gcc/config/aarch64/aarch64-linux.h
|
||||
+++ b/gcc/config/aarch64/aarch64-linux.h
|
||||
@@ -39,6 +39,7 @@
|
||||
#define CPP_SPEC "%{pthread:-D_REENTRANT}"
|
||||
|
||||
#define LINUX_TARGET_LINK_SPEC "%{h*} \
|
||||
+ --as-needed \
|
||||
%{static:-Bstatic} \
|
||||
%{shared:-shared} \
|
||||
%{symbolic:-Bsymbolic} \
|
||||
diff --git a/gcc/config/alpha/linux-elf.h b/gcc/config/alpha/linux-elf.h
|
||||
index 3fd3b831166..0b4c2dccebe 100644
|
||||
--- a/gcc/config/alpha/linux-elf.h
|
||||
+++ b/gcc/config/alpha/linux-elf.h
|
||||
@@ -37,7 +37,7 @@ along with GCC; see the file COPYING3. If not see
|
||||
|
||||
#define ELF_DYNAMIC_LINKER GNU_USER_DYNAMIC_LINKER
|
||||
|
||||
-#define LINK_SPEC "-m elf64alpha %{G*} %{relax:-relax} \
|
||||
+#define LINK_SPEC "-m elf64alpha --as-needed %{G*} %{relax:-relax} \
|
||||
%{O*:-O3} %{!O*:-O1} \
|
||||
%{shared:-shared} \
|
||||
%{!shared: \
|
||||
diff --git a/gcc/config/arm/linux-elf.h b/gcc/config/arm/linux-elf.h
|
||||
index d4d389e2aa8..adccc0b11c2 100644
|
||||
--- a/gcc/config/arm/linux-elf.h
|
||||
+++ b/gcc/config/arm/linux-elf.h
|
||||
@@ -70,6 +70,7 @@
|
||||
%{rdynamic:-export-dynamic} \
|
||||
%{!shared:-dynamic-linker " GNU_USER_DYNAMIC_LINKER "}} \
|
||||
-X \
|
||||
+ --as-needed \
|
||||
%{mbig-endian:-EB} %{mlittle-endian:-EL}" \
|
||||
SUBTARGET_EXTRA_LINK_SPEC
|
||||
|
||||
diff --git a/gcc/config/gnu-user.h b/gcc/config/gnu-user.h
|
||||
index 4c4e31efa39..3c17ac6eade 100644
|
||||
--- a/gcc/config/gnu-user.h
|
||||
+++ b/gcc/config/gnu-user.h
|
||||
@@ -136,7 +136,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
#define LIBASAN_EARLY_SPEC "%{!shared:libasan_preinit%O%s} " \
|
||||
"%{static-libasan:%{!shared:" \
|
||||
LD_STATIC_OPTION " --whole-archive -lasan --no-whole-archive " \
|
||||
- LD_DYNAMIC_OPTION "}}%{!static-libasan:-lasan}"
|
||||
+ LD_DYNAMIC_OPTION "}}%{!static-libasan:%{!fuse-ld=gold:--push-state} --no-as-needed -lasan %{fuse-ld=gold:--as-needed;:--pop-state}}"
|
||||
#undef LIBHWASAN_EARLY_SPEC
|
||||
#define LIBHWASAN_EARLY_SPEC "%{!shared:libhwasan_preinit%O%s} " \
|
||||
"%{static-libhwasan:%{!shared:" \
|
||||
@@ -146,12 +146,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
#define LIBTSAN_EARLY_SPEC "%{!shared:libtsan_preinit%O%s} " \
|
||||
"%{static-libtsan:%{!shared:" \
|
||||
LD_STATIC_OPTION " --whole-archive -ltsan --no-whole-archive " \
|
||||
- LD_DYNAMIC_OPTION "}}%{!static-libtsan:-ltsan}"
|
||||
+ LD_DYNAMIC_OPTION "}}%{!static-libtsan:%{!fuse-ld=gold:--push-state} --no-as-needed -ltsan %{fuse-ld=gold:--as-needed;:--pop-state}}"
|
||||
#undef LIBLSAN_EARLY_SPEC
|
||||
#define LIBLSAN_EARLY_SPEC "%{!shared:liblsan_preinit%O%s} " \
|
||||
"%{static-liblsan:%{!shared:" \
|
||||
LD_STATIC_OPTION " --whole-archive -llsan --no-whole-archive " \
|
||||
- LD_DYNAMIC_OPTION "}}%{!static-liblsan:-llsan}"
|
||||
+ LD_DYNAMIC_OPTION "}}%{!static-liblsan:%{!fuse-ld=gold:--push-state} --no-as-needed -llsan %{fuse-ld=gold:--as-needed;:--pop-state}}"
|
||||
#endif
|
||||
|
||||
#undef TARGET_F951_OPTIONS
|
||||
diff --git a/gcc/config/i386/gnu-user.h b/gcc/config/i386/gnu-user.h
|
||||
index 7abfda53049..ceb8f855b7d 100644
|
||||
--- a/gcc/config/i386/gnu-user.h
|
||||
+++ b/gcc/config/i386/gnu-user.h
|
||||
@@ -68,7 +68,7 @@ along with GCC; see the file COPYING3. If not see
|
||||
{ "link_emulation", GNU_USER_LINK_EMULATION },\
|
||||
{ "dynamic_linker", GNU_USER_DYNAMIC_LINKER }
|
||||
|
||||
-#define GNU_USER_TARGET_LINK_SPEC "-m %(link_emulation) %{shared:-shared} \
|
||||
+#define GNU_USER_TARGET_LINK_SPEC "-m %(link_emulation) --as-needed %{shared:-shared} \
|
||||
%{!shared: \
|
||||
%{!static: \
|
||||
%{!static-pie: \
|
||||
diff --git a/gcc/config/i386/gnu-user64.h b/gcc/config/i386/gnu-user64.h
|
||||
index abe714711bf..3ca128a79f5 100644
|
||||
--- a/gcc/config/i386/gnu-user64.h
|
||||
+++ b/gcc/config/i386/gnu-user64.h
|
||||
@@ -56,6 +56,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
"%{" SPEC_64 ":-m " GNU_USER_LINK_EMULATION64 "} \
|
||||
%{" SPEC_32 ":-m " GNU_USER_LINK_EMULATION32 "} \
|
||||
%{" SPEC_X32 ":-m " GNU_USER_LINK_EMULATIONX32 "} \
|
||||
+ --as-needed \
|
||||
%{shared:-shared} \
|
||||
%{!shared: \
|
||||
%{!static: \
|
||||
diff --git a/gcc/config/ia64/linux.h b/gcc/config/ia64/linux.h
|
||||
index a2494c214c4..e1a5d530cdf 100644
|
||||
--- a/gcc/config/ia64/linux.h
|
||||
+++ b/gcc/config/ia64/linux.h
|
||||
@@ -58,7 +58,7 @@ do { \
|
||||
#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-ia64.so.2"
|
||||
|
||||
#undef LINK_SPEC
|
||||
-#define LINK_SPEC "\
|
||||
+#define LINK_SPEC " --as-needed \
|
||||
%{shared:-shared} \
|
||||
%{!shared: \
|
||||
%{!static: \
|
||||
diff --git a/gcc/config/loongarch/gnu-user.h b/gcc/config/loongarch/gnu-user.h
|
||||
index fbc75a90ad5..adbc4b7733f 100644
|
||||
--- a/gcc/config/loongarch/gnu-user.h
|
||||
+++ b/gcc/config/loongarch/gnu-user.h
|
||||
@@ -44,7 +44,7 @@ along with GCC; see the file COPYING3. If not see
|
||||
|
||||
#undef GNU_USER_TARGET_LINK_SPEC
|
||||
#define GNU_USER_TARGET_LINK_SPEC \
|
||||
- "%{G*} %{shared} -m " GNU_USER_LINK_EMULATION \
|
||||
+ "%{G*} %{shared} --as-needed -m " GNU_USER_LINK_EMULATION \
|
||||
"%{!shared: %{static} " \
|
||||
"%{!static: %{!static-pie: %{rdynamic:-export-dynamic} " \
|
||||
"-dynamic-linker " GNU_USER_DYNAMIC_LINKER "}} " \
|
||||
diff --git a/gcc/config/mips/gnu-user.h b/gcc/config/mips/gnu-user.h
|
||||
index 5a82508c113..6eee7cdc603 100644
|
||||
--- a/gcc/config/mips/gnu-user.h
|
||||
+++ b/gcc/config/mips/gnu-user.h
|
||||
@@ -55,6 +55,7 @@ along with GCC; see the file COPYING3. If not see
|
||||
#undef GNU_USER_TARGET_LINK_SPEC
|
||||
#define GNU_USER_TARGET_LINK_SPEC "\
|
||||
%{G*} %{EB} %{EL} %{mips*} %{shared} \
|
||||
+ -as-needed \
|
||||
%{!shared: \
|
||||
%{!static: \
|
||||
%{rdynamic:-export-dynamic} \
|
||||
diff --git a/gcc/config/riscv/linux.h b/gcc/config/riscv/linux.h
|
||||
index 9060c940a44..282c77b6a7b 100644
|
||||
--- a/gcc/config/riscv/linux.h
|
||||
+++ b/gcc/config/riscv/linux.h
|
||||
@@ -48,6 +48,7 @@ along with GCC; see the file COPYING3. If not see
|
||||
"%{mabi=ilp32:_ilp32}"
|
||||
|
||||
#define LINK_SPEC "\
|
||||
+-as-needed \
|
||||
-melf" XLEN_SPEC DEFAULT_ENDIAN_SPEC "riscv" LD_EMUL_SUFFIX " \
|
||||
%{mno-relax:--no-relax} \
|
||||
-X \
|
||||
diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
|
||||
index 0316d8cb65d..139e1b6796c 100644
|
||||
--- a/gcc/config/rs6000/linux64.h
|
||||
+++ b/gcc/config/rs6000/linux64.h
|
||||
@@ -378,13 +378,13 @@ extern int dot_symbols;
|
||||
" -m elf64ppc")
|
||||
#endif
|
||||
|
||||
-#define LINK_OS_LINUX_SPEC32 LINK_OS_LINUX_EMUL32 " %{!shared: %{!static: \
|
||||
+#define LINK_OS_LINUX_SPEC32 LINK_OS_LINUX_EMUL32 " --as-needed %{!shared: %{!static: \
|
||||
%{!static-pie: \
|
||||
%{rdynamic:-export-dynamic} \
|
||||
-dynamic-linker " GNU_USER_DYNAMIC_LINKER32 "}}} \
|
||||
%(link_os_extra_spec32)"
|
||||
|
||||
-#define LINK_OS_LINUX_SPEC64 LINK_OS_LINUX_EMUL64 " %{!shared: %{!static: \
|
||||
+#define LINK_OS_LINUX_SPEC64 LINK_OS_LINUX_EMUL64 " --as-needed %{!shared: %{!static: \
|
||||
%{!static-pie: \
|
||||
%{rdynamic:-export-dynamic} \
|
||||
-dynamic-linker " GNU_USER_DYNAMIC_LINKER64 "}}} \
|
||||
diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h
|
||||
index afb5c6ad867..b64638fb25b 100644
|
||||
--- a/gcc/config/rs6000/sysv4.h
|
||||
+++ b/gcc/config/rs6000/sysv4.h
|
||||
@@ -781,7 +781,7 @@ GNU_USER_TARGET_CC1_SPEC
|
||||
#define GNU_USER_DYNAMIC_LINKER GLIBC_DYNAMIC_LINKER
|
||||
#endif
|
||||
|
||||
-#define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
|
||||
+#define LINK_OS_LINUX_SPEC "-m elf32ppclinux --as-needed %{!shared: %{!static: \
|
||||
%{rdynamic:-export-dynamic} \
|
||||
-dynamic-linker " GNU_USER_DYNAMIC_LINKER "}}"
|
||||
|
||||
diff --git a/gcc/config/s390/linux.h b/gcc/config/s390/linux.h
|
||||
index 2c3bca5dfcb..b90661247a4 100644
|
||||
--- a/gcc/config/s390/linux.h
|
||||
+++ b/gcc/config/s390/linux.h
|
||||
@@ -82,7 +82,7 @@ along with GCC; see the file COPYING3. If not see
|
||||
|
||||
#undef LINK_SPEC
|
||||
#define LINK_SPEC \
|
||||
- "%{m31:-m elf_s390}%{m64:-m elf64_s390} \
|
||||
+ "%{m31:-m elf_s390}%{m64:-m elf64_s390} --as-needed \
|
||||
%{shared:-shared} \
|
||||
%{!shared: \
|
||||
%{static:-static} \
|
||||
diff --git a/gcc/config/sparc/linux.h b/gcc/config/sparc/linux.h
|
||||
index 6d928846895..3cc05bb7240 100644
|
||||
--- a/gcc/config/sparc/linux.h
|
||||
+++ b/gcc/config/sparc/linux.h
|
||||
@@ -81,7 +81,7 @@ extern const char *host_detect_local_cpu (int argc, const char **argv);
|
||||
#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
|
||||
|
||||
#undef LINK_SPEC
|
||||
-#define LINK_SPEC "-m elf32_sparc %{shared:-shared} \
|
||||
+#define LINK_SPEC "-m elf32_sparc --as-needed %{shared:-shared} \
|
||||
%{!mno-relax:%{!r:-relax}} \
|
||||
%{!shared: \
|
||||
%{!static: \
|
||||
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
|
||||
index 74a356fdf5e..fc9c7d15b04 100644
|
||||
--- a/gcc/gcc.cc
|
||||
+++ b/gcc/gcc.cc
|
||||
@@ -774,8 +774,11 @@ proper position among the other output files. */
|
||||
#ifdef LIBASAN_EARLY_SPEC
|
||||
#define LIBASAN_SPEC STATIC_LIBASAN_LIBS
|
||||
#elif defined(HAVE_LD_STATIC_DYNAMIC)
|
||||
-#define LIBASAN_SPEC "%{static-libasan:" LD_STATIC_OPTION \
|
||||
- "} -lasan %{static-libasan:" LD_DYNAMIC_OPTION "}" \
|
||||
+#define LIBASAN_SPEC "%{static-libasan:" LD_STATIC_OPTION "}" \
|
||||
+ " %{!static-libasan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \
|
||||
+ " -lasan " \
|
||||
+ " %{static-libasan:" LD_DYNAMIC_OPTION "}" \
|
||||
+ " %{!static-libasan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \
|
||||
STATIC_LIBASAN_LIBS
|
||||
#else
|
||||
#define LIBASAN_SPEC "-lasan" STATIC_LIBASAN_LIBS
|
||||
@@ -810,8 +813,11 @@ proper position among the other output files. */
|
||||
#ifdef LIBTSAN_EARLY_SPEC
|
||||
#define LIBTSAN_SPEC STATIC_LIBTSAN_LIBS
|
||||
#elif defined(HAVE_LD_STATIC_DYNAMIC)
|
||||
-#define LIBTSAN_SPEC "%{static-libtsan:" LD_STATIC_OPTION \
|
||||
- "} -ltsan %{static-libtsan:" LD_DYNAMIC_OPTION "}" \
|
||||
+#define LIBTSAN_SPEC "%{static-libtsan:" LD_STATIC_OPTION "}" \
|
||||
+ " %{!static-libtsan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \
|
||||
+ " -ltsan " \
|
||||
+ " %{static-libtsan:" LD_DYNAMIC_OPTION "}" \
|
||||
+ " %{!static-libtsan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \
|
||||
STATIC_LIBTSAN_LIBS
|
||||
#else
|
||||
#define LIBTSAN_SPEC "-ltsan" STATIC_LIBTSAN_LIBS
|
||||
@@ -828,8 +834,11 @@ proper position among the other output files. */
|
||||
#ifdef LIBLSAN_EARLY_SPEC
|
||||
#define LIBLSAN_SPEC STATIC_LIBLSAN_LIBS
|
||||
#elif defined(HAVE_LD_STATIC_DYNAMIC)
|
||||
-#define LIBLSAN_SPEC "%{static-liblsan:" LD_STATIC_OPTION \
|
||||
- "} -llsan %{static-liblsan:" LD_DYNAMIC_OPTION "}" \
|
||||
+#define LIBLSAN_SPEC "%{static-liblsan:" LD_STATIC_OPTION "}" \
|
||||
+ " %{!static-liblsan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \
|
||||
+ " -llsan " \
|
||||
+ " %{static-liblsan:" LD_DYNAMIC_OPTION "}" \
|
||||
+ " %{!static-liblsan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \
|
||||
STATIC_LIBLSAN_LIBS
|
||||
#else
|
||||
#define LIBLSAN_SPEC "-llsan" STATIC_LIBLSAN_LIBS
|
||||
@@ -844,8 +853,11 @@ proper position among the other output files. */
|
||||
#define STATIC_LIBUBSAN_LIBS \
|
||||
" %{static-libubsan|static:%:include(libsanitizer.spec)%(link_libubsan)}"
|
||||
#ifdef HAVE_LD_STATIC_DYNAMIC
|
||||
-#define LIBUBSAN_SPEC "%{static-libubsan:" LD_STATIC_OPTION \
|
||||
- "} -lubsan %{static-libubsan:" LD_DYNAMIC_OPTION "}" \
|
||||
+#define LIBUBSAN_SPEC "%{static-libubsan:" LD_STATIC_OPTION "}" \
|
||||
+ " %{!static-libubsan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \
|
||||
+ " -lubsan " \
|
||||
+ " %{static-libubsan:" LD_DYNAMIC_OPTION "}" \
|
||||
+ " %{!static-libubsan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \
|
||||
STATIC_LIBUBSAN_LIBS
|
||||
#else
|
||||
#define LIBUBSAN_SPEC "-lubsan" STATIC_LIBUBSAN_LIBS
|
||||
--
|
||||
2.50.1
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
From 58a94690d4dd7b34543d9d154abc96d2d90d3b32 Mon Sep 17 00:00:00 2001
|
||||
From: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Date: Fri, 21 Aug 2020 06:47:43 +0000
|
||||
Subject: [PATCH] Enable -Wformat and -Wformat-security by default.
|
||||
|
||||
---
|
||||
gcc/c-family/c.opt | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
|
||||
index 75b6531860e..78830ce4b42 100644
|
||||
--- a/gcc/c-family/c.opt
|
||||
+++ b/gcc/c-family/c.opt
|
||||
@@ -805,7 +805,7 @@ Warn about function calls with format strings that write past the end
|
||||
of the destination region.
|
||||
|
||||
Wformat-security
|
||||
-C ObjC C++ ObjC++ Var(warn_format_security) Warning LangEnabledBy(C ObjC C++ ObjC++,Wformat=, warn_format >= 2, 0)
|
||||
+C ObjC C++ ObjC++ Var(warn_format_security) Init(1) Warning LangEnabledBy(C ObjC C++ ObjC++,Wformat=, warn_format >= 2, 0)
|
||||
Warn about possible security problems with format functions.
|
||||
|
||||
Wformat-signedness
|
||||
@@ -830,7 +830,7 @@ C ObjC C++ ObjC++ Var(warn_format_zero_length) Warning LangEnabledBy(C ObjC C++
|
||||
Warn about zero-length formats.
|
||||
|
||||
Wformat=
|
||||
-C ObjC C++ ObjC++ Joined RejectNegative UInteger Var(warn_format) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall, 1, 0) IntegerRange(0, 2)
|
||||
+C ObjC C++ ObjC++ Joined RejectNegative UInteger Var(warn_format) Init(1) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall, 1, 0) IntegerRange(0, 2)
|
||||
Warn about printf/scanf/strftime/strfmon format string anomalies.
|
||||
|
||||
Wframe-address
|
||||
--
|
||||
2.50.1
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
From b2a755b671d88c34402290d7d769232e01aed350 Mon Sep 17 00:00:00 2001
|
||||
From: Ariadne Conill <ariadne@ariadne.space>
|
||||
Date: Fri, 25 Jul 2025 01:44:20 -0700
|
||||
Subject: [PATCH] Enable -Wtrampolines by default.
|
||||
|
||||
---
|
||||
gcc/common.opt | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/gcc/common.opt b/gcc/common.opt
|
||||
index bea1adc0940..e65a575d9f8 100644
|
||||
--- a/gcc/common.opt
|
||||
+++ b/gcc/common.opt
|
||||
@@ -829,7 +829,7 @@ Common Var(warn_tautological_compare) Warning LangEnabledBy(C ObjC C++ ObjC++,Wa
|
||||
Warn if a comparison always evaluates to true or false.
|
||||
|
||||
Wtrampolines
|
||||
-Common Var(warn_trampolines) Warning
|
||||
+Common Var(warn_trampolines) Init(1) Warning
|
||||
Warn whenever a trampoline is generated.
|
||||
|
||||
Wtrivial-auto-var-init
|
||||
--
|
||||
2.50.1
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
From c355364231395090e7223ec00d8a16065903c2c5 Mon Sep 17 00:00:00 2001
|
||||
From: Ariadne Conill <ariadne@ariadne.space>
|
||||
Date: Fri, 25 Jul 2025 01:49:03 -0700
|
||||
Subject: [PATCH] gcc: disable SSP on -ffreestanding, -nostdlib and
|
||||
-nodefaultlibs
|
||||
|
||||
---
|
||||
gcc/gcc.cc | 8 +++++++-
|
||||
1 file changed, 7 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
|
||||
index fc9c7d15b04..7b0d3d2743b 100644
|
||||
--- a/gcc/gcc.cc
|
||||
+++ b/gcc/gcc.cc
|
||||
@@ -1009,6 +1009,12 @@ proper position among the other output files. */
|
||||
#define LINK_GCC_C_SEQUENCE_SPEC "%G %{!nolibc:%L %G}"
|
||||
#endif
|
||||
|
||||
+#ifdef ENABLE_DEFAULT_SSP
|
||||
+#define NO_SSP_SPEC "%{nostdlib|nodefaultlibs|ffreestanding:-fno-stack-protector} "
|
||||
+#else
|
||||
+#define NO_SSP_SPEC ""
|
||||
+#endif
|
||||
+
|
||||
#ifndef LINK_SSP_SPEC
|
||||
#ifdef TARGET_LIBC_PROVIDES_SSP
|
||||
#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
|
||||
@@ -1314,7 +1320,7 @@ static const char *cc1_options =
|
||||
%{-version:--version}\
|
||||
%{-help=*:--help=%*}\
|
||||
%{!fsyntax-only:%{S:%W{o*}%{!o*:-o %w%b.s}}}\
|
||||
- %{fsyntax-only:-o %j} %{-param*}\
|
||||
+ %{fsyntax-only:-o %j} %{-param*} " NO_SSP_SPEC "\
|
||||
%{coverage:-fprofile-arcs -ftest-coverage}\
|
||||
%{fprofile-arcs|fcondition-coverage|fpath-coverage|fprofile-generate*|coverage:\
|
||||
%{!fprofile-update=single:\
|
||||
--
|
||||
2.50.1
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
From 5f09842c19d6db976724cd117190a8a6951acf9b Mon Sep 17 00:00:00 2001
|
||||
From: Ariadne Conill <ariadne@ariadne.space>
|
||||
Date: Fri, 25 Jul 2025 01:50:42 -0700
|
||||
Subject: [PATCH] gcc: params: set default ssp-buffer-size to 4
|
||||
|
||||
---
|
||||
gcc/params.opt | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/gcc/params.opt b/gcc/params.opt
|
||||
index 64e453d29b7..bba3fd574f2 100644
|
||||
--- a/gcc/params.opt
|
||||
+++ b/gcc/params.opt
|
||||
@@ -1064,7 +1064,7 @@ Common Joined UInteger Var(param_ssa_name_def_chain_limit) Init(512) Param Optim
|
||||
The maximum number of SSA_NAME assignments to follow in determining a value.
|
||||
|
||||
-param=ssp-buffer-size=
|
||||
-Common Joined UInteger Var(param_ssp_buffer_size) Init(8) IntegerRange(1, 65536) Param Optimization
|
||||
+Common Joined UInteger Var(param_ssp_buffer_size) Init(4) IntegerRange(1, 65536) Param Optimization
|
||||
The lower bound for a buffer to be considered for stack smashing protection.
|
||||
|
||||
-param=stack-clash-protection-guard-size=
|
||||
--
|
||||
2.50.1
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
From ee0615536ae0d255f59070b904aa35d6de8fce49 Mon Sep 17 00:00:00 2001
|
||||
From: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Date: Fri, 21 Aug 2020 06:50:33 +0000
|
||||
Subject: [PATCH] Ensure that msgfmt doesn't encounter problems during gcc
|
||||
bootstrapping.
|
||||
|
||||
Solves error messages like the following:
|
||||
|
||||
msgfmt: /var/tmp/portage/sys-devel/gcc-4.1.2/work/build/./gcc/libgcc_s.so.1: version `GCC_4.2.0' not found (required by /usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/libstdc++.so.6)
|
||||
|
||||
The libgcc_s.so used during build doesn't satisfy the needs of the
|
||||
libstdc++.so that msgfmt is linked against. On the other hand, msgfmt
|
||||
is used as a stand-alone application here, and what library it uses
|
||||
behind the scenes is of no concern to the gcc build process.
|
||||
Therefore, simply invoking it "as usual", i.e. without any special
|
||||
library path, will make it work as expected here.
|
||||
|
||||
2011-09-19 Martin von Gagern
|
||||
|
||||
References:
|
||||
https://bugs.gentoo.org/372377
|
||||
https://bugs.gentoo.org/295480
|
||||
---
|
||||
libstdc++-v3/po/Makefile.am | 1 +
|
||||
libstdc++-v3/po/Makefile.in | 1 +
|
||||
2 files changed, 2 insertions(+)
|
||||
|
||||
diff --git a/libstdc++-v3/po/Makefile.am b/libstdc++-v3/po/Makefile.am
|
||||
index 7f84a99533e..a4c6284f788 100644
|
||||
--- a/libstdc++-v3/po/Makefile.am
|
||||
+++ b/libstdc++-v3/po/Makefile.am
|
||||
@@ -38,6 +38,7 @@ MSGFMT = msgfmt
|
||||
EXTRA_DIST = string_literals.cc POTFILES.in $(PACKAGE).pot $(LOCALE_IN)
|
||||
|
||||
.po.mo:
|
||||
+ env --unset=LD_LIBRARY_PATH \
|
||||
$(MSGFMT) -o $@ $<
|
||||
|
||||
all-local: all-local-$(USE_NLS)
|
||||
diff --git a/libstdc++-v3/po/Makefile.in b/libstdc++-v3/po/Makefile.in
|
||||
index 8e93445acd2..d6ff06e5ddb 100644
|
||||
--- a/libstdc++-v3/po/Makefile.in
|
||||
+++ b/libstdc++-v3/po/Makefile.in
|
||||
@@ -561,6 +561,7 @@ uninstall-am:
|
||||
|
||||
|
||||
.po.mo:
|
||||
+ env --unset=LD_LIBRARY_PATH \
|
||||
$(MSGFMT) -o $@ $<
|
||||
|
||||
all-local: all-local-$(USE_NLS)
|
||||
--
|
||||
2.50.1
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
From 62966418472466142a9962892177f4b1f9f56944 Mon Sep 17 00:00:00 2001
|
||||
From: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Date: Fri, 21 Aug 2020 06:52:07 +0000
|
||||
Subject: [PATCH] Don't declare asprintf if defined as a macro.
|
||||
|
||||
---
|
||||
include/libiberty.h | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/include/libiberty.h b/include/libiberty.h
|
||||
index d4e8791b14b..c074980ed80 100644
|
||||
--- a/include/libiberty.h
|
||||
+++ b/include/libiberty.h
|
||||
@@ -678,8 +678,11 @@ extern void *bsearch_r (const void *, const void *,
|
||||
/* Like sprintf but provides a pointer to malloc'd storage, which must
|
||||
be freed by the caller. */
|
||||
|
||||
+/* asprintf may be declared as a macro by glibc with __USE_FORTIFY_LEVEL. */
|
||||
+#ifndef asprintf
|
||||
extern int asprintf (char **, const char *, ...) ATTRIBUTE_PRINTF_2;
|
||||
#endif
|
||||
+#endif
|
||||
|
||||
/* Like asprintf but allocates memory without fail. This works like
|
||||
xmalloc. */
|
||||
--
|
||||
2.50.1
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
From 0351f4f3dd00bdece780ce5e24d972e97ca1b7ed Mon Sep 17 00:00:00 2001
|
||||
From: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Date: Fri, 21 Aug 2020 06:53:00 +0000
|
||||
Subject: [PATCH] libiberty: copy PIC objects during build process
|
||||
|
||||
---
|
||||
libiberty/Makefile.in | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in
|
||||
index ce54d88278d..10c212a1ad3 100644
|
||||
--- a/libiberty/Makefile.in
|
||||
+++ b/libiberty/Makefile.in
|
||||
@@ -266,6 +266,7 @@ $(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS)
|
||||
$(AR) $(AR_FLAGS) $(TARGETLIB) \
|
||||
$(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \
|
||||
$(RANLIB) $(TARGETLIB); \
|
||||
+ cp $(TARGETLIB) ../ ; \
|
||||
cd ..; \
|
||||
else true; fi
|
||||
|
||||
--
|
||||
2.50.1
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
From bd7e32d5405b6b4f3994a212a77ff2cd33134c74 Mon Sep 17 00:00:00 2001
|
||||
From: Szabolcs Nagy <nsz@port70.net>
|
||||
Date: Sat, 24 Oct 2015 20:09:53 +0000
|
||||
Subject: [PATCH] libgcc_s
|
||||
|
||||
---
|
||||
gcc/config/i386/i386-expand.cc | 4 ++--
|
||||
libgcc/config/i386/cpuinfo.c | 6 +++---
|
||||
libgcc/config/i386/t-linux | 2 +-
|
||||
3 files changed, 6 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc
|
||||
index cdfd94d3c73..a3a6c988833 100644
|
||||
--- a/gcc/config/i386/i386-expand.cc
|
||||
+++ b/gcc/config/i386/i386-expand.cc
|
||||
@@ -13643,10 +13643,10 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget,
|
||||
{
|
||||
case IX86_BUILTIN_CPU_INIT:
|
||||
{
|
||||
- /* Make it call __cpu_indicator_init in libgcc. */
|
||||
+ /* Make it call __cpu_indicator_init in libgcc.a. */
|
||||
tree call_expr, fndecl, type;
|
||||
type = build_function_type_list (integer_type_node, NULL_TREE);
|
||||
- fndecl = build_fn_decl ("__cpu_indicator_init", type);
|
||||
+ fndecl = build_fn_decl ("__cpu_indicator_init_local", type);
|
||||
call_expr = build_call_expr (fndecl, 0);
|
||||
return expand_expr (call_expr, target, mode, EXPAND_NORMAL);
|
||||
}
|
||||
diff --git a/libgcc/config/i386/cpuinfo.c b/libgcc/config/i386/cpuinfo.c
|
||||
index 2484dc839bf..e980030ef23 100644
|
||||
--- a/libgcc/config/i386/cpuinfo.c
|
||||
+++ b/libgcc/config/i386/cpuinfo.c
|
||||
@@ -63,7 +63,7 @@ __cpu_indicator_init (void)
|
||||
__cpu_features2);
|
||||
}
|
||||
|
||||
-#if defined SHARED && defined USE_ELF_SYMVER
|
||||
-__asm__ (".symver __cpu_indicator_init, __cpu_indicator_init@GCC_4.8.0");
|
||||
-__asm__ (".symver __cpu_model, __cpu_model@GCC_4.8.0");
|
||||
+#ifndef SHARED
|
||||
+int __cpu_indicator_init_local (void)
|
||||
+ __attribute__ ((weak, alias ("__cpu_indicator_init")));
|
||||
#endif
|
||||
diff --git a/libgcc/config/i386/t-linux b/libgcc/config/i386/t-linux
|
||||
index 8506a635790..564296f788e 100644
|
||||
--- a/libgcc/config/i386/t-linux
|
||||
+++ b/libgcc/config/i386/t-linux
|
||||
@@ -3,5 +3,5 @@
|
||||
# t-slibgcc-elf-ver and t-linux
|
||||
SHLIB_MAPFILES = libgcc-std.ver $(srcdir)/config/i386/libgcc-glibc.ver
|
||||
|
||||
-HOST_LIBGCC2_CFLAGS += -mlong-double-80 -DUSE_ELF_SYMVER $(CET_FLAGS)
|
||||
+HOST_LIBGCC2_CFLAGS += -mlong-double-80 $(CET_FLAGS)
|
||||
CRTSTUFF_T_CFLAGS += $(CET_FLAGS)
|
||||
--
|
||||
2.50.1
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
From c191dc86f4f7340542066f4156aa57be9cfbf876 Mon Sep 17 00:00:00 2001
|
||||
From: Szabolcs Nagy <nsz@port70.net>
|
||||
Date: Sat, 7 Nov 2015 02:08:05 +0000
|
||||
Subject: [PATCH] nopie
|
||||
|
||||
---
|
||||
gcc/configure | 25 +++++++++++++++++++++++++
|
||||
gcc/configure.ac | 11 +++++++++++
|
||||
2 files changed, 36 insertions(+)
|
||||
|
||||
diff --git a/gcc/configure b/gcc/configure
|
||||
index 0f4a5d52c30..343563c8948 100755
|
||||
--- a/gcc/configure
|
||||
+++ b/gcc/configure
|
||||
@@ -34586,6 +34586,29 @@ rm -f core conftest.err conftest.$ac_objext \
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_no_pie" >&5
|
||||
$as_echo "$gcc_cv_no_pie" >&6; }
|
||||
+# Check if -nopie works.
|
||||
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -nopie option" >&5
|
||||
+$as_echo_n "checking for -nopie option... " >&6; }
|
||||
+if ${gcc_cv_nopie+:} false; then :
|
||||
+ $as_echo_n "(cached) " >&6
|
||||
+else
|
||||
+ saved_LDFLAGS="$LDFLAGS"
|
||||
+ LDFLAGS="$LDFLAGS -nopie"
|
||||
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
+/* end confdefs.h. */
|
||||
+int main(void) {return 0;}
|
||||
+_ACEOF
|
||||
+if ac_fn_cxx_try_link "$LINENO"; then :
|
||||
+ gcc_cv_nopie=yes
|
||||
+else
|
||||
+ gcc_cv_nopie=no
|
||||
+fi
|
||||
+rm -f core conftest.err conftest.$ac_objext \
|
||||
+ conftest$ac_exeext conftest.$ac_ext
|
||||
+ LDFLAGS="$saved_LDFLAGS"
|
||||
+fi
|
||||
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_nopie" >&5
|
||||
+$as_echo "$gcc_cv_nopie" >&6; }
|
||||
|
||||
if test x$enable_host_shared = xyes; then
|
||||
PICFLAG=-fPIC
|
||||
@@ -34603,6 +34626,8 @@ if test x$enable_host_pie = xyes; then
|
||||
LD_PICFLAG=-pie
|
||||
elif test x$gcc_cv_no_pie = xyes; then
|
||||
LD_PICFLAG=-no-pie
|
||||
+elif test x$gcc_cv_nopie = xyes; then
|
||||
+ LD_PICFLAG=-nopie
|
||||
else
|
||||
LD_PICFLAG=
|
||||
fi
|
||||
diff --git a/gcc/configure.ac b/gcc/configure.ac
|
||||
index b0e3615e5aa..b3948469d17 100644
|
||||
--- a/gcc/configure.ac
|
||||
+++ b/gcc/configure.ac
|
||||
@@ -7802,6 +7802,15 @@ AC_CACHE_CHECK([for -no-pie option],
|
||||
[gcc_cv_no_pie=yes],
|
||||
[gcc_cv_no_pie=no])
|
||||
LDFLAGS="$saved_LDFLAGS"])
|
||||
+# Check if -nopie works.
|
||||
+AC_CACHE_CHECK([for -nopie option],
|
||||
+ [gcc_cv_nopie],
|
||||
+ [saved_LDFLAGS="$LDFLAGS"
|
||||
+ LDFLAGS="$LDFLAGS -nopie"
|
||||
+ AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) {return 0;}])],
|
||||
+ [gcc_cv_nopie=yes],
|
||||
+ [gcc_cv_nopie=no])
|
||||
+ LDFLAGS="$saved_LDFLAGS"])
|
||||
|
||||
if test x$enable_host_shared = xyes; then
|
||||
PICFLAG=-fPIC
|
||||
@@ -7819,6 +7828,8 @@ if test x$enable_host_pie = xyes; then
|
||||
LD_PICFLAG=-pie
|
||||
elif test x$gcc_cv_no_pie = xyes; then
|
||||
LD_PICFLAG=-no-pie
|
||||
+elif test x$gcc_cv_nopie = xyes; then
|
||||
+ LD_PICFLAG=-nopie
|
||||
else
|
||||
LD_PICFLAG=
|
||||
fi
|
||||
--
|
||||
2.50.1
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
From f1d6c0950e0f12fb8cf2429da570f478a1369286 Mon Sep 17 00:00:00 2001
|
||||
From: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Date: Fri, 21 Aug 2020 06:59:16 +0000
|
||||
Subject: [PATCH] ada: fix shared linking
|
||||
|
||||
---
|
||||
gcc/ada/link.c | 12 ++++++------
|
||||
1 file changed, 6 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/gcc/ada/link.c b/gcc/ada/link.c
|
||||
index 9e3385ca94f..2c0cca6e480 100644
|
||||
--- a/gcc/ada/link.c
|
||||
+++ b/gcc/ada/link.c
|
||||
@@ -107,9 +107,9 @@ const char *__gnat_default_libgcc_subdir = "lib";
|
||||
|| defined (__NetBSD__) || defined (__OpenBSD__) \
|
||||
|| defined (__QNX__)
|
||||
const char *__gnat_object_file_option = "-Wl,@";
|
||||
-const char *__gnat_run_path_option = "-Wl,-rpath,";
|
||||
-char __gnat_shared_libgnat_default = STATIC;
|
||||
-char __gnat_shared_libgcc_default = STATIC;
|
||||
+const char *__gnat_run_path_option = "";
|
||||
+char __gnat_shared_libgnat_default = SHARED;
|
||||
+char __gnat_shared_libgcc_default = SHARED;
|
||||
int __gnat_link_max = 8192;
|
||||
unsigned char __gnat_objlist_file_supported = 1;
|
||||
const char *__gnat_object_library_extension = ".a";
|
||||
@@ -129,9 +129,9 @@ const char *__gnat_default_libgcc_subdir = "lib";
|
||||
|
||||
#elif defined (__linux__) || defined (__GLIBC__)
|
||||
const char *__gnat_object_file_option = "-Wl,@";
|
||||
-const char *__gnat_run_path_option = "-Wl,-rpath,";
|
||||
-char __gnat_shared_libgnat_default = STATIC;
|
||||
-char __gnat_shared_libgcc_default = STATIC;
|
||||
+const char *__gnat_run_path_option = "";
|
||||
+char __gnat_shared_libgnat_default = SHARED;
|
||||
+char __gnat_shared_libgcc_default = SHARED;
|
||||
int __gnat_link_max = 8192;
|
||||
unsigned char __gnat_objlist_file_supported = 1;
|
||||
const char *__gnat_object_library_extension = ".a";
|
||||
--
|
||||
2.50.1
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
From 8773e0cf880da9fe80de7f8a662359664bb0b234 Mon Sep 17 00:00:00 2001
|
||||
From: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Date: Fri, 21 Aug 2020 06:59:43 +0000
|
||||
Subject: [PATCH] build: fix CXXFLAGS_FOR_BUILD passing
|
||||
|
||||
---
|
||||
Makefile.in | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/Makefile.in b/Makefile.in
|
||||
index b1ed67d3d4f..1e039c20550 100644
|
||||
--- a/Makefile.in
|
||||
+++ b/Makefile.in
|
||||
@@ -179,6 +179,7 @@ BUILD_EXPORTS = \
|
||||
# built for the build system to override those in BASE_FLAGS_TO_PASS.
|
||||
EXTRA_BUILD_FLAGS = \
|
||||
CFLAGS="$(CFLAGS_FOR_BUILD)" \
|
||||
+ CXXFLAGS="$(CXXFLAGS_FOR_BUILD)" \
|
||||
LDFLAGS="$(LDFLAGS_FOR_BUILD)"
|
||||
|
||||
# This is the list of directories to built for the host system.
|
||||
--
|
||||
2.50.1
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
From 625b8095796f24389fdda5bb5bc6ff9fbb365813 Mon Sep 17 00:00:00 2001
|
||||
From: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Date: Fri, 21 Aug 2020 07:01:06 +0000
|
||||
Subject: [PATCH] add fortify-headers paths
|
||||
|
||||
---
|
||||
gcc/config/linux.h | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/gcc/config/linux.h b/gcc/config/linux.h
|
||||
index d6280a4d4dd..ba69fb9fad7 100644
|
||||
--- a/gcc/config/linux.h
|
||||
+++ b/gcc/config/linux.h
|
||||
@@ -159,6 +159,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
|
||||
#ifdef NATIVE_SYSTEM_HEADER_DIR
|
||||
#define INCLUDE_DEFAULTS_MUSL_NATIVE \
|
||||
+ { NATIVE_SYSTEM_HEADER_DIR "/fortify", 0, 0, 0, 1, 2 }, \
|
||||
+ { NATIVE_SYSTEM_HEADER_DIR "/fortify", 0, 0, 0, 1, 0 }, \
|
||||
{ NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \
|
||||
{ NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 },
|
||||
#else
|
||||
--
|
||||
2.50.1
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
From c557286adc46536fe033df400c50a880b672cfd6 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
|
||||
Date: Fri, 21 Aug 2020 07:03:00 +0000
|
||||
Subject: [PATCH] Alpine musl package provides libssp_nonshared.a. We link to
|
||||
it unconditionally, as otherwise we get link failures if some objects are
|
||||
-fstack-protector built and final link happens with -fno-stack-protector.
|
||||
This seems to be the common case when bootstrapping gcc, the piepatches do
|
||||
not seem to fully fix the crosstoolchain and bootstrap sequence wrt.
|
||||
stack-protector flag usage.
|
||||
|
||||
---
|
||||
gcc/gcc.cc | 3 +--
|
||||
1 file changed, 1 insertion(+), 2 deletions(-)
|
||||
|
||||
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
|
||||
index 7b0d3d2743b..e46e976a2e8 100644
|
||||
--- a/gcc/gcc.cc
|
||||
+++ b/gcc/gcc.cc
|
||||
@@ -1017,8 +1017,7 @@ proper position among the other output files. */
|
||||
|
||||
#ifndef LINK_SSP_SPEC
|
||||
#ifdef TARGET_LIBC_PROVIDES_SSP
|
||||
-#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
|
||||
- "|fstack-protector-strong|fstack-protector-explicit:}"
|
||||
+#define LINK_SSP_SPEC "-lssp_nonshared"
|
||||
#else
|
||||
#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
|
||||
"|fstack-protector-strong|fstack-protector-explicit" \
|
||||
--
|
||||
2.50.1
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
From d698fead9d201ef032e2e978898864335a9ab513 Mon Sep 17 00:00:00 2001
|
||||
From: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Date: Fri, 21 Aug 2020 07:03:42 +0000
|
||||
Subject: [PATCH] DP: Use --push-state/--pop-state for gold as well when
|
||||
linking libtsan.
|
||||
|
||||
---
|
||||
gcc/gcc.cc | 16 ++++++++--------
|
||||
1 file changed, 8 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
|
||||
index e46e976a2e8..607c8ca1d42 100644
|
||||
--- a/gcc/gcc.cc
|
||||
+++ b/gcc/gcc.cc
|
||||
@@ -775,10 +775,10 @@ proper position among the other output files. */
|
||||
#define LIBASAN_SPEC STATIC_LIBASAN_LIBS
|
||||
#elif defined(HAVE_LD_STATIC_DYNAMIC)
|
||||
#define LIBASAN_SPEC "%{static-libasan:" LD_STATIC_OPTION "}" \
|
||||
- " %{!static-libasan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \
|
||||
+ " %{!static-libasan:--push-state --no-as-needed}" \
|
||||
" -lasan " \
|
||||
" %{static-libasan:" LD_DYNAMIC_OPTION "}" \
|
||||
- " %{!static-libasan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \
|
||||
+ " %{!static-libasan:--pop-state}" \
|
||||
STATIC_LIBASAN_LIBS
|
||||
#else
|
||||
#define LIBASAN_SPEC "-lasan" STATIC_LIBASAN_LIBS
|
||||
@@ -814,10 +814,10 @@ proper position among the other output files. */
|
||||
#define LIBTSAN_SPEC STATIC_LIBTSAN_LIBS
|
||||
#elif defined(HAVE_LD_STATIC_DYNAMIC)
|
||||
#define LIBTSAN_SPEC "%{static-libtsan:" LD_STATIC_OPTION "}" \
|
||||
- " %{!static-libtsan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \
|
||||
+ " %{!static-libtsan:--push-state --no-as-needed}" \
|
||||
" -ltsan " \
|
||||
" %{static-libtsan:" LD_DYNAMIC_OPTION "}" \
|
||||
- " %{!static-libtsan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \
|
||||
+ " %{!static-libtsan:--pop-state}" \
|
||||
STATIC_LIBTSAN_LIBS
|
||||
#else
|
||||
#define LIBTSAN_SPEC "-ltsan" STATIC_LIBTSAN_LIBS
|
||||
@@ -835,10 +835,10 @@ proper position among the other output files. */
|
||||
#define LIBLSAN_SPEC STATIC_LIBLSAN_LIBS
|
||||
#elif defined(HAVE_LD_STATIC_DYNAMIC)
|
||||
#define LIBLSAN_SPEC "%{static-liblsan:" LD_STATIC_OPTION "}" \
|
||||
- " %{!static-liblsan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \
|
||||
+ " %{!static-liblsan:--push-state --no-as-needed}" \
|
||||
" -llsan " \
|
||||
" %{static-liblsan:" LD_DYNAMIC_OPTION "}" \
|
||||
- " %{!static-liblsan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \
|
||||
+ " %{!static-liblsan:--pop-state}" \
|
||||
STATIC_LIBLSAN_LIBS
|
||||
#else
|
||||
#define LIBLSAN_SPEC "-llsan" STATIC_LIBLSAN_LIBS
|
||||
@@ -854,10 +854,10 @@ proper position among the other output files. */
|
||||
" %{static-libubsan|static:%:include(libsanitizer.spec)%(link_libubsan)}"
|
||||
#ifdef HAVE_LD_STATIC_DYNAMIC
|
||||
#define LIBUBSAN_SPEC "%{static-libubsan:" LD_STATIC_OPTION "}" \
|
||||
- " %{!static-libubsan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \
|
||||
+ " %{!static-libubsan:--push-state --no-as-needed}" \
|
||||
" -lubsan " \
|
||||
" %{static-libubsan:" LD_DYNAMIC_OPTION "}" \
|
||||
- " %{!static-libubsan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \
|
||||
+ " %{!static-libubsan:--pop-state}" \
|
||||
STATIC_LIBUBSAN_LIBS
|
||||
#else
|
||||
#define LIBUBSAN_SPEC "-lubsan" STATIC_LIBUBSAN_LIBS
|
||||
--
|
||||
2.50.1
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
From 9cf1916bd52d61ea0fd7a8b6acebb1dc4a1f2488 Mon Sep 17 00:00:00 2001
|
||||
From: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Date: Thu, 6 Jan 2022 03:12:55 +0000
|
||||
Subject: [PATCH] aarch64: disable multilib support
|
||||
|
||||
multilib is unsupported on Alpine GCC
|
||||
---
|
||||
gcc/config/aarch64/t-aarch64-linux | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/gcc/config/aarch64/t-aarch64-linux b/gcc/config/aarch64/t-aarch64-linux
|
||||
index 70e36b3299e..e00c3becd3f 100644
|
||||
--- a/gcc/config/aarch64/t-aarch64-linux
|
||||
+++ b/gcc/config/aarch64/t-aarch64-linux
|
||||
@@ -22,7 +22,7 @@ LIB1ASMSRC = aarch64/lib1funcs.asm
|
||||
LIB1ASMFUNCS = _aarch64_sync_cache_range
|
||||
|
||||
AARCH_BE = $(if $(findstring TARGET_BIG_ENDIAN_DEFAULT=1, $(tm_defines)),_be)
|
||||
-MULTILIB_OSDIRNAMES = mabi.lp64=../lib64$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu)
|
||||
+MULTILIB_OSDIRNAMES = mabi.lp64=../lib
|
||||
MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu)
|
||||
|
||||
MULTILIB_OSDIRNAMES += mabi.ilp32=../libilp32$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu_ilp32)
|
||||
--
|
||||
2.50.1
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
From dc07fb7df8d4f997877d8f98ea9ef8292f738ed3 Mon Sep 17 00:00:00 2001
|
||||
From: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Date: Thu, 6 Jan 2022 03:13:59 +0000
|
||||
Subject: [PATCH] s390x: disable multilib support
|
||||
|
||||
multilib is not supported on Alpine GCC at present
|
||||
---
|
||||
gcc/config/s390/t-linux64 | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/gcc/config/s390/t-linux64 b/gcc/config/s390/t-linux64
|
||||
index cc6ab367072..7f498ee1cdc 100644
|
||||
--- a/gcc/config/s390/t-linux64
|
||||
+++ b/gcc/config/s390/t-linux64
|
||||
@@ -7,5 +7,5 @@
|
||||
|
||||
MULTILIB_OPTIONS = m64/m31
|
||||
MULTILIB_DIRNAMES = 64 32
|
||||
-MULTILIB_OSDIRNAMES = ../lib64$(call if_multiarch,:s390x-linux-gnu)
|
||||
-MULTILIB_OSDIRNAMES += $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:s390-linux-gnu)
|
||||
+MULTILIB_OSDIRNAMES = m64=../lib
|
||||
+MULTILIB_OSDIRNAMES+= m32=../lib32
|
||||
--
|
||||
2.50.1
|
||||
|
||||
@@ -1,81 +0,0 @@
|
||||
From 496067ded4a3698468412e240b899755d92b314c Mon Sep 17 00:00:00 2001
|
||||
From: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Date: Thu, 6 Jan 2022 03:14:33 +0000
|
||||
Subject: [PATCH] ppc64[le]: disable multilib support
|
||||
|
||||
multilib is not presently supported on Alpine GCC
|
||||
---
|
||||
gcc/config/rs6000/t-linux | 6 ++++--
|
||||
gcc/config/rs6000/t-linux64 | 4 ++--
|
||||
gcc/config/rs6000/t-linux64bele | 4 ++--
|
||||
gcc/config/rs6000/t-linux64lebe | 4 ++--
|
||||
4 files changed, 10 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/gcc/config/rs6000/t-linux b/gcc/config/rs6000/t-linux
|
||||
index 4e371255533..128c75c7d39 100644
|
||||
--- a/gcc/config/rs6000/t-linux
|
||||
+++ b/gcc/config/rs6000/t-linux
|
||||
@@ -2,7 +2,8 @@
|
||||
# or soft-float.
|
||||
ifeq (,$(filter $(with_cpu),$(SOFT_FLOAT_CPUS))$(findstring soft,$(with_float)))
|
||||
ifneq (,$(findstring powerpc64,$(target)))
|
||||
-MULTILIB_OSDIRNAMES := .=../lib64$(call if_multiarch,:powerpc64-linux-gnu)
|
||||
+MULTILIB_OSDIRNAMES := m64=../lib
|
||||
+MULTILIB_OSDIRNAMES += m32=../lib32
|
||||
else
|
||||
MULTIARCH_DIRNAME := $(call if_multiarch,powerpc-linux-gnu)
|
||||
endif
|
||||
@@ -10,7 +11,8 @@ ifneq (,$(findstring powerpcle,$(target)))
|
||||
MULTIARCH_DIRNAME := $(subst -linux,le-linux,$(MULTIARCH_DIRNAME))
|
||||
endif
|
||||
ifneq (,$(findstring powerpc64le,$(target)))
|
||||
-MULTILIB_OSDIRNAMES := $(subst -linux,le-linux,$(MULTILIB_OSDIRNAMES))
|
||||
+MULTILIB_OSDIRNAMES := m64=../lib
|
||||
+MULTILIB_OSDIRNAMES += m32=../lib32
|
||||
endif
|
||||
endif
|
||||
|
||||
diff --git a/gcc/config/rs6000/t-linux64 b/gcc/config/rs6000/t-linux64
|
||||
index f56b47c268e..c5f757a6284 100644
|
||||
--- a/gcc/config/rs6000/t-linux64
|
||||
+++ b/gcc/config/rs6000/t-linux64
|
||||
@@ -28,8 +28,8 @@
|
||||
MULTILIB_OPTIONS := m64/m32
|
||||
MULTILIB_DIRNAMES := 64 32
|
||||
MULTILIB_EXTRA_OPTS :=
|
||||
-MULTILIB_OSDIRNAMES := m64=../lib64$(call if_multiarch,:powerpc64-linux-gnu)
|
||||
-MULTILIB_OSDIRNAMES += m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:powerpc-linux-gnu)
|
||||
+MULTILIB_OSDIRNAMES := m64=../lib
|
||||
+MULTILIB_OSDIRNAMES += m32=../lib32
|
||||
|
||||
rs6000-linux.o: $(srcdir)/config/rs6000/rs6000-linux.cc
|
||||
$(COMPILE) $<
|
||||
diff --git a/gcc/config/rs6000/t-linux64bele b/gcc/config/rs6000/t-linux64bele
|
||||
index 97c1ee6fb4d..08d72639cb6 100644
|
||||
--- a/gcc/config/rs6000/t-linux64bele
|
||||
+++ b/gcc/config/rs6000/t-linux64bele
|
||||
@@ -2,6 +2,6 @@
|
||||
|
||||
MULTILIB_OPTIONS += mlittle
|
||||
MULTILIB_DIRNAMES += le
|
||||
-MULTILIB_OSDIRNAMES += $(subst =,.mlittle=,$(subst lible32,lib32le,$(subst lible64,lib64le,$(subst lib,lible,$(subst -linux,le-linux,$(MULTILIB_OSDIRNAMES))))))
|
||||
-MULTILIB_OSDIRNAMES += $(subst $(if $(findstring 64,$(target)),m64,m32).,,$(filter $(if $(findstring 64,$(target)),m64,m32).mlittle%,$(MULTILIB_OSDIRNAMES)))
|
||||
+MULTILIB_OSDIRNAMES = m64=../lib
|
||||
+MULTILIB_OSDIRNAMES+= m32=../lib32
|
||||
MULTILIB_MATCHES := ${MULTILIB_MATCHES_ENDIAN}
|
||||
diff --git a/gcc/config/rs6000/t-linux64lebe b/gcc/config/rs6000/t-linux64lebe
|
||||
index 2e63bdb9fc9..c6e1c5db65d 100644
|
||||
--- a/gcc/config/rs6000/t-linux64lebe
|
||||
+++ b/gcc/config/rs6000/t-linux64lebe
|
||||
@@ -2,6 +2,6 @@
|
||||
|
||||
MULTILIB_OPTIONS += mbig
|
||||
MULTILIB_DIRNAMES += be
|
||||
-MULTILIB_OSDIRNAMES += $(subst =,.mbig=,$(subst libbe32,lib32be,$(subst libbe64,lib64be,$(subst lib,libbe,$(subst le-linux,-linux,$(MULTILIB_OSDIRNAMES))))))
|
||||
-MULTILIB_OSDIRNAMES += $(subst $(if $(findstring 64,$(target)),m64,m32).,,$(filter $(if $(findstring 64,$(target)),m64,m32).mbig%,$(MULTILIB_OSDIRNAMES)))
|
||||
+MULTILIB_OSDIRNAMES := m64=../lib
|
||||
+MULTILIB_OSDIRNAMES += m32=../lib32
|
||||
MULTILIB_MATCHES := ${MULTILIB_MATCHES_ENDIAN}
|
||||
--
|
||||
2.50.1
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
From 3d0f96f3f53a7ff81532f077e9db69d7318db796 Mon Sep 17 00:00:00 2001
|
||||
From: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Date: Thu, 6 Jan 2022 03:14:54 +0000
|
||||
Subject: [PATCH] x86_64: disable multilib support
|
||||
|
||||
multilib is not presently supported on Alpine GCC
|
||||
---
|
||||
gcc/config/i386/t-linux64 | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/gcc/config/i386/t-linux64 b/gcc/config/i386/t-linux64
|
||||
index 64a4a20e64f..9a8eb8dd8d1 100644
|
||||
--- a/gcc/config/i386/t-linux64
|
||||
+++ b/gcc/config/i386/t-linux64
|
||||
@@ -33,6 +33,6 @@
|
||||
comma=,
|
||||
MULTILIB_OPTIONS = $(subst $(comma),/,$(TM_MULTILIB_CONFIG))
|
||||
MULTILIB_DIRNAMES = $(patsubst m%, %, $(subst /, ,$(MULTILIB_OPTIONS)))
|
||||
-MULTILIB_OSDIRNAMES = m64=../lib64$(call if_multiarch,:x86_64-linux-gnu)
|
||||
-MULTILIB_OSDIRNAMES+= m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:i386-linux-gnu)
|
||||
+MULTILIB_OSDIRNAMES = m64=../lib
|
||||
+MULTILIB_OSDIRNAMES+= m32=../lib32
|
||||
MULTILIB_OSDIRNAMES+= mx32=../libx32$(call if_multiarch,:x86_64-linux-gnux32)
|
||||
--
|
||||
2.50.1
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
From b1ab523d6fa44aae8f3ec5f787a8f86f8686bf64 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
|
||||
Date: Mon, 3 Jan 2022 07:14:48 +0100
|
||||
Subject: [PATCH] riscv: disable multilib support
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
From the musl wiki [1]:
|
||||
|
||||
musl does not support sharing an include directory between archs
|
||||
[…], and thus is not compatible with GCC-style multilib. It is
|
||||
recommended that distributions build GCC with multilib disabled,
|
||||
and use library directories named lib, not lib64 or lib32.
|
||||
|
||||
For this reason, we patch existing GCC configuration files (gcc/config)
|
||||
to pin MULTILIB_OSDIRNAMES to lib, there is also a corresponding GCC
|
||||
upstream bug about this issue [2]. Avoiding the use of lib64 and lib32
|
||||
directories is a bit more difficult on the RISC-V architecture. This is
|
||||
due to the fact that the default RISC-V configuration does not only use
|
||||
the lib64 and lib32 directories but also subdirectories within these
|
||||
directories for different RISC-V ABIs (e.g. lp64d, lp64, …) [3].
|
||||
|
||||
This patch aligns the RISC-V configuration with other architectures by
|
||||
pinning MULTILIB_OSDIRNAMES to lib for rv64gc (our default RISC-V
|
||||
-march). Furthermore, this patch removes the ABI-specific startfile
|
||||
prefix spec. Since both of these impact the default LIBRARY_PATH [4]
|
||||
this patch thereby aligns the default RISC-V LIBRARY_PATH with that from
|
||||
other Alpine architectures and thereby fixes #13369 [5].
|
||||
|
||||
Incidentally, this also fixes gccgo on riscv64, as without this patch
|
||||
gccgo is otherwise not able to find the *.gox files for the Go standard
|
||||
library.
|
||||
|
||||
[1]: https://wiki.musl-libc.org/guidelines-for-distributions.html#Multilib/multi_arch
|
||||
[2]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90077
|
||||
[3]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103889#c14
|
||||
[4]: https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/gcc.c;h=d4c8746b0aa322286decf92aa72a12f0a393b655;hb=HEAD#l9122
|
||||
[5]: https://gitlab.alpinelinux.org/alpine/aports/-/issues/13369
|
||||
---
|
||||
gcc/config/riscv/linux.h | 8 --------
|
||||
gcc/config/riscv/t-linux | 7 +++++--
|
||||
2 files changed, 5 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/gcc/config/riscv/linux.h b/gcc/config/riscv/linux.h
|
||||
index 282c77b6a7b..07adae3d59c 100644
|
||||
--- a/gcc/config/riscv/linux.h
|
||||
+++ b/gcc/config/riscv/linux.h
|
||||
@@ -61,11 +61,3 @@ along with GCC; see the file COPYING3. If not see
|
||||
%{rdynamic:-export-dynamic} \
|
||||
-dynamic-linker " GNU_USER_DYNAMIC_LINKER "}} \
|
||||
%{static:-static} %{static-pie:-static -pie --no-dynamic-linker -z text}}"
|
||||
-
|
||||
-#define STARTFILE_PREFIX_SPEC \
|
||||
- "/lib" XLEN_SPEC "/" ABI_SPEC "/ " \
|
||||
- "/usr/lib" XLEN_SPEC "/" ABI_SPEC "/ " \
|
||||
- "/lib/ " \
|
||||
- "/usr/lib/ "
|
||||
-
|
||||
-#define RISCV_USE_CUSTOMISED_MULTI_LIB select_by_abi
|
||||
diff --git a/gcc/config/riscv/t-linux b/gcc/config/riscv/t-linux
|
||||
index a6f64f88d25..f88776ec520 100644
|
||||
--- a/gcc/config/riscv/t-linux
|
||||
+++ b/gcc/config/riscv/t-linux
|
||||
@@ -1,5 +1,8 @@
|
||||
-# Only XLEN and ABI affect Linux multilib dir names, e.g. /lib32/ilp32d/
|
||||
-MULTILIB_DIRNAMES := $(patsubst rv32%,lib32,$(patsubst rv64%,lib64,$(MULTILIB_DIRNAMES)))
|
||||
+MULTILIB_OPTIONS := march=rv64gc
|
||||
+MULTILIB_DIRNAMES := rv64gc
|
||||
+
|
||||
+MULTILIB_DIRNAMES := $(patsubst rv32%,lib32,$(patsubst rv64%,lib,$(MULTILIB_DIRNAMES)))
|
||||
MULTILIB_OSDIRNAMES := $(patsubst lib%,../lib%,$(MULTILIB_DIRNAMES))
|
||||
+MULTILIB_MATCHES := march?rv64gc=march?rv64imafdc
|
||||
|
||||
MULTIARCH_DIRNAME := $(call if_multiarch,$(firstword $(subst -, ,$(target)))-linux-gnu)
|
||||
--
|
||||
2.50.1
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
From ee64e5ead8938d5be6cedd674158a25d93711fe3 Mon Sep 17 00:00:00 2001
|
||||
From: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Date: Fri, 21 Aug 2020 07:05:41 +0000
|
||||
Subject: [PATCH] always build libgcc_eh.a
|
||||
|
||||
highly inspired by:
|
||||
http://landley.net/hg/aboriginal/file/7e0747a665ab/sources/patches/gcc-core-libgcceh.patch
|
||||
---
|
||||
libgcc/Makefile.in | 11 ++++++-----
|
||||
1 file changed, 6 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in
|
||||
index 0719fd0615d..80bb8f1622f 100644
|
||||
--- a/libgcc/Makefile.in
|
||||
+++ b/libgcc/Makefile.in
|
||||
@@ -971,8 +971,9 @@ ifneq ($(LIBUNWIND),)
|
||||
all: libunwind.a
|
||||
endif
|
||||
|
||||
+all: libgcc_eh.a
|
||||
ifeq ($(enable_shared),yes)
|
||||
-all: libgcc_eh.a libgcc_s$(SHLIB_EXT)
|
||||
+all: libgcc_s$(SHLIB_EXT)
|
||||
ifneq ($(LIBUNWIND),)
|
||||
all: libunwind$(SHLIB_EXT)
|
||||
libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_EXT)
|
||||
@@ -1177,10 +1178,6 @@ install-libunwind:
|
||||
install-shared:
|
||||
$(mkinstalldirs) $(DESTDIR)$(inst_libdir)
|
||||
|
||||
- $(INSTALL_DATA) libgcc_eh.a $(DESTDIR)$(inst_libdir)/
|
||||
- chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a
|
||||
- $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a
|
||||
-
|
||||
$(subst @multilib_dir@,$(MULTIDIR),$(subst \
|
||||
@shlib_base_name@,libgcc_s,$(subst \
|
||||
@shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIB_INSTALL))))
|
||||
@@ -1197,6 +1194,10 @@ ifeq ($(enable_gcov),yes)
|
||||
$(RANLIB) $(DESTDIR)$(inst_libdir)/libgcov.a
|
||||
endif
|
||||
|
||||
+ $(INSTALL_DATA) libgcc_eh.a $(DESTDIR)$(inst_libdir)/
|
||||
+ chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a
|
||||
+ $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a
|
||||
+
|
||||
parts="$(INSTALL_PARTS)"; \
|
||||
for file in $$parts; do \
|
||||
rm -f $(DESTDIR)$(inst_libdir)/$$file; \
|
||||
--
|
||||
2.50.1
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
From 5adfe740c027fb8dc9931053f55f7eae222e6bb4 Mon Sep 17 00:00:00 2001
|
||||
From: Ariadne Conill <ariadne@ariadne.space>
|
||||
Date: Fri, 25 Jul 2025 02:09:02 -0700
|
||||
Subject: [PATCH] ada: libgnarl: remove use of glibc-specific
|
||||
pthread_rwlockattr_setkind_np
|
||||
|
||||
musl's thread library does not implement it
|
||||
|
||||
Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
|
||||
---
|
||||
gcc/ada/libgnarl/s-osinte__linux.ads | 10 ----------
|
||||
gcc/ada/libgnarl/s-taprop__linux.adb | 7 -------
|
||||
2 files changed, 17 deletions(-)
|
||||
|
||||
diff --git a/gcc/ada/libgnarl/s-osinte__linux.ads b/gcc/ada/libgnarl/s-osinte__linux.ads
|
||||
index 7aeb15da523..5551b701e5a 100644
|
||||
--- a/gcc/ada/libgnarl/s-osinte__linux.ads
|
||||
+++ b/gcc/ada/libgnarl/s-osinte__linux.ads
|
||||
@@ -402,16 +402,6 @@ package System.OS_Interface is
|
||||
(attr : access pthread_rwlockattr_t) return int;
|
||||
pragma Import (C, pthread_rwlockattr_destroy, "pthread_rwlockattr_destroy");
|
||||
|
||||
- PTHREAD_RWLOCK_PREFER_READER_NP : constant := 0;
|
||||
- PTHREAD_RWLOCK_PREFER_WRITER_NP : constant := 1;
|
||||
- PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP : constant := 2;
|
||||
-
|
||||
- function pthread_rwlockattr_setkind_np
|
||||
- (attr : access pthread_rwlockattr_t;
|
||||
- pref : int) return int;
|
||||
- pragma Import
|
||||
- (C, pthread_rwlockattr_setkind_np, "pthread_rwlockattr_setkind_np");
|
||||
-
|
||||
function pthread_rwlock_init
|
||||
(mutex : access pthread_rwlock_t;
|
||||
attr : access pthread_rwlockattr_t) return int;
|
||||
diff --git a/gcc/ada/libgnarl/s-taprop__linux.adb b/gcc/ada/libgnarl/s-taprop__linux.adb
|
||||
index 8f4c835baa7..6df36c7d8f4 100644
|
||||
--- a/gcc/ada/libgnarl/s-taprop__linux.adb
|
||||
+++ b/gcc/ada/libgnarl/s-taprop__linux.adb
|
||||
@@ -409,16 +409,9 @@ package body System.Task_Primitives.Operations is
|
||||
Result : C.int;
|
||||
|
||||
begin
|
||||
- -- Set the rwlock to prefer writer to avoid writers starvation
|
||||
-
|
||||
Result := pthread_rwlockattr_init (RWlock_Attr'Access);
|
||||
pragma Assert (Result = 0);
|
||||
|
||||
- Result := pthread_rwlockattr_setkind_np
|
||||
- (RWlock_Attr'Access,
|
||||
- PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP);
|
||||
- pragma Assert (Result = 0);
|
||||
-
|
||||
Result := pthread_rwlock_init (L.RW'Access, RWlock_Attr'Access);
|
||||
|
||||
pragma Assert (Result in 0 | ENOMEM);
|
||||
--
|
||||
2.50.1
|
||||
|
||||
Loaded 100 of 8014 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user