Skip to content

Commit dd233d9

Browse files
committed
Updating github-config
1 parent 2888e9d commit dd233d9

3 files changed

Lines changed: 95 additions & 0 deletions

File tree

scripts/.util/tools.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
{
2+
"createpackage": "v1.73.0",
23
"jam": "v2.11.5",
4+
"libpaktools": "v0.2.0",
35
"pack": "v0.38.1"
46
}

scripts/.util/tools.sh

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ function util::tools::arch() {
3131
amd64|x86_64)
3232
if [[ "${1:-}" == "--blank-amd64" ]]; then
3333
echo ""
34+
elif [[ "${1:-}" == "--format-amd64-x86_64" ]]; then
35+
echo "x86_64"
3436
else
3537
echo "amd64"
3638
fi
@@ -196,6 +198,91 @@ function util::tools::packager::install () {
196198
fi
197199
}
198200

201+
function util::tools::libpak-tools::install () {
202+
local dir token
203+
token=""
204+
205+
while [[ "${#}" != 0 ]]; do
206+
case "${1}" in
207+
--directory)
208+
dir="${2}"
209+
shift 2
210+
;;
211+
212+
--token)
213+
token="${2}"
214+
shift 2
215+
;;
216+
217+
*)
218+
util::print::error "unknown argument \"${1}\""
219+
esac
220+
done
221+
222+
mkdir -p "${dir}"
223+
util::tools::path::export "${dir}"
224+
225+
226+
if [[ ! -f "${dir}/libpak-tools" ]]; then
227+
local version curl_args os arch
228+
229+
version="$(jq -r .libpaktools "$(dirname "${BASH_SOURCE[0]}")/tools.json")"
230+
231+
curl_args=(
232+
"--fail"
233+
"--silent"
234+
"--location"
235+
"--output" "${dir}/libpak-tools.tar.gz"
236+
)
237+
238+
if [[ "${token}" != "" ]]; then
239+
curl_args+=("--header" "Authorization: Token ${token}")
240+
fi
241+
242+
util::print::title "Installing libpak-tools ${version}"
243+
244+
os=$(util::tools::os)
245+
arch=$(util::tools::arch --format-amd64-x86_64)
246+
247+
curl "https://github.com/paketo-buildpacks/libpak-tools/releases/download/${version}/libpak-tools_${os^}_${arch}.tar.gz" \
248+
"${curl_args[@]}"
249+
250+
tar -xzf "${dir}/libpak-tools.tar.gz" -C $dir
251+
rm "${dir}/libpak-tools.tar.gz"
252+
253+
chmod +x "${dir}/libpak-tools"
254+
else
255+
util::print::info "Using libpak-tools"
256+
fi
257+
}
258+
259+
function util::tools::create-package::install () {
260+
local dir version
261+
while [[ "${#}" != 0 ]]; do
262+
case "${1}" in
263+
--directory)
264+
dir="${2}"
265+
shift 2
266+
;;
267+
268+
*)
269+
util::print::error "unknown argument \"${1}\""
270+
;;
271+
272+
esac
273+
done
274+
275+
version="$(jq -r .createpackage "$(dirname "${BASH_SOURCE[0]}")/tools.json")"
276+
277+
mkdir -p "${dir}"
278+
util::tools::path::export "${dir}"
279+
280+
if [[ ! -f "${dir}/create-package" ]]; then
281+
util::print::title "Installing create-package"
282+
GOBIN="${dir}" go install -ldflags="-s -w" "github.com/paketo-buildpacks/libpak/cmd/create-package@${version}"
283+
fi
284+
}
285+
199286
function util::tools::tests::checkfocus() {
200287
testout="${1}"
201288
if grep -q 'Focused: [1-9]' "${testout}"; then

scripts/integration.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,12 @@ function tools::install() {
110110
--directory "${BUILDPACKDIR}/.bin" \
111111
--token "${token}"
112112

113+
util::tools::libpak-tools::install \
114+
--directory "${BUILDPACKDIR}/.bin"
115+
116+
util::tools::create-package::install \
117+
--directory "${BUILDPACKDIR}/.bin"
118+
113119
if [[ -f "${BUILDPACKDIR}/.libbuildpack" ]]; then
114120
util::tools::packager::install \
115121
--directory "${BUILDPACKDIR}/.bin"

0 commit comments

Comments
 (0)