From 26626bb25c7375d5b09cc02feb2e4544a96a4559 Mon Sep 17 00:00:00 2001 From: fabianegli Date: Tue, 6 Sep 2022 14:21:00 +0200 Subject: [PATCH 1/4] generalized code, better error message and link update --- nf_core/pipeline-template/lib/Utils.groovy | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) mode change 100755 => 100644 nf_core/pipeline-template/lib/Utils.groovy diff --git a/nf_core/pipeline-template/lib/Utils.groovy b/nf_core/pipeline-template/lib/Utils.groovy old mode 100755 new mode 100644 index 28567bd70..f5b2ba6c0 --- a/nf_core/pipeline-template/lib/Utils.groovy +++ b/nf_core/pipeline-template/lib/Utils.groovy @@ -21,19 +21,26 @@ class Utils { } // Check that all channels are present - def required_channels = ['conda-forge', 'bioconda', 'defaults'] - def conda_check_failed = !required_channels.every { ch -> ch in channels } + // This channel list is ordered by required channel priority. + def required_channels_in_order = ['conda-forge', 'bioconda', 'defaults'] + def channels_missing = ((required_channels_in_order as Set) - (channels as Set)) as Boolean // Check that they are in the right order - conda_check_failed |= !(channels.indexOf('conda-forge') < channels.indexOf('bioconda')) - conda_check_failed |= !(channels.indexOf('bioconda') < channels.indexOf('defaults')) + def channel_priority_violation = false + def n = required_channels_in_order.size() + for (int i = 0; i < n - 1; i++) { + channel_priority_violation |= !(channels.indexOf(required_channels_in_order[i]) < channels.indexOf(required_channels_in_order[i+1])) + } - if (conda_check_failed) { + if (channels_missing | channel_priority_violation) { log.warn "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" + " There is a problem with your Conda configuration!\n\n" + " You will need to set-up the conda-forge and bioconda channels correctly.\n" + - " Please refer to https://bioconda.github.io/user/install.html#set-up-channels\n" + - " NB: The order of the channels matters!\n" + + " Please refer to https://bioconda.github.io/\n" + + " The observed channel order is \n" + + " ${channels}" + + " but the following channel order is required:\n" + + " ${required_channels}\n" + "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" } } From 7017caa9f523c3655da9b897c17defdd9b1c6da3 Mon Sep 17 00:00:00 2001 From: fabianegli Date: Tue, 6 Sep 2022 14:57:44 +0200 Subject: [PATCH 2/4] mend --- nf_core/pipeline-template/lib/Utils.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nf_core/pipeline-template/lib/Utils.groovy b/nf_core/pipeline-template/lib/Utils.groovy index f5b2ba6c0..7378f26f5 100644 --- a/nf_core/pipeline-template/lib/Utils.groovy +++ b/nf_core/pipeline-template/lib/Utils.groovy @@ -40,7 +40,7 @@ class Utils { " The observed channel order is \n" + " ${channels}" + " but the following channel order is required:\n" + - " ${required_channels}\n" + + " ${required_channels_in_order}\n" + "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" } } From 6029c9d5b302ae9ca5ae663d74ec326260b59e05 Mon Sep 17 00:00:00 2001 From: Fabian Egli Date: Tue, 6 Sep 2022 17:37:40 +0200 Subject: [PATCH 3/4] better error message for bad conda channel setup --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 27b86f23c..7ee1a97be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Template - Add `actions/upload-artifact` step to the awstest workflows, to expose the debug log file +- Bioconda incompatible conda channel setups now result in more informative error messages ([#1812](https://github.com/nf-core/tools/pull/1812)) ### Linting From 1712cc77af456efcfe9d08659e2d47cbf8d76b81 Mon Sep 17 00:00:00 2001 From: Fabian Egli Date: Wed, 7 Sep 2022 08:54:28 +0200 Subject: [PATCH 4/4] better text formatting added missing newline --- nf_core/pipeline-template/lib/Utils.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nf_core/pipeline-template/lib/Utils.groovy b/nf_core/pipeline-template/lib/Utils.groovy index 7378f26f5..8d030f4e8 100644 --- a/nf_core/pipeline-template/lib/Utils.groovy +++ b/nf_core/pipeline-template/lib/Utils.groovy @@ -38,7 +38,7 @@ class Utils { " You will need to set-up the conda-forge and bioconda channels correctly.\n" + " Please refer to https://bioconda.github.io/\n" + " The observed channel order is \n" + - " ${channels}" + + " ${channels}\n" + " but the following channel order is required:\n" + " ${required_channels_in_order}\n" + "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"