diff --git a/app/config/drupal10-dev/download.sh b/app/config/drupal10-dev/download.sh index 0a4291e0..e8f0f9e0 100644 --- a/app/config/drupal10-dev/download.sh +++ b/app/config/drupal10-dev/download.sh @@ -26,10 +26,11 @@ pushd "$WEB_ROOT" >> /dev/null git_cache_clone "civicrm/civicrm-core" -b "$CIVI_VERSION" src/civicrm-core git_cache_clone "civicrm/civicrm-drupal-8" -b "$CIVI_VERSION" src/civicrm-drupal-8 git_cache_clone "civicrm/civicrm-packages" -b "$CIVI_VERSION" src/civicrm-packages - composer config repositories.civicrm-core '{"type": "path", "url": "./src/civicrm-core", "options": { "symlink": false } }' - composer config repositories.civicrm-drupal-8 '{"type": "path", "url": "./src/civicrm-drupal-8", "options": { "symlink": false }}' - composer config repositories.civicrm-packages '{"type": "path", "url": "./src/civicrm-packages", "options": { "symlink": false }}' - ## The symlink:false helps when running the installation step. We should probably fix that... + + if civicrm_check_requested_ver '<' 5.81.alpha1 ; then _composer_symlink=false ; else _composer_symlink=true ; fi + composer config repositories.civicrm-core '{"type": "path", "url": "./src/civicrm-core", "options": { "symlink": '$_composer_symlink' } }' + composer config repositories.civicrm-drupal-8 '{"type": "path", "url": "./src/civicrm-drupal-8", "options": { "symlink": '$_composer_symlink' }}' + composer config repositories.civicrm-packages '{"type": "path", "url": "./src/civicrm-packages", "options": { "symlink": '$_composer_symlink' }}' civibuild_apply_user_extras civicrm_download_composer_d8 vendor/civicrm/civicrm-core diff --git a/app/config/drupal9-dev/download.sh b/app/config/drupal9-dev/download.sh index 27bea5b6..ed1134b2 100644 --- a/app/config/drupal9-dev/download.sh +++ b/app/config/drupal9-dev/download.sh @@ -25,10 +25,11 @@ pushd "$WEB_ROOT" >> /dev/null git_cache_clone "civicrm/civicrm-core" -b "$CIVI_VERSION" src/civicrm-core git_cache_clone "civicrm/civicrm-drupal-8" -b "$CIVI_VERSION" src/civicrm-drupal-8 git_cache_clone "civicrm/civicrm-packages" -b "$CIVI_VERSION" src/civicrm-packages - composer config repositories.civicrm-core '{"type": "path", "url": "./src/civicrm-core", "options": { "symlink": false } }' - composer config repositories.civicrm-drupal-8 '{"type": "path", "url": "./src/civicrm-drupal-8", "options": { "symlink": false }}' - composer config repositories.civicrm-packages '{"type": "path", "url": "./src/civicrm-packages", "options": { "symlink": false }}' - ## The symlink:false helps when running the installation step. We should probably fix that... + + if civicrm_check_requested_ver '<' 5.81.alpha1 ; then _composer_symlink=false ; else _composer_symlink=true ; fi + composer config repositories.civicrm-core '{"type": "path", "url": "./src/civicrm-core", "options": { "symlink": '$_composer_symlink' } }' + composer config repositories.civicrm-drupal-8 '{"type": "path", "url": "./src/civicrm-drupal-8", "options": { "symlink": '$_composer_symlink' }}' + composer config repositories.civicrm-packages '{"type": "path", "url": "./src/civicrm-packages", "options": { "symlink": '$_composer_symlink' }}' civibuild_apply_user_extras civicrm_download_composer_d8 vendor/civicrm/civicrm-core diff --git a/src/civibuild.lib.sh b/src/civibuild.lib.sh index e43ec22f..bcaa9d44 100644 --- a/src/civibuild.lib.sh +++ b/src/civibuild.lib.sh @@ -617,7 +617,8 @@ function civicrm_download_composer_d8() { *) echo 'No Extra Patch required' ; ;; esac - composer require "${EXTRA_COMPOSER[@]}" civicrm/civicrm-{core,packages,drupal-8}:"$CIVI_VERSION_COMP" --prefer-source -W + composer config 'preferred-install.civicrm/*' source + composer require "${EXTRA_COMPOSER[@]}" civicrm/civicrm-{core,packages,drupal-8}:"$CIVI_VERSION_COMP" -W [ -n "$EXTRA_PATCH" ] && git scan am -N "${EXTRA_PATCH[@]}" if [ -z "$CIVI_ROOT" ]; then @@ -1013,6 +1014,23 @@ function civicrm_check_ver() { fi } +############################################################################### +## Check if the requested version of CiviCRM (*not yet downloaded*) matches some condition. +## usage: civicrm_check_ver +## example: if civicrm_check_ver '>=' '5.43' ; then echo NEW; else echo OLD; fi +function civicrm_check_requested_ver() { + cvutil_assertvars civicrm_check_requested_ver CIVI_VERSION + local ver="$CIVI_VERSION" + if [[ "$ver" == "master" ]]; then + ver=9999999.9999.9999 + fi + if env ACTUAL="$ver" OP="$1" EXPECT="$2" php -r 'exit(version_compare(getenv("ACTUAL"), getenv("EXPECT"), getenv("OP"))?0:1);'; then + return 0 + else + return 1 + fi +} + ############################################################################### ## usage: civicrm_ext_download_bare function civicrm_ext_download_bare() {