Skip to content

Commit

Permalink
Trash support for packaging v1
Browse files Browse the repository at this point in the history
  • Loading branch information
alexAubin committed Dec 8, 2024
1 parent 56c101f commit adb88b8
Show file tree
Hide file tree
Showing 8 changed files with 146 additions and 319 deletions.
20 changes: 3 additions & 17 deletions helpers/helpers.v1.d/composer
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,7 @@ ynh_composer_exec() {
ynh_handle_getopts_args "$@"
workdir="${workdir:-${install_dir:-$final_path}}"

if dpkg --compare-versions ${YNH_APP_PACKAGING_FORMAT:-0} lt 2; then
phpversion="${phpversion:-$YNH_PHP_VERSION}"
else
phpversion="${phpversion:-$_globalphpversion}"
fi
phpversion="${phpversion:-$_globalphpversion}"

COMPOSER_HOME="$workdir/.composer" COMPOSER_MEMORY_LIMIT=-1 \
php${phpversion} "$workdir/composer.phar" $commands \
Expand All @@ -56,18 +52,8 @@ ynh_install_composer() {
local composerversion
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
if dpkg --compare-versions ${YNH_APP_PACKAGING_FORMAT:-0} lt 2; then
workdir="${workdir:-$final_path}"
else
workdir="${workdir:-$install_dir}"
fi

if dpkg --compare-versions ${YNH_APP_PACKAGING_FORMAT:-0} lt 2; then
phpversion="${phpversion:-$YNH_PHP_VERSION}"
else
phpversion="${phpversion:-$_globalphpversion}"
fi

workdir="${workdir:-$install_dir}"
phpversion="${phpversion:-$_globalphpversion}"
install_args="${install_args:-}"
composerversion="${composerversion:-$YNH_COMPOSER_VERSION}"

Expand Down
7 changes: 1 addition & 6 deletions helpers/helpers.v1.d/php
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,7 @@ ynh_add_fpm_config() {

fi

# Set the default PHP-FPM version by default
if dpkg --compare-versions ${YNH_APP_PACKAGING_FORMAT:-0} lt 2; then
phpversion="${phpversion:-$YNH_PHP_VERSION}"
else
phpversion="${phpversion:-$_globalphpversion}"
fi
phpversion="${phpversion:-$_globalphpversion}"

local old_phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)

Expand Down
5 changes: 0 additions & 5 deletions helpers/helpers.v1.d/ruby
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@ ruby_version_path="$rbenv_install_dir/versions"
export RBENV_ROOT="$rbenv_install_dir"
export rbenv_root="$rbenv_install_dir"

if dpkg --compare-versions ${YNH_APP_PACKAGING_FORMAT:-0} lt 2; then
build_ruby_dependencies="libjemalloc-dev curl build-essential libreadline-dev zlib1g-dev libsqlite3-dev libssl-dev libxml2-dev libxslt-dev autoconf automake bison libtool"
build_pkg_dependencies="${build_pkg_dependencies:-} $build_ruby_dependencies"
fi

# Load the version of Ruby for an app, and set variables.
#
# ynh_use_ruby has to be used in any app scripts before using Ruby for the first time.
Expand Down
4 changes: 0 additions & 4 deletions helpers/helpers.v1.d/templating
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,6 @@ ynh_replace_vars() {
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$file"
ynh_replace_string --match_string="__INSTALL_DIR__" --replace_string="$final_path" --target_file="$file"
fi
# Legacy / Packaging v1 only
if dpkg --compare-versions ${YNH_APP_PACKAGING_FORMAT:-0} lt 2 && test -n "${YNH_PHP_VERSION:-}"; then
ynh_replace_string --match_string="__PHPVERSION__" --replace_string="$YNH_PHP_VERSION" --target_file="$file"
fi
if test -n "${ynh_node_load_PATH:-}"; then
ynh_replace_string --match_string="__YNH_NODE_LOAD_PATH__" --replace_string="$ynh_node_load_PATH" --target_file="$file"
fi
Expand Down
2 changes: 1 addition & 1 deletion helpers/helpers.v1.d/utils
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ ynh_abort_if_errors() {
}

# When running an app script with packaging format >= 2, auto-enable ynh_abort_if_errors except for remove script
if [[ "${YNH_CONTEXT:-}" != "regenconf" ]] && dpkg --compare-versions ${YNH_APP_PACKAGING_FORMAT:-0} ge 2 && [[ ${YNH_APP_ACTION} != "remove" ]]; then
if [[ "${YNH_CONTEXT:-}" != "regenconf" ]] && [[ ${YNH_APP_ACTION} != "remove" ]]; then
ynh_abort_if_errors
fi

Expand Down
Loading

0 comments on commit adb88b8

Please sign in to comment.