File: create-components.sh

package info (click to toggle)
icingadb 1.5.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 59,960 kB
  • sloc: ansic: 170,157; asm: 7,097; sql: 4,098; sh: 1,614; cpp: 1,132; makefile: 438; xml: 160
file content (59 lines) | stat: -rwxr-xr-x 1,437 bytes parent folder | download | duplicates (3)
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
#!/bin/bash

if [ -z "$1" ]; then
    echo "Usage: $0 <ORIGTARGZ>"
    exit 1
fi

UPSTREAM_TARBALL="$(realpath -s "$1")"

if [ ! -e "${UPSTREAM_TARBALL}" ]; then
    echo "Error: Upstream tarball not found"
    exit 1
fi

COMPONENT_NAME="dependencies"
COMPONENT_TARBALL="${UPSTREAM_TARBALL//.orig.tar/.orig-${COMPONENT_NAME}.tar}"

TEMP_DIR="$(mktemp -d)"

GOPATH="${TEMP_DIR}/${COMPONENT_NAME}"
export GOPATH

echo "Unpacking upstream tarball: ${UPSTREAM_TARBALL} into: ${TEMP_DIR}"
tar --strip-components=1 -xaf "${UPSTREAM_TARBALL}" -C "${TEMP_DIR}"

MAIN_DIR="${TEMP_DIR}/cmd/icingadb"

echo "Getting main dependencies into: ${GOPATH}"
cd "${MAIN_DIR}" || exit 1
go get .
cd "${OLDPWD}" || exit 1

MIGRATE_DIR="${TEMP_DIR}/cmd/icingadb-migrate"

echo "Getting migrate dependencies into: ${GOPATH}"
cd "${MIGRATE_DIR}" || exit 1
go get .
cd "${OLDPWD}" || exit 1

#TESTS_DIR="${TEMP_DIR}/tests"
#
#echo "Getting test dependencies into: ${GOPATH}"
#cd "${TESTS_DIR}" || exit 1
#go get -t .
#cd "${OLDPWD}" || exit 1

echo "Fixing permissions for: ${GOPATH}"
chmod -R u+w "${GOPATH}"

echo "Removing unwanted files from: ${GOPATH}"
find "${GOPATH}" -name "*.exe" -print -delete

echo "Creating component tarball: ${COMPONENT_TARBALL}"
cd "${TEMP_DIR}" || exit 1
tar --owner root --group root -caf "${COMPONENT_TARBALL}" "${COMPONENT_NAME}"
cd "${OLDPWD}" || exit 1

echo "Removing temporary directory: ${TEMP_DIR}"
rm -rf "${TEMP_DIR}"