UnpackedJars targets need to be re-unpacked if any of its configuration changes or any of
    the jars they import have changed.
177885
def compute_fingerprint(self, target):
    
    if isinstance(target, UnpackedJars):
      hasher = sha1()
      for cache_key in sorted(jar.cache_key() for jar in target.all_imported_jar_deps):
        hasher.update(cache_key.encode('utf-8'))
      hasher.update(target.payload.fingerprint().encode('utf-8'))
      return hasher.hexdigest() if PY3 else hasher.hexdigest().decode('utf-8')
    return None
958996
private static InMemoryJarfile modifyCatalogClasses(Catalog catalog, InMemoryJarfile jarfile, String deletePatterns,
            InMemoryJarfile newJarfile, boolean isXDCR, HSQLInterface hsql)
                    throws IOException, ClassNotFoundException, VoltCompilerException
    {
        // modify the old jar in place based on the @UpdateClasses inputs, and then
        // recompile it if necessary
        boolean deletedClasses = false;
        if (deletePatterns != null) {
            String[] patterns = deletePatterns.split(",");
            ClassMatcher matcher = new ClassMatcher();
            // Need to concatenate all the classnames together for ClassMatcher
            String currentClasses = "";
            for (String classname : jarfile.getLoader().getClassNames()) {
                currentClasses = currentClasses.concat(classname + "\n");
            }
            matcher.m_classList = currentClasses;
            for (String pattern : patterns) {
                ClassNameMatchStatus status = matcher.addPattern(pattern.trim());
                if (status == ClassNameMatchStatus.MATCH_FOUND) {
                    deletedClasses = true;
                }
            }

            for (String classname : matcher.getMatchedClassList()) {
                jarfile.removeClassFromJar(classname);
            }
        }
        boolean foundClasses = false;
        if (newJarfile != null) {
            for (Entry<String, byte[]> e : newJarfile.entrySet()) {
                String filename = e.getKey();
                // Ignore root level, non-class file names
                boolean isRootFile = Paths.get(filename).getNameCount() == 1;
                if (isRootFile && !filename.endsWith(".class")) {
                    continue;
                }
                foundClasses = true;
                jarfile.put(e.getKey(), e.getValue());
            }
        }
        if (!deletedClasses && !foundClasses) {
            return null;
        }

        compilerLog.info("Updating java classes available to stored procedures");
        VoltCompiler compiler = new VoltCompiler(isXDCR);
        try {
            compiler.compileInMemoryJarfileForUpdateClasses(jarfile, catalog, hsql);
        } catch (ClassNotFoundException | VoltCompilerException | IOException ex) {
            throw ex;
        }

        return jarfile;
    }
499825
public void init() {
        isDirty = false;

        // If we haven't looked at anything from the cache or the filesystem, this is bootstrap time
        boolean firstInit = cachedFeatures.isEmpty();

        autoFeatures = new ArrayList<SubsystemFeatureDefinitionImpl>();
        knownFeatures = new HashMap<File, SubsystemFeatureDefinitionImpl>();
        knownBadFeatures = new HashMap<File, BadFeature>();

        // Read feature cache, this will only toss files that no longer exist
        // stale will be marked true if feature definitions were discarded.
        readCache(firstInit);

        // Now we need to go find / update the cache with anything new/interesting/different.
        // This will happen at most twice...
        readFeatureManifests();

        // If something was out of sync with the filesystem and this is the first pass,
        // reset the installed features list so we re-figure out what should be installed.
        if (isDirty && firstInit) {
            // If stale, reset to empty list as we'll be rebuilding....
            installedFeatures = Collections.emptySet();
            configuredFeatures = Collections.emptySet();
        }
    }
772310
def unpackage(package_):
    '''
    
    '''
    return salt.utils.msgpack.loads(package_, use_list=True,
                                    _msgpack_module=msgpack)
470281
private void checkConfiguration()
            throws MojoExecutionException
    {
        checkDependencyFilenameStrategy();

        if ( CollectionUtils.isEmpty( jnlpFiles ) )
        {
            throw new MojoExecutionException(
                    "Configuration error: At least one <jnlpFile> element must be specified" );
        }

        if ( jnlpFiles.size() == 1 && StringUtils.isEmpty( jnlpFiles.get( 0 ).getOutputFilename() ) )
        {
            getLog().debug( "Jnlp output file name not specified in single set of jnlpFiles. " +
                                    "Using default output file name: launch.jnlp." );
            jnlpFiles.get( 0 ).setOutputFilename( "launch.jnlp" );
        }

        // ---
        // check Jnlp files configuration
        // ---

        Set<String> filenames = new LinkedHashSet<>( jnlpFiles.size() );

        for ( JnlpFile jnlpFile : jnlpFiles )
        {
            if ( !filenames.add( jnlpFile.getOutputFilename() ) )
            {
                throw new MojoExecutionException( "Configuration error: Unique JNLP filenames must be provided. " +
                                                          "The following file name appears more than once [" +
                                                          jnlpFile.getOutputFilename() + "]." );
            }

            checkJnlpFileConfiguration( jnlpFile );
        }

        if ( CollectionUtils.isNotEmpty( commonJarResources ) )
        {

            // ---
            // --- checkCommonJarResources();
            // ---

            for ( JarResource jarResource : commonJarResources )
            {
                checkMandatoryJarResourceFields( jarResource );

                if ( jarResource.getMainClass() != null )
                {
                    throw new MojoExecutionException( "Configuration Error: A mainClass must not be specified " +
                                                              "on a JarResource in the commonJarResources collection." );
                }
            }

            // ---
            // check for duplicate jar resources
            // Checks that any jarResources defined in the jnlpFile elements are not also defined in
            // commonJarResources.
            // ---

            for ( JnlpFile jnlpFile : jnlpFiles )
            {
                for ( JarResource jarResource : jnlpFile.getJarResources() )
                {
                    if ( commonJarResources.contains( jarResource ) )
                    {
                        String message = "Configuration Error: The jar resource element for artifact " + jarResource +
                                " defined in common jar resources is duplicated in the jar " +
                                "resources configuration of the jnlp file identified by the template file " +
                                jnlpFile.getInputTemplate() + ".";

                        throw new MojoExecutionException( message );
                    }
                }
            }
        }
    }
1258448
protected void unpackXARToOutputDirectory(Artifact artifact, String[] includes, String[] excludes)
        throws MojoExecutionException
    {
        if (!this.outputBuildDirectory.exists()) {
            this.outputBuildDirectory.mkdirs();
        }

        File file = artifact.getFile();
        unpack(file, this.outputBuildDirectory, "XAR Plugin", false, includes, excludes);
    }
909077
def _determine_unfiltered_package_names(self):
        
        # This plugin only processes packages, if the line in the packages
        # configuration contains a PEP440 specifier it will be processed by the
        # blacklist release filter.  So we need to remove any packages that
        # are not applicable for this plugin.
        unfiltered_packages = set()
        try:
            lines = self.configuration["whitelist"]["packages"]
            package_lines = lines.split("\n")
        except KeyError:
            package_lines = []
        for package_line in package_lines:
            package_line = package_line.strip()
            if not package_line or package_line.startswith("#"):
                continue
            unfiltered_packages.add(package_line)
        return list(unfiltered_packages)
116163
private void searchJars(Container moduleContainer, List<String> classList) {
        Entry webinfLibEntry = moduleContainer.getEntry("WEB-INF/lib");

        //No need to look for jars if there is no WEB-INF/lib
        if (webinfLibEntry == null)
            return;

        try {
            Container c = webinfLibEntry.adapt(Container.class);
            Iterator<Entry> ie = c.iterator();
            while (ie.hasNext()) {
                Entry current = ie.next();
                if (current.getName().endsWith(".jar")) {
                    //Again, convert to a container
                    try {
                        Container jarContainer = current.adapt(Container.class);
                        if (jarContainer != null) {
                            addConfigFileBeans(jarContainer.getEntry("META-INF/faces-config.xml"), classList);

                            //Spec says we have to look for any file in META-INF that ends with .faces-config.xml
                            Entry metainf = jarContainer.getEntry("META-INF");
                            if (metainf == null)
                                return;

                            Container metainfContainer = metainf.adapt(Container.class);
                            Iterator<Entry> metaInfIterator = metainfContainer.iterator();

                            while (metaInfIterator.hasNext()) {
                                Entry currentEntry = metaInfIterator.next();
                                if (currentEntry.getName().endsWith(".faces-config.xml")) {
                                    addConfigFileBeans(currentEntry, classList);
                                }
                            }

                        }

                    } catch (UnableToAdaptException e) {
                        if (log.isLoggable(Level.FINE)) {
                            log.logp(Level.FINE, CLASS_NAME, "searchJars", "unable to adapt jar or META-INF dir in jar named " + current.getName() + " to a container", e);
                        }
                    }
                }
            }
        } catch (UnableToAdaptException e) {
            if (log.isLoggable(Level.FINE)) {
                log.logp(Level.FINE, CLASS_NAME, "searchJars", "unable to adapt WEB-INF/lib to a container", e);
            }
        }
    }
262587
public function unpackPackage()
    {
        // it is zipped, we must unzip it
        if($this->getPackage()->getUnzip()) {
            $this->extractZip($this->getDownloadFullPath(), $this->getInstallDir());
        } else {
            $this->recursiveCopy($this->getDownloadFullPath(), $this->getInstallDir());                        
        }        
    }
1055939
def clean_cache():
    
    import importlib
    try:  # Python ver < 3.3
        vermod = importlib.import_module("versioneer")
        globals()["versioneer"] = vermod
    except ImportError:
        importlib.invalidate_caches()
1143266
private void resetPackageList() {
		final Set<PackageDoc> set = new TreeSet<>();
        for (final PackageDoc pack : this.root.specifiedPackages()) {
            set.add(pack);
        }
        for (final ClassDoc clazz : this.root.specifiedClasses()) {
            set.add(clazz.containingPackage());
        }
        this.packages = Utils.toArray(this.packages, set);
	}
175302
public void taintPackagesDependingOnChangedPackages(Set<String> pkgs, Set<String> recentlyCompiled) {
        for (Package pkg : prev.packages().values()) {
            for (String dep : pkg.dependencies()) {
                if (pkgs.contains(dep) && !recentlyCompiled.contains(pkg.name())) {
                    taintPackage(pkg.name(), " its depending on "+dep);
                }
            }
        }
    }
937503
protected void signOrRenameJars()
            throws MojoExecutionException
    {

        if ( sign != null )
        {
            try
            {
                ClassLoader loader = getCompileClassLoader();
                sign.init( getWorkDirectory(), getLog().isDebugEnabled(), signTool, securityDispatcher, loader );
            }
            catch ( MalformedURLException e )
            {
                throw new MojoExecutionException( "Could not create classloader", e );
            }

            if ( unsignAlreadySignedJars )
            {
                removeExistingSignatures( getLibDirectory() );
            }

            if ( isPack200() )
            {

                //TODO tchemit  use a temporary directory to pack-unpack

                // http://java.sun.com/j2se/1.5.0/docs/guide/deployment/deployment-guide/pack200.html
                // we need to pack then unpack the files before signing them
                unpackJars( getLibDirectory() );

                // As out current Pack200 ant tasks don't give us the ability to use a temporary area for
                // creating those temporary packing, we have to delete the temporary files.
                ioUtil.deleteFiles( getLibDirectory(), unprocessedPack200FileFilter );
                // specs says that one should do it twice when there are unsigned jars??
                // Pack200.unpackJars( applicationDirectory, updatedPack200FileFilter );
            }

            if ( MapUtils.isNotEmpty( updateManifestEntries ) )
            {
                updateManifestEntries( getLibDirectory() );
            }

            int signedJars = signJars( getLibDirectory() );

            if ( signedJars != getModifiedJnlpArtifacts().size() )
            {
                throw new IllegalStateException(
                        "The number of signed artifacts (" + signedJars + ") differ from the number of modified " +
                                "artifacts (" + getModifiedJnlpArtifacts().size() + "). Implementation error" );
            }

        }
        else
        {
            makeUnprocessedFilesFinal( getLibDirectory() );
        }

        if ( isPack200() )
        {
            verboseLog( "-- Pack jars" );
            pack200Jars( getLibDirectory(), processedJarFileFilter );
        }
    }
554096
def imported_targets(self):
    
    libs = []
    for spec in self.imported_target_specs(payload=self.payload):
      resolved_target = self._build_graph.get_target_from_spec(spec,
                                                               relative_to=self.address.spec_path)
      if not resolved_target:
        raise self.UnresolvedImportError(
          'Could not find target {spec} referenced from {relative_to}'
          .format(spec=spec, relative_to=self.address.spec))
      try:
        libs.append(self.expected_target_constraint.validate_satisfied_by(resolved_target))
      except TypeConstraintError as e:
        raise self.WrongTargetTypeError(
          'Wrong target type {spec} referenced from remote sources target {relative_to}: {err}'
          .format(spec=spec, relative_to=self.address.spec, err=str(e)),
          e)
    return libs
482662
private void readRequiredJarFiles(final DataInput in) throws IOException {

		// Do jar files follow;
		final int numJars = in.readInt();

		if (numJars > 0) {

			for (int i = 0; i < numJars; i++) {

				final Path p = new Path();
				p.read(in);
				this.userJars.add(p);

				// Read the size of the jar file
				final long sizeOfJar = in.readLong();

				// Add the jar to the library manager
				LibraryCacheManager.addLibrary(this.jobID, p, sizeOfJar, in);
			}

		}

		// Register this job with the library cache manager
		LibraryCacheManager.register(this.jobID, this.userJars.toArray(new Path[0]));
	}
972807
public void taintPackagesDependingOnChangedClasspathPackages() throws IOException {

        // 1. Collect fully qualified names of all interesting classpath dependencies
        Set<String> fqDependencies = new HashSet<>();
        for (Package pkg : prev.packages().values()) {
            // Check if this package was compiled. If it's presence is recorded
            // because it was on the class path and we needed to save it's
            // public api, it's not a candidate for tainting.
            if (pkg.sources().isEmpty())
                continue;

            pkg.typeClasspathDependencies().values().forEach(fqDependencies::addAll);
        }

        // 2. Extract the public APIs from the on disk .class files
        // (Reason for doing step 1 in a separate phase is to avoid extracting
        // public APIs of the same class twice.)
        PubApiExtractor pubApiExtractor = new PubApiExtractor(options);
        Map<String, PubApi> onDiskPubApi = new HashMap<>();
        for (String cpDep : fqDependencies) {
            onDiskPubApi.put(cpDep, pubApiExtractor.getPubApi(cpDep));
        }
        pubApiExtractor.close();

        // 3. Compare them with the public APIs as of last compilation (loaded from javac_state)
        nextPkg:
        for (Package pkg : prev.packages().values()) {
            // Check if this package was compiled. If it's presence is recorded
            // because it was on the class path and we needed to save it's
            // public api, it's not a candidate for tainting.
            if (pkg.sources().isEmpty())
                continue;

            Set<String> cpDepsOfThisPkg = new HashSet<>();
            for (Set<String> cpDeps : pkg.typeClasspathDependencies().values())
                cpDepsOfThisPkg.addAll(cpDeps);

            for (String fqDep : cpDepsOfThisPkg) {

                String depPkg = ":" + fqDep.substring(0, fqDep.lastIndexOf('.'));
                PubApi prevPkgApi = prev.packages().get(depPkg).getPubApi();

                // This PubApi directly lists the members of the class,
                // i.e. [ MEMBER1, MEMBER2, ... ]
                PubApi prevDepApi = prevPkgApi.types.get(fqDep).pubApi;

                // In order to dive *into* the class, we need to add
                // .types.get(fqDep).pubApi below.
                PubApi currentDepApi = onDiskPubApi.get(fqDep).types.get(fqDep).pubApi;

                if (!currentDepApi.isBackwardCompatibleWith(prevDepApi)) {
                    List<String> apiDiff = currentDepApi.diff(prevDepApi);
                    taintPackage(pkg.name(), "depends on classpath "
                                + "package which has an updated package api: "
                                + String.join("\n", apiDiff));
                    //Log.debug("========================================");
                    //Log.debug("------ PREV API ------------------------");
                    //prevDepApi.asListOfStrings().forEach(Log::debug);
                    //Log.debug("------ CURRENT API ---------------------");
                    //currentDepApi.asListOfStrings().forEach(Log::debug);
                    //Log.debug("========================================");
                    continue nextPkg;
                }
            }
        }
    }
228910
public static synchronized void reloadExistingConfigurations() {
		if (LOG.isDebugEnabled()) {
			LOG.debug("Reloading " + REGISTRY.keySet().size()
					+ " existing configurations");
		}
		for (Configuration conf : REGISTRY.keySet()) {
			conf.reloadConfiguration();
		}
	}