Пример #1
0
func printCfg(targetName string, cfg syscfg.Cfg) {
	if errText := cfg.ErrorText(); errText != "" {
		util.StatusMessage(util.VERBOSITY_DEFAULT, "!!! %s\n\n", errText)
	}

	util.StatusMessage(util.VERBOSITY_DEFAULT, "Syscfg for %s:\n", targetName)
	pkgNameEntryMap := syscfg.EntriesByPkg(cfg)

	pkgNames := make([]string, 0, len(pkgNameEntryMap))
	for pkgName, _ := range pkgNameEntryMap {
		pkgNames = append(pkgNames, pkgName)
	}
	sort.Strings(pkgNames)

	for i, pkgName := range pkgNames {
		if i > 0 {
			util.StatusMessage(util.VERBOSITY_DEFAULT, "\n")
		}
		printPkgCfg(pkgName, cfg, pkgNameEntryMap[pkgName])
	}
}
Пример #2
0
// Resolves all of a build package's dependencies and API requirements.
func (bpkg *BuildPackage) resolveDeps(
	cfg syscfg.Cfg, apiMap map[string]*BuildPackage) error {

	features := cfg.FeaturesForLpkg(bpkg.LocalPackage)

	// Match each required API with the package which implements it.
	reqApis := newtutil.GetStringSliceFeatures(bpkg.PkgV, features,
		"pkg.req_apis")
	for _, reqApi := range reqApis {
		if err := bpkg.satisfyReqApi(reqApi, apiMap[reqApi]); err != nil {
			return err
		}
	}

	proj := project.GetProject()
	newDeps := newtutil.GetStringSliceFeatures(bpkg.PkgV, features,
		"pkg.deps")
	for _, newDepStr := range newDeps {
		newDep, err := pkg.NewDependency(bpkg.Repo(), newDepStr)
		if err != nil {
			return err
		}

		_, ok := proj.ResolveDependency(newDep).(*pkg.LocalPackage)
		if !ok {
			return util.NewNewtError("Could not resolve package dependency " +
				newDep.String())
		}

		if !bpkg.HasDep(newDep) {
			bpkg.AddDep(newDep)
		}
	}

	return nil
}