Beispiel #1
0
func (p *PackageDeprecated) LoadImports(dir string) bool {
	tmp_src_dir := filepath.Join(p.tmpdir, p.name, "src")
	specs, err := NewSpecs(filepath.Join(tmp_src_dir, p.name))
	if err != nil {
		p.logger.Fatal("Failed to load specs", err)
	}
	if specs == nil {
		p.logger.Debug(" * No dependencies found")
		p.Specs = NewBlankSpecs(p.Source)
		return true
	} else {
		p.Specs = specs
	}

	p.deps = map[string]*PackageDeprecated{}

	p.logger.Info(" * Loading dependencies for", p.name)
	for name, spec := range p.Specs.List {
		var dep *PackageDeprecated
		found, version, source := p.gvm.FindPackageInCache(name, spec)
		if found == true {
			dep = NewPackageDeprecated(p.gvm, name, version, filepath.Join(p.gvm.PkgsetRoot(), "pkg.gvm", name, version.String()), source, p.tmpdir, p.logger)
		} else if p.BuildOptsDeprecated.Install == true {
			found, version, source := p.gvm.FindPackageInSources(name, spec)
			if found == true {
				dep = NewPackageDeprecated(p.gvm, name, version, filepath.Join(p.gvm.PkgsetRoot(), "pkg.gvm", name), source, p.tmpdir, p.logger)
				p.logger.Trace(dep)
				dep.Install(p.BuildOptsDeprecated)
				dep.root = filepath.Join(p.gvm.PkgsetRoot(), "pkg.gvm", name, version.String())
			}
		} else {
			p.logger.Fatal("ERROR: Package", name, spec, "not found locally and install=false")
		}

		if dep == nil {
			p.logger.Fatal("ERROR: Couldn't find " + name + " " + spec + " in any sources")
		}
		p.logger.Info("    -", dep.name, dep.version, "(Spec:", spec+")")
		p.Specs.List[dep.name] = dep.version.String()
		p.LoadImport(dep, dir)
	}
	return true
}
Beispiel #2
0
func (app *App) list() {
	app.Message("\ngpkg package list", app.Gvm.String(), "\n")
	pkgs := app.PackageList()
	for _, pkg := range pkgs {
		output := pkg + " ("
		versions := app.VersionList(pkg)
		for n, version := range versions {
			output += version.String()
			if n < len(versions)-1 {
				output += ", "
			}
		}
		output += ")"
		app.Info(output)
	}
	app.Message("\ngoinstall package list", app.Gvm.String(), "\n")
	pkgs = app.GoinstallList()
	for _, pkg := range pkgs {
		app.Info(pkg)
	}
	app.Info()
}