--- Begin Message ---
Package: dpkg
Version: 1.10.28
Severity: wishlist
Tags: patch
Hi,
attached are the changes needed to introduce the Multi-Arch field to
dpkg. Multi-Arch is a tri-state field with the following meaning (to be added
to the dpkg docs or debian policy):
(unset) - Old package, assume the worst [also for non multi-arch debs]
- Only one arch can be installed for this package.
- Depends on this package must have the same architecture.
- Use this if you are unsure. It is the save option.
yes - library package
- Multiple architectures can be installed in parallel.
- Depends on this package must have the same architecture.
- The package may not have file overlaps between architectures, no
public binaries, no conffiles. Shared object files must be in
multiarch subdirs.
no - binary only package
- Only one arch can be installed for this package.
- Depends of any architecture will work with this package.
- The package must not have any public shared objects.
Note that the patch does only carry the field from source into the
debs and changes files and the available and status database. No
enforcement of the above rules is made and dpkg is still mono-arch
[which ensures the above rules incidentally].
One thing is missing from the patch though. The Multi-Arch and
Architecture fields should be kept in the status file for
half-installed and removed packages. Hints how to achieve that are
welcome.
MfG
Goswin
PS: The patch also contains an addition to the clean rule. The *.gmo
files seem to get rebuild and make it impossible to work with an
orig.tar.gz + diff.gz.
-- System Information:
Debian Release: 3.1
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.8-frosties-2
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Versions of packages dpkg depends on:
ii dselect 1.10.28 a user tool to manage Debian packa
ii libc6 2.3.2.ds1-22 GNU C Library: Shared libraries an
-- no debconf information
--- dpkg-1.13.19.orig/scripts/dpkg-source.pl
+++ dpkg-1.13.19/scripts/dpkg-source.pl
@@ -218,6 +218,7 @@
} elsif (m/^(Package|Essential|Pre-Depends|Depends|Provides)$/i ||
m/^(Recommends|Suggests|Optional|Conflicts|Replaces)$/i ||
m/^(Enhances|Description|Section|Priority)$/i ||
+ m/^(Multi-Arch)$/i ||
m/^X[CS]+-/i) {
} else {
&unknown("package's section of control info file");
--- dpkg-1.13.19.orig/scripts/dpkg-genchanges.pl
+++ dpkg-1.13.19/scripts/dpkg-genchanges.pl
@@ -203,7 +203,8 @@
}
push(@archvalues,$v) unless !$v || $archadded{$v}++;
} elsif (m/^(Package|Essential|Pre-Depends|Depends|Provides)$/ ||
- m/^(Recommends|Suggests|Enhances|Optional|Conflicts|Replaces)$/ ||
+ m/^(Recommends|Suggests|Enhances|Optional|Conflicts)$/ ||
+ m/^(Replaces|Multi-Arch)$/ ||
m/^X[CS]+-/i) {
} else {
&unknown("package's section of control info file");
--- dpkg-1.13.19.orig/scripts/controllib.pl
+++ dpkg-1.13.19/scripts/controllib.pl
@@ -226,7 +226,7 @@
ALTERNATE:
foreach my $dep_or (split(/\s*\|\s*/m, $dep_and)) {
my ($package, $relation, $version);
- $package = $1 if ($dep_or =~ s/^([a-zA-Z0-9][a-zA-Z0-9+._-]*)\s*//m);
+ $package = $1 if ($dep_or =~ s,^([a-zA-Z0-9][a-zA-Z0-9+._-]*(/[a-z0-9]*)?)\s*,,m);
($relation, $version) = ($1, $2)
if ($dep_or =~ s/^\(\s*(=|<=|>=|<<?|>>?)\s*([^)]+).*\)\s*//m);
my @arches;
--- dpkg-1.13.19.orig/scripts/dpkg-gencontrol.pl
+++ dpkg-1.13.19/scripts/dpkg-gencontrol.pl
@@ -48,7 +48,7 @@
Pre-Depends Depends Recommends Suggests Enhances Optional
Conflicts Replaces Provides Installed-Size Origin Maintainer
Bugs Source Description Build-Depends Build-Depends-Indep
- Build-Conflicts Build-Conflicts-Indep ));
+ Build-Conflicts Build-Conflicts-Indep Multi-Arch ));
while (@ARGV) {
$_=shift(@ARGV);
@@ -120,7 +120,7 @@
else { $_ = "C $_"; &unknown('general section of control info file'); }
} elsif (s/^C$myindex //) {
#print STDERR "P key >$_< value >$v<\n";
- if (m/^(Package|Description|Essential|Optional)$/) {
+ if (m/^(Package|Description|Essential|Optional|Multi-Arch)$/) {
$f{$_}= $v;
} elsif (exists($pkg_dep_fields{$_})) {
} elsif (m/^Section$|^Priority$/) {
@@ -178,7 +178,7 @@
$v= $fi{$_};
if (s/^C //) {
} elsif (s/^C$myindex //) {
- if (m/^(Package|Description|Essential|Optional)$/) {
+ if (m/^(Package|Description|Essential|Optional|Multi-Arch)$/) {
} elsif (exists($pkg_dep_fields{$_})) {
my $dep = parsedep(substvars($v), 1, 1);
&error("error occurred while parsing $_") unless defined $dep;
--- dpkg-1.13.19.orig/debian/changelog
+++ dpkg-1.13.19/debian/changelog
@@ -1,3 +1,21 @@
+dpkg (1.13.19-0a0.mrvn.1) unstable; urgency=low
+
+ [ Goswin von Brederlow ]
+ * debian/rules: remove po/*.gmo and dselect/po/*.gmo on clean
+ * Introduce Multi-Arch field to scripts
+ + scripts/dpkg-source.pl
+ + scripts/dpkg-gencontrol.pl
+ + scripts/dpkg-genchanges.pl
+ * Introduce Multi-Arch field to dpkg/dpkg-deb
+ + lib/parse.c: add Multi-Arch to fieldinfos
+ + lib/dpkg-db.h: add pkginfoperfile.multiarch field
+ + lib/database.c: blank multiarch field in blankpackageperfile
+ + lib/parsedump.h: add {f,w}_tristate pototype
+ + lib/fields.c: add f_tristate
+ + lib/dump.c: add w_tristate
+
+ -- Goswin von Brederlow <[email protected]> Sat, 20 May 2006 03:29:11 +0000
+
dpkg (1.13.19) unstable; urgency=low
[ Frank Lichtenheld ]
--- dpkg-1.13.19.orig/debian/rules
+++ dpkg-1.13.19/debian/rules
@@ -120,7 +120,7 @@
clean:
dh_testdir
- rm -rf build-tree
+ rm -rf build-tree po/*.gmo dselect/po/*.gmo
dh_clean
--- dpkg-1.13.19.orig/lib/fields.c
+++ dpkg-1.13.19/lib/fields.c
@@ -136,6 +136,17 @@
: 0;
}
+void f_tristate(struct pkginfo *pigp, struct pkginfoperfile *pifp,
+ enum parsedbflags flags,
+ const char *filename, int lno, FILE *warnto, int *warncount,
+ const char *value, const struct fieldinfo *fip) {
+ pifp->multiarch=
+ *value ? convert_string(filename,lno,_("yes/no in tristate field"), -1,
+ warnto,warncount,pigp,
+ value,booleaninfos,NULL)
+ : -1;
+}
+
void f_section(struct pkginfo *pigp, struct pkginfoperfile *pifp,
enum parsedbflags flags,
const char *filename, int lno, FILE *warnto, int *warncount,
--- dpkg-1.13.19.orig/lib/dpkg-db.h
+++ dpkg-1.13.19/lib/dpkg-db.h
@@ -100,6 +100,7 @@
struct dependency *depends;
struct deppossi *depended;
int essential; /* The `essential' flag, 1=yes, 0=no (absent) */
+ int multiarch; /* The `multi-arch' flag, 1=yes, 0=no, -1=absent */
char *description, *maintainer, *source, *architecture, *installedsize, *origin, *bugs;
struct versionrevision version;
struct conffile *conffiles;
--- dpkg-1.13.19.orig/lib/parse.c
+++ dpkg-1.13.19/lib/parse.c
@@ -43,6 +43,7 @@
/* NB: capitalisation of these strings is important. */
{ "Package", f_name, w_name },
{ "Essential", f_boolean, w_booleandefno, PKGIFPOFF(essential) },
+ { "Multi-Arch", f_tristate, w_tristate, PKGIFPOFF(multiarch) },
{ "Status", f_status, w_status },
{ "Priority", f_priority, w_priority },
{ "Section", f_section, w_section },
--- dpkg-1.13.19.orig/lib/dump.c
+++ dpkg-1.13.19/lib/dump.c
@@ -140,6 +140,22 @@
varbufaddstr(vb,fip->name); varbufaddstr(vb, ": yes\n");
}
+void w_tristate(struct varbuf *vb,
+ const struct pkginfo *pigp, const struct pkginfoperfile *pifp,
+ enum fwriteflags flags, const struct fieldinfo *fip) {
+ int value= pifp->valid ? PKGPFIELD(pifp,fip->integer,int) : -1;
+ if (value == -1) return;
+ assert(value==1 || value==0);
+ if (flags&fw_printheader) {
+ varbufaddstr(vb,fip->name);
+ varbufaddstr(vb, ": ");
+ }
+ varbufaddstr(vb, (value==1) ? "yes" : "no");
+ if (flags&fw_printheader) {
+ varbufaddstr(vb, "\n");
+ }
+}
+
void w_priority(struct varbuf *vb,
const struct pkginfo *pigp, const struct pkginfoperfile *pifp,
enum fwriteflags flags, const struct fieldinfo *fip) {
--- dpkg-1.13.19.orig/lib/parsedump.h
+++ dpkg-1.13.19/lib/parsedump.h
@@ -39,7 +39,7 @@
const char *value, const struct fieldinfo *fip);
freadfunction f_name, f_charfield, f_priority, f_section, f_status, f_filecharf;
freadfunction f_boolean, f_dependency, f_conffiles, f_version, f_revision;
-freadfunction f_configversion;
+freadfunction f_configversion, f_tristate;
enum fwriteflags {
fw_printheader = 001 /* print field header and trailing newline */
@@ -50,7 +50,7 @@
enum fwriteflags flags, const struct fieldinfo*);
fwritefunction w_name, w_charfield, w_priority, w_section, w_status, w_configversion;
fwritefunction w_version, w_null, w_booleandefno, w_dependency, w_conffiles;
-fwritefunction w_filecharf;
+fwritefunction w_filecharf, w_tristate;
struct fieldinfo {
const char *name;
--- dpkg-1.13.19.orig/lib/database.c
+++ dpkg-1.13.19/lib/database.c
@@ -78,6 +78,7 @@
void blankpackageperfile(struct pkginfoperfile *pifp) {
pifp->essential= 0;
+ pifp->multiarch= -1;
pifp->depends= NULL;
pifp->depended= NULL;
pifp->description= pifp->maintainer= pifp->source= pifp->installedsize= pifp->bugs= pifp->origin= NULL;
--- End Message ---