1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/photoview_ynh.git synced 2024-09-03 20:05:55 +02:00

Fix build

This commit is contained in:
Jules Bertholet 2022-01-02 02:53:43 -05:00
parent 1ba884530a
commit 447e4f432f
2 changed files with 152 additions and 157 deletions

View file

@ -1,8 +0,0 @@
{
"markdownlint.config": {
"MD028": false,
"MD025": {
"front_matter_title": ""
}
}
}

View file

@ -56,10 +56,12 @@ function build_api {
pushd "$final_path/api" || ynh_die pushd "$final_path/api" || ynh_die
chown -R $app:$app "$final_path" chown -R $app:$app "$final_path"
set +e ; for i in {1..5}; do set +e
for i in {1..5}; do
sudo -u $app env "PATH=$go_path_full" "LIBRARY_PATH=$heif_lib_path" "LD_LIBRARY_PATH=$heif_ld_lib_path" "CGO_CFLAGS=$heif_cgo_cflags" GOENV_VERSION=$go_version CGO_ENABLED=1 go mod download 2>&1 && break sudo -u $app env "PATH=$go_path_full" "LIBRARY_PATH=$heif_lib_path" "LD_LIBRARY_PATH=$heif_ld_lib_path" "CGO_CFLAGS=$heif_cgo_cflags" GOENV_VERSION=$go_version CGO_ENABLED=1 go mod download 2>&1 && break
sleep 5 sleep 5
done; set -e done
set -e
sudo -u $app env "PATH=$go_path_full" "LIBRARY_PATH=$heif_lib_path" "LD_LIBRARY_PATH=$heif_ld_lib_path" "CGO_CFLAGS=$heif_cgo_cflags" GOENV_VERSION=$go_version CGO_ENABLED=1 go install github.com/mattn/go-sqlite3 github.com/Kagami/go-face 2>&1 sudo -u $app env "PATH=$go_path_full" "LIBRARY_PATH=$heif_lib_path" "LD_LIBRARY_PATH=$heif_ld_lib_path" "CGO_CFLAGS=$heif_cgo_cflags" GOENV_VERSION=$go_version CGO_ENABLED=1 go install github.com/mattn/go-sqlite3 github.com/Kagami/go-face 2>&1
sudo -u $app env "PATH=$go_path_full" "LIBRARY_PATH=$heif_lib_path" "LD_LIBRARY_PATH=$heif_ld_lib_path" "CGO_CFLAGS=$heif_cgo_cflags" GOENV_VERSION=$go_version go build -o photoview "$final_path/api" 2>&1 sudo -u $app env "PATH=$go_path_full" "LIBRARY_PATH=$heif_lib_path" "LD_LIBRARY_PATH=$heif_ld_lib_path" "CGO_CFLAGS=$heif_cgo_cflags" GOENV_VERSION=$go_version go build -o photoview "$final_path/api" 2>&1
popd || ynh_die popd || ynh_die
@ -81,17 +83,23 @@ function build_ui {
pushd "$ui_path" || ynh_die pushd "$ui_path" || ynh_die
chown -R $app:$app $final_path chown -R $app:$app $final_path
sudo -u $app touch $ui_path/.yarnrc sudo -u $app touch $ui_path/.yarnrc
sudo -u $app env "PATH=$node_path" yarn --cache-folder "$ui_path/yarn-cache" --use-yarnrc "$ui_path/.yarnrc" import 2>&1
sudo -u $app env "PATH=$node_path" yarn --cache-folder "$ui_path/yarn-cache" --use-yarnrc "$ui_path/.yarnrc" add husky 2>&1
sudo -u $app env "PATH=$node_path" yarn --cache-folder "$ui_path/yarn-cache" --use-yarnrc "$ui_path/.yarnrc" install 2>&1 sudo -u $app env "PATH=$node_path" yarn --cache-folder "$ui_path/yarn-cache" --use-yarnrc "$ui_path/.yarnrc" install 2>&1
sudo -u $app env "PATH=$node_path" yarn --cache-folder "$ui_path/yarn-cache" --use-yarnrc "$ui_path/.yarnrc" add graphql --ignore-engines 2>&1 sudo -u $app env "PATH=$node_path" yarn --cache-folder "$ui_path/yarn-cache" --use-yarnrc "$ui_path/.yarnrc" add graphql --ignore-engines 2>&1
grep -q "build complete" <((sudo -u $app env "PATH=$node_path" yarn --cache-folder "$ui_path/yarn-cache" --use-yarnrc "$ui_path/.yarnrc" run build -- --public-url "$path_url" 2>&1 & echo $! >&3 ) 3>pid) ; kill "$(<pid)" sudo -u $app env "PATH=$node_path" yarn --cache-folder "$ui_path/yarn-cache" --use-yarnrc "$ui_path/.yarnrc" run build --public-url "$path_url" 2>&1
popd || ynh_die popd || ynh_die
cp -rT "$final_path/ui/dist" "$final_path/output/ui" cp -rT "$final_path/ui/build" "$final_path/output/ui"
set_permissions set_permissions
} }
function set_node_vars { function set_node_vars {
nodejs_version=$(ynh_app_setting_get --app=$app --key=nodejs_version)
if [ $nodejs_version -ne 16 ]; then
ynh_exec_warn_less ynh_remove_nodejs
fi
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=16 ynh_exec_warn_less ynh_install_nodejs --nodejs_version=16
ynh_use_nodejs ynh_use_nodejs
node_path=$nodejs_path:$(sudo -u $app sh -c 'echo $PATH') node_path=$nodejs_path:$(sudo -u $app sh -c 'echo $PATH')
@ -331,29 +339,24 @@ ynh_cleanup_go () {
# List required Go versions # List required Go versions
local installed_apps=$(yunohost app list | grep -oP 'id: \K.*$') local installed_apps=$(yunohost app list | grep -oP 'id: \K.*$')
local required_go_versions="" local required_go_versions=""
for installed_app in $installed_apps for installed_app in $installed_apps; do
do
local installed_app_go_version=$(ynh_app_setting_get --app=$installed_app --key="go_version") local installed_app_go_version=$(ynh_app_setting_get --app=$installed_app --key="go_version")
if [[ $installed_app_go_version ]] if [[ $installed_app_go_version ]]; then
then
required_go_versions="${installed_app_go_version}\n${required_go_versions}" required_go_versions="${installed_app_go_version}\n${required_go_versions}"
fi fi
done done
# Remove no more needed Go versions # Remove no more needed Go versions
local installed_go_versions=$(goenv versions --bare --skip-aliases | grep -Ev '/') local installed_go_versions=$(goenv versions --bare --skip-aliases | grep -Ev '/')
for installed_go_version in $installed_go_versions for installed_go_version in $installed_go_versions; do
do if ! $(echo ${required_go_versions} | grep "${installed_go_version}" 1>/dev/null 2>&1); then
if ! `echo ${required_go_versions} | grep "${installed_go_version}" 1>/dev/null 2>&1`
then
ynh_print_info --message="Removing of Go-$installed_go_version" ynh_print_info --message="Removing of Go-$installed_go_version"
$goenv_install_dir/bin/goenv uninstall --force $installed_go_version $goenv_install_dir/bin/goenv uninstall --force $installed_go_version
fi fi
done done
# If none Go version is required # If none Go version is required
if [[ ! $required_go_versions ]] if [[ ! $required_go_versions ]]; then
then
# Remove goenv environment configuration # Remove goenv environment configuration
ynh_print_info --message="Removing of goenv" ynh_print_info --message="Removing of goenv"
ynh_secure_remove --file="$goenv_install_dir" ynh_secure_remove --file="$goenv_install_dir"