mirror of
https://github.com/YunoHost/yunohost-ci.git
synced 2024-09-03 20:05:53 +02:00
improve install dependencies
This commit is contained in:
parent
72c0307f07
commit
5d0d5ad8d3
1 changed files with 20 additions and 8 deletions
28
utils.sh
28
utils.sh
|
@ -117,6 +117,22 @@ rotate_image()
|
|||
fi
|
||||
}
|
||||
|
||||
# These lines are used to extract the dependencies/recommendations from the debian/control file.
|
||||
# /!\ There's a high risk of lamentable failure if we change the format of this file
|
||||
get_dependencies()
|
||||
{
|
||||
local debian_version=$1
|
||||
local ynh_version=$2
|
||||
|
||||
# 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/$debian_version-$ynh_version/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/$debian_version-$ynh_version/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/$debian_version-$ynh_version/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/$debian_version-$ynh_version/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 python-pip"
|
||||
PIP_PKG="mock pip pytest pytest-mock pytest-sugar requests-mock tox"
|
||||
}
|
||||
|
||||
rebuild_base_containers()
|
||||
{
|
||||
|
@ -160,12 +176,10 @@ 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"
|
||||
|
||||
YNH_DEPENDENCIES=$(curl https://raw.githubusercontent.com/YunoHost/yunohost/$debian_version-$ynh_version/debian/control 2> /dev/null | grep "^Depends" -A50 | grep "Recommends:" -B50 | grep "^ *," | grep -o -P "[\w\-]{3,}" | grep -v moulinette | grep -v ssowat |tr "\n" " ")
|
||||
BUILD_DEPENDENCIES="git-buildpackage postfix python-setuptools python-pip"
|
||||
PIP_PKG="mock pip pytest pytest-mock pytest-sugar requests-mock tox"
|
||||
get_dependencies $debian_version $ynh_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 -o Dpkg::Options::=\"--force-confold\" install --assume-yes $YNH_DEPENDENCIES $BUILD_DEPENDENCIES"
|
||||
lxc exec "$base_image_to_rebuild-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 "$base_image_to_rebuild-tmp" -- /bin/bash -c "pip install -U $PIP_PKG"
|
||||
|
||||
rotate_image "$base_image_to_rebuild-tmp" "$base_image_to_rebuild-before-install"
|
||||
|
@ -203,11 +217,9 @@ 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"
|
||||
|
||||
YNH_DEPENDENCIES=$(curl https://raw.githubusercontent.com/YunoHost/yunohost/$debian_version-$ynh_version/debian/control 2> /dev/null | grep "^Depends" -A50 | grep "Recommends:" -B50 | grep "^ *," | grep -o -P "[\w\-]{3,}" | grep -v moulinette | grep -v ssowat |tr "\n" " ")
|
||||
BUILD_DEPENDENCIES="git-buildpackage postfix python-setuptools python-pip"
|
||||
PIP_PKG="mock pip pytest pytest-mock pytest-sugar requests-mock tox"
|
||||
get_dependencies $debian_version $ynh_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 $YNH_DEPENDENCIES $BUILD_DEPENDENCIES"
|
||||
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 "pip install -U $PIP_PKG"
|
||||
|
||||
rotate_image "$image_to_update-tmp" "$image_to_update"
|
||||
|
|
Loading…
Reference in a new issue