-
Notifications
You must be signed in to change notification settings - Fork 5
/
ci-build
executable file
·41 lines (34 loc) · 1.73 KB
/
ci-build
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
#! /bin/bash
#--
# Copyright (C) 2021 SUSE LLC
# This library is free software; you can redistribute it and/or modify
# it only under the terms of version 2.1 of the GNU Lesser General Public
# License as published by the Free Software Foundation.
#
# This library 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 Lesser General Public License for more
# details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#++
set -e -x
# check the license and changelog then build the tarball
rake package
# run the osc source validator to check the .spec and .changes locally
(cd package && /usr/lib/obs/service/source_validator)
# Build the binary package locally, use plain "rpmbuild" to make it simple.
# "osc build" is too resource hungry (builds a complete chroot from scratch).
# Moreover it does not work in a Docker container (it fails when trying to mount
# /proc and /sys in the chroot).
cp package/* /usr/src/packages/SOURCES/
rpmbuild -bb -D "jobs $(nproc)" --with coverage --nodeps package/*.spec
# test the %pre/%post scripts by installing/updating/removing the built packages
# ignore the dependencies to make the test easier, as a smoke test it's good enough
rpm -iv --force --nodeps /usr/src/packages/RPMS/*/*.rpm
rpm -Uv --force --nodeps /usr/src/packages/RPMS/*/*.rpm
# get the plain package names and remove all packages at once
mapfile -t packages < <(rpm -q --qf '%{NAME}\n' -p /usr/src/packages/RPMS/*/*.rpm)
rpm -ev --nodeps "${packages[@]}"