Exemplo n.º 1
0
func addReverseBuildDeps(sourcesPath string, binaries map[string]bool, rebuild map[string][]version.Version) error {
	log.Printf("Loading sources index %q\n", sourcesPath)
	catFile := exec.Command("/usr/lib/apt/apt-helper",
		"cat-file",
		sourcesPath)
	var s *bufio.Reader
	if lines, err := catFile.Output(); err == nil {
		s = bufio.NewReader(strings.NewReader(string(lines)))
	} else {
		// Fallback for older versions of apt-get. See
		// <*****@*****.**> for context.
		o, err := os.Open(sourcesPath)
		if err != nil {
			return err
		}
		defer o.Close()
		s = bufio.NewReader(o)
	}
	idx, err := control.ParseSourceIndex(s)
	if err != nil && err != io.EOF {
		return err
	}

	for _, src := range idx {
		if dependsOn(src, binaries) {
			rebuild[src.Package] = append(rebuild[src.Package], src.Version)
		}
	}

	return nil
}
Exemplo n.º 2
0
func addReverseBuildDeps(sourcesPath string, binaries map[string]bool, rebuild map[string][]version.Version) error {
	log.Printf("Loading sources index %q\n", sourcesPath)
	s, err := os.Open(sourcesPath)
	if err != nil {
		return err
	}
	defer s.Close()
	idx, err := control.ParseSourceIndex(bufio.NewReader(s))
	if err != nil && err != io.EOF {
		return err
	}

	for _, src := range idx {
		if dependsOn(src, binaries) {
			rebuild[src.Package] = append(rebuild[src.Package], src.Version)
		}
	}

	return nil
}
Exemplo n.º 3
0
func TestSourceIndexParse(t *testing.T) {
	// Test Source Index {{{
	reader := bufio.NewReader(strings.NewReader(`Package: fbasics
Binary: r-cran-fbasics
Version: 3011.87-2
Maintainer: Dirk Eddelbuettel <*****@*****.**>
Build-Depends: debhelper (>= 7.0.0), r-base-dev (>= 3.2.0), cdbs, r-cran-mass, r-cran-timedate, r-cran-timeseries (>= 2100.84), r-cran-stabledist, xvfb, xauth, xfonts-base, r-cran-gss
Architecture: any
Standards-Version: 3.9.6
Format: 1.0
Files:
 8bb6eda1e01be26c5446d21c64420e7f 1818 fbasics_3011.87-2.dsc
 f9f6e7f84bff1ce90cdc5890b9a3f6b5 932125 fbasics_3011.87.orig.tar.gz
 afc2e90feddb30baf96babfc767dff60 3818 fbasics_3011.87-2.diff.gz
Checksums-Sha1:
 45137d257a8bf2ed01b1809add5641bea7353072 1818 fbasics_3011.87-2.dsc
 cb0d17a055b7eaea72b14938e2948e603011b548 932125 fbasics_3011.87.orig.tar.gz
 03c215003ddca5a9651d315902d2d3ee67e8c37a 3818 fbasics_3011.87-2.diff.gz
Checksums-Sha256:
 0a4f8cc793903e366a84379a651bf1a4542d50823b4bd4e038efcdb85a1af95e 1818 fbasics_3011.87-2.dsc
 f0a79bb3931cd145677c947d8cd87cf60869f604933e685e74225bb01ad992f4 932125 fbasics_3011.87.orig.tar.gz
 e087596fc0ac2bca6cf9ad531afc4329e75b2d7b26f0a0334be8dcb29d94f4ee 3818 fbasics_3011.87-2.diff.gz
Homepage: http://www.Rmetrics.org
Package-List: 
 r-cran-fbasics deb gnu-r optional arch=any
Directory: pool/main/f/fbasics
Priority: source
Section: gnu-r

Package: fbautostart
Binary: fbautostart
Version: 2.718281828-1
Maintainer: Paul Tagliamonte <*****@*****.**>
Build-Depends: debhelper (>= 9)
Architecture: any
Standards-Version: 3.9.3
Format: 3.0 (quilt)
Files:
 9d610c30f96623cff07bd880e5cca12f 1899 fbautostart_2.718281828-1.dsc
 06495f9b23b1c9b1bf35c2346cb48f63 92748 fbautostart_2.718281828.orig.tar.gz
 3b0e6dd201d5036f6d1b80f0ac4e1e7d 2396 fbautostart_2.718281828-1.debian.tar.gz
Vcs-Browser: http://git.debian.org/?p=collab-maint/fbautostart.git
Vcs-Git: git://git.debian.org/collab-maint/fbautostart.git
Checksums-Sha1:
 3e0dcbe5549f47f35eb7f8960c0ada33bbc3f48b 1899 fbautostart_2.718281828-1.dsc
 bc36310c15edc9acf48f0a1daf548bcc6f861372 92748 fbautostart_2.718281828.orig.tar.gz
 af4f1950dd8ed5bb7bd8952c8c00ffdd42eadb46 2396 fbautostart_2.718281828-1.debian.tar.gz
Checksums-Sha256:
 0adda8e19e217dd2fa69d0842dcef0fa250bd428b1e43e78723d76909e5f51cc 1899 fbautostart_2.718281828-1.dsc
 bb2fdfd4a38505905222ee02d8236a594bdf6eaefca23462294cacda631745c1 92748 fbautostart_2.718281828.orig.tar.gz
 49f402ff3a72653e63542037be9f4da56e318e412d26d4154f9336fb88df3519 2396 fbautostart_2.718281828-1.debian.tar.gz
Homepage: https://launchpad.net/fbautostart
Package-List: 
 fbautostart deb misc optional
Directory: pool/main/f/fbautostart
Priority: source
Section: misc
`))
	// }}}
	sources, err := control.ParseSourceIndex(reader)
	isok(t, err)
	assert(t, len(sources) == 2)

	fbautostart := sources[1]
	assert(t, fbautostart.Maintainer == "Paul Tagliamonte <*****@*****.**>")
	assert(t, fbautostart.VcsGit == "git://git.debian.org/collab-maint/fbautostart.git")
}