Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Trixie] Trash support for packaging v1 #2008

Draft
wants to merge 1 commit into
base: trixie
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 5 additions & 19 deletions helpers/helpers.v1.d/composer
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ YNH_COMPOSER_VERSION=${YNH_COMPOSER_VERSION:-$YNH_DEFAULT_COMPOSER_VERSION}
#
# usage: ynh_composer_exec [--phpversion=phpversion] [--workdir=$install_dir] --commands="commands"
# | arg: -v, --phpversion - PHP version to use with composer
# | arg: -w, --workdir - The directory from where the command will be executed. Default $install_dir or $final_path
# | arg: -w, --workdir - The directory from where the command will be executed. Default $install_dir
# | arg: -c, --commands - Commands to execute.
#
# Requires YunoHost version 4.2 or higher.
Expand All @@ -23,13 +23,9 @@ ynh_composer_exec() {
local commands
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
workdir="${workdir:-${install_dir:-$final_path}}"
workdir="${workdir:-${install_dir}}"

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
2 changes: 1 addition & 1 deletion helpers/helpers.v1.d/nodejs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export N_PREFIX="$n_install_dir"
# However, $PATH is duplicated into $node_PATH to outlast any manipulation of `$PATH`
# You can use the variable `$ynh_node_load_PATH` to quickly load your node version
# in $PATH for an usage into a separate script.
# Exemple: $ynh_node_load_PATH $final_path/script_that_use_npm.sh`
# Exemple: $ynh_node_load_PATH $install_dir/script_that_use_npm.sh`
#
#
# Finally, to start a nodejs service with the correct version, 2 solutions
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
9 changes: 2 additions & 7 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 All @@ -29,7 +24,7 @@ fi
# However, $PATH is duplicated into $ruby_path to outlast any manipulation of $PATH
# You can use the variable `$ynh_ruby_load_path` to quickly load your Ruby version
# in $PATH for an usage into a separate script.
# Exemple: $ynh_ruby_load_path $final_path/script_that_use_gem.sh`
# Exemple: $ynh_ruby_load_path $install_dir/script_that_use_gem.sh`
#
#
# Finally, to start a Ruby service with the correct version, 2 solutions
Expand Down Expand Up @@ -74,7 +69,7 @@ ynh_use_ruby() {
ynh_ruby_load_path="PATH=$PATH"

# Sets the local application-specific Ruby version
pushd ${install_dir:-$final_path}
pushd ${install_dir}
$rbenv_install_dir/bin/rbenv local $ruby_version
popd
}
Expand Down
4 changes: 0 additions & 4 deletions helpers/helpers.v1.d/sources
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,6 @@ ynh_setup_source() {
if [ -n "${install_dir:-}" ] && [ "$dest_dir" == "$install_dir" ]; then
_ynh_apply_default_permissions $dest_dir
fi
if [ -n "${final_path:-}" ] && [ "$dest_dir" == "$final_path" ]; then
_ynh_apply_default_permissions $dest_dir
fi

if [[ "$src_extract" == "false" ]]; then
if [[ -z "$src_rename" ]]; then
mv $src_filename $dest_dir
Expand Down
11 changes: 0 additions & 11 deletions helpers/helpers.v1.d/templating
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
# __NAME__ by $app
# __NAMETOCHANGE__ by $app
# __USER__ by $app
# __FINALPATH__ by $final_path
# __PHPVERSION__ by $YNH_PHP_VERSION (packaging v1 only, packaging v2 uses phpversion setting implicitly set by apt resource)
# __YNH_NODE_LOAD_PATH__ by $ynh_node_load_PATH
# ```
Expand Down Expand Up @@ -110,7 +109,6 @@ ynh_add_config() {
# __NAME__ by $app
# __NAMETOCHANGE__ by $app
# __USER__ by $app
# __FINALPATH__ by $final_path
# __PHPVERSION__ by $YNH_PHP_VERSION (packaging v1 only, packaging v2 uses phpversion setting implicitly set by apt resource)
# __YNH_NODE_LOAD_PATH__ by $ynh_node_load_PATH
#
Expand Down Expand Up @@ -141,15 +139,6 @@ ynh_replace_vars() {
ynh_replace_string --match_string="__NAMETOCHANGE__" --replace_string="$app" --target_file="$file"
ynh_replace_string --match_string="__USER__" --replace_string="$app" --target_file="$file"
fi
# Legacy
if test -n "${final_path:-}"; then
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