forked from openSUSE/obs-build
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-recipe-flatpak
108 lines (92 loc) · 3.21 KB
/
build-recipe-flatpak
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#################################################################
#
# Flatpak specific functions.
#
# Author: Tina Müller <tina.mueller@suse.com>
#
################################################################
#
# Copyright © 2020 SUSE LLC
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, see <http://www.gnu.org/licenses/>.
#
################################################################
recipe_setup_flatpak() {
echo $BUILD_ROOT
pwd
TOPDIR=/usr/src/packages
"$DO_INIT_TOPDIR" && rm -rf "$BUILD_ROOT$TOPDIR"
for i in OTHER SOURCES FLATPAK_ROOT ; do
mkdir -p "$BUILD_ROOT$TOPDIR/$i"
done
if test "$MYSRCDIR" = $BUILD_ROOT/.build-srcdir ; then
mv "$MYSRCDIR"/* $BUILD_ROOT$TOPDIR/SOURCES/
else
copy_sources "$MYSRCDIR" "$BUILD_ROOT$TOPDIR/SOURCES/"
fi
chown -hR "$ABUILD_UID:$ABUILD_GID" "$BUILD_ROOT$TOPDIR"
}
recipe_prepare_flatpak() {
:
}
# Variables:
# $BUILD_ROOT is the chroot
# $TOPDIR/SOURCES includes the sources
# $RECIPEFILE the name of the flatpak.(yaml|json) config file
recipe_build_flatpak() {
echo "===================== recipe_build_flatpak ($@)"
set -e
mkdir -p "$BUILD_ROOT/var/lib/flatpak/runtime"
cd "$BUILD_ROOT/var/lib/flatpak/runtime"
# Unpack the tarfiles installed by the rpms
local pkg
for i in ../tars/*.tar.gz; do
echo "Unpacking $i"
pkg="$(basename $i)" pkg="${pkg/-*}"
[[ -d $pkg ]] || tar xf $i
done
ls -l $BUILD_ROOT$TOPDIR/SOURCES
cd "$BUILD_ROOT$TOPDIR/FLATPAK_ROOT"
cp $BUILD_ROOT$TOPDIR/SOURCES/* .
local FLATPAK_FILE="$TOPDIR/SOURCES/$RECIPEFILE"
local FLATPAK_FILE_LOCAL="$TOPDIR/SOURCES/flatpak-local.yaml"
local FLATPAK_APP=$(perl -I$BUILD_DIR -MBuild::Flatpak -e 'Build::Flatpak::show' -- "$BUILD_ROOT$FLATPAK_FILE" name)
local FLATPAK_APP_VERSION=$(perl -I$BUILD_DIR -MBuild::Flatpak -e 'Build::Flatpak::show' -- "$BUILD_ROOT$FLATPAK_FILE" version)
# Rewrite http urls to file urls
perl -I$BUILD_DIR -MBuild::Flatpak -e 'Build::Flatpak::rewrite' -- "$BUILD_ROOT$FLATPAK_FILE" > "$BUILD_ROOT$FLATPAK_FILE_LOCAL"
FLATPAK_FILE="$FLATPAK_FILE_LOCAL"
FLATPAK_APP_VERSION="${FLATPAK_APP_VERSION:-0}"
local FLATPAK_REPO=/tmp/flatpakrepo
local FLATPAK_REMOTE=https://dl.flathub.org/repo/flathub.flatpakrepo
export FLATPAK_REPO
export FLATPAK_REMOTE
export FLATPAK_APP
export FLATPAK_APP_VERSION
export FLATPAK_FILE
export TOPDIR
export RELEASE
chroot "$BUILD_ROOT" su -c "flatpak list"
$BUILD_DIR/call-flatpak-builder --root "$BUILD_ROOT"
set +e
BUILD_SUCCEEDED=true
}
recipe_resultdirs_flatpak() {
:
}
recipe_cleanup_flatpak() {
:
}
# Local Variables:
# mode: Shell-script
# End: