diff -Nru /tmp/file6ljl7n/dpkg-1.10.18/Makefile.in /tmp/fileUfdG3B/dpkg-1.10.18/Makefile.in --- /tmp/file6ljl7n/dpkg-1.10.18/Makefile.in 2003-04-26 12:26:19.000000000 -0400 +++ /tmp/fileUfdG3B/dpkg-1.10.18/Makefile.in 2003-11-28 19:57:09.000000000 -0500 @@ -19,6 +19,7 @@ $(mkinstalldirs) $(DESTDIR)$(dpkgsharedir)/origins $(INSTALL_DATA) $(srcdir)/origin $(DESTDIR)$(dpkgconfdir)/origins/debian $(INSTALL_DATA) $(srcdir)/archtable $(DESTDIR)$(dpkgsharedir)/archtable + $(INSTALL_DATA) $(srcdir)/subarchtable $(DESTDIR)$(dpkgsharedir)/subarchtable clean: clean-recursive rm -f $(GENFILES) diff -Nru /tmp/file6ljl7n/dpkg-1.10.18/archtable /tmp/fileUfdG3B/dpkg-1.10.18/archtable --- /tmp/file6ljl7n/dpkg-1.10.18/archtable 2003-09-13 19:43:49.000000000 -0400 +++ /tmp/fileUfdG3B/dpkg-1.10.18/archtable 2003-11-28 19:57:09.000000000 -0500 @@ -7,11 +7,11 @@ # returned by `dpkg --print-installation-architecture'. # Column 3 is returned by `dpkg --print-architecture'. -i386-linux-gnu i386 i486 -i486-linux-gnu i386 i486 -i586-linux-gnu i386 i486 -i686-linux-gnu i386 i486 -pentium-linux-gnu i386 i486 +i386-linux-gnu i386 i386 +i486-linux-gnu i486 i486 +i586-linux-gnu i586 i586 +i686-linux-gnu i686 i686 +pentium-linux-gnu i686 i686 sparc-linux-gnu sparc sparc sparc64-linux-gnu sparc sparc alpha-linux-gnu alpha alpha @@ -60,3 +60,5 @@ s390x-linux-gnu s390x s390x s390x-ibm-linux-gnu s390x s390x s390x-unknown-linux-gnu s390x s390x +amd64-linux-gnu amd64 amd64 +x86_64-linux-gnu amd64 amd64 diff -Nru /tmp/file6ljl7n/dpkg-1.10.18/debian/changelog /tmp/fileUfdG3B/dpkg-1.10.18/debian/changelog --- /tmp/file6ljl7n/dpkg-1.10.18/debian/changelog 2003-10-27 14:42:05.000000000 -0500 +++ /tmp/fileUfdG3B/dpkg-1.10.18/debian/changelog 2004-01-09 15:00:24.000000000 -0500 @@ -1,3 +1,41 @@ +dpkg (1.10.18-subarch4) unstable; urgency=low + + * fixed a few small bugs in dpkg-subarchitecture. + * fixed a segmentation fault in subarchtable parser. + + -- Bart Trojanowski Fri, 9 Jan 2004 14:58:00 -0500 + +dpkg (1.10.18-subarch3) unstable; urgency=low + + * moved multiarch functionality to lib/multiarch.c and include/multiarch.h. + * added Arch and ABI enumeration functions. + * added faster Arch comparison and ABI comparison functions. + * general cleanup to mutliarch support. + + -- Bart Trojanowski Thu, 18 Dec 2003 12:30:47 -0500 + +dpkg (1.10.18-subarch2.1) unstable; urgency=low + + * Reintroduce special hack for a biarch i386/x86_64 compiler + + -- Goswin von Brederlow Sat, 13 Dec 2003 21:25:20 +0100 + +dpkg (1.10.18-subarch2) unstable; urgency=low + + * subarchtable format changed to only use [A-Z_] variable names. + * dpkg-subarchitecture updated to above mentioned format. + * dpkg no longer fork()s dpkg-subarchitecture.pl when testing + compatibility two architectures; a C parser was written to parse the + subarchtable. + + -- Bart Trojanowski Thu, 11 Dec 2003 16:04:20 -0500 + +dpkg (1.10.18-subarch1) unstable; urgency=low + + * merged in subarchitecture additions. + + -- Bart Trojanowski Nov, 27 Sep 2003 19:25:00 -0400 + dpkg (1.10.18) unstable; urgency=medium * Rebuild, tagging and releasing correctly from cvs this time. @@ -289,6 +327,26 @@ After opening files, set binmode. Closes: #175363 -- Adam Heath Tue, 16 Sep 2003 12:52:11 -0500 +dpkg (1.10.10.0-subarch.3) unstable; urgency=low + + * added /usr/bin/dpkg-subarchitecture utility, + * extended the knowledge held by /usr/share/dpkg/subarchtable, + * dpkg currently requires dpkg-dev to function, + * fixed the package version (was kind of messy). + + -- Bart Trojanowski Fri, 8 Aug 2003 22:39:15 -0400 + +dpkg (1.10.10.0lib641+subarch) unstable; urgency=low + + * added primitive subarchitecture support for dpkg + + -- Bart Trojanowski Sat, 12 Jul 2003 16:10:23 -0400 + +dpkg (1.10.10.0lib641) unstable; urgency=low + + * lib64 support added. + + -- Gerhard Tonn Thu, 9 Jun 2003 15:10:24 +0200 dpkg (1.10.10) unstable; urgency=low diff -Nru /tmp/file6ljl7n/dpkg-1.10.18/debian/dselect.substvars /tmp/fileUfdG3B/dpkg-1.10.18/debian/dselect.substvars --- /tmp/file6ljl7n/dpkg-1.10.18/debian/dselect.substvars 1969-12-31 19:00:00.000000000 -0500 +++ /tmp/fileUfdG3B/dpkg-1.10.18/debian/dselect.substvars 2004-01-03 15:46:35.000000000 -0500 @@ -0,0 +1 @@ +shlibs:Depends=lib64c6 (>= 2.3.2-1), lib64gcc1 (>= 1:3.3-1), lib64ncurses5 (>= 5.3.20030510-1), lib64stdc++5 (>= 1:3.3-1) diff -Nru /tmp/file6ljl7n/dpkg-1.10.18/debian/rules /tmp/fileUfdG3B/dpkg-1.10.18/debian/rules --- /tmp/file6ljl7n/dpkg-1.10.18/debian/rules 2003-09-19 13:29:09.000000000 -0400 +++ /tmp/fileUfdG3B/dpkg-1.10.18/debian/rules 2003-12-14 11:30:10.000000000 -0500 @@ -70,6 +70,8 @@ rm -f po/{cat-id-tbl.c,stamp-cat-id,*.gmo} rm -f stamp-build stamp-binary + find . -name '*~' -exec rm {} \; + build: stamp-build stamp-build: $(BUILD)/configure-stamp @@ -198,7 +200,8 @@ set -e ; for i in dpkg-name dpkg-source dpkg-genchanges dpkg-gencontrol \ dpkg-shlibdeps dpkg-buildpackage dpkg-distaddfile 822-date \ dpkg-scanpackages dpkg-scansources dpkg-architecture \ - dpkg-parsechangelog dpkg-checkbuilddeps ; do \ + dpkg-parsechangelog dpkg-checkbuilddeps dpkg-libinfo \ + dpkg-subarchitecture ; do \ mv $(INSTALL_TMP)/usr/bin/$$i $(TMP_DPKG_DEV)/usr/bin/ ; \ done set -e ; for i in "" de fr ja sv ; do \ @@ -206,7 +209,7 @@ for m in dpkg-name.1 dpkg-source.1 822-date.1 dpkg-architecture.1 \ dpkg-buildpackage.1 dpkg-distaddfile.1 dpkg-genchanges.1 \ dpkg-gencontrol.1 dpkg-parsechangelog.1 dpkg-shlibdeps.1 \ - dpkg-checkbuilddeps.1 ; do \ + dpkg-checkbuilddeps.1 dpkg-libinfo.1 dpkg-subarchitecture.1 ; do \ if [ -e $(INSTALL_TMP)/usr/share/man/$$i/man1/$$m ] ; then \ mv $(INSTALL_TMP)/usr/share/man/$$i/man1/$$m $(TMP_DPKG_DEV)/usr/share/man/$$i/man1/$$m ; \ fi ; \ diff -Nru /tmp/file6ljl7n/dpkg-1.10.18/dpkg-deb/build.c /tmp/fileUfdG3B/dpkg-1.10.18/dpkg-deb/build.c --- /tmp/file6ljl7n/dpkg-1.10.18/dpkg-deb/build.c 2003-10-25 16:03:20.000000000 -0400 +++ /tmp/fileUfdG3B/dpkg-1.10.18/dpkg-deb/build.c 2003-11-28 19:57:09.000000000 -0500 @@ -44,6 +44,8 @@ #include #include "dpkg-deb.h" +#include + #ifndef S_ISLNK # define S_ISLNK(mode) ((mode&0xF000) == S_IFLNK) #endif @@ -286,6 +288,21 @@ if (subdir) { versionstring= versiondescribe(&checkedinfo->available.version,vdew_never); arch= checkedinfo->available.architecture; if (!arch) arch= ""; +#if 1 /* bart's hack */ +fprintf (stderr, "arch=%s\n", arch); +if (0==strcmp (arch,"amd64")) { + struct utsname utsname; + int rc = uname (&utsname); +fprintf (stderr, "machine=%s\n", utsname.machine); + if (rc == 0 && utsname.machine[0]=='i' && 0==strcmp(utsname.machine+2,"86")) { + static char architecture32[128]; + //arch="i386"; + snprintf (architecture32, 127, "%s", utsname.machine); + arch = architecture32; +fprintf (stderr, "using arch=%s\n", arch); + } +} +#endif m= m_malloc(sizeof(DEBEXT)+1+strlen(debar)+1+strlen(checkedinfo->name)+ strlen(versionstring)+1+strlen(arch)); sprintf(m,"%s/%s_%s%s%s" DEBEXT,debar,checkedinfo->name,versionstring, diff -Nru /tmp/file6ljl7n/dpkg-1.10.18/dselect/helpmsgs.src /tmp/fileUfdG3B/dpkg-1.10.18/dselect/helpmsgs.src --- /tmp/file6ljl7n/dpkg-1.10.18/dselect/helpmsgs.src 1969-12-31 19:00:00.000000000 -0500 +++ /tmp/fileUfdG3B/dpkg-1.10.18/dselect/helpmsgs.src 2003-11-27 23:15:52.000000000 -0500 @@ -0,0 +1,181 @@ +@@@ listkeys Keystrokes + +Motion keys: Next/Previous, Top/End, Up/Down, Backwards/Forwards: + n, Down-arrow, j p, Up-arrow, k move highlight + N, Page-down, Space P, Page-up, Backspace scroll list by 1 page + ^n ^p scroll list by 1 line + t, Home e, End jump to top/end of list + u d scroll info by 1 page + ^u ^d scroll info by 1 line + B, Left-arrow F, Right-arrow pan display by 1/3 screen + ^b ^f pan display by 1 character + +Mark packages for later processing: + +, Insert install or upgrade =, H hold in present state + -, Delete remove :, G unhold: upgrade or leave uninstalled + _ remove & purge config + Miscellaneous: +Quit, exit, overwrite (note capitals!): ?, F1 request help (also Help) + Return Confirm, quit (check dependencies) i, I toggle/cycle info displays + Q Confirm, quit (override dep.s) o, O cycle through sort options + X, Esc eXit, abandoning any changes made v, V change status display opts + R Revert to state before this list ^l redraw display + U set all to sUggested state / search (Return to cancel) + D set all to Directly requested state \\ repeat last search + +@@@ mainintro Introduction to package selections + +Welcome to dselect's main package listing. + +You will be presented with a list of packages which are installed or available +for installation. You can navigate around the list using the cursor keys, +mark packages for installation (using `+') or deinstallation (using `-'). +Packages can be marked either singly or in groups; initially you will see that +the line `All packages' is selected. `+', `-' and so on will affect all the +packages described by the highlighted line. + +Some of your choices will cause conflicts or dependency problems; you will be +given a sub-list of the relevant packages, so that you can solve the problems. + +You should read the list of keys and the explanations of the display. +Much on-line help is available, please make use of it - press `?' at +any time for help. + +When you have finished selecting packages, press to confirm changes, +or `Q' to quit without saving changes. A final check on conflicts and +dependencies will be done - here too you may see a sublist. + +Press to leave help and enter the list now. + +@@@ readonlyintro Introduction to read-only package list browser + +Welcome to dselect's main package listing. + +You will be presented with a list of packages which are installed or available +for installation. Since you do not have the privilege necessary to update +package states, you are in a read-only mode. You can navigate around the +list using the cursor keys (please see the `Keystrokes' help screen), observe +the status of the packages and read information about them. + +You should read the list of keys and the explanations of the display. +Much on-line help is available, please make use of it - press `?' at +any time for help. + +When you have finished browsing, press `Q' or to quit. + +Press to leave help and enter the list now. + +@@@ recurintro Introduction to conflict/dependency resolution sub-list + +Dependency/conflict resolution - introduction. + +One or more of your choices have raised a conflict or dependency problem - +some packages should only be installed in conjunction with certain others, and +some combinations of packages may not be installed together. + +You will see a sub-list containing the packages involved. The bottom half of +the display shows relevant conflicts and dependencies; use `i' to cycle between +that, the package descriptions and the internal control information. + +A set of `suggested' packages has been calculated, and the initial markings in +this sub-list have been set to match those, so you can just hit Return to +accept the suggestions if you wish. You may abort the change(s) which caused +the problem(s), and go back to the main list, by pressing capital `X'. + +You can also move around the list and change the markings so that they are more +like what you want, and you can `reject' my suggestions by using the capital +`D' or `R' keys (see the keybindings help screen). You can use capital `Q' to +force me to accept the situation currently displayed, in case you want to +override a recommendation or think that the program is mistaken. + +Press to leave help and enter the sub-list; remember: press `?' for help. + +@@@ displayexplain1 Display, part 1: package listing and status chars + +The top half of the screen shows a list of packages. For each package you see +four columns for its current status on the system and mark. In terse mode (use +`v' to toggle verbose display) these are single characters, from left to right: + + Error flag: Space - no error (but package may be in broken state - see below) + `R' - serious error during installation, needs reinstallation; + Installed state: Space - not installed; + `*' - installed; + `-' - not installed but config files remain; + packages in { `U' - unpacked but not yet configured; + these states { `C' - half-configured (an error happened); + are broken { `I' - half-installed (an error happened). + Old mark: what was requested for this package before presenting this list; + Mark: what is requested for this package: + `*': marked for installation or upgrade; + `-': marked for removal, but any configuration files will remain; + `=': on hold: package will not be processed at all; + `_': marked for purge completely - even remove configuration; + `n': package is new and has yet to be marked for install/remove/&c. + +Also displayed are each package's Priority, Section, name, installed and +available version numbers (shift-V to display/hide) and summary description. + +@@@ displayexplain2 Display, part 2: list highlight; information display + +* Highlight: One line in the package list will be highlighted. It indicates + which package(s) will be affected by presses of `+', `-' and `_'. + +* The dividing line in the middle of the screen shows a brief explanation of + the status of the currently-highlighted package, or a description of which + group is highlighted if a group line is. If you don't understand the + meaning of some of the status characters displayed, go to the relevant + package and look at this divider line, or use the `v' key for a verbose + display (press `v' again to go back to the terse display). + +* The bottom of the screen shows more information about the + currently-highlighted package (if there is only one). + + It can show an extended description of the package, the internal package + control details (either for the installed or available version of the + package), or information about conflicts and dependencies involving the + current package (in conflict/dependency resolution sublists). + + Use the `i' key to cycle through the displays, and `I' to hide the + information display or expand it to use almost all of the screen. + +@@@ methintro Introduction to method selection display + +dselect and dpkg can do automatic installation, loading the package files to be +installed from one of a number of different possible places. + +This list allows you to select one of these installation methods. + +Move the highlight to the method you wish to use, and hit Enter. You will then +be prompted for the information required to do the installation. + +As you move the highlight a description of each method, where available, is +displayed in the bottom half of the screen. + +If you wish to quit without changing anything use the `x' key while in the list +of installation methods. + +A full list of keystrokes is available by pressing `k' now, or from the help +menu reachable by pressing `?'. + +@@@ methkeys Keystrokes for method selection + +Motion keys: Next/Previous, Top/End, Up/Down, Backwards/Forwards: + n, Down-arrow p, Up-arrow move highlight + N, Page-down, Space P, Page-up, Backspace scroll list by 1 page + ^n ^p scroll list by 1 line + t, Home e, End jump to top/end of list + u d scroll info by 1 page + ^u ^d scroll info by 1 line + B, Left-arrow F, Right-arrow pan display by 1/3 screen + ^b ^f pan display by 1 character +(These are the same motion keys as in the package list display.) + +Quit: + Return, Enter select this method and go to its configuration dialogue + x, X exit without changing or setting up the installation method + +Miscellaneous: + ?, Help, F1 request help + ^l redraw display + / search (just return to cancel) + \\ repeat last search diff -Nru /tmp/file6ljl7n/dpkg-1.10.18/dselect/mkhelpmsgs.pl /tmp/fileUfdG3B/dpkg-1.10.18/dselect/mkhelpmsgs.pl --- /tmp/file6ljl7n/dpkg-1.10.18/dselect/mkhelpmsgs.pl 1969-12-31 19:00:00.000000000 -0500 +++ /tmp/fileUfdG3B/dpkg-1.10.18/dselect/mkhelpmsgs.pl 2003-11-27 23:15:52.000000000 -0500 @@ -0,0 +1,78 @@ +#!/usr/bin/perl + +$maxnlines= 22; + +open(SRC,$ARGV[0]) || die $!; +open(NC,">helpmsgs.cc.new") || die $!; +open(NH,">helpmsgs.h.new") || die $!; + +&autowarn('NC'); &autowarn('NH'); + +print(NC "#include \"helpmsgs.h\"\n") || die $!; +print(NH <<'END') || die $!; +#ifndef HELPMSGS_H +#define HELPMSGS_H +extern "C" { +#include +#include +} +struct helpmessage { const char *title; const char *text; }; +END + +$state= 'start'; +$nblanks= 0; $nlines= 0; +while () { + s/\"/\\\"/g; + if (m/^\@\@\@ (\w+)\s+(\S.*\S)\s+$/) { + &finishif; + $currentname= $1; $currenttitle= $2; + print(NH "extern const struct helpmessage hlp_$currentname;\n") || die $!; + print(NC + "const struct helpmessage hlp_$currentname = {\n". + " N_(\"$currenttitle\"), N_(\"") || die $!; + } elsif (m/^\@\@\@/) { + die; + } elsif (!m/\S/) { + $nblanks++; + } else { + if ($state ne 'start' && $nblanks) { + print(NC ("\\n"x$nblanks)."\\\n") || die $!; + $nlines+= $nblanks; + } + $state= 'middle'; $nblanks= 0; + s/\s*\n$//; + print(NC "\\\n".$_."\\n") || die $!; + $nlines++; + } +} + +&finishif; + +close(NC) || die $!; +print(NH "#endif /* HELPMSGS_H */\n") || die $!; +close(NH) || die $!; + +rename("helpmsgs.cc.new","helpmsgs.cc") || die $!; +rename("helpmsgs.h.new","helpmsgs.h") || die $!; + +sub finishif { + if ($state ne 'start') { + print(NC "\")\n};\n") || die $!; + printf "\t\t%s: %d lines\n",$currentname,$nlines; + if ($nlines > $maxnlines) { warn "Too many lines in $currentname"; } + } + $state= 'start'; + $nblanks= 0; $nlines= 0; +} + + +sub autowarn { + $fh= $_[0]; + print($fh <<'END') || die $!; +/* + * WARNING - THIS FILE IS GENERATED AUTOMATICALLY - DO NOT EDIT + * It is generated by mkhelpmsgs.pl from helpmsgs.src. + */ + +END +} diff -Nru /tmp/file6ljl7n/dpkg-1.10.18/foo /tmp/fileUfdG3B/dpkg-1.10.18/foo --- /tmp/file6ljl7n/dpkg-1.10.18/foo 1969-12-31 19:00:00.000000000 -0500 +++ /tmp/fileUfdG3B/dpkg-1.10.18/foo 2003-11-27 23:20:37.000000000 -0500 @@ -0,0 +1,97 @@ +ChangeLog +aclocal.m4 +config.h.in +configure +configure.in +version-nr +debian/changelog +debian/dpkg.postinst +dpkg-deb/build.c +dpkg-deb/extract.c +dpkg-deb/info.c +dpkg-deb/main.c +dselect/basecmds.cc +dselect/baselist.cc +dselect/basetop.cc +dselect/bindings.cc +dselect/main.cc +dselect/methkeys.cc +dselect/methlist.cc +dselect/method.cc +dselect/methparse.cc +dselect/pkgcmds.cc +dselect/pkgdepcon.cc +dselect/pkgdisplay.cc +dselect/pkginfo.cc +dselect/pkgkeys.cc +dselect/pkglist.cc +dselect/pkgsublist.cc +dselect/pkgtop.cc +include/dpkg.h.in +lib/compat.c +lib/database.c +lib/dbmodify.c +lib/dump.c +lib/ehandle.c +lib/fields.c +lib/lock.c +lib/md5.c +lib/mlib.c +lib/myopt.c +lib/nfmalloc.c +lib/parse.c +lib/parsehelp.c +lib/showcright.c +lib/showpkg.c +lib/varbuf.c +lib/vercmp.c +main/archives.c +main/cleanup.c +main/configure.c +main/depcon.c +main/dpkg.8 +main/enquiry.c +main/errors.c +main/filesdb.c +main/help.c +main/main.c +main/packages.c +main/processarc.c +main/query.c +main/remove.c +main/select.c +main/update.c +man/Makefile.in +man/fr/Makefile.in +man/pt_BR/Makefile.in +po/ChangeLog +po/ca.po +po/cs.po +po/da.po +po/de.po +po/dpkg.pot +po/en.po +po/es.po +po/fr.po +po/gl.po +po/it.po +po/ja.po +po/nl.po +po/pl.po +po/pt_BR.po +po/ru.po +po/sv.po +scripts/dpkg-checkbuilddeps.pl +scripts/dpkg-gencontrol.pl +scripts/dpkg-scanpackages.8 +scripts/dpkg-scanpackages.pl +scripts/dpkg-source.pl +scripts/install-info.pl +split/info.c +split/join.c +split/main.c +split/queue.c +split/split.c +utils/md5sum.c +utils/start-stop-daemon.8 +utils/start-stop-daemon.c diff -Nru /tmp/file6ljl7n/dpkg-1.10.18/include/dpkg-db.h /tmp/fileUfdG3B/dpkg-1.10.18/include/dpkg-db.h --- /tmp/file6ljl7n/dpkg-1.10.18/include/dpkg-db.h 2002-05-06 12:18:15.000000000 -0400 +++ /tmp/fileUfdG3B/dpkg-1.10.18/include/dpkg-db.h 2003-12-18 16:39:37.000000000 -0500 @@ -72,6 +72,7 @@ struct versionrevision version; enum depverrel verrel; int cyclebreak; + int depabi; /* -1 == ignore, else use abi_of_enum() to look up name */ }; struct arbitraryfield { diff -Nru /tmp/file6ljl7n/dpkg-1.10.18/include/multiarch.h /tmp/fileUfdG3B/dpkg-1.10.18/include/multiarch.h --- /tmp/file6ljl7n/dpkg-1.10.18/include/multiarch.h 1969-12-31 19:00:00.000000000 -0500 +++ /tmp/fileUfdG3B/dpkg-1.10.18/include/multiarch.h 2003-12-18 16:39:37.000000000 -0500 @@ -0,0 +1,48 @@ +/* + * libdpkg - Debian packaging suite library routines + * multiarch.h - support for multiple architectures + * + * Copyright (C) 2003 Bart Trojanowski + * + * This 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 2, + * or (at your option) any later version. + * + * This is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with dpkg; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef MULTIARCH_H +#define MULTIARCH_H + +typedef int arch_id_t; +#define ARCH_ID_INVALID ((arch_id_t)-1) + +typedef int abi_id_t; +#define ABI_ID_INVALID ((abi_id_t)-1) + +extern arch_id_t enum_of_arch(const char*); +extern const char *arch_of_enum(arch_id_t); +extern int arch_enum_valid (arch_id_t id); + +extern const char* test_support_for_arch_by_name (const char *const, const char *const); +extern const char* test_support_for_arch (arch_id_t, arch_id_t); +extern const char* test_compatible_abi (arch_id_t, arch_id_t); + +extern abi_id_t lookup_abi_of_arch (arch_id_t); +extern abi_id_t lookup_abi_of_arch_name (const char *const); +extern int abi_enum_valid (abi_id_t id); + +extern abi_id_t enum_of_abi (const char *); +extern const char * abi_of_enum (abi_id_t); + +extern int abisatisfied(struct pkginfoperfile *it, struct deppossi *against); + +#endif /* MULTIARCH_H */ diff -Nru /tmp/file6ljl7n/dpkg-1.10.18/lib/Makefile.in /tmp/fileUfdG3B/dpkg-1.10.18/lib/Makefile.in --- /tmp/file6ljl7n/dpkg-1.10.18/lib/Makefile.in 2003-09-13 15:31:50.000000000 -0400 +++ /tmp/fileUfdG3B/dpkg-1.10.18/lib/Makefile.in 2003-12-15 23:14:08.000000000 -0500 @@ -9,7 +9,7 @@ SOURCES = compat.c database.c dbmodify.c dump.c ehandle.c fields.c \ lock.c mlib.c myopt.c nfmalloc.c parse.c parsehelp.c \ showcright.c showpkg.c tarfn.c varbuf.c vercmp.c md5.c \ - utils.c + utils.c multiarch.c OBJECTS = $(patsubst %.c, %.o, $(SOURCES)) GENFILES = $(OBJECTS) libdpkg.a diff -Nru /tmp/file6ljl7n/dpkg-1.10.18/lib/fields.c /tmp/fileUfdG3B/dpkg-1.10.18/lib/fields.c --- /tmp/file6ljl7n/dpkg-1.10.18/lib/fields.c 2003-10-25 16:03:20.000000000 -0400 +++ /tmp/fileUfdG3B/dpkg-1.10.18/lib/fields.c 2003-12-18 16:39:37.000000000 -0500 @@ -28,6 +28,7 @@ #include #include #include "parsedump.h" +#include "multiarch.h" static int convert_string (const char *filename, int lno, const char *what, int otherwise, @@ -269,10 +270,11 @@ const char *value, const struct fieldinfo *fip) { char c1, c2; const char *p, *emsg; - const char *depnamestart, *versionstart; - int depnamelength, versionlength; - static int depnameused= 0, versionused= 0; - static char *depname= NULL, *version= NULL; + const char *depnamestart, *versionstart, *abistart; + int depnamelength, versionlength, abilength; + static int depnameused= 0, versionused= 0, abiused= 0; + static char *depname= NULL, *version= NULL, *abi= NULL; + int abi_id; struct dependency *dyp, **ldypp; struct deppossi *dop, **ldopp; @@ -291,9 +293,9 @@ for (;;) { /* loop creating new struct deppossi's */ depnamestart= p; /* skip over package name characters */ - while (*p && !isspace(*p) && *p != '(' && *p != ',' && *p != '|') { + while (*p && !isspace(*p) && *p != '(' && *p != ',' && *p != '|' && *p != '/') { p++; - } +} depnamelength= p - depnamestart ; if (depnamelength >= depnameused) { depnameused= depnamelength; @@ -320,6 +322,58 @@ * links from the depended on packages to dop are left undone. */ dop->cyclebreak= 0; + dop->depabi = -1; /* no ABI particular required */ +/* we may have an optional /abi reference */ + if (*p == '/') { /* if we have a versioned relation */ + abistart = ++p; + while (*p && !isspace(*p) && *p != '(' && *p != ',' && *p != '|' ) { + p++; + } + abilength= p - abistart ; + if (abilength >= abiused) { + abiused= abilength; + abi= realloc(abi,abilength+1); + } + strncpy(abi, abistart, abilength); + *(abi + abilength)= 0; + + if (0 == strcasecmp (abi, "abi")) { + /* if we have /abi then we need to look up the ABI of the + * architecture */ + + abi_id = lookup_abi_of_arch_name (pifp->architecture); + + if (abi_id < 0) { + parseerr(NULL,filename,lno, warnto, warncount, pigp,0, + _("`%s' field, ABI of `%s' is unknown"), + fip->name, pifp->architecture); + } + + } else { + + /* otherwise we use the /${whatever} to look up the abi + * index */ + + abi_id = enum_of_abi (abi); + + if (abi_id < 0) { + parseerr(NULL,filename,lno, warnto, warncount, pigp,0, + _("`%s' field, invalid abi name `%s'"), + fip->name, abi); + } + + } + +#if 1 + fprintf (stderr, "parsing %s: filename=%s, fip->name=%s, value=%s, abi=%s (%d)\n", + pigp->name, filename, fip->name, value, abi, abi_id); +#endif + + /* parsing here is incomplete... we still need to lookup the abi in + * subarchtable, get the index and store it in a variable of 'dop' -- + * that also needs to be added */ + + } /* skip whitespace after packagename */ while (isspace(*p)) p++; if (*p == '(') { /* if we have a versioned relation */ diff -Nru /tmp/file6ljl7n/dpkg-1.10.18/lib/multiarch.c /tmp/fileUfdG3B/dpkg-1.10.18/lib/multiarch.c --- /tmp/file6ljl7n/dpkg-1.10.18/lib/multiarch.c 1969-12-31 19:00:00.000000000 -0500 +++ /tmp/fileUfdG3B/dpkg-1.10.18/lib/multiarch.c 2004-01-03 15:40:04.000000000 -0500 @@ -0,0 +1,1043 @@ +/* + * dpkg - main program for package management + * multiarch.c - support for multiple architectures + * + * Copyright (C) 2003 Bart Trojanowski + * + * This 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 2, + * or (at your option) any later version. + * + * This is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with dpkg; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +//#include "filesdb.h" +//#include "main.h" +//#include "archives.h" + +#include "multiarch.h" + +#define DPKG_SUBARCHTABLE "/usr/share/dpkg/subarchtable" +//#define DPKG_SUBARCHTABLE "./subarchtable" + +/* the database storage of all archs */ +static char *archs_buf = NULL; /* read the file into this buffer */ +typedef struct arch_s { + // ARCHITECTURE: # name of the architecture + char *name; + + // ALIASES: , ... # other names for this architecture + + // BITS: # machine word width + int bits; + + // ABI: # library ABI format + char *abi; + abi_id_t abi_id; + + // COMPAT: , ... # compatible/emulated architecture + int subarch_cnt; + char **subarch_names; + arch_id_t *subarch_ids; + + // LIB_DIR: # default placement for native libs + // LIB_DIR_i686: # placement for 'i686' libs + // BUILD_CFLAGS: # set CFLAGS when running a build + +} archinfo_t; +static archinfo_t *archs = NULL; +static int arch_cnt = 0; + +/* the database of ABI names */ +static const char **abis = NULL; +static int abi_cnt = 0; + +/* local function prototypes */ +static int lcl_test_support_for_arch (arch_id_t, arch_id_t); + +static int parse_subarchtable (void); +static void finalize_subarchtable (void); +static int split_rfc822_line (char *line, char **tag, char **value); +static int parse_line (const char *tag, char *value, archinfo_t *arch); + +static int assert_arch_valid (const char *arch); +static int assert_abi_valid (const char *arch); +static int assert_token_valid (const char *token); + +#define ASSERT_VALID_SUBARCHTABLE ({ if (! parse_subarchtable ()) \ + ohshit ( _( "failed to parse subarchtable" ) ); }) + +#if 0 +#define prsdbg(f,a...) fprintf (stderr, f, ## a) +#else +#define prsdbg(f,a...) ({ /* do nothing */ }) +#endif + +/* ------------------------------------------------------------------------ */ +/* main entry point into this module */ + +/* given an architecture name return the enumared ID */ +arch_id_t +enum_of_arch(const char *name) +{ + int id; + + if (name == NULL) + return ARCH_ID_INVALID; + + /* continue only if we can parse the architectures file; + * or have parsed it already */ + ASSERT_VALID_SUBARCHTABLE; + + for (id=0; idname)) + /* found */ + return id; + } + + /* not found */ + return ARCH_ID_INVALID; +} + +/* given an architecture enumerated ID return the name */ +const char * +arch_of_enum(arch_id_t id) +{ + archinfo_t *arch = &archs[id]; + + /* continue only if we can parse the architectures file; + * or have parsed it already */ + ASSERT_VALID_SUBARCHTABLE; + + if (! arch_enum_valid(id)) + /* bad ID */ + return NULL; + + /* good ID */ + return arch->name; +} + +/* return true if arch enum provided is in a valid range */ +int +arch_enum_valid (arch_id_t id) +{ + archinfo_t *arch = &archs[id]; + + /* continue only if we can parse the architectures file; + * or have parsed it already */ + ASSERT_VALID_SUBARCHTABLE; + + if (id < 0 || id >= arch_cnt || !arch->name ) + /* bad ID */ + return 0; + + /* good ID */ + return 1; +} + +/* this function returns NULL if the deb_arch can be installed on sys_arch + * otherwise an error string is returned */ +const char * +test_support_for_arch_by_name (const char *const deb_arch, const char *const sys_arch) +{ + arch_id_t deb_arch_id, sys_arch_id; + + if (deb_arch == NULL) + return _( "deb Architecture is set to NULL" ); + + if (sys_arch == NULL) + return _( "host Architecture is set to NULL" ); + + if (0 == strcmp (deb_arch, "all")) + /* we can install this one anywhere */ + return NULL; + + /* continue only if we can parse the architectures file; + * or have parsed it already */ + ASSERT_VALID_SUBARCHTABLE; + + deb_arch_id = enum_of_arch (deb_arch); + if (! arch_enum_valid (deb_arch_id)) + return _( "unknown deb Architecture name" ); + + sys_arch_id = enum_of_arch (sys_arch); + if (! arch_enum_valid (sys_arch_id)) + return _( "unknown host Architecture name" ); + + return (test_support_for_arch (deb_arch_id, sys_arch_id)); + +} + +/* this function returns NULL if the deb_arch can be installed on sys_arch + * otherwise an error string is returned */ +const char * +test_support_for_arch (arch_id_t deb_arch, arch_id_t sys_arch) +{ + /* bail out early if we have the same architecture */ + if (deb_arch == sys_arch) + return NULL; + + /* continue only if we can parse the architectures file; + * or have parsed it already */ + ASSERT_VALID_SUBARCHTABLE; + + if (! lcl_test_support_for_arch (deb_arch, sys_arch)) + return _( "package cannot be installed on host architecture" ); + + return NULL; +} + +/* this function returns NULL if both architectures use the same ABI + * otherwise an error string is returned */ +const char* +test_compatible_abi (arch_id_t a_id, arch_id_t b_id) +{ + archinfo_t *a_arch, *b_arch; + + /* continue only if we can parse the architectures file; + * or have parsed it already */ + ASSERT_VALID_SUBARCHTABLE; + + /* make sure we have valid arch ID's */ + if ( !arch_enum_valid (a_id) + || !arch_enum_valid (b_id)) + return _( "invalid subarchtable ID's" ); + + /* get archs */ + a_arch = &archs[a_id]; + b_arch = &archs[b_id]; + + /* make sure they are valid */ + if ( !a_arch->name || !b_arch->name ) + return _( "subarchtable table is corrupt" ); + + if ( 0 == strcasecmp (a_arch->abi, b_arch->abi) ) + return NULL; + + return _( "architectures do not share a common ABI" ); +} + +abi_id_t +enum_of_abi (const char *name) +{ + int id; + + if (name == NULL) + return ARCH_ID_INVALID; + + /* continue only if we can parse the architectures file; + * or have parsed it already */ + ASSERT_VALID_SUBARCHTABLE; + + for (id=0; id= abi_cnt) + /* bad ID */ + return 0; + + if (NULL == abis[id]) + /* name not set */ + return 0; + + /* good ID */ + return 1; +} + +/* this function will return the ABI ID of the Architecture + * identified by its ARCH ID */ +abi_id_t +lookup_abi_of_arch (arch_id_t arch_id) +{ + archinfo_t *arch; + + /* continue only if we can parse the architectures file; + * or have parsed it already */ + ASSERT_VALID_SUBARCHTABLE; + + /* do we have a valid arch? */ + if (! arch_enum_valid (arch_id)) + return ABI_ID_INVALID; + + arch = &archs[arch_id]; + + return arch->abi_id; +} + +/* this function will return the ABI ID of the Architecture + * identified by its name */ +abi_id_t +lookup_abi_of_arch_name (const char *const arch_name) +{ + arch_id_t arch_id; + + /* continue only if we can parse the architectures file; + * or have parsed it already */ + ASSERT_VALID_SUBARCHTABLE; + + arch_id = enum_of_arch (arch_name); + /* don't test the arch_id validity since + * lookup_abi_of_arch() will do that */ + + return lookup_abi_of_arch (arch_id); +} + +/* this function returns true if the package (pipf) satisfies the + * abi dependency (dep->depabi) */ +int +abisatisfied(struct pkginfoperfile *pipf, struct deppossi *dep) +{ + arch_id_t pkg_arch_id; + abi_id_t pkg_abi_id, dep_abi_id; + + /* continue only if we can parse the architectures file; + * or have parsed it already */ + ASSERT_VALID_SUBARCHTABLE; + + /* do we actually need to check the package? */ + dep_abi_id = dep->depabi; + if (! abi_enum_valid (dep_abi_id) ) + /* dependency does not require any abi check */ + return 1; + +#if 1 /* HACK!!! */ + + /* until dpkg knows that is installed we have to ignore lookups with + * pipf->architecture set to NULL */ + + if (pipf->architecture == NULL) { + fprintf (stderr, "WARNING: %s is installed but dpkg does not know " + "what Architecture it is.\n", + dep->ed->name); + return 1; + } + +#endif + + pkg_arch_id = enum_of_arch (pipf->architecture); + if (! arch_enum_valid (pkg_arch_id) ) { + ohshit ( _( "%s: unknown Architecture '%s'" ), + dep->ed->name, + pipf->architecture); + } + pkg_abi_id = archs[pkg_arch_id].abi_id; + if (! abi_enum_valid (pkg_abi_id) ) { + ohshit ( _( "unknown ABI of Architecture '%s'" ), + pipf->architecture); + } + + /* we match if the provided and depended ABI is the same */ + return ( pkg_abi_id == dep_abi_id ); +} + + +/* ------------------------------------------------------------------------ */ +/* helper functions */ + +/* do a recursive test on subarchtable, parse DPKG_SUBARCHTABLE if needed; + * return non-zero if deb_arch can be installed on sys_arch */ +static int +lcl_test_support_for_arch (arch_id_t deb_arch_id, arch_id_t sys_arch_id) +{ + int s; + archinfo_t *arch; + + /* do we have a direct match */ + if (deb_arch_id == sys_arch_id) + return 1; + + if (!arch_enum_valid (sys_arch_id)) + return 0; + arch = &archs[sys_arch_id]; + + /* compare the debian architecture with each subarch */ + for (s=0; s < arch->subarch_cnt; s++) { + + /* this is a valid subarch of the sys_arch_id */ + arch_id_t sub_arch_id = arch->subarch_ids[s]; + + /* if there is no match try the next subarch */ + if (! lcl_test_support_for_arch + (deb_arch_id, sub_arch_id)) + continue; + + /* found a match, return success */ + prsdbg ("_%s.deb can be installed on %s\n", + arch_of_enum (deb_arch_id), + arch->name); + + return 1; + } + + /* we found nothing compatible */ + return 0; +} + +/* ---------------------------------------------------------------------- */ +/* parser code starts here */ + +/* parse the DPKG_SUBARCHTABLE file and store results in archs table; + * return 0 on failure, 1 on success */ +static int +parse_subarchtable (void) +{ + int rc, fd, max, line_no, last_empty; + struct stat st; + size_t archs_alloc; + archinfo_t arch_defaults = {0,}; + archinfo_t *arch; + char *p, *t; + + /* return success if we have a valid table already */ + if (arch_cnt>0 && archs && archs_buf) + return 1; + + /* return ailure if we failed previously */ + if (arch_cnt==-1) + return 0; + + /* get the file */ + fd = open (DPKG_SUBARCHTABLE, O_RDONLY); + if (fd < 0) { + fprintf (stderr, "open(\"%s\"): %s\n", + DPKG_SUBARCHTABLE, + strerror (errno)); + goto error_on_open; + } + + rc = fstat (fd, &st); + if (rc < 0) + goto error_with_file; + + /* get the flat file into a buffer */ + archs_buf = malloc (st.st_size+1); + if (NULL == archs_buf) { + fprintf (stderr, "failed to allocate %ld byte buffer\n", + st.st_size+1); + goto error_with_file; + } + + rc = read (fd, archs_buf, st.st_size); + if (rc < 0) { + perror ("read(subarchtable)"); + goto error_with_archs_buf; + } + archs_buf[rc] = 0; + + /* count the maximum number of lines - we will assume we have this + * many arches at maxium */ + p = archs_buf; + max = 2; + while (*p) { + if (*p == '\n' || *p == '\r') + max ++; + p++; + } + + if (!max) { + fprintf (stderr, "%s is empty\n", DPKG_SUBARCHTABLE); + goto error_with_archs_buf; + } + + /* build the array of architectures */ + archs_alloc = (max+1) * sizeof (archinfo_t); + archs = malloc (archs_alloc); + if (NULL == archs) { + fprintf (stderr, "failed to allocate %lu byte buffer\n", + archs_alloc); + goto error_with_archs_buf; + } + + memset (archs, 0, archs_alloc); + + p = archs_buf; + arch_cnt = -1; + arch = NULL; + line_no = 0; + last_empty = !0; + while ( (t = strsep (&p, "\n\r")) != NULL ) { + + char *tag, *value; + + line_no ++; + + /* empty line or invalid length... skip it */ + if (!*t || t>=p) { + last_empty = !0; + continue; + } + + /* split it into the tag and value */ + rc = split_rfc822_line (t, &tag, &value); + if (rc) { + /* bail if we cannot parse the line */ + ohshit(_("%s: invalid line format:\n\t%s\n"), + DPKG_SUBARCHTABLE, t); + } + + /* skip over blank lines and comments */ + if (!tag || !*tag || *tag == '#') { + last_empty = !0; + continue; + } + + /* defaults? */ + if (0 == strcmp (tag, "DEFAULTS")) { + if (!last_empty || arch_cnt>=0 || arch) + ohshit(_("%s: DEFAULTS must be the first line " + "of first block if defined\n"), + DPKG_SUBARCHTABLE); + + arch = &arch_defaults; + memset (arch, 0, sizeof (archinfo_t)); + //arch->name = NULL; + + continue; + } + + /* new architecture? */ + if (0 == strcmp (tag, "ARCHITECTURE")) { + if (!last_empty) + ohshit(_("%s: ARCHITECTURE must be the first line " + "of first block if defined\n"), + DPKG_SUBARCHTABLE); + + /* initialize the new architecture */ + arch_cnt++; + arch = &archs[arch_cnt]; + memcpy (arch, &arch_defaults, sizeof (archinfo_t)); + + rc = assert_arch_valid (value); + if (rc) + ohshit(_("%s: architecture name '%s' is invalid \n"), + DPKG_SUBARCHTABLE, value); + + arch->name = value; + + continue; + } + + /* anything else belongs to the current architecture block */ + rc = parse_line (tag, value, arch); + if (rc) { + /* bail if we cannot parse the line */ + ohshit(_("%s: could not parse line:\n\t%s\n"), + DPKG_SUBARCHTABLE, t); + } + + } + archs[arch_cnt].name = NULL; + + /* look up indexes for all the subarchs */ + finalize_subarchtable (); + + /* and we are done */ + close (fd); + + return 1; + + //free (archs); + //archs = NULL; +error_with_archs_buf: + free (archs_buf); + archs_buf = NULL; +error_with_file: + close (fd); +error_on_open: + fprintf (stderr, "WARNING: ignoring subarch support\n"); + arch_cnt = -1; /* this will cause the parser to not parse again */ + return 0; +} + +/* ---------------------------------------------------------------------- */ +/* assert code */ + +static void finalize_arch (archinfo_t *arch); + +/* this function looks up self referencing IDs in the subarch table */ +static void +finalize_subarchtable (void) +{ + size_t abis_alloc_len; + arch_id_t id; /* arch id */ + + /* allocate the buffer for ABI names; there can be no more + * ABI names then there are architectures */ + abi_cnt = 0; + abis_alloc_len = sizeof (char*) * arch_cnt; + abis = malloc (abis_alloc_len); + + /* this should not happen often :) */ + if (abis == NULL) + ohshit ( _("Could not allocate %lu bytes for ABI names"), + abis_alloc_len); + + for (id=0; idsubarch_cnt; ndx++) { + + const char *subarch = arch->subarch_names[ndx]; + + if (0 == strcmp (subarch, "all")) + continue; + + /* look up the subarch name and store the ID */ + sid = enum_of_arch (subarch); + + if (! arch_enum_valid (sid)) + ohshit ( _("No entry in subarchtable for '%s', a subarch of %s."), + arch->subarch_names[ndx], arch->name); + + arch->subarch_ids[ndx] = sid; + + /* store the ABI name in the ABI table */ + aid = enum_of_abi (arch->abi); + + if (! arch_enum_valid (aid)) { + /* add it to the table */ + abis[abi_cnt++] = arch->abi; + } + } + +} + +/* ---------------------------------------------------------------------- */ +/* some helper code */ + +static inline char * +ltrim (char *str) +{ + char *p = str; + while (*p && isspace(*p)) p++; + return p; +} + +static inline char * +rtrim (char *str) +{ + char *p = str; + while (*p && !isspace(*p)) p++; + *p=0; + return str; +} + +static inline char * +trim (char *str) +{ + return rtrim (ltrim (str)); +} + +/** 0 on success, unix error code on error */ +static int +assert_token_valid (const char *token) +{ + const char *p = token; + int rc; + + /* assume invalid */ + rc = -EINVAL; + + /* test first character */ + if ( !(*p >= 'A' && *p <= 'Z') + && !(*p >= '0' && *p <= '9') ) { + prsdbg ("don't like '%c' (1st)\n", *p); + goto bail; + } + + /* test teh rest of the token */ + for (++p; *p; p++) { + + if ( *p == '_' || (*p >= 'A' && *p <= 'Z') + || (*p >= 'a' && *p <= 'z') + || (*p >= '0' && *p <= '9') ) + continue; + + prsdbg ("don't like '%c' (%ld)\n", *p, p-token); + + goto bail; + } + + + rc = 0; +bail: + return rc; +} + +/** 0 on success, unix error code on error */ +static int +assert_arch_valid (const char *arch) +{ + int rc; + const char *p; + + rc = -EINVAL; + + for (p=arch; *p; p++) { + + if ( (*p >= 'a' && *p <= 'z') || (*p >= '0' && *p <= '9') ) + continue; + + prsdbg ("don't like '%c' (%ld)\n", *p, p-arch); + + goto bail; + } + + + rc = 0; +bail: + return rc; +} + +/** 0 on success, unix error code on error */ +static int +assert_abi_valid (const char *abi) +{ + /* for now an abi has the same restrictions as an arch */ + return assert_arch_valid (abi); +} + +/** modify the 'line' in place and return pointers to the tag and value. + * Given something like "foo: bar\n" this function will return pointers to + * "foo\0" and "bar\0" but line will be consumed. */ +static int +split_rfc822_line (char *line, char **tag, char **value) +{ + int rc; + char *str = line; + char *tok; + + prsdbg ("S: %s\n", line); + + /* comment */ + if (*str == '#') { + *tag = str; + *(str+1) = 0; + *value = str+2; + return 0; + } + + /* invalid first character */ + if (!isalpha(*str)) { + /* bail if we get a bad token */ + ohshit(_("%s: invalid first char in line:\n\t%s\n"), + DPKG_SUBARCHTABLE, line); + } + + /* assume failure */ + rc = -EINVAL; + + /* get the token name */ + tok = strsep (&str, ":"); + if (tok == NULL || str == NULL) + goto error_splitting; + + /* remove leading and trailing spaces of token */ + tok = trim (tok); + + if (!*tok || isspace (*tok)) + goto error_token; + + rc = assert_token_valid (tok); + if (rc) { + ohshit(_("%s: invalid token in:\n\t%s\n"), + DPKG_SUBARCHTABLE, line); + } + + *tag = tok; + + /* remove leading and trailing spaces of value */ + str = trim (str); + + *value = str; + + return 0; + +error_token: +error_splitting: + return rc; +} + +/* ---------------------------------------------------------------------- */ +/* next section parses individual lines */ + +/* forward declarations of individual line parsers */ +static int parse_bits_line (const char*, char*, archinfo_t*); +static int parse_abi_line (const char*, char*, archinfo_t*); +static int parse_compat_line (const char*, char*, archinfo_t*); + +static int ignore_line (const char*, char*, archinfo_t*); + +/* database of tags we can parse */ +static struct { + const char *name; + ssize_t len; /* if full, set to -1 */ + int (*fn)(const char *tag, char *value, archinfo_t *arch); + +#define FULL_PARSER_INIT(n,f) \ + { .name = n, .len = -1, .fn = f } +#define PART_PARSER_INIT(n,f) \ + { .name = n, .len = strlen(n), .fn = f } + +} table_line_parsers[] = { + FULL_PARSER_INIT ( "ALIASES", ignore_line ), + FULL_PARSER_INIT ( "BITS", parse_bits_line ), + FULL_PARSER_INIT ( "ABI", parse_abi_line ), + FULL_PARSER_INIT ( "COMPAT", parse_compat_line ), + FULL_PARSER_INIT ( "LIB_DIR", ignore_line ), + + PART_PARSER_INIT ( "LIB_DIR_", ignore_line ), + PART_PARSER_INIT ( "BUILD_", ignore_line ), + + { .name = NULL, .len = 0, } +}; + +/* main parser entry point */ +static int +parse_line (const char *tag, char *value, archinfo_t *arch) +{ + int rc; + typeof (table_line_parsers[0]) *parser; + + prsdbg ("P: %s.%s = %s\n", arch->name, tag, value); + + for (parser = table_line_parsers; + parser && parser->name; parser ++) { + + int match = 0; + + /* skip over if NULL function pointer */ + if (parser->len == 0 || parser->fn == NULL) + continue; + + /* do a full match */ + if (parser->len == -1 + && 0 == strcmp (tag, parser->name)) { + + match = 1; + } + + /* do a partial match */ + if (parser->len > 0 + && 0 == strncmp (tag, parser->name, + parser->len)) { + match = 1; + } + + /* try the next one */ + if (!match) + continue; + + /* process using the matched parser */ + rc = parser->fn (tag, value, arch); + if (rc) + ohshit( _("failed to parse %s line " + "in subarchtable\n"), tag); + + /* done */ + return 0; + + } + + /* nothing matched */ + ohshit( _("don't know how to parse %s from subarchtable\n"), tag); + + return -EINVAL; +} + +/* parse BITS tag */ +static int +parse_bits_line (const char *tag, char *bits, archinfo_t *arch) +{ + /* convert to a number */ + arch->bits = atoi (bits); + + /* test for supported bits values */ + switch (arch->bits) { + case 16: + case 32: + case 64: + case 128: + return 0; + } + + /* we don't know this one */ + ohshit( _("unknown BITS value (%s) in %s architecture\n"), + bits, arch->name); + + return -EINVAL; +} + +/* parse ABI tag */ +static int +parse_abi_line (const char *tag, char *abi, archinfo_t *arch) +{ + int rc; + + /* test to make sure it matches what is expected */ + rc = assert_abi_valid (abi); + if (rc) + ohshit ( _("%s has an invalid ABI '%s'\n"), + arch->name, abi); + + arch->abi = abi; + + return 0; +} + +/* parse COMPAT tag */ +static int +parse_compat_line (const char *tag, char *compat, archinfo_t *arch) +{ + int rc; + char *p = trim (compat); + char *sub, *t; + int max, cnt; + + /* assume failure */ + rc = -EINVAL; + + /* guess number of words */ + t = p; + max = 1; + while (*t && *t!='#') { + max ++; + while (*t && isspace(*t)) t++; + while (*t && *t!='#' && !isspace(*t)) t++; + } + *t = 0; + + /* allocate the array of pointers for this */ + arch->subarch_names = malloc (max * sizeof (char*)); + if (arch->subarch_names == NULL) + goto error_alloc_names; + + /* allocate the array of subarch ID's */ + arch->subarch_ids = malloc (max * sizeof (arch_id_t)); + if (arch->subarch_ids == NULL) + goto error_alloc_ids; + + /* invalidate all entries */ + memset (arch->subarch_ids, -1, max * sizeof (arch_id_t)); + + /* parse for real */ + cnt = 0; + while ( (sub = strsep (&p, ",")) != NULL ) { + + sub = trim (sub); + + /* comment on rest of line */ + if (*sub == '#') + break; + + /* invalid first character */ + rc = assert_arch_valid (sub); + if (rc) { + fprintf (stderr, "%s has an invalid subarch '%s'\n", + arch->name, sub); + goto error_parsing_line; + } + + /* store and advance */ + arch->subarch_names[cnt++] = sub; + } + arch->subarch_cnt = cnt; + arch->subarch_names[cnt] = NULL; + + return 0; + +error_parsing_line: + arch->subarch_cnt = 0; + free (arch->subarch_ids); +error_alloc_ids: + free (arch->subarch_names); +error_alloc_names: + arch->subarch_names = NULL; + return rc; +} + +/* warn that we are ignoring this tag */ +static int +ignore_line (const char *tag, char *compat, archinfo_t *arch) +{ +#if 0 + fprintf (stderr, "WARNING: ignoring %s %s tags in subarchtable\n", + ( arch->name ) ? ( arch->name) : "DEFAULTS", + tag); +#endif + + return 0; +} + diff -Nru /tmp/file6ljl7n/dpkg-1.10.18/lib/startup.c /tmp/fileUfdG3B/dpkg-1.10.18/lib/startup.c --- /tmp/file6ljl7n/dpkg-1.10.18/lib/startup.c 1969-12-31 19:00:00.000000000 -0500 +++ /tmp/fileUfdG3B/dpkg-1.10.18/lib/startup.c 2003-11-27 23:15:52.000000000 -0500 @@ -0,0 +1,65 @@ +/* + * dpkg - main program for package management + * main.c - main program + * + * Copyright (C) 1994,1995 Ian Jackson + * + * This 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 2, + * or (at your option) any later version. + * + * This is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with dpkg; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +void standard_startup(jmp_buf *ejbuf, int argc, const char *const **argv, const char *prog, int loadcfg, const struct cmdinfo cmdinfos[]) { + + setlocale(LC_ALL, ""); + bindtextdomain(PACKAGE, LOCALEDIR); + textdomain(PACKAGE); + + if (setjmp(*ejbuf)) { /* expect warning about possible clobbering of argv */ + error_unwind(ehflag_bombout); exit(2); + } + push_error_handler(ejbuf,print_error_fatal,0); + + umask(022); /* Make sure all our status databases are readable. */ + + if (loadcfg) + loadcfgfile(prog, cmdinfos); + + myopt(argv,cmdinfos); +} + +void standard_shutdown(int freemem) { + set_error_display(0,0); + error_unwind(ehflag_normaltidy); + if (freemem) + nffreeall(); +} diff -Nru /tmp/file6ljl7n/dpkg-1.10.18/main/Makefile.in /tmp/fileUfdG3B/dpkg-1.10.18/main/Makefile.in --- /tmp/file6ljl7n/dpkg-1.10.18/main/Makefile.in 2002-08-24 15:54:18.000000000 -0400 +++ /tmp/fileUfdG3B/dpkg-1.10.18/main/Makefile.in 2003-12-15 23:14:08.000000000 -0500 @@ -8,7 +8,7 @@ SOURCES = main.c enquiry.c filesdb.c archives.c processarc.c \ cleanup.c select.c packages.c configure.c remove.c \ - help.c depcon.c errors.c update.c + help.c depcon.c errors.c update.c MAN8PAGES = dpkg.8 dpkg-query.8 diff -Nru /tmp/file6ljl7n/dpkg-1.10.18/main/archives.c /tmp/fileUfdG3B/dpkg-1.10.18/main/archives.c --- /tmp/file6ljl7n/dpkg-1.10.18/main/archives.c 2003-10-25 16:03:20.000000000 -0400 +++ /tmp/fileUfdG3B/dpkg-1.10.18/main/archives.c 2003-12-18 16:39:30.000000000 -0500 @@ -46,6 +46,7 @@ #include "filesdb.h" #include "main.h" #include "archives.h" +#include "multiarch.h" /* We shouldn't need anymore than 10 conflictors */ struct pkginfo *conflictor[20]; @@ -244,6 +245,7 @@ debug(dbg_depcondetail,"does_replace ... found old, version %s", versiondescribe(&dep->list->version,vdew_always)); if (!versionsatisfied(&oldpigp->installed,dep->list)) continue; + if (!abisatisfied(&oldpigp->installed,dep->list)) continue; debug(dbg_depcon,"does_replace ... yes"); return 1; } diff -Nru /tmp/file6ljl7n/dpkg-1.10.18/main/depcon.c /tmp/fileUfdG3B/dpkg-1.10.18/main/depcon.c --- /tmp/file6ljl7n/dpkg-1.10.18/main/depcon.c 2003-10-25 16:03:20.000000000 -0400 +++ /tmp/fileUfdG3B/dpkg-1.10.18/main/depcon.c 2003-12-18 16:39:30.000000000 -0500 @@ -30,6 +30,7 @@ #include #include "main.h" +#include "multiarch.h" struct cyclesofarlink { struct cyclesofarlink *back; @@ -157,6 +158,7 @@ struct deppossi *possi; struct deppossi *provider; int nconflicts; + int goodver, goodabi; /* Use this buffer so that when internationalisation comes along we * don't have to rewrite the code completely, only redo the sprintf strings @@ -218,18 +220,45 @@ sprintf(linebuf,_(" %.250s is to be deconfigured.\n"),possi->ed->name); break; case itb_installnew: - if (versionsatisfied(&possi->ed->available,possi)) return 1; - sprintf(linebuf,_(" %.250s is to be installed, but is version %.250s.\n"), + goodver = versionsatisfied(&possi->ed->available,possi); + goodabi = abisatisfied(&possi->ed->available,possi); + /* is everything good? */ + if (goodver && goodabi) return 1; + + /* print version warning */ + if (!goodver) { + sprintf(linebuf,_(" %.250s is to be installed, but is version %.250s.\n"), possi->ed->name, versiondescribe(&possi->ed->available.version,vdew_nonambig)); + } + + /* print ABI warning */ + if (!goodabi) { + sprintf(linebuf,_(" %.250s is to be installed, but requires ABI %.250s.\n"), + possi->ed->name, + abi_of_enum (possi->depabi)); + } break; case itb_normal: case itb_preinstall: switch (possi->ed->status) { case stat_installed: - if (versionsatisfied(&possi->ed->installed,possi)) return 1; - sprintf(linebuf,_(" %.250s is installed, but is version %.250s.\n"), + goodver = versionsatisfied(&possi->ed->available,possi); + goodabi = abisatisfied(&possi->ed->available,possi); + /* is everything good? */ + if (goodver && goodabi) return 1; + + /* print version warning */ + if (!goodver) { + sprintf(linebuf,_(" %.250s is installed, but is version %.250s.\n"), possi->ed->name, versiondescribe(&possi->ed->installed.version,vdew_nonambig)); + } + /* print ABI warning */ + if (!goodabi) { + sprintf(linebuf,_(" %.250s is installed, but requires ABI %.250s.\n"), + possi->ed->name, + abi_of_enum (possi->depabi)); + } break; case stat_notinstalled: /* Don't say anything about this yet - it might be a virtual package. @@ -250,6 +279,11 @@ possi->ed->name, versiondescribe(&possi->ed->available.version,vdew_nonambig)); break; + } else if (!abisatisfied(&possi->ed->installed, possi)) { + sprintf(linebuf, _(" %.250s is unpacked, but requires ABI %.250s.\n"), + possi->ed->name, + abi_of_enum (possi->depabi)); + break; } else if (!versionsatisfied3(&possi->ed->configversion, &possi->version,possi->verrel)) { sprintf(linebuf, _(" %.250s latest configured version is %.250s.\n"), @@ -351,6 +385,7 @@ break; case itb_installnew: if (!versionsatisfied(&possi->ed->available, possi)) break; + if (!abisatisfied(&possi->ed->available, possi)) break; sprintf(linebuf, _(" %.250s (version %.250s) is to be installed.\n"), possi->ed->name, versiondescribe(&possi->ed->available.version,vdew_nonambig)); @@ -365,6 +400,7 @@ break; default: if (!versionsatisfied(&possi->ed->installed, possi)) break; + if (!abisatisfied(&possi->ed->installed, possi)) break; sprintf(linebuf, _(" %.250s (version %.250s) is %s.\n"), possi->ed->name, versiondescribe(&possi->ed->installed.version,vdew_nonambig), diff -Nru /tmp/file6ljl7n/dpkg-1.10.18/main/enquiry.c /tmp/fileUfdG3B/dpkg-1.10.18/main/enquiry.c --- /tmp/file6ljl7n/dpkg-1.10.18/main/enquiry.c 2003-10-25 16:03:20.000000000 -0400 +++ /tmp/fileUfdG3B/dpkg-1.10.18/main/enquiry.c 2003-12-18 16:39:30.000000000 -0500 @@ -40,6 +40,7 @@ #include "filesdb.h" #include "main.h" +#include "multiarch.h" int pkglistqsortcmp(const void *a, const void *b) { const struct pkginfo *pa= *(const struct pkginfo**)a; @@ -339,7 +340,8 @@ possi=possi->next) { trypkg= possi->ed; if (!trypkg->available.valid) continue; - if (trypkg->files && versionsatisfied(&trypkg->available,possi)) { + if (trypkg->files && versionsatisfied(&trypkg->available,possi) + && abisatisfied(&trypkg->available,possi)) { if (trypkg->clientdata->istobe == itb_normal) { pkg= trypkg; break; } } if (possi->verrel != dvr_none) continue; diff -Nru /tmp/file6ljl7n/dpkg-1.10.18/main/main.c /tmp/fileUfdG3B/dpkg-1.10.18/main/main.c --- /tmp/file6ljl7n/dpkg-1.10.18/main/main.c 2003-10-25 16:03:21.000000000 -0400 +++ /tmp/fileUfdG3B/dpkg-1.10.18/main/main.c 2003-11-28 19:57:09.000000000 -0500 @@ -38,6 +38,8 @@ #include #include +#include + #include "main.h" static void printversion(void) { @@ -116,7 +118,7 @@ } const char thisname[]= "dpkg"; -const char architecture[]= ARCHITECTURE; +const char *architecture= ARCHITECTURE; const char printforhelp[]= N_("\ Type dpkg --help for help about installing and deinstalling packages [*];\n\ Use dselect for user-friendly package management;\n\ @@ -327,7 +329,7 @@ for (;;) { comma= strchr(value,','); - l= comma ? (int)(comma-value) : strlen(value); + l= comma ? (size_t)(comma-value) : (size_t)strlen(value); for (fip=forceinfos; fip->name; fip++) if (!strncmp(fip->name,value,l) && strlen(fip->name)==l) break; if (!fip->name) @@ -546,11 +548,35 @@ } } +/* this hack allows dpkg to belive that it's running on an i386 when + * in the 32bit personality */ +static void +revert_arch32 (void) +{ +#if 1 /* bart's hack */ + //fprintf (stderr, "architecture=%s\n", architecture); + if (0==strcmp (architecture,"amd64")) { + struct utsname utsname; + int rc = uname (&utsname); + //fprintf (stderr, "machine=%s\n", utsname.machine); + if (rc == 0 && utsname.machine[0]=='i' && 0==strcmp(utsname.machine+2,"86")) { + static char architecture32[128]; + //architecture="i386"; + snprintf (architecture32, 127, "%s", utsname.machine); + architecture = architecture32; + //fprintf (stderr, "using architecture=%s\n", + // architecture); + } + } +#endif +} int main(int argc, const char *const *argv) { jmp_buf ejbuf; static void (*actionfunction)(const char *const *argv); + revert_arch32(); + standard_startup(&ejbuf, argc, &argv, DPKG, 1, cmdinfos); if (!cipaction) badusage(_("need an action option")); diff -Nru /tmp/file6ljl7n/dpkg-1.10.18/main/main.h /tmp/fileUfdG3B/dpkg-1.10.18/main/main.h --- /tmp/file6ljl7n/dpkg-1.10.18/main/main.h 2002-05-20 01:56:01.000000000 -0400 +++ /tmp/fileUfdG3B/dpkg-1.10.18/main/main.h 2003-12-15 23:14:08.000000000 -0500 @@ -92,7 +92,7 @@ extern const char *admindir; extern const char *instdir; extern struct packageinlist *ignoredependss; -extern const char architecture[]; +extern const char *architecture; /* from filesdb.c */ diff -Nru /tmp/file6ljl7n/dpkg-1.10.18/main/packages.c /tmp/fileUfdG3B/dpkg-1.10.18/main/packages.c --- /tmp/file6ljl7n/dpkg-1.10.18/main/packages.c 2003-10-25 16:03:21.000000000 -0400 +++ /tmp/fileUfdG3B/dpkg-1.10.18/main/packages.c 2003-12-18 16:39:30.000000000 -0500 @@ -39,6 +39,7 @@ #include "filesdb.h" #include "main.h" +#include "multiarch.h" struct pkginqueue { struct pkginqueue *next; @@ -278,18 +279,27 @@ case stat_unpacked: case stat_halfconfigured: assert(possdependee->installed.valid); - if (checkversion && !versionsatisfied(&possdependee->installed,checkversion)) { - varbufaddstr(oemsgs,_(" Version of ")); - varbufaddstr(oemsgs,possdependee->name); - varbufaddstr(oemsgs,_(" on system is ")); - varbufaddstr(oemsgs,versiondescribe(&possdependee->installed.version, + if (checkversion) { + if (!versionsatisfied(&possdependee->installed,checkversion)) { + varbufaddstr(oemsgs,_(" Version of ")); + varbufaddstr(oemsgs,possdependee->name); + varbufaddstr(oemsgs,_(" on system is ")); + varbufaddstr(oemsgs,versiondescribe(&possdependee->installed.version, vdew_nonambig)); - varbufaddstr(oemsgs,".\n"); - assert(checkversion->verrel != dvr_none); - if (fc_depends) thisf= (dependtry >= 3) ? 2 : 1; - debug(dbg_depcondetail," bad version, returning %d",thisf); - (*interestingwarnings)++; - return thisf; + varbufaddstr(oemsgs,".\n"); + assert(checkversion->verrel != dvr_none); + if (fc_depends) thisf= (dependtry >= 3) ? 2 : 1; + debug(dbg_depcondetail," bad version, returning %d",thisf); + (*interestingwarnings)++; + return thisf; + } + if (!abisatisfied(&possdependee->installed,checkversion)) { + fprintf (stderr, "installed %s, dep %s\n", + possdependee->installed.architecture, + abi_of_enum (checkversion->depabi)); + + ohshit ( "TODO: finish off deppossi_ok_found()'s ABI testing." ); + } } if (possdependee->status == stat_installed) { debug(dbg_depcondetail," is installed, ok and found"); diff -Nru /tmp/file6ljl7n/dpkg-1.10.18/main/processarc.c /tmp/fileUfdG3B/dpkg-1.10.18/main/processarc.c --- /tmp/file6ljl7n/dpkg-1.10.18/main/processarc.c 2003-10-25 16:03:21.000000000 -0400 +++ /tmp/fileUfdG3B/dpkg-1.10.18/main/processarc.c 2004-01-03 15:37:42.000000000 -0500 @@ -43,6 +43,7 @@ #include "filesdb.h" #include "main.h" #include "archives.h" +#include "multiarch.h" void process_archive(const char *filename) { static const struct TarFunctions tf = { @@ -50,6 +51,8 @@ tarobject, tarobject, tarobject, tarobject, tarobject }; + const char *emsg; + /* These need to be static so that we can pass their addresses to * push_cleanup as arguments to the cu_xxx routines; if an error occurs * we unwind the stack before processing the cleanup list, and these @@ -207,12 +210,15 @@ return; } - if (pkg->available.architecture && *pkg->available.architecture && - strcmp(pkg->available.architecture,"all") && - strcmp(pkg->available.architecture,architecture)) - forcibleerr(fc_architecture, - _("package architecture (%s) does not match system (%s)"), - pkg->available.architecture,architecture); + /* make sure that the package architecture can be installed on this host */ + emsg = test_support_for_arch_by_name (pkg->available.architecture, + architecture); + if (emsg) { + forcibleerr(fc_architecture, + _("package architecture (%s) does not " + "match system (%s) - %s"), + pkg->available.architecture, architecture, emsg); + } if (!pkg->installed.valid) blankpackageperfile(&pkg->installed); assert(pkg->available.valid); @@ -280,8 +286,8 @@ filesdbinit(); if (pkg->status != stat_notinstalled && pkg->status != stat_configfiles) - printf(_("Preparing to replace %s %s (using %s) ...\n"), - pkg->name, + printf(_("Preparing to replace %s/%s %s (using %s) ...\n"), + pkg->name, pkg->installed.architecture, versiondescribe(&pkg->installed.version,vdew_nonambig), pfilename); else diff -Nru /tmp/file6ljl7n/dpkg-1.10.18/scripts/Makefile.in /tmp/fileUfdG3B/dpkg-1.10.18/scripts/Makefile.in --- /tmp/file6ljl7n/dpkg-1.10.18/scripts/Makefile.in 2002-05-20 00:40:27.000000000 -0400 +++ /tmp/fileUfdG3B/dpkg-1.10.18/scripts/Makefile.in 2003-11-28 19:57:09.000000000 -0500 @@ -9,7 +9,8 @@ dpkg-gencontrol dpkg-shlibdeps dpkg-buildpackage \ dpkg-parsechangelog dpkg-distaddfile 822-date \ dpkg-scanpackages dpkg-scansources \ - dpkg-architecture dpkg-checkbuilddeps + dpkg-architecture dpkg-checkbuilddeps \ + dpkg-libinfo dpkg-subarchitecture SBIN_SCRIPTS = update-alternatives install-info \ dpkg-divert dpkg-statoverride cleanup-info diff -Nru /tmp/file6ljl7n/dpkg-1.10.18/scripts/controllib.pl /tmp/fileUfdG3B/dpkg-1.10.18/scripts/controllib.pl --- /tmp/file6ljl7n/dpkg-1.10.18/scripts/controllib.pl 2003-09-19 13:29:09.000000000 -0400 +++ /tmp/fileUfdG3B/dpkg-1.10.18/scripts/controllib.pl 2003-11-28 19:57:09.000000000 -0500 @@ -134,11 +134,25 @@ binmode(CDATA); $indices= &parsecdata('C',1,"control file $controlfile"); $indices >= 2 || &error("control file must have at least one binary package part"); + $lib64_arch=`dpkg-libinfo -qDEB_LIB64_ARCH`; for ($i=1;$i<$indices;$i++) { defined($fi{"C$i Package"}) || &error("per-package paragraph $i in control info file is ". "missing Package line"); + if (defined($fi{"C$i Package.64"}) && $lib64_arch == 1) { + if (defined($fi{"C$i Substvarname"})) { + $substvar{$fi{"C$i Substvarname"}} = $fi{"C$i Package.64"}; + } else { + $substvar{$fi{"C$i Package"}} = $fi{"C$i Package.64"}; + } + } else { + if (defined($fi{"C$i Substvarname"})) { + $substvar{$fi{"C$i Substvarname"}} = $fi{"C$i Package"}; + } else { + $substvar{$fi{"C$i Package"}} = $fi{"C$i Package"}; + } + } } defined($fi{"C Source"}) || &error("source paragraph in control info file is ". @@ -257,7 +271,10 @@ # many=1: many paragraphs like in source control file # many=-1: single paragraph of control data optionally signed local ($index,$cf,$paraborder); + local ($pkg,$pkg64,$vold,$lib64_arch); $index=''; $cf=''; $paraborder=1; + $pkg=0; $pkg64=0; + $lib64_arch=`dpkg-libinfo -qDEB_LIB64_ARCH`; while () { s/\s*\n$//; next if (m/^$/ and $paraborder); @@ -268,7 +285,8 @@ $cf= &capit($cf); $fi{"$source$index $cf"}= $v; $fi{"o:$source$index $cf"}= $1; - if (lc $cf eq 'package') { $p2i{"$source $v"}= $index; } + if (lc $cf eq 'package.64' && $lib64_arch == 1) { if ($pkg == 1) { $vold = $fi{"$source$index Package"}; delete $p2i{"$source $vold"}; } $p2i{"$source $v"}= $index; $pkg64 = 1;} + elsif (lc $cf eq 'package' && $pkg64 == 0) { $p2i{"$source $v"}= $index; $pkg = 1;} } elsif (m/^\s+\S/) { length($cf) || &syntax("continued value line not in field"); $fi{"$source$index $cf"}.= "\n$_"; @@ -278,6 +296,7 @@ $many= -2; } elsif (m/^$/) { $paraborder = 1; + $pkg=0; $pkg64=0; if ($many>0) { $index++; $cf=''; } elsif ($many == -2) { diff -Nru /tmp/file6ljl7n/dpkg-1.10.18/scripts/dpkg-architecture.pl /tmp/fileUfdG3B/dpkg-1.10.18/scripts/dpkg-architecture.pl --- /tmp/file6ljl7n/dpkg-1.10.18/scripts/dpkg-architecture.pl 2003-09-13 21:49:08.000000000 -0400 +++ /tmp/fileUfdG3B/dpkg-1.10.18/scripts/dpkg-architecture.pl 2003-12-14 16:02:49.000000000 -0500 @@ -40,7 +40,7 @@ # 1.0.7 -q should not imply -f, because this prevents setting # make variables with non-standard names correctly. -$version="1.0.0"; +$version="1.10.10"; $0 = `basename $0`; chomp $0; $dpkglibdir="/usr/lib/dpkg"; @@ -48,6 +48,9 @@ require 'controllib.pl'; %archtable=('i386', 'i386-linux', + 'i486', 'i486-linux', + 'i586', 'i586-linux', + 'i686', 'i686-linux', 'sparc', 'sparc-linux', 'sparc64', 'sparc64-linux', 'alpha', 'alpha-linux', @@ -69,7 +72,8 @@ 'freebsd-i386', 'i386-freebsd', 'netbsd-i386', 'i386-netbsdelf-gnu', 'darwin-powerpc', 'powerpc-darwin', - 'darwin-i386', 'i386-darwin'); + 'darwin-i386', 'i386-darwin', + 'amd64', 'x86_64-linux'); sub usageversion { print STDERR @@ -137,6 +141,14 @@ $gcc = ''; } else { chomp $gcc; + # special hack for a biarch i386/x86_64 compiler + if ($gcc eq 'i486-linux') { + my $multidir=`\${CC:-gcc} --print-multi-directory`; + chomp $multidir; + if ('64' eq $multidir) { + $gcc = 'x86_64-linux'; + } + } } if ($gcc ne '') { diff -Nru /tmp/file6ljl7n/dpkg-1.10.18/scripts/dpkg-genchanges.pl /tmp/fileUfdG3B/dpkg-1.10.18/scripts/dpkg-genchanges.pl --- /tmp/file6ljl7n/dpkg-1.10.18/scripts/dpkg-genchanges.pl 2003-09-16 14:06:27.000000000 -0400 +++ /tmp/fileUfdG3B/dpkg-1.10.18/scripts/dpkg-genchanges.pl 2003-11-28 19:57:09.000000000 -0500 @@ -156,6 +156,8 @@ close(FL); } +$lib64_arch=`dpkg-libinfo -qDEB_LIB64_ARCH`; + for $_ (keys %fi) { $v= $fi{$_}; if (s/^C //) { @@ -166,7 +168,10 @@ elsif (m/|^X[BS]+-|^Standards-Version$/i) { } else { &unknown('general section of control info file'); } } elsif (s/^C(\d+) //) { - $i=$1; $p=$fi{"C$i Package"}; $a=$fi{"C$i Architecture"}; + $i=$1; + if (defined($fi{"C$i Package.64"}) && $lib64_arch==1) { $p=$fi{"C$i Package.64"}; } + else { $p=$fi{"C$i Package"}; } + $a=$fi{"C$i Architecture"}; if (!defined($p2f{$p}) && not $sourceonly) { if ($a eq 'any' || ($a eq 'all' && !$archspecific) || grep($_ eq $substvar{'Arch'}, split(/\s+/, $a))) { @@ -200,7 +205,7 @@ $v = ''; } push(@archvalues,$v) unless !$v || $archadded{$v}++; - } elsif (m/^(Package|Essential|Pre-Depends|Depends|Provides)$/ || + } elsif (m/^(Package|Package.64|Substvarname|Essential|Pre-Depends|Depends|Provides)$/ || m/^(Recommends|Suggests|Enhances|Optional|Conflicts|Replaces)$/ || m/^X[CS]+-/i) { } else { diff -Nru /tmp/file6ljl7n/dpkg-1.10.18/scripts/dpkg-gencontrol.pl /tmp/fileUfdG3B/dpkg-1.10.18/scripts/dpkg-gencontrol.pl --- /tmp/file6ljl7n/dpkg-1.10.18/scripts/dpkg-gencontrol.pl 2003-10-27 14:04:07.000000000 -0500 +++ /tmp/fileUfdG3B/dpkg-1.10.18/scripts/dpkg-gencontrol.pl 2003-11-28 19:57:09.000000000 -0500 @@ -46,7 +46,7 @@ } $i=100;grep($fieldimps{$_}=$i--, - qw(Package Version Section Priority Architecture Essential + qw(Package Package.64 Substvarname Version Section Priority Architecture Essential Pre-Depends Depends Recommends Suggests Enhances Optional Conflicts Replaces Provides Installed-Size Origin Maintainer Bugs Source Description Build-Depends Build-Depends-Indep @@ -96,6 +96,8 @@ } } +$lib64_arch=`dpkg-libinfo -qDEB_LIB64_ARCH`; + &findarch; &parsechangelog; &parsesubstvars; @@ -127,9 +129,15 @@ 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/^(Description|Essential|Optional)$/) { $f{$_}= $v; + } elsif (m/^Package$/) { + if (defined($fi{"C$myindex Package.64"}) && $lib64_arch==1) { $f{$_}= $fi{"C$myindex Package.64"}; } + else { $f{$_}= $v; } + } elsif (m/^Package.64$|^Substvarname$/) { + # do nothing more } elsif (exists($pkg_dep_fields{$_})) { + $f{$_}= showdep(parsedep(substvars($v)), 0); } elsif (m/^Section$|^Priority$/) { $spvalue{$_}= $v; } elsif (m/^Architecture$/) { diff -Nru /tmp/file6ljl7n/dpkg-1.10.18/scripts/dpkg-libinfo.pl /tmp/fileUfdG3B/dpkg-1.10.18/scripts/dpkg-libinfo.pl --- /tmp/file6ljl7n/dpkg-1.10.18/scripts/dpkg-libinfo.pl 1969-12-31 19:00:00.000000000 -0500 +++ /tmp/fileUfdG3B/dpkg-1.10.18/scripts/dpkg-libinfo.pl 2003-12-11 11:51:26.000000000 -0500 @@ -0,0 +1,147 @@ +#! /usr/bin/perl +# +# dpkg-libinfo +# +# Copyright 2003 Gerhard Tonn +# +# 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 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# History +# 0.0.1 Initial release. + +$version="0.0.1"; +$0 = `basename $0`; chomp $0; + +$dpkglibdir="/usr/lib/dpkg"; +push(@INC,$dpkglibdir); +require 'controllib.pl'; + +%archtable=('i386', 'i386-linux', + 'sparc', 'sparc-linux', + 'sparc64', 'sparc64-linux', + 'alpha', 'alpha-linux', + 'm68k', 'm68k-linux', + 'arm', 'arm-linux', + 'powerpc', 'powerpc-linux', + 'mips', 'mips-linux', + 'mipsel', 'mipsel-linux', + 'sh3', 'sh3-linux', + 'sh4', 'sh4-linux', + 'sh3eb', 'sh3eb-linux', + 'sh4eb', 'sh4eb-linux', + 'hppa', 'hppa-linux', + 'hurd-i386', 'i386-gnu', + 's390', 's390-linux', + 's390x', 's390x-linux', + 'ia64', 'ia64-linux', + 'openbsd-i386', 'i386-openbsd', + 'freebsd-i386', 'i386-freebsd', + 'netbsd-i386', 'i386-netbsdelf-gnu', + 'darwin-powerpc', 'powerpc-darwin', + 'darwin-i386', 'i386-darwin', + 'amd64', 'x86_64-linux'); + +sub usageversion { + print STDERR +"Debian $0 $version. Copyright (C) 2003 Gerhard Tonn. +This is free software; see the GNU General Public Licence version 2 +or later for copying conditions. There is NO warranty. + +Usage: + $0 [