helpers2.1: in ynh_setup_source, remove the underused sources/extra_files/sourceid/ mechanism (basically the only apps with these files manually cp stuff) + move the sources/patches/ mechanism to just patches/

This commit is contained in:
Alexandre Aubin 2024-06-11 22:55:30 +02:00
parent 47b2a5695f
commit 66f667e48a

View file

@ -132,8 +132,7 @@ fi
# - Uncompress the archive to `$dest_dir`. # - Uncompress the archive to `$dest_dir`.
# - If `in_subdir` is true, the first level directory of the archive will be removed. # - If `in_subdir` is true, the first level directory of the archive will be removed.
# - If `in_subdir` is a numeric value, the N first level directories will be removed. # - If `in_subdir` is a numeric value, the N first level directories will be removed.
# - Patches named `sources/patches/${src_id}-*.patch` will be applied to `$dest_dir` # - Patches named `patches/${src_id}-*.patch` will be applied to `$dest_dir`
# - Extra files in `sources/extra_files/$src_id` will be copied to dest_dir
# #
# Requires YunoHost version 2.6.4 or higher. # Requires YunoHost version 2.6.4 or higher.
ynh_setup_source() { ynh_setup_source() {
@ -309,9 +308,10 @@ ynh_setup_source() {
fi fi
# Apply patches # Apply patches
if [ -d "$YNH_APP_BASEDIR/sources/patches/" ]; then if [ -d "$YNH_APP_BASEDIR/patches/" ]; then
local patches_folder=$(realpath $YNH_APP_BASEDIR/sources/patches/) local patches_folder=$(realpath $YNH_APP_BASEDIR/patches/)
if (($(find $patches_folder -type f -name "${source_id}-*.patch" 2>/dev/null | wc --lines) > "0")); then # Check if any file matching the pattern exists, cf https://stackoverflow.com/a/34195247
if compgen -G "$patches_folder/${source_id}-*.patch" >/dev/null; then
pushd "$dest_dir" pushd "$dest_dir"
for p in $patches_folder/${source_id}-*.patch; do for p in $patches_folder/${source_id}-*.patch; do
echo $p echo $p
@ -321,11 +321,6 @@ ynh_setup_source() {
fi fi
fi fi
# Add supplementary files
if test -e "$YNH_APP_BASEDIR/sources/extra_files/${source_id}"; then
cp --archive $YNH_APP_BASEDIR/sources/extra_files/$source_id/. "$dest_dir"
fi
# Keep files to be backup/restored at the end of the helper # Keep files to be backup/restored at the end of the helper
# Assuming $dest_dir already exists # Assuming $dest_dir already exists
if [ -n "$keep" ]; then if [ -n "$keep" ]; then