system/src/sc/repos/RepositoryPackage.java
public boolean updateFromSaved(IRepositoryManager mgr, RepositoryPackage oldPkg, boolean install, DependencyContext ctx) {
      if (!samePackages(oldPkg))
         return false;

      // Note: We used to also compare fileNames but we can at least add to that list based on the contents of the POM
      // so we need to restore that value instead

      if (oldPkg.sources == null)
         return false;

      if (sources == null)
         sources = new RepositorySource[0];

      // We might have added a source but if the current sources are the same we do not have to reinstall
      if (sources.length > oldPkg.sources.length) {
         if (currentSource == null || oldPkg.currentSource == null || !currentSource.equals(oldPkg.currentSource))
            return false;
      }

      // If the packet went from false to true, we need to re-install to pick up the test dependencies.  If it goes from
      // true to false we'll accept that as already being installed.
      if (includeTests && !oldPkg.includeTests)
         return false;

      if (includeRuntime && !oldPkg.includeRuntime)
         return false;

      // Just check that the original sources match.  sources right now only has those added in the layer def files - not those that will be added
      // via dependencies if we install.
      if (currentSource == null || oldPkg.currentSource == null) {
         for (int i = 0; i < sources.length; i++)
            if (!sources[i].equals(oldPkg.sources[i]))
               return false;
      }
      // The current source changed
      else if (!currentSource.equals(oldPkg.currentSource)) {
         RepositorySystem reposSys = getRepositorySystem();
         if (reposSys == null)
            return false;

         MessageHandler.info(reposSys.msg, "Package ", packageName, " - source changed from: " + oldPkg.currentSource + " to: " + currentSource);
         return false;
      }

      fileNames = oldPkg.fileNames;
      definesClasses = oldPkg.definesClasses;
      definesSrc = oldPkg.definesSrc;
      buildFromSrc = oldPkg.buildFromSrc;

      RepositorySystem sys = mgr.getRepositorySystem();

      if (oldPkg.parentPkgURL != null) {
         if (parentPkg != null) {
            if (!parentPkg.sameParentURL(oldPkg.parentPkgURL)) {
               System.err.println("*** parentPkgURL changed - reinstalling");
               return false;
            }
         }
         else {
            IRepositoryManager parentMgr = sys.getManagerFromURL(oldPkg.parentPkgURL);
            if (parentMgr == null) {
               parentMgr = mgr;
            }
            setParentPkg(parentMgr.getOrCreatePackage(oldPkg.parentPkgURL, null, false));
         }
      }

      initSubPackages(oldPkg, install);
      if (oldPkg.depPkgURLs != null) {
         ArrayList<RepositoryPackage> deps = new ArrayList<RepositoryPackage>(oldPkg.depPkgURLs.size());
         for (String depPkgURL:oldPkg.depPkgURLs) {
            deps.add(mgr.getOrCreatePackage(depPkgURL, null, install));
         }
         dependencies = deps;
      }

      // Restore any package aliases we migh ahve saved so those are properly resolved in the dependency mechanism
      if (oldPkg.packageAlias != null)
         mgr.getRepositorySystem().registerAlternateName(this, oldPkg.packageAlias);

      // Move over the restored RepositorySource objects since they will have more info than
      // these source objects that were maybe created from the URL of some reference.  Need to
      // update the backpointer as well.
      sources = oldPkg.sources;
      if (sources != null) {
         for (RepositorySource nsrc:sources) {
            nsrc.updateAfterRestore(this);
         }
      }
      updateCurrentSource(oldPkg.currentSource, true);

      if (install) {
         installSubPackages(mgr, ctx);
      }

      return true;
   }
// update this package with the saved info.
update this package with the saved info.
update this package with the saved info .
public boolean updateFromSaved(IRepositoryManager mgr, RepositoryPackage oldPkg, boolean install, DependencyContext ctx) {
      if (!samePackages(oldPkg))
         return false;
      if (oldPkg.sources == null)
         return false;
      if (sources == null)
         sources = new RepositorySource[0];
      if (sources.length > oldPkg.sources.length) {
         if (currentSource == null || oldPkg.currentSource == null || !currentSource.equals(oldPkg.currentSource))
            return false;
      }
      if (includeTests && !oldPkg.includeTests)
         return false;
      if (includeRuntime && !oldPkg.includeRuntime)
         return false;
      if (currentSource == null || oldPkg.currentSource == null) {
         for (int i = 0; i < sources.length; i++)
            if (!sources[i].equals(oldPkg.sources[i]))
               return false;
      }
      else if (!currentSource.equals(oldPkg.currentSource)) {
         RepositorySystem reposSys = getRepositorySystem();
         if (reposSys == null)
            return false;
         MessageHandler.info(reposSys.msg, "Package ", packageName, " - source changed from: " + oldPkg.currentSource + " to: " + currentSource);
         return false;
      }
      fileNames = oldPkg.fileNames;
      definesClasses = oldPkg.definesClasses;
      definesSrc = oldPkg.definesSrc;
      buildFromSrc = oldPkg.buildFromSrc;
      RepositorySystem sys = mgr.getRepositorySystem();
      if (oldPkg.parentPkgURL != null) {
         if (parentPkg != null) {
            if (!parentPkg.sameParentURL(oldPkg.parentPkgURL)) {
               System.err.println("*** parentPkgURL changed - reinstalling");
               return false;
            }
         }
         else {
            IRepositoryManager parentMgr = sys.getManagerFromURL(oldPkg.parentPkgURL);
            if (parentMgr == null) {
               parentMgr = mgr;
            }
            setParentPkg(parentMgr.getOrCreatePackage(oldPkg.parentPkgURL, null, false));
         }
      }
      initSubPackages(oldPkg, install);
      if (oldPkg.depPkgURLs != null) {
         ArrayList<RepositoryPackage> deps = new ArrayList<RepositoryPackage>(oldPkg.depPkgURLs.size());
         for (String depPkgURL:oldPkg.depPkgURLs) {
            deps.add(mgr.getOrCreatePackage(depPkgURL, null, install));
         }
         dependencies = deps;
      }
      if (oldPkg.packageAlias != null)
         mgr.getRepositorySystem().registerAlternateName(this, oldPkg.packageAlias);
      sources = oldPkg.sources;
      if (sources != null) {
         for (RepositorySource nsrc:sources) {
            nsrc.updateAfterRestore(this);
         }
      }
      updateCurrentSource(oldPkg.currentSource, true);
      if (install) {
         installSubPackages(mgr, ctx);
      }
      return true;
   }
public boolean updateFromSaved ( IRepositoryManager mgr , RepositoryPackage oldPkg , boolean install , DependencyContext ctx ) { if ( ! samePackages ( oldPkg ) ) return false ; if ( oldPkg . sources == null ) return false ; if ( sources == null ) sources = new RepositorySource [ 0 ] ; if ( sources . length > oldPkg . sources . length ) { if ( currentSource == null || oldPkg . currentSource == null || ! currentSource . equals ( oldPkg . currentSource ) ) return false ; } if ( includeTests && ! oldPkg . includeTests ) return false ; if ( includeRuntime && ! oldPkg . includeRuntime ) return false ; if ( currentSource == null || oldPkg . currentSource == null ) { for ( int i = 0 ; i < sources . length ; i ++ ) if ( ! sources [ i ] . equals ( oldPkg . sources [ i ] ) ) return false ; } else if ( ! currentSource . equals ( oldPkg . currentSource ) ) { RepositorySystem reposSys = getRepositorySystem ( ) ; if ( reposSys == null ) return false ; MessageHandler . info ( reposSys . msg , "Package " , packageName , " - source changed from: " + oldPkg . currentSource + " to: " + currentSource ) ; return false ; } fileNames = oldPkg . fileNames ; definesClasses = oldPkg . definesClasses ; definesSrc = oldPkg . definesSrc ; buildFromSrc = oldPkg . buildFromSrc ; RepositorySystem sys = mgr . getRepositorySystem ( ) ; if ( oldPkg . parentPkgURL != null ) { if ( parentPkg != null ) { if ( ! parentPkg . sameParentURL ( oldPkg . parentPkgURL ) ) { System . err . println ( "*** parentPkgURL changed - reinstalling" ) ; return false ; } } else { IRepositoryManager parentMgr = sys . getManagerFromURL ( oldPkg . parentPkgURL ) ; if ( parentMgr == null ) { parentMgr = mgr ; } setParentPkg ( parentMgr . getOrCreatePackage ( oldPkg . parentPkgURL , null , false ) ) ; } } initSubPackages ( oldPkg , install ) ; if ( oldPkg . depPkgURLs != null ) { ArrayList < RepositoryPackage > deps = new ArrayList < RepositoryPackage > ( oldPkg . depPkgURLs . size ( ) ) ; for ( String depPkgURL : oldPkg . depPkgURLs ) { deps . add ( mgr . getOrCreatePackage ( depPkgURL , null , install ) ) ; } dependencies = deps ; } if ( oldPkg . packageAlias != null ) mgr . getRepositorySystem ( ) . registerAlternateName ( this , oldPkg . packageAlias ) ; sources = oldPkg . sources ; if ( sources != null ) { for ( RepositorySource nsrc : sources ) { nsrc . updateAfterRestore ( this ) ; } } updateCurrentSource ( oldPkg . currentSource , true ) ; if ( install ) { installSubPackages ( mgr , ctx ) ; } return true ; }
update this package with the saved info.
update this package with the saved info .
// Note: We used to also compare fileNames but we can at least add to that list based on the contents of the POM // so we need to restore that value instead // We might have added a source but if the current sources are the same we do not have to reinstall // If the packet went from false to true, we need to re-install to pick up the test dependencies.  If it goes from // true to false we'll accept that as already being installed. // Just check that the original sources match.  sources right now only has those added in the layer def files - not those that will be added // via dependencies if we install. // The current source changed // Restore any package aliases we migh ahve saved so those are properly resolved in the dependency mechanism // Move over the restored RepositorySource objects since they will have more info than // these source objects that were maybe created from the URL of some reference.  Need to // update the backpointer as well.