Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add revision support to versioning #10

Merged
merged 11 commits into from Apr 3, 2024
Merged

Conversation

mateusrodrigues
Copy link
Member

This PR adds revision support to component versioning. This will allow the release of updates when the upstream .NET version of a component does not change.

How it works

Revision works by appending a +<number> to the end of the version string of a component, e.g.

   {
      "key": "aspnetcore-runtime-8.0.3+2",
      "name": "aspnetcore-runtime",
      "description": "ASP.NET Core",
      "baseUrl": "https://launchpad.net/ubuntu/+archive/primary/+files/",
      "version": "8.0.3+2",
      "packages": [
         {
            "name": "aspnetcore-runtime-8.0",
            "version": "8.0.3-0ubuntu1~22.04.1"
         }
      ],
      "dependencies": [
         "dotnet-runtime-8.0.3+2"
      ]
   }

Since the key is a unique parameter, it should also be updated to include the revision to avoid any collisions when merging local and remote manifests.

Any dependency key strings also need updating when the key of a dependent component changes.

Ordering

Revision is an optional parameter, therefore a version 8.0.3 has a revision of null. Subsequently, any +<number> appended to the end of a version string changes the version to have a revision of <number>.

Null revisions take precedence in ordering, such as:

8.0.3 < 8.0.3+2 < 8.0.3+256 < 8.0.4

In order to make sure that all revisions are installable in terms of the limits established by limits.json, we max out the revision section to INT_MAX so that all versions up to that upper limit revision are installable and avoid having to re-ship a new limits.json file whenever a new revision comes out.
It could happen that the update might not be installable because of the host version limit in the user's machine. Since install() is the method that fails, and uninstall() is not bound by limits, we run the former first to make sure it succeeds before removing anything.
Turns out that installing the new version first then uninstalling the old version, when the update is simply a revision, causes the registration file for the packages in that version to vanish due to the fact that the uninstallation removes the registration file of that package name.

It can also cause installed files to be simply replaced then erased, leaving a broken installation.

So we made Component.CanInstall() public in order to allow checking before uninstalling.
Removed the logic to remove a previous version of a component upon the installation of a newer version. In order to make it work, one would have to:

  1. Remove reverse dependencies of older version to be removed.
  2. Make sure to install the new versions of these reverse dependencies.

Update will do the trick for now.
@mateusrodrigues mateusrodrigues requested a review from a team as a code owner April 3, 2024 20:19
Copy link
Contributor

github-actions bot commented Apr 3, 2024

Test Results

82 tests  +21   82 ✅ +21   0s ⏱️ ±0s
 1 suites ± 0    0 💤 ± 0 
 1 files   ± 0    0 ❌ ± 0 

Results for commit 308a13e. ± Comparison against base commit e16259b.

This pull request removes 19 and adds 40 tests. Note that renamed tests count towards both.
Dotnet.Installer.Core.Tests.Types.DotnetVersionOperatorsTests ‑ CompareTo_WithEqualVersion_ShouldReturnZero(major: 8, minor: 0, patch: 100, isPreview: False, isRc: True, previewIdentifier: 1)
Dotnet.Installer.Core.Tests.Types.DotnetVersionOperatorsTests ‑ CompareTo_WithEqualVersion_ShouldReturnZero(major: 8, minor: 0, patch: 100, isPreview: True, isRc: False, previewIdentifier: 3)
Dotnet.Installer.Core.Tests.Types.DotnetVersionOperatorsTests ‑ CompareTo_WithEqualVersion_ShouldReturnZero(major: 8, minor: 0, patch: 102, isPreview: False, isRc: False, previewIdentifier: null)
Dotnet.Installer.Core.Tests.Types.DotnetVersionOperatorsTests ‑ CompareTo_WithHigherVersion_ShouldReturnSmallerThanZero(major: 8, minor: 0, patch: 100, isPreview: False, isRc: True, previewIdentifier: 1)
Dotnet.Installer.Core.Tests.Types.DotnetVersionOperatorsTests ‑ CompareTo_WithHigherVersion_ShouldReturnSmallerThanZero(major: 8, minor: 0, patch: 100, isPreview: True, isRc: False, previewIdentifier: 3)
Dotnet.Installer.Core.Tests.Types.DotnetVersionOperatorsTests ‑ CompareTo_WithHigherVersion_ShouldReturnSmallerThanZero(major: 8, minor: 0, patch: 102, isPreview: False, isRc: False, previewIdentifier: null)
Dotnet.Installer.Core.Tests.Types.DotnetVersionOperatorsTests ‑ CompareTo_WithLowerVersion_ShouldReturnGreaterThanZero(major: 8, minor: 0, patch: 100, isPreview: False, isRc: False, previewIdentifier: null)
Dotnet.Installer.Core.Tests.Types.DotnetVersionOperatorsTests ‑ CompareTo_WithLowerVersion_ShouldReturnGreaterThanZero(major: 8, minor: 0, patch: 101, isPreview: False, isRc: True, previewIdentifier: 1)
Dotnet.Installer.Core.Tests.Types.DotnetVersionOperatorsTests ‑ CompareTo_WithLowerVersion_ShouldReturnGreaterThanZero(major: 8, minor: 0, patch: 101, isPreview: True, isRc: False, previewIdentifier: 2)
Dotnet.Installer.Core.Tests.Types.DotnetVersionTests ‑ Constructor_WithInvalidInput_ShouldThrowApplicationException(major: 8, minor: 0, patch: 0, isPreview: False, isRc: False, previewIdentifier: 1)
…
Dotnet.Installer.Core.Tests.Types.DotnetVersionOperatorsTests ‑ CompareTo_WithEqualVersion_ShouldReturnZero(major: 8, minor: 0, patch: 100, isPreview: False, isRc: True, previewIdentifier: 1, revision: null)
Dotnet.Installer.Core.Tests.Types.DotnetVersionOperatorsTests ‑ CompareTo_WithEqualVersion_ShouldReturnZero(major: 8, minor: 0, patch: 100, isPreview: True, isRc: False, previewIdentifier: 3, revision: 2)
Dotnet.Installer.Core.Tests.Types.DotnetVersionOperatorsTests ‑ CompareTo_WithEqualVersion_ShouldReturnZero(major: 8, minor: 0, patch: 102, isPreview: False, isRc: False, previewIdentifier: null, revision: 1)
Dotnet.Installer.Core.Tests.Types.DotnetVersionOperatorsTests ‑ CompareTo_WithHigherVersion_ShouldReturnSmallerThanZero(major: 8, minor: 0, patch: 100, isPreview: False, isRc: True, previewIdentifier: 1, revision: null)
Dotnet.Installer.Core.Tests.Types.DotnetVersionOperatorsTests ‑ CompareTo_WithHigherVersion_ShouldReturnSmallerThanZero(major: 8, minor: 0, patch: 100, isPreview: True, isRc: False, previewIdentifier: 3, revision: null)
Dotnet.Installer.Core.Tests.Types.DotnetVersionOperatorsTests ‑ CompareTo_WithHigherVersion_ShouldReturnSmallerThanZero(major: 8, minor: 0, patch: 102, isPreview: False, isRc: False, previewIdentifier: null, revision: null)
Dotnet.Installer.Core.Tests.Types.DotnetVersionOperatorsTests ‑ CompareTo_WithHigherVersion_ShouldReturnSmallerThanZero(major: 8, minor: 0, patch: 103, isPreview: False, isRc: False, previewIdentifier: null, revision: 1)
Dotnet.Installer.Core.Tests.Types.DotnetVersionOperatorsTests ‑ CompareTo_WithLowerVersion_ShouldReturnGreaterThanZero(major: 8, minor: 0, patch: 100, isPreview: False, isRc: False, previewIdentifier: null, revision: null)
Dotnet.Installer.Core.Tests.Types.DotnetVersionOperatorsTests ‑ CompareTo_WithLowerVersion_ShouldReturnGreaterThanZero(major: 8, minor: 0, patch: 100, isPreview: False, isRc: True, previewIdentifier: 1, revision: 2)
Dotnet.Installer.Core.Tests.Types.DotnetVersionOperatorsTests ‑ CompareTo_WithLowerVersion_ShouldReturnGreaterThanZero(major: 8, minor: 0, patch: 101, isPreview: False, isRc: False, previewIdentifier: null, revision: 1)
…

♻️ This comment has been updated with latest results.

@mateusrodrigues mateusrodrigues merged commit 8be7347 into main Apr 3, 2024
3 checks passed
@mateusrodrigues mateusrodrigues deleted the feat/revision-support branch April 3, 2024 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant