File tree 4 files changed +47
-20
lines changed
4 files changed +47
-20
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ # This is a library which contains functions used inside ci/build
4
+ #
5
+ # We separated it into it's own file so that we could easily unit test
6
+ # these functions and helpers.
7
+
8
+ # On some CPU architectures (notably node/uname "armv7l", default on Raspberry Pis),
9
+ # different package managers have different labels for the same CPU (deb=armhf, rpm=armhfp).
10
+ # This function returns the overriden arch on platforms
11
+ # with alternate labels, or the same arch otherwise.
12
+ get_nfpm_arch () {
13
+ case " $ARCH " in
14
+ armv7l)
15
+ if [ " $PKG_FORMAT " = " deb" ]; then
16
+ echo armhf
17
+ elif [ " $PKG_FORMAT " = " rpm" ]; then
18
+ echo armhfp
19
+ fi
20
+ ;;
21
+ * )
22
+ echo " $ARCH "
23
+ ;;
24
+ esac
25
+ }
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ set -euo pipefail
7
7
main () {
8
8
cd " $( dirname " ${0} " ) /../.."
9
9
source ./ci/lib.sh
10
+ source ./ci/build/build-lib.sh
10
11
11
12
# Allow us to override architecture
12
13
# we use this for our Linux ARM64 cross compile builds
@@ -43,18 +44,6 @@ release_gcp() {
43
44
cp " ./release-packages/$release_name .tar.gz" " ./release-gcp/latest/$OS -$ARCH .tar.gz"
44
45
}
45
46
46
- # On some CPU architectures (notably node/uname "armv7l", default on Raspberry Pis),
47
- # different package managers have different labels for the same CPU (deb=armhf, rpm=armhfp).
48
- # This function parses arch-override.json and returns the overriden arch on platforms
49
- # with alternate labels, or the same arch otherwise.
50
- get_nfpm_arch () {
51
- if jq -re " .${PKG_FORMAT} .${ARCH} " ./ci/build/arch-override.json > /dev/null; then
52
- jq -re " .${PKG_FORMAT} .${ARCH} " ./ci/build/arch-override.json
53
- else
54
- echo " $ARCH "
55
- fi
56
- }
57
-
58
47
# Generates deb and rpm packages.
59
48
release_nfpm () {
60
49
local nfpm_config
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bats
2
+
3
+ SCRIPT_NAME=" build-lib.sh"
4
+ SCRIPT=" $BATS_TEST_DIRNAME /../../ci/build/$SCRIPT_NAME "
5
+
6
+ source " $SCRIPT "
7
+
8
+ @test " get_nfpm_arch should return armhfp for rpm on armv7l" {
9
+ PKG_FORMAT=" rpm" ARCH=" armv7l" run get_nfpm_arch
10
+ [ " $output " = " armhfp" ]
11
+ }
12
+
13
+ @test " get_nfpm_arch should return armhf for deb on armv7l" {
14
+ PKG_FORMAT=" deb" ARCH=" armv7l" run get_nfpm_arch
15
+ [ " $output " = " armhf" ]
16
+ }
17
+
18
+ @test " get_nfpm_arch should return arch if no arch override exists " {
19
+ PKG_FORMAT=" deb" ARCH=" i386" run get_nfpm_arch
20
+ [ " $output " = " i386" ]
21
+ }
You can’t perform that action at this time.
0 commit comments