Beispiel #1
0
func Example_genDevPackage() {
	ctrl := deb.NewControlDefault("testpkg", "me", "me@a", "Dummy package for doing nothing", "testpkg is package ", true)

	spara := ctrl.GetParasByField(deb.SourceFName, "testpkg")
	bpara := ctrl.GetParasByField(deb.PackageFName, "testpkg-dev")
	nctrl := &deb.Control{spara[0], bpara[0]}

	build := debgen.NewBuildParams()
	build.IsRmtemp = false
	build.Init()
	var err error
	mappedFiles, err := debgen.GlobForGoSources(".", []string{build.TmpDir, build.DestDir})
	if err != nil {
		log.Fatalf("Error building -dev: %v", err)
	}

	artifacts, err := deb.NewWriters(nctrl)
	if err != nil {
		log.Fatalf("Error building -dev: %v", err)
	}
	for _, artifact := range artifacts {
		dgen := debgen.NewDebGenerator(artifact, build)
		dgen.DataFiles = mappedFiles
		err = dgen.GenerateAllDefault()
		if err != nil {
			log.Fatalf("Error building -dev: %v", err)
		}
	}

	// Output:
	//
}
Beispiel #2
0
func Example_genBinaryPackage() {

	ctrl := deb.NewControlDefault("testpkg", "me", "<*****@*****.**>", "Dummy package for doing nothing", "testpkg is a dummy package", true)
	for _, pkg := range ctrl.BinaryParas() {
		pkg.Set(deb.VersionFName, "0.0.2")
	}
	build := debgen.NewBuildParams()
	build.Init()
	build.IsRmtemp = false
	artifacts, err := deb.NewWriters(ctrl)
	if err != nil {
		log.Fatalf("Error building binary: %v", err)
	}
	artifacts[deb.ArchAmd64].MappedFiles = map[string]string{"/usr/bin/a": "_out/a.amd64"}
	artifacts[deb.ArchI386].MappedFiles = map[string]string{"/usr/bin/a": "_out/a.i386"}
	artifacts[deb.ArchArmhf].MappedFiles = map[string]string{"/usr/bin/a": "_out/a.armhf"}

	prep() //prepare files for packaging using some other means.

	for arch, artifact := range artifacts {
		log.Printf("generating artifact '%s'/%v", arch, artifact)
		dgen := debgen.NewDebGenerator(artifact, build)
		err = dgen.GenerateAllDefault()
		if err != nil {
			log.Fatalf("Error building for '%s': %v", arch, err)
		}
	}

	// Output:
	//
}