forked from openSUSE/obs-build
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-recipe-appimage
128 lines (112 loc) · 4.09 KB
/
build-recipe-appimage
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#################################################################
#
# AppImage specific functions.
#
# Author: Adrian Schroeter <[email protected]>
#
################################################################
#
# Copyright (c) 2017 SUSE Linux Products GmbH
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or 3 as
# published by the Free Software Foundation.
#
# 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 (see the file COPYING); if not, write to the
# Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
#
################################################################
recipe_setup_appimage() {
TOPDIR=/usr/src/packages
test "$DO_INIT_TOPDIR" = false || rm -rf "$BUILD_ROOT$TOPDIR"
for i in OTHER SOURCES APPIMAGE_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"
rawcfgmacros=.rpmmacros
test "$BUILDTYPE" = debbuild && rawcfgmacros=.debmacros
queryconfig rawmacros --dist "$BUILD_DIST" --archpath "$BUILD_ARCH" --configdir "$CONFIG_DIR" > $BUILD_ROOT/root/$rawcfgmacros
}
recipe_prepare_appimage() {
:
}
# Variables:
# $BUILD_ROOT is the chroot
# $TOPDIR/SOURCES includes the appimages sources
# $TOPDIR/$APPIMAGE_ROOT where appimage will be called
# $RECIPEFILE the name of the appimage.yml config file
recipe_build_appimage() {
local ARCH DEB
if [ -x "$BUILD_ROOT/bin/rpm" ]; then
ARCH=$(chroot $BUILD_ROOT su -c "rpm --eval '%{_target_cpu}'")
else
ARCH=$(chroot $BUILD_ROOT su -c "dpkg-architecture -qDEB_BUILD_ARCH")
DEB=1
fi
local DIST="OBS"
test -z "${ARCH}" -o -z "${DIST}" && cleanup_and_exit 1
test -d $BUILD_ROOT/.build.binaries || cleanup_and_exit 1 "missing $BUILD_ROOT/.build.binaries"
if test "$DO_INIT" = true; then
if test -n "$DEB" -a ! -d "$BUILD_ROOT/.build.binaries/dists" ; then
echo "creating debian repository metadata..."
createrepo_debian $BUILD_ROOT/.build.binaries ${ARCH} ${DIST}
# setup /etc/apt/sources.list
mkdir -p "$BUILD_ROOT/etc/apt"
echo "deb [trusted=yes] file:/.build.binaries OBS main" >> "$BUILD_ROOT/etc/apt/sources.list"
fi
if test -z "$DEB" -a ! -d "$BUILD_ROOT/.build.binaries/repodata" ; then
echo "creating repository metadata..."
if chroot "$BUILD_ROOT" test -x /usr/bin/createrepo_c; then
chroot "$BUILD_ROOT" /usr/bin/createrepo_c /.build.binaries
elif chroot "$BUILD_ROOT" test -x /usr/bin/createrepo; then
chroot "$BUILD_ROOT" /usr/bin/createrepo /.build.binaries
else
cleanup_and_exit 1 "No createrepo found in build root"
fi
fi
fi
release_option=""
if test -n "$RELEASE" ; then
release_option="--release $RELEASE"
fi
chroot $BUILD_ROOT su -c "cd $TOPDIR/SOURCES && ARCH=$ARCH /usr/lib/appimagetool/pkg2appimage $release_option" - root \
|| cleanup_and_exit 1
# extract build result basenames
local build_results=""
for i in $BUILD_ROOT/$TOPDIR/OTHER/* ; do
test -f "$i" || continue
case "${i##*/}" in
*.AppImage|*.AppImage.digest|*.AppImage.zsync)
build_results="${build_results}\n${i%%.snap}"
;;
*)
;;
esac
done
# Fail the build if no build results are found
if [ -z "${build_results}" ] ; then
cleanup_and_exit 1 "No live-build result found"
fi
BUILD_SUCCEEDED=true
}
recipe_resultdirs_appimage() {
:
}
recipe_cleanup_appimage() {
:
}
# Local Variables:
# mode: Shell-script
# End: