Ejemplo n.º 1
0
func Backfill(config minion.MinionConfig, proxy minion.CoordinatorProxy, args []string) {

	suite := "unstable"
	/* Do a topsort of the .dsc files that need build, I guess */

	for _, archive := range args {
		needs, err := proxy.GetBuildNeeding(archive, suite, "any", "")
		if err != nil {
			log.Fatalf("%s", err)
		}
		for _, need := range needs {
			log.Printf("%s [%s] - %s", archive, need.Arch, need.Location)
			archiveRoot := fmt.Sprintf("http://%s/%s", config.Host, archive)
			dsc := fmt.Sprintf("%s/%s", archiveRoot, need.Location)
			build := minion.NewBuild(
				config.Host,
				archive,
				suite,
				"main",
				need.Arch,
				dsc,
			)
			proxy.QueueBuild(build)
		}
	}
}
Ejemplo n.º 2
0
func BinNMU(config minion.MinionConfig, proxy minion.CoordinatorProxy, args []string) {
	ensure := func(x *string, arg string) {
		if x != nil && *x != "" {
			return
		}
		log.Fatalf("Missing argument %s", arg)
	}

	flags := flag.FlagSet{}

	dsc := flags.String("dsc", "", "DSC to binNMU")
	archive := flags.String("archive", "", "Archive to binNMU into")
	arch := flags.String("arch", "", "Archive to binNMU into")
	version := flags.String("version", "", "Version to use for the binNMU")
	changes := flags.String("changes", "", "Changes to use for the binNMU")
	suite := flags.String("suite", "", "suite to use for the binNMU")

	flags.Parse(args)

	for _, s := range []struct {
		Name  string
		Value *string
	}{
		{"dsc", dsc},
		{"arch", arch},
		{"archive", archive},
		{"version", version},
		{"changes", changes},
		{"suite", suite},
	} {
		ensure(s.Value, s.Name)
	}

	build := minion.NewBuild(
		config.Host,
		*archive,
		*suite,
		"main",
		*arch,
		*dsc,
	)
	build.BinNMU = minion.BinNMU{
		Version:   *version,
		Changelog: *changes,
	}
	proxy.QueueBuild(build)
}
Ejemplo n.º 3
0
func Status(config minion.MinionConfig, proxy minion.CoordinatorProxy, args []string) {
	minions, err := proxy.Heartbeat()
	if err != nil {
		log.Fatalf("%s\n", err)
	}

	queueLengths, err := proxy.GetQueueLengths()
	if err != nil {
		log.Fatalf("%s\n", err)
	}

	for _, minion := range minions {
		fmt.Printf("%s - online\n", minion)
	}
	for name, length := range queueLengths {
		fmt.Printf("%s - %d pending job(s)\n", name, length)
	}
}
Ejemplo n.º 4
0
func repreproRun(config minion.MinionConfig, cmd *Command, args []string) {
	incoming := Incoming{}
	incoming.Parse(args)
	if incoming.Type != "add" {
		return
	}

	conn, err := service.DialFromKeys(
		fmt.Sprintf("%s:%d", config.Host, config.Port),
		config.Cert, config.Key, config.CaCert,
	)
	if err != nil {
		log.Fatalf("Error! %s\n", err)
	}
	proxy := minion.CoordinatorProxy{service.Client(conn)}
	log.Printf("Queueing build\n")

	archiveRoot := fmt.Sprintf("http://%s", path.Join(*fqdn, *archive))

	repo := reprepro.GetWorkingRepo()
	buildNeeding, err := repo.BuildNeeding(incoming.Suite, "any", &incoming.Package)
	if err != nil {
		log.Fatalf("Error! %s\n", err)
	}

	for _, build := range buildNeeding {
		dscPath := fmt.Sprintf("%s/%s", archiveRoot, build.Location)
		build := minion.NewBuild(
			*fqdn,
			*archive,
			incoming.Suite,
			incoming.Component,
			build.Arch,
			dscPath,
		)
		proxy.QueueBuild(build)
	}
	log.Printf("Queued\n")
}