--- /dev/null
+--- aptitude-0.0.8.2/src/generic/aptcache.cc.orig Sat Apr 7 17:53:06 2001
++++ aptitude-0.0.8.2/src/generic/aptcache.cc Sat Apr 7 18:06:26 2001
+@@ -29,6 +29,7 @@
+ #include <apt-pkg/tagfile.h>
+ #include <apt-pkg/fileutl.h>
+ #include <apt-pkg/algorithms.h>
++#include <apt-pkg/systemfactory.h>
+ #ifdef HAVE_LIBAPT_PKG3
+ #include <apt-pkg/pkgsystem.h>
+ #include <apt-pkg/policy.h>
+@@ -163,7 +164,7 @@
+ if(!pkgDepCache::Init(&Prog))
+ return false;
+
+- string statedir=_config->FindDir("Dir::Aptitude::state", "/var/state/aptitude");
++ string statedir=_config->FindDir("Dir::Aptitude::state", "/var/lib/aptitude");
+ // Should this not go under Dir:: ? I'm not sure..
+ delete package_states;
+ package_states=new aptitude_state[Head().PackageCount];
+@@ -289,7 +290,7 @@
+ {
+ if(lock==-1)
+ return true;
+- string statefile=_config->FindDir("Dir::Aptitude::state", "/var/state/aptitude")+"pkgstates";
++ string statefile=_config->FindDir("Dir::Aptitude::state", "/var/lib/aptitude")+"pkgstates";
+
+ FileFd newstate(statefile+".new", FileFd::WriteEmpty);
+ if(!newstate.IsOpen())
+@@ -689,7 +690,8 @@
+ bool aptitudeCacheFile::Open(OpProgress &Progress, bool WithLock)
+ {
+ if(WithLock)
+- Lock=new pkgDpkgLock;
++ //Lock=new pkgDpkgLock;
++ Lock=new pkgRpmLock; // pkgDpkgLock;
+
+ if(_error->PendingError())
+ return false;
+@@ -700,7 +702,8 @@
+
+ if(WithLock)
+ {
+- pkgMakeStatusCache(List, Progress);
++ //pkgMakeStatusCache(List, Progress);
++ _system->makeStatusCache(List, Progress);
+ if(_error->PendingError())
+ return _error->Error(_("The package lists or status file could not be parsed or opened."));
+ if(!_error->empty())
+@@ -716,7 +719,8 @@
+ }
+ else
+ {
+- Map=pkgMakeStatusCacheMem(List, Progress);
++ //Map=pkgMakeStatusCacheMem(List, Progress);
++ Map=_system->makeStatusCacheMem(List, Progress);
+ Progress.Done();
+ if(!Map)
+ return false;
+--- aptitude-0.0.8.2/src/generic/aptcache.h.orig Sat Apr 7 18:09:53 2001
++++ aptitude-0.0.8.2/src/generic/aptcache.h Sat Apr 7 18:11:08 2001
+@@ -31,6 +31,7 @@
+ #include <config.h>
+
+ #include <apt-pkg/depcache.h>
++#include <apt-pkg/rpminit.h>
+
+ #ifndef HAVE_LIBAPT_PKG3
+ #include <apt-pkg/dpkginit.h>
+@@ -212,7 +213,8 @@
+ {
+ MMap *Map;
+ aptitudeDepCache *Cache;
+- pkgDpkgLock *Lock;
++ //pkgDpkgLock *Lock;
++ pkgRpmLock *Lock;
+ public:
+ // We look pretty much exactly like a pointer to a dep cache
+ inline operator aptitudeDepCache &() {return *Cache;};
+--- aptitude-0.0.8.2/src/Makefile.am.orig Sat Apr 7 17:29:53 2001
++++ aptitude-0.0.8.2/src/Makefile.am Sat Apr 7 17:39:20 2001
+@@ -3,7 +3,7 @@
+ SUBDIRS=generic vscreen
+
+ localedir = $(datadir)/locale
+-INCLUDES = -Wall -Werror -I.. -I$(srcdir) -I$(top_srcdir)/lib -I../intl
++INCLUDES = -Wall -I.. -I$(srcdir) -I$(top_srcdir)/lib -I../intl #-Werror
+ DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
+
+ bin_PROGRAMS=aptitude
+--- aptitude-0.0.8.2/src/dep_item.cc.orig Sat Apr 7 17:42:18 2001
++++ aptitude-0.0.8.2/src/dep_item.cc Sat Apr 7 17:45:18 2001
+@@ -31,7 +31,11 @@
+ #include "generic/apt.h"
+
+ #include <apt-pkg/version.h>
++#include <apt-pkg/systemfactory.h>
++
+ #include <apt-pkg/configuration.h>
++
++#define pkgCheckDep _system->checkDep
+
+ class pkg_depitem:public pkg_subtree
+ {
+--- aptitude-0.0.8.2/src/download.cc.orig Sat Apr 7 17:46:41 2001
++++ aptitude-0.0.8.2/src/download.cc Sat Apr 7 17:50:59 2001
+@@ -23,6 +23,7 @@
+ #include <apt-pkg/error.h>
+ #include <apt-pkg/dpkgpm.h>
+ #include <apt-pkg/packagemanager.h>
++#include <apt-pkg/systemfactory.h>
+ #include <apt-pkg/sourcelist.h>
+ #include <apt-pkg/acquire.h>
+ #include <apt-pkg/acquire-item.h>
+@@ -213,7 +214,9 @@
+ }
+
+ // Make a package manager, get ready to download
+- pkgDPkgPM pm(*apt_cache_file);
++ // pkgDPkgPM pm(*apt_cache_file);
++ pkgPackageManager *pm_ = _system->CreatePackageManager(*apt_cache_file);
++ pkgPackageManager &pm = *pm_;
+ if(!pm.GetArchives(&fetcher, &list, apt_package_records) || _error->PendingError())
+ {
+ _error->Error(_("Internal error: couldn't generate list of packages to download"));
+@@ -294,7 +297,7 @@
+ }
+
+ fprintf(f, "Aptitude " VERSION ": log report\n\n");
+- fprintf(f, _("IMPORTANT: this log only lists intended actions; actions which fail due to\ndpkg problems may not be completed.\n\n"));
++ fprintf(f, _("IMPORTANT: this log only lists intended actions; actions which fail due to\nrpm problems may not be completed.\n\n"));
+ fprintf(f, _("Will install %li packages, and remove %li packages.\n"), (*apt_cache_file)->InstCount(), (*apt_cache_file)->DelCount());
+ if((*apt_cache_file)->UsrSize()>0)
+ fprintf(f, _("%li bytes of disk space will be used\n"), (long int) (*apt_cache_file)->UsrSize());
+@@ -370,7 +373,7 @@
+ _error->DumpErrors();
+ cerr<<_("Ack! Something bad happened while installing packages. Trying to recover:")<<endl;
+ // and this is really a hack:
+- system("dpkg --configure -a");
++ // system("dpkg --configure -a");
+ _error->Discard();
+ }
+
+--- aptitude-0.0.8.2/src/pkg_columnizer.cc.orig Sat Apr 7 18:14:34 2001
++++ aptitude-0.0.8.2/src/pkg_columnizer.cc Sat Apr 7 18:15:26 2001
+@@ -28,7 +28,11 @@
+ #include <apt-pkg/strutl.h>
+ #include <apt-pkg/error.h>
+ #include <apt-pkg/configuration.h>
+-#include <apt-pkg/version.h>
++//#include <apt-pkg/version.h>
++#include <apt-pkg/systemfactory.h>
++
++#define pkgCheckDep _system->checkDep
++
+ #ifdef HAVE_LIBAPT_PKG3
+ #include <apt-pkg/pkgsystem.h>
+ #endif
+--- aptitude-0.0.8.2/src/pkg_info_screen.cc.orig Sat Apr 7 18:15:42 2001
++++ aptitude-0.0.8.2/src/pkg_info_screen.cc Sat Apr 7 18:16:27 2001
+@@ -69,7 +69,7 @@
+ tree->add_child(new pkg_description(pkg.VersionList(), _("Description")));
+ tree->add_child(new vs_staticitem(_("Priority: "),ver.PriorityType()?ver.PriorityType():"Unknown"));
+ tree->add_child(new vs_staticitem(_("Section: "),pkg.Section()?pkg.Section():_("Unknown")));
+- tree->add_child(new vs_staticitem(_("Maintainer: "),rec.Maintainer()));
++ //tree->add_child(new vs_staticitem(_("Maintainer: "),rec.Maintainer()));
+ tree->add_child(new vs_staticitem(_("Compressed size: "), SizeToStr(ver->Size)));
+ tree->add_child(new vs_staticitem(_("Uncompressed size: "), SizeToStr(ver->InstalledSize)));
+ if(!rec.SourcePkg().empty())
+--- aptitude-0.0.8.2/src/pkg_ver_item.cc.orig Sat Apr 7 18:17:28 2001
++++ aptitude-0.0.8.2/src/pkg_ver_item.cc Sat Apr 7 18:20:32 2001
+@@ -35,6 +35,9 @@
+ #include <string>
+ #include <apt-pkg/configuration.h>
+ #include <apt-pkg/strutl.h>
++#include <apt-pkg/systemfactory.h>
++
+++#define pkgVersionCompare _system->versionCompare
+
+ class pkg_ver_columnizer:public column_generator
+ {
+--- aptitude-0.0.8.2/src/vs_progress.cc.orig Sat Apr 7 18:21:03 2001
++++ aptitude-0.0.8.2/src/vs_progress.cc Sat Apr 7 18:21:32 2001
+@@ -32,7 +32,7 @@
+
+ if(!Op.empty())
+ {
+- assert(Percent>=0 && Percent<=100);
++ //assert(Percent>=0 && Percent<=100);
+ barsize=int(Percent*width/100.0);
+
+ snprintf(percent_string, 50, ": %i%%", int(Percent));
+--- aptitude-0.0.8.2/configure.in.orig Sat Apr 7 16:56:20 2001
++++ aptitude-0.0.8.2/configure.in Sat Apr 7 19:12:31 2001
+@@ -15,16 +15,19 @@
+ ac_cv_c_inline=yes
+
+ dnl Checks for libraries.
+-AC_CHECK_LIB(curses, initscr)
+-AC_CHECK_LIB(apt-pkg, main, , AC_MSG_ERROR([Can't find the APT libraries -- please install libapt-pkg-dev]))
++AC_CHECK_LIB(ncurses, initscr)
++AC_CHECK_LIB(popt, poptGetArg, , AC_MSG_ERROR([Can't find the popt library -- please install popt-devel]))
++AC_CHECK_LIB(rpmio, rpmdbOpen, , AC_MSG_ERROR([Can't find the RPM library -- please install rpm-devel]), [ -lrpm -lpopt -ldb])
++AC_CHECK_LIB(apt-pkg, main, , AC_MSG_ERROR([Can't find the APT libraries -- please install libapt-pkg-devel]), [ -lrpm -lpopt -ldb])
+ AC_CHECK_LIB(pthread, main,
+ HAVE_LIBPTHREAD=1
+- , AC_MSG_WARN([Can't find the POSIX thread libraries -- configuring without threads]))
++ , AC_MSG_WARN([Can't find the POSIX thread libraries -- configuring without threads]), [ -lrpm -lpopt -ldb])
+
+ dnl Checks for header files.
+ AC_HEADER_STDC
+ AC_CHECK_HEADERS(fcntl.h sys/ioctl.h unistd.h, , AC_MSG_ERROR([Can't find needed header file.]))
+-AC_CHECK_HEADER(apt-pkg/init.h, , AC_MSG_ERROR([Can't find the APT header files -- please install libapt-pkg-dev]))
++AC_CHECK_HEADER(apt-pkg/init.h, , AC_MSG_ERROR([Can't find the APT header files -- please install libapt-pkg-devel]), [ -lrpm -lpopt -ldb])
++AC_CHECK_HEADER(rpm/dbindex.h, CXXFLAGS="$CXXFLAGS -I/usr/include/rpm" , AC_MSG_ERROR([Can't find the RPM header files -- please install librpm-devel]), [ -lrpm -lpopt -ldb -lrpmio])
+ AC_CHECK_HEADER(apt-pkg/policy.h, AC_DEFINE(HAVE_LIBAPT_PKG3))
+ if test x$HAVE_LIBPTHREAD = x1
+ then
+--- aptitude-0.0.8.2/Makefile.in.orig Sat Apr 7 16:58:45 2001
++++ aptitude-0.0.8.2/Makefile.in Sat Apr 7 17:11:40 2001
+@@ -44,9 +44,10 @@
+ AUTOHEADER = @AUTOHEADER@
+
+ INSTALL = @INSTALL@
+-INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
++INSTALL_PROGRAM = @INSTALL_PROGRAM@
+ INSTALL_DATA = @INSTALL_DATA@
+ INSTALL_SCRIPT = @INSTALL_SCRIPT@
++INSTALL_STRIP_FLAG =
+ transform = @program_transform_name@
+
+ NORMAL_INSTALL = :
+@@ -112,7 +113,7 @@
+ $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps Makefile
+
+-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
++Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
+ cd $(top_builddir) \
+ && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+@@ -298,6 +299,11 @@
+ -rm -rf $(distdir)
+ mkdir $(distdir)
+ -chmod 777 $(distdir)
++ here=`cd $(top_builddir) && pwd`; \
++ top_distdir=`cd $(distdir) && pwd`; \
++ distdir=`cd $(distdir) && pwd`; \
++ cd $(top_srcdir) \
++ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu Makefile
+ @for file in $(DISTFILES); do \
+ d=$(srcdir); \
+ if test -d $$d/$$file; then \
+@@ -344,7 +350,7 @@
+ all-am: Makefile $(DATA) config.h
+ all-redirect: all-recursive-am
+ install-strip:
+- $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
++ $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install
+ installdirs: installdirs-recursive
+ installdirs-am:
+ $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)
+--- aptitude-0.0.8.2/config.h.in.orig Sat Apr 7 17:13:27 2001
++++ aptitude-0.0.8.2/config.h.in Sat Apr 7 17:15:15 2001
+@@ -3,9 +3,6 @@
+ /* Define if using alloca.c. */
+ #undef C_ALLOCA
+
+-/* Define to empty if the keyword does not work. */
+-#undef const
+-
+ /* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
+ This function is required for alloca.c support on those systems. */
+ #undef CRAY_STACKSEG_END
+@@ -19,9 +16,6 @@
+ /* Define if you have a working `mmap' system call. */
+ #undef HAVE_MMAP
+
+-/* Define as __inline if that's what the C compiler calls it. */
+-#undef inline
+-
+ /* Define to `long' if <sys/types.h> doesn't define. */
+ #undef off_t
+
+@@ -154,6 +148,12 @@
+
+ /* Define if you have the i library (-li). */
+ #undef HAVE_LIBI
++
++/* Define if you have the popt library (-lpopt). */
++#undef HAVE_LIBPOPT
++
++/* Define if you have the rpm library (-lrpm). */
++#undef HAVE_LIBRPM
+
+ /* Name of package */
+ #undef PACKAGE