Skip to content

Commit a4a218d

Browse files
committed
Merge remote-tracking branch 'origin/fix/module-system-code-issues-2' into feat/use-npr-client
2 parents f93e0af + d0545dc commit a4a218d

18 files changed

Lines changed: 724 additions & 123 deletions

File tree

modules/nextflow/src/main/groovy/nextflow/cli/module/CmdModuleInfo.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class CmdModuleInfo extends CmdBase {
120120
throw new AbortOperationException("No release information available for ${reference}")
121121
}
122122
if( !release.metadata ) {
123-
log.info("No metadata found for $reference ${release.version ? "($release.version)" : ''}")
123+
throw new AbortOperationException("No metadata found for ${reference}${release.version ? " (${release.version})" : ''}")
124124
}
125125
def moduleUrl = buildModuleUrl(registryConfig.url, reference, release.version)
126126
if( !output || output == 'text' ) {

modules/nextflow/src/main/groovy/nextflow/cli/module/CmdModuleInstall.groovy

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import nextflow.module.ModuleReference
2929
import io.seqera.npr.client.RegistryClient
3030
import nextflow.module.RegistryClientFactory
3131
import nextflow.module.ModuleResolver
32+
import nextflow.module.ModuleSpec
3233

3334
import nextflow.util.TestOnly
3435

@@ -86,7 +87,8 @@ class CmdModuleInstall extends CmdBase {
8687

8788
try {
8889
def installedMainFile = resolver.installModule(reference, version, force)
89-
def installedVersion = version ?: resolver.resolveVersion(reference)
90+
// Read the installed version from meta.yml to avoid a redundant registry call
91+
def installedVersion = ModuleSpec.load(installedMainFile.parent.resolve('meta.yml')).version
9092

9193
println "Module ${reference}@${installedVersion} installed and configured successfully"
9294
}

modules/nextflow/src/main/groovy/nextflow/cli/module/CmdModulePublish.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ class CmdModulePublish extends CmdBase {
261261
final localStorage = new ModuleStorage(root ?: Paths.get('.').toAbsolutePath().normalize())
262262

263263
if (!localStorage.isInstalled(ref)){
264-
throw new AbortOperationException("No module diretory found for $module")
264+
throw new AbortOperationException("No module directory found for $module")
265265
}
266266
useModuleReference = true
267267
return localStorage.getModuleDir(ref)

modules/nextflow/src/main/groovy/nextflow/module/ModuleInfo.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,13 @@ class ModuleInfo {
9494
* Load all properties from the .module-info file in the module directory
9595
*
9696
* @param moduleDir The module directory path
97-
* @return The checksum, or null if file doesn't exist
97+
* @return Map of properties, or null if file doesn't exist
9898
*/
9999
static Map<String, String> load(Path moduleDir) {
100100
def moduleInfoFile = moduleDir.resolve(MODULE_INFO_FILE)
101101
if( !Files.exists(moduleInfoFile) ) {
102102
log.debug("Module file $moduleInfoFile not found")
103-
return [:]
103+
return null
104104
}
105105
def props = new Properties()
106106
moduleInfoFile.withInputStream { is -> props.load(is) }

modules/nextflow/src/main/groovy/nextflow/module/ModuleReference.groovy

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@ import java.util.regex.Pattern
3131
@EqualsAndHashCode
3232
class ModuleReference {
3333

34-
// Pattern allows: scope with letters/digits/hyphens/dots/underscores, name segments separated by slashes (no trailing slash)
35-
// Scope: starts with letter/digit, followed by letters/digits/dots/underscores/hyphens
36-
// Name: one or more segments (each starting with letter, followed by letters/digits/underscores/hyphens), separated by slashes
34+
// Must stay in sync with ModuleResolver.REMOTE_MODULE_PATTERN in nf-lang
3735
private static final Pattern MODULE_NAME_PATTERN = ~/^([a-z0-9][a-z0-9._\-]*)\/([a-z][a-z0-9._\-]*(?:\/[a-z][a-z0-9._\-]*)*)$/
3836

3937
final String scope

0 commit comments

Comments
 (0)