refactor: no need for the --system flag for buildx.sh

This commit is contained in:
Zaiming (Stone) Shi 2022-09-14 20:43:29 +02:00
parent 30a02c74dc
commit 20ddd4557f
3 changed files with 9 additions and 10 deletions

View File

@ -262,7 +262,6 @@ jobs:
--profile "${PROFILE}" \ --profile "${PROFILE}" \
--pkgtype "${PACKAGE}" \ --pkgtype "${PACKAGE}" \
--arch "${ARCH}" \ --arch "${ARCH}" \
--system "${SYSTEM}" \
--builder "ghcr.io/emqx/emqx-builder/4.4-19:${OTP}-${SYSTEM}" --builder "ghcr.io/emqx/emqx-builder/4.4-19:${OTP}-${SYSTEM}"
- uses: actions/upload-artifact@v1 - uses: actions/upload-artifact@v1
with: with:

View File

@ -21,7 +21,6 @@ help() {
echo "--src_dir <SRC_DIR>: EMQ X source ode in this dir, default to PWD" echo "--src_dir <SRC_DIR>: EMQ X source ode in this dir, default to PWD"
echo "--builder <BUILDER>: Builder image to pull" echo "--builder <BUILDER>: Builder image to pull"
echo " E.g. ghcr.io/emqx/emqx-builder/4.4-19:24.1.5-3-debian11" echo " E.g. ghcr.io/emqx/emqx-builder/4.4-19:24.1.5-3-debian11"
echo "--system <SYSTEM>: The target OS system the package is being built for, ex: debian11"
echo "--ssh: Pass ssh agent to the builder." echo "--ssh: Pass ssh agent to the builder."
echo " Also configures git in container to use ssh instead of https to clone deps" echo " Also configures git in container to use ssh instead of https to clone deps"
} }
@ -53,10 +52,6 @@ while [ "$#" -gt 0 ]; do
ARCH="$2" ARCH="$2"
shift 2 shift 2
;; ;;
--system)
SYSTEM="$2"
shift 2
;;
--ssh) --ssh)
USE_SSH='yes' USE_SSH='yes'
shift shift
@ -108,8 +103,6 @@ fi
docker info docker info
docker run --rm --privileged tonistiigi/binfmt:latest --install "${ARCH}" docker run --rm --privileged tonistiigi/binfmt:latest --install "${ARCH}"
# $SYSTEM below is used by the `relup-base-vsns.escript` to correctly
# output the list of relup base versions.
# shellcheck disable=SC2086 # shellcheck disable=SC2086
docker run -i --rm \ docker run -i --rm \
-v "$(pwd)":$DOCKER_WORKDIR \ -v "$(pwd)":$DOCKER_WORKDIR \
@ -117,7 +110,6 @@ docker run -i --rm \
--workdir $DOCKER_WORKDIR \ --workdir $DOCKER_WORKDIR \
--platform="linux/$ARCH" \ --platform="linux/$ARCH" \
--user root \ --user root \
-e SYSTEM="$SYSTEM" \
$SSH_AGENT_OPTION \ $SSH_AGENT_OPTION \
"$BUILDER" \ "$BUILDER" \
bash -euc "mkdir -p _build && chown -R root:root _build && make ${PROFILE}-${PKGTYPE} && .ci/build_packages/tests.sh $PROFILE $PKGTYPE" bash -euc "mkdir -p _build && chown -R root:root _build && make ${PROFILE}-${PKGTYPE} && .ci/build_packages/tests.sh $PROFILE $PKGTYPE"

View File

@ -160,7 +160,7 @@ fetch_version(Vsn, VsnMap) ->
filter_froms(Froms0, AvailableVersionsIndex) -> filter_froms(Froms0, AvailableVersionsIndex) ->
Froms1 = Froms1 =
case os:getenv("SYSTEM") of case get_system() of
%% we do not support relup for windows %% we do not support relup for windows
"windows" -> "windows" ->
[]; [];
@ -178,6 +178,14 @@ filter_froms(Froms0, AvailableVersionsIndex) ->
fun(V) -> maps:get(V, AvailableVersionsIndex, false) end, fun(V) -> maps:get(V, AvailableVersionsIndex, false) end,
Froms1). Froms1).
get_system() ->
case os:getenv("SYSTEM") of
false ->
string:trim(os:cmd("./scripts/get-distro.sh"));
System ->
System
end.
%% assumes that's X.Y.Z, without pre-releases %% assumes that's X.Y.Z, without pre-releases
parse_vsn(VsnBin) -> parse_vsn(VsnBin) ->
{match, [Major0, Minor0, Patch0]} = re:run(VsnBin, "([0-9]+)\\.([0-9]+)\\.([0-9]+)", {match, [Major0, Minor0, Patch0]} = re:run(VsnBin, "([0-9]+)\\.([0-9]+)\\.([0-9]+)",