Ejemplo n.º 1
0
 /* returns null if consistent, error string when not */
 public String checkConsistency() {
   final Collection<String> uploadSiteNames = getSiteNamesToUpload();
   final String uploadSiteName =
       uploadSiteNames.isEmpty() ? null : uploadSiteNames.iterator().next();
   final StringBuilder result = new StringBuilder();
   final Set<FileObject> circularChecked = new HashSet<FileObject>();
   for (final FileObject file : this) {
     if (uploadSiteName != null && !uploadSiteName.equals(file.updateSite)
         || file.getAction() == Action.REMOVE) {
       continue;
     }
     result.append(checkForCircularDependency(file, circularChecked, uploadSiteName));
     // only non-obsolete components can have dependencies
     final Set<String> deps = file.dependencies.keySet();
     if (deps.size() > 0 && file.isObsolete() && file.getAction() != Action.UPLOAD) {
       result.append(
           "Obsolete file " + file + " has dependencies: " + UpdaterUtil.join(", ", deps) + "!\n");
     }
     for (final String dependency : deps) {
       final FileObject dep = get(dependency);
       if (dep == null || dep.current == null)
         result.append(
             "The file "
                 + file
                 + " has the obsolete/local-only "
                 + "dependency "
                 + dependency
                 + "!\n");
     }
   }
   return result.length() > 0 ? result.toString() : null;
 }
Ejemplo n.º 2
0
 void addDependencies(final FileObject file, final DependencyMap map, final boolean overriding) {
   for (final Dependency dependency : file.getDependencies()) {
     final FileObject other = get(dependency.filename);
     if (other == null || overriding != dependency.overrides || !other.isUpdateablePlatform(this))
       continue;
     if (other.isObsolete() && other.willNotBeInstalled()) {
       log.warn("Ignoring obsolete dependency " + dependency.filename + " of " + file.filename);
       continue;
     }
     if (dependency.overrides) {
       if (other.willNotBeInstalled()) continue;
     } else if (other.willBeUpToDate()) continue;
     if (!map.add(other, file)) continue;
     // overriding dependencies are not recursive
     if (!overriding) addDependencies(other, map, overriding);
   }
 }