예제 #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)
}