Add Platform v2.0

master
Marko Semet 2020-01-14 23:36:29 +01:00
parent 5cf561347f
commit a6b0f2d251
15 changed files with 222 additions and 317 deletions

3
.gitmodules vendored 100644
View File

@ -0,0 +1,3 @@
[submodule "tools"]
path = tools
url = https://git.marko10-000.de/flatpaks/tools.git

View File

@ -0,0 +1,82 @@
build-runtime: true
writable-sdk: true
id: de.marko10_000.winebarrels.WineSdk
id-platform: de.marko10_000.winebarrels.Wine
branch: "{{VERSION}}-staging"
sdk: de.marko10_000.winebarrels.Sdk
runtime: de.marko10_000.winebarrels.Platform
runtime-version: "v2.0"
separate-locales: false
inherit-extensions:
- org.freedesktop.Platform.GL32
- org.freedesktop.Platform.GL
- org.freedesktop.Platform.Timezones
- org.freedesktop.Platform.GStreamer
- org.freedesktop.Platform.Icontheme
- org.gtk.Gtk3theme
- org.freedesktop.Platform.VAAPI.Intel
- org.freedesktop.Platform.openh264
- de.marko10_000.winebarrels.Platform.ExtensionsV2
- de.marko10_000.winebarrels.Platform.Gecko
- de.marko10_000.winebarrels.Platform.Mono
modules:
- name: test-arch
buildsystem: simple
build-commands:
- false
skip-arches:
- x86_64
- name: wine
sources:
- type: archive
url: "{{WINE_SOURCE}}"
sha256: "{{WINE_SOURCE_SHA256}}"
- type: archive
url: "{{WINE_SOURCE_STAGING}}"
sha256: "{{WINE_SOURCE_STAGING_SHA256}}"
dest: wine-staging-patches
- type: shell
commands:
- wine-staging-patches/patches/patchinstall.sh --all
buildsystem: simple
build-commands:
- mkdir -p build/64
- cd build/64; ../../configure
--prefix=/usr
--libdir=/usr/lib
--with-x
--disable-tests
--enable-win64
CFLAGS=-O2\ -D_FORTIFY_SOURCE=2
CPPFLAGS=-O2\ -D_FORTIFY_SOURCE=2
CC=ccache\ gcc
CPP=ccache\ cpp
- make -C build/64 -j$FLATPAK_BUILDER_N_JOBS
- mkdir -p build/32
- cd build/32; ../../configure
--prefix=/usr
--libdir=/usr/lib32
--with-x
--with-wine64=../64
--disable-tests
CFLAGS=-O2\ -D_FORTIFY_SOURCE=2
CPPFLAGS=-O2\ -D_FORTIFY_SOURCE=2
CC=ccache\ gcc
CPP=ccache\ cpp
- make -C build/32 -j$FLATPAK_BUILDER_N_JOBS
- make -C build/32 DESTDIR=/usr/tmp_wine install -j$FLATPAK_BUILDER_N_JOBS
- make -C build/64 DESTDIR=/usr/tmp_wine install -j$FLATPAK_BUILDER_N_JOBS
- rm -rf /usr/tmp_wine/usr/share/man
- cp -arvP --remove-destination /usr/tmp_wine/usr/* /usr
- rm -rf /usr/tmp_wine
cleanup-platform:
- /include
- "*.a"
- "*.la"

View File

@ -0,0 +1,74 @@
build-runtime: true
writable-sdk: true
id: de.marko10_000.winebarrels.WineSdk
id-platform: de.marko10_000.winebarrels.Wine
branch: "{{VERSION}}"
sdk: de.marko10_000.winebarrels.Sdk
runtime: de.marko10_000.winebarrels.Platform
runtime-version: "v2.0"
separate-locales: false
inherit-extensions:
- org.freedesktop.Platform.GL32
- org.freedesktop.Platform.GL
- org.freedesktop.Platform.Timezones
- org.freedesktop.Platform.GStreamer
- org.freedesktop.Platform.Icontheme
- org.gtk.Gtk3theme
- org.freedesktop.Platform.VAAPI.Intel
- org.freedesktop.Platform.openh264
- de.marko10_000.winebarrels.Platform.ExtensionsV2
- de.marko10_000.winebarrels.Platform.Gecko
- de.marko10_000.winebarrels.Platform.Mono
modules:
- name: test-arch
buildsystem: simple
build-commands:
- false
skip-arches:
- x86_64
- name: wine
sources:
- type: archive
url: {{WINE_SOURCE}}
sha256: {{WINE_SOURCE_SHA256}}
buildsystem: simple
build-commands:
- mkdir -p build/64
- cd build/64; ../../configure
--prefix=/usr
--libdir=/usr/lib
--with-x
--disable-tests
--enable-win64
CFLAGS=-O2\ -D_FORTIFY_SOURCE=2
CPPFLAGS=-O2\ -D_FORTIFY_SOURCE=2
CC=ccache\ gcc
CPP=ccache\ cpp
- make -C build/64 -j$FLATPAK_BUILDER_N_JOBS
- mkdir -p build/32
- cd build/32; ../../configure
--prefix=/usr
--libdir=/usr/lib32
--with-x
--with-wine64=../64
--disable-tests
CFLAGS=-O2\ -D_FORTIFY_SOURCE=2
CPPFLAGS=-O2\ -D_FORTIFY_SOURCE=2
CC=ccache\ gcc
CPP=ccache\ cpp
- make -C build/32 -j$FLATPAK_BUILDER_N_JOBS
- make -C build/32 DESTDIR=/usr/tmp_wine install -j$FLATPAK_BUILDER_N_JOBS
- make -C build/64 DESTDIR=/usr/tmp_wine install -j$FLATPAK_BUILDER_N_JOBS
- cp -arvP --remove-destination /usr/tmp_wine/usr/* /usr
- rm -rf /usr/tmp_wine
cleanup-platform:
- /include
- "*.a"
- "*.la"

View File

@ -0,0 +1,6 @@
#! /usr/bin/env bash
# Args: <build-args> [<repo>]
CONFIG_DIR="$(dirname "$0")" &&
"$CONFIG_DIR/versions.py" "$CONFIG_DIR/build_amd64.sh" " $1" "$2" &&
"$CONFIG_DIR/versions.py" -s "$CONFIG_DIR/build_amd64.sh" " $1" "$2"

View File

@ -0,0 +1,5 @@
#! /usr/bin/env bash
# Args: <file> <build-args> [<repo>]
"$(dirname "$0")/../tools/hash_modules.py" --require-build "$1" x86_64 &&
exec "$(dirname "$0")/../tools/build.sh" "$1" x86_64 "$2" "$3"

View File

@ -0,0 +1,5 @@
"5.0-rc5":
"WINE_SOURCE": "https://dl.winehq.org/wine/source/5.0/wine-5.0-rc5.tar.xz"
"WINE_SOURCE_STAGING": "https://github.com/wine-staging/wine-staging/archive/v5.0-rc5.tar.gz"
"WINE_SOURCE_SHA256": "aa1a20a9a98c9193f922c78fd8ad5a1ce1d3df98a5795c79692a52b7e54dd38b"
"WINE_SOURCE_STAGING_SHA256": "f6707bfd291a08cb2c6892f077e01618af40d9db0f293597e5d427946e481b7c"

View File

@ -0,0 +1,46 @@
#! /usr/bin/env python3
if __name__ == "__main__":
import argparse
import os
import subprocess
import sys
import tempfile
import yaml
parser = argparse.ArgumentParser(description="Run script for all versions.")
parser.add_argument("script", metavar="script", type=str, nargs=1,
help="The script to run with the config file as argument.")
parser.add_argument("args", metavar="args", nargs='*', help="Args to add aditional.")
parser.add_argument("-s", "--staging", dest="staging", action="store_const",
const=True, default=False, help="Generate staging config.")
args = parser.parse_args()
# Load configuration
ownPath = os.path.split(sys.argv[0])[0]
filePath = None
if args.staging:
filePath = os.path.join(ownPath, "Wine-staging-x86_64.yaml")
else:
filePath = os.path.join(ownPath, "Wine-x86_64.yaml")
fileData = open(filePath, "r").read()
config = yaml.load(open(os.path.join(ownPath, "sources.yaml"), "r").read(), Loader=yaml.SafeLoader)
# Run script for each version
for version, i in config.items():
# Gen config file
tmp = fileData.replace("{{VERSION}}", version)
for jID, j in i.items():
tmp = tmp.replace("{{" + jID + "}}", j)
# Generate config file
outFile = tempfile.mktemp(".yaml")
with open(outFile, "w") as f:
f.write(tmp)
# Call script
try:
subprocess.call([args.script[0], outFile] + args.args)
finally:
os.remove(outFile)

View File

@ -1,7 +0,0 @@
#! /usr/bin/env bash
# Args: <config-system> <arch> <version> <repo>
CONFIG_DIR="`dirname \"$0\"`" &&
"$CONFIG_DIR/$1/gen_script.sh" "$2" "$3" tmp.yaml &&
HASH="`\"\$CONFIG_DIR/hash_modules.py\" tmp.yaml \"\$2\" | sed -n '1p'`" &&
flatpak-builder --force-clean "--arch=$2" --gpg-sign=winebarrels@marko10-000.de "--repo=$4" -s "WB_HASH='${HASH}'" build tmp.yaml

View File

@ -1,17 +0,0 @@
#! /usr/bin/env bash
# Args: <repo>
if [ "`whoami`" != "root" ]
then
(>&2 echo Programm has to run as root.)
exit 1
fi
if [ -z "$SUDO_USER" ]
then
(>&2 echo Programm has to be run as sudo. SUDO_USER not set.)
exit 1
fi
CONFIG_DIR="`dirname \"$0\"`" &&
echo '' | sudo -u "$SUDO_USER" -v &&
REPO="$1" "$CONFIG_DIR/list.sh" "$CONFIG_DIR/build_in_tmp.sh"

View File

@ -1,35 +0,0 @@
#! /usr/bin/env bash
# Args: <config-system> <arch> <version> <repo>
if [ "`whoami`" != "root" ]
then
(>&2 echo Programm has to run as root.)
exit 1
fi
if [ -z "$SUDO_USER" ]
then
(>&2 echo Programm has to be run as sudo. SUDO_USER not set.)
exit 1
fi
if [ "$#" = 4 ]
then
REPO="$4"
fi
CONFIG_DIR=$(dirname "$0") &&
BUILD_DIR=$(sudo -u "$SUDO_USER" -H mktemp -d) &&
sudo -u "$SUDO_USER" -H mkdir -p ".flatpak-builder/ccache" &&
sudo -u "$SUDO_USER" -H mkdir -p ".flatpak-builder/downloads" &&
sudo -u "$SUDO_USER" -H mkdir -p "$BUILD_DIR/.flatpak-builder/ccache" &&
sudo -u "$SUDO_USER" -H mkdir -p "$BUILD_DIR/.flatpak-builder/downloads" &&
mount --bind ".flatpak-builder/ccache" "$BUILD_DIR/.flatpak-builder/ccache" &&
mount --bind ".flatpak-builder/downloads" "$BUILD_DIR/.flatpak-builder/downloads" &&
cd "$BUILD_DIR" &&
sudo -u "$SUDO_USER" -H "$CONFIG_DIR/build.sh" "$1" "$2" "$3" "$REPO"
RESULT=$!
umount "$BUILD_DIR/.flatpak-builder/ccache" &&
umount "$BUILD_DIR/.flatpak-builder/downloads" &&
cd &&
rm -rf "$BUILD_DIR"
exit $RESULT

View File

@ -1,11 +0,0 @@
#! /usr/bin/env bash
list=$(ostree refs --repo "$1" | sort)
counts=$(echo "$list" | wc -l)
index=1
for i in $list
do
echo "Move($index/$counts): $i"
index=$(expr $index + 1)
flatpak build-commit-from --src-repo "$1" --src-ref "$i" --disable-fsync --no-update-summary --gpg-sign=winebarrels@marko10-000.de "$2" "$i"
done

View File

@ -1,149 +0,0 @@
#!/usr/bin/env python3
import hashlib
import json
import os
import re
import subprocess
import yaml
def _load_stdout(args):
p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
p.wait()
result = p.stdout.read()
if p.returncode != 0:
raise RuntimeError("Process crashed with " + repr(p.returncode)
+ ". Args: " + repr(args))
return result
_moduleFiles = {}
class ModuleLoader():
path = str
content = dict
__hash_find = re.compile(".*WB_HASH\\=\\'(?P<hash>[a-zA-Z0-9]*)\\'.*")
def __module(self, modules):
for iID in range(len(modules)):
i = modules[iID]
if isinstance(i, str):
i = self.relative(i)
if i in _moduleFiles:
tmp = _moduleFiles[i]
else:
tmp = ModuleLoader(i)
modules[iID] = tmp.content
else:
if "modules" in i:
self.__module(i["modules"])
def __init__(self, source):
if not isinstance(source, str):
raise ValueError("source have to be string. It was a "
+ repr(source) + ".")
self.path = os.path.abspath(source)
_moduleFiles[self.path] = self
self.content = yaml.load(open(self.path, "r").read(),
Loader=yaml.SafeLoader)
if "modules" in self.content:
self.__module(self.content["modules"])
def hash(self, function):
tmp = json.dumps(self.content, skipkeys=False, ensure_ascii=True,
check_circular=True, allow_nan=True, indent=None,
separators=("", ""), default=None, sort_keys=True)
tmp = tmp.encode("utf-8")
return function(tmp)
def gen_base_version(self, arch):
version = self.content["runtime-version"]
sdk = _load_stdout(["flatpak", "info", "-c", "--arch=" + arch,
"--user", self.content["sdk"], version])
platform = _load_stdout(["flatpak", "info", "-c", "--arch=" + arch,
"--user", self.content["runtime"], version])
sdk = sdk.splitlines()[0]
platform = platform.splitlines()[0]
return sdk, platform
def get_depends(self, arch):
version_src = "/" + arch + "/" + self.content["runtime-version"]
version_target = "/" + arch + "/" + self.content["branch"]
result = [self.content["sdk"] + version_src,
self.content["runtime"] + version_src,
self.content["id"] + version_target,
self.content["id-platform"] + version_target]
return result
def get_old_hash(self, arch):
vers = self.content["branch"]
try:
hash_sdk = _load_stdout(["flatpak", "info", "--arch=" + arch,
"--user", self.content["id"], vers])
hash_platform = _load_stdout(["flatpak", "info", "--arch=" + arch,
"--user",
self.content["id-platform"], vers])
if b"WB_HASH=" in hash_sdk:
hash_sdk = hash_sdk[hash_sdk.find(b"WB_HASH="):]
hash_sdk = self.__hash_find.match(hash_sdk.decode())
if hash_sdk is None:
hash_sdk = "--None--"
else:
hash_sdk = hash_sdk.groupdict()["hash"]
if b"WB_HASH=" in hash_platform:
hash_platform = hash_platform[hash_platform.find(b"WB_HASH="):]
hash_platform = self.__hash_find.match(hash_platform.decode())
if hash_platform is None:
hash_platform = "--None--"
else:
hash_platform = hash_platform.groupdict()["hash"]
return hash_sdk, hash_platform
except RuntimeError:
return "--None--", "--None--"
def relative(self, file):
return os.path.abspath(os.path.join(os.path.split(self.path)[0], file))
def get_hashes(source, arch):
mod = ModuleLoader(source)
parent_ids = b" ".join(mod.gen_base_version(arch)) + b" "
# Hash config
def hash_methode(hashclass):
def func(data):
tmp = hashclass()
tmp.update(parent_ids)
tmp.update(data)
return tmp.hexdigest()
return func
own = mod.hash(hash_methode(hashlib.sha3_512)).upper()
# Get old hash
old1, old2 = mod.get_old_hash(args.arch[0])
return own, old1, old2
def get_depends(source, arch):
mod = ModuleLoader(source)
return mod.get_depends(arch)
if __name__ == '__main__':
import argparse
# Parse config
parser = argparse.ArgumentParser(description="Generate hash of a module.")
parser.add_argument("file", metavar="file", type=str, nargs=1,
help="File configuration to generate hash.")
parser.add_argument("arch", metavar="arch", type=str, nargs=1,
help="The arch to build.")
parser.add_argument("--depends", dest="dependes", action="store_const",
const=True, default=False, help="List source runtime.")
args = parser.parse_args()
if args.dependes:
print("\n".join(get_depends(args.file[0], args.arch[0])))
else:
print("\n".join(get_hashes(args.file[0], args.arch[0])))

View File

@ -1,36 +0,0 @@
#!/usr/bin/env bash
REPO_PATH="$1"
function install {
echo "Installing: $1/$3" >&2
flatpak build-commit-from --gpg-sign=winebarrels@marko10-000.de --extra-collection-id=de.marko10_000.Winebarrels --no-update-summary --disable-fsync "--src-repo=$REPO_PATH" "--src-ref=runtime/$1/$2" "$REPO_PATH" "runtime/$1/$3" || (
ostree commit --repo "$REPO_PATH" --bind-ref="runtime/$1/$2" -b "runtime/$1/$3" --fsync=none --skip-if-unchanged &&
flatpak build-commit-from --gpg-sign=winebarrels@marko10-000.de --extra-collection-id=de.marko10_000.Winebarrels --no-update-summary --disable-fsync "--src-repo=$REPO_PATH" "--src-ref=runtime/$1/$2" "$REPO_PATH" -v "runtime/$1/$3"
)
}
#
# SETTINGS
#
STABLE_WINE="4.0.3"
LATEST_WINE="4.21"
LATEST_STAGING_WINE="4.21-staging"
#
# Install
#
install "de.marko10_000.winebarrels.WineSdk" "x86_64/$STABLE_WINE" "x86_64/stable"
install "de.marko10_000.winebarrels.WineSdk" "i386/$STABLE_WINE" "i386/stable"
install "de.marko10_000.winebarrels.Wine" "x86_64/$STABLE_WINE" "x86_64/stable"
install "de.marko10_000.winebarrels.Wine" "i386/$STABLE_WINE" "i386/stable"
install "de.marko10_000.winebarrels.WineSdk" "x86_64/$LATEST_WINE" "x86_64/latest"
install "de.marko10_000.winebarrels.WineSdk" "i386/$LATEST_WINE" "i386/latest"
install "de.marko10_000.winebarrels.Wine" "x86_64/$LATEST_WINE" "x86_64/latest"
install "de.marko10_000.winebarrels.Wine" "i386/$LATEST_WINE" "i386/latest"
install "de.marko10_000.winebarrels.WineSdk" "x86_64/$LATEST_STAGING_WINE" "x86_64/latest-staging"
install "de.marko10_000.winebarrels.WineSdk" "i386/$LATEST_STAGING_WINE" "i386/latest-staging"
install "de.marko10_000.winebarrels.Wine" "x86_64/$LATEST_STAGING_WINE" "x86_64/latest-staging"
install "de.marko10_000.winebarrels.Wine" "i386/$LATEST_STAGING_WINE" "i386/latest-staging"

62
list.sh
View File

@ -1,62 +0,0 @@
#! /usr/bin/env bash
# Check user
USE_SUDO=()
if [ "`whoami`" = "root" ]
then
if [ -z "$SUDO_USER" ]
then
(>&2 echo Run as root. SUDO_USER not set.)
exit 1
fi
(>&2 echo Run processes as "$SUDO_USER.")
USE_SUDO=( sudo "-u" "$SUDO_USER" "-H" )
fi
# Get config an command
CONFIG_DIR="`dirname \"$0\"`"
if [ "$#" = 0 ]
then
COMMAND=(echo)
else
COMMAND=$@
fi
function run_command {
tmp="${USE_SUDO[*]} " &&
tmp+=$@ &&
$tmp
}
function list_required {
"$CONFIG_DIR/$1/list.sh" | while read -r i
do
# Load data
i="`echo \"\$i\" | sed 's/ /\n/g'`" &&
ARCH="`echo \"$i\" | sed -n '1p'`" &&
VERSION="`echo \"$i\" | sed -n '2p'`" &&
# Install depends
"$CONFIG_DIR/$1/gen_script.sh" "$ARCH" "$VERSION" tmp.yaml &&
j=$(run_command "$CONFIG_DIR/hash_modules.py" --depends tmp.yaml "$ARCH")
echo "$j" | while read -r k
do
(run_command flatpak install -y --user winebarrels "$k" > /dev/null 2> /dev/null)
done
# Check version
j=$(run_command "$CONFIG_DIR/hash_modules.py" tmp.yaml "$ARCH") &&
CURRENT_VERS="`echo \"\$j\" | sed -n '1p'`" &&
WINE_VERS="`echo \"\$j\" | sed -n '2p'`" &&
WINE_SDK_VERS="`echo \"\$j\" | sed -n '3p'`"
if [ "$CURRENT_VERS" != "$WINE_VERS" ]
then
$COMMAND "$1" "$ARCH" "$VERSION"
elif [ "$CURRENT_VERS" != "$WINE_SDK_VERS" ]
then
$COMMAND "$1" "$ARCH" "$VERSION"
fi
done
}
list_required "Platform-v1.0"

1
tools 160000

@ -0,0 +1 @@
Subproject commit d05f998c394ffba0a152064fd22940f07cbcfbdf