2

Resolved

Recipe execution doesn't install module from custom module gallery other version than latest

description

Module recipe handler installs only latest version of modules if "repository" is defined.

Example:

We have 3 versions of module XYZ in custom module repository: version 1.0, 2.0 and 3.0. Recipe looks like this.
<Module packageId="Orchard.Module.XYZ" repository="http://MyGalleryServer/FeedService.svc" version="2.0" />
Recipe handler will install this module but in version 3.0.
The problem is with this lines of code in ModuleRecipeHandler.cs
            var packagingSource = _packagingSourceManager.GetSources().FirstOrDefault();
            if (repository != null) {
                enforceVersion = false;
                packagingSource = new PackagingSource {FeedTitle = repository, FeedUrl = repository};
            }

            if (enforceVersion) {
                packagingEntry = _packagingSourceManager.GetExtensionList(false, packagingSource, 
                    packages => packages.Where(package => 
                        package.PackageType.Equals(DefaultExtensionTypes.Module) && 
                        package.Id.Equals(packageId, StringComparison.OrdinalIgnoreCase) && 
                        package.Version.Equals(version, StringComparison.OrdinalIgnoreCase))).FirstOrDefault();
            }
            else {
                packagingEntry = _packagingSourceManager.GetExtensionList(false, packagingSource, 
                    packages => packages.Where(package => 
                        package.PackageType.Equals(DefaultExtensionTypes.Module) && 
                        package.Id.Equals(packageId, StringComparison.OrdinalIgnoreCase) && 
                        package.IsLatestVersion)).FirstOrDefault();
            }
If repository is defined (it means custom) then "enforceVersion" is set to false and only package.IsLatestVersion is taken. The similar code is in ThemeRecipeHandler.cs and the same problem.

I will try to deliver pull request with bugfix soon.

comments

rodpl wrote Aug 17, 2013 at 2:29 PM

In what changeset is it resolved ?

sebastienros wrote Aug 22, 2013 at 6:37 PM

Fixed in changeset 8c9b3570d0be883f8084bf7efe471cebd386c062