コード例 #1
0
ファイル: interface.go プロジェクト: paultag/nmr
func ComputeBuildStatus(
	repo reprepro.Repo,
	index resolver.Candidates,
	packages []reprepro.BuildNeedingPackage,
) []BuildStatus {
	ret := []BuildStatus{}

	for _, pkg := range packages {
		dsc, err := control.ParseDscFile(repo.Basedir + "/" + pkg.Location)
		if err != nil {
			continue
		}

		arch, err := dependency.ParseArch(pkg.Arch)
		if err != nil {
			/// XXX: ERROR OUT
			continue
		}

		buildable, why := index.ExplainSatisfiesBuildDepends(*arch, dsc.BuildDepends)

		ret = append(ret, BuildStatus{
			Package:   pkg,
			Buildable: buildable,
			Why:       why,
		})
	}

	return ret
}
コード例 #2
0
ファイル: fetch.go プロジェクト: tianon/dtodo
func fetchCandidates(can *resolver.Candidates, url string) error {
	for _, comp := range compressions {
		resp, err := http.Get(url + comp)
		if err != nil {
			return err
		}
		if resp.StatusCode != http.StatusOK {
			resp.Body.Close()
			continue
		}
		defer resp.Body.Close()
		switch comp {
		case ".xz":
			reader, err := xz.NewReader(resp.Body, 0)
			if err != nil {
				return err
			}
			return can.AppendBinaryIndexReader(reader)
		case ".bz2":
			return can.AppendBinaryIndexReader(bzip2.NewReader(resp.Body))
		case ".gz":
			reader, err := gzip.NewReader(resp.Body)
			if err != nil {
				return err
			}
			defer reader.Close()
			return can.AppendBinaryIndexReader(reader)
		}
		return can.AppendBinaryIndexReader(resp.Body)
	}
	return fmt.Errorf("unable to find %s (tried all of %q)", url, compressions)
}