Esempio n. 1
0
func depBundleForPkg(pkg *gx.Package) (string, error) {
	obj, err := pm.Shell().NewObject("unixfs-dir")
	if err != nil {
		Fatal(err)
	}

	for _, dep := range pkg.Dependencies {
		Log("processing dep: ", dep.Name)
		nobj, err := pm.Shell().PatchLink(obj, dep.Name+"-"+dep.Hash, dep.Hash, false)
		if err != nil {
			return "", err
		}

		var cpkg gx.Package
		err = gx.LoadPackage(&cpkg, pkg.Language, dep.Hash)
		if err != nil {
			return "", err
		}

		child, err := depBundleForPkg(&cpkg)
		if err != nil {
			return "", err
		}

		nobj, err = pm.Shell().PatchLink(nobj, dep.Name+"-"+dep.Hash+"-deps", child, false)
		if err != nil {
			return "", err
		}

		obj = nobj
	}

	return obj, nil
}
Esempio n. 2
0
func postImportHook(pkg *Package, npkgHash string) error {
	var npkg Package
	err := gx.LoadPackage(&npkg, "go", npkgHash)
	if err != nil {
		return err
	}

	if npkg.Gx.DvcsImport != "" {
		q := fmt.Sprintf("update imports of %s to the newly imported package?", npkg.Gx.DvcsImport)
		if yesNoPrompt(q, false) {
			nimp := fmt.Sprintf("gx/ipfs/%s/%s", npkgHash, npkg.Name)
			err := doUpdate(cwd, npkg.Gx.DvcsImport, nimp)
			if err != nil {
				return err
			}
		}
	}

	return nil
}
Esempio n. 3
0
			for k, _ := range depmap {
				deps = append(deps, k)
			}
		} else {
			for _, d := range pkg.Dependencies {
				deps = append(deps, d.Hash)
			}
		}

		sort.Strings(deps)

		w := tabwriter.NewWriter(os.Stdout, 12, 4, 1, ' ', 0)
		for _, d := range deps {
			if !quiet {
				var dpkg gx.Package
				err := gx.LoadPackage(&dpkg, pkg.Language, d)
				if err != nil {
					Fatal(err)
				}

				fmt.Fprintf(w, "%s\t%s\t%s\n", dpkg.Name, d, dpkg.Version)
			} else {
				Log(d)
			}
		}
		w.Flush()
	},
}

var depBundleCommand = cli.Command{
	Name:  "bundle",