├── flatdeb ├── suites ├── scout_beta.yaml ├── valve-steam-keyring.gpg ├── debian-archive-keyring.gpg ├── ubuntu-archive-keyring.gpg ├── valve-archive-keyring.gpg ├── b05498b7-valve-archive-steam.gpg ├── d0bbf5ae-valve-archive-builder.gpg ├── 518e17e1-debian-archive-jessie-stable.gpg ├── 77e11517-debian-archive-buster-stable.gpg ├── 0d6c9793-debian-archive-bullseye-stable.gpg ├── 1a7b6500-debian-archive-stretch-stable.gpg ├── 2b90d010-debian-archive-jessie-automatic.gpg ├── 3cbbabee-debian-archive-buster-automatic.gpg ├── 8783d481-debian-archive-bookworm-stable.gpg ├── 350947f8-debian-archive-bookworm-automatic.gpg ├── 8abddd96-valve-archive-steamos-release-key.gpg ├── 8dd47936-debian-archive-bullseye-automatic.gpg ├── f66aec98-debian-archive-stretch-automatic.gpg ├── 8ae22ba9-debian-archive-stretch-security-automatic.gpg ├── c857c906-debian-archive-jessie-security-automatic.gpg ├── caa96dfa-debian-archive-buster-security-automatic.gpg ├── 4aad5c5d-debian-archive-bullseye-security-automatic.gpg ├── aec0a8f0-debian-archive-bookworm-security-automatic.gpg ├── medic.yaml ├── scout.yaml ├── steamrt5.yaml ├── sniper.yaml └── soldier.yaml ├── LICENSES ├── LicenseRef-NotApplicable.txt └── MIT.txt ├── .gitignore ├── subprojects └── flatdeb │ ├── Makefile │ ├── .gitignore │ ├── deb-buildapi │ ├── configure │ └── Makefile │ ├── .reuse │ └── dep5 │ ├── apps │ ├── org.debian.packages.hello.yaml │ ├── org.debian.packages.bash_static.yaml │ ├── org.debian.packages.mesa_utils.yaml │ ├── org.debian.packages.openarena.yaml │ └── openarena │ │ └── 0001-Add-experimental-Flatpak-support.patch │ ├── flatdeb │ ├── Dockerfile.in │ ├── put-ldconfig-in-path │ ├── prepare-runtime │ ├── disable-services │ ├── debos-collect-dbgsym.yaml │ ├── symlink-alternatives │ ├── unpack-dbgsym │ ├── debos-collect-source.yaml │ ├── usrmerge │ ├── debootstrap │ ├── clean-up-before-pack │ ├── clean-up-base │ ├── write-manifest │ ├── purge-conffiles │ ├── apt-install │ ├── collect-app-source-code │ ├── dbgsym-use-build-id │ ├── make-flatpak-friendly │ ├── platformize │ ├── debos-base.yaml │ ├── set-build-id │ ├── list-required-source-code │ └── collect-source-code │ ├── runtimes │ ├── net.debian.flatpak.Base.yaml │ └── net.debian.flatpak.Games.yaml │ ├── suites │ ├── buster.yaml │ ├── bullseye.yaml │ ├── stretch.yaml │ ├── bookworm.yaml │ └── trixie.yaml │ ├── t │ ├── pyflakes.sh │ ├── pycodestyle.sh │ ├── shellcheck.sh │ └── mypy.sh │ ├── LICENSES │ └── MIT.txt │ ├── run-in-fakemachine │ ├── README │ └── ci │ └── Jenkinsfile ├── Makefile ├── .reuse └── dep5 ├── COPYING.md ├── brewmaster_beta.yaml ├── t ├── pyflakes.sh ├── pycodestyle.sh └── mypy.sh ├── apps ├── org.debian.packages.mesa_utils.yaml └── com.valvesoftware.Steam.yaml ├── .github └── workflows │ └── build.yml ├── CONTRIBUTING.md ├── runtimes ├── steamrt5.yaml ├── medic.yaml ├── sniper.yaml ├── soldier.yaml └── scout.yaml ├── README.md └── compare-steam-runtime.py /flatdeb: -------------------------------------------------------------------------------- 1 | subprojects/flatdeb -------------------------------------------------------------------------------- /suites/scout_beta.yaml: -------------------------------------------------------------------------------- 1 | scout.yaml -------------------------------------------------------------------------------- /LICENSES/LicenseRef-NotApplicable.txt: -------------------------------------------------------------------------------- 1 | Not believed to be covered by copyright. 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Copyright 2017 Collabora Ltd. 2 | # SPDX-License-Identifier: MIT 3 | 4 | /.flatpak-builder/ 5 | __pycache__/ 6 | -------------------------------------------------------------------------------- /suites/valve-steam-keyring.gpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loathingKernel/flatdeb-steam/master/suites/valve-steam-keyring.gpg -------------------------------------------------------------------------------- /suites/debian-archive-keyring.gpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loathingKernel/flatdeb-steam/master/suites/debian-archive-keyring.gpg -------------------------------------------------------------------------------- /suites/ubuntu-archive-keyring.gpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loathingKernel/flatdeb-steam/master/suites/ubuntu-archive-keyring.gpg -------------------------------------------------------------------------------- /suites/valve-archive-keyring.gpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loathingKernel/flatdeb-steam/master/suites/valve-archive-keyring.gpg -------------------------------------------------------------------------------- /subprojects/flatdeb/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright 2017 Collabora Ltd. 2 | # SPDX-License-Identifier: MIT 3 | 4 | check: 5 | prove -v t/*.sh 6 | -------------------------------------------------------------------------------- /subprojects/flatdeb/.gitignore: -------------------------------------------------------------------------------- 1 | # Copyright 2017 Collabora Ltd. 2 | # SPDX-License-Identifier: MIT 3 | 4 | /.flatpak-builder/ 5 | __pycache__/ 6 | -------------------------------------------------------------------------------- /suites/b05498b7-valve-archive-steam.gpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loathingKernel/flatdeb-steam/master/suites/b05498b7-valve-archive-steam.gpg -------------------------------------------------------------------------------- /suites/d0bbf5ae-valve-archive-builder.gpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loathingKernel/flatdeb-steam/master/suites/d0bbf5ae-valve-archive-builder.gpg -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Copyright 2017 Collabora Ltd. 2 | # SPDX-License-Identifier: MIT 3 | 4 | check: 5 | prove -v t/*.sh 6 | $(MAKE) -C subprojects/flatdeb check 7 | -------------------------------------------------------------------------------- /suites/518e17e1-debian-archive-jessie-stable.gpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loathingKernel/flatdeb-steam/master/suites/518e17e1-debian-archive-jessie-stable.gpg -------------------------------------------------------------------------------- /suites/77e11517-debian-archive-buster-stable.gpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loathingKernel/flatdeb-steam/master/suites/77e11517-debian-archive-buster-stable.gpg -------------------------------------------------------------------------------- /suites/0d6c9793-debian-archive-bullseye-stable.gpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loathingKernel/flatdeb-steam/master/suites/0d6c9793-debian-archive-bullseye-stable.gpg -------------------------------------------------------------------------------- /suites/1a7b6500-debian-archive-stretch-stable.gpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loathingKernel/flatdeb-steam/master/suites/1a7b6500-debian-archive-stretch-stable.gpg -------------------------------------------------------------------------------- /suites/2b90d010-debian-archive-jessie-automatic.gpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loathingKernel/flatdeb-steam/master/suites/2b90d010-debian-archive-jessie-automatic.gpg -------------------------------------------------------------------------------- /suites/3cbbabee-debian-archive-buster-automatic.gpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loathingKernel/flatdeb-steam/master/suites/3cbbabee-debian-archive-buster-automatic.gpg -------------------------------------------------------------------------------- /suites/8783d481-debian-archive-bookworm-stable.gpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loathingKernel/flatdeb-steam/master/suites/8783d481-debian-archive-bookworm-stable.gpg -------------------------------------------------------------------------------- /suites/350947f8-debian-archive-bookworm-automatic.gpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loathingKernel/flatdeb-steam/master/suites/350947f8-debian-archive-bookworm-automatic.gpg -------------------------------------------------------------------------------- /suites/8abddd96-valve-archive-steamos-release-key.gpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loathingKernel/flatdeb-steam/master/suites/8abddd96-valve-archive-steamos-release-key.gpg -------------------------------------------------------------------------------- /suites/8dd47936-debian-archive-bullseye-automatic.gpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loathingKernel/flatdeb-steam/master/suites/8dd47936-debian-archive-bullseye-automatic.gpg -------------------------------------------------------------------------------- /suites/f66aec98-debian-archive-stretch-automatic.gpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loathingKernel/flatdeb-steam/master/suites/f66aec98-debian-archive-stretch-automatic.gpg -------------------------------------------------------------------------------- /suites/8ae22ba9-debian-archive-stretch-security-automatic.gpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loathingKernel/flatdeb-steam/master/suites/8ae22ba9-debian-archive-stretch-security-automatic.gpg -------------------------------------------------------------------------------- /suites/c857c906-debian-archive-jessie-security-automatic.gpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loathingKernel/flatdeb-steam/master/suites/c857c906-debian-archive-jessie-security-automatic.gpg -------------------------------------------------------------------------------- /suites/caa96dfa-debian-archive-buster-security-automatic.gpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loathingKernel/flatdeb-steam/master/suites/caa96dfa-debian-archive-buster-security-automatic.gpg -------------------------------------------------------------------------------- /suites/4aad5c5d-debian-archive-bullseye-security-automatic.gpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loathingKernel/flatdeb-steam/master/suites/4aad5c5d-debian-archive-bullseye-security-automatic.gpg -------------------------------------------------------------------------------- /suites/aec0a8f0-debian-archive-bookworm-security-automatic.gpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loathingKernel/flatdeb-steam/master/suites/aec0a8f0-debian-archive-bookworm-security-automatic.gpg -------------------------------------------------------------------------------- /subprojects/flatdeb/deb-buildapi/configure: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright 2017-2018 Collabora Ltd. 3 | # SPDX-License-Identifier: MIT 4 | 5 | if [ ! -e Makefile ]; then 6 | cp "$(dirname "$0")/Makefile" Makefile 7 | fi 8 | 9 | exit 0 10 | -------------------------------------------------------------------------------- /.reuse/dep5: -------------------------------------------------------------------------------- 1 | Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ 2 | Upstream-Name: flatdeb-steam 3 | Source: https://gitlab.steamos.cloud/steamrt/flatdeb-steam 4 | 5 | Files: suites/*.gpg 6 | Copyright: n/a 7 | License: LicenseRef-NotApplicable 8 | -------------------------------------------------------------------------------- /COPYING.md: -------------------------------------------------------------------------------- 1 | This project's licensing is REUSE-compliant . 2 | See individual files for full details of copyright and licensing, 3 | and see `LICENSES/*.txt` and `subprojects/*/LICENSES/*.txt` for the 4 | license text. 5 | 6 | The preferred license for new contributions is the version of the MIT/X11 7 | license used by Expat, which can be found in `LICENSES/MIT.txt`. 8 | -------------------------------------------------------------------------------- /subprojects/flatdeb/.reuse/dep5: -------------------------------------------------------------------------------- 1 | Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ 2 | Upstream-Name: flatdeb 3 | Source: https://salsa.debian.org/smcv/flatdeb 4 | 5 | Files: 6 | README 7 | Copyright: 2017-2020 Collabora Ltd. 8 | License: MIT 9 | 10 | Files: 11 | apps/openarena/*.patch 12 | Copyright: 2018 Collabora Ltd. 13 | License: GPL-2.0-or-later 14 | -------------------------------------------------------------------------------- /brewmaster_beta.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # Copyright 2017-2019 Collabora Ltd. 3 | # SPDX-License-Identifier: MIT 4 | apt_components: 5 | - main 6 | - contrib 7 | - non-free 8 | sources: 9 | - apt_uri: 'http://repo.steampowered.com/steamos' 10 | keyring: 'valve-archive-keyring.gpg' 11 | - apt_uri: 'http://deb.debian.org/debian' 12 | apt_suite: 'jessie' 13 | keyring: 'debian-archive-keyring.gpg' 14 | - apt_uri: 'http://repo.steampowered.com/steam' 15 | apt_suite: 'precise' 16 | keyring: 'valve-steam-keyring.gpg' 17 | apt_components: 18 | - steam 19 | ... 20 | -------------------------------------------------------------------------------- /subprojects/flatdeb/apps/org.debian.packages.hello.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # Copyright 2017-2018 Collabora Ltd. 3 | # SPDX-License-Identifier: MIT 4 | id: org.debian.packages.hello 5 | branch: master 6 | runtime: net.debian.flatpak.Base.Platform 7 | runtime-version: stretch 8 | sdk: net.debian.flatpak.Base.Sdk 9 | command: hello 10 | modules: 11 | - name: hello 12 | x-flatdeb-apt-packages: 13 | - hello 14 | sources: 15 | - type: file 16 | path: deb-buildapi/configure 17 | dest: '.' 18 | - type: file 19 | path: deb-buildapi/Makefile 20 | ... 21 | -------------------------------------------------------------------------------- /t/pyflakes.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright © 2016-2018 Simon McVittie 3 | # Copyright © 2018 Collabora Ltd. 4 | # 5 | # SPDX-License-Identifier: MIT 6 | 7 | set -e 8 | set -u 9 | 10 | if [ "x${PYFLAKES:=pyflakes3}" = xfalse ] || \ 11 | [ -z "$(command -v "$PYFLAKES")" ]; then 12 | echo "1..0 # SKIP pyflakes3 not found" 13 | elif "${PYFLAKES}" \ 14 | *.py \ 15 | >&2; then 16 | echo "1..1" 17 | echo "ok 1 - $PYFLAKES reported no issues" 18 | else 19 | echo "1..1" 20 | echo "not ok 1 # TODO $PYFLAKES issues reported" 21 | fi 22 | 23 | # vim:set sw=4 sts=4 et: 24 | -------------------------------------------------------------------------------- /subprojects/flatdeb/apps/org.debian.packages.bash_static.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # Copyright 2017-2018 Collabora Ltd. 3 | # SPDX-License-Identifier: MIT 4 | id: org.debian.packages.bash_static 5 | branch: stretch 6 | runtime: net.debian.flatpak.Base.Platform 7 | runtime-version: stretch 8 | sdk: net.debian.flatpak.Base.Sdk 9 | command: bash-static 10 | modules: 11 | - name: bash-static 12 | x-flatdeb-apt-packages: 13 | - bash-static 14 | sources: 15 | - type: file 16 | path: deb-buildapi/configure 17 | dest: '.' 18 | - type: file 19 | path: deb-buildapi/Makefile 20 | ... 21 | -------------------------------------------------------------------------------- /t/pycodestyle.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright © 2016-2018 Simon McVittie 3 | # Copyright © 2018 Collabora Ltd. 4 | # 5 | # SPDX-License-Identifier: MIT 6 | 7 | set -e 8 | set -u 9 | 10 | if [ "x${PYCODESTYLE:=pycodestyle}" = xfalse ] || \ 11 | [ -z "$(command -v "$PYCODESTYLE")" ]; then 12 | echo "1..0 # SKIP pycodestyle not found" 13 | elif "${PYCODESTYLE}" \ 14 | *.py \ 15 | >&2; then 16 | echo "1..1" 17 | echo "ok 1 - $PYCODESTYLE reported no issues" 18 | else 19 | echo "1..1" 20 | echo "not ok 1 # TODO $PYCODESTYLE issues reported" 21 | fi 22 | 23 | # vim:set sw=4 sts=4 et: 24 | -------------------------------------------------------------------------------- /subprojects/flatdeb/deb-buildapi/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright 2017-2018 Collabora Ltd. 2 | # SPDX-License-Identifier: MIT 3 | 4 | all: 5 | if ! [ -d /var/lib/dpkg ]; then \ 6 | cp -PRp /usr/var /; \ 7 | fi 8 | set -e; \ 9 | if test -d src; then \ 10 | cd src && \ 11 | dpkg-buildpackage -b -nc -d \ 12 | --build-profiles=pkg.flatpak.app,nocheck,nodoc; \ 13 | fi; \ 14 | done 15 | 16 | # This assumes we don't need to run maintainer scripts. 17 | install: 18 | set -e; \ 19 | for deb in *.deb; do \ 20 | dpkg-deb --fsys-tarfile "$$deb" | \ 21 | tar -xf- -C /app \ 22 | --transform='s,^(\.?/)?(app|usr)/,,x'; \ 23 | done 24 | -------------------------------------------------------------------------------- /subprojects/flatdeb/apps/org.debian.packages.mesa_utils.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # Copyright 2017-2018 Collabora Ltd. 3 | # SPDX-License-Identifier: MIT 4 | id: org.debian.packages.mesa_utils 5 | branch: master 6 | runtime: net.debian.flatpak.Games.Platform 7 | sdk: net.debian.flatpak.Games.Sdk 8 | command: glxgears 9 | finish-args: 10 | - --share=ipc 11 | - --socket=x11 12 | - --device=dri 13 | modules: 14 | - name: mesa-utils 15 | x-flatdeb-apt-packages: 16 | - mesa-utils 17 | sources: 18 | - type: file 19 | path: deb-buildapi/configure 20 | - type: file 21 | path: deb-buildapi/Makefile 22 | ... 23 | -------------------------------------------------------------------------------- /apps/org.debian.packages.mesa_utils.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # Copyright 2017-2018 Collabora Ltd. 3 | # SPDX-License-Identifier: MIT 4 | id: org.debian.packages.mesa_utils 5 | branch: scout_beta 6 | runtime: com.valvesoftware.SteamRuntime.Platform 7 | sdk: com.valvesoftware.SteamRuntime.Sdk 8 | command: glxgears 9 | writable-sdk: true 10 | finish-args: 11 | - --share=ipc 12 | - --socket=x11 13 | - --device=dri 14 | modules: 15 | - name: mesa-utils 16 | x-flatdeb-apt-packages: 17 | - mesa-utils 18 | sources: 19 | - type: file 20 | path: subprojects/flatdeb/deb-buildapi/configure 21 | - type: file 22 | path: subprojects/flatdeb/deb-buildapi/Makefile 23 | ... 24 | -------------------------------------------------------------------------------- /subprojects/flatdeb/flatdeb/Dockerfile.in: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2022 Collabora Ltd. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #ifndef SYSROOT_TARBALL 5 | # error SYSROOT_TARBALL must be defined 6 | #endif 7 | 8 | FROM scratch 9 | ADD SYSROOT_TARBALL / 10 | 11 | #ifdef NOPASSWD 12 | RUN mkdir -p /etc/sudoers.d && echo "%sudo ALL=(ALL:ALL) NOPASSWD: ALL" > /etc/sudoers.d/flatdeb && chmod 0440 /etc/sudoers.d/flatdeb 13 | #endif 14 | 15 | #ifdef OS_RELEASE_LABELS 16 | OS_RELEASE_LABELS 17 | #endif 18 | 19 | #ifdef TOOLBX 20 | LABEL com.github.containers.toolbox="true" 21 | LABEL com.github.debarshiray.toolbox="true" 22 | #endif 23 | 24 | CMD ["/bin/bash"] 25 | 26 | // vim:set sw=4 sts=4 et: 27 | -------------------------------------------------------------------------------- /subprojects/flatdeb/runtimes/net.debian.flatpak.Base.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # Copyright 2017-2020 Collabora Ltd. 3 | # SPDX-License-Identifier: MIT 4 | id_prefix: net.debian.flatpak.Base 5 | 6 | # These packages are required by Toolbx 7 | add_packages: 8 | - libcap2-bin 9 | - mount 10 | - passwd 11 | - sudo 12 | 13 | add_packages_multiarch: 14 | - libc6 15 | - libstdc++6 16 | 17 | toolbx: true 18 | 19 | sdk: 20 | add_packages: 21 | - apt-forktracer 22 | - build-essential 23 | - busybox-static 24 | - ccache 25 | - debhelper 26 | - dpkg-dev 27 | - fakeroot 28 | - gdb 29 | - libc6-dbg 30 | - ltrace 31 | - python3-debian 32 | - strace 33 | - valgrind 34 | ... 35 | -------------------------------------------------------------------------------- /subprojects/flatdeb/suites/buster.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # Copyright 2017-2021 Collabora Ltd. 3 | # SPDX-License-Identifier: MIT 4 | apt_components: 5 | - main 6 | - contrib 7 | can_merge_usr: true 8 | has_automatic_dbgsym: true 9 | sources: 10 | - label: debian 11 | apt_uri: 'http://deb.debian.org/debian' 12 | - label: debug 13 | apt_uri: 'http://deb.debian.org/debian-debug' 14 | apt_suite: '*-debug' 15 | - label: security 16 | apt_uri: 'http://security.debian.org' 17 | apt_suite: '*/updates' 18 | # Contains detached debug symbols for security updates, so is useful 19 | # to have even if we are not installing content from proposed-updates 20 | - label: pu-debug 21 | apt_uri: 'http://deb.debian.org/debian-debug' 22 | apt_suite: '*-proposed-updates-debug' 23 | ... 24 | -------------------------------------------------------------------------------- /subprojects/flatdeb/suites/bullseye.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # Copyright 2017-2021 Collabora Ltd. 3 | # SPDX-License-Identifier: MIT 4 | apt_components: 5 | - main 6 | - contrib 7 | can_merge_usr: true 8 | has_automatic_dbgsym: true 9 | sources: 10 | - label: debian 11 | apt_uri: 'http://deb.debian.org/debian' 12 | - label: debug 13 | apt_uri: 'http://deb.debian.org/debian-debug' 14 | apt_suite: '*-debug' 15 | - label: security 16 | apt_uri: 'http://security.debian.org/debian-security' 17 | apt_suite: '*-security' 18 | # Contains detached debug symbols for security updates, so is useful 19 | # to have even if we are not installing content from proposed-updates 20 | - label: pu-debug 21 | apt_uri: 'http://deb.debian.org/debian-debug' 22 | apt_suite: '*-proposed-updates-debug' 23 | ... 24 | -------------------------------------------------------------------------------- /t/mypy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright © 2016-2018 Simon McVittie 3 | # Copyright © 2018 Collabora Ltd. 4 | # 5 | # SPDX-License-Identifier: MIT 6 | 7 | set -e 8 | set -u 9 | 10 | export MYPYPATH="${PYTHONPATH:=$(pwd)}" 11 | 12 | i=0 13 | for script in \ 14 | *.py \ 15 | ; do 16 | i=$((i + 1)) 17 | if [ "x${MYPY:="$(command -v mypy || echo false)"}" = xfalse ]; then 18 | echo "ok $i - $script # SKIP mypy not found" 19 | elif "${MYPY}" \ 20 | --python-executable="${PYTHON:=python3}" \ 21 | --follow-imports=skip \ 22 | --ignore-missing-imports \ 23 | $script; then 24 | echo "ok $i - $script" 25 | else 26 | echo "not ok $i - $script # TODO mypy issues reported" 27 | fi 28 | done 29 | echo "1..$i" 30 | 31 | # vim:set sw=4 sts=4 et: 32 | -------------------------------------------------------------------------------- /subprojects/flatdeb/suites/stretch.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # Copyright 2017-2021 Collabora Ltd. 3 | # SPDX-License-Identifier: MIT 4 | additional_base_packages: 5 | - apt-transport-https 6 | apt_components: 7 | - main 8 | - contrib 9 | can_merge_usr: true 10 | has_automatic_dbgsym: true 11 | sources: 12 | - label: debian 13 | apt_uri: 'http://deb.debian.org/debian' 14 | - label: debug 15 | apt_uri: 'http://deb.debian.org/debian-debug' 16 | apt_suite: '*-debug' 17 | - label: security 18 | apt_uri: 'http://security.debian.org' 19 | apt_suite: '*/updates' 20 | # Contains detached debug symbols for security updates, so is useful 21 | # to have even if we are not installing content from proposed-updates 22 | - label: pu-debug 23 | apt_uri: 'http://deb.debian.org/debian-debug' 24 | apt_suite: '*-proposed-updates-debug' 25 | ... 26 | -------------------------------------------------------------------------------- /subprojects/flatdeb/suites/bookworm.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # Copyright 2017-2021 Collabora Ltd. 3 | # SPDX-License-Identifier: MIT 4 | additional_base_packages: 5 | - usr-is-merged 6 | apt_components: 7 | - main 8 | - contrib 9 | can_merge_usr: true 10 | has_automatic_dbgsym: true 11 | signed_by: 12 | - /usr/share/keyrings/debian-archive-keyring.gpg 13 | sources: 14 | - label: debian 15 | apt_uri: 'http://deb.debian.org/debian' 16 | - label: debug 17 | apt_uri: 'http://deb.debian.org/debian-debug' 18 | apt_suite: '*-debug' 19 | - label: security 20 | apt_uri: 'http://deb.debian.org/debian-security' 21 | apt_suite: '*-security' 22 | # Contains detached debug symbols for security updates, so is useful 23 | # to have even if we are not installing content from proposed-updates 24 | - label: pu-debug 25 | apt_uri: 'http://deb.debian.org/debian-debug' 26 | apt_suite: '*-proposed-updates-debug' 27 | ... 28 | -------------------------------------------------------------------------------- /subprojects/flatdeb/t/pyflakes.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright © 2016-2018 Simon McVittie 3 | # Copyright © 2018 Collabora Ltd. 4 | # 5 | # SPDX-License-Identifier: MIT 6 | 7 | set -e 8 | set -u 9 | 10 | if [ "${PYFLAKES:=pyflakes3}" = false ] || \ 11 | [ -z "$(command -v "$PYFLAKES")" ]; then 12 | echo "1..0 # SKIP pyflakes3 not found" 13 | elif "${PYFLAKES}" \ 14 | ./*.py \ 15 | flatdeb/apt-install \ 16 | flatdeb/collect-dbgsym \ 17 | flatdeb/collect-app-source-code \ 18 | flatdeb/collect-source-code \ 19 | flatdeb/dbgsym-use-build-id \ 20 | flatdeb/debootstrap \ 21 | flatdeb/list-required-source-code \ 22 | flatdeb/purge-conffiles \ 23 | flatdeb/set-build-id \ 24 | flatdeb/unpack-dbgsym \ 25 | >&2; then 26 | echo "1..1" 27 | echo "ok 1 - $PYFLAKES reported no issues" 28 | else 29 | echo "1..1" 30 | echo "not ok 1 # TODO $PYFLAKES issues reported" 31 | fi 32 | 33 | # vim:set sw=4 sts=4 et: 34 | -------------------------------------------------------------------------------- /subprojects/flatdeb/t/pycodestyle.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright © 2016-2018 Simon McVittie 3 | # Copyright © 2018 Collabora Ltd. 4 | # 5 | # SPDX-License-Identifier: MIT 6 | 7 | set -e 8 | set -u 9 | 10 | if [ "${PYCODESTYLE:=pycodestyle}" = false ] || \ 11 | [ -z "$(command -v "$PYCODESTYLE")" ]; then 12 | echo "1..0 # SKIP pycodestyle not found" 13 | elif "${PYCODESTYLE}" \ 14 | ./*.py \ 15 | flatdeb/apt-install \ 16 | flatdeb/collect-dbgsym \ 17 | flatdeb/collect-app-source-code \ 18 | flatdeb/collect-source-code \ 19 | flatdeb/dbgsym-use-build-id \ 20 | flatdeb/debootstrap \ 21 | flatdeb/list-required-source-code \ 22 | flatdeb/purge-conffiles \ 23 | flatdeb/set-build-id \ 24 | flatdeb/unpack-dbgsym \ 25 | >&2; then 26 | echo "1..1" 27 | echo "ok 1 - $PYCODESTYLE reported no issues" 28 | else 29 | echo "1..1" 30 | echo "not ok 1 # TODO $PYCODESTYLE issues reported" 31 | fi 32 | 33 | # vim:set sw=4 sts=4 et: 34 | -------------------------------------------------------------------------------- /LICENSES/MIT.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /subprojects/flatdeb/LICENSES/MIT.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /subprojects/flatdeb/suites/trixie.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # Copyright 2017-2024 Collabora Ltd. 3 | # SPDX-License-Identifier: MIT 4 | 5 | debootstrap_include: 6 | # Workarounds for https://bugs.debian.org/1069787 7 | - libdb5.3t64 8 | - libssl3t64 9 | 10 | # Ensure that apt works afterwards 11 | - usr-is-merged 12 | 13 | apt_components: 14 | - main 15 | - contrib 16 | 17 | can_merge_usr: true 18 | 19 | has_automatic_dbgsym: true 20 | 21 | signed_by: 22 | - /usr/share/keyrings/debian-archive-keyring.gpg 23 | 24 | sources: 25 | - label: debian 26 | apt_uri: 'http://deb.debian.org/debian' 27 | 28 | - label: debug 29 | apt_uri: 'http://deb.debian.org/debian-debug' 30 | apt_suite: '*-debug' 31 | 32 | - label: security 33 | apt_uri: 'http://deb.debian.org/debian-security' 34 | apt_suite: '*-security' 35 | 36 | # Contains detached debug symbols for security updates, so is useful 37 | # to have even if we are not installing content from proposed-updates 38 | - label: pu-debug 39 | apt_uri: 'http://deb.debian.org/debian-debug' 40 | apt_suite: '*-proposed-updates-debug' 41 | 42 | ... 43 | -------------------------------------------------------------------------------- /subprojects/flatdeb/run-in-fakemachine: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # flatdeb — build Flatpak runtimes from Debian packages 4 | # 5 | # Copyright © 2016-2017 Simon McVittie 6 | # Copyright © 2017-2018 Collabora Ltd. 7 | # 8 | # SPDX-License-Identifier: MIT 9 | # (see run.py) 10 | 11 | set -e 12 | set -o pipefail 13 | set -u 14 | set -x 15 | 16 | cwd="$(pwd)" 17 | here="$(cd "$(dirname "$0")"; pwd)" 18 | cache="${XDG_CACHE_HOME:-"$HOME/.cache"}" 19 | mkdir -p "$cache/flatdeb" 20 | 21 | declare -a fakemachine=(fakemachine) 22 | 23 | # Currently hard-coded: 2G of RAM, 2G of disk-backed scratch space 24 | # (so that /var/tmp will support xattrs) 25 | fakemachine+=(-m 2048) 26 | fakemachine+=(-s 2G) 27 | 28 | fakemachine+=(-v "$cwd") 29 | 30 | if [ "$cwd" != "$here" ]; then 31 | fakemachine+=(-v "$here") 32 | fi 33 | 34 | fakemachine+=(-v "$cache/flatdeb") 35 | 36 | exec \ 37 | "${fakemachine[@]}" \ 38 | -- \ 39 | env \ 40 | PYTHONUNBUFFERED=yes \ 41 | TMPDIR=/scratch \ 42 | XDG_CACHE_HOME="${cache}" \ 43 | "$here/run.py" --chdir "${cwd}" --in-fakemachine \ 44 | "$@" 45 | 46 | # vim:set sw=4 sts=4 et: 47 | -------------------------------------------------------------------------------- /subprojects/flatdeb/t/shellcheck.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Copyright © 2018-2019 Collabora Ltd 4 | # 5 | # SPDX-License-Identifier: MIT 6 | 7 | set -e 8 | set -u 9 | 10 | if ! command -v shellcheck >/dev/null 2>&1; then 11 | echo "1..0 # SKIP shellcheck not available" 12 | exit 0 13 | fi 14 | 15 | n=0 16 | for shell_script in \ 17 | deb-buildapi/configure \ 18 | flatdeb/clean-up-base \ 19 | flatdeb/clean-up-before-pack \ 20 | flatdeb/disable-services \ 21 | flatdeb/make-flatpak-friendly \ 22 | flatdeb/platformize \ 23 | flatdeb/prepare-runtime \ 24 | flatdeb/put-ldconfig-in-path \ 25 | flatdeb/symlink-alternatives \ 26 | flatdeb/usrmerge \ 27 | flatdeb/write-manifest \ 28 | run-in-fakemachine \ 29 | t/*.sh \ 30 | ; do 31 | n=$((n + 1)) 32 | 33 | # Ignore SC2039: we assume a Debian-style shell that has 'local'. 34 | if shellcheck --exclude=SC2039 "$shell_script"; then 35 | echo "ok $n - $shell_script" 36 | else 37 | echo "not ok $n # TODO - $shell_script" 38 | fi 39 | done 40 | 41 | echo "1..$n" 42 | 43 | # vim:set sw=4 sts=4 et ft=sh: 44 | -------------------------------------------------------------------------------- /subprojects/flatdeb/t/mypy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright © 2016-2018 Simon McVittie 3 | # Copyright © 2018 Collabora Ltd. 4 | # 5 | # SPDX-License-Identifier: MIT 6 | 7 | set -e 8 | set -u 9 | 10 | export MYPYPATH="${PYTHONPATH:=$(pwd)}" 11 | 12 | i=0 13 | for script in \ 14 | ./*.py \ 15 | flatdeb/apt-install \ 16 | flatdeb/collect-dbgsym \ 17 | flatdeb/collect-app-source-code \ 18 | flatdeb/collect-source-code \ 19 | flatdeb/dbgsym-use-build-id \ 20 | flatdeb/debootstrap \ 21 | flatdeb/list-required-source-code \ 22 | flatdeb/purge-conffiles \ 23 | flatdeb/set-build-id \ 24 | flatdeb/unpack-dbgsym \ 25 | ; do 26 | i=$((i + 1)) 27 | if [ "${MYPY:="$(command -v mypy || echo false)"}" = false ]; then 28 | echo "ok $i - $script # SKIP mypy not found" 29 | elif "${MYPY}" \ 30 | --python-executable="${PYTHON:=python3}" \ 31 | --follow-imports=skip \ 32 | --ignore-missing-imports \ 33 | "$script"; then 34 | echo "ok $i - $script" 35 | else 36 | echo "not ok $i - $script # TODO mypy issues reported" 37 | fi 38 | done 39 | echo "1..$i" 40 | 41 | # vim:set sw=4 sts=4 et: 42 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Build 2 | 3 | on: 4 | workflow_dispatch: 5 | 6 | jobs: 7 | build: 8 | name: Build runtime 9 | runs-on: ubuntu-latest 10 | steps: 11 | - name: Prepare host 12 | run: sudo apt update && sudo apt install binutils debootstrap debos dpkg-dev flatpak flatpak-builder ostree pigz python3 python3-debian python3-gi python3-yaml systemd-container time 13 | 14 | - name: Checkout 15 | uses: actions/checkout@v4 16 | with: 17 | fetch-depth: 0 18 | fetch-tags: true 19 | submodules: recursive 20 | 21 | - name: Make base 22 | run: subprojects/flatdeb/run.py --suite=sniper --arch=amd64,i386 base 23 | 24 | - name: Make runtime 25 | run: subprojects/flatdeb/run.py --suite=sniper --arch=amd64,i386 --no-collect-source-code --no-debug-symbols --no-generate-source-tarball --ostree-commit --platform runtimes runtimes/sniper.yaml 26 | 27 | - name: Compress flatdeb 28 | run: tar -cfv - ~/.cache/flatdeb/repo | zstd -T0 --ultra -22 > flatdeb.tar.zst 29 | 30 | - name: Upload to artifacts 31 | uses: actions/upload-artifact@v3 32 | with: 33 | name: flatdeb.tar.gz 34 | path: flatdeb.tar.zst -------------------------------------------------------------------------------- /suites/medic.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # Copyright 2017-2021 Collabora Ltd. 3 | # SPDX-License-Identifier: MIT 4 | additional_base_packages: 5 | - steamrt-customizations 6 | - usr-is-merged 7 | apt_components: 8 | - main 9 | - contrib 10 | - non-free 11 | can_merge_usr: true 12 | has_automatic_dbgsym: true 13 | strip_source_version_suffix: '\+bsrt[34][.~].*' 14 | bootstrap_keyring: '8dd47936-debian-archive-bullseye-automatic.gpg' 15 | signed_by: 16 | - /usr/share/keyrings/debian-archive-keyring.gpg 17 | sources: 18 | - label: debian 19 | apt_uri: 'http://deb.debian.org/debian' 20 | apt_suite: 'bookworm' 21 | - label: debian-debug 22 | apt_uri: 'http://deb.debian.org/debian-debug' 23 | apt_suite: 'bookworm-debug' 24 | deb-src: false 25 | # For security updates' detached debug symbols 26 | - label: debian-pu-debug 27 | apt_uri: 'http://deb.debian.org/debian-debug' 28 | apt_suite: 'bookworm-proposed-updates-debug' 29 | deb-src: false 30 | - label: debian-security 31 | apt_uri: 'http://security.debian.org/debian-security' 32 | apt_suite: 'bookworm-security' 33 | - label: steamrt 34 | apt_uri: 'https://repo.steampowered.com/steamrt4/apt' 35 | keyrings: 36 | - 'd0bbf5ae-valve-archive-builder.gpg' 37 | - '8abddd96-valve-archive-steamos-release-key.gpg' 38 | ... 39 | -------------------------------------------------------------------------------- /suites/scout.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # Copyright 2017-2021 Collabora Ltd. 3 | # SPDX-License-Identifier: MIT 4 | additional_base_packages: 5 | - apt-transport-https 6 | - apt 7 | - libapt-pkg4.12 8 | apt_components: 9 | - main 10 | can_merge_usr: after_sysroot 11 | has_automatic_dbgsym: true 12 | debootstrap_script: unstable 13 | strip_source_version_suffix: '\+b?srt[0-9~].*' 14 | sources: 15 | - label: steamrt 16 | apt_uri: 'https://repo.steampowered.com/steamrt1/apt' 17 | keyrings: 18 | - 'd0bbf5ae-valve-archive-builder.gpg' 19 | - '8abddd96-valve-archive-steamos-release-key.gpg' 20 | apt_components: 21 | - main 22 | - label: steamrt-debug 23 | apt_uri: 'https://repo.steampowered.com/steamrt1/apt' 24 | keyrings: 25 | - 'd0bbf5ae-valve-archive-builder.gpg' 26 | - '8abddd96-valve-archive-steamos-release-key.gpg' 27 | apt_components: 28 | - main/debug 29 | deb: true 30 | deb-src: false 31 | - label: steam 32 | for_build: false 33 | for_final: true 34 | apt_uri: 'https://repo.steampowered.com/steam' 35 | apt_suite: 'precise' 36 | keyrings: 37 | - 'b05498b7-valve-archive-steam.gpg' 38 | apt_components: 39 | - steam 40 | - label: ubuntu 41 | for_build: false 42 | for_final: true 43 | apt_uri: 'http://old-releases.ubuntu.com/ubuntu' 44 | apt_suite: 'precise' 45 | keyrings: 46 | - 'ubuntu-archive-keyring.gpg' 47 | apt_components: 48 | - main 49 | - restricted 50 | - universe 51 | - multiverse 52 | -------------------------------------------------------------------------------- /suites/steamrt5.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # Copyright 2017-2023 Collabora Ltd. 3 | # SPDX-License-Identifier: MIT 4 | debootstrap_include: 5 | - libdb5.3t64 6 | - libssl3t64 7 | - usr-is-merged 8 | additional_base_packages: 9 | - steamrt-customizations 10 | apt_components: 11 | - main 12 | - contrib 13 | - non-free 14 | can_merge_usr: true 15 | has_automatic_dbgsym: true 16 | strip_source_version_suffix: '\+bsrt[345][.~].*' 17 | bootstrap_keyring: '350947f8-debian-archive-bookworm-automatic.gpg' 18 | signed_by: 19 | - /usr/share/keyrings/debian-archive-keyring.gpg 20 | sources: 21 | - label: debian 22 | apt_uri: 'http://deb.debian.org/debian' 23 | apt_suite: 'trixie' 24 | - label: debian-debug 25 | apt_uri: 'http://deb.debian.org/debian-debug' 26 | apt_suite: 'trixie-debug' 27 | deb-src: false 28 | # For security updates' detached debug symbols 29 | - label: debian-pu-debug 30 | apt_uri: 'http://deb.debian.org/debian-debug' 31 | apt_suite: 'trixie-proposed-updates-debug' 32 | deb-src: false 33 | - label: debian-unstable 34 | apt_uri: 'http://deb.debian.org/debian' 35 | apt_suite: 'unstable' 36 | - label: debian-unstable-debug 37 | apt_uri: 'http://deb.debian.org/debian-debug' 38 | apt_suite: 'unstable-debug' 39 | deb-src: false 40 | - label: debian-security 41 | apt_uri: 'http://security.debian.org/debian-security' 42 | apt_suite: 'trixie-security' 43 | - label: steamrt 44 | apt_uri: 'https://repo.steampowered.com/steamrt5/apt' 45 | keyrings: 46 | - 'd0bbf5ae-valve-archive-builder.gpg' 47 | - '8abddd96-valve-archive-steamos-release-key.gpg' 48 | ... 49 | -------------------------------------------------------------------------------- /subprojects/flatdeb/flatdeb/put-ldconfig-in-path: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright © 2016-2017 Simon McVittie 4 | # Copyright © 2017-2018 Collabora Ltd. 5 | # 6 | # SPDX-License-Identifier: MIT 7 | # 8 | # Permission is hereby granted, free of charge, to any person obtaining 9 | # a copy of this software and associated documentation files (the 10 | # "Software"), to deal in the Software without restriction, including 11 | # without limitation the rights to use, copy, modify, merge, publish, 12 | # distribute, sublicense, and/or sell copies of the Software, and to 13 | # permit persons to whom the Software is furnished to do so, subject to 14 | # the following conditions: 15 | # 16 | # The above copyright notice and this permission notice shall be included 17 | # in all copies or substantial portions of the Software. 18 | # 19 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 21 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 22 | # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 23 | # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 24 | # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 25 | # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | 27 | set -e 28 | set -u 29 | set -o pipefail 30 | 31 | me="$(basename "$0")" 32 | 33 | if [ "$#" != 1 ] || [ "$1" = '--help' ] || [ "x$(id -u)" != x0 ] || 34 | ! [ -d "$1" ]; then 35 | echo "$me: Usage:" >&2 36 | echo " $me SYSROOT" >&2 37 | echo "" >&2 38 | echo "Run this script as root." >&2 39 | exit 2 40 | fi 41 | 42 | set -x 43 | 44 | sysroot="$1" 45 | cd "$sysroot" 46 | 47 | in_chroot () { 48 | chroot "$sysroot" "$@" 49 | } 50 | 51 | if ! test -e "$sysroot/bin/ldconfig"; then 52 | in_chroot ln -s /sbin/ldconfig /bin/ldconfig 53 | fi 54 | -------------------------------------------------------------------------------- /apps/com.valvesoftware.Steam.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # Copyright 2017 Collabora Ltd. 3 | # SPDX-License-Identifier: MIT 4 | id: com.valvesoftware.Steam 5 | branch: scout_beta 6 | runtime: com.valvesoftware.SteamRuntime.Platform 7 | runtime-version: scout_beta 8 | sdk: com.valvesoftware.SteamRuntime.Sdk 9 | command: steam 10 | tags: 11 | - proprietary 12 | modules: 13 | - name: steam-launcher 14 | x-flatdeb-apt-packages: 15 | - steam-launcher 16 | sources: 17 | - type: file 18 | path: subprojects/flatdeb/deb-buildapi/configure 19 | dest: '.' 20 | - type: file 21 | path: subprojects/flatdeb/deb-buildapi/Makefile 22 | 23 | finish-args: 24 | - --allow=multiarch 25 | - --device=all 26 | - --persist=.steam 27 | - --share=ipc 28 | - --share=network 29 | - --socket=pulseaudio 30 | - --socket=system-bus 31 | - --socket=x11 32 | - --talk-name=org.freedesktop.NetworkManager 33 | - --talk-name=org.gnome.SettingsDaemon 34 | - --talk-name=org.kde.StatusNotifierWatcher 35 | # FIXME: This should be the runtime's job, but requires a generic way 36 | # to detect which flavour of GL driver selection is in use. Maybe one 37 | # day glvnd will save us all. 38 | - --env=LD_LIBRARY_PATH=/app/lib:/usr/lib/x86_64-linux-gnu/mesa:/usr/lib/i386-linux-gnu/mesa 39 | # Assume the Flatpak runtime provides all the libraries needed 40 | - --env=STEAM_RUNTIME=0 41 | 42 | cleanup-commands: 43 | - sed -i -e '2,$s,/usr/,/app/,g' /app/bin/steam 44 | - sed -i -e 's,/usr/bin/steam,/app/bin/steam,g' /app/share/applications/*.desktop 45 | - sed -i -e 's,[$]STEAMPACKAGE[.]desktop,com.valvesoftware.Steam.desktop,g' /app/bin/steam 46 | # Allow launching in beta mode by running with --command= 47 | - ln -s steam /app/bin/steambeta 48 | - ln -s steamdeps /app/bin/steambetadeps 49 | rename-desktop-file: steam.desktop 50 | rename-icon: steam 51 | desktop-file-name-prefix: "flatdeb " 52 | ... 53 | -------------------------------------------------------------------------------- /subprojects/flatdeb/apps/org.debian.packages.openarena.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # Copyright 2017-2018 Collabora Ltd. 3 | # SPDX-License-Identifier: MIT 4 | id: org.debian.packages.openarena 5 | branch: master 6 | runtime: net.debian.flatpak.Games.Platform 7 | sdk: net.debian.flatpak.Games.Sdk 8 | #var: net.debian.flatpak.Games.Sdk.Var 9 | command: openarena 10 | finish-args: 11 | - --filesystem=~/.openarena:create 12 | - --share=ipc 13 | - --share=network 14 | - --socket=pulseaudio 15 | - --socket=wayland 16 | - --socket=x11 17 | - --device=dri 18 | modules: 19 | - name: ioquake3 20 | sources: 21 | - type: git 22 | dest: src 23 | url: https://salsa.debian.org/games-team/ioquake3.git 24 | # Or replace with a local checkout: 25 | #path: /home/smcv/src/debian/ioquake3 # TODO: edit me 26 | branch: debian/master 27 | - type: file 28 | path: deb-buildapi/configure 29 | - type: file 30 | path: deb-buildapi/Makefile 31 | cleanup: 32 | - ioq3ded* 33 | - qagame*.so 34 | - name: openarena 35 | sources: 36 | - type: git 37 | dest: src 38 | url: https://salsa.debian.org/games-team/openarena.git 39 | # Or replace with a local checkout: 40 | #path: /home/smcv/src/debian/openarena # TODO: edit me 41 | branch: debian/master 42 | - type: file 43 | path: deb-buildapi/configure 44 | - type: file 45 | path: deb-buildapi/Makefile 46 | - type: patch 47 | path: apps/openarena/0001-Add-experimental-Flatpak-support.patch 48 | - name: openarena-data 49 | x-flatdeb-apt-packages: 50 | - openarena-088-data 51 | - openarena-data 52 | - openarena-oacmp1 53 | sources: 54 | - type: file 55 | path: deb-buildapi/configure 56 | - type: file 57 | path: deb-buildapi/Makefile 58 | rename-desktop-file: openarena.desktop 59 | rename-icon: openarena128 60 | desktop-file-name-prefix: "flatdeb " 61 | ... 62 | -------------------------------------------------------------------------------- /suites/sniper.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # Copyright 2017-2021 Collabora Ltd. 3 | # SPDX-License-Identifier: MIT 4 | additional_base_packages: 5 | - steamrt-customizations 6 | apt_components: 7 | - main 8 | - contrib 9 | - non-free 10 | can_merge_usr: after_sysroot 11 | has_automatic_dbgsym: true 12 | strip_source_version_suffix: '\+bsrt3[.~].*' 13 | bootstrap_keyring: '0d6c9793-debian-archive-bullseye-stable.gpg' 14 | sources: 15 | - label: debian 16 | apt_uri: 'http://deb.debian.org/debian' 17 | apt_suite: 'bullseye' 18 | keyrings: 19 | - '8dd47936-debian-archive-bullseye-automatic.gpg' 20 | - '4aad5c5d-debian-archive-bullseye-security-automatic.gpg' 21 | - '0d6c9793-debian-archive-bullseye-stable.gpg' 22 | - label: debian-debug 23 | apt_uri: 'http://deb.debian.org/debian-debug' 24 | apt_suite: 'bullseye-debug' 25 | keyrings: 26 | - '8dd47936-debian-archive-bullseye-automatic.gpg' 27 | - '4aad5c5d-debian-archive-bullseye-security-automatic.gpg' 28 | - '0d6c9793-debian-archive-bullseye-stable.gpg' 29 | deb-src: false 30 | # For security updates' detached debug symbols 31 | - label: debian-pu-debug 32 | apt_uri: 'http://deb.debian.org/debian-debug' 33 | apt_suite: 'bullseye-proposed-updates-debug' 34 | keyrings: 35 | - '8dd47936-debian-archive-bullseye-automatic.gpg' 36 | - '4aad5c5d-debian-archive-bullseye-security-automatic.gpg' 37 | - '0d6c9793-debian-archive-bullseye-stable.gpg' 38 | deb-src: false 39 | - label: debian-security 40 | apt_uri: 'http://security.debian.org/debian-security' 41 | apt_suite: 'bullseye-security' 42 | keyrings: 43 | - '8dd47936-debian-archive-bullseye-automatic.gpg' 44 | - '4aad5c5d-debian-archive-bullseye-security-automatic.gpg' 45 | - '0d6c9793-debian-archive-bullseye-stable.gpg' 46 | - label: steamrt 47 | apt_uri: 'https://repo.steampowered.com/steamrt3/apt' 48 | keyrings: 49 | - 'd0bbf5ae-valve-archive-builder.gpg' 50 | - '8abddd96-valve-archive-steamos-release-key.gpg' 51 | ... 52 | -------------------------------------------------------------------------------- /subprojects/flatdeb/runtimes/net.debian.flatpak.Games.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # Copyright 2017-2020 Collabora Ltd. 3 | # SPDX-License-Identifier: MIT 4 | id_prefix: net.debian.flatpak.Games 5 | toolbx: true 6 | 7 | add_packages: 8 | # These packages are required by Toolbx 9 | - libcap2-bin 10 | - mount 11 | - passwd 12 | - sudo 13 | 14 | - libopusfile0 15 | - x11-utils 16 | 17 | add_packages_multiarch: 18 | - libcurl3-gnutls 19 | - libgl1-mesa-dri 20 | - libgl1-mesa-glx 21 | - libgles2-mesa 22 | - libglib2.0-0 23 | - libglu1-mesa 24 | - libjpeg62-turbo 25 | - libogg0 26 | - libopenal1 27 | - libopus0 28 | - libsdl2-2.0-0 29 | - libvorbis0a 30 | - libvorbisfile3 31 | - libxcb-randr0 32 | - libxcb-render0 33 | - zlib1g 34 | 35 | platform: 36 | null: null 37 | 38 | sdk: 39 | add_packages: 40 | - apt-forktracer 41 | - build-essential 42 | - ccache 43 | - debhelper 44 | - dh-exec 45 | - dpkg-dev 46 | - fakeroot 47 | - gdb 48 | - libc6-dbg 49 | - libcurl4-gnutls-dev 50 | - libgl1-mesa-dev 51 | - libjpeg-dev 52 | - libnss-extrausers 53 | - libogg-dev 54 | - libopenal-dev 55 | - libopus-dev 56 | - libopusfile-dev 57 | - libsdl2-dev 58 | - libvorbis-dev 59 | - ltrace 60 | - python3-debian 61 | - strace 62 | - valgrind 63 | - zlib1g-dev 64 | 65 | add-extensions: 66 | # FIXME: This is not properly multiarch-aware, but it's enough for a 67 | # proof of concept. 68 | net.debian.flatpak.GL: 69 | directory: lib/GL 70 | subdirectories: true 71 | no-autodownload: true 72 | autodelete: false 73 | add-ld-path: lib 74 | download-if: active-gl-driver 75 | enable-if: active-gl-driver 76 | merge-dirs: vulkan/icd.d;glvnd/egl_vendor.d 77 | # FIXME: Ideally this should only be added for 64-bit architectures 78 | net.debian.flatpak.GL32: 79 | directory: lib/GL32 80 | subdirectories: true 81 | no-autodownload: true 82 | autodelete: false 83 | add-ld-path: lib 84 | download-if: active-gl-driver 85 | enable-if: active-gl-driver 86 | merge-dirs: vulkan/icd.d;glvnd/egl_vendor.d 87 | ... 88 | -------------------------------------------------------------------------------- /subprojects/flatdeb/flatdeb/prepare-runtime: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright © 2016-2017 Simon McVittie 4 | # Copyright © 2017-2018 Collabora Ltd. 5 | # 6 | # SPDX-License-Identifier: MIT 7 | # 8 | # Permission is hereby granted, free of charge, to any person obtaining 9 | # a copy of this software and associated documentation files (the 10 | # "Software"), to deal in the Software without restriction, including 11 | # without limitation the rights to use, copy, modify, merge, publish, 12 | # distribute, sublicense, and/or sell copies of the Software, and to 13 | # permit persons to whom the Software is furnished to do so, subject to 14 | # the following conditions: 15 | # 16 | # The above copyright notice and this permission notice shall be included 17 | # in all copies or substantial portions of the Software. 18 | # 19 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 21 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 22 | # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 23 | # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 24 | # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 25 | # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | 27 | set -e 28 | set -u 29 | set -o pipefail 30 | 31 | me="$(basename "$0")" 32 | 33 | if [ "$#" != 1 ] || [ "$1" = '--help' ] || [ "x$(id -u)" != x0 ] || 34 | ! [ -d "$1" ]; then 35 | echo "$me: Usage:" >&2 36 | echo " $me SYSROOT" >&2 37 | echo "" >&2 38 | echo "Run this script as root." >&2 39 | exit 2 40 | fi 41 | 42 | set -x 43 | 44 | sysroot="$1" 45 | cd "$sysroot" 46 | 47 | in_chroot () { 48 | local var 49 | 50 | for var in ftp_proxy http_proxy https_proxy no_proxy; do 51 | if [ -n "${!var-}" ]; then 52 | set -- "${var}=${!var}" "$@" 53 | fi 54 | done 55 | 56 | systemd-nspawn --directory="$sysroot" --as-pid2 --pipe --tmpfs=/run/lock \ 57 | --register=no env DEBIAN_FRONTEND=noninteractive \ 58 | "$@" 59 | } 60 | 61 | DEBIAN_FRONTEND=noninteractive 62 | export DEBIAN_FRONTEND 63 | 64 | install -d \ 65 | "$sysroot/run/lock" \ 66 | "$sysroot/var/cache/apt/archives/partial" \ 67 | "$sysroot/var/lib/apt/lists" \ 68 | "$sysroot/var/lock" \ 69 | ${NULL+} 70 | 71 | # Required for openjdk-8-jre-headless 72 | install -d "$sysroot/usr/share/man/man1" 73 | -------------------------------------------------------------------------------- /subprojects/flatdeb/README: -------------------------------------------------------------------------------- 1 | flatdeb 2 | ======= 3 | 4 | flatdeb is a proof of concept for building Flatpak runtimes and apps 5 | from Debian packages. 6 | 7 | Walkthrough 8 | ----------- 9 | 10 | On a Debian 11 'bullseye' or Debian 12 'bookworm' machine: 11 | 12 | apt install \ 13 | binutils \ 14 | cpp \ 15 | debootstrap \ 16 | debos \ 17 | dpkg-dev \ 18 | flatpak \ 19 | flatpak-builder \ 20 | libarchive-tools \ 21 | linux-image-amd64 \ 22 | mount \ 23 | ostree \ 24 | pigz \ 25 | python3 \ 26 | python3-debian \ 27 | python3-gi \ 28 | python3-yaml \ 29 | systemd-container \ 30 | time \ 31 | ${NULL} 32 | 33 | # Required in Debian >= bookworm 34 | test -x /lib/systemd/systemd-resolved || apt install systemd-resolved 35 | 36 | Also edit org.debian.packages.openarena.yaml to specify where you have 37 | put local clones of ioquake3 and openarena if you can't (or don't 38 | want to) clone them via https. 39 | 40 | You will probably want to use a caching proxy such as apt-cacher-ng to 41 | download `.deb` packages, which you can do by prefixing all the commands 42 | below with `env http_proxy=http://192.168.122.1:3142` or similar. 43 | 44 | Finally, put a copy of debian-archive-keyring.gpg in this directory. 45 | 46 | Then you can run: 47 | 48 | ./run.py --suite=stretch --arch=amd64 base 49 | ./run.py --suite=stretch --arch=amd64 runtimes \ 50 | runtimes/net.debian.flatpak.Base.yaml 51 | ./run.py --suite=stretch --arch=amd64 runtimes \ 52 | runtimes/net.debian.flatpak.Games.yaml 53 | ./run.py --suite=stretch --arch=amd64 app \ 54 | apps/org.debian.packages.hello.yaml 55 | ./run.py --suite=stretch --arch=amd64 app \ 56 | apps/org.debian.packages.openarena.yaml 57 | ./run.py --suite=stretch --arch=amd64 app \ 58 | apps/org.debian.packages.mesa_utils.yaml 59 | 60 | To use the ./run.py app subcommand, you must include python3 and python3-debian 61 | in the SDK. 62 | 63 | On the same machine, or a test machine onto which you have copied 64 | `$HOME/.cache/flatdeb/repo` with `rsync` or similar: 65 | 66 | flatpak --user remote-add --no-gpg-verify flatdeb $HOME/.cache/flatdeb/repo 67 | flatpak --user install flatdeb org.debian.packages.hello 68 | flatpak run org.debian.packages.hello 69 | flatpak --user install flatdeb org.debian.packages.openarena 70 | flatpak run org.debian.packages.openarena 71 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | Contributing to flatdeb-steam 2 | ============================= 3 | 4 | 8 | 9 | Reporting bugs 10 | -------------- 11 | 12 | We use for general 13 | issue tracking for the Steam Runtime. If you are not completely sure 14 | what the best way to resolve an issue is, please report issues there 15 | so that they can be triaged. 16 | 17 | If you are sure that an issue specifically deals with the code and 18 | configuration in this repository, the issue tracker for what's in 19 | this repository is at 20 | . 21 | 22 | Proposed patches are welcome, but please describe what the issue is first 23 | (including the steps that can be used to reproduce the issue, the expected 24 | result of those steps, and the actual result). That way, even if the 25 | patch you propose isn't suitable, we can think about other solutions to 26 | the issue. 27 | 28 | The subprojects/flatdeb/ directory 29 | ---------------------------------- 30 | 31 | The actual flatdeb program is maintained in Debian's infrastructure: 32 | [flatdeb](https://salsa.debian.org/smcv/flatdeb). You can create a fork 33 | and open merge requests there. Our policy is that all changes to the 34 | `subprojects/flatdeb/` directory in the `flatdeb-steam` project should 35 | usually be merges from the `flatdeb` project. 36 | 37 | If a bug in flatdeb is causing Steam Runtime issues, please report an 38 | issue at 39 | and refer to it in the flatdeb merge request. 40 | 41 | Because `flatdeb` is not yet stable, we "vendor" a known-good copy of 42 | `flatdeb` into `flatdeb-steam`, so that we can keep track of which version 43 | we are using, and so that incompatible changes in `flatdeb` (if any) 44 | will not affect the Steam Runtime until we are ready to deal with them. 45 | 46 | Controlling what goes into each runtime 47 | --------------------------------------- 48 | 49 | The packages that will go into each runtime are mostly determined by 50 | . Shared libraries are 51 | controlled by `abi/steam-runtime-abi.yaml`, and development libraries 52 | for the SDK are listed in `debian/control`. 53 | 54 | We prefer to keep the lists of packages mostly in `steamrt`, and only 55 | change the recipes in `flatdeb-steam` if there is a structural change. 56 | -------------------------------------------------------------------------------- /suites/soldier.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # Copyright 2017-2021 Collabora Ltd. 3 | # SPDX-License-Identifier: MIT 4 | additional_base_packages: 5 | - steamrt-customizations 6 | apt_components: 7 | - main 8 | - contrib 9 | - non-free 10 | can_merge_usr: after_sysroot 11 | has_automatic_dbgsym: true 12 | strip_source_version_suffix: '\+bsrt2[.~].*' 13 | bootstrap_keyring: '77e11517-debian-archive-buster-stable.gpg' 14 | sources: 15 | - label: debian 16 | apt_uri: 'http://deb.debian.org/debian' 17 | apt_suite: 'buster' 18 | keyrings: 19 | - '8dd47936-debian-archive-bullseye-automatic.gpg' 20 | - '4aad5c5d-debian-archive-bullseye-security-automatic.gpg' 21 | - '0d6c9793-debian-archive-bullseye-stable.gpg' 22 | - '3cbbabee-debian-archive-buster-automatic.gpg' 23 | - 'caa96dfa-debian-archive-buster-security-automatic.gpg' 24 | - '77e11517-debian-archive-buster-stable.gpg' 25 | - label: debian-debug 26 | apt_uri: 'http://deb.debian.org/debian-debug' 27 | apt_suite: 'buster-debug' 28 | keyrings: 29 | - '8dd47936-debian-archive-bullseye-automatic.gpg' 30 | - '4aad5c5d-debian-archive-bullseye-security-automatic.gpg' 31 | - '0d6c9793-debian-archive-bullseye-stable.gpg' 32 | - '3cbbabee-debian-archive-buster-automatic.gpg' 33 | - 'caa96dfa-debian-archive-buster-security-automatic.gpg' 34 | - '77e11517-debian-archive-buster-stable.gpg' 35 | 36 | deb-src: false 37 | # For security updates' detached debug symbols 38 | - label: debian-pu-debug 39 | apt_uri: 'http://deb.debian.org/debian-debug' 40 | apt_suite: 'buster-proposed-updates-debug' 41 | keyrings: 42 | - '8dd47936-debian-archive-bullseye-automatic.gpg' 43 | - '4aad5c5d-debian-archive-bullseye-security-automatic.gpg' 44 | - '0d6c9793-debian-archive-bullseye-stable.gpg' 45 | - '3cbbabee-debian-archive-buster-automatic.gpg' 46 | - 'caa96dfa-debian-archive-buster-security-automatic.gpg' 47 | - '77e11517-debian-archive-buster-stable.gpg' 48 | deb-src: false 49 | - label: debian-security 50 | apt_uri: 'http://security.debian.org/debian-security' 51 | apt_suite: 'buster/updates' 52 | keyrings: 53 | - '8dd47936-debian-archive-bullseye-automatic.gpg' 54 | - '4aad5c5d-debian-archive-bullseye-security-automatic.gpg' 55 | - '0d6c9793-debian-archive-bullseye-stable.gpg' 56 | - '3cbbabee-debian-archive-buster-automatic.gpg' 57 | - 'caa96dfa-debian-archive-buster-security-automatic.gpg' 58 | - '77e11517-debian-archive-buster-stable.gpg' 59 | - label: steamrt 60 | apt_uri: 'https://repo.steampowered.com/steamrt2/apt' 61 | keyrings: 62 | - 'd0bbf5ae-valve-archive-builder.gpg' 63 | - '8abddd96-valve-archive-steamos-release-key.gpg' 64 | ... 65 | -------------------------------------------------------------------------------- /subprojects/flatdeb/flatdeb/disable-services: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright © 2016-2017 Simon McVittie 4 | # Copyright © 2017-2018 Collabora Ltd. 5 | # 6 | # SPDX-License-Identifier: MIT 7 | # 8 | # Permission is hereby granted, free of charge, to any person obtaining 9 | # a copy of this software and associated documentation files (the 10 | # "Software"), to deal in the Software without restriction, including 11 | # without limitation the rights to use, copy, modify, merge, publish, 12 | # distribute, sublicense, and/or sell copies of the Software, and to 13 | # permit persons to whom the Software is furnished to do so, subject to 14 | # the following conditions: 15 | # 16 | # The above copyright notice and this permission notice shall be included 17 | # in all copies or substantial portions of the Software. 18 | # 19 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 21 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 22 | # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 23 | # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 24 | # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 25 | # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | 27 | # Disable services in a chroot. 28 | 29 | set -e 30 | set -u 31 | set -x 32 | set -o pipefail 33 | 34 | me="$(basename "$0")" 35 | 36 | if [ "$#" != 1 ] || [ "$1" = '--help' ] || [ "x$(id -u)" != x0 ] || 37 | ! [ -d "$1" ]; then 38 | echo "$me: Usage:" >&2 39 | echo " $me SYSROOT" >&2 40 | echo "" >&2 41 | echo "Run this script as root." >&2 42 | exit 2 43 | fi 44 | 45 | sysroot="$1" 46 | cd "$sysroot" 47 | 48 | in_chroot () { 49 | chroot "$sysroot" "$@" 50 | } 51 | 52 | set_file_contents () { 53 | file="$1" 54 | permissions="${2-0644}" 55 | 56 | install -d "$sysroot/$(dirname "$file")" 57 | rm -f "$sysroot/$file" 58 | cat > "$sysroot/$file.dpkg-new" 59 | chmod "$permissions" "$sysroot/$file.dpkg-new" 60 | mv -f "$sysroot/$file.dpkg-new" "$sysroot/$file" 61 | } 62 | 63 | # Disable starting services. The containers produced by flatdeb have 64 | # no init anyway. 65 | set_file_contents "usr/sbin/policy-rc.d" 0755 <&2 85 | exit 0 86 | EOF 87 | -------------------------------------------------------------------------------- /subprojects/flatdeb/flatdeb/debos-collect-dbgsym.yaml: -------------------------------------------------------------------------------- 1 | {{/* 2 | Copyright 2018-2023 Collabora Ltd. 3 | SPDX-License-Identifier: MIT 4 | */}} 5 | 6 | {{- $architecture := or .architecture "amd64" -}} 7 | {{- $flatpak_arch := or .flatpak_arch $architecture -}} 8 | {{- $runtime := .runtime -}} 9 | {{- $runtime_branch := or .runtime_branch "master" -}} 10 | {{- $suite := or .suite "stretch" -}} 11 | 12 | {{- $apt_debug := or .apt_debug false -}} 13 | {{- $artifact_prefix := or .artifact_prefix (printf "%s-%s-%s" $runtime $flatpak_arch $runtime_branch) -}} 14 | {{- $automatic_dbgsym := or .automatic_dbgsym false -}} 15 | {{- $ddeb_directory := or .ddeb_directory "" -}} 16 | {{- $ddeb_include_executables := or .ddeb_include_executables "" -}} 17 | {{- $debug_prefix := or .debug_prefix (printf "%s-debug" $artifact_prefix) -}} 18 | {{- $debug_tarball := or .debug_tarball "" -}} 19 | {{- $ospack := or .ospack (printf "base-%s-%s.tar.gz" $suite $architecture) -}} 20 | 21 | architecture: {{ $architecture }} 22 | 23 | actions: 24 | - action: unpack 25 | compression: gz 26 | file: {{ $ospack }} 27 | 28 | - action: run 29 | label: download -dbgsym packages 30 | chroot: false 31 | command: | 32 | set -e 33 | echo 34 | {{ if $ddeb_directory }} 35 | target="$ARTIFACTDIR/{{ $ddeb_directory }}" 36 | {{ else }} 37 | target="/scratch/ddebs" 38 | {{ end }} 39 | install -d "$target" 40 | "$RECIPEDIR/collect-dbgsym" \ 41 | {{ if $apt_debug }}--debug{{ end }} \ 42 | --download="$target" \ 43 | {{ if $ddeb_include_executables }}--include-executables{{ end }} \ 44 | --sysroot="$ROOTDIR" \ 45 | --platform-manifest="$RECIPEDIR/manifest.dpkg.platform" \ 46 | --sdk-manifest="$RECIPEDIR/manifest.dpkg" \ 47 | ${NULL+} 48 | 49 | {{ if $debug_tarball }} 50 | - action: run 51 | label: create -dbgsym tarball 52 | chroot: false 53 | command: | 54 | set -eux 55 | {{ if $ddeb_directory }} 56 | ddeb_directory="$ARTIFACTDIR/{{ $ddeb_directory }}" 57 | {{ else }} 58 | ddeb_directory="/scratch/ddebs" 59 | {{ end }} 60 | rm -fr /scratch/dbgsym 61 | install -d /scratch/dbgsym/sysroot/usr/lib/debug 62 | "$RECIPEDIR/unpack-dbgsym" "$ddeb_directory" /scratch/dbgsym/sysroot 63 | install -m644 "$RECIPEDIR/flatpak-overlay/debug/metadata" /scratch/dbgsym/metadata 64 | mv /scratch/dbgsym/sysroot/usr/lib/debug /scratch/dbgsym/files 65 | rm -fr /scratch/dbgsym/sysroot 66 | "$RECIPEDIR/dbgsym-use-build-id" --debug-dir /scratch/dbgsym/files 67 | tar -cf "$ARTIFACTDIR/{{ $debug_tarball }}" \ 68 | --numeric-owner \ 69 | --sort=name \ 70 | --use-compress-program="pigz -n --rsyncable" \ 71 | -C /scratch/dbgsym \ 72 | files metadata 73 | {{ end }} 74 | -------------------------------------------------------------------------------- /subprojects/flatdeb/flatdeb/symlink-alternatives: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright © 2016-2017 Simon McVittie 4 | # Copyright © 2017-2019 Collabora Ltd. 5 | # 6 | # SPDX-License-Identifier: MIT 7 | # 8 | # Permission is hereby granted, free of charge, to any person obtaining 9 | # a copy of this software and associated documentation files (the 10 | # "Software"), to deal in the Software without restriction, including 11 | # without limitation the rights to use, copy, modify, merge, publish, 12 | # distribute, sublicense, and/or sell copies of the Software, and to 13 | # permit persons to whom the Software is furnished to do so, subject to 14 | # the following conditions: 15 | # 16 | # The above copyright notice and this permission notice shall be included 17 | # in all copies or substantial portions of the Software. 18 | # 19 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 21 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 22 | # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 23 | # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 24 | # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 25 | # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | 27 | set -e 28 | set -u 29 | set -o pipefail 30 | 31 | me="$(basename "$0")" 32 | 33 | if [ "$#" != 1 ] || [ "$1" = '--help' ] || [ "x$(id -u)" != x0 ] || 34 | ! [ -d "$1" ]; then 35 | echo "$me: Usage:" >&2 36 | echo " $me SYSROOT" >&2 37 | echo "" >&2 38 | echo "Run this script as root." >&2 39 | exit 2 40 | fi 41 | 42 | sysroot="$1" 43 | cd "$sysroot" 44 | 45 | in_chroot () { 46 | chroot "$sysroot" "$@" 47 | } 48 | 49 | # shellcheck disable=SC2016 50 | in_chroot find / -xdev '(' \ 51 | -lname '/etc/alternatives/*' -o \ 52 | -lname '/etc/locale.alias' \ 53 | ')' -exec sh -euc ' 54 | while [ $# -gt 0 ]; do 55 | old="$(readlink "$1")" 56 | if target="$(readlink -f "$1")"; then 57 | rel_target="$target" # /usr/bin/more 58 | rel_link="$1" # /usr/bin/pager 59 | target_top="${rel_target#/}" # usr/bin/more 60 | target_top="${target_top%%/*}" # usr 61 | link_top="${rel_link#/}" # usr/bin/pager 62 | link_top="${link_top%%/*}" # usr 63 | if [ "$target_top" = "$link_top" ]; then 64 | # While the part up to the first / is equal, remove it 65 | while [ "${rel_target%%/*}" = "${rel_link%%/*}" ]; do 66 | rel_target="${rel_target#*/}" 67 | rel_link="${rel_link#*/}" 68 | done 69 | # If the link has directories, add enough ../ to escape 70 | while [ "${rel_link#*/}" != "${rel_link}" ]; do 71 | rel_link="${rel_link#*/}" 72 | rel_target="../${rel_target}" 73 | done 74 | fi 75 | echo "Making $1 a symlink to $rel_target (was $old -> ... -> $target)" 76 | ln -fns "$rel_target" "$1" 77 | fi 78 | shift 79 | done 80 | ' \ 81 | 'sh' \ 82 | '{}' '+' 83 | # In the above, 'sh' before '{}' is argv[0] 84 | 85 | # vim:set sw=4 sts=4 et: 86 | -------------------------------------------------------------------------------- /subprojects/flatdeb/flatdeb/unpack-dbgsym: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | 3 | # Copyright 2016-2017 Simon McVittie 4 | # Copyright 2017-2022 Collabora Ltd. 5 | # 6 | # SPDX-License-Identifier: MIT 7 | # 8 | # Permission is hereby granted, free of charge, to any person obtaining 9 | # a copy of this software and associated documentation files (the 10 | # "Software"), to deal in the Software without restriction, including 11 | # without limitation the rights to use, copy, modify, merge, publish, 12 | # distribute, sublicense, and/or sell copies of the Software, and to 13 | # permit persons to whom the Software is furnished to do so, subject to 14 | # the following conditions: 15 | # 16 | # The above copyright notice and this permission notice shall be included 17 | # in all copies or substantial portions of the Software. 18 | # 19 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 21 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 22 | # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 23 | # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 24 | # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 25 | # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | 27 | """ 28 | Unpack detached debug symbols. 29 | """ 30 | 31 | import argparse 32 | import logging 33 | import os 34 | import subprocess 35 | import sys 36 | 37 | try: 38 | import typing 39 | except ImportError: 40 | pass 41 | else: 42 | typing # silence "unused" warnings 43 | 44 | 45 | logger = logging.getLogger('flatdeb.unpack-dbgsym') 46 | 47 | 48 | def main(): 49 | # type: (...) -> None 50 | parser = argparse.ArgumentParser( 51 | description='Unpack -dbgsym packages', 52 | ) 53 | parser.add_argument('ddeb_directory') 54 | parser.add_argument('sysroot') 55 | 56 | args = parser.parse_args() 57 | 58 | for entry in sorted(os.listdir(args.ddeb_directory)): 59 | if entry.endswith('.deb' or entry.endswith('.ddeb')): 60 | subprocess.run( 61 | [ 62 | 'dpkg-deb', 63 | '-x', 64 | os.path.join(args.ddeb_directory, entry), 65 | args.sysroot, 66 | ], 67 | check=True, 68 | ) 69 | 70 | 71 | if __name__ == '__main__': 72 | if sys.stderr.isatty(): 73 | try: 74 | import colorlog 75 | except ImportError: 76 | logging.basicConfig() 77 | else: 78 | formatter = colorlog.ColoredFormatter( 79 | '%(log_color)s%(levelname)s:%(name)s:%(reset)s %(message)s') 80 | handler = logging.StreamHandler() 81 | handler.setFormatter(formatter) 82 | logging.getLogger().addHandler(handler) 83 | else: 84 | logging.basicConfig() 85 | 86 | logging.getLogger().setLevel(logging.DEBUG) 87 | 88 | try: 89 | main() 90 | except KeyboardInterrupt: 91 | raise SystemExit(130) 92 | except subprocess.CalledProcessError as e: 93 | logger.error('%s', e) 94 | raise SystemExit(1) 95 | -------------------------------------------------------------------------------- /subprojects/flatdeb/flatdeb/debos-collect-source.yaml: -------------------------------------------------------------------------------- 1 | {{/* 2 | Copyright 2018-2022 Collabora Ltd. 3 | SPDX-License-Identifier: MIT 4 | */}} 5 | 6 | {{- $architecture := or .architecture "amd64" -}} 7 | {{- $flatpak_arch := or .flatpak_arch $architecture -}} 8 | {{- $runtime := .runtime -}} 9 | {{- $runtime_branch := or .runtime_branch "master" -}} 10 | {{- $suite := or .suite "stretch" -}} 11 | 12 | {{- $artifact_prefix := or .artifact_prefix (printf "%s-%s-%s" $runtime $flatpak_arch $runtime_branch) -}} 13 | {{- $ospack := or .ospack (printf "base-%s-%s.tar.gz" $suite $architecture) -}} 14 | {{- $sources_directory := or .sources_directory "" -}} 15 | {{- $sources_prefix := or .sources_prefix (printf "%s-sources" $artifact_prefix) -}} 16 | {{- $sources_tarball := or .sources_tarball "" -}} 17 | 18 | architecture: {{ $architecture }} 19 | 20 | actions: 21 | - action: unpack 22 | compression: gz 23 | file: {{ $ospack }} 24 | 25 | - action: run 26 | label: collect-source-code 27 | chroot: false 28 | command: | 29 | set -eux 30 | {{ if $sources_directory }} 31 | dir="$ARTIFACTDIR/{{ $sources_directory }}" 32 | {{ else }} 33 | dir="/scratch/src" 34 | {{ end }} 35 | install -m644 "$RECIPEDIR/flatpak-overlay/src/metadata" "$dir/metadata" 36 | echo 37 | "$RECIPEDIR/collect-source-code" \ 38 | {{ if $sources_directory }}--output="$ARTIFACTDIR/{{ $sources_directory }}"{{ end }} \ 39 | --sysroot="$ROOTDIR" \ 40 | "$RECIPEDIR/source-required.txt" 41 | 42 | {{ if $sources_tarball }} 43 | - action: run 44 | label: pack source code 45 | chroot: false 46 | command: | 47 | set -eux 48 | {{ if $sources_directory }} 49 | dir="$ARTIFACTDIR/{{ $sources_directory }}" 50 | {{ else }} 51 | dir="/scratch/src" 52 | {{ end }} 53 | tar -cf "$ARTIFACTDIR/{{ $sources_tarball }}" \ 54 | --numeric-owner \ 55 | --sort=name \ 56 | --transform='s,^./,files/,;s,^files/metadata$,metadata,' \ 57 | --use-compress-program="pigz -n --rsyncable" \ 58 | -C "$dir" \ 59 | . 60 | {{ end }} 61 | 62 | - action: run 63 | label: list of included source code 64 | chroot: false 65 | command: | 66 | set -e 67 | cd "$ARTIFACTDIR" 68 | dir="{{ or $sources_directory "/scratch/src" }}" 69 | cp -v "$dir/Sources.gz" "{{ $sources_prefix }}.deb822.gz" 70 | cp -v "$dir/sources.txt" "{{ $sources_prefix }}.sources.txt" 71 | 72 | - action: run 73 | label: list of missing source code 74 | chroot: false 75 | command: > 76 | set -e; 77 | cd "$ARTIFACTDIR"; 78 | dir="{{ or $sources_directory "/scratch/src" }}"; 79 | test ! -e "$dir/MISSING.txt" || 80 | cp -v "$dir/MISSING.txt" 81 | "{{ $sources_prefix }}.MISSING.txt" 82 | 83 | - action: run 84 | label: included 85 | chroot: false 86 | command: > 87 | set -e; 88 | cd "$ARTIFACTDIR"; 89 | head -n10000 90 | {{ or $sources_directory "/scratch/src" }}/sources.txt 91 | || true 92 | 93 | - action: run 94 | label: missing 95 | chroot: false 96 | command: > 97 | set -e; 98 | cd "$ARTIFACTDIR"; 99 | head -n10000 100 | {{ or $sources_directory "/scratch/src" }}/MISSING.txt 101 | || true 102 | -------------------------------------------------------------------------------- /runtimes/steamrt5.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # Copyright © 2013-2016 Valve Corporation 3 | # Copyright © 2017-2023 Collabora Ltd. 4 | # SPDX-License-Identifier: MIT 5 | 6 | id_prefix: com.valvesoftware.SteamRuntime 7 | toolbx: true 8 | 9 | add_packages_multiarch: 10 | - steamrt-container-host-compat 11 | - steamrt-libs 12 | 13 | add_packages: 14 | - steamrt-container 15 | 16 | post_script: | 17 | set -eux 18 | 19 | if [ -e /usr/share/i18n/locales/en_US ]; then 20 | echo "en_US.UTF-8 UTF-8" > /etc/locale.gen 21 | localedef -v -i en_US -c -f UTF-8 en_US.UTF-8 || : 22 | test -e /usr/lib/locale/locale-archive 23 | fi 24 | 25 | test -d /usr/lib/gconv 26 | test -d /usr/lib/locale 27 | test -d /usr/share/i18n 28 | test -d /usr/share/libdrm 29 | if dpkg-query -W steamrt-container-host-compat:amd64; then 30 | test -d /usr/lib64 31 | test -d /usr/lib64/gconv 32 | test -d /usr/lib64/locale 33 | test -d /usr/lib/x86_64-linux-gnu/gconv 34 | # Arch Linux uses a non-standard ELF interpreter for some binaries in 35 | # the glibc package. We can't create this from 36 | # steamrt-container-host-compat, because that breaks dpkg-shlibdeps. 37 | ln -fns /lib64/ld-linux-x86-64.so.2 /usr/lib/ld-linux-x86-64.so.2 38 | if ! [ -e /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 ] \ 39 | && ! [ -L /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 ] \ 40 | ; then 41 | install -d /usr/lib/x86_64-linux-gnu 42 | ln -s /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 \ 43 | /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 44 | fi 45 | test -e /usr/x86_64-pc-linux-gnu/lib/ld-linux-x86-64.so.2 46 | fi 47 | if dpkg-query -W steamrt-container-host-compat:i386; then 48 | test -d /usr/lib32 49 | test -d /usr/lib32/gconv 50 | test -d /usr/lib32/locale 51 | test -d /usr/lib/i386-linux-gnu/gconv 52 | if ! [ -e /usr/lib/i386-linux-gnu/ld-linux.so.2 ] \ 53 | && ! [ -L /usr/lib/i386-linux-gnu/ld-linux.so.2 ] \ 54 | ; then 55 | install -d /usr/lib/i386-linux-gnu 56 | ln -s /lib/i386-linux-gnu/ld-linux.so.2 \ 57 | /usr/lib/i386-linux-gnu/ld-linux.so.2 58 | fi 59 | test -e /usr/i686-pc-linux-gnu/lib/ld-linux.so.2 60 | fi 61 | # https://github.com/ValveSoftware/steam-runtime/issues/302 62 | # https://github.com/ValveSoftware/steam-for-linux/issues/6310 63 | for prefix in /usr /usr/local; do 64 | install -d "${prefix}/share/steam" 65 | ln -fns "/run/host${prefix}/share/steam/compatibilitytools.d" \ 66 | "${prefix}/share/steam/compatibilitytools.d" 67 | done 68 | 69 | sdk: 70 | add_packages_multiarch: 71 | - steamrt-libdebug: 72 | debug_symbols: true 73 | - steamrt-libdevel 74 | 75 | add_packages: 76 | - steamrt-dev 77 | - steamrt-libdebug-non-multiarch: 78 | debug_symbols: true 79 | 80 | post_script: | 81 | set -eux 82 | 83 | for bin in \ 84 | dos2unix \ 85 | ifconfig \ 86 | ip \ 87 | nc \ 88 | ping \ 89 | ping6 \ 90 | route \ 91 | telnet \ 92 | traceroute \ 93 | traceroute6 \ 94 | unix2dos \ 95 | vi \ 96 | xxd \ 97 | ; do 98 | if [ -e /bin/busybox ] && ! [ -e "/bin/$bin" ] && ! [ -e "/usr/bin/$bin" ]; then 99 | ln -fnsv busybox "/bin/$bin" 100 | fi 101 | done 102 | 103 | ... 104 | -------------------------------------------------------------------------------- /subprojects/flatdeb/flatdeb/usrmerge: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright © 2016-2017 Simon McVittie 4 | # Copyright © 2017-2018 Collabora Ltd. 5 | # 6 | # SPDX-License-Identifier: MIT 7 | # 8 | # Permission is hereby granted, free of charge, to any person obtaining 9 | # a copy of this software and associated documentation files (the 10 | # "Software"), to deal in the Software without restriction, including 11 | # without limitation the rights to use, copy, modify, merge, publish, 12 | # distribute, sublicense, and/or sell copies of the Software, and to 13 | # permit persons to whom the Software is furnished to do so, subject to 14 | # the following conditions: 15 | # 16 | # The above copyright notice and this permission notice shall be included 17 | # in all copies or substantial portions of the Software. 18 | # 19 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 21 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 22 | # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 23 | # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 24 | # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 25 | # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | 27 | # Make files in a sysroot (chroot or similar) undergo the /usr merge. 28 | # This is basically a simpler version of the usrmerge package. Unlike 29 | # the usrmerge package, this does not attempt to set up all /libQUAL 30 | # directories to undergo the /usr merge in future, only the ones that 31 | # already exist. 32 | 33 | set -e 34 | set -u 35 | set -o pipefail 36 | 37 | me="$(basename "$0")" 38 | 39 | if [ "$#" != 1 ] || [ "$1" = '--help' ] || [ "$(id -u)" != 0 ] || 40 | ! [ -d "$1" ]; then 41 | echo "$me: Usage:" >&2 42 | echo " $me SYSROOT" >&2 43 | echo "" >&2 44 | echo "Run this script as root." >&2 45 | exit 2 46 | fi 47 | 48 | sysroot="$1" 49 | cd "$sysroot" 50 | 51 | ls -ld bin sbin lib* 52 | ls -ld usr/* 53 | 54 | in_chroot () { 55 | chroot "$sysroot" "$@" 56 | } 57 | 58 | unmerged=no 59 | 60 | for f in bin sbin lib*; do 61 | if [ "$(in_chroot readlink -f "/$f")" != "/usr/$f" ]; then 62 | unmerged=yes 63 | fi 64 | done 65 | 66 | if [ "$unmerged" = no ]; then 67 | exit 0 68 | fi 69 | 70 | usrmerge () { 71 | local f="$1" 72 | 73 | in_chroot ls -dl "$f" "/usr$f" >&2 || true 74 | if [ "$(in_chroot readlink "$f")" = "/usr$f" ]; then 75 | echo "$me: Removing $f in favour of /usr$f" >&2 76 | rm -v -f "$sysroot$f" 77 | elif [ "$(in_chroot readlink "/usr$f")" = "$f" ]; then 78 | echo "$me: Removing /usr$f in favour of $f" >&2 79 | rm -v -f "$sysroot/usr$f" 80 | elif [ "$(in_chroot readlink -f "/usr$f")" = \ 81 | "$(in_chroot readlink -f "$f")" ]; then 82 | echo "$me: /usr$f and $f are functionally identical" >&2 83 | rm -v -f "$sysroot$f" 84 | else 85 | echo "$me: Cannot merge $f with /usr$f" >&2 86 | exit 1 87 | fi 88 | } 89 | 90 | ( find bin sbin lib* -not -xtype d -print0 ) | 91 | while read -r -d '' f; do 92 | if chroot "$sysroot" test -e "/usr/$f"; then 93 | usrmerge "/$f" 94 | fi 95 | done 96 | 97 | for f in bin sbin lib*; do 98 | if [ -L "$f" ]; then 99 | rm -v -f "$f" >&2 100 | else 101 | echo "$f" 102 | fi 103 | done | tar -cf- -T- | tar -C usr -xf- 104 | 105 | rm -fr bin sbin lib* 106 | ln -vs usr/bin usr/sbin usr/lib* . 107 | -------------------------------------------------------------------------------- /subprojects/flatdeb/flatdeb/debootstrap: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | 3 | # flatdeb — build Flatpak runtimes from Debian packages 4 | # Copyright © 2016-2017 Simon McVittie 5 | # Copyright © 2017-2024 Collabora Ltd. 6 | # SPDX-License-Identifier: MIT 7 | 8 | """ 9 | Install the given packages. 10 | 11 | This is basically debos' debootstrap action, but with more options. 12 | """ 13 | 14 | import argparse 15 | import logging 16 | import os 17 | import subprocess 18 | import sys 19 | from contextlib import suppress 20 | from pathlib import Path 21 | 22 | 23 | logger = logging.getLogger('flatdeb.debootstrap') 24 | 25 | 26 | def main() -> None: 27 | parser = argparse.ArgumentParser( 28 | description='Create a basic chroot' 29 | ) 30 | parser.add_argument('--arch', default='') 31 | parser.add_argument('--components', default='') 32 | parser.add_argument('--exclude', default='') 33 | parser.add_argument('--include', default='') 34 | parser.add_argument('--keyring-file', default='') 35 | parser.add_argument('--merged-usr', action='store_true', default=None) 36 | parser.add_argument( 37 | '--no-merged-usr', action='store_false', dest='merged_usr', 38 | ) 39 | parser.add_argument('--script', default='') 40 | parser.add_argument('suite') 41 | parser.add_argument('sysroot') 42 | parser.add_argument('mirror') 43 | 44 | args = parser.parse_args() 45 | argv = ['debootstrap'] 46 | 47 | if args.arch: 48 | argv.append(f'--arch={args.arch}') 49 | 50 | if args.components: 51 | argv.append(f'--components={args.components}') 52 | 53 | if args.exclude: 54 | argv.append(f'--exclude={args.exclude}') 55 | 56 | if args.include: 57 | argv.append(f'--include={args.include}') 58 | 59 | if args.keyring_file: 60 | if args.keyring_file.startswith('/'): 61 | prefix = '' 62 | else: 63 | prefix = os.environ['RECIPEDIR'] + '/' 64 | 65 | argv.append(f'--keyring={prefix}{args.keyring_file}') 66 | else: 67 | argv.append('--no-check-gpg') 68 | 69 | if args.merged_usr: 70 | argv.append('--merged-usr') 71 | elif args.merged_usr is not None: 72 | argv.append('--no-merged-usr') 73 | 74 | argv.append('--variant=minbase') 75 | argv.append(args.suite) 76 | argv.append(args.sysroot) 77 | argv.append(args.mirror) 78 | 79 | if args.script: 80 | argv.append(args.script) 81 | 82 | try: 83 | subprocess.check_call(argv) 84 | except subprocess.CalledProcessError: 85 | with open( 86 | str(Path(args.sysroot, 'debootstrap', 'debootstrap.log')) 87 | ) as reader: 88 | for line in reader: 89 | logger.error(line) 90 | 91 | raise 92 | 93 | with suppress(FileNotFoundError): 94 | Path(args.sysroot, 'etc', 'resolv.conf').unlink() 95 | 96 | subprocess.call(['chroot', args.sysroot, 'apt-get', 'clean']) 97 | 98 | 99 | if __name__ == '__main__': 100 | if sys.stderr.isatty(): 101 | try: 102 | import colorlog 103 | except ImportError: 104 | logging.basicConfig() 105 | else: 106 | formatter = colorlog.ColoredFormatter( 107 | '%(log_color)s%(levelname)s:%(name)s:%(reset)s %(message)s') 108 | handler = logging.StreamHandler() 109 | handler.setFormatter(formatter) 110 | logging.getLogger().addHandler(handler) 111 | else: 112 | logging.basicConfig() 113 | 114 | logging.getLogger().setLevel(logging.DEBUG) 115 | 116 | try: 117 | main() 118 | except KeyboardInterrupt: 119 | raise SystemExit(130) 120 | except subprocess.CalledProcessError as e: 121 | logger.error('%s', e) 122 | raise SystemExit(1) 123 | -------------------------------------------------------------------------------- /subprojects/flatdeb/flatdeb/clean-up-before-pack: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright © 2016-2017 Simon McVittie 4 | # Copyright © 2017-2018 Collabora Ltd. 5 | # 6 | # SPDX-License-Identifier: MIT 7 | # 8 | # Permission is hereby granted, free of charge, to any person obtaining 9 | # a copy of this software and associated documentation files (the 10 | # "Software"), to deal in the Software without restriction, including 11 | # without limitation the rights to use, copy, modify, merge, publish, 12 | # distribute, sublicense, and/or sell copies of the Software, and to 13 | # permit persons to whom the Software is furnished to do so, subject to 14 | # the following conditions: 15 | # 16 | # The above copyright notice and this permission notice shall be included 17 | # in all copies or substantial portions of the Software. 18 | # 19 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 21 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 22 | # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 23 | # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 24 | # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 25 | # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | 27 | set -e 28 | set -u 29 | set -o pipefail 30 | 31 | me="$(basename "$0")" 32 | 33 | if [ "$#" != 1 ] || [ "$1" = '--help' ] || [ "x$(id -u)" != x0 ] || 34 | ! [ -d "$1" ]; then 35 | echo "$me: Usage:" >&2 36 | echo " $me SYSROOT" >&2 37 | echo "" >&2 38 | echo "Run this script as root." >&2 39 | exit 2 40 | fi 41 | 42 | sysroot="$1" 43 | cd "$sysroot" 44 | 45 | set_file_contents () { 46 | file="$1" 47 | permissions="${2-0644}" 48 | 49 | install -d "$sysroot/$(dirname "$file")" 50 | rm -f "$sysroot/$file" 51 | cat > "$sysroot/$file.dpkg-new" 52 | chmod "$permissions" "$sysroot/$file.dpkg-new" 53 | mv -f "$sysroot/$file.dpkg-new" "$sysroot/$file" 54 | } 55 | 56 | in_chroot () { 57 | chroot "$sysroot" "$@" 58 | } 59 | 60 | rm -fr \ 61 | etc/.pwd.lock \ 62 | etc/group- \ 63 | etc/machine-id \ 64 | etc/passwd- \ 65 | etc/shadow- \ 66 | etc/subgid- \ 67 | etc/subuid- \ 68 | home \ 69 | media \ 70 | mnt \ 71 | opt \ 72 | root \ 73 | run \ 74 | srv \ 75 | tmp \ 76 | var/cache \ 77 | var/lib/aptitude/pkgstates.old \ 78 | var/lib/dbus/machine-id \ 79 | var/lib/dpkg/available-old \ 80 | var/lib/dpkg/diversions-old \ 81 | var/lib/dpkg/status-old \ 82 | var/lib/urandom \ 83 | var/lock \ 84 | var/tmp \ 85 | ${NULL+} 86 | 87 | rm -f "$sysroot/var/log/apt/eipp.log.xz" 88 | rm -f "$sysroot/var/log/bootstrap.log" 89 | set_file_contents var/log/alternatives.log . 20 | */ 21 | @Library('steamos-ci') _ 22 | 23 | pipeline { 24 | agent { 25 | docker { 26 | label 'docker-slave' 27 | args '--device=/dev/kvm' 28 | image "docker-registry.internal.collabora.com/steamos/package-builder:stretch" 29 | registryUrl 'https://docker-registry.internal.collabora.com' 30 | registryCredentialsId 'ccu-docker-internal-collabora-com' 31 | alwaysPull true 32 | } 33 | } 34 | 35 | environment { 36 | GOBIN="${env.WORKSPACE}/bin" 37 | GOPATH="${env.WORKSPACE}/go" 38 | HOME="${env.WORKSPACE}" 39 | NSS_WRAPPER_PASSWD="${env.WORKSPACE}/passwd" 40 | NSS_WRAPPER_GROUP="/dev/null" 41 | PATH="${env.WORKSPACE}/bin:/usr/local/bin:/usr/bin:/bin" 42 | PYTHONUNBUFFERED="1" 43 | TMPDIR="${env.WORKSPACE}" 44 | XDG_CACHE_HOME="${env.WORKSPACE}/cache" 45 | suites="stretch" 46 | archs="amd64 i386" 47 | runtimes="Base Games" 48 | } 49 | 50 | options { 51 | timestamps() 52 | skipDefaultCheckout() 53 | } 54 | 55 | stages { 56 | stage ("setup") { 57 | steps { 58 | sh ''' 59 | set -e 60 | echo "jenkins::$(id -u):$(id -g):Jenkins:$(pwd):/bin/sh" > passwd 61 | mkdir -p "$XDG_CACHE_HOME" 62 | git config --global user.name Jenkins 63 | git config --global user.email nobody@example.com 64 | ''' 65 | checkoutCollaboraGitlab('smcv/flatdeb', 'wip/ci', 'src') 66 | sh ''' 67 | set -e 68 | export LD_PRELOAD=libnss_wrapper.so 69 | 70 | mkdir -p "$HOME/go" 71 | 72 | go get -v -x github.com/go-debos/fakemachine/cmd/fakemachine 73 | go install -v -x github.com/go-debos/fakemachine/cmd/fakemachine 74 | 75 | go get -v -x github.com/go-debos/debos/cmd/debos 76 | go install -v -x github.com/go-debos/debos/cmd/debos 77 | ''' 78 | } 79 | } 80 | 81 | stage ("base") { 82 | steps { 83 | sh ''' 84 | set -e 85 | export LD_PRELOAD=libnss_wrapper.so 86 | cd src 87 | for suite in $suites; do 88 | for arch in $archs; do 89 | ./run.py --suite "$suite" --arch "$arch" base 90 | done 91 | done 92 | ls -sh "$XDG_CACHE_HOME/flatdeb" 93 | ostree refs --repo "$XDG_CACHE_HOME"/flatdeb/repo|LC_ALL=C sort -u 94 | ''' 95 | } 96 | } 97 | 98 | stage ("runtimes") { 99 | steps { 100 | sh ''' 101 | set -e 102 | export LD_PRELOAD=libnss_wrapper.so 103 | cd src 104 | for suite in $suites; do 105 | for arch in $archs; do 106 | for rt in $runtimes; do 107 | ./run.py --suite "$suite" --arch "$arch" runtimes "runtimes/net.debian.flatpak.$rt.yaml" 108 | done 109 | done 110 | done 111 | ls -sh "$XDG_CACHE_HOME/flatdeb" 112 | ostree refs --repo "$XDG_CACHE_HOME"/flatdeb/repo|LC_ALL=C sort -u 113 | ''' 114 | } 115 | } 116 | } 117 | 118 | post { 119 | always { 120 | deleteDir() 121 | } 122 | } 123 | } 124 | /* vim:set sw=2 sts=2 et: */ 125 | -------------------------------------------------------------------------------- /subprojects/flatdeb/flatdeb/clean-up-base: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright © 2016-2017 Simon McVittie 4 | # Copyright © 2017-2018 Collabora Ltd. 5 | # 6 | # SPDX-License-Identifier: MIT 7 | # 8 | # Permission is hereby granted, free of charge, to any person obtaining 9 | # a copy of this software and associated documentation files (the 10 | # "Software"), to deal in the Software without restriction, including 11 | # without limitation the rights to use, copy, modify, merge, publish, 12 | # distribute, sublicense, and/or sell copies of the Software, and to 13 | # permit persons to whom the Software is furnished to do so, subject to 14 | # the following conditions: 15 | # 16 | # The above copyright notice and this permission notice shall be included 17 | # in all copies or substantial portions of the Software. 18 | # 19 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 21 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 22 | # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 23 | # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 24 | # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 25 | # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | 27 | set -e 28 | set -u 29 | set -x 30 | set -o pipefail 31 | 32 | me="$(basename "$0")" 33 | 34 | if [ "$#" != 1 ] || [ "$1" = '--help' ] || [ "x$(id -u)" != x0 ] || 35 | ! [ -d "$1" ]; then 36 | echo "$me: Usage:" >&2 37 | echo " $me SYSROOT" >&2 38 | echo "" >&2 39 | echo "Run this script as root." >&2 40 | exit 2 41 | fi 42 | 43 | sysroot="$1" 44 | cd "$sysroot" 45 | 46 | in_chroot () { 47 | chroot "$sysroot" "$@" 48 | } 49 | 50 | set_file_contents () { 51 | file="$1" 52 | permissions="${2-0644}" 53 | 54 | install -d "$sysroot/$(dirname "$file")" 55 | rm -f "$sysroot/$file" 56 | cat > "$sysroot/$file.dpkg-new" 57 | chmod "$permissions" "$sysroot/$file.dpkg-new" 58 | mv -f "$sysroot/$file.dpkg-new" "$sysroot/$file" 59 | } 60 | 61 | # There is some cleanup that we can do in the base 62 | # tarball rather than in every runtime individually. 63 | # See https://github.com/debuerreotype/debuerreotype 64 | # for further ideas. 65 | 66 | find "$sysroot/usr/share/doc" -xdev -not -name copyright -not -type d -delete 67 | find "$sysroot/usr/share/doc" -depth -xdev -type d -empty -delete 68 | rm -fr "$sysroot/usr/share/doc-base" 69 | rm -fr "$sysroot/usr/share/groff" 70 | rm -fr "$sysroot/usr/share/info" 71 | rm -fr "$sysroot/usr/share/linda" 72 | rm -fr "$sysroot/usr/share/lintian" 73 | rm -fr "$sysroot/usr/share/man" 74 | 75 | rm -f "$sysroot/var/log/apt/eipp.log.xz" 76 | rm -f "$sysroot/var/log/bootstrap.log" 77 | set_file_contents var/log/alternatives.log &2 39 | fi 40 | 41 | echo "$me: Usage" 42 | echo " $me SYSROOT" 43 | echo 44 | echo "Run this script as root." 45 | exit "$status" 46 | } 47 | 48 | getopt_temp="$(getopt -o '' --long \ 49 | 'help,debug' \ 50 | -n "$me" -- "$@")" 51 | 52 | eval set -- "$getopt_temp" 53 | unset getopt_temp 54 | 55 | while [ "$#" -gt 0 ]; do 56 | case "$1" in 57 | (--debug) 58 | debug=yes 59 | shift 60 | ;; 61 | 62 | (--help) 63 | usage 0 64 | # not reached 65 | ;; 66 | 67 | (--) 68 | shift 69 | break 70 | ;; 71 | 72 | (-*) 73 | echo "$me: unknown option: $1" >&2 74 | usage 2 75 | # not reached 76 | ;; 77 | 78 | (*) 79 | break 80 | ;; 81 | esac 82 | done 83 | 84 | if [ "x$(id -u)" != x0 ] || [ "$#" -ne 1 ]; then 85 | usage 2 86 | # not reached 87 | fi 88 | 89 | if [ -n "$debug" ]; then 90 | set -x 91 | fi 92 | 93 | sysroot="$1" 94 | cd "$sysroot" 95 | 96 | in_chroot () { 97 | chroot "$sysroot" "$@" 98 | } 99 | 100 | export DEBIAN_FRONTEND=noninteractive 101 | 102 | exec 3>"$sysroot/usr/manifest.dpkg" 103 | 104 | printf '#Package[:Architecture]\t#Version\t#Source\t#Installed-Size\n' >&3 105 | 106 | # ${} escapes here are for dpkg-query, not sh 107 | # shellcheck disable=SC2016 108 | dpkg_version="$(in_chroot dpkg-query -W -f '${Version}' dpkg)" 109 | 110 | if in_chroot dpkg --compare-versions "$dpkg_version" ge 1.16.2; then 111 | # shellcheck disable=SC2016 112 | in_chroot dpkg-query -W -f \ 113 | '${binary:Package}\t${Version}\t${Source}\t${Installed-Size}\n' \ 114 | | LC_ALL=C sort -u >&3 115 | # shellcheck disable=SC2016 116 | in_chroot dpkg-query -W -f '${binary:Package}\n' \ 117 | | LC_ALL=C sort -u \ 118 | | in_chroot xargs -d '\n' dpkg-query -s \ 119 | | gzip -9nc \ 120 | > "$sysroot/usr/manifest.deb822.gz" 121 | else 122 | # shellcheck disable=SC2016 123 | in_chroot dpkg-query -W -f \ 124 | '${Package}:${Architecture}\t${Version}\t${Source}\t${Installed-Size}\n' \ 125 | | LC_ALL=C sort -u >&3 126 | fi 127 | 128 | exec 3>"$sysroot/usr/manifest.dpkg.built-using" 129 | 130 | printf '#Built-Binary\t#Built-Using-Source\t#Built-Using-Version\n' >&3 131 | 132 | # shellcheck disable=SC2016 133 | in_chroot dpkg-query -W -f '${Package}\t${Built-Using}\n' | perl -ne ' 134 | chomp; 135 | die "Unable to parse dpkg-query output: $_\n" unless /^(\S+)\t(.*)$/; 136 | next unless $2; 137 | my $binary = $1; 138 | my @using = split /,/, $2; 139 | next unless @using; 140 | foreach my $using (@using) { 141 | $using =~ s/ //g; 142 | die "Unable to parse Built-Using: $using\n" 143 | unless $using =~ /^(\S+)\(=(\S+)\)$/; 144 | print "$binary\t$1\t$2\n"; 145 | } 146 | ' | LC_ALL=C sort -u >&3 147 | 148 | # vim:set sw=4 sts=4 et: 149 | -------------------------------------------------------------------------------- /runtimes/medic.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # Copyright © 2013-2016 Valve Corporation 3 | # Copyright © 2017-2021 Collabora Ltd. 4 | # SPDX-License-Identifier: MIT 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining 7 | # a copy of these scripts and associated documentation files (the 8 | # "Software"), to deal in the Software without restriction, including 9 | # without limitation the rights to use, copy, modify, merge, publish, 10 | # distribute, sublicense, and/or sell copies of the Software, and to 11 | # permit persons to whom the Software is furnished to do so, subject to 12 | # the following conditions: 13 | # 14 | # The above copyright notice and this permission notice shall be included 15 | # in all copies or substantial portions of the Software. 16 | # 17 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 20 | # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 21 | # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 22 | # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 23 | # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | 25 | id_prefix: com.valvesoftware.SteamRuntime 26 | toolbx: true 27 | 28 | add_packages_multiarch: 29 | - steamrt-container-host-compat 30 | - steamrt-libs 31 | 32 | add_packages: 33 | - steamrt-container 34 | 35 | post_script: | 36 | set -eux 37 | 38 | if [ -e /usr/share/i18n/locales/en_US ]; then 39 | echo "en_US.UTF-8 UTF-8" > /etc/locale.gen 40 | localedef -v -i en_US -c -f UTF-8 en_US.UTF-8 || : 41 | test -e /usr/lib/locale/locale-archive 42 | fi 43 | 44 | test -d /usr/lib/gconv 45 | test -d /usr/lib/locale 46 | test -d /usr/share/i18n 47 | test -d /usr/share/libdrm 48 | if dpkg-query -W steamrt-container-host-compat:amd64; then 49 | test -d /usr/lib64 50 | test -d /usr/lib64/gconv 51 | test -d /usr/lib64/locale 52 | test -d /usr/lib/x86_64-linux-gnu/gconv 53 | # Arch Linux uses a non-standard ELF interpreter for some binaries in 54 | # the glibc package. We can't create this from 55 | # steamrt-container-host-compat, because that breaks dpkg-shlibdeps. 56 | ln -fns /lib64/ld-linux-x86-64.so.2 /usr/lib/ld-linux-x86-64.so.2 57 | if ! [ -e /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 ] \ 58 | && ! [ -L /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 ] \ 59 | ; then 60 | install -d /usr/lib/x86_64-linux-gnu 61 | ln -s /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 \ 62 | /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 63 | fi 64 | test -e /usr/x86_64-pc-linux-gnu/lib/ld-linux-x86-64.so.2 65 | fi 66 | if dpkg-query -W steamrt-container-host-compat:i386; then 67 | test -d /usr/lib32 68 | test -d /usr/lib32/gconv 69 | test -d /usr/lib32/locale 70 | test -d /usr/lib/i386-linux-gnu/gconv 71 | if ! [ -e /usr/lib/i386-linux-gnu/ld-linux.so.2 ] \ 72 | && ! [ -L /usr/lib/i386-linux-gnu/ld-linux.so.2 ] \ 73 | ; then 74 | install -d /usr/lib/i386-linux-gnu 75 | ln -s /lib/i386-linux-gnu/ld-linux.so.2 \ 76 | /usr/lib/i386-linux-gnu/ld-linux.so.2 77 | fi 78 | test -e /usr/i686-pc-linux-gnu/lib/ld-linux.so.2 79 | fi 80 | # https://github.com/ValveSoftware/steam-runtime/issues/302 81 | # https://github.com/ValveSoftware/steam-for-linux/issues/6310 82 | for prefix in /usr /usr/local; do 83 | install -d "${prefix}/share/steam" 84 | ln -fns "/run/host${prefix}/share/steam/compatibilitytools.d" \ 85 | "${prefix}/share/steam/compatibilitytools.d" 86 | done 87 | 88 | sdk: 89 | add_packages_multiarch: 90 | - steamrt-libdebug: 91 | debug_symbols: true 92 | - steamrt-libdevel 93 | 94 | add_packages: 95 | - steamrt-dev 96 | - steamrt-libdebug-non-multiarch: 97 | debug_symbols: true 98 | 99 | post_script: | 100 | set -eux 101 | 102 | for bin in \ 103 | dos2unix \ 104 | ifconfig \ 105 | ip \ 106 | nc \ 107 | ping \ 108 | ping6 \ 109 | route \ 110 | telnet \ 111 | traceroute \ 112 | traceroute6 \ 113 | unix2dos \ 114 | vi \ 115 | xxd \ 116 | ; do 117 | if [ -e /bin/busybox ] && ! [ -e "/bin/$bin" ] && ! [ -e "/usr/bin/$bin" ]; then 118 | ln -fnsv busybox "/bin/$bin" 119 | fi 120 | done 121 | 122 | ... 123 | -------------------------------------------------------------------------------- /runtimes/sniper.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # Copyright © 2013-2016 Valve Corporation 3 | # Copyright © 2017-2020 Collabora Ltd. 4 | # SPDX-License-Identifier: MIT 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining 7 | # a copy of these scripts and associated documentation files (the 8 | # "Software"), to deal in the Software without restriction, including 9 | # without limitation the rights to use, copy, modify, merge, publish, 10 | # distribute, sublicense, and/or sell copies of the Software, and to 11 | # permit persons to whom the Software is furnished to do so, subject to 12 | # the following conditions: 13 | # 14 | # The above copyright notice and this permission notice shall be included 15 | # in all copies or substantial portions of the Software. 16 | # 17 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 20 | # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 21 | # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 22 | # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 23 | # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | 25 | id_prefix: com.valvesoftware.SteamRuntime 26 | toolbx: true 27 | 28 | add_packages_multiarch: 29 | - steamrt-container-host-compat 30 | - steamrt-libs 31 | 32 | add_packages: 33 | - steamrt-container 34 | 35 | post_script: | 36 | set -eux 37 | 38 | if [ -e /usr/share/i18n/locales/en_US ]; then 39 | echo "en_US.UTF-8 UTF-8" > /etc/locale.gen 40 | localedef -v -i en_US -c -f UTF-8 en_US.UTF-8 || : 41 | test -e /usr/lib/locale/locale-archive 42 | fi 43 | 44 | test -d /usr/lib/gconv 45 | test -d /usr/lib/locale 46 | test -d /usr/share/i18n 47 | test -d /usr/share/libdrm 48 | if dpkg-query -W steamrt-container-host-compat:amd64; then 49 | test -d /usr/lib64 50 | test -d /usr/lib64/gconv 51 | test -d /usr/lib64/locale 52 | test -d /usr/lib/x86_64-linux-gnu/gconv 53 | # Arch Linux uses a non-standard ELF interpreter for some binaries in 54 | # the glibc package. We can't create this from 55 | # steamrt-container-host-compat, because that breaks dpkg-shlibdeps. 56 | ln -fns /lib64/ld-linux-x86-64.so.2 /usr/lib/ld-linux-x86-64.so.2 57 | if ! [ -e /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 ] \ 58 | && ! [ -L /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 ] \ 59 | ; then 60 | install -d /usr/lib/x86_64-linux-gnu 61 | ln -s /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 \ 62 | /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 63 | fi 64 | test -e /usr/x86_64-pc-linux-gnu/lib/ld-linux-x86-64.so.2 65 | fi 66 | if dpkg-query -W steamrt-container-host-compat:i386; then 67 | test -d /usr/lib32 68 | test -d /usr/lib32/gconv 69 | test -d /usr/lib32/locale 70 | test -d /usr/lib/i386-linux-gnu/gconv 71 | if ! [ -e /usr/lib/i386-linux-gnu/ld-linux.so.2 ] \ 72 | && ! [ -L /usr/lib/i386-linux-gnu/ld-linux.so.2 ] \ 73 | ; then 74 | install -d /usr/lib/i386-linux-gnu 75 | ln -s /lib/i386-linux-gnu/ld-linux.so.2 \ 76 | /usr/lib/i386-linux-gnu/ld-linux.so.2 77 | fi 78 | test -e /usr/i686-pc-linux-gnu/lib/ld-linux.so.2 79 | fi 80 | # https://github.com/ValveSoftware/steam-runtime/issues/302 81 | # https://github.com/ValveSoftware/steam-for-linux/issues/6310 82 | for prefix in /usr /usr/local; do 83 | install -d "${prefix}/share/steam" 84 | ln -fns "/run/host${prefix}/share/steam/compatibilitytools.d" \ 85 | "${prefix}/share/steam/compatibilitytools.d" 86 | done 87 | 88 | sdk: 89 | add_packages_multiarch: 90 | - steamrt-libdebug: 91 | debug_symbols: true 92 | - steamrt-libdevel 93 | 94 | add_packages: 95 | - steamrt-dev 96 | - steamrt-libdebug-non-multiarch: 97 | debug_symbols: true 98 | 99 | post_script: | 100 | set -eux 101 | 102 | for bin in \ 103 | dos2unix \ 104 | ifconfig \ 105 | ip \ 106 | nc \ 107 | ping \ 108 | ping6 \ 109 | route \ 110 | telnet \ 111 | traceroute \ 112 | traceroute6 \ 113 | unix2dos \ 114 | vi \ 115 | xxd \ 116 | ; do 117 | if [ -e /bin/busybox ] && ! [ -e "/bin/$bin" ] && ! [ -e "/usr/bin/$bin" ]; then 118 | ln -fnsv busybox "/bin/$bin" 119 | fi 120 | done 121 | 122 | ... 123 | -------------------------------------------------------------------------------- /runtimes/soldier.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # Copyright © 2013-2016 Valve Corporation 3 | # Copyright © 2017-2019 Collabora Ltd. 4 | # SPDX-License-Identifier: MIT 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining 7 | # a copy of these scripts and associated documentation files (the 8 | # "Software"), to deal in the Software without restriction, including 9 | # without limitation the rights to use, copy, modify, merge, publish, 10 | # distribute, sublicense, and/or sell copies of the Software, and to 11 | # permit persons to whom the Software is furnished to do so, subject to 12 | # the following conditions: 13 | # 14 | # The above copyright notice and this permission notice shall be included 15 | # in all copies or substantial portions of the Software. 16 | # 17 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 20 | # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 21 | # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 22 | # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 23 | # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | 25 | id_prefix: com.valvesoftware.SteamRuntime 26 | toolbx: true 27 | 28 | add_packages_multiarch: 29 | - steamrt-container-host-compat 30 | - steamrt-libs 31 | 32 | add_packages: 33 | - steamrt-container 34 | 35 | post_script: | 36 | set -eux 37 | 38 | if [ -e /usr/share/i18n/locales/en_US ]; then 39 | echo "en_US.UTF-8 UTF-8" > /etc/locale.gen 40 | localedef -v -i en_US -c -f UTF-8 en_US.UTF-8 || : 41 | test -e /usr/lib/locale/locale-archive 42 | fi 43 | 44 | test -d /usr/lib/gconv 45 | test -d /usr/lib/locale 46 | test -d /usr/share/i18n 47 | test -d /usr/share/libdrm 48 | if dpkg-query -W steamrt-container-host-compat:amd64; then 49 | test -d /usr/lib64 50 | test -d /usr/lib64/gconv 51 | test -d /usr/lib64/locale 52 | test -d /usr/lib/x86_64-linux-gnu/gconv 53 | # Arch Linux uses a non-standard ELF interpreter for some binaries in 54 | # the glibc package. We can't create this from 55 | # steamrt-container-host-compat, because that breaks dpkg-shlibdeps. 56 | ln -fns /lib64/ld-linux-x86-64.so.2 /usr/lib/ld-linux-x86-64.so.2 57 | if ! [ -e /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 ] \ 58 | && ! [ -L /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 ] \ 59 | ; then 60 | install -d /usr/lib/x86_64-linux-gnu 61 | ln -s /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 \ 62 | /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 63 | fi 64 | test -e /usr/x86_64-pc-linux-gnu/lib/ld-linux-x86-64.so.2 65 | fi 66 | if dpkg-query -W steamrt-container-host-compat:i386; then 67 | test -d /usr/lib32 68 | test -d /usr/lib32/gconv 69 | test -d /usr/lib32/locale 70 | test -d /usr/lib/i386-linux-gnu/gconv 71 | if ! [ -e /usr/lib/i386-linux-gnu/ld-linux.so.2 ] \ 72 | && ! [ -L /usr/lib/i386-linux-gnu/ld-linux.so.2 ] \ 73 | ; then 74 | install -d /usr/lib/i386-linux-gnu 75 | ln -s /lib/i386-linux-gnu/ld-linux.so.2 \ 76 | /usr/lib/i386-linux-gnu/ld-linux.so.2 77 | fi 78 | test -e /usr/i686-pc-linux-gnu/lib/ld-linux.so.2 79 | fi 80 | # https://github.com/ValveSoftware/steam-runtime/issues/302 81 | # https://github.com/ValveSoftware/steam-for-linux/issues/6310 82 | for prefix in /usr /usr/local; do 83 | install -d "${prefix}/share/steam" 84 | ln -fns "/run/host${prefix}/share/steam/compatibilitytools.d" \ 85 | "${prefix}/share/steam/compatibilitytools.d" 86 | done 87 | 88 | sdk: 89 | add_packages_multiarch: 90 | - steamrt-libdebug: 91 | debug_symbols: true 92 | - steamrt-libdevel 93 | 94 | add_packages: 95 | - steamrt-dev 96 | - steamrt-libdebug-non-multiarch: 97 | debug_symbols: true 98 | 99 | post_script: | 100 | set -eux 101 | 102 | for bin in \ 103 | dos2unix \ 104 | ifconfig \ 105 | ip \ 106 | nc \ 107 | ping \ 108 | ping6 \ 109 | route \ 110 | telnet \ 111 | traceroute \ 112 | traceroute6 \ 113 | unix2dos \ 114 | vi \ 115 | xxd \ 116 | ; do 117 | if [ -e /bin/busybox ] && ! [ -e "/bin/$bin" ] && ! [ -e "/usr/bin/$bin" ]; then 118 | ln -fnsv busybox "/bin/$bin" 119 | fi 120 | done 121 | 122 | ... 123 | -------------------------------------------------------------------------------- /subprojects/flatdeb/flatdeb/purge-conffiles: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | 3 | # flatdeb — build Flatpak runtimes from Debian packages 4 | # 5 | # Copyright © 2016-2017 Simon McVittie 6 | # Copyright © 2017-2019 Collabora Ltd. 7 | # 8 | # SPDX-License-Identifier: MIT 9 | # 10 | # Permission is hereby granted, free of charge, to any person obtaining 11 | # a copy of this software and associated documentation files (the 12 | # "Software"), to deal in the Software without restriction, including 13 | # without limitation the rights to use, copy, modify, merge, publish, 14 | # distribute, sublicense, and/or sell copies of the Software, and to 15 | # permit persons to whom the Software is furnished to do so, subject to 16 | # the following conditions: 17 | # 18 | # The above copyright notice and this permission notice shall be included 19 | # in all copies or substantial portions of the Software. 20 | # 21 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 24 | # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 25 | # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 26 | # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 27 | # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | 29 | import argparse 30 | import logging 31 | import os 32 | import subprocess 33 | import sys 34 | 35 | try: 36 | import typing 37 | except ImportError: 38 | pass 39 | else: 40 | typing # silence "unused" warnings 41 | 42 | 43 | logger = logging.getLogger('flatdeb.purge-conffiles') 44 | 45 | 46 | def main(): 47 | # type: (...) -> None 48 | 49 | parser = argparse.ArgumentParser( 50 | description='Purge leftover configuration files' 51 | ) 52 | parser.add_argument('sysroot') 53 | 54 | args = parser.parse_args() 55 | 56 | in_chroot = [ 57 | 'systemd-nspawn', 58 | '--directory={}'.format(args.sysroot), 59 | '--as-pid2', 60 | '--pipe', 61 | '--tmpfs=/run/lock', 62 | '--register=no', 63 | 'env', 64 | 'DEBIAN_FRONTEND=noninteractive', 65 | 'SUDO_FORCE_REMOVE=yes', 66 | ] 67 | 68 | in_chroot_simple = [ 69 | 'chroot', '--', args.sysroot, 70 | ] 71 | 72 | for var in ('ftp_proxy', 'http_proxy', 'https_proxy', 'no_proxy'): 73 | if var in os.environ: 74 | in_chroot.append('{}={}'.format(var, os.environ[var])) 75 | 76 | logger.info('Purging leftover configuration files:') 77 | 78 | unwanted = set() # type: typing.Set[str] 79 | 80 | with subprocess.Popen(in_chroot_simple + [ 81 | 'dpkg-query', 82 | '--show', 83 | '-f', r'${Status}:${Package}\n', 84 | ], stdout=subprocess.PIPE, universal_newlines=True) as dpkg_query: 85 | stdout = dpkg_query.stdout 86 | assert stdout is not None 87 | for line in stdout: 88 | line = line.rstrip() 89 | 90 | if not line: 91 | continue 92 | 93 | if ':' not in line: 94 | raise AssertionError('dpkg-query produced {!r}'.format(line)) 95 | 96 | status, package = line.rsplit(':') 97 | 98 | if status.endswith(' config-files'): 99 | logger.info('- %s', package) 100 | unwanted.add(package) 101 | 102 | if dpkg_query.wait() != 0: 103 | raise subprocess.CalledProcessError( 104 | returncode=dpkg_query.returncode, 105 | cmd=dpkg_query.args, 106 | ) 107 | 108 | if unwanted: 109 | subprocess.check_call(in_chroot + [ 110 | 'dpkg', 111 | '--purge', 112 | '--force-depends', 113 | '--force-remove-essential', 114 | ] + list(unwanted)) 115 | 116 | 117 | if __name__ == '__main__': 118 | if sys.stderr.isatty(): 119 | try: 120 | import colorlog 121 | except ImportError: 122 | logging.basicConfig() 123 | else: 124 | formatter = colorlog.ColoredFormatter( 125 | '%(log_color)s%(levelname)s:%(name)s:%(reset)s %(message)s') 126 | handler = logging.StreamHandler() 127 | handler.setFormatter(formatter) 128 | logging.getLogger().addHandler(handler) 129 | else: 130 | logging.basicConfig() 131 | 132 | logging.getLogger().setLevel(logging.DEBUG) 133 | 134 | try: 135 | main() 136 | except KeyboardInterrupt: 137 | raise SystemExit(130) 138 | except subprocess.CalledProcessError as e: 139 | logger.error('%s', e) 140 | raise SystemExit(1) 141 | -------------------------------------------------------------------------------- /subprojects/flatdeb/flatdeb/apt-install: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | 3 | # flatdeb — build Flatpak runtimes from Debian packages 4 | # 5 | # Copyright © 2016-2017 Simon McVittie 6 | # Copyright © 2017-2018 Collabora Ltd. 7 | # 8 | # SPDX-License-Identifier: MIT 9 | # 10 | # Permission is hereby granted, free of charge, to any person obtaining 11 | # a copy of this software and associated documentation files (the 12 | # "Software"), to deal in the Software without restriction, including 13 | # without limitation the rights to use, copy, modify, merge, publish, 14 | # distribute, sublicense, and/or sell copies of the Software, and to 15 | # permit persons to whom the Software is furnished to do so, subject to 16 | # the following conditions: 17 | # 18 | # The above copyright notice and this permission notice shall be included 19 | # in all copies or substantial portions of the Software. 20 | # 21 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 24 | # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 25 | # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 26 | # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 27 | # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | 29 | """ 30 | Install the given packages. 31 | 32 | This is basically debos' apt action, but with more debugging, and without 33 | doing `apt-get update`. 34 | """ 35 | 36 | import argparse 37 | import logging 38 | import os 39 | import subprocess 40 | import sys 41 | import yaml 42 | 43 | try: 44 | import typing 45 | except ImportError: 46 | pass 47 | else: 48 | typing # silence "unused" warnings 49 | 50 | 51 | logger = logging.getLogger('flatdeb.apt-install') 52 | 53 | 54 | def main(): 55 | # type: (...) -> None 56 | parser = argparse.ArgumentParser( 57 | description='Install the given packages' 58 | ) 59 | parser.add_argument( 60 | '--with-recommends', action='store_true', dest='recommends', 61 | default=False) 62 | parser.add_argument( 63 | '--without-recommends', action='store_false', dest='recommends', 64 | default=False) 65 | parser.add_argument( 66 | '--debug', action='store_true', default=False) 67 | parser.add_argument( 68 | '--update', action='store_true', default=False) 69 | parser.add_argument('sysroot') 70 | parser.add_argument('package_files', nargs='+') 71 | 72 | args = parser.parse_args() 73 | 74 | in_chroot = [ 75 | 'systemd-nspawn', 76 | '--directory={}'.format(args.sysroot), 77 | '--as-pid2', 78 | '--pipe', 79 | '--tmpfs=/run/lock', 80 | '--register=no', 81 | 'env', 'DEBIAN_FRONTEND=noninteractive', 82 | ] 83 | 84 | for var in ('ftp_proxy', 'http_proxy', 'https_proxy', 'no_proxy'): 85 | if var in os.environ: 86 | in_chroot.append('{}={}'.format(var, os.environ[var])) 87 | 88 | options = ['-q', '-oAcquire::Retries=3'] 89 | packages = [] # type: typing.List[str] 90 | 91 | if args.debug: 92 | options.append('-oDebug::pkgDepCache::AutoInstall=true') 93 | options.append('-oDebug::pkgDepCache::Marker=true') 94 | options.append('-oDebug::pkgPolicy=true') 95 | options.append('-oDebug::pkgProblemResolver=true') 96 | options.append('-oDebug::pkgProblemResolver::ShowScores=true') 97 | 98 | if not args.recommends: 99 | options.append('--no-install-recommends') 100 | 101 | for p in args.package_files: 102 | with open(p, encoding='utf-8') as reader: 103 | packages.extend(yaml.safe_load(reader)) 104 | 105 | if args.update: 106 | subprocess.check_call(in_chroot + [ 107 | 'apt-get', '-y', 108 | ] + options + ['update']) 109 | 110 | subprocess.check_call(in_chroot + [ 111 | 'apt-get', '-y', 112 | ] + options + ['install'] + packages) 113 | 114 | subprocess.check_call(in_chroot + [ 115 | 'apt-get', 116 | ] + options + [ 117 | 'clean', 118 | ]) 119 | 120 | 121 | if __name__ == '__main__': 122 | if sys.stderr.isatty(): 123 | try: 124 | import colorlog 125 | except ImportError: 126 | logging.basicConfig() 127 | else: 128 | formatter = colorlog.ColoredFormatter( 129 | '%(log_color)s%(levelname)s:%(name)s:%(reset)s %(message)s') 130 | handler = logging.StreamHandler() 131 | handler.setFormatter(formatter) 132 | logging.getLogger().addHandler(handler) 133 | else: 134 | logging.basicConfig() 135 | 136 | logging.getLogger().setLevel(logging.DEBUG) 137 | 138 | try: 139 | main() 140 | except KeyboardInterrupt: 141 | raise SystemExit(130) 142 | except subprocess.CalledProcessError as e: 143 | logger.error('%s', e) 144 | raise SystemExit(1) 145 | -------------------------------------------------------------------------------- /subprojects/flatdeb/flatdeb/collect-app-source-code: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | 3 | # flatdeb - build Flatpak runtimes from Debian packages 4 | # 5 | # Copyright (c) 2020 Collabora Ltd. 6 | # 7 | # SPDX-License-Identifier: MIT 8 | # 9 | # Permission is hereby granted, free of charge, to any person obtaining 10 | # a copy of this software and associated documentation files (the 11 | # "Software"), to deal in the Software without restriction, including 12 | # without limitation the rights to use, copy, modify, merge, publish, 13 | # distribute, sublicense, and/or sell copies of the Software, and to 14 | # permit persons to whom the Software is furnished to do so, subject to 15 | # the following conditions: 16 | # 17 | # The above copyright notice and this permission notice shall be included 18 | # in all copies or substantial portions of the Software. 19 | # 20 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 23 | # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 24 | # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 25 | # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 26 | # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | 28 | """ 29 | Fetch source code for app packages. 30 | """ 31 | 32 | import argparse 33 | import glob 34 | import logging 35 | import os 36 | import re 37 | import shutil 38 | import subprocess 39 | import sys 40 | from debian.debfile import DebFile 41 | 42 | logger = logging.getLogger('flatdeb.collect-app-source-code') 43 | 44 | 45 | def main(): 46 | parser = argparse.ArgumentParser( 47 | description='Collect source code for app', 48 | ) 49 | parser.add_argument('--strip-source-version-suffix', default='') 50 | parser.add_argument('--export', default=os.getcwd()) 51 | parser.add_argument('packages', nargs='*') 52 | 53 | args = parser.parse_args() 54 | 55 | strip_source_version_suffix = None 56 | 57 | if args.strip_source_version_suffix: 58 | strip_source_version_suffix = re.compile( 59 | '(?:' + args.strip_source_version_suffix + ')$') 60 | 61 | options = ['-q', '-oAcquire::Retries=3'] 62 | 63 | subprocess.check_call(['cp', '-PRp', '/usr/var', '/']) 64 | subprocess.check_call(['install', '-d', '/var/cache/apt/archives/partial']) 65 | subprocess.check_call(['fakeroot', 'apt-get'] + options + ['update']) 66 | subprocess.check_call(['fakeroot', 'apt-get'] + options 67 | + ['-y', '--download-only', 68 | '--no-install-recommends', 'install'] 69 | + args.packages) 70 | 71 | for file in glob.glob("/var/cache/apt/archives/*.deb"): 72 | debian_control = DebFile(file).control.debcontrol() 73 | package = debian_control.get('Package') 74 | source = debian_control.get('Source') 75 | bu = debian_control.get('Built-Using') 76 | version = debian_control.get('Version') 77 | 78 | if not source: 79 | source = package 80 | if source.endswith(')'): 81 | source, version = source.rstrip(')').split(' (') 82 | if strip_source_version_suffix is not None: 83 | version = strip_source_version_suffix.sub('', version) 84 | assert source 85 | assert version 86 | 87 | subprocess.check_call(['apt-get'] + options + [ 88 | '-y', '--download-only', 89 | '-oAPT::Get::Only-Source=true', 'source', 90 | '{}={}'.format(source, version), 91 | ], cwd=args.export) 92 | 93 | if bu: 94 | for dep in bu.split(', '): 95 | source, version = dep.rstrip(')').split(' (= ') 96 | if strip_source_version_suffix is not None: 97 | version = strip_source_version_suffix.sub('', version) 98 | assert source 99 | assert version 100 | 101 | subprocess.check_call(['apt-get'] + options + [ 102 | '-y', '--download-only', 103 | '-oAPT::Get::Only-Source=true', 'source', 104 | '{}={}'.format(source, version), 105 | ], cwd=args.export) 106 | 107 | for file in glob.glob("/var/cache/apt/archives/*.deb"): 108 | shutil.move(file, args.export) 109 | shutil.move('/var/lib/apt/lists', args.export) 110 | 111 | 112 | if __name__ == '__main__': 113 | if sys.stderr.isatty(): 114 | try: 115 | import colorlog 116 | except ImportError: 117 | logging.basicConfig() 118 | else: 119 | formatter = colorlog.ColoredFormatter( 120 | '%(log_color)s%(levelname)s:%(name)s:%(reset)s %(message)s') 121 | handler = logging.StreamHandler() 122 | handler.setFormatter(formatter) 123 | logging.getLogger().addHandler(handler) 124 | else: 125 | logging.basicConfig() 126 | 127 | logging.getLogger().setLevel(logging.DEBUG) 128 | 129 | try: 130 | main() 131 | except KeyboardInterrupt: 132 | raise SystemExit(130) 133 | -------------------------------------------------------------------------------- /subprojects/flatdeb/flatdeb/dbgsym-use-build-id: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright 2013-2019 Valve Corporation 4 | # Copyright 2019 Collabora Ltd. 5 | # 6 | # SPDX-License-Identifier: MIT 7 | # 8 | # Permission is hereby granted, free of charge, to any person obtaining 9 | # a copy of this software and associated documentation files (the 10 | # "Software"), to deal in the Software without restriction, including 11 | # without limitation the rights to use, copy, modify, merge, publish, 12 | # distribute, sublicense, and/or sell copies of the Software, and to 13 | # permit persons to whom the Software is furnished to do so, subject to 14 | # the following conditions: 15 | # 16 | # The above copyright notice and this permission notice shall be included 17 | # in all copies or substantial portions of the Software. 18 | # 19 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 21 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 22 | # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 23 | # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 24 | # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 25 | # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | 27 | import argparse 28 | import logging 29 | import os 30 | import re 31 | import subprocess 32 | import sys 33 | 34 | 35 | """ 36 | Provide build-ID-based hard links to legacy path-based debugging symbols. 37 | 38 | Based on build-runtime.py in steam-runtime. 39 | """ 40 | 41 | 42 | logger = logging.getLogger('flatdeb.dbgsym-use-build-id') 43 | 44 | 45 | def main(): 46 | # type: (...) -> None 47 | 48 | parser = argparse.ArgumentParser( 49 | description=( 50 | 'Provide build-ID-based hard links for legacy debug symbols' 51 | ), 52 | ) 53 | parser.add_argument( 54 | '--dry-run', 55 | action='store_true', 56 | default=False, 57 | ) 58 | parser.add_argument('--debug-dir', default='/usr/lib/debug') 59 | 60 | args = parser.parse_args() 61 | 62 | for dirname, subdirs, files in os.walk(args.debug_dir): 63 | # Skip build-ID directory: it is already in the form we wanted 64 | if '.build-id' in subdirs: 65 | subdirs.remove('.build-id') 66 | 67 | # Skip .dwz directory: items here are just referenced by name from 68 | # other debug symbols 69 | if '.dwz' in subdirs: 70 | subdirs.remove('.dwz') 71 | 72 | for f in files: 73 | if f.endswith('.txt'): 74 | continue 75 | 76 | # Scrape the output of readelf to find the build-ID for this 77 | # binary 78 | path = os.path.join(dirname, f) 79 | 80 | with subprocess.Popen([ 81 | os.environ.get('READELF', 'readelf'), '-n', path, 82 | ], stdout=subprocess.PIPE, universal_newlines=True) as p: 83 | stdout = p.stdout 84 | assert stdout is not None 85 | for line in stdout: 86 | m = re.search( 87 | r'Build ID: ([a-fA-F0-9]{2})([a-fA-F0-9]+)', 88 | line, 89 | re.ASCII, 90 | ) 91 | if m is None: 92 | continue 93 | 94 | # ensure no path traversal 95 | assert '.' not in m.group(1) 96 | assert '.' not in m.group(2) 97 | linkdir = os.path.join( 98 | args.debug_dir, '.build-id', m.group(1), 99 | ) 100 | link = os.path.join(linkdir, m.group(2) + '.debug') 101 | 102 | if args.dry_run: 103 | logger.info('Would hard-link %s as %s', path, link) 104 | else: 105 | logger.info('Hard-linking %s as %s', path, link) 106 | 107 | if not os.access(linkdir, os.W_OK): 108 | os.makedirs(linkdir) 109 | 110 | if os.path.lexists(link): 111 | os.unlink(link) 112 | 113 | os.link(os.path.join(dirname, f), link) 114 | 115 | break 116 | else: 117 | logger.warning( 118 | 'Unable to create build-ID-based hard link to %s', 119 | path, 120 | ) 121 | 122 | 123 | if __name__ == '__main__': 124 | if sys.stderr.isatty(): 125 | try: 126 | import colorlog 127 | except ImportError: 128 | logging.basicConfig() 129 | else: 130 | formatter = colorlog.ColoredFormatter( 131 | '%(log_color)s%(levelname)s:%(name)s:%(reset)s %(message)s') 132 | handler = logging.StreamHandler() 133 | handler.setFormatter(formatter) 134 | logging.getLogger().addHandler(handler) 135 | else: 136 | logging.basicConfig() 137 | 138 | logging.getLogger().setLevel(logging.DEBUG) 139 | 140 | try: 141 | main() 142 | except KeyboardInterrupt: 143 | raise SystemExit(130) 144 | -------------------------------------------------------------------------------- /subprojects/flatdeb/flatdeb/make-flatpak-friendly: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright © 2016-2017 Simon McVittie 4 | # Copyright © 2017-2018 Collabora Ltd. 5 | # 6 | # SPDX-License-Identifier: MIT 7 | # 8 | # Permission is hereby granted, free of charge, to any person obtaining 9 | # a copy of this software and associated documentation files (the 10 | # "Software"), to deal in the Software without restriction, including 11 | # without limitation the rights to use, copy, modify, merge, publish, 12 | # distribute, sublicense, and/or sell copies of the Software, and to 13 | # permit persons to whom the Software is furnished to do so, subject to 14 | # the following conditions: 15 | # 16 | # The above copyright notice and this permission notice shall be included 17 | # in all copies or substantial portions of the Software. 18 | # 19 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 21 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 22 | # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 23 | # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 24 | # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 25 | # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | 27 | set -e 28 | set -u 29 | set -o pipefail 30 | 31 | me="$(basename "$0")" 32 | sdk= 33 | 34 | if [ "${1-}" = '--sdk' ]; then 35 | sdk=yes 36 | shift 37 | fi 38 | 39 | if [ "$#" != 1 ] || [ "$1" = '--help' ] || [ "x$(id -u)" != x0 ] || 40 | ! [ -d "$1" ]; then 41 | echo "$me: Usage:" >&2 42 | echo " $me SYSROOT" >&2 43 | echo "" >&2 44 | echo "Run this script as root." >&2 45 | exit 2 46 | fi 47 | 48 | set -x 49 | 50 | sysroot="$1" 51 | cd "$sysroot" 52 | 53 | rm -fr --one-file-system \ 54 | etc/apparmor \ 55 | etc/apparmor.d \ 56 | etc/bindresvport.blacklist \ 57 | etc/console-setup \ 58 | etc/cron.daily \ 59 | etc/cron.hourly \ 60 | etc/cron.monthly \ 61 | etc/cron.weekly \ 62 | etc/dbus-1/system.d \ 63 | etc/depmod.d \ 64 | etc/dhcp \ 65 | etc/emacs \ 66 | etc/fstab \ 67 | etc/fstab.d \ 68 | etc/gai.conf \ 69 | etc/group- \ 70 | etc/gshadow- \ 71 | etc/hostname \ 72 | etc/hosts \ 73 | etc/hosts.allow \ 74 | etc/hosts.deny \ 75 | etc/init \ 76 | etc/init.d \ 77 | etc/initramfs-tools \ 78 | etc/insserv \ 79 | etc/insserv.conf \ 80 | etc/insserv.conf.d \ 81 | etc/iproute2 \ 82 | etc/issue \ 83 | etc/issue.net \ 84 | etc/kbd \ 85 | etc/kernel \ 86 | etc/libaudit.conf \ 87 | etc/localtime \ 88 | etc/logcheck \ 89 | etc/login.defs \ 90 | etc/logrotate.d \ 91 | etc/lsb-base \ 92 | etc/lsb-base-logging.sh \ 93 | etc/machine-id \ 94 | etc/mailname \ 95 | etc/modprobe.d \ 96 | etc/modules \ 97 | etc/motd \ 98 | etc/network \ 99 | etc/networks \ 100 | etc/nologin \ 101 | etc/opt \ 102 | etc/pam.conf \ 103 | etc/pam.d \ 104 | etc/passwd- \ 105 | etc/ppp \ 106 | "etc/rc.local" \ 107 | etc/rc0.d \ 108 | etc/rc1.d \ 109 | etc/rc2.d \ 110 | etc/rc3.d \ 111 | etc/rc4.d \ 112 | etc/rc5.d \ 113 | etc/rc6.d \ 114 | etc/rcS.d \ 115 | etc/resolv.conf \ 116 | etc/resolvconf \ 117 | etc/rmt \ 118 | etc/rpc \ 119 | etc/rsyslog.conf \ 120 | etc/rsyslog.d \ 121 | etc/securetty \ 122 | etc/security \ 123 | etc/selinux \ 124 | etc/shadow- \ 125 | etc/shells \ 126 | etc/staff-group-for-usr-local \ 127 | etc/subgid- \ 128 | etc/subuid- \ 129 | etc/sudoers \ 130 | etc/sudoers.d \ 131 | etc/sysctl.conf \ 132 | etc/sysctl.d \ 133 | etc/systemd \ 134 | etc/terminfo \ 135 | etc/timezone \ 136 | etc/udev \ 137 | etc/update-motd.d \ 138 | var/backups \ 139 | var/cache \ 140 | var/lib/aptitude/pkgstates.old \ 141 | var/lib/binfmts \ 142 | var/lib/dbus/machine-id \ 143 | var/lib/dpkg/available-old \ 144 | var/lib/dpkg/diversions-old \ 145 | var/lib/dpkg/status-old \ 146 | var/lib/dpkg/statoverride \ 147 | var/lib/urandom \ 148 | "var/local" \ 149 | var/lock \ 150 | var/log \ 151 | var/mail \ 152 | var/opt \ 153 | var/run \ 154 | var/spool \ 155 | ${NULL+} 156 | 157 | for d in \ 158 | var/lib/dbus \ 159 | var/lib/misc \ 160 | var/lib \ 161 | ; do 162 | if [ -d "$d" ]; then 163 | rmdir --ignore-fail-on-non-empty "$d" 164 | fi 165 | done 166 | 167 | chmod -R --changes "a-s,o-t,u=rwX,og=rX" . 168 | chown -R --changes "root:root" . 169 | 170 | mkdir -p debug 171 | mkdir -p usr/lib/debug 172 | mv usr/lib/debug debug/files 173 | # mount point 174 | mkdir -p usr/lib/debug 175 | mv usr files 176 | 177 | if [ -n "$sdk" ]; then 178 | install -d var/cache/apt/archives/partial 179 | install -d var/lib/extrausers 180 | touch var/cache/apt/archives/partial/.exists 181 | # This is only useful if the SDK has libnss-extrausers 182 | cp etc/passwd var/lib/extrausers/passwd 183 | cp etc/group var/lib/extrausers/groups 184 | 185 | mv var files 186 | else 187 | rm -fr --one-file-system \ 188 | etc/adduser.conf \ 189 | etc/alternatives \ 190 | etc/apt \ 191 | etc/bash_completion.d \ 192 | etc/dpkg \ 193 | etc/debconf.conf \ 194 | etc/default \ 195 | etc/deluser.conf \ 196 | etc/gdb \ 197 | etc/gpasswd \ 198 | etc/gshadow \ 199 | etc/groff \ 200 | etc/group \ 201 | etc/mailcap \ 202 | etc/mailcap.order \ 203 | etc/manpath.config \ 204 | etc/mke2fs.conf \ 205 | etc/newt \ 206 | etc/passwd \ 207 | etc/shadow \ 208 | etc/skel \ 209 | etc/subgid \ 210 | etc/subuid \ 211 | etc/ucf.conf \ 212 | share/bash-completion \ 213 | share/bug \ 214 | var \ 215 | ${NULL+} 216 | fi 217 | 218 | rm -fr --one-file-system boot media mnt opt proc run srv sys tmp 219 | mkdir proc run sys tmp 220 | 221 | mv etc files 222 | 223 | ln -s files usr 224 | ln -s files/etc etc 225 | ln -s files/var var 226 | -------------------------------------------------------------------------------- /subprojects/flatdeb/flatdeb/platformize: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright © 2016-2017 Simon McVittie 4 | # Copyright © 2017-2018 Collabora Ltd. 5 | # 6 | # SPDX-License-Identifier: MIT 7 | # 8 | # Permission is hereby granted, free of charge, to any person obtaining 9 | # a copy of this software and associated documentation files (the 10 | # "Software"), to deal in the Software without restriction, including 11 | # without limitation the rights to use, copy, modify, merge, publish, 12 | # distribute, sublicense, and/or sell copies of the Software, and to 13 | # permit persons to whom the Software is furnished to do so, subject to 14 | # the following conditions: 15 | # 16 | # The above copyright notice and this permission notice shall be included 17 | # in all copies or substantial portions of the Software. 18 | # 19 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 21 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 22 | # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 23 | # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 24 | # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 25 | # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | 27 | # Disable services in a chroot. 28 | 29 | set -e 30 | set -u 31 | set -o pipefail 32 | 33 | me="$(basename "$0")" 34 | 35 | if [ "$#" != 1 ] || [ "$1" = '--help' ] || [ "x$(id -u)" != x0 ] || 36 | ! [ -d "$1" ]; then 37 | echo "$me: Usage:" >&2 38 | echo " $me SYSROOT" >&2 39 | echo "" >&2 40 | echo "Run this script as root." >&2 41 | exit 2 42 | fi 43 | 44 | sysroot="$1" 45 | cd "$sysroot" 46 | 47 | in_chroot_simple () { 48 | chroot -- "$sysroot" "$@" 49 | } 50 | 51 | in_chroot () { 52 | local var 53 | 54 | for var in ftp_proxy http_proxy https_proxy no_proxy; do 55 | if [ -n "${!var-}" ]; then 56 | set -- "${var}=${!var}" "$@" 57 | fi 58 | done 59 | 60 | systemd-nspawn --directory="$sysroot" --as-pid2 --pipe --tmpfs=/run/lock \ 61 | --register=no env DEBIAN_FRONTEND=noninteractive SUDO_FORCE_REMOVE=yes \ 62 | "$@" 63 | } 64 | 65 | list_packages_ignore_arch () { 66 | # ${} here is interpreted by dpkg-query 67 | # shellcheck disable=SC2016 68 | in_chroot_simple dpkg-query --show -f '${Package}\n' | LC_ALL=C sort -u 69 | } 70 | 71 | is_installed () { 72 | local status 73 | # ${} here is interpreted by dpkg-query 74 | # shellcheck disable=SC2016 75 | if ! status="$(in_chroot_simple dpkg-query --show -f '${Status}\n' "$@")"; then 76 | return 1 77 | fi 78 | case "$status" in 79 | (*\ not-installed) 80 | return 1 81 | ;; 82 | (*\ config-files) 83 | return 1 84 | ;; 85 | esac 86 | return 0 87 | } 88 | 89 | declare -a unwanted=() 90 | 91 | echo "Packages installed at the moment:" 92 | list_packages_ignore_arch | sed -e 's/^/- /' 93 | 94 | for package in \ 95 | aptitude \ 96 | fakeroot \ 97 | libfakeroot \ 98 | ; do \ 99 | if is_installed "$package"; then 100 | unwanted+=("$package") 101 | fi 102 | done 103 | 104 | if [ -n "${unwanted[*]}" ]; then 105 | echo "Packages we will remove (before autoremove):" 106 | for p in "${unwanted[@]}"; do 107 | echo "- $p" 108 | done 109 | 110 | in_chroot apt-get -q -y purge "${unwanted[@]}" 111 | fi 112 | 113 | in_chroot apt-get -q -y --purge autoremove 114 | 115 | echo "Packages installed before destroying Essential set:" 116 | list_packages_ignore_arch | sed -e 's/^/- /' 117 | 118 | unwanted=() 119 | 120 | # These are Essential (or at least important) but serve no 121 | # purpose in an immutable runtime with no init. Note that 122 | # order is important: adduser needs to be removed before 123 | # debconf, and sudo before lsb-base. 124 | # We remove these particular packages first because 125 | # they try to invoke other packages we want to remove in 126 | # their postrm maintainer scripts. 127 | for package in \ 128 | adduser \ 129 | apt \ 130 | apt-transport-https \ 131 | gnupg \ 132 | ifupdown \ 133 | initramfs-tools \ 134 | initramfs-tools-bin \ 135 | initscripts \ 136 | sudo \ 137 | lsb-base \ 138 | module-init-tools \ 139 | plymouth \ 140 | tcpd \ 141 | udev \ 142 | ; do \ 143 | if is_installed "$package"; then 144 | unwanted+=("$package") 145 | fi 146 | done 147 | 148 | if ! is_installed python; then 149 | unwanted+=(python-minimal python2.7-minimal) 150 | fi 151 | 152 | if ! ( is_installed gnupg || is_installed gnupg2 || is_installed gnupg1 ); then 153 | unwanted+=(gpgv) 154 | fi 155 | 156 | if [ -n "${unwanted[*]}" ]; then 157 | echo "Packages we will forcibly remove (first round):" 158 | for p in "${unwanted[@]}"; do 159 | echo "- $p" 160 | done 161 | 162 | in_chroot dpkg --purge --force-remove-essential --force-depends \ 163 | "${unwanted[@]}" 164 | fi 165 | 166 | unwanted=() 167 | 168 | for package in \ 169 | busybox-initramfs \ 170 | debconf \ 171 | debian-archive-keyring \ 172 | e2fsprogs \ 173 | init \ 174 | init-system-helpers \ 175 | insserv \ 176 | iproute \ 177 | iproute2 \ 178 | login \ 179 | mount \ 180 | mountall \ 181 | passwd \ 182 | systemd \ 183 | systemd-sysv \ 184 | sysv-rc \ 185 | ubuntu-archive-keyring \ 186 | ubuntu-keyring \ 187 | upstart \ 188 | ; do \ 189 | if is_installed "$package"; then 190 | unwanted+=("$package") 191 | fi 192 | done 193 | 194 | if [ -n "${unwanted[*]}" ]; then 195 | echo "Packages we will forcibly remove (second round):" 196 | for p in "${unwanted[@]}"; do 197 | echo "- $p" 198 | done 199 | 200 | in_chroot dpkg --purge --force-remove-essential --force-depends \ 201 | "${unwanted[@]}" 202 | fi 203 | 204 | unwanted=() 205 | 206 | if ! is_installed perl; then 207 | unwanted+=(perl-base) 208 | fi 209 | 210 | if [ -n "${unwanted[*]}" ]; then 211 | echo "Packages we will forcibly remove (third round):" 212 | for p in "${unwanted[@]}"; do 213 | echo "- $p" 214 | done 215 | 216 | in_chroot dpkg --purge --force-remove-essential --force-depends \ 217 | "${unwanted[@]}" 218 | fi 219 | -------------------------------------------------------------------------------- /runtimes/scout.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # Loosely based on: 3 | # https://github.com/ValveSoftware/steam-runtime/blob/master/setup_chroot.sh 4 | # 5 | # Copyright © 2013-2016 Valve Corporation 6 | # Copyright © 2017-2019 Collabora Ltd. 7 | # SPDX-License-Identifier: MIT 8 | # 9 | # Permission is hereby granted, free of charge, to any person obtaining 10 | # a copy of these scripts and associated documentation files (the 11 | # "Software"), to deal in the Software without restriction, including 12 | # without limitation the rights to use, copy, modify, merge, publish, 13 | # distribute, sublicense, and/or sell copies of the Software, and to 14 | # permit persons to whom the Software is furnished to do so, subject to 15 | # the following conditions: 16 | # 17 | # The above copyright notice and this permission notice shall be included 18 | # in all copies or substantial portions of the Software. 19 | # 20 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 23 | # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 24 | # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 25 | # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 26 | # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | 28 | id_prefix: com.valvesoftware.SteamRuntime 29 | toolbx: true 30 | 31 | add_packages_multiarch: 32 | - steamrt-container-host-compat 33 | - steamrt-libs 34 | 35 | add_packages: 36 | - steamrt-container 37 | 38 | # This needs to be installed to be able to remove sudo 39 | - sysv-rc 40 | 41 | post_script: | 42 | set -eux 43 | 44 | if ! [ -L /bin ]; then 45 | dpkg --purge usr-is-merged || : 46 | fi 47 | 48 | if [ -e /usr/share/i18n/locales/en_US ]; then 49 | echo "en_US.UTF-8 UTF-8" > /etc/locale.gen 50 | localedef -v -i en_US -c -f UTF-8 en_US.UTF-8 || : 51 | test -e /usr/lib/locale/locale-archive 52 | fi 53 | 54 | test -d /usr/lib/gconv 55 | test -d /usr/lib/locale 56 | test -d /usr/share/i18n 57 | test -d /usr/share/libdrm 58 | if dpkg-query -W steamrt-container-host-compat:amd64; then 59 | test -d /usr/lib64 60 | test -d /usr/lib64/gconv 61 | test -d /usr/lib64/locale 62 | test -d /usr/lib/x86_64-linux-gnu/gconv 63 | # Arch Linux uses a non-standard ELF interpreter for some binaries in 64 | # the glibc package. We can't create this from 65 | # steamrt-container-host-compat, because that breaks dpkg-shlibdeps. 66 | ln -fns /lib64/ld-linux-x86-64.so.2 /usr/lib/ld-linux-x86-64.so.2 67 | if ! [ -e /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 ] \ 68 | && ! [ -L /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 ] \ 69 | ; then 70 | install -d /usr/lib/x86_64-linux-gnu 71 | ln -s /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 \ 72 | /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 73 | fi 74 | test -e /usr/x86_64-pc-linux-gnu/lib/ld-linux-x86-64.so.2 75 | fi 76 | if dpkg-query -W steamrt-container-host-compat:i386; then 77 | test -d /usr/lib32 78 | test -d /usr/lib32/gconv 79 | test -d /usr/lib32/locale 80 | test -d /usr/lib/i386-linux-gnu/gconv 81 | if ! [ -e /usr/lib/i386-linux-gnu/ld-linux.so.2 ] \ 82 | && ! [ -L /usr/lib/i386-linux-gnu/ld-linux.so.2 ] \ 83 | ; then 84 | install -d /usr/lib/i386-linux-gnu 85 | ln -s /lib/i386-linux-gnu/ld-linux.so.2 \ 86 | /usr/lib/i386-linux-gnu/ld-linux.so.2 87 | fi 88 | test -e /usr/i686-pc-linux-gnu/lib/ld-linux.so.2 89 | fi 90 | # https://github.com/ValveSoftware/steam-runtime/issues/302 91 | # https://github.com/ValveSoftware/steam-for-linux/issues/6310 92 | for prefix in /usr /usr/local; do 93 | install -d "${prefix}/share/steam" 94 | ln -fns "/run/host${prefix}/share/steam/compatibilitytools.d" \ 95 | "${prefix}/share/steam/compatibilitytools.d" 96 | done 97 | 98 | platform: 99 | post_script: | 100 | set -eux 101 | 102 | if [ -x /usr/bin/python3.5 ] && ! [ -e /usr/bin/python3 ]; then 103 | ln -fns python3.5 /usr/bin/python3 104 | fi 105 | 106 | sdk: 107 | add_packages_multiarch: 108 | - steamrt-libdebug: 109 | debug_symbols: true 110 | - steamrt-libdevel 111 | 112 | add_packages: 113 | - steamrt-dev 114 | - steamrt-libdebug-non-multiarch: 115 | debug_symbols: true 116 | - steamrt-libdevel-non-multiarch 117 | 118 | post_script: | 119 | set -eux 120 | 121 | for bin in \ 122 | dos2unix \ 123 | ifconfig \ 124 | ip \ 125 | nc \ 126 | ping \ 127 | ping6 \ 128 | route \ 129 | telnet \ 130 | traceroute \ 131 | traceroute6 \ 132 | unix2dos \ 133 | vi \ 134 | ; do 135 | if [ -e /bin/busybox ] && ! [ -e "/bin/$bin" ] && ! [ -e "/usr/bin/$bin" ]; then 136 | ln -fnsv busybox "/bin/$bin" 137 | fi 138 | done 139 | 140 | # Workaround bug 714890 in 32-bit clang. Gcc 4.8 changed the include paths. 141 | # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=714890 142 | # /usr/include/c++/4.6/i686-linux-gnu/bits/c++config.h 143 | # /usr/include/i386-linux-gnu/c++/4.8/bits/c++config.h 144 | echo "Before fixing include paths:" 145 | ls -ld /usr/include/c++/*/*-linux-gnu 146 | ls -ld /usr/include/*-linux-gnu/c++/* 147 | if [ -d /usr/include/i386-linux-gnu/c++/4.8 ]; then 148 | ln -s /usr/include/i386-linux-gnu/c++/4.8 /usr/include/c++/4.8/i686-linux-gnu 149 | fi 150 | echo "After fixing include paths:" 151 | ls -ld /usr/include/c++/*/*-linux-gnu 152 | ls -ld /usr/include/*-linux-gnu/c++/* 153 | 154 | # Setup compiler alternatives 155 | update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 50 156 | update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.6 50 157 | update-alternatives --install /usr/bin/cpp cpp-bin /usr/bin/cpp-4.6 50 158 | 159 | update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 100 160 | update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 100 161 | update-alternatives --install /usr/bin/cpp cpp-bin /usr/bin/cpp-4.8 100 162 | 163 | update-alternatives --install /usr/bin/gcc gcc /usr/bin/clang-3.4 50 164 | update-alternatives --install /usr/bin/g++ g++ /usr/bin/clang++-3.4 50 165 | 166 | update-alternatives --install /usr/bin/gcc gcc /usr/bin/clang-3.6 50 167 | update-alternatives --install /usr/bin/g++ g++ /usr/bin/clang++-3.6 50 168 | 169 | # gcc-4.8 is the default 170 | update-alternatives --set gcc /usr/bin/gcc-4.8 171 | update-alternatives --set g++ /usr/bin/g++-4.8 172 | update-alternatives --set cpp-bin /usr/bin/cpp-4.8 173 | ... 174 | -------------------------------------------------------------------------------- /subprojects/flatdeb/flatdeb/debos-base.yaml: -------------------------------------------------------------------------------- 1 | {{/* 2 | Copyright 2018-2021 Collabora Ltd. 3 | SPDX-License-Identifier: MIT 4 | */}} 5 | 6 | {{- $architecture := or .architecture "amd64" -}} 7 | {{- /* Use a YAML list here */ -}} 8 | {{- $components := or .components "" -}} 9 | {{- $suite := or .suite "stretch" -}} 10 | {{- $foreignarchs := or .foreignarchs "" -}} 11 | {{- $mirror := or .mirror "http://deb.debian.org/debian" -}} 12 | {{- $mergedusr := or .mergedusr "false" }} 13 | {{- $keyring := or .keyring "" -}} 14 | {{- $additional_base_packages := or .additional_base_packages "" -}} 15 | {{- $build_id := or .build_id "" -}} 16 | {{- $debootstrap_script := or .debootstrap_script "" -}} 17 | {{- $exclude := or .exclude "" -}} 18 | {{- $include := or .include "" -}} 19 | {{- $variant := or .variant "Minimal base system" -}} 20 | {{- $variant_id := or .variant_id "base" -}} 21 | {{- $artifact_prefix := or .artifact_prefix (printf "base-%s-%s" $suite $architecture) -}} 22 | {{- $ospack := or .ospack (printf "%s.tar.gz" $artifact_prefix) -}} 23 | {{- $strip_source_version_suffix := or .strip_source_version_suffix "" -}} 24 | 25 | architecture: {{ $architecture }} 26 | 27 | actions: 28 | # Make sure Ubuntu precise doesn't try to migrate /run 29 | - action: run 30 | label: create skeleton chroot 31 | command: | 32 | set -e 33 | echo 34 | install -d "$ROOTDIR" 35 | install -d "$ROOTDIR/run" 36 | install -d "$ROOTDIR/var" 37 | ln -fns /run "$ROOTDIR/var/run" 38 | ln -fns /dev/shm "$ROOTDIR/run/shm" 39 | 40 | - action: run 41 | label: debootstrap 42 | chroot: false 43 | command: | 44 | set -e 45 | "$RECIPEDIR/debootstrap" \ 46 | --arch "{{ $architecture }}" \ 47 | --components "{{ $components }}" \ 48 | --exclude "{{ $exclude }}" \ 49 | --include "{{ $include }}" \ 50 | --keyring-file "{{ $keyring }}" \ 51 | {{ if eq $mergedusr "true" }}--merged-usr{{ else }}--no-merged-usr{{ end }} \ 52 | --script "{{ $debootstrap_script }}" \ 53 | "{{ $suite }}" \ 54 | "$ROOTDIR" \ 55 | "{{ $mirror }}" 56 | 57 | - action: overlay 58 | source: suites/{{ $suite }}/overlay 59 | 60 | - action: run 61 | label: remove extra apt sources 62 | chroot: false 63 | command: | 64 | set -e 65 | echo 66 | rm -fr "$ROOTDIR/etc/apt/sources.list.d" 67 | mkdir "$ROOTDIR/etc/apt/sources.list.d" 68 | 69 | - action: run 70 | label: clean up bootstrap apt configuration 71 | chroot: false 72 | command: | 73 | set -e 74 | echo 75 | rm -frv "$ROOTDIR/etc/apt/trustdb.gpg" 76 | rm -frv "$ROOTDIR/etc/apt/trustdb.gpg~" 77 | rm -frv "$ROOTDIR/etc/apt/trusted.gpg" 78 | rm -frv "$ROOTDIR/etc/apt/trusted.gpg~" 79 | 80 | - action: run 81 | label: list apt configuration 82 | chroot: false 83 | command: > 84 | set -e; 85 | find "$ROOTDIR/etc/apt" -ls; 86 | head -n10000 87 | "$ROOTDIR/etc/apt/apt.conf" 88 | "$ROOTDIR/etc/apt/apt.conf.d"/* 89 | "$ROOTDIR/etc/apt/sources.list" 90 | "$ROOTDIR/etc/apt/sources.list.d"/* 91 | "$ROOTDIR/etc/debian_chroot" 92 | "$ROOTDIR/lib/os-release" 93 | || true 94 | 95 | {{ if $additional_base_packages }} 96 | - action: run 97 | label: additional base packages 98 | chroot: false 99 | command: | 100 | set -eux 101 | install -d -m755 "$ROOTDIR/run" 102 | echo "{{ $additional_base_packages }}" > "$ROOTDIR/run/packages.yaml" 103 | "$RECIPEDIR/apt-install" \ 104 | --debug \ 105 | --update \ 106 | --without-recommends \ 107 | "$ROOTDIR" \ 108 | "$ROOTDIR/run/packages.yaml" 109 | echo "end" 110 | {{ end }} 111 | 112 | - action: run 113 | label: disable-services 114 | chroot: false 115 | command: 'echo; "$RECIPEDIR/disable-services" "$ROOTDIR"' 116 | 117 | - action: run 118 | label: clean-up-base 119 | chroot: false 120 | command: 'echo; "$RECIPEDIR/clean-up-base" "$ROOTDIR"' 121 | 122 | {{ if eq $mergedusr "after_debootstrap" }} 123 | - action: run 124 | label: usrmerge 125 | chroot: false 126 | command: 'echo; "$RECIPEDIR/usrmerge" "$ROOTDIR"' 127 | {{ end }} 128 | 129 | {{ if $foreignarchs }} 130 | - action: run 131 | label: add-foreign-architectures 132 | chroot: true 133 | command: | 134 | set -eux 135 | for a in {{ $foreignarchs }}; do 136 | dpkg --add-architecture "$a" 137 | done 138 | {{ end }} 139 | 140 | - action: run 141 | label: apt update 142 | chroot: true 143 | command: 'apt-get -y -q -oAcquire::Retries=3 update' 144 | 145 | - action: run 146 | label: apt dist-upgrade 147 | chroot: true 148 | command: 'echo; DEBIAN_FRONTEND=noninteractive apt-get -y -q -oAcquire::Retries=3 dist-upgrade' 149 | 150 | - action: run 151 | label: write-manifest 152 | chroot: false 153 | command: | 154 | set -e 155 | echo 156 | "$RECIPEDIR/write-manifest" "$ROOTDIR" 157 | "$RECIPEDIR/list-required-source-code" \ 158 | --output="$ARTIFACTDIR/{{ $artifact_prefix }}.source-required.txt" \ 159 | --sysroot="$ROOTDIR" \ 160 | --strip-source-version-suffix="{{ $strip_source_version_suffix }}" \ 161 | ${NULL+} 162 | cp "$ROOTDIR/usr/manifest.dpkg" "$ARTIFACTDIR/{{ $artifact_prefix }}.manifest.dpkg" 163 | cp "$ROOTDIR/usr/manifest.dpkg.built-using" "$ARTIFACTDIR/{{ $artifact_prefix }}.manifest.dpkg.built-using" 164 | cp "$ROOTDIR/usr/manifest.deb822.gz" "$ARTIFACTDIR/{{ $artifact_prefix }}.manifest.deb822.gz" 165 | cp "$ROOTDIR/etc/apt/sources.list" "$ARTIFACTDIR/{{ $artifact_prefix }}.sources.list" 166 | 167 | if test -e "$ROOTDIR/etc/os-release" && ! test -e "$ROOTDIR/usr/lib/os-release"; then 168 | rm -f "$ROOTDIR/usr/lib/os-release" 169 | mv "$ROOTDIR/etc/os-release" "$ROOTDIR/usr/lib/os-release" 170 | ln -fns ../usr/lib/os-release "$ROOTDIR/etc/os-release" 171 | fi 172 | 173 | if test -e "$ROOTDIR/usr/lib/os-release"; then 174 | "$RECIPEDIR/set-build-id" \ 175 | --build-id="{{ $build_id }}" \ 176 | --variant="{{ $variant }}" \ 177 | --variant-id="{{ $variant_id }}" \ 178 | "$ROOTDIR" 179 | 180 | cp "$ROOTDIR/usr/lib/os-release" "$ARTIFACTDIR/{{ $artifact_prefix }}.os-release.txt" 181 | fi 182 | 183 | # No point in archiving these 184 | - action: run 185 | label: clean-up-before-pack 186 | chroot: false 187 | command: 'echo; "$RECIPEDIR/clean-up-before-pack" "$ROOTDIR"' 188 | 189 | - action: pack 190 | compression: gz 191 | file: {{ $ospack }} 192 | 193 | - action: run 194 | label: pack base tarball 195 | chroot: false 196 | command: > 197 | set -e; 198 | echo; 199 | tar -cf "$ARTIFACTDIR/{{ $ospack }}" 200 | --numeric-owner 201 | --sort=name 202 | --use-compress-program="pigz -n --rsyncable" 203 | -C "$ROOTDIR" 204 | --transform="s,^./,," 205 | . 206 | 207 | - action: run 208 | label: pack apt tarball 209 | chroot: false 210 | command: > 211 | set -e; 212 | echo; 213 | tar -cf "$ARTIFACTDIR/{{ $artifact_prefix }}.apt.tar.gz" 214 | --numeric-owner 215 | --sort=name 216 | --use-compress-program="pigz -n --rsyncable" 217 | -C "$ROOTDIR" 218 | --transform="s,^./,," 219 | etc/apt 220 | var/lib/apt/lists 221 | 222 | - action: run 223 | label: manifests 224 | chroot: false 225 | command: > 226 | set -e; 227 | cd "$ROOTDIR"; 228 | head -n10000 229 | usr/manifest.dpkg 230 | usr/manifest.dpkg.built-using 231 | 232 | - action: run 233 | label: metadata 234 | chroot: false 235 | command: > 236 | set -e; 237 | cd "$ROOTDIR"; 238 | head -n10000 239 | etc/apt/apt.conf 240 | etc/apt/apt.conf.d/* 241 | etc/apt/sources.list 242 | etc/apt/sources.list.d/* 243 | etc/debian_chroot 244 | usr/lib/os-release 245 | || true 246 | -------------------------------------------------------------------------------- /subprojects/flatdeb/flatdeb/set-build-id: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | 3 | # flatdeb — build Flatpak runtimes from Debian packages 4 | # 5 | # Copyright © 2016-2017 Simon McVittie 6 | # Copyright © 2017-2019 Collabora Ltd. 7 | # 8 | # SPDX-License-Identifier: MIT 9 | # 10 | # Permission is hereby granted, free of charge, to any person obtaining 11 | # a copy of this software and associated documentation files (the 12 | # "Software"), to deal in the Software without restriction, including 13 | # without limitation the rights to use, copy, modify, merge, publish, 14 | # distribute, sublicense, and/or sell copies of the Software, and to 15 | # permit persons to whom the Software is furnished to do so, subject to 16 | # the following conditions: 17 | # 18 | # The above copyright notice and this permission notice shall be included 19 | # in all copies or substantial portions of the Software. 20 | # 21 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 24 | # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 25 | # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 26 | # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 27 | # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | 29 | import argparse 30 | import logging 31 | import os 32 | import subprocess 33 | import sys 34 | 35 | try: 36 | import typing 37 | except ImportError: 38 | pass 39 | else: 40 | typing # silence "unused" warnings 41 | 42 | 43 | logger = logging.getLogger('flatdeb.set-build-id') 44 | 45 | 46 | def quote(s): 47 | # We can't use shlex.quote() because it relies on concatenated 48 | # strings, which are valid for sh but not for /etc/os-release 49 | quoted = s.replace( 50 | '\\', '\\\\', 51 | ).replace( 52 | '$', '\\$', 53 | ).replace( 54 | '`', '\\`', 55 | ).replace( 56 | '"', '\\"', 57 | ) 58 | 59 | for c in quoted: 60 | if c >= '\x7f' or not c.isalnum(): 61 | quoted = '"{}"'.format(quoted) 62 | break 63 | 64 | return quoted 65 | 66 | 67 | def main(): 68 | # type: (...) -> None 69 | 70 | parser = argparse.ArgumentParser( 71 | description='Set build ID in chroot' 72 | ) 73 | parser.add_argument('--build-id', default='') 74 | parser.add_argument('--variant', default='') 75 | parser.add_argument('--variant-id', default='') 76 | parser.add_argument('--test-quoting', action='store_true') 77 | parser.add_argument('sysroot') 78 | 79 | args = parser.parse_args() 80 | lines = [] 81 | 82 | if args.test_quoting: 83 | for x in ( 84 | 'debian', 85 | '10', 86 | ): 87 | assert quote(x) == x, x 88 | 89 | for x in ( 90 | 'Debian GNU/Linux 10 (buster)', 91 | '3.141592654', 92 | ): 93 | assert quote(x) == '"' + x + '"', x 94 | 95 | for orig, quoted in ( 96 | ("My 'great' distro", '"My \'great\' distro"'), 97 | ('My "great" distro', '"My \\"great\\" distro"'), 98 | ('$PATH', '"\\$PATH"'), 99 | ('C:\\Windows', '"C:\\\\Windows"'), 100 | ('Shell `injection`', '"Shell \\`injection\\`"'), 101 | ): 102 | assert quote(orig) == quoted 103 | unquoted = subprocess.check_output( 104 | 'printf "%s" ' + quoted, 105 | universal_newlines=True, 106 | shell=True, 107 | ) 108 | assert unquoted == orig, (unquoted, orig) 109 | 110 | return 111 | 112 | os_id = '' 113 | version_codename = '' 114 | version_id = '' 115 | 116 | with open( 117 | os.path.join(args.sysroot, 'usr', 'lib', 'os-release'), 118 | 'r', 119 | ) as reader: 120 | for line in reader: 121 | if line.startswith(('VARIANT=', 'VARIANT_ID=', 'BUILD_ID=')): 122 | logger.info('# Ignoring: %s', line.strip()) 123 | else: 124 | logger.info('%s', line.strip()) 125 | lines.append(line) 126 | value = line.split('=', 1)[1].strip() 127 | 128 | if value[0] == '"': 129 | assert value.endswith('"'), value 130 | value = value[1:-1] 131 | 132 | # Unescape \\, \", \$, \`. The string can't contain \n 133 | # so we can use \n as a placeholder for a literal backslash. 134 | value = value.replace('\\\\', '\n') 135 | value = value.replace('\\', '') 136 | value = value.replace('\n', '\\') 137 | 138 | if line.startswith('ID='): 139 | os_id = value 140 | elif line.startswith('VERSION_CODENAME='): 141 | version_codename = value 142 | elif line.startswith('VERSION_ID='): 143 | version_id = value 144 | 145 | if args.build_id: 146 | logger.info('Adding BUILD_ID=%s', quote(args.build_id)) 147 | lines.append('BUILD_ID={}\n'.format(quote(args.build_id))) 148 | 149 | if args.variant: 150 | logger.info('Adding VARIANT=%s', quote(args.variant)) 151 | lines.append('VARIANT={}\n'.format(quote(args.variant))) 152 | 153 | if args.variant_id: 154 | logger.info('Adding VARIANT_ID=%s', quote(args.variant_id)) 155 | lines.append('VARIANT_ID={}\n'.format(quote(args.variant_id))) 156 | 157 | with open( 158 | os.path.join(args.sysroot, 'usr', 'lib', 'os-release.new'), 159 | 'w', 160 | ) as writer: 161 | writer.writelines(lines) 162 | 163 | os.rename( 164 | os.path.join(args.sysroot, 'usr', 'lib', 'os-release.new'), 165 | os.path.join(args.sysroot, 'usr', 'lib', 'os-release'), 166 | ) 167 | 168 | if version_codename: 169 | # e.g. buster, leading to (buster) user@host:~$ 170 | chroot_name = version_codename 171 | elif version_id: 172 | # e.g. 10, leading to (10) user@host:~$ 173 | chroot_name = version_id 174 | else: 175 | chroot_name = '' 176 | 177 | # We use the OS ID instead of the human-readable NAME because we want 178 | # something short. 179 | if os_id: 180 | if chroot_name: 181 | # e.g. leading to (debian buster) user@host:~$ 182 | # or (debian 10) user@host:~$ 183 | chroot_name = '{} {}'.format(os_id, chroot_name) 184 | else: 185 | # e.g. (debian) user@host:~$ 186 | chroot_name = os_id 187 | 188 | if args.build_id: 189 | if chroot_name: 190 | # e.g. (debian buster 20190603) user@host:~$ 191 | chroot_name = '{} {}'.format(chroot_name, args.build_id) 192 | else: 193 | # e.g. (20190603) user@host:~$ 194 | chroot_name = args.build_id 195 | 196 | if chroot_name: 197 | logger.info('Setting debian_chroot to %r', chroot_name) 198 | 199 | with open( 200 | os.path.join(args.sysroot, 'etc', 'debian_chroot.new'), 201 | 'w', 202 | ) as writer: 203 | writer.write(chroot_name + '\n') 204 | else: 205 | logger.info('Not setting debian_chroot') 206 | 207 | os.rename( 208 | os.path.join(args.sysroot, 'etc', 'debian_chroot.new'), 209 | os.path.join(args.sysroot, 'etc', 'debian_chroot'), 210 | ) 211 | 212 | 213 | if __name__ == '__main__': 214 | if sys.stderr.isatty(): 215 | try: 216 | import colorlog 217 | except ImportError: 218 | logging.basicConfig() 219 | else: 220 | formatter = colorlog.ColoredFormatter( 221 | '%(log_color)s%(levelname)s:%(name)s:%(reset)s %(message)s') 222 | handler = logging.StreamHandler() 223 | handler.setFormatter(formatter) 224 | logging.getLogger().addHandler(handler) 225 | else: 226 | logging.basicConfig() 227 | 228 | logging.getLogger().setLevel(logging.DEBUG) 229 | 230 | try: 231 | main() 232 | except KeyboardInterrupt: 233 | raise SystemExit(130) 234 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | flatdeb - Steam 2 | =============== 3 | 4 | 8 | 9 | [flatdeb](https://salsa.debian.org/smcv/flatdeb) builds Flatpak-style 10 | runtimes from Debian packages. This repository sets it up for the 11 | Steam Runtime. 12 | 13 | How this fits into the overall Steam Runtime project 14 | ---------------------------------------------------- 15 | 16 | 1. Build .deb packages for the content of the Steam Runtime, from 17 | the source code in e.g. 18 | . 19 | This is not part of this git repository. 20 | 21 | 2. For `scout` only: Put together the .deb packages into the 22 | `LD_LIBRARY_PATH`-based Steam Runtime. 23 | This git repository is not relevant for this step. 24 | 25 | 3. Put together the .deb packages into a Flatpak-style container runtime. 26 | This step is done by the code in this git repository. The choice of 27 | the actual packages to include is mostly delegated to 28 | [steamrt](https://gitlab.steamos.cloud/steamrt/steamrt), which has 29 | a branch for each major version of the Steam Runtime. 30 | 31 | 4. To make the runtime suitable for running Steam games and Proton on 32 | (almost) any GNU/Linux machine, turn it into a Steampipe depot 33 | with the runtime itself, the pressure-vessel container runtime tool, 34 | all of the pressure-vessel tool's dependencies except glibc, and some 35 | scripts and Steam manifests to hold the whole thing together. 36 | This is controlled by the `populate-depot.py` script in 37 | [steam-runtime-tools](https://gitlab.steamos.cloud/steamrt/steam-runtime-tools). 38 | 39 | Building Flatpak-style runtimes 40 | ------------------------------- 41 | 42 | On a Debian 10 'buster' machine: 43 | 44 | apt install \ 45 | binutils \ 46 | debootstrap \ 47 | debos \ 48 | dpkg-dev \ 49 | flatpak \ 50 | flatpak-builder \ 51 | ostree \ 52 | pigz \ 53 | python3 \ 54 | python3-debian \ 55 | python3-gi \ 56 | python3-yaml \ 57 | systemd-container \ 58 | time \ 59 | ${NULL} 60 | 61 | You will probably want to use a caching proxy such as apt-cacher-ng to 62 | download `.deb` packages, which you can do by prefixing all the commands 63 | below with `env http_proxy=http://192.168.122.1:3142` or similar. 64 | 65 | Have lots of space in `${XDG_CACHE_HOME}` (defaulting to `~/.cache` 66 | as usual). 67 | 68 | Then you can run something like this: 69 | 70 | subprojects/flatdeb/run.py --suite=scout_beta --arch=amd64,i386 base 71 | subprojects/flatdeb/run.py --suite=scout_beta --arch=amd64,i386 \ 72 | --no-collect-source-code \ 73 | --no-debug-symbols \ 74 | --no-generate-source-tarball \ 75 | --no-ostree-commit \ 76 | runtimes \ 77 | runtimes/scout.yaml 78 | 79 | Depending on the current state of the Steam Runtime development cycle, 80 | the `scout` runtime as configured here might require unreleased packages; 81 | roll back recent commits if necessary. 82 | 83 | Some of the runtimes visible in `suites/` and `runtimes/` are not 84 | currently available to the public: they represent possible future 85 | development. Please see 86 | for more information 87 | about the various branches of the Steam Runtime. 88 | 89 | Options 90 | ------- 91 | 92 | See the flatdeb source code for details. Potentially interesting options 93 | include: 94 | 95 | * `--collect-source-code`: Gather up the complete corresponding source 96 | code, ready to publish. For copyleft (GPL and LGPL) software, 97 | publishing source code that corresponds to each binary build is 98 | the easiest way to comply with the license. 99 | 100 | You can either use `--generate-source-tarball` to collect it into a 101 | very large tar archive (slow!), or `--generate-source-directory=DIR` 102 | to put it all in the directory *DIR*. 103 | 104 | Official builds use `--generate-source-directory=sources`, resulting 105 | in the `./sources` directory, for example 106 | . 107 | 108 | * `--debug-symbols`: Gather up detached debugging symbols in the SDK's 109 | `/usr/lib/debug`, but break them off into `*-debug.tar.gz` instead 110 | of including them in the SDK itself. 111 | 112 | Official builds do this. 113 | 114 | * `--generate-sysroot-tarball`: Generate a `-sysroot.tar.gz` for the SDK. 115 | This is not "merged-/usr" (which sometimes matters when building new 116 | .deb packages, especially in scout), and doesn't have some tweaks that 117 | make it better for pressure-vessel. 118 | 119 | Official builds do this, to produce the `-sysroot.tar.gz` that we 120 | publish. It's also what we use to make the official Docker containers 121 | ([scout](https://gitlab.steamos.cloud/steamrt/scout/sdk), 122 | [soldier](https://gitlab.steamos.cloud/steamrt/soldier/sdk)). 123 | 124 | * `--ostree-commit`: Commit a Flatpak runtime to an OSTree repository 125 | in `~/.cache/flatdeb/repo`. It's the same as what you would get by 126 | committing the contents of the `-runtime.tar.gz` as a tree. 127 | 128 | Official builds don't do this. We originally did, but it's quite slow 129 | and we don't need it at the moment. 130 | 131 | * `--sdk`, `--no-sdk`, `--platform`, `--no-platform`: 132 | Build the SDK (used for debugging and development), or the Platform 133 | (used to run games), or both. The default is to include both, and 134 | that's what official builds do. 135 | 136 | * `--replace-build-apt-source`: 137 | Replace one of the apt sources listed in `suites/*.yaml` with a 138 | different apt source. 139 | 140 | Official builds use this to replace all the apt sources with 141 | equivalents on Valve infrastructure containing packages that haven't 142 | been published or released yet, so that we can test the resulting 143 | build, and if it's good, publish it (together with the packages 144 | it includes). 145 | 146 | * `--add-apt-source`: Add a PPA-style additional layer of packages. 147 | 148 | Official builds don't use this option, but we use it during development 149 | as a way to incorporate unreleased packages into a runtime for testing. 150 | 151 | Building Flatpak apps 152 | --------------------- 153 | 154 | The original concept for this code was to use Steam Runtime 1 'scout' 155 | to make a Flatpak runtime, then package the Steam client (the main Steam app) 156 | to run as a Flatpak app in that runtime. For various reasons, this never 157 | happened, and the focus shifted towards running individual games in 158 | Flatpak-style containers. 159 | 160 | The "app" stage (which builds Flatpak apps) is not regularly tested but 161 | might still work if you're lucky. 162 | 163 | First, you'll need to build runtimes with `--ostree-commit`, to get a 164 | Flatpak runtime to work from. Then you can try building apps on top 165 | of that: 166 | 167 | subprojects/flatdeb/run.py --arch=amd64,i386 app \ 168 | apps/org.debian.packages.mesa_utils.yaml 169 | subprojects/flatdeb/run.py --arch=i386 app \ 170 | apps/org.debian.packages.mesa_utils.yaml 171 | subprojects/flatdeb/run.py --arch=amd64,i386 app \ 172 | apps/com.valvesoftware.Steam.yaml 173 | subprojects/flatdeb/run.py --arch=i386 app \ 174 | apps/com.valvesoftware.Steam.yaml 175 | 176 | On the host, or a test machine onto which you have copied 177 | `$HOME/.cache/flatdeb/repo` with `rsync` or similar: 178 | 179 | flatpak --user remote-add --no-gpg-verify flatdeb $HOME/.cache/flatdeb/repo 180 | flatpak --user install flatdeb org.debian.packages.mesa_utils 181 | flatpak run org.debian.packages.mesa_utils 182 | flatpak --user install flatdeb com.valvesoftware.Steam 183 | flatpak run com.valvesoftware.Steam 184 | 185 | Note that the Steam Flatpak app that is built this way is very much a 186 | proof-of-concept, and does not have all the necessary permissions and 187 | workarounds for the Steam client and games to work particularly reliably. The 188 | [community Steam package on Flathub](https://github.com/flathub/com.valvesoftware.Steam) 189 | is likely to work better in practice. 190 | -------------------------------------------------------------------------------- /subprojects/flatdeb/flatdeb/list-required-source-code: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | 3 | # flatdeb — build Flatpak runtimes from Debian packages 4 | # 5 | # Copyright © 2016-2017 Simon McVittie 6 | # Copyright © 2017-2022 Collabora Ltd. 7 | # 8 | # SPDX-License-Identifier: MIT 9 | # 10 | # Permission is hereby granted, free of charge, to any person obtaining 11 | # a copy of this software and associated documentation files (the 12 | # "Software"), to deal in the Software without restriction, including 13 | # without limitation the rights to use, copy, modify, merge, publish, 14 | # distribute, sublicense, and/or sell copies of the Software, and to 15 | # permit persons to whom the Software is furnished to do so, subject to 16 | # the following conditions: 17 | # 18 | # The above copyright notice and this permission notice shall be included 19 | # in all copies or substantial portions of the Software. 20 | # 21 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 24 | # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 25 | # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 26 | # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 27 | # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | 29 | """ 30 | List required source code for packages installed in the given sysroot. 31 | """ 32 | 33 | import argparse 34 | import logging 35 | import os 36 | import re 37 | import subprocess 38 | import sys 39 | 40 | from debian.debian_support import Version 41 | 42 | try: 43 | import typing 44 | except ImportError: 45 | pass 46 | else: 47 | typing # silence "unused" warnings 48 | 49 | 50 | logger = logging.getLogger('flatdeb.list-required-source-code') 51 | 52 | 53 | class InstalledPackage: 54 | def __init__(self, fields): 55 | # type: (typing.Sequence[str]) -> None 56 | self.binary = fields[0] 57 | self.binary_version = fields[1] 58 | self.source = fields[2] 59 | 60 | if self.source.endswith(')'): 61 | self.source, self.source_version = ( 62 | self.source.rstrip(')').split(' (')) 63 | else: 64 | self.source_version = self.binary_version 65 | 66 | if not self.source: 67 | self.source = self.binary 68 | 69 | self.installed_size = fields[3] 70 | 71 | def __str__(self): 72 | # type: () -> str 73 | return '{}_{}'.format(self.binary, self.binary_version) 74 | 75 | def __hash__(self): 76 | # type: () -> int 77 | return hash(self.binary) ^ hash(self.binary_version) 78 | 79 | def __eq__(self, other): 80 | # type: (typing.Any) -> bool 81 | if isinstance(other, InstalledPackage): 82 | return ( 83 | self.binary, 84 | self.binary_version, 85 | ) == ( 86 | other.binary, 87 | other.binary_version, 88 | ) 89 | else: 90 | return NotImplemented 91 | 92 | 93 | class SourceRequired: 94 | def __init__(self, source, source_version): 95 | # type: (str, Version) -> None 96 | self.source = source 97 | self.source_version = source_version 98 | 99 | def __str__(self): 100 | # type: () -> str 101 | return 'src:{}_{}'.format(self.source, self.source_version) 102 | 103 | def __hash__(self): 104 | # type: () -> int 105 | return hash(self.source) ^ hash(self.source_version) 106 | 107 | def __eq__(self, other): 108 | # type: (typing.Any) -> bool 109 | if isinstance(other, SourceRequired): 110 | return ( 111 | self.source, 112 | self.source_version, 113 | ) == ( 114 | other.source, 115 | other.source_version, 116 | ) 117 | else: 118 | return NotImplemented 119 | 120 | def __lt__(self, other): 121 | # type: (typing.Any) -> bool 122 | if isinstance(other, SourceRequired): 123 | return ( 124 | self.source, 125 | Version(self.source_version), 126 | ) < ( 127 | other.source, 128 | Version(other.source_version), 129 | ) 130 | else: 131 | return NotImplemented 132 | 133 | @property 134 | def get_source(self): 135 | # type: () -> str 136 | return '{}={}'.format(self.source, self.source_version) 137 | 138 | 139 | def read_manifest(path): 140 | # type: (str) -> typing.List[InstalledPackage] 141 | 142 | ret = [] 143 | 144 | with open(path, encoding='utf-8') as reader: 145 | for line in reader: 146 | line = line.rstrip('\n') 147 | 148 | if not line: 149 | continue 150 | 151 | if line.startswith('#'): 152 | continue 153 | 154 | assert '\t' in line, repr(line) 155 | ret.append(InstalledPackage(line.rstrip('\n').split('\t'))) 156 | 157 | return ret 158 | 159 | 160 | def convert_manifest(path): 161 | # type: (str) -> typing.Set[SourceRequired] 162 | ret = set() # type: typing.Set[SourceRequired] 163 | 164 | for p in read_manifest(path): 165 | ret.add(SourceRequired(p.source, p.source_version)) 166 | 167 | return ret 168 | 169 | 170 | def read_built_using(path): 171 | # type: (str) -> typing.Set[SourceRequired] 172 | 173 | ret = set() # type: typing.Set[SourceRequired] 174 | 175 | with open(path, encoding='utf-8') as reader: 176 | for line in reader: 177 | line = line.rstrip('\n') 178 | 179 | if line.startswith('#'): 180 | continue 181 | 182 | package, source, version = line.split('\t') 183 | s = SourceRequired(source, version) 184 | logger.info( 185 | '%s was Built-Using %s', 186 | package, s) 187 | ret.add(s) 188 | 189 | return ret 190 | 191 | 192 | def main(): 193 | # type: (...) -> None 194 | parser = argparse.ArgumentParser( 195 | description='Collect source code', 196 | ) 197 | parser.add_argument('--output', '-o', default='') 198 | parser.add_argument('--built-using', action='append', default=[]) 199 | parser.add_argument('--merge', action='append', default=[]) 200 | parser.add_argument('--strip-source-version-suffix', default='') 201 | parser.add_argument('--sysroot', default='/') 202 | parser.add_argument('manifest', nargs='*') 203 | 204 | args = parser.parse_args() 205 | 206 | strip_source_version_suffix = None 207 | 208 | if args.strip_source_version_suffix: 209 | strip_source_version_suffix = re.compile( 210 | '(?:' + args.strip_source_version_suffix + ')$') 211 | 212 | sources_required = set() # type: typing.Set[SourceRequired] 213 | 214 | for manifest in args.manifest: 215 | sources_required |= convert_manifest(manifest) 216 | 217 | for built_using in args.built_using: 218 | sources_required |= read_built_using(built_using) 219 | 220 | for sysroot in args.sysroot: 221 | manifest = os.path.join(args.sysroot, 'usr', 'manifest.dpkg') 222 | sources_required |= convert_manifest(manifest) 223 | 224 | built_using = os.path.join( 225 | args.sysroot, 'usr', 'manifest.dpkg.built-using', 226 | ) 227 | sources_required |= read_built_using(built_using) 228 | 229 | without_suffix = set() # type: typing.Set[SourceRequired] 230 | 231 | for s in sources_required: 232 | source = s.source 233 | source_version = s.source_version 234 | 235 | # TODO: Is this necessary any more? 236 | source = source.split(':', 1)[0] 237 | 238 | if strip_source_version_suffix is not None: 239 | source_version = strip_source_version_suffix.sub( 240 | '', source_version) 241 | 242 | s = SourceRequired(source, source_version) 243 | without_suffix.add(s) 244 | 245 | for path in args.merge: 246 | with open(path, 'r') as reader: 247 | for line in reader: 248 | if line.startswith('#'): 249 | continue 250 | 251 | source, source_version = line.rstrip('\n').split('\t')[:2] 252 | without_suffix.add(SourceRequired(source, source_version)) 253 | 254 | if args.output: 255 | writer = open(args.output, 'w') # type: typing.TextIO 256 | else: 257 | writer = sys.stdout 258 | 259 | with writer: 260 | writer.write('#Source\t#Version\n') 261 | 262 | for s in sorted(without_suffix): 263 | writer.write('{}\t{}\n'.format(s.source, s.source_version)) 264 | 265 | 266 | if __name__ == '__main__': 267 | if sys.stderr.isatty(): 268 | try: 269 | import colorlog 270 | except ImportError: 271 | logging.basicConfig() 272 | else: 273 | formatter = colorlog.ColoredFormatter( 274 | '%(log_color)s%(levelname)s:%(name)s:%(reset)s %(message)s') 275 | handler = logging.StreamHandler() 276 | handler.setFormatter(formatter) 277 | logging.getLogger().addHandler(handler) 278 | else: 279 | logging.basicConfig() 280 | 281 | logging.getLogger().setLevel(logging.DEBUG) 282 | 283 | try: 284 | main() 285 | except KeyboardInterrupt: 286 | raise SystemExit(130) 287 | except subprocess.CalledProcessError as e: 288 | logger.error('%s', e) 289 | raise SystemExit(1) 290 | -------------------------------------------------------------------------------- /compare-steam-runtime.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | 3 | # Compare Steam Runtime with official package list 4 | # 5 | # Copyright © 2017 Collabora Ltd. 6 | # 7 | # SPDX-License-Identifier: MIT 8 | # 9 | # Permission is hereby granted, free of charge, to any person obtaining 10 | # a copy of this software and associated documentation files (the 11 | # "Software"), to deal in the Software without restriction, including 12 | # without limitation the rights to use, copy, modify, merge, publish, 13 | # distribute, sublicense, and/or sell copies of the Software, and to 14 | # permit persons to whom the Software is furnished to do so, subject to 15 | # the following conditions: 16 | # 17 | # The above copyright notice and this permission notice shall be included 18 | # in all copies or substantial portions of the Software. 19 | # 20 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 23 | # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 24 | # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 25 | # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 26 | # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | 28 | import argparse 29 | import os 30 | from debian.debian_support import Version 31 | 32 | import yaml 33 | 34 | 35 | def main(packages, *, manifest=None, steam=None): 36 | with open('runtimes/com.valvesoftware.SteamRuntime.yaml') as reader: 37 | source_manifest = yaml.safe_load(reader) 38 | 39 | print('---') 40 | 41 | missing_platform = set() 42 | missing_sdk = set() 43 | only_in_flatpak = set() 44 | only_in_steam = set() 45 | newer_in_flatpak = set() 46 | newer_in_steam = set() 47 | 48 | if packages is not None: 49 | print('comparing_packages_txt:') 50 | print(' path: ' + packages) 51 | 52 | with open(packages, 'r') as reader: 53 | for line in reader: 54 | line = line.strip() 55 | 56 | if not line or line.startswith('#'): 57 | continue 58 | 59 | tokens = line.split() 60 | 61 | source = tokens[0] 62 | binaries = tokens[1:] 63 | 64 | for binary in binaries: 65 | if (binary.endswith('-dev') or 66 | binary.endswith('-multidev') or 67 | binary.endswith('-dbg') or 68 | # Probably not intentionally in the user-facing 69 | # Runtime? 70 | # https://github.com/ValveSoftware/steam-runtime/issues/76 71 | binary.endswith('-pic') or 72 | # Probably not intentionally in the user-facing 73 | # Runtime? 74 | # https://github.com/ValveSoftware/steam-runtime/issues/77 75 | binary == 'nvidia-cg-toolkit'): 76 | if binary in source_manifest['sdk'].get( 77 | 'add_packages_multiarch', ()): 78 | continue 79 | 80 | if binary in source_manifest['sdk']['add_packages']: 81 | continue 82 | 83 | missing_sdk.add(binary) 84 | continue 85 | 86 | if binary in source_manifest['add_packages_multiarch']: 87 | continue 88 | 89 | if binary in source_manifest['add_packages']: 90 | continue 91 | 92 | missing_platform.add(binary) 93 | 94 | if missing_platform: 95 | print(' missing_from_platform:') 96 | 97 | for binary in sorted(missing_platform): 98 | print(' - ' + binary) 99 | 100 | if missing_sdk: 101 | print(' missing_from_sdk:') 102 | 103 | for binary in sorted(missing_sdk): 104 | print(' - ' + binary) 105 | 106 | if steam is None: 107 | steam = os.path.join(os.path.expanduser('~'), '.steam', 'steam') 108 | 109 | if not os.path.exists(steam): 110 | steam = None 111 | 112 | steam_runtime = os.path.join(steam, 'ubuntu12_32', 'steam-runtime') 113 | 114 | if not os.path.exists(steam_runtime): 115 | steam_runtime = None 116 | 117 | if steam_runtime is not None and manifest is not None: 118 | print('comparing_steam_installation:') 119 | print(' steam: ' + steam_runtime) 120 | print(' manifest: ' + manifest) 121 | 122 | records = [] 123 | 124 | with open(manifest, 'r') as reader: 125 | for line in reader: 126 | if line.strip().startswith('#'): 127 | continue 128 | 129 | if not line.strip(): 130 | continue 131 | 132 | records.append(line.split('\t')) 133 | 134 | architectures = set() 135 | flatpak_versions = {} 136 | 137 | for line in records: 138 | if line[0].startswith('coreutils:'): 139 | arch = line[0].split(':', 1)[1] 140 | architectures.add(arch) 141 | elif line[0].startswith('libc6:'): 142 | arch = line[0].split(':', 1)[1] 143 | architectures.add(arch) 144 | 145 | flatpak_versions[line[0].split(':', 1)[0]] = line 146 | 147 | in_steam = set() 148 | only_in_flatpak = set() 149 | sources_only_in_flatpak = set() 150 | 151 | for arch in architectures: 152 | contents = os.listdir( 153 | os.path.join(steam_runtime, arch, 'installed')) 154 | 155 | for name in contents: 156 | if name in ('.', '..'): 157 | continue 158 | 159 | if name.endswith('.md5'): 160 | continue 161 | 162 | binary, version, arch_ = name.split('_', 2) 163 | assert arch_ in (arch, 'all'), (arch, name) 164 | in_steam.add(binary) 165 | 166 | flatpak_version = flatpak_versions.get(binary) 167 | 168 | if flatpak_version is None: 169 | only_in_steam.add(binary) 170 | else: 171 | no_epoch_version = Version(flatpak_version[1]) 172 | no_epoch_version.epoch = None 173 | 174 | if no_epoch_version < Version(version): 175 | newer_in_steam.add( 176 | (binary, flatpak_version[1], version, arch)) 177 | 178 | if no_epoch_version > Version(version): 179 | newer_in_flatpak.add( 180 | (binary, flatpak_version[1], version, arch)) 181 | 182 | for package, line in flatpak_versions.items(): 183 | if package not in in_steam: 184 | source = line[2] or package 185 | 186 | if '(' in source: 187 | source_version = source.split('(', 1)[1].strip(')') 188 | else: 189 | source_version = line[1] 190 | 191 | only_in_flatpak.add(package) 192 | sources_only_in_flatpak.add((source, source_version)) 193 | 194 | if only_in_steam: 195 | print(' only_in_steam:') 196 | 197 | for binary in sorted(only_in_steam): 198 | print(' - ' + binary) 199 | 200 | if only_in_flatpak: 201 | print(' only_in_flatpak:') 202 | 203 | for binary in sorted(only_in_flatpak): 204 | print(' - ' + binary) 205 | 206 | if sources_only_in_flatpak: 207 | print(' sources_only_in_flatpak:') 208 | 209 | for source in sorted(sources_only_in_flatpak): 210 | print(' - source: ' + source[0]) 211 | print(' source_version: ' + source[1]) 212 | 213 | if newer_in_flatpak: 214 | print(' newer_in_flatpak:') 215 | 216 | for binary in sorted(newer_in_flatpak): 217 | print(' - package: ' + binary[0]) 218 | print(' in_flatpak: ' + binary[1]) 219 | print(' in_steam: ' + binary[2]) 220 | print(' architecture: ' + binary[3]) 221 | 222 | if newer_in_steam: 223 | print(' newer_in_steam:') 224 | 225 | for binary in sorted(newer_in_steam): 226 | print(' - package: ' + binary[0]) 227 | print(' in_flatpak: ' + binary[1]) 228 | print(' in_steam: ' + binary[2]) 229 | print(' architecture: ' + binary[3]) 230 | 231 | print('...') 232 | 233 | if (missing_platform or missing_sdk or only_in_steam or 234 | newer_in_flatpak or newer_in_steam): 235 | raise SystemExit(1) 236 | 237 | 238 | if __name__ == '__main__': 239 | parser = argparse.ArgumentParser( 240 | description='Compare Steam Runtime with official package list') 241 | parser.add_argument( 242 | '--steam', metavar='STEAM', 243 | help='Path to ~/.steam/steam or ~/.local/share/Steam', 244 | ) 245 | parser.add_argument( 246 | '--manifest', metavar='MANIFEST', 247 | help='Path to ' 248 | '~/.local/share/flatpak/runtime/' 249 | 'com.valvesoftware.SteamRuntime.Platform/' 250 | 'x86_64/scout_beta/active/files/manifest.dpkg or similar', 251 | ) 252 | parser.add_argument( 253 | 'packages', metavar='PACKAGES.TXT', 254 | help='Path to packages.txt from the Steam Runtime', 255 | ) 256 | args = parser.parse_args() 257 | main(args.packages, manifest=args.manifest, steam=args.steam) 258 | -------------------------------------------------------------------------------- /subprojects/flatdeb/flatdeb/collect-source-code: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | 3 | # flatdeb — build Flatpak runtimes from Debian packages 4 | # 5 | # Copyright © 2016-2017 Simon McVittie 6 | # Copyright © 2017-2018 Collabora Ltd. 7 | # 8 | # SPDX-License-Identifier: MIT 9 | # 10 | # Permission is hereby granted, free of charge, to any person obtaining 11 | # a copy of this software and associated documentation files (the 12 | # "Software"), to deal in the Software without restriction, including 13 | # without limitation the rights to use, copy, modify, merge, publish, 14 | # distribute, sublicense, and/or sell copies of the Software, and to 15 | # permit persons to whom the Software is furnished to do so, subject to 16 | # the following conditions: 17 | # 18 | # The above copyright notice and this permission notice shall be included 19 | # in all copies or substantial portions of the Software. 20 | # 21 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 24 | # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 25 | # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 26 | # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 27 | # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | 29 | """ 30 | Fetch source code for packages installed in the given sysroot. 31 | """ 32 | 33 | import argparse 34 | import logging 35 | import os 36 | import subprocess 37 | import sys 38 | 39 | from debian.debian_support import Version 40 | 41 | try: 42 | import typing 43 | except ImportError: 44 | pass 45 | else: 46 | typing # silence "unused" warnings 47 | 48 | 49 | logger = logging.getLogger('flatdeb.collect-source-code') 50 | 51 | 52 | class SourceRequired: 53 | def __init__(self, source, source_version): 54 | # type: (str, Version) -> None 55 | self.source = source 56 | self.source_version = source_version 57 | 58 | def __str__(self): 59 | # type: () -> str 60 | return 'src:{}_{}'.format(self.source, self.source_version) 61 | 62 | def __hash__(self): 63 | # type: () -> int 64 | return hash(self.source) ^ hash(self.source_version) 65 | 66 | def __eq__(self, other): 67 | # type: (typing.Any) -> bool 68 | if isinstance(other, SourceRequired): 69 | return ( 70 | self.source, 71 | self.source_version, 72 | ) == ( 73 | other.source, 74 | other.source_version, 75 | ) 76 | else: 77 | return NotImplemented 78 | 79 | def __lt__(self, other): 80 | # type: (typing.Any) -> bool 81 | if isinstance(other, SourceRequired): 82 | return ( 83 | self.source, 84 | Version(self.source_version), 85 | ) < ( 86 | other.source, 87 | Version(other.source_version), 88 | ) 89 | else: 90 | return NotImplemented 91 | 92 | @property 93 | def get_source(self): 94 | # type: () -> str 95 | return '{}={}'.format(self.source, self.source_version) 96 | 97 | 98 | def read_required(path): 99 | # type: (str) -> typing.Set[SourceRequired] 100 | 101 | ret = set() 102 | 103 | with open(path, encoding='utf-8') as reader: 104 | for line in reader: 105 | line = line.rstrip('\n') 106 | 107 | if line.startswith('#'): 108 | continue 109 | 110 | source, version = line.split('\t') 111 | ret.add(SourceRequired(source, version)) 112 | 113 | return ret 114 | 115 | 116 | def main(): 117 | # type: (...) -> None 118 | parser = argparse.ArgumentParser( 119 | description='Collect source code', 120 | ) 121 | parser.add_argument('--output', '-o', default='') 122 | parser.add_argument('--sysroot', default='/') 123 | parser.add_argument('required', nargs='+') 124 | 125 | args = parser.parse_args() 126 | 127 | in_chroot = [ 128 | 'systemd-nspawn', 129 | '--directory={}'.format(args.sysroot), 130 | '--as-pid2', 131 | '--pipe', 132 | '--tmpfs=/run/lock', 133 | '--register=no', 134 | ] 135 | 136 | if args.output: 137 | in_chroot.append( 138 | '--bind={}:/src/files'.format(os.path.abspath(args.output)) 139 | ) 140 | 141 | in_chroot.append('env') 142 | 143 | for var in ('ftp_proxy', 'http_proxy', 'https_proxy', 'no_proxy'): 144 | if var in os.environ: 145 | in_chroot.append('{}={}'.format(var, os.environ[var])) 146 | 147 | sources_required = set() 148 | 149 | for path in args.required: 150 | sources_required |= read_required(path) 151 | 152 | get_source = [] # type: typing.List[str] 153 | included = set() # type: typing.Set[SourceRequired] 154 | missing_sources = set() # type: typing.Set[SourceRequired] 155 | 156 | for s in sorted(sources_required): 157 | logger.debug(s.get_source) 158 | get_source.append(s.get_source) 159 | 160 | options = ['-q', '-q', '-y', '--download-only'] 161 | options.append('-oAPT::Get::Only-Source=true') 162 | options.append('-oAcquire::Retries=3') 163 | 164 | try: 165 | subprocess.check_call(in_chroot + [ 166 | 'sh', '-euc', 167 | 'dir="$1"; shift; mkdir -p "$dir"; cd "$dir"; "$@"', 168 | 'sh', # argv[0] 169 | '/src/files', # working directory 170 | 'apt-get' 171 | ] + options + [ 172 | 'source', 173 | ] + get_source) 174 | except subprocess.CalledProcessError: 175 | logger.warning( 176 | 'Unable to download some sources as a batch, trying ' 177 | 'to download sources individually') 178 | 179 | for s in sources_required: 180 | try: 181 | subprocess.check_call(in_chroot + [ 182 | 'sh', '-euc', 183 | 'dir="$1"; shift; mkdir -p "$dir"; cd "$dir"; "$@"', 184 | 'sh', # argv[0] 185 | '/src/files', # working directory 186 | 'apt-get', 187 | ] + options + [ 188 | 'source', 189 | s.get_source, 190 | ]) 191 | except subprocess.CalledProcessError: 192 | # Non-fatal for now 193 | logger.warning( 194 | 'Unable to get source code for %s', s.source) 195 | missing_sources.add(s) 196 | subprocess.call(in_chroot + [ 197 | 'apt-cache', 'showsrc', s.source, 198 | ]) 199 | else: 200 | included.add(s) 201 | else: 202 | included = set(sources_required) 203 | 204 | parent = args.output or os.path.join(args.sysroot, 'src', 'files') 205 | os.makedirs(parent, mode=0o755, exist_ok=True) 206 | 207 | with open(os.path.join(parent, 'Sources'), 'wb') as binary_writer: 208 | subprocess.check_call( 209 | ['dpkg-scansources', '.'], 210 | cwd=parent, 211 | stdout=binary_writer, 212 | ) 213 | 214 | with open( 215 | os.path.join(parent, 'Sources.gz'), 'wb' 216 | ) as binary_writer: 217 | subprocess.check_call([ 218 | 'pigz', '-c', '-n', '--rsyncable', 219 | os.path.join(parent, 'Sources'), 220 | ], stdout=binary_writer) 221 | 222 | os.remove(os.path.join(parent, 'Sources')) 223 | 224 | try: 225 | with open( 226 | os.path.join(parent, 'sources.txt'), 'r' 227 | ) as reader: 228 | for line in reader: 229 | if line.startswith('#'): 230 | continue 231 | 232 | source, source_version = line.rstrip('\n').split('\t')[:2] 233 | included.add(SourceRequired(source, source_version)) 234 | except OSError: 235 | pass 236 | 237 | with open( 238 | os.path.join(parent, 'sources.txt'), 'w' 239 | ) as writer: 240 | writer.write('#Source\t#Version\n') 241 | 242 | for s in sorted(included): 243 | writer.write('{}\t{}\n'.format(s.source, s.source_version)) 244 | 245 | if missing_sources: 246 | logger.warning('Missing source packages:') 247 | 248 | try: 249 | with open( 250 | os.path.join(parent, 'MISSING.txt'), 'r' 251 | ) as reader: 252 | for line in reader: 253 | if line.startswith('#'): 254 | continue 255 | 256 | source, source_version = line.rstrip('\n').split('\t')[:2] 257 | missing_sources.add(SourceRequired(source, source_version)) 258 | except OSError: 259 | pass 260 | 261 | with open( 262 | os.path.join(parent, 'MISSING.txt'), 'w' 263 | ) as writer: 264 | writer.write('#Source\t#Version\n') 265 | 266 | for s in sorted(missing_sources): 267 | logger.warning('- %s', s) 268 | writer.write('{}\t{}\n'.format(s.source, s.source_version)) 269 | 270 | logger.warning('Check that this runtime is GPL-compliant!') 271 | 272 | 273 | if __name__ == '__main__': 274 | if sys.stderr.isatty(): 275 | try: 276 | import colorlog 277 | except ImportError: 278 | logging.basicConfig() 279 | else: 280 | formatter = colorlog.ColoredFormatter( 281 | '%(log_color)s%(levelname)s:%(name)s:%(reset)s %(message)s') 282 | handler = logging.StreamHandler() 283 | handler.setFormatter(formatter) 284 | logging.getLogger().addHandler(handler) 285 | else: 286 | logging.basicConfig() 287 | 288 | logging.getLogger().setLevel(logging.DEBUG) 289 | 290 | try: 291 | main() 292 | except KeyboardInterrupt: 293 | raise SystemExit(130) 294 | except subprocess.CalledProcessError as e: 295 | logger.error('%s', e) 296 | raise SystemExit(1) 297 | -------------------------------------------------------------------------------- /subprojects/flatdeb/apps/openarena/0001-Add-experimental-Flatpak-support.patch: -------------------------------------------------------------------------------- 1 | From 507e07512bfb10fbe9a208ea685b79e0108d5d67 Mon Sep 17 00:00:00 2001 2 | From: Simon McVittie 3 | Date: Tue, 28 Nov 2017 15:33:30 +0000 4 | Subject: [PATCH] Add experimental Flatpak support 5 | 6 | If built with build profile pkg.flatpak.app, relocate to /app and do 7 | not build the openarena-server package. 8 | --- 9 | debian/control | 2 + 10 | ...openarena.desktop => openarena.desktop.in} | 2 +- 11 | debian/openarena.install | 12 ++-- 12 | debian/openarena.links | 28 ++++---- 13 | debian/rules | 67 ++++++++++++++----- 14 | debian/scripts/openarena.in | 10 ++- 15 | debian/source/lintian-overrides | 5 ++ 16 | 7 files changed, 87 insertions(+), 39 deletions(-) 17 | rename debian/{openarena.desktop => openarena.desktop.in} (91%) 18 | mode change 100644 => 100755 debian/openarena.install 19 | mode change 100644 => 100755 debian/openarena.links 20 | create mode 100644 debian/source/lintian-overrides 21 | 22 | diff --git a/src/debian/control b/src/debian/control 23 | index 0c59dc0b..7057354c 100644 24 | --- a/src/debian/control 25 | +++ b/src/debian/control 26 | @@ -8,6 +8,7 @@ Uploaders: 27 | Simon McVittie , 28 | Build-Depends: 29 | debhelper (>= 10), 30 | + dh-exec, 31 | dpkg-dev (>= 1.16.1), 32 | ioquake3-server (>= 1.36+u20150730+dfsg1-1~), 33 | Standards-Version: 4.2.1 34 | @@ -44,6 +45,7 @@ Description: fast-paced 3D first-person shooter 35 | This package installs the OpenArena client. 36 | 37 | Package: openarena-server 38 | +Build-Profiles: 39 | Architecture: any 40 | Depends: 41 | adduser, 42 | diff --git a/src/debian/openarena.desktop b/src/debian/openarena.desktop.in 43 | similarity index 91% 44 | rename from debian/openarena.desktop 45 | rename to debian/openarena.desktop.in 46 | index ea3bae61..50ec568c 100644 47 | --- a/src/debian/openarena.desktop 48 | +++ b/src/debian/openarena.desktop.in 49 | @@ -2,7 +2,7 @@ 50 | Name=OpenArena 51 | Comment=A fast-paced 3D first-person shooter, similar to id Software Inc.'s Quake III Arena 52 | Comment[de]=Ein hektischer und netzwerkfähiger 3D Ego-Shooter, ähnlich zu Quake III Arena von id Software Inc. 53 | -Exec=/usr/games/openarena 54 | +Exec=@gamesbindir@/openarena 55 | Terminal=false 56 | Icon=openarena128 57 | Type=Application 58 | diff --git a/src/debian/openarena.install b/src/debian/openarena.install 59 | old mode 100644 60 | new mode 100755 61 | index 7bccbd3c..5b79fbab 62 | --- a/src/debian/openarena.install 63 | +++ b/src/debian/openarena.install 64 | @@ -1,5 +1,7 @@ 65 | -debian/openarena.desktop usr/share/applications 66 | -debian/openarena128.png usr/share/icons/hicolor/128x128/apps 67 | -debian/scripts/openarena usr/games 68 | -usr/lib/openarena/*/*.so 69 | -usr/lib/openarena/*/*/*.so 70 | +#!/usr/bin/dh-exec 71 | + 72 | +debian/openarena.desktop ${datadir}/applications 73 | +debian/openarena128.png ${datadir}/icons/hicolor/128x128/apps 74 | +debian/scripts/openarena ${gamesbindir} 75 | +${pkglibdir}/*/*.so 76 | +${pkglibdir}/*/*/*.so 77 | diff --git a/src/debian/openarena.links b/src/debian/openarena.links 78 | old mode 100644 79 | new mode 100755 80 | index 52e939c2..72bf6a18 81 | --- a/src/debian/openarena.links 82 | +++ b/src/debian/openarena.links 83 | @@ -1,13 +1,15 @@ 84 | -usr/share/doc/openarena-088-data/CREDITS-0.8.8 usr/share/doc/openarena/CREDITS 85 | -usr/share/doc/openarena-088-data/readme_088.txt.gz usr/share/doc/openarena/README.gz 86 | -usr/share/doc/openarena-data/changelog.gz usr/share/doc/openarena/changelog.gz 87 | -usr/share/games/openarena/baseoa/pak0.pk3 usr/lib/openarena/baseoa/pak0.pk3 88 | -usr/share/games/openarena/baseoa/pak1-maps.pk3 usr/lib/openarena/baseoa/pak1-maps.pk3 89 | -usr/share/games/openarena/baseoa/pak2-players-mature.pk3 usr/lib/openarena/baseoa/pak2-players-mature.pk3 90 | -usr/share/games/openarena/baseoa/pak2-players.pk3 usr/lib/openarena/baseoa/pak2-players.pk3 91 | -usr/share/games/openarena/baseoa/pak4-textures.pk3 usr/lib/openarena/baseoa/pak4-textures.pk3 92 | -usr/share/games/openarena/baseoa/pak5-TA.pk3 usr/lib/openarena/baseoa/pak5-TA.pk3 93 | -usr/share/games/openarena/baseoa/pak6-misc.pk3 usr/lib/openarena/baseoa/pak6-misc.pk3 94 | -usr/share/games/openarena/baseoa/pak6-patch085.pk3 usr/lib/openarena/baseoa/pak6-patch085.pk3 95 | -usr/share/games/openarena/baseoa/pak6-patch088.pk3 usr/lib/openarena/baseoa/pak6-patch088.pk3 96 | -usr/share/games/openarena/missionpack/mp-pak0.pk3 usr/lib/openarena/missionpack/mp-pak0.pk3 97 | +#!/usr/bin/dh-exec 98 | + 99 | +${docdir}/openarena-088-data/CREDITS-0.8.8 ${docdir}/openarena/CREDITS 100 | +${docdir}/openarena-088-data/readme_088.txt.gz ${docdir}/openarena/README.gz 101 | +${docdir}/openarena-data/changelog.gz ${docdir}/openarena/changelog.gz 102 | +${pkggamesdatadir}/baseoa/pak0.pk3 ${pkglibdir}/baseoa/pak0.pk3 103 | +${pkggamesdatadir}/baseoa/pak1-maps.pk3 ${pkglibdir}/baseoa/pak1-maps.pk3 104 | +${pkggamesdatadir}/baseoa/pak2-players-mature.pk3 ${pkglibdir}/baseoa/pak2-players-mature.pk3 105 | +${pkggamesdatadir}/baseoa/pak2-players.pk3 ${pkglibdir}/baseoa/pak2-players.pk3 106 | +${pkggamesdatadir}/baseoa/pak4-textures.pk3 ${pkglibdir}/baseoa/pak4-textures.pk3 107 | +${pkggamesdatadir}/baseoa/pak5-TA.pk3 ${pkglibdir}/baseoa/pak5-TA.pk3 108 | +${pkggamesdatadir}/baseoa/pak6-misc.pk3 ${pkglibdir}/baseoa/pak6-misc.pk3 109 | +${pkggamesdatadir}/baseoa/pak6-patch085.pk3 ${pkglibdir}/baseoa/pak6-patch085.pk3 110 | +${pkggamesdatadir}/baseoa/pak6-patch088.pk3 ${pkglibdir}/baseoa/pak6-patch088.pk3 111 | +${pkggamesdatadir}/missionpack/mp-pak0.pk3 ${pkglibdir}/missionpack/mp-pak0.pk3 112 | diff --git a/src/debian/rules b/src/debian/rules 113 | index 7f6ea085..f5050c25 100755 114 | --- a/src/debian/rules 115 | +++ b/src/debian/rules 116 | @@ -10,6 +10,22 @@ DEB_CFLAGS_MAINT_APPEND := \ 117 | $(NULL) 118 | 119 | include /usr/share/dpkg/default.mk 120 | +binaries := $(shell dh_listpackages) 121 | + 122 | +ifneq ($(filter pkg.flatpak.app,$(DEB_BUILD_PROFILES)),) 123 | +export prefix = /app 124 | +export gamesbindir = ${prefix}/bin 125 | +else 126 | +export prefix = /usr 127 | +export gamesbindir = ${prefix}/games 128 | +endif 129 | + 130 | +export datadir = ${prefix}/share 131 | +export docdir = ${datadir}/doc 132 | +export gamesdatadir = ${datadir}/games 133 | +export libdir = ${prefix}/lib 134 | +export pkggamesdatadir = ${gamesdatadir}/openarena 135 | +export pkglibdir = ${libdir}/openarena 136 | 137 | %: 138 | dh $@ 139 | @@ -20,6 +36,9 @@ else 140 | TARGET = debug 141 | endif 142 | 143 | +# Find q3arch via $PATH so it works with or without being in /app 144 | +PATH := ${datadir}/ioquake3:/usr/share/ioquake3:${PATH} 145 | + 146 | common_options = \ 147 | V=1 \ 148 | BUILD_STANDALONE=1 \ 149 | @@ -32,7 +51,7 @@ common_options = \ 150 | USE_INTERNAL_SPEEX=0 \ 151 | USE_INTERNAL_ZLIB=0 \ 152 | USE_LOCAL_HEADERS=0 \ 153 | - $(shell /usr/share/ioquake3/q3arch make ${DEB_HOST_GNU_CPU} ${DEB_HOST_GNU_SYSTEM}) \ 154 | + $(shell q3arch make ${DEB_HOST_GNU_CPU} ${DEB_HOST_GNU_SYSTEM}) \ 155 | SDL_CFLAGS= \ 156 | BUILD_CLIENT=0 \ 157 | BUILD_SERVER=0 \ 158 | @@ -58,19 +77,26 @@ override_dh_auto_build: 159 | dh_auto_build -- $(common_options) $(GAME_OPTIONS) $(TARGET) 160 | dh_auto_build -- $(common_options) $(GAME_081_OPTIONS) $(TARGET) 161 | sed \ 162 | + -e 's!@libdir@!${libdir}!' \ 163 | -e 's!@IOQ3BINARY@!ioquake3!' \ 164 | -e 's!@IOQ3SELF@!openarena!' \ 165 | -e 's!@IOQ3ROLE@!client!' \ 166 | - -e 's!@FS_BASEPATH@!/usr/lib/openarena!' \ 167 | + -e 's!@FS_BASEPATH@!${pkglibdir}!' \ 168 | < debian/scripts/openarena.in > debian/scripts/openarena 169 | + chmod +x debian/scripts/openarena 170 | sed \ 171 | + -e 's!@gamesbindir@!${gamesbindir}!' \ 172 | + < debian/openarena.desktop.in > debian/openarena.desktop 173 | +ifneq ($(filter openarena-server,$(binaries)),) 174 | + sed \ 175 | + -e 's!@libdir@!${libdir}!' \ 176 | -e 's!@IOQ3BINARY@!ioq3ded!' \ 177 | -e 's!@IOQ3SELF@!openarena-server!' \ 178 | -e 's!@IOQ3ROLE@!server!' \ 179 | - -e 's!@FS_BASEPATH@!/usr/lib/openarena-server!' \ 180 | + -e 's!@FS_BASEPATH@!${libdir}/openarena-server!' \ 181 | < debian/scripts/openarena.in > debian/scripts/openarena-server 182 | - chmod +x debian/scripts/openarena 183 | chmod +x debian/scripts/openarena-server 184 | +endif 185 | 186 | override_dh_clean: 187 | dh_clean --exclude README-0.8.8~ 188 | @@ -78,41 +104,44 @@ override_dh_clean: 189 | override_dh_auto_clean: 190 | rm -f build-stamp 191 | rm -rf build 192 | + rm -f debian/openarena.desktop 193 | rm -f debian/scripts/openarena 194 | rm -f debian/scripts/openarena-server 195 | 196 | override_dh_auto_install: DESTDIR = debian/tmp 197 | override_dh_auto_install: 198 | - install -d $(DESTDIR)/usr/games 199 | - install -d $(DESTDIR)/usr/lib/openarena/baseoa/pak0/ 200 | - install -d $(DESTDIR)/usr/lib/openarena/baseoa/pak6-patch085/ 201 | - install -d $(DESTDIR)/usr/lib/openarena/baseoa/pak6-patch088/ 202 | - install -d $(DESTDIR)/usr/lib/openarena/missionpack/ 203 | - install -d $(DESTDIR)/usr/lib/openarena-server/baseoa/ 204 | - install -d $(DESTDIR)/usr/lib/openarena-server/missionpack/ 205 | + install -d $(DESTDIR)${gamesbindir} 206 | + install -d $(DESTDIR)${pkglibdir}/baseoa/pak0/ 207 | + install -d $(DESTDIR)${pkglibdir}/baseoa/pak6-patch085/ 208 | + install -d $(DESTDIR)${pkglibdir}/baseoa/pak6-patch088/ 209 | + install -d $(DESTDIR)${pkglibdir}/missionpack/ 210 | # The client currently needs two builds: 211 | # * one compatible with OA 0.8.1 pure servers 212 | # * one compatible with OA 0.8.5 and 0.8.8 pure servers 213 | # On impure servers, we default to the latest. 214 | install -m644 build/0.8.1-compat/baseq3/*.so \ 215 | - $(DESTDIR)/usr/lib/openarena/baseoa/pak0/ 216 | + $(DESTDIR)${pkglibdir}/baseoa/pak0/ 217 | install -m644 build/normal/baseq3/*.so \ 218 | - $(DESTDIR)/usr/lib/openarena/baseoa/pak6-patch088 219 | - ( cd $(DESTDIR)/usr/lib/openarena/baseoa/pak6-patch085 && \ 220 | + $(DESTDIR)${pkglibdir}/baseoa/pak6-patch088 221 | + ( cd $(DESTDIR)${pkglibdir}/baseoa/pak6-patch085 && \ 222 | ln -s ../pak6-patch088/*.so . ) 223 | - ( cd $(DESTDIR)/usr/lib/openarena/baseoa && \ 224 | + ( cd $(DESTDIR)${pkglibdir}/baseoa && \ 225 | ln -s pak6-patch088/*.so . ) 226 | # The "mission pack" doesn't currently have incompatible versions so 227 | # just use the latest 228 | install -m644 build/normal/missionpack/*.so\ 229 | - $(DESTDIR)/usr/lib/openarena/missionpack/ 230 | + $(DESTDIR)${pkglibdir}/missionpack/ 231 | +ifneq ($(filter openarena-server,$(binaries)),) 232 | + install -d $(DESTDIR)${libdir}/openarena-server/baseoa/ 233 | + install -d $(DESTDIR)${libdir}/openarena-server/missionpack/ 234 | # The server only needs the latest version, since it's the server 235 | # that determines which version clients are expected to be 236 | # compatible with 237 | install -m644 build/normal/baseq3/qagame*.so \ 238 | - $(DESTDIR)/usr/lib/openarena-server/baseoa/ 239 | + $(DESTDIR)${libdir}/openarena-server/baseoa/ 240 | install -m644 build/normal/missionpack/qagame*.so\ 241 | - $(DESTDIR)/usr/lib/openarena-server/missionpack/ 242 | + $(DESTDIR)${libdir}/openarena-server/missionpack/ 243 | +endif 244 | 245 | override_dh_strip: 246 | # Don't generate openarena-server-dbgsym since it contains files 247 | @@ -120,7 +149,9 @@ override_dh_strip: 248 | # when compared with openarena-data, so it doesn't seem worthwhile 249 | # to add an openarena-common package to make them shareable. 250 | dh_strip -popenarena --dbgsym-migration='openarena-dbg (<< 0.8.8-19~)' 251 | +ifneq ($(filter openarena-server,$(binaries)),) 252 | dh_strip -popenarena-server --no-automatic-dbgsym 253 | +endif 254 | 255 | # --------------------------------------------------------------------------- 256 | 257 | diff --git a/src/debian/scripts/openarena.in b/src/debian/scripts/openarena.in 258 | index 37189806..89551777 100644 259 | --- a/src/debian/scripts/openarena.in 260 | +++ b/src/debian/scripts/openarena.in 261 | @@ -1,15 +1,21 @@ 262 | #!/bin/sh 263 | 264 | +libdir=@libdir@ 265 | # quake3 or quake3-server or whatever 266 | IOQ3SELF=@IOQ3SELF@ 267 | # "server" or "client" 268 | IOQ3ROLE=@IOQ3ROLE@ 269 | # ioquake3 or ioq3ded 270 | IOQ3BINARY=@IOQ3BINARY@ 271 | -# /usr/lib/openarena or /usr/lib/openarena-server 272 | +# ${libdir}/openarena or ${libdir}/openarena-server 273 | FS_BASEPATH=@FS_BASEPATH@ 274 | 275 | -ENGINE="/usr/lib/ioquake3/${IOQ3BINARY}" 276 | +# Be independent of whether ioquake3 has also been relocated 277 | +if [ -e "${libdir}/ioquake3/${IOQ3BINARY}" ]; then 278 | + ENGINE="${libdir}/ioquake3/${IOQ3BINARY}" 279 | +else 280 | + ENGINE="/usr/lib/ioquake3/${IOQ3BINARY}" 281 | +fi 282 | 283 | DEBUGGER="$OPENARENA_DEBUGGER" 284 | 285 | diff --git a/src/debian/source/lintian-overrides b/src/debian/source/lintian-overrides 286 | new file mode 100644 287 | index 00000000..a6f48b46 288 | --- /dev/null 289 | +++ b/src/debian/source/lintian-overrides 290 | @@ -0,0 +1,5 @@ 291 | +dh-exec-subst-unknown-variable debian/openarena.install datadir 292 | +dh-exec-subst-unknown-variable debian/openarena.install gamesbindir 293 | +dh-exec-subst-unknown-variable debian/openarena.install pkglibdir 294 | +dh-exec-subst-unknown-variable debian/openarena.links docdir 295 | +dh-exec-subst-unknown-variable debian/openarena.links pkggamesdatadir 296 | -- 297 | 2.20.0.rc1 298 | 299 | --------------------------------------------------------------------------------