コード例 #1
0
ファイル: main.go プロジェクト: paultag/descend
func main() {
	conf := descend.Descend{
		Host: "localhost",
		Port: 443,
	}
	flags, err := config.LoadFlags("descend", &conf)
	if err != nil {
		panic(err)
	}
	flags.Parse(os.Args[1:])
	Missing(flags, conf.CaCert, conf.Cert, conf.Key)

	client, err := descend.NewClient(conf.CaCert, conf.Cert, conf.Key)
	if err != nil {
		panic(err)
	}

	for _, changesPath := range flags.Args() {
		changes, err := control.ParseChangesFile(changesPath)
		if err != nil {
			panic(err)
		}

		fmt.Printf("Pushing %s\n", changesPath)
		err = descend.DoPutChanges(
			client, changes,
			fmt.Sprintf("%s:%d", conf.Host, conf.Port),
			conf.Archive,
		)
		if err != nil {
			panic(err)
		}
	}
}
コード例 #2
0
ファイル: utils.go プロジェクト: paultag/minion
func LogChangesFromChanges(logPath, changesPath, arch string) (string, error) {
	changes, err := control.ParseChangesFile(changesPath)
	if err != nil {
		return "", nil
	}

	return FakeChanges(
		"Fri, 31 Jul 2015 12:53:50 -0400",
		changes.Source,
		strings.Join(changes.Binaries, " "),
		arch,
		changes.Version.String(),
		changes.Distribution,
		changes.Urgency,
		[]string{logPath},
	)
}
コード例 #3
0
ファイル: minion.go プロジェクト: paultag/minion
func UploadChanges(conf MinionConfig, job Build, changesPath string) error {
	client, err := descend.NewClient(conf.CaCert, conf.Cert, conf.Key)
	if err != nil {
		return err
	}

	changes, err := control.ParseChangesFile(changesPath)
	if err != nil {
		return err
	}

	err = descend.DoPutChanges(
		client, changes,
		fmt.Sprintf("%s:%d", job.Upload.Host, job.Upload.Port),
		job.Upload.Archive,
	)
	return err
}
コード例 #4
0
ファイル: enqueued.go プロジェクト: paultag/enqueued
func Process(changesPath string) {
	repoRoot := path.Clean(path.Join(path.Dir(changesPath), ".."))
	pwd, err := os.Getwd()
	if err != nil {
		log.Printf("%s\n", err)
		return
	}
	gnuPGHome := path.Join(pwd, "..", "private", repoRoot, ".gnupg")
	repo := reprepro.NewRepo(
		repoRoot,
		"--component=main",
		fmt.Sprintf("--gnupghome=%s", gnuPGHome),
	)

	changes, err := control.ParseChangesFile(changesPath)
	if err != nil {
		log.Printf("Error: %s\n", err)
	}

	err = repo.Include(changes.Distribution, changesPath)
	if err != nil {
		go Mail([]string{conf.Administrator}, "rejected", &Upload{
			Changes: *changes,
			Repo:    *repo,
			Reason:  err.Error(),
		})

		log.Printf("Error: %s\n", err)
		changes.Remove()
		log.Printf("Removed %s and associated files\n", changesPath)
		return
	}

	log.Printf("Included %s into %s", changes.Source, repo.Basedir)
	go Mail([]string{conf.Administrator}, "accepted", &Upload{
		Changes: *changes,
		Repo:    *repo,
	})
	changes.Remove()
}
コード例 #5
0
ファイル: log.go プロジェクト: paultag/go-reprepro
func (repo Repo) ParseLogEntry(params []string) (*LogEntry, error) {
	if len(params) != 6 {
		return nil, fmt.Errorf("Unknown input string format")
	}

	version, err := version.Parse(params[3])
	if err != nil {
		return nil, err
	}

	changes, err := control.ParseChangesFile(repo.Basedir + "/" + params[5])
	if err != nil {
		return nil, err
	}

	return &LogEntry{
		Action:  params[0],
		Suite:   params[1],
		Source:  params[2],
		Version: version,
		Changes: *changes,
	}, nil
}
コード例 #6
0
ファイル: main.go プロジェクト: paultag/nmr
func BuildPackage(dscFile, arch, suite, repoRoot string, verbose bool) (bool, error) {
	// done := fancytext.FormatSpinner(fmt.Sprintf("%%s  -  building %s", dscFile))
	// defer done()

	incomingLocation, err := GetIncoming(repoRoot, suite)
	if err != nil {
		return false, err
	}

	dsc, err := control.ParseDscFile(dscFile)
	if err != nil {
		return false, err
	}

	source := dsc.Source
	version := dsc.Version

	cmd, err := SbuildCommand(suite, suite, arch, dscFile, repoRoot, verbose)
	if err != nil {
		return false, err
	}

	err = cmd.Run()
	ftbfs := err != nil

	changesFile := helpers.Filename(source, version, arch, "changes")
	logPath := helpers.Filename(source, version, arch, "build")

	if ftbfs {
		return true, nil

		// fmt.Printf(" FTBFS!\n")
		// return
		// changes, err := helpers.LogChangesFromDsc(logPath, dscFile, suite, arch)
		// if err != nil {
		// 	panic(err)
		// }
		// fd, err := os.Create(changesFile)
		// if err != nil {
		// 	panic(err)
		// }
		// defer fd.Close()
		// _, err = fd.Write([]byte(changes))
		// if err != nil {
		// 	panic(err)
		// }
	} else {
		helpers.AppendLogToChanges(logPath, changesFile, arch)
	}

	if IsArchAllArch(repoRoot, arch) && dsc.HasArchAll() {
		archAllLogPath := helpers.Filename(source, version, "all", "build")
		Copy(logPath, archAllLogPath)
		helpers.AppendLogToChanges(archAllLogPath, changesFile, "all")
	}

	changes, err := control.ParseChangesFile(changesFile)
	if err != nil {
		return ftbfs, err
	}

	err = changes.Copy(incomingLocation)
	if err != nil {
		return ftbfs, err
	}

	return ftbfs, nil
}