From b17f2e31b8e6cd905f40f1762c506324d8358ae0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20M=C3=A9ndez?= Date: Sat, 26 Sep 2026 09:36:14 +0000 Subject: [PATCH] tkldev-setup: clone appliance APP from keel-APP on the keel-linux organization Appliance repositories of the keel-linux organization carry the keel- prefix (decision 0006: keel-core, keel-wordpress, ...), while infrastructure repositories keep their upstream names. When the remote is the organization (GIT_REMOTE_URL with a keel-linux path component, https or ssh, any case), app_repo_name maps APP to keel-APP unless it is already prefixed; the local product directory stays products/APP so make and bt-layer keep the appliance name. Any other remote is unchanged: turnkeylinux still gets the -apps organization and a mirror is used as is. Three bats cases: the https organization remote (core from keel-core, common and buildtasks unprefixed), an ssh remote with a prefixed and an unprefixed appliance, and app_repo_name on the turnkeylinux, a mirror and an IPv6 organization mirror remote. --- overlay/usr/local/sbin/tkldev-setup | 20 ++++++++++++++++++-- tests/tkldev-setup.bats | 29 +++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/overlay/usr/local/sbin/tkldev-setup b/overlay/usr/local/sbin/tkldev-setup index 92bcd15..ea09ca6 100755 --- a/overlay/usr/local/sbin/tkldev-setup +++ b/overlay/usr/local/sbin/tkldev-setup @@ -56,7 +56,9 @@ Env vars: CDROOTS_REFS Candidate refs for turnkeylinux/cdroots GIT_DEPTH Depth to clone (default: $GIT_DEPTH) - setting to 'full' gives same behavior as -n|--full-clone - GIT_REMOTE_URL Remote URL to clone/update from + GIT_REMOTE_URL Remote URL to clone/update from. On the keel-linux + organization appliance APP is cloned from keel-APP + (core from keel-core) into $FAB_PATH/products/APP (default: 'https://github.com/turnkeylinux') GIT_REMOTE_NAME Remote name (default: 'origin') DEBUG Verbose output (useful for debugging) @@ -159,6 +161,19 @@ update_repo() { fi } +# app_repo_name APP REMOTE_URL: name of the repository holding appliance APP +# on REMOTE_URL. On the keel-linux organization appliances carry the keel- +# prefix (core is keel-core); anywhere else the name is used as is. +app_repo_name() { + local app=$1 + local remote=$2 + if [[ "$remote" =~ [:/][Kk]eel-[Ll]inux(/|$) ]] && [[ "$app" != keel-* ]]; then + echo "keel-$app" + else + echo "$app" + fi +} + clone_or_update() { local remote_url remote_url="$GIT_REMOTE_URL" @@ -333,7 +348,8 @@ clone_or_update buildtasks "$BT_PATH" "${BT_REFS[@]}" clone_or_update tklbam-profiles "$TKLBAM_PATH" "${TKLBAM_REFS[@]}" clone_or_update common "$FAB_PATH/common" "${COMMON_REFS[@]}" for app in "${APPS[@]}"; do - clone_or_update _APP_ "$app" "$FAB_PATH/products/$app" "${APP_REFS[@]}" + clone_or_update _APP_ "$(app_repo_name "$app" "$APP_GIT_REMOTE_URL")" \ + "$FAB_PATH/products/$app" "${APP_REFS[@]}" done if [[ "${FAB_ARCH}" == "amd64" ]]; then diff --git a/tests/tkldev-setup.bats b/tests/tkldev-setup.bats index 70395d2..114edf3 100644 --- a/tests/tkldev-setup.bats +++ b/tests/tkldev-setup.bats @@ -273,6 +273,35 @@ output_has() { not_logged "mirror-apps" } +@test "on the keel-linux organization an appliance is cloned from keel-APP" { + export GIT_REMOTE_URL="https://github.com/keel-linux" + run_setup + [ "$status" -eq 0 ] + logged "https://github.com/keel-linux/keel-core.git $FAB_PATH/products/core" + logged "https://github.com/keel-linux/common.git $FAB_PATH/common" + not_logged "keel-linux-apps" + not_logged "keel-common" + not_logged "products/keel-core" +} + +@test "an SSH remote of the organization maps the appliance names too" { + export GIT_REMOTE_URL="git@github.com:Keel-Linux/" + run_setup wordpress keel-lamp + [ "$status" -eq 0 ] + logged "git@github.com:Keel-Linux/keel-wordpress.git $FAB_PATH/products/wordpress" + logged "git@github.com:Keel-Linux/keel-lamp.git $FAB_PATH/products/keel-lamp" + not_logged "keel-keel-lamp" +} + +@test "app_repo_name keeps the name on any other remote" { + call app_repo_name core "https://github.com/turnkeylinux-apps" + [ "$output" = core ] + call app_repo_name core "https://[2001:db8::1]/mirror" + [ "$output" = core ] + call app_repo_name core "https://[2001:db8::1]/keel-linux" + [ "$output" = keel-core ] +} + @test "apt is updated and fab installed" { run_setup [ "$status" -eq 0 ]