blob: 26b3a1ded5da48263c8a5b2b97435318fa912fc9 (
plain)
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
|
# Maintainer: Maykel Moya <mmoya [at] mmoya [dot] org>
_extractedName="google-cloud-sdk"
_pkgname="google-cloud-cli"
pkgname="${_pkgname}-lite"
pkgver=502.0.0
pkgrel=1
pkgdesc="A distribution of the gcloud CLI that strips unnecessary dependencies to reduce the size by > 75%"
url="https://github.com/tonymet/gcloud-lite"
license=('Apache-2.0')
arch=('x86_64')
depends=('python' 'python-botocore')
optdepends=(
"python-crcmod: [gsutil] verify the integrity of GCS object contents"
)
options=('!strip' 'staticlibs' !zipman)
source=(
"$pkgname-$pkgver.orig.tar.gz::${url}/releases/download/${pkgver}/google-cloud-cli-${pkgver}-linux-x86_64-lite.tar.gz"
"google-cloud-cli.sh"
"0003-add-compdef-to-zsh-completion.patch"
)
# Conflict the old package name to force migration
conflicts=('google-cloud-sdk' 'google-cloud-cli')
provides=('google-cloud-sdk' 'google-cloud-cli')
replaces=('google-cloud-sdk')
sha256sums=('1ed59c505fc7eb66531470c20010d1099d4c4df9ba6591f1293696023580a359'
'5d9ca924675b24fc1ed044cf52f9f218e72ddc12703770271b0417a4a3c3a15d'
'c19dbe916e6fd18d9b17b3309ee60c5d389035c5520822d2c14c045d8b853924')
prepare() {
cd "${_extractedName}"
for f in "${source[@]}"; do
[[ "$f" =~ \.patch$ ]] && \
( \
patch -p1 -i "${srcdir}/${f}" > /dev/null 2>&1 ||\
( \
echo "failed to apply patch: $(basename ${f})" && \
exit 1 \
) \
)
done
}
package() {
mkdir "${pkgdir}/opt"
cp -r "${_extractedName}" "${pkgdir}/opt/${_pkgname}"
# The Google code uses a _TraceAction() method which spams the screen even
# in "quiet" mode, we're throwing away output on purpose to keep it clean
# ref: lib/googlecloudsdk/core/platforms_install.py
"${pkgdir}/opt/${_pkgname}/install.sh" \
--quiet \
--usage-reporting false \
--path-update false \
--bash-completion false \
> /dev/null
find $pkgdir -name '__pycache__' -type d -exec rm -rf {} +
install -D -m 0755 "${srcdir}/${source[1]}" \
"${pkgdir}/etc/profile.d/google-cloud-cli.sh"
install -d -m 0755 \
"${pkgdir}/etc/bash_completion.d" \
"${pkgdir}/usr/share/zsh/site-functions" \
ln -rsT "${pkgdir}/opt/${_pkgname}/completion.bash.inc" \
"${pkgdir}/etc/bash_completion.d/google-cloud-cli"
for cmd in gcloud gsutil bq; do
ln -rsT "${pkgdir}/opt/${_pkgname}/completion.zsh.inc" \
"${pkgdir}/usr/share/zsh/site-functions/_${cmd}"
done
}
|