diff --git a/auto_upgrade_container.sh b/auto_upgrade_container.sh index 7b1fe83..9ee92ee 100755 --- a/auto_upgrade_container.sh +++ b/auto_upgrade_container.sh @@ -3,7 +3,7 @@ current_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" source $current_dir/utils.sh # Get utils functions. -for debian_version in "buster" "bullseye" +for debian_version in "bullseye" do for ynh_version in "stable" "testing" "unstable" do @@ -13,3 +13,14 @@ do done done done + +for debian_version in "bookworm" +do + for ynh_version in "unstable" + do + for snapshot in "before-install" "after-install" + do + update_image $debian_version $ynh_version $snapshot + done + done +done diff --git a/rebuild_all.sh b/rebuild_all.sh index 21e8da0..b222bf7 100755 --- a/rebuild_all.sh +++ b/rebuild_all.sh @@ -3,7 +3,7 @@ current_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" source $current_dir/utils.sh # Get utils functions. -for debian_version in "buster" "bullseye" +for debian_version in "bullseye" do rebuild_base_containers $debian_version "stable" "amd64" @@ -34,3 +34,10 @@ do done done done + + +for debian_version in "bookworm" +do + rebuild_base_containers $debian_version "unstable" "amd64" +done + diff --git a/utils.sh b/utils.sh index 9ec6cd1..955f4f3 100755 --- a/utils.sh +++ b/utils.sh @@ -140,14 +140,26 @@ rotate_image() # /!\ There's a high risk of lamentable failure if we change the format of this file get_dependencies() { - # To extract the dependencies, we want to retrieve the lines between "^Dependencies:" and the new line that doesn't start with a space (exclusively) . Then, we remove ",", then we remove the version specifiers "(>= X.Y)", then we add simple quotes to packages when there is a pipe (or) 'php-mysql|php-mysqlnd'. - YUNOHOST_DEPENDENCIES=$(curl https://raw.githubusercontent.com/YunoHost/yunohost/dev/debian/control 2> /dev/null | sed -n '/^Depends:/,/^\w/{//!p}' | sed -e "s/,//g" -e "s/[(][^)]*[)]//g" -e "s/ | \S\+//g" | grep -v moulinette | grep -v ssowat | tr "\n" " ") - YUNOHOST_RECOMMENDS=$(curl https://raw.githubusercontent.com/YunoHost/yunohost/dev/debian/control 2> /dev/null | sed -n '/^Recommends:/,/^\w/{//!p}' | sed -e "s/,//g" -e "s/[(][^)]*[)]//g" -e "s/ | \S\+//g" | tr "\n" " ") - MOULINETTE_DEPENDENCIES=$(curl https://raw.githubusercontent.com/YunoHost/moulinette/dev/debian/control 2> /dev/null | sed -n '/^Depends:/,/^\w/{//!p}' | sed -e "s/,//g" -e "s/[(][^)]*[)]//g" -e "s/ | \S\+//g" | tr "\n" " ") - # Same as above, except that all dependencies are in the same line - SSOWAT_DEPENDENCIES=$(curl https://raw.githubusercontent.com/YunoHost/ssowat/dev/debian/control 2> /dev/null | grep '^Depends:' | sed 's/Depends://' | sed -e "s/,//g" -e "s/[(][^)]*[)]//g" -e "s/ | \S\+//g" | tr "\n" " ") - BUILD_DEPENDENCIES="git-buildpackage postfix python-setuptools python3-pip devscripts" - PIP3_PKG="mock pip pyOpenSSL pytest pytest-cov pytest-mock pytest-sugar requests-mock tox ansi2html black jinja2 types-ipaddress types-enum34 types-cryptography types-toml types-requests types-PyYAML types-pyOpenSSL types-mock" + local debian_version=$1 + if [[ "$debian_version" == "bullseye" ]] + then + local branch="dev" + else + local branch="$debian_version" + fi + + # To extract the dependencies, we want to retrieve the lines between "^Dependencies:" and the new line that doesn't start with a space (exclusively) . Then, we remove ",", then we remove the version specifiers "(>= X.Y)", then we add simple quotes to packages when there is a pipe (or) 'php-mysql|php-mysqlnd'. + YUNOHOST_DEPENDENCIES=$(curl https://raw.githubusercontent.com/YunoHost/yunohost/$branch/debian/control 2> /dev/null | sed -n '/^Depends:/,/^\w/{//!p}' | sed -e "s/,//g" -e "s/[(][^)]*[)]//g" -e "s/ | \S\+//g" | grep -v moulinette | grep -v ssowat | tr "\n" " ") + YUNOHOST_RECOMMENDS=$(curl https://raw.githubusercontent.com/YunoHost/yunohost/$branch/debian/control 2> /dev/null | sed -n '/^Recommends:/,/^\w/{//!p}' | sed -e "s/,//g" -e "s/[(][^)]*[)]//g" -e "s/ | \S\+//g" | tr "\n" " ") + MOULINETTE_DEPENDENCIES=$(curl https://raw.githubusercontent.com/YunoHost/moulinette/$branch/debian/control 2> /dev/null | sed -n '/^Depends:/,/^\w/{//!p}' | sed -e "s/,//g" -e "s/[(][^)]*[)]//g" -e "s/ | \S\+//g" | tr "\n" " ") + # Same as above, except that all dependencies are in the same line + SSOWAT_DEPENDENCIES=$(curl https://raw.githubusercontent.com/YunoHost/ssowat/$branch/debian/control 2> /dev/null | grep '^Depends:' | sed 's/Depends://' | sed -e "s/,//g" -e "s/[(][^)]*[)]//g" -e "s/ | \S\+//g" | tr "\n" " ") + BUILD_DEPENDENCIES="git-buildpackage postfix python3-setuptools python3-pip devscripts" + PIP3_PKG='mock pip pyOpenSSL pytest pytest-cov pytest-mock pytest-sugar requests-mock tox ansi2html black jinja2 types-ipaddress types-enum34 types-cryptography types-toml types-requests types-PyYAML types-pyOpenSSL types-mock "packaging<22"' + if [[ "$debian_version" == "bookworm" ]] + then + PIP3_PKG="$PIP3_PKG --break-system-packages" + fi } rebuild_base_containers() @@ -189,7 +201,7 @@ rebuild_base_containers() # Run the YunoHost install script patched lxc exec "$base_image_to_rebuild-tmp" -- /bin/bash -c "cat install.sh | bash -s -- -a -d $ynh_version" - get_dependencies + get_dependencies $debian_version # Pre install dependencies lxc exec "$base_image_to_rebuild-tmp" -- /bin/bash -c "DEBIAN_FRONTEND=noninteractive SUDO_FORCE_REMOVE=yes apt-get --assume-yes install --assume-yes $YUNOHOST_DEPENDENCIES $YUNOHOST_RECOMMENDS $MOULINETTE_DEPENDENCIES $SSOWAT_DEPENDENCIES $BUILD_DEPENDENCIES" @@ -240,7 +252,7 @@ update_image() { lxc exec "$image_to_update-tmp" -- /bin/bash -c "apt-get update" lxc exec "$image_to_update-tmp" -- /bin/bash -c "apt-get upgrade --assume-yes" - get_dependencies + get_dependencies $debian_version lxc exec "$image_to_update-tmp" -- /bin/bash -c "DEBIAN_FRONTEND=noninteractive SUDO_FORCE_REMOVE=yes apt-get --assume-yes -o Dpkg::Options::=\"--force-confold\" install --assume-yes $YUNOHOST_DEPENDENCIES $YUNOHOST_RECOMMENDS $MOULINETTE_DEPENDENCIES $SSOWAT_DEPENDENCIES $BUILD_DEPENDENCIES" lxc exec "$image_to_update-tmp" -- /bin/bash -c "python3 -m pip install -U $PIP3_PKG" diff --git a/variables.sh b/variables.sh index d9f5eb4..a7626ab 100755 --- a/variables.sh +++ b/variables.sh @@ -13,10 +13,10 @@ CURRENT_BRANCH="$CUSTOM_ENV_CI_COMMIT_REF_NAME" # CUSTOM_ENV_CI_COMMIT_REF_NAME LAST_CHANGELOG_ENTRY=$(curl https://gitlab.com/yunohost/yunohost/-/raw/$CURRENT_BRANCH/debian/changelog --silent | head -n 1) # yunohost (4.2) unstable; urgency=low CURRENT_VERSION=$(echo $LAST_CHANGELOG_ENTRY | cut -d' ' -f3 | tr -d ';') # stable, testing, unstable -DEBIAN_VERSION_NUMBER=$(echo $LAST_CHANGELOG_ENTRY | cut -d' ' -f2 | tr -d '(' | tr -d ')' | cut -d'.' -f1) # 3, 4, 11 +DEBIAN_VERSION_NUMBER=$(echo $LAST_CHANGELOG_ENTRY | cut -d' ' -f2 | tr -d '(' | tr -d ')' | cut -d'.' -f1) # 11, 12 declare -A DEBIAN_VERSION_TABLE -DEBIAN_VERSION_TABLE=(["4"]="buster" ["11"]="bullseye") +DEBIAN_VERSION_TABLE=(["11"]="bullseye" ["12"]="bookworm") DEBIAN_VERSION="${DEBIAN_VERSION_TABLE[$DEBIAN_VERSION_NUMBER]}"