[Pkg-ocaml-maint-commits] [SCM] pkglab packaging branch, master, updated. debian/1.4.2-1-2-g6bed820
Ralf Treinen
treinen at free.fr
Tue Jun 16 18:53:28 UTC 2009
The following commit has been merged in the master branch:
commit 395227d19e0df1af9feecfa5edc4ee67ca2c695a
Author: Ralf Treinen <treinen at free.fr>
Date: Mon Jun 15 21:14:24 2009 +0200
add edos-builddebcheck to the package
diff --git a/debian/changelog b/debian/changelog
index 72dc124..57464d5 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -7,9 +7,10 @@ pkglab (1.4.2-1) unstable; urgency=low
- Add symlinks for /usr/bin/edos-{deb,rpm}check.
- Replaces, Conflicts and Provides edos-{rpm,deb}check
- Add manpages for edos-{deb,rpm}check
+ - Add edos-builddebcheck
* Patch distcheck/common.ml to accept an -checkonly option
- -- Ralf Treinen <treinen at debian.org> Mon, 15 Jun 2009 20:37:38 +0200
+ -- Ralf Treinen <treinen at debian.org> Mon, 15 Jun 2009 21:06:05 +0200
pkglab (1.4.1-1) unstable; urgency=low
diff --git a/debian/contrib/add-sources.py b/debian/contrib/add-sources.py
new file mode 100755
index 0000000..03217a7
--- /dev/null
+++ b/debian/contrib/add-sources.py
@@ -0,0 +1,120 @@
+#!/usr/bin/python
+
+# Given as input a Packages and a Sources file, produces as output a new
+# Packages containing fake packages which are installable if and only if the
+# corresponding source package has satisfiable build dependencies.
+
+# Copyright (C) 2008 Stefano Zacchiroli <zack at debian.org>
+# This program is free software: you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free Software
+# Foundation, either version 3 of the License, or (at your option) any later
+# version.
+
+# $Id: add-sources.py 5957 2008-08-16 18:32:17Z zack $
+
+import string
+import sys
+
+from optparse import OptionParser
+from debian_bundle import deb822
+
+usage = 'Usage: cat Packages | add-sources [OPTION...] Sources ARCH > Packages.new'
+cli = OptionParser(usage=usage)
+cli.add_option('-p', '--prefix', dest='prefix', default='source---',
+ help='set the prefix for fake source packages to PREFIX (default: source---)',
+ metavar='PREFIX')
+(options, args) = cli.parse_args()
+if len(args) != 2:
+ cli.print_help()
+ sys.exit(2)
+sources_file = args[0]
+architecture = args[1]
+
+def pkg_of_src(src):
+ global architecture, options
+ pkg = deb822.Packages()
+ pkg['Package'] = options.prefix + src['Package']
+
+ def dep_for_me(dep):
+ for_me = None
+ if dep['arch'] is None:
+ for_me = True
+ elif dep['arch']:
+ (polarity, _) = dep['arch'][0]
+ if polarity: # list is inclusive
+ for_me = (True, architecture) in dep['arch']
+ else: # list is exclusive
+ for_me = not ((False, architecture) in dep['arch'])
+ else:
+ for_me = False
+ return for_me
+
+ def mk_bin_rels(fields, relations):
+ def strip_arch(dep):
+ dep['arch'] = None
+ return dep
+
+ def get_rels(fields, relations):
+ rels = []
+ for name in fields:
+ if relations.has_key(name):
+ rels.extend(relations[name])
+ return rels
+
+ src_rels = get_rels(fields, relations)
+ bin_rels = []
+ for or_deps in src_rels:
+ my_or_deps = map(strip_arch, filter(dep_for_me, or_deps))
+ if my_or_deps:
+ bin_rels.append(my_or_deps)
+
+ return bin_rels
+
+ def str_of_relations(rels):
+ # XXX this is cut and paste from python-debian's deb822.py, more
+ # precisely it matches the str() method of the PkgRelation class
+ # TODO to be removed as soon as python-debian 0.1.12 hits unstable
+ def pp_arch(arch_spec):
+ (excl, arch) = arch_spec
+ if excl:
+ return arch
+ else:
+ return '!' + arch
+ def pp_atomic_dep(dep):
+ s = dep['name']
+ if dep.has_key('version') and dep['version'] is not None:
+ s += ' (%s %s)' % dep['version']
+ if dep.has_key('arch') and dep['arch'] is not None:
+ s += ' [%s]' % string.join(map(pp_arch, dep['arch']))
+ return s
+ pp_or_dep = lambda deps: string.join(map(pp_atomic_dep, deps), ' | ')
+ return string.join(map(pp_or_dep, rels), ', ')
+
+ for field in ['Version', 'Priority', 'Section', 'Maintainer']:
+ if src.has_key(field):
+ pkg[field] = src[field]
+ bin_depends = mk_bin_rels(['build-depends', 'build-depends-indep'],
+ src.relations)
+ if bin_depends:
+ #pkg['Depends'] = deb822.PkgRelation.str(bin_depends)
+ pkg['Depends'] = str_of_relations(bin_depends)
+ bin_conflicts = mk_bin_rels(['build-conflicts', 'build-conflicts-indep'],
+ src.relations)
+ if bin_conflicts:
+ #pkg['Conflicts'] = deb822.PkgRelation.str(bin_conflicts)
+ pkg['Conflicts'] = str_of_relations(bin_conflicts)
+ pkg['Description'] = 'dummy counterpart of "%s" source package' % \
+ src['Package']
+ pkg['Description'] += "\n I don't exist, go away."
+
+ return pkg
+
+#for pkg in deb822.Packages.iter_paragraphs(sys.stdin):
+for line in sys.stdin:
+ print line,
+for src in deb822.Sources.iter_paragraphs(file(sources_file)):
+ if src['Architecture'] in ['any', 'all'] \
+ or architecture in src['Architecture'].split():
+ pkg = pkg_of_src(src)
+ print pkg
+
diff --git a/debian/contrib/edos-builddebcheck b/debian/contrib/edos-builddebcheck
new file mode 100755
index 0000000..7851cee
--- /dev/null
+++ b/debian/contrib/edos-builddebcheck
@@ -0,0 +1,137 @@
+#!/usr/bin/perl -w
+
+# Copyright (C) 2008 Ralf Treinen <treinen at debian.org>
+# This program is free software: you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free Software
+# Foundation, version 2 of the License.
+
+open(D,"dpkg-query -W python-debian|");
+die "The package 'python-debian' is necessary to run this program"
+ unless <D> =~ /^python-debian\s/;
+close D;
+
+$debug=0;
+
+# the prefix used to encode source packages
+$sourceprefix="source---";
+
+$architecture="";
+$binexplain=0;
+$edosoptions = "-failures -explain";
+while ( $arg = shift @ARGV ) {
+ if ( $arg eq '-a' || $arg eq '--architecture' ) {
+ if ($#ARGV == -1) {
+ die "-a option needs a value";
+ } else {
+ $architecture = shift @ARGV;
+ }
+ } elsif ( $arg =~ "--binexplain" || $arg =~ "-be" ) {
+ $binexplain = 1;
+ } elsif ( $arg =~ /^-.*/ ) {
+ die "unrecognized option: $arg";
+ } else {
+ last;
+ }
+}
+
+if ($#ARGV != 0) {
+ die "Usage: edos-debbuildcheck [options] Packages Sources"
+} else {
+ $packagefile = $arg;
+ $sourcesfile = shift(@ARGV);
+}
+
+if ($debug) {
+ print "Arch: $architecture\n";
+ print "Packages: $packagefile\n";
+ print "Sources: $sourcesfile\n";
+ print "Edos options: $edosoptions\n";
+}
+
+$packagearch="";
+open(P,$packagefile);
+while (<P>) {
+ next unless /^Architecture/;
+ next if /^Architecture:\s*all/;
+ /Architecture:\s*([^\s]*)/;
+ if ($packagearch eq "") {
+ $packagearch = $1;
+ } elsif ( $packagearch ne $1) {
+ die "Package file contains different architectures: $packagearch, $1";
+ }
+}
+close P;
+
+if ( $architecture eq "" ) {
+ if ( $packagearch eq "" ) {
+ die "No architecture option given, " .
+ "and no non-all architecture found in the Packages file";
+ } else {
+ $architecture = $packagearch;
+ }
+} else {
+ if ( $packagearch ne "" & $architecture ne $packagearch) {
+ die "Architecture option is $architecture ".
+ "but the package file contains architecture $packagearch";
+ }
+}
+
+open(RESULT,"/usr/share/edos-debcheck/add-sources.py ".
+ "--prefix \"$sourceprefix\" < $packagefile $sourcesfile $architecture ".
+ "| edos-debcheck $edosoptions|");
+
+$sourcestanza=0;
+$explanation="";
+$binpackage="";
+
+while (<RESULT>) {
+ if (/^\s+/) {
+ if ($sourcestanza) {
+ s/^(\s*)$sourceprefix(.*)(depends on|conflicts with)/$1$2build-$3/o;
+ print;
+ if (/depends on ([^\s]*) .*\{.*\}/) {
+ push(@binqueue,$1);
+ }
+ } else {
+ $explanation .= $_;
+ }
+ } else {
+ if ($binpackage ne ""){
+ $binfailures{$binpackage} = $explanation;
+ $binpackage="";
+ }
+ if (/^$sourceprefix.*: FAILED/o) {
+ s/^$sourceprefix//o;
+ print;
+
+ $_=<RESULT>;
+ print;
+
+ $sourcestanza=1;
+ } elsif (/^([^\s]*) .*: FAILED/) {
+ $binpackage=$1;
+ $explanation=$_;
+ $explanation.=<RESULT>;
+ $sourcestanza=0;
+ } else {
+ # we have someting strange here
+ $sourcestanza=0;
+ }
+ }
+}
+
+close RESULT;
+
+if ($binexplain) {
+ while (@binqueue) {
+ $p=pop(@binqueue);
+ $v=$binfailures{$p};
+ next unless defined $v;
+ $binfailures{$p}="";
+ print "$v" if $v ne "";
+ if ($v=~/depends on ([^\s]*) .*\{.*\}/) {
+ push(@binqueue,$1);
+ }
+ }
+}
+
diff --git a/debian/contrib/edos-builddebcheck.1 b/debian/contrib/edos-builddebcheck.1
new file mode 100644
index 0000000..ada1492
--- /dev/null
+++ b/debian/contrib/edos-builddebcheck.1
@@ -0,0 +1,72 @@
+.TH EDOS-BUILDDEBCHECK 1 2008-08-17 EDOS
+
+.SH NAME
+Edos-builddebcheck \- Check satisfiability of Debian package build-dependencies
+
+.SH SYNOPSIS
+\fBedos-builddebcheck\fR [option] ... Packagefile Sourcepackagefile
+
+.SH DESCRIPTION
+.B edos-builddebcheck
+reads a set of Debian package descriptions from the file \fIPackagefile\fR,
+each of which is in the format of deb-control(5), and a set of source package
+descriptions from the file \fISourcepackagefile\fR. All packages described in
+the file \fIPackagefile\fR must have the same value of their \fIArchitecture\fR
+(if it is different from \fIall\fP).
+
+For instance, the Packages and Sources files as found on a Debian mirror
+server, or in the directory \fI/var/lib/apt/lists/\fR of a Debian system, are
+suitable as input files.
+
+.B edos-builddebcheck
+verifies for every of the source packages (from \fISourcepackagefile\fR)
+whether its build-dependencies, build-indep-dependencies and build-conflicts
+can be satisfied from the binary packages provided in \fIPackagefile\fR. Only
+build-relations that apply to the architecture (see below on how the
+architecture is determined) are taken into account.
+
+Note that this is not the same thing as checking whether a distribution
+can be rebuild from scratch, for several reasons:
+
+\fB1.\fP
+No actual compilation is taking place, this tool only does a static
+analysis of package relationships.
+
+\fB2.\fP
+The binary packages in \fIPackages\fR are not necessarily those that are
+the result of the compilation of the source packages in
+\fISourcepackagefile\fR.
+
+\fB3.\fP We do not check for cycles. For instance, suppose that we have source
+packages \fIa\fP and \fIb\fP both generating one binary package of
+respectively the same name, and that \fIa\fP build-depends on \fIb\fP and
+\fIb\fP build-depends on \fIa\fP. Then we can not rebuild the set of packages
+from scratch because of the cycle. However, if we already have binary packages
+\fIa\fP and \fIb\fP then we can recompile both of them. Consequently,
+\fBedos-builddebcheck\fP will not report an error in this case.
+
+\fB4.\fP The underlying logical machine does a complete analysis of
+alternatives, and might report satisfiability of constraints in case actual
+tools (like apt) fail to find a solution.
+
+.SH OPTIONS
+.TP
+.B -a, --architecture \fIarchitecture\fP
+Check for compilation on \fIarchitecture\fP. Usually it is not
+necessary to specify the architecture since it can be derived from the Packages
+file.
+.TP
+.B -be, --binexplain
+Add all explanations why build-dependencies are not satisfiable. Without that
+option some of these explanations may be missing from the output in case a
+source package build-depends on a binary package that exists in
+\fIPackagefile\fP file but that edos-debchecks finds not to be installable
+inside \fIPackagefile\fP.
+
+.SH AUTHOR
+Edos-builddebcheck has been written by Stefano Zacchiroli <zack at debian.org>
+and Ralf Treinen <treinen at debian.org>. It heavily relies on edos-debcheck
+which has been written by Jerome Vouillon for the EDOS project.
+
+.SH SEE ALSO
+.BR deb-control (5), edos-debcheck (1)
diff --git a/debian/edos-distcheck.dirs b/debian/edos-distcheck.dirs
index 7b9b0e0..0f6b3b8 100644
--- a/debian/edos-distcheck.dirs
+++ b/debian/edos-distcheck.dirs
@@ -1,3 +1,4 @@
usr/bin
usr/lib/edos-distcheck
+usr/share/edos-distcheck
usr/share/man
diff --git a/debian/edos-distcheck.install b/debian/edos-distcheck.install
new file mode 100644
index 0000000..86a9605
--- /dev/null
+++ b/debian/edos-distcheck.install
@@ -0,0 +1,2 @@
+debian/contrib/add-sources.py usr/share/edos-distcheck
+debian/contrib/edos-builddebcheck usr/bin
diff --git a/debian/edos-distcheck.manpages b/debian/edos-distcheck.manpages
index 19333d3..a06be29 100644
--- a/debian/edos-distcheck.manpages
+++ b/debian/edos-distcheck.manpages
@@ -1,3 +1,4 @@
debian/manpages/edos-debcheck.1
debian/manpages/edos-rpmcheck.1
debian/manpages/edos-pscheck.1
+debian/contrib/edos-builddebcheck.1
--
pkglab packaging
More information about the Pkg-ocaml-maint-commits
mailing list