Skip to content

Commit 5400108

Browse files
committed
Removed target for dummy #2213
1 parent 56bc13f commit 5400108

12 files changed

+328
-17
lines changed

make/tool.mk

+1-14
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ $(ALL_TOOLS_RAW):%: \
9797
$(TOOLS_DIR)/%/manifest.json \
9898
$(TOOLS_DIR)/%/Dockerfile \
9999
builders \
100-
base \
101100
; $(info $(M) Building image $(REGISTRY)/$(REPOSITORY_PREFIX)$*...)
102101
@set -o errexit; \
103102
PUSH=$(or $(PUSH), false); \
@@ -230,7 +229,7 @@ $(addsuffix --debug,$(ALL_TOOLS_RAW)):%--debug: \
230229
--env version=$${TOOL_VERSION} \
231230
--rm \
232231
$(REGISTRY)/$(REPOSITORY_PREFIX)$*:$${VERSION_TAG} \
233-
bash
232+
bash --login
234233

235234
.PHONY:
236235
$(addsuffix --buildg,$(ALL_TOOLS_RAW)):%--buildg: \
@@ -272,15 +271,3 @@ $(addsuffix --test,$(ALL_TOOLS_RAW)):%--test: \
272271
.PHONY:
273272
debug: \
274273
debug-$(ALT_ARCH)
275-
276-
.PHONY:
277-
debug-%: \
278-
; $(info $(M) Debugging on platform $*...)
279-
@docker container run \
280-
--interactive \
281-
--tty \
282-
--privileged \
283-
--rm \
284-
--platform linux/$* \
285-
$(REGISTRY)/$(REPOSITORY_PREFIX)base:$(DOCKER_TAG) \
286-
bash

tools/dummy/Dockerfile.template

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
#syntax=docker/dockerfile:1.6.0
22

3-
ARG ref=main
3+
FROM nicholasdille/ubuntu:22.04 AS prepare
4+
COPY --from=ghcr.io/uniget-org/tools/uniget-build:latest \
5+
/etc/profile.d/ \
6+
/etc/profile.d/
7+
SHELL [ "bash", "-clo", "errexit" ]
48

5-
FROM ghcr.io/uniget-org/tools/base:${ref} AS prepare
69
ARG name
710
ARG version
811
RUN <<EOF
912
touch \
10-
"${prefix}${target}/dummy"
13+
"${prefix}/dummy"
1114
EOF

tools/dummy/check-clone.sh

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
set -o errexit
3+
4+
function check-clone() {
5+
local repo="$1"
6+
if test -z "${repo}"; then
7+
echo "Usage: $0 <repo> <ref>"
8+
exit 1
9+
fi
10+
shift
11+
12+
local ref=$1
13+
if test -z "${ref}"; then
14+
echo "Usage: $0 <repo> <ref>"
15+
exit 1
16+
fi
17+
18+
echo "### Checking clone from repo ${repo} with ref ${ref}"
19+
if git ls-remote --exit-code "${repo}" "${ref}"; then
20+
echo " Found :-)"
21+
return
22+
fi
23+
echo " ERROR: Unable to find ref ${ref} in repo ${repo}"
24+
return 1
25+
}

tools/dummy/check-download.sh

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
set -o errexit
3+
4+
function check-download() {
5+
local url="$1"
6+
if test -z "${url}"; then
7+
echo "Usage: $0 <url>"
8+
exit 1
9+
fi
10+
11+
echo "### Checking ${url}"
12+
if curl --silent --show-error --location --fail --head --url "${url}"; then
13+
echo " Found :-)"
14+
return
15+
fi
16+
echo " ERROR: Download ${url} not found"
17+
return 1
18+
}
+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/bin/bash
2+
set -o errexit
3+
4+
function check-github-release-asset() {
5+
local repo="$1"
6+
if test -z "${repo}"; then
7+
echo "Usage: $0 <owner/repo> <version> <asset>"
8+
exit 1
9+
fi
10+
shift
11+
12+
local version=$1
13+
if test -z "${version}"; then
14+
echo "Usage: $0 <owner/repo> <version> <asset>"
15+
exit 1
16+
fi
17+
shift
18+
19+
local asset=$1
20+
if test -z "${asset}"; then
21+
echo "Usage: $0 <owner/repo> <version> <asset>"
22+
exit 1
23+
fi
24+
25+
local url="https://github.com/${repo}/releases/download/${version}/${asset}"
26+
echo "### Checking ${repo} ${version} ${asset}"
27+
if curl --silent --show-error --location --fail --head --url "${url}"; then
28+
echo " Found :-)"
29+
return
30+
fi
31+
echo " ERROR: Asset ${asset} not found for ${repo} ${version}"
32+
echo " at ${url}"
33+
34+
echo "### Fetching release assets for ${repo} ${version}"
35+
local id
36+
local url="https://api.github.com/repos/${repo}/releases/tags/${version}"
37+
id="$(curl --silent --show-error --location "${url}" | jq --raw-output '.id')"
38+
if test -z "${id}" || test "${id}" == "null"; then
39+
echo " ERROR: Failed to fetch release id for ${repo} ${version}"
40+
echo " at ${url}"
41+
return 1
42+
fi
43+
echo " Found release id ${id} for ${repo} ${version}"
44+
45+
echo "### Fetching release assets for ${repo} ${version} with id ${id}"
46+
local url="https://api.github.com/repos/${repo}/releases/${id}/assets"
47+
if ! curl --silent --show-error --location --fail "${url}" | jq --raw-output '.[].name'; then
48+
echo " ERROR: Failed to fetch release assets for ${repo} ${version}"
49+
echo " at ${url}"
50+
return 1
51+
fi
52+
return 1
53+
}

tools/dummy/init.sh

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/bin/bash
2+
set -o errexit
3+
4+
arch="$(uname -m)"
5+
case "${arch}" in
6+
x86_64)
7+
alt_arch=amd64
8+
;;
9+
aarch64)
10+
alt_arch=arm64
11+
;;
12+
*)
13+
echo "ERROR: Unknown architecture ${arch}."
14+
exit 1
15+
;;
16+
esac
17+
export arch
18+
export alt_arch
19+
20+
export uniget_cache=/var/cache/uniget
21+
export uniget_lib=/var/lib/uniget
22+
export uniget_contrib="${uniget_lib}/contrib"
23+
export uniget_manifests="${uniget_lib}/manifests"
24+
export uniget_post_install="${uniget_lib}/post_install"
25+
export prefix=/uniget_bootstrap
26+
27+
mkdir -p \
28+
"${prefix}${uniget_cache}" \
29+
"${prefix}${uniget_contrib}" \
30+
"${prefix}${uniget_manifests}" \
31+
"${prefix}${uniget_post_install}" \
32+
"${prefix}/etc/profile.d" \
33+
"${prefix}/etc/systemd/system" \
34+
"${prefix}/bin" \
35+
"${prefix}/etc" \
36+
"${prefix}/include" \
37+
"${prefix}/lib" \
38+
"${prefix}/libexec/docker/cli-plugins" \
39+
"${prefix}/opt" \
40+
"${prefix}/sbin" \
41+
"${prefix}/var" \
42+
"${prefix}/share/man/man1" \
43+
"${prefix}/share/man/man2" \
44+
"${prefix}/share/man/man3" \
45+
"${prefix}/share/man/man4" \
46+
"${prefix}/share/man/man5" \
47+
"${prefix}/share/man/man6" \
48+
"${prefix}/share/man/man7" \
49+
"${prefix}/share/man/man8" \
50+
"${prefix}/share/man/man9" \
51+
"${prefix}/share/bash-completion/completions" \
52+
"${prefix}/share/fish/vendor_completions.d" \
53+
"${prefix}/share/zsh/vendor-completions"
+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#syntax=docker/dockerfile:1.6.0
2+
3+
FROM nicholasdille/ubuntu:22.04 AS prepare
4+
COPY --chmod=0755 \
5+
init.sh \
6+
check-download.sh \
7+
check-github-release-asset.sh \
8+
check-clone.sh \
9+
/uniget_bootstrap/etc/profile.d/

tools/uniget-build/check-clone.sh

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
set -o errexit
3+
4+
function check-clone() {
5+
local repo="$1"
6+
if test -z "${repo}"; then
7+
echo "Usage: $0 <repo> <ref>"
8+
exit 1
9+
fi
10+
shift
11+
12+
local ref=$1
13+
if test -z "${ref}"; then
14+
echo "Usage: $0 <repo> <ref>"
15+
exit 1
16+
fi
17+
18+
echo "### Checking clone from repo ${repo} with ref ${ref}"
19+
if git ls-remote --exit-code "${repo}" "${ref}"; then
20+
echo " Found :-)"
21+
return
22+
fi
23+
echo " ERROR: Unable to find ref ${ref} in repo ${repo}"
24+
return 1
25+
}

tools/uniget-build/check-download.sh

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
set -o errexit
3+
4+
function check-download() {
5+
local url="$1"
6+
if test -z "${url}"; then
7+
echo "Usage: $0 <url>"
8+
exit 1
9+
fi
10+
11+
echo "### Checking ${url}"
12+
if curl --silent --show-error --location --fail --head --url "${url}"; then
13+
echo " Found :-)"
14+
return
15+
fi
16+
echo " ERROR: Download ${url} not found"
17+
return 1
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/bin/bash
2+
set -o errexit
3+
4+
function check-github-release-asset() {
5+
local repo="$1"
6+
if test -z "${repo}"; then
7+
echo "Usage: $0 <owner/repo> <version> <asset>"
8+
exit 1
9+
fi
10+
shift
11+
12+
local version=$1
13+
if test -z "${version}"; then
14+
echo "Usage: $0 <owner/repo> <version> <asset>"
15+
exit 1
16+
fi
17+
shift
18+
19+
local asset=$1
20+
if test -z "${asset}"; then
21+
echo "Usage: $0 <owner/repo> <version> <asset>"
22+
exit 1
23+
fi
24+
25+
local url="https://github.com/${repo}/releases/download/${version}/${asset}"
26+
echo "### Checking ${repo} ${version} ${asset}"
27+
if curl --silent --show-error --location --fail --head --url "${url}"; then
28+
echo " Found :-)"
29+
return
30+
fi
31+
echo " ERROR: Asset ${asset} not found for ${repo} ${version}"
32+
echo " at ${url}"
33+
34+
echo "### Fetching release assets for ${repo} ${version}"
35+
local id
36+
local url="https://api.github.com/repos/${repo}/releases/tags/${version}"
37+
id="$(curl --silent --show-error --location "${url}" | jq --raw-output '.id')"
38+
if test -z "${id}" || test "${id}" == "null"; then
39+
echo " ERROR: Failed to fetch release id for ${repo} ${version}"
40+
echo " at ${url}"
41+
return 1
42+
fi
43+
echo " Found release id ${id} for ${repo} ${version}"
44+
45+
echo "### Fetching release assets for ${repo} ${version} with id ${id}"
46+
local url="https://api.github.com/repos/${repo}/releases/${id}/assets"
47+
if ! curl --silent --show-error --location --fail "${url}" | jq --raw-output '.[].name'; then
48+
echo " ERROR: Failed to fetch release assets for ${repo} ${version}"
49+
echo " at ${url}"
50+
return 1
51+
fi
52+
return 1
53+
}

tools/uniget-build/init.sh

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/bin/bash
2+
set -o errexit
3+
4+
arch="$(uname -m)"
5+
case "${arch}" in
6+
x86_64)
7+
alt_arch=amd64
8+
;;
9+
aarch64)
10+
alt_arch=arm64
11+
;;
12+
*)
13+
echo "ERROR: Unknown architecture ${arch}."
14+
exit 1
15+
;;
16+
esac
17+
export arch
18+
export alt_arch
19+
20+
export uniget_cache=/var/cache/uniget
21+
export uniget_lib=/var/lib/uniget
22+
export uniget_contrib="${uniget_lib}/contrib"
23+
export uniget_manifests="${uniget_lib}/manifests"
24+
export uniget_post_install="${uniget_lib}/post_install"
25+
export prefix=/uniget_bootstrap
26+
27+
mkdir -p \
28+
"${prefix}${uniget_cache}" \
29+
"${prefix}${uniget_contrib}" \
30+
"${prefix}${uniget_manifests}" \
31+
"${prefix}${uniget_post_install}" \
32+
"${prefix}/etc/profile.d" \
33+
"${prefix}/etc/systemd/system" \
34+
"${prefix}/bin" \
35+
"${prefix}/etc" \
36+
"${prefix}/include" \
37+
"${prefix}/lib" \
38+
"${prefix}/libexec/docker/cli-plugins" \
39+
"${prefix}/opt" \
40+
"${prefix}/sbin" \
41+
"${prefix}/var" \
42+
"${prefix}/share/man/man1" \
43+
"${prefix}/share/man/man2" \
44+
"${prefix}/share/man/man3" \
45+
"${prefix}/share/man/man4" \
46+
"${prefix}/share/man/man5" \
47+
"${prefix}/share/man/man6" \
48+
"${prefix}/share/man/man7" \
49+
"${prefix}/share/man/man8" \
50+
"${prefix}/share/man/man9" \
51+
"${prefix}/share/bash-completion/completions" \
52+
"${prefix}/share/fish/vendor_completions.d" \
53+
"${prefix}/share/zsh/vendor-completions"

tools/uniget-build/manifest.yaml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# yaml-language-server: $schema=https://tools.uniget.dev/schema.yaml
2+
$schema: https://tools.uniget.dev/schema.yaml
3+
name: uniget-build
4+
version: "0.0.1"
5+
binary: "false"
6+
check: "" # No version check possible
7+
platforms:
8+
- linux/amd64
9+
- linux/arm64
10+
tags:
11+
- org/uniget
12+
- category/development
13+
homepage: https://github.com/uniget-org/tools
14+
description: Defaults and helpers for building uniget tools

0 commit comments

Comments
 (0)