Skip to content

Commit

Permalink
[570643] Installer does not update to new versions
Browse files Browse the repository at this point in the history
  • Loading branch information
merks committed Jan 26, 2021
1 parent 8fb2279 commit d72a56f
Showing 1 changed file with 1 addition and 30 deletions.
Expand Up @@ -13,9 +13,7 @@
import org.eclipse.oomph.p2.P2Factory;
import org.eclipse.oomph.p2.ProfileDefinition;
import org.eclipse.oomph.p2.Repository;
import org.eclipse.oomph.p2.Requirement;
import org.eclipse.oomph.p2.core.CertificateConfirmer;
import org.eclipse.oomph.p2.core.Profile;
import org.eclipse.oomph.p2.core.ProfileTransaction;
import org.eclipse.oomph.p2.core.ProfileTransaction.CommitContext;
import org.eclipse.oomph.setup.User;
Expand All @@ -24,7 +22,6 @@
import org.eclipse.oomph.setup.ui.wizards.ProgressPage;
import org.eclipse.oomph.setup.util.SetupUtil;
import org.eclipse.oomph.util.Confirmer;
import org.eclipse.oomph.util.PropertiesUtil;

import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.URI;
Expand All @@ -33,8 +30,6 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.equinox.p2.engine.IProvisioningPlan;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.VersionRange;

/**
* @author Eike Stepper
Expand All @@ -54,31 +49,7 @@ public SelfCommitContext(User user) throws CoreException

public ProfileTransaction migrateProfile(ProfileTransaction transaction) throws CoreException
{
boolean installer = false;

// TODO Remove this temporary range conversion when all users can be expected to have a major range.
String productID = PropertiesUtil.getProductID();
VersionRange deprecatedVersionRange = new VersionRange("[1.0.0,1.1.0)"); //$NON-NLS-1$
ProfileDefinition profileDefinition = transaction.getProfileDefinition();
for (Requirement requirement : profileDefinition.getRequirements())
{
if (IInstallableUnit.NAMESPACE_IU_ID.equals(requirement.getNamespace()) && productID.equals(requirement.getName()))
{
installer = true;
if (deprecatedVersionRange.equals(requirement.getVersionRange()))
{
requirement.setVersionRange(new VersionRange("[1.0.0,2.0.0)")); //$NON-NLS-1$
transaction.commit(new NullProgressMonitor());

Profile profile = transaction.getProfile();
transaction = profile.change();
}

break;
}
}

repositoryChanged = installer ? changeRepositoryIfNeeded(profileDefinition) : false;
repositoryChanged = SetupUtil.INSTALLER_APPLICATION && changeRepositoryIfNeeded(transaction.getProfileDefinition());
return transaction;
}

Expand Down

0 comments on commit d72a56f

Please sign in to comment.