Skip to content
This repository has been archived by the owner on Dec 18, 2017. It is now read-only.

Ignore pacakge with unnormalized version #2251

Merged
merged 1 commit into from
Jul 15, 2015
Merged

Ignore pacakge with unnormalized version #2251

merged 1 commit into from
Jul 15, 2015

Conversation

troydai
Copy link
Contributor

@troydai troydai commented Jul 12, 2015

Intend to address #2240.

It just test the water. I'll add more test cases.

@davidfowl
Copy link
Member

@troydai
Copy link
Contributor Author

troydai commented Jul 12, 2015

Yes, change in the PackageRepository was the first though. But then we agreed on Friday that we'd better limit the scope of this change to the dnu restore only. There are more things depends on PackageRepository.

@davidfowl
Copy link
Member

@troydai I prefer that change. It should only affect restore because PackageRepository has 2 code paths. With and without the lock file.

@troydai
Copy link
Contributor Author

troydai commented Jul 13, 2015

All right.

@troydai
Copy link
Contributor Author

troydai commented Jul 13, 2015

@davidfowl better?

@davidfowl
Copy link
Member

@troydai Much better! The comment needs some work

@davidfowl
Copy link
Member

Can you add a test? We do have restore tests ping @ChengTian

@troydai
Copy link
Contributor Author

troydai commented Jul 14, 2015

Yes, tests will be added. I'll work with @ChengTian

{
// For a non-http match, if the OriginalVersion string is not normalized that means name of the folder which contains
// the package is not a normalized string. It will cause trouble for file searching in later stage. By invalidate this
// match, it ensures the package will be reinstalled under a correct folder. This change ensures a package installed
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By invalidating this

@ChengTian
Copy link
Contributor

@troydai
Copy link
Contributor Author

troydai commented Jul 15, 2015

@davidfowl @ChengTian

Updated. Test Added.

public void DnuRestore_ReinstallsPackageWithNormalizedVersion(string flavor, string os, string architecture)
{
var runtimeHomePath = _fixture.GetRuntimeHomeDir(flavor, os, architecture);
using (var tempDir = new DisposableDir("/tmp/troy.temp", false))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're not actually hardcoding a temp directory right? Why isn't this random?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, shouldn't have it here. It's for local testing. Gonna remove it.

@troydai
Copy link
Contributor Author

troydai commented Jul 15, 2015

arguments: $"{projectDir} -s {_fixture.PackageSource} --packages {packagesDir}");

// rename package folder to an unnormalized string
Directory.Move(Path.Combine(packagesDir, "alpha", "0.1.0"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible that the folder can be normalized but the sha file and nupkg inside isn't or that that not possible

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's actually not possible. Either both normalized or not. https://github.com/aspnet/dnx/blob/dev/src/Microsoft.Framework.PackageManager/Utils/NuGetPackageUtils.cs#L30

But the simplified model used by test is sufficient because the version of a package on disk is parsed from it's folder name: https://github.com/aspnet/dnx/blob/dev/src/Microsoft.Framework.Runtime/NuGet/Repositories/PackageRepository.cs#L102.

@troydai
Copy link
Contributor Author

troydai commented Jul 15, 2015

@davidfowl
Copy link
Member

:shipit: does this also fix the issue for publish? An issue we just filed on this

@troydai
Copy link
Contributor Author

troydai commented Jul 15, 2015

I'll try out

@troydai
Copy link
Contributor Author

troydai commented Jul 15, 2015

This won't fix that issue though. It needs to normalize the version in PublishCommand. It doesn't use DefaultPackagePathResolver.

I'll merge this one first then address issue #2267

@troydai troydai merged commit a8d2d5a into dev Jul 15, 2015
@troydai troydai deleted the trdai/2240 branch July 15, 2015 23:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants