Debian Codegraph @

build-recipe-flatpak

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