Pull KDE from kde-linux-packages artifacts instead of building

This commit is contained in:
Lasath Fernando
2024-10-26 06:02:23 +00:00
committed by Nate Graham
parent 19f3ee8e16
commit 977527e910
3 changed files with 80 additions and 140 deletions

View File

@@ -54,8 +54,6 @@ WithNetwork=true
# RootPassword=
# Make sure kernel-install knows where we expect the ESP to be mounted so it can create correct loader entries.
@Environment=BOOT_MNT=/efi-template
# TODO: revisit pulseaudio qt it should be pulled in implicitly but isn't right now
@Environment=KDE_BUILDER_TARGET="pulseaudio-qt workspace dolphin-plugins ffmpegthumbs kdegraphics-thumbnailers kimageformats kio-fuse kio-gdrive kpmcore spectacle xwaylandvideobridge partitionmanager kde-inotify-survey kdeconnect-kde kdenetwork-filesharing"
[Host]
QemuGui=yes

View File

@@ -1,19 +1,23 @@
#!/bin/env python
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
# SPDX-FileCopyrightText: 2024 Harald Sitter <sitter@kde.org>
import os
import subprocess
import shutil
set -xe
if __name__ == '__main__':
debugroot = '/tmp/debugroot'
debugroot='/tmp/debugroot'
mkdir -p "$debugroot"
extension_dir = f'{debugroot}/usr/lib/extension-release.d/'
os.makedirs(extension_dir)
shutil.copy2('/usr/lib/os-release', f'{extension_dir}/extension-release.debug')
# The debug packages are not in a group, so we make
# pacman list every package in the banana-debug repo
pacstrap "$debugroot" $(pacman --sync --list --quiet banana-debug)
tar = 'debug.tar'
subprocess.run(['tar', '-C', f'{debugroot}/', '-cf', tar, '.'])
subprocess.run(['zstd', '-T0', '--rm', tar])
extension_dir="${debugroot}/usr/lib/extension-release.d/"
mkdir -p "$extension_dir"
cp /usr/lib/os-release "${extension_dir}/extension-release.debug"
tar='debug.tar'
tar --directory="$debugroot" --create --file="$tar" usr
# threads 0 means autodetect the number of CPU cores
zstd --threads=0 --rm "$tar"

View File

@@ -7,7 +7,7 @@ set -ex
env
mkdir --mode 0700 /system # for the kdeos-overlay.service
mkdir /snap # for snapd (will get a subvolume mounted into that snapd then mounts the snaps into)
mkdir /snap # for snapd (will get a subvolume mounted into that snapd then mounts the snaps into)
export SYSTEMD_ESP_PATH="$BOOT_MNT"
mkdir --mode 0700 "$SYSTEMD_ESP_PATH"
@@ -20,55 +20,79 @@ mkdir -pv /efi/EFI/Linux
/usr/lib/systemd/systemd-sysupdate --verify=no list # verify=no because we only care if the configs are valid
rm -rfv /efi/
# Each time the kde-linux-packages pipeline runs, it will create a new repository
# So we need to query GitLab to get the latest Job ID and artifacts path
pacman --sync --refresh --noconfirm jq
kde_linux_packages_project_id=19668
# Get the latest pipeline ID
latest_pipeline_id=$(
curl --silent \
"https://invent.kde.org/api/v4/projects/$kde_linux_packages_project_id/pipelines?ref=master&status=success&per_page=1" |
jq -r '.[0].id'
)
# Get the latest job in the pipeline
latest_job_id=$(
curl --silent \
"https://invent.kde.org/api/v4/projects/$kde_linux_packages_project_id/pipelines/$latest_pipeline_id/jobs?scope[]=success&order_by=id&sort=desc" |
jq -r '.[0].id'
)
# Now add its artifacts to the pacman.conf
cat <<- EOF >> /etc/pacman.conf
[banana]
# Signature checking is not needed beacuse the packages are served over HTTPS and we have no mirrors
SigLevel = Never
Server = https://invent.kde.org/fernando/kde-linux-packages/-/jobs/$latest_job_id/artifacts/raw/artifacts/banana
[banana-debug]
SigLevel = Never
Server = https://invent.kde.org/fernando/kde-linux-packages/-/jobs/$latest_job_id/artifacts/raw/artifacts/banana-debug
EOF
pacman --sync --refresh
# Install build and runtime dependencies
packages=(
git base-devel cmake yaml-cpp boost-libs boost dosfstools btrfs-progs glib2-devel
# NOTE: plasma-workspace depends on phonon (to build integration plugins **for** phonon) but doesn't actually
# need a working backend so we build without vlc for now.
# For discover backend
# NOTE: plasma-workspace depends on phonon (to build integration plugins **for** phonon) but doesn't actually
# need a working backend so we build without vlc for now.
# For discover backend
fwupd
# For kio-extras
# For kio-extras
smbclient
# For selenium
# For selenium
python-atspi
# For print-manager
# For print-manager
cups cups-browsed system-config-printer
# For kdenetwork-filesharing
# For kdenetwork-filesharing
samba
# For spectacle
# For spectacle
opencv
# For fingerprint login
# For fingerprint login
fprintd
# For DDC/CI external monitors brightness; https://wiki.archlinux.org/title/backlight
# For DDC/CI external monitors brightness; https://wiki.archlinux.org/title/backlight
ddcutil
# For users KCM
# For users KCM
accountsservice
)
# Install in parallel to improve performance
pacman --sync --refresh --noconfirm "${packages[@]}"
# YAY Builder
# https://preciselab.io/how-to-install-yay-on-pure-archlinux-image/
pacman --sync --noconfirm go
mkdir -p /tmp/yay-build
useradd -m -G wheel builder && passwd -d builder
chown -R builder:builder /tmp/yay-build
echo 'builder ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers.d/builder
su - builder -c "git clone https://aur.archlinux.org/yay.git /tmp/yay-build/yay"
su - builder -c "cd /tmp/yay-build/yay && makepkg --noconfirm"
pacman --noconfirm --upgrade /tmp/yay-build/yay/*.pkg.tar.*
pacman --noconfirm --sync libinih libnsl liburcu lzo python apparmor autoconf-archive go-tools python-docutils squashfs-tools xfsprogs
# For build deps for systemd-bootchart
pacman --noconfirm --sync intltool docbook-xsl
su - builder -c "yay --noconfirm --sync --sudo /bin/true snapd steam-devices-git systemd-bootchart"
pacman --noconfirm --upgrade /home/builder/.cache/yay/snapd/*.pkg.tar.*
pacman --noconfirm --upgrade /home/builder/.cache/yay/steam-devices-git/*.pkg.tar.*
pacman --noconfirm --upgrade /home/builder/.cache/yay/systemd-bootchart/*.pkg.tar.*
touch /var/lib/snapd/apparmor/snap-confine/.keep # this has been gotten lost in the past for unknown reasons
ln -s /snap /var/lib/snapd/snap # try to reconcile different default locations for snap mounts by making the arch path a symlink to the canonical one
userdel --remove builder
rm /etc/sudoers.d/builder
rm -rf /home/builder
# All the KDE we plan to include in the base image
$(pacman --sync --list --quiet banana)
# AUR packages
snapd steam-devices-git systemd-bootchart
# kde-builder dependencies
dbus-python python-yaml python-setproctitle
# for _kdeos-make-debug-archive
arch-install-scripts
)
# Install in parallel to improve performance
# --noconfirm won't replace conflicts so we use `yes`
yes | pacman --sync --refresh --needed "${packages[@]}"
# KDE Builder
whoami
@@ -79,102 +103,16 @@ env
KDE_BUILD_ROOT="$CHROOT_SRCDIR/kde-builder"
export HOME=$KDE_BUILD_ROOT
pacman --sync --noconfirm git dbus-python python-promise python-yaml python-setproctitle
git clone https://invent.kde.org/sdk/kde-builder.git
cd kde-builder
#
export PATH="$SRCDIR/strip:$PATH" # hijack ninja and strip executables
export PATH="$PWD":"$PATH"
export KDESRC_BUILD_IGNORE_MISSING_PROGRAMS=1
# Still need this until the following issue is resolved:
# https://invent.kde.org/sysadmin/repo-metadata/-/issues/12
./kde-builder --install-distro-packages --prompt-answer yes
./kde-builder --generate-config --prompt-answer yes
cat <<- EOF > $KDE_BUILD_ROOT/.config/kde-builder.yaml
# This file controls options to apply when configuring/building projects, and controls which projects are built in the first place.
# List of all options: https://kde-builder.kde.org/en/kdesrc-buildrc/conf-options-table.html
config-version: 2
global:
branch-group: kf6-qt6
# Finds and includes *KDE*-based dependencies into the build. This makes
# it easier to ensure that you have all the projects needed, but the
# dependencies are not very fine-grained so this can result in quite a few
# projects being installed that you didn't need.
include-dependencies: true
source-dir: $KDE_BUILD_ROOT/kde/src # Directory for downloaded source code
build-dir: $KDE_BUILD_ROOT/kde/build # Directory to build KDE into before installing
install-dir: /usr # Directory to install KDE software into
# qt-install-dir: ~/kde/qt # Directory to install Qt if kde-builder supplies it
cmake-options: >
-DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_STRIP=$SRCDIR/strip/strip -DQT_FORCE_ASSERTS=1
# kde-builder sets 2 options which is used in options like make-options or set-env
# to help manage the number of compile jobs that happen during a build:
#
# 1. num-cores, which is just the number of detected CPU cores, and can be passed
# to tools like make (needed for parallel build) or ninja (completely optional).
#
# 2. num-cores-low-mem, which is set to the largest value that appears safe for
# particularly heavyweight projects based on total memory, intended for
# projects like qtwebengine.
num-cores: "$(nproc)"
num-cores-low-mem: "$(nproc)"
# Makes the built-from-source Plasma session accessible from the SDDM login screen.
install-login-session: false
# Stop the build process on the first failure. If set to false, when kde-builder
# encounters a build failure, it will attempt to continue building other projects,
# using libraries from the system in cases where they would otherwise be provided
# by a project that has failed to build.
# Unless your system has very up-to-date packages, this is probably not what you want.
stop-on-failure: true
# Use a flat folder layout under ~/kde/src and ~/kde/build
# rather than nested directories
directory-layout: flat
# Use Ninja as cmake generator
cmake-generator: Ninja
# Build with LSP support for everything that supports it
compile-commands-linking: false
compile-commands-export: false
# Generate .idea config files in project directories
# Enable this if you want to use CLion for development
generate-clion-project-config: false
# Generate .vscode config files in project directories
# Enable this if you want to use Visual Studio Code for development
generate-vscode-project-config: false
# Generate copy-pastable files for manual qtcreator config creation
# Enable this if you want to use Qt Creator for development
generate-qtcreator-project-config: false
# Ignore packagekit-qt module
ignore-projects: [packagekit-qt, gpgme]
# With base options set, the remainder of the file is used to define projects to build, in the
# desired order, and set any project-specific options.
# This line includes build configs that are provided in build-configs dir in repo-metadata.
# https://invent.kde.org/sysadmin/repo-metadata/-/tree/master/build-configs
# KDE Builder automatically updates repo-metadata, so you are always using an up-to-date configs.
include \${build-configs-dir}/kde6.yaml: ""
EOF
# No packagekit support in discover please! We don't want discover talking about pacman things.
pacman --remove --noconfirm packagekit libpackagekit-glib || true
cat ~/.config/kde-builder.yaml
# We want word splitting here because KDE_BUILDER_TARGET contains multiple things
# shellcheck disable=SC2086
./kde-builder ${KDE_BUILDER_ARGS} ${KDE_BUILDER_TARGET}
# Calamares
cd /tmp
git clone --depth 1 https://github.com/calamares/calamares