0.5.5cnc4.1-alt7
- apt-pkg/rpm/rpmpm.cc(pkgRPMPM::ExecRPM): honor "quiet" option. - Additional sorting hacks for virtual packages (mouse).
This commit is contained in:
parent
3212342525
commit
4ef124c6d0
@ -1,55 +0,0 @@
|
||||
--- apt-0.5.4cnc1.orig/configure.in Tue Jul 9 12:28:05 2002
|
||||
+++ apt-0.5.4cnc1/configure.in Fri Jul 19 00:11:07 2002
|
||||
@@ -64,6 +64,7 @@
|
||||
dnl AC_MSG_ERROR(failed: I need posix threads, pthread)
|
||||
dnl fi
|
||||
|
||||
+dnl ALT:We need this to build apt-ftparchive
|
||||
dnl Check for DB2
|
||||
AC_CHECK_HEADER(db2/db.h,
|
||||
[AC_CHECK_LIB(db2,db_open,
|
||||
@@ -77,7 +78,6 @@
|
||||
SAVE_CPPFLAGS="$CPPFLAGS"
|
||||
|
||||
CPPFLAGS="$SAVE_CPPFLAGS -I/usr/include/rpm"
|
||||
-AC_CHECK_HEADERS(db1/db.h)
|
||||
AC_CHECK_HEADER(rpm/rpmlib.h, rpm_header_ok=1, rpm_header_ok=0)
|
||||
|
||||
if test $rpm_header_ok = 1; then
|
||||
@@ -85,7 +85,7 @@
|
||||
LIBS="$SAVE_LIBS -lrpm -lrpmio -lz -lbz2 -lpopt"
|
||||
AC_CHECK_LIB(rpmdb,rpmdbOpen,
|
||||
[RPMDBLIBS="-lrpmdb"],
|
||||
- [RPMDBLIBS="-ldb-3.1"])
|
||||
+ [RPMDBLIBS="-ldb"])
|
||||
|
||||
LIBS="$SAVE_LIBS $RPMDBLIBS -lrpmio -lz -lbz2 -lpopt"
|
||||
AC_CHECK_LIB(rpm,rpmdbGetIteratorOffset,
|
||||
@@ -100,6 +100,7 @@
|
||||
[AC_DEFINE_UNQUOTED(HAVE_RPM, 1)
|
||||
RPMLIBS="-lrpm -ldb1 -lz -lbz2 -lpopt"
|
||||
SAVE_CPPFLAGS="$SAVE_CPPFLAGS -I/usr/include/rpm"
|
||||
+ AC_CHECK_HEADERS(db1/db.h)
|
||||
rpm_version="3"])
|
||||
fi
|
||||
if test $rpm_version != "none"; then
|
||||
--- apt-0.5.4cnc1.orig/tools/cached_md5.cc Tue Jul 9 02:41:48 2002
|
||||
+++ apt-0.5.4cnc1/tools/cached_md5.cc Thu Jul 18 22:47:39 2002
|
||||
@@ -39,6 +39,7 @@
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <rpm/rpmlib.h>
|
||||
+#include <rpm/misc.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
--- apt-0.5.4cnc1.orig/tools/hdlist2pkglist.cc Tue Jul 9 02:42:13 2002
|
||||
+++ apt-0.5.4cnc1/tools/hdlist2pkglist.cc Thu Jul 18 22:48:22 2002
|
||||
@@ -37,6 +37,7 @@
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <rpmlib.h>
|
||||
+#include <rpm/misc.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
@ -1,16 +0,0 @@
|
||||
2002-10-23 Dmitry V. Levin <ldv@altlinux.org>
|
||||
|
||||
* apt-pkg/rpm/rpmpm.cc(pkgRPMPM::ExecRPM):
|
||||
Pass "fancypercent" option if interactive.
|
||||
|
||||
--- apt-0.5.4cnc8/apt-pkg/rpm/rpmpm.cc.orig 2002-08-05 17:46:44 +0300
|
||||
+++ apt-0.5.4cnc8/apt-pkg/rpm/rpmpm.cc 2002-10-23 11:16:13 +0300
|
||||
@@ -266,6 +266,8 @@
|
||||
|
||||
if (Interactive == false && op != Item::RPMErase)
|
||||
Args[n++] = "--percent";
|
||||
+ if (Interactive)
|
||||
+ Args[n++] = "--fancypercent";
|
||||
|
||||
string rootdir = _config->Find("RPM::RootDir", "");
|
||||
if (!rootdir.empty())
|
@ -1,31 +0,0 @@
|
||||
2002-10-23 Dmitry V. Levin <ldv@altlinux.org>
|
||||
|
||||
* apt-pkg/rpm/rpmpm.cc(pkgRPMPM::ExecRPM):
|
||||
Report actual options being passed to rpm.
|
||||
|
||||
--- apt-0.5.4cnc8/apt-pkg/rpm/rpmpm.cc.orig 2002-08-05 17:46:44 +0300
|
||||
+++ apt-0.5.4cnc8/apt-pkg/rpm/rpmpm.cc 2002-10-23 11:16:13 +0300
|
||||
@@ -326,6 +326,14 @@
|
||||
if (_config->FindB("RPM::Order",false) == false)
|
||||
Args[n++] = "--noorder";
|
||||
|
||||
+ string cmd;
|
||||
+ for (unsigned i = 0; i < n; ++i)
|
||||
+ {
|
||||
+ if (!cmd.empty())
|
||||
+ cmd += ' ';
|
||||
+ cmd += Args[i];
|
||||
+ }
|
||||
+
|
||||
for (list<const char*>::iterator I = files.begin(); I != files.end(); I++)
|
||||
Args[n++] = *I;
|
||||
|
||||
@@ -339,7 +347,7 @@
|
||||
return true;
|
||||
}
|
||||
|
||||
- cout << _("Executing RPM (")<<operation<<")..." << endl;
|
||||
+ cout << _("Executing RPM (")<<cmd<<")..." << endl;
|
||||
|
||||
cout << flush;
|
||||
clog << flush;
|
@ -1,18 +0,0 @@
|
||||
2003-01-17 Anton Kachalov <mouse@altlinux.org>,
|
||||
Dmitry V. Levin <ldv@altlinux.org>
|
||||
|
||||
* cmdline/apt-get.cc (TryToInstall):
|
||||
Add APT::Install::Virtual support.
|
||||
|
||||
--- apt-0.5.4cnc9/cmdline/apt-get.cc.orig 2003-01-17 17:11:11 +0300
|
||||
+++ apt-0.5.4cnc9/cmdline/apt-get.cc 2003-01-17 17:19:10 +0300
|
||||
@@ -988,7 +988,8 @@ bool TryToInstall(pkgCache::PkgIterator
|
||||
/* This is a pure virtual package and there is a single available
|
||||
provides */
|
||||
if (Cache[Pkg].CandidateVer == 0 && Pkg->ProvidesList != 0 &&
|
||||
- Pkg.ProvidesList()->NextProvides == 0)
|
||||
+ (Pkg.ProvidesList()->NextProvides == 0 ||
|
||||
+ _config->FindB("APT::Install::Virtual", false)))
|
||||
{
|
||||
pkgCache::PkgIterator Tmp = Pkg.ProvidesList().OwnerPkg();
|
||||
ioprintf(c1out,_("Note, selecting %s instead of %s\n"),
|
@ -2,6 +2,8 @@
|
||||
|
||||
* apt-pkg/versionmatch.cc (pkgVersionMatch::Find):
|
||||
Add APT::Install::VirtualVersion support.
|
||||
* cmdline/apt-get.cc (TryToChangeVer):
|
||||
Substitute virtual package with real one.
|
||||
|
||||
--- apt-0.5.4cnc9/apt-pkg/versionmatch.cc.orig 2002-07-23 21:54:50 +0400
|
||||
+++ apt-0.5.4cnc9/apt-pkg/versionmatch.cc 2003-01-21 16:42:55 +0300
|
||||
@ -33,3 +35,24 @@
|
||||
// This will be Ended by now.
|
||||
return Ver;
|
||||
}
|
||||
--- apt-0.5.4cnc9/cmdline/apt-get.cc.orig 2002-10-18 22:32:12 +0400
|
||||
+++ apt-0.5.4cnc9/cmdline/apt-get.cc 2003-01-23 15:33:45 +0300
|
||||
@@ -1119,7 +1119,7 @@
|
||||
// TryToChangeVer - Try to change a candidate version /*{{{*/
|
||||
// ---------------------------------------------------------------------
|
||||
/* */
|
||||
-bool TryToChangeVer(pkgCache::PkgIterator Pkg,pkgDepCache &Cache,
|
||||
+bool TryToChangeVer(pkgCache::PkgIterator &Pkg,pkgDepCache &Cache,
|
||||
const char *VerTag,bool IsRel)
|
||||
{
|
||||
pkgVersionMatch Match(VerTag,(IsRel == true?pkgVersionMatch::Release :
|
||||
@@ -1143,6 +1143,9 @@
|
||||
}
|
||||
|
||||
Cache.SetCandidateVersion(Ver);
|
||||
+ if (Ver.ParentPkg() != Pkg) {
|
||||
+ Pkg = Ver.ParentPkg();
|
||||
+ }
|
||||
return true;
|
||||
}
|
||||
/*}}}*/
|
||||
|
@ -1,11 +0,0 @@
|
||||
--- apt-0.5.4cnc9/apt-pkg/rpm/rpmlistparser.cc.orig 2002-08-05 18:55:56 +0400
|
||||
+++ apt-0.5.4cnc9/apt-pkg/rpm/rpmlistparser.cc 2002-12-23 17:21:35 +0300
|
||||
@@ -123,8 +123,6 @@ string rpmListParser::Package()
|
||||
bool DupOk = false;
|
||||
string Name = str;
|
||||
|
||||
- if (strncmp(str,"kernel", 6)==0)
|
||||
- DupOk=true;
|
||||
for (vector<regex_t*>::iterator I = AllowedDupPackages.begin();
|
||||
I != AllowedDupPackages.end(); I++)
|
||||
{
|
@ -1,37 +0,0 @@
|
||||
2002-12-20 Anton V. Denisov <avd@altlinux.org>
|
||||
|
||||
* cmdline/apt-cdrom.cc (DoAdd):
|
||||
Simple workaround for ParseQuoteWord(Buffer,URI) == false
|
||||
if URI contains symbol '#'.
|
||||
ParseQuoteWord() need to be tested.
|
||||
|
||||
--- apt-0.5.4cnc9.orig/cmdline/apt-cdrom.cc 2002-12-14 14:35:00 +1200
|
||||
+++ apt-0.5.4cnc9/cmdline/apt-cdrom.cc 2002-12-20 00:17:51 +1200
|
||||
@@ -631,7 +631,7 @@ bool DoAdd(CommandLine &)
|
||||
// Escape special characters
|
||||
string::iterator J = Name.begin();
|
||||
for (; J != Name.end(); J++)
|
||||
- if (*J == '"' || *J == ']' || *J == '[')
|
||||
+ if (*J == '"' || *J == ']' || *J == '[' || *J == '#')
|
||||
*J = '_';
|
||||
|
||||
cout << "Found label '" << Name << "'" << endl;
|
||||
@@ -650,7 +650,8 @@ bool DoAdd(CommandLine &)
|
||||
if (Name.empty() == false &&
|
||||
Name.find('"') == string::npos &&
|
||||
Name.find('[') == string::npos &&
|
||||
- Name.find(']') == string::npos)
|
||||
+ Name.find(']') == string::npos &&
|
||||
+ Name.find('#') == string::npos)
|
||||
break;
|
||||
cout << "That is not a valid name, try again " << endl;
|
||||
}
|
||||
@@ -662,7 +663,7 @@ bool DoAdd(CommandLine &)
|
||||
// Escape special characters
|
||||
string::iterator J = Name.begin();
|
||||
for (; J != Name.end(); J++)
|
||||
- if (*J == '"' || *J == ']' || *J == '[')
|
||||
+ if (*J == '"' || *J == ']' || *J == '[' || *J == '#')
|
||||
*J = '_';
|
||||
|
||||
Database.Set("CD::" + ID,Name);
|
@ -1,12 +0,0 @@
|
||||
--- apt-0.5.5cnc1/apt-pkg/init.cc.orig 2003-02-07 19:14:18 +0300
|
||||
+++ apt-0.5.5cnc1/apt-pkg/init.cc 2003-02-07 19:26:23 +0300
|
||||
@@ -98,7 +98,9 @@
|
||||
|
||||
if (Cnf.Exists("Dir::Locale"))
|
||||
{
|
||||
+#ifdef APT_DOMAIN
|
||||
bindtextdomain(APT_DOMAIN,Cnf.FindDir("Dir::Locale").c_str());
|
||||
+#endif
|
||||
bindtextdomain(textdomain(0),Cnf.FindDir("Dir::Locale").c_str());
|
||||
}
|
||||
|
@ -1,11 +0,0 @@
|
||||
--- apt-0.5.5cnc1_rc2/buildlib/environment.mak.in.orig 2003-02-02 12:34:15.000000000 -0500
|
||||
+++ apt-0.5.5cnc1_rc2/buildlib/environment.mak.in 2003-02-02 12:35:17.000000000 -0500
|
||||
@@ -35,7 +35,7 @@
|
||||
# SGML for the man pages
|
||||
NSGMLS = @NSGMLS@
|
||||
SGMLSPL = @SGMLSPL@
|
||||
-DOCBOOK2MAN := $(wildcard /usr/lib/perl5/sgmlspl-specs/docbook2man-spec.pl)
|
||||
+DOCBOOK2MAN := $(wildcard /usr/share/sgml/docbook/utils-*/helpers/docbook2man-spec.pl)
|
||||
|
||||
# Gettext settings
|
||||
GMSGFMT = @GMSGFMT@
|
@ -9,20 +9,20 @@
|
||||
Cnf.CndSet("Acquire::CDROM::Mount", "/mnt/cdrom");
|
||||
Cnf.CndSet("Acquire::CDROM::Copy-All", "true");
|
||||
|
||||
--- apt-0.5.5cnc1/cmdline/apt-cdrom.cc.orig 2003-01-29 18:11:14 +0300
|
||||
+++ apt-0.5.5cnc1/cmdline/apt-cdrom.cc 2003-02-07 18:11:58 +0300
|
||||
@@ -668,7 +668,7 @@
|
||||
Name.empty() == true)
|
||||
--- apt-0.5.5cnc2/cmdline/apt-cdrom.cc.orig 2003-02-21 17:09:14 +0300
|
||||
+++ apt-0.5.5cnc2/cmdline/apt-cdrom.cc 2003-02-25 15:33:02 +0300
|
||||
@@ -700,7 +700,7 @@ bool DoAdd(CommandLine &)
|
||||
{
|
||||
// CNC:2002-07-11
|
||||
// CNC:2002-07-11
|
||||
#ifdef HAVE_RPM
|
||||
- cout << "Please provide a name for this Disc, such as 'Conectiva Disk 1'";
|
||||
+ cout << "Please provide a name for this Disc, such as 'ALT Linux Disk 1'";
|
||||
while (1)
|
||||
{
|
||||
Name = PromptLine("");
|
||||
--- apt-0.5.5cnc1/methods/ftp.cc.orig 2002-07-25 22:07:19 +0400
|
||||
+++ apt-0.5.5cnc1/methods/ftp.cc 2003-01-29 15:46:54 +0300
|
||||
@@ -185,7 +185,7 @@ bool FTPConn::Login()
|
||||
#else
|
||||
cout << "Please provide a name for this Disc, such as 'Debian 2.1r1 Disk 1'";
|
||||
#endif
|
||||
--- apt-0.5.5cnc2/methods/ftp.cc.orig 2003-02-21 17:12:17 +0300
|
||||
+++ apt-0.5.5cnc2/methods/ftp.cc 2003-02-25 16:02:07 +0300
|
||||
@@ -189,7 +189,7 @@ bool FTPConn::Login()
|
||||
|
||||
// Setup the variables needed for authentication
|
||||
string User = "anonymous";
|
66
apt-0.5.5cnc2-alt-rpm.patch
Normal file
66
apt-0.5.5cnc2-alt-rpm.patch
Normal file
@ -0,0 +1,66 @@
|
||||
diff -uprk.orig apt-0.5.5cnc2.orig/configure.in apt-0.5.5cnc2/configure.in
|
||||
--- apt-0.5.5cnc2.orig/configure.in 2003-02-21 17:06:40 +0300
|
||||
+++ apt-0.5.5cnc2/configure.in 2003-02-25 16:04:31 +0300
|
||||
@@ -56,10 +56,12 @@ dnl if test "$PTHREADLIB" != "-lpthread"
|
||||
dnl AC_MSG_ERROR(failed: I need posix threads, pthread)
|
||||
dnl fi
|
||||
|
||||
+DB2LIB=
|
||||
+dnl ALT: uncomment this to build apt-ftparchive
|
||||
dnl Check for DB2
|
||||
-AC_CHECK_HEADER(db2/db.h,
|
||||
- [AC_CHECK_LIB(db2,db_open,
|
||||
- [AC_DEFINE(HAVE_DB2) DB2LIB="-ldb2"])])
|
||||
+dnl AC_CHECK_HEADER(db2/db.h,
|
||||
+dnl [AC_CHECK_LIB(db2,db_open,
|
||||
+dnl [AC_DEFINE(HAVE_DB2) DB2LIB="-ldb2"])])
|
||||
AC_SUBST(DB2LIB)
|
||||
|
||||
dnl CNC:2002-07-03
|
||||
@@ -69,7 +71,6 @@ SAVE_LIBS="$LIBS"
|
||||
SAVE_CPPFLAGS="$CPPFLAGS"
|
||||
|
||||
CPPFLAGS="$SAVE_CPPFLAGS -I/usr/include/rpm"
|
||||
-AC_CHECK_HEADERS(db1/db.h)
|
||||
AC_CHECK_HEADER(rpm/rpmlib.h, rpm_header_ok=1, rpm_header_ok=0)
|
||||
|
||||
if test $rpm_header_ok = 1; then
|
||||
@@ -77,7 +78,7 @@ if test $rpm_header_ok = 1; then
|
||||
LIBS="$SAVE_LIBS -lrpm -lrpmio -lz -lbz2 -lpopt"
|
||||
AC_CHECK_LIB(rpmdb,rpmdbOpen,
|
||||
[RPMDBLIBS="-lrpmdb"],
|
||||
- [RPMDBLIBS="-ldb-3.1"])
|
||||
+ [RPMDBLIBS="-ldb"])
|
||||
|
||||
LIBS="$SAVE_LIBS $RPMDBLIBS -lrpmio -lz -lbz2 -lpopt"
|
||||
AC_CHECK_LIB(rpm,rpmdbGetIteratorOffset,
|
||||
@@ -96,6 +97,7 @@ if test $rpm_header_ok = 1; then
|
||||
[AC_DEFINE_UNQUOTED(HAVE_RPM, 1)
|
||||
RPMLIBS="-lrpm -ldb1 -lz -lbz2 -lpopt"
|
||||
SAVE_CPPFLAGS="$SAVE_CPPFLAGS -I/usr/include/rpm"
|
||||
+ AC_CHECK_HEADERS(db1/db.h)
|
||||
rpm_version="3"])
|
||||
fi
|
||||
fi
|
||||
diff -uprk.orig apt-0.5.5cnc2.orig/tools/cached_md5.cc apt-0.5.5cnc2/tools/cached_md5.cc
|
||||
--- apt-0.5.5cnc2.orig/tools/cached_md5.cc 2003-02-21 17:12:36 +0300
|
||||
+++ apt-0.5.5cnc2/tools/cached_md5.cc 2003-02-25 16:03:17 +0300
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <rpm/rpmlib.h>
|
||||
+#include <rpm/misc.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
diff -uprk.orig apt-0.5.5cnc2.orig/tools/hdlist2pkglist.cc apt-0.5.5cnc2/tools/hdlist2pkglist.cc
|
||||
--- apt-0.5.5cnc2.orig/tools/hdlist2pkglist.cc 2003-02-21 17:12:30 +0300
|
||||
+++ apt-0.5.5cnc2/tools/hdlist2pkglist.cc 2003-02-25 16:03:17 +0300
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <rpmlib.h>
|
||||
+#include <rpm/misc.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
20
apt-0.5.5cnc3-alt-i18n-apt-cdrom.patch
Normal file
20
apt-0.5.5cnc3-alt-i18n-apt-cdrom.patch
Normal file
@ -0,0 +1,20 @@
|
||||
--- apt-0.5.5cnc3.orig/cmdline/apt-cdrom.cc 2003-02-28 04:19:12 +1200
|
||||
+++ apt-0.5.5cnc3/cmdline/apt-cdrom.cc 2003-03-04 11:34:11 +1200
|
||||
@@ -853,7 +853,7 @@ int ShowHelp()
|
||||
return 0;
|
||||
|
||||
cout <<
|
||||
- "Usage: apt-cdrom [options] command\n"
|
||||
+ _("Usage: apt-cdrom [options] command\n"
|
||||
"\n"
|
||||
"apt-cdrom is a tool to add CDROM's to APT's source list. The\n"
|
||||
"CDROM mount point and device information is taken from apt.conf\n"
|
||||
@@ -872,7 +872,7 @@ int ShowHelp()
|
||||
" -a Thorough scan mode\n"
|
||||
" -c=? Read this configuration file\n"
|
||||
" -o=? Set an arbitary configuration option, eg -o dir::cache=/tmp\n"
|
||||
- "See fstab(5)\n";
|
||||
+ "See fstab(5)\n");
|
||||
return 0;
|
||||
}
|
||||
/*}}}*/
|
40
apt-0.5.5cnc4-alt-defaults.patch
Normal file
40
apt-0.5.5cnc4-alt-defaults.patch
Normal file
@ -0,0 +1,40 @@
|
||||
diff -uprk.orig apt-0.5.5cnc4.1.orig/apt-pkg/init.cc apt-0.5.5cnc4.1/apt-pkg/init.cc
|
||||
--- apt-0.5.5cnc4.1.orig/apt-pkg/init.cc 2003-06-25 18:35:05 +0400
|
||||
+++ apt-0.5.5cnc4.1/apt-pkg/init.cc 2003-06-25 18:35:45 +0400
|
||||
@@ -72,7 +72,7 @@ bool pkgInitConfig(Configuration &Cnf)
|
||||
Cnf.Set("Dir::Etc::main","apt.conf");
|
||||
Cnf.Set("Dir::Etc::parts","apt.conf.d");
|
||||
Cnf.Set("Dir::Etc::preferences","preferences");
|
||||
- Cnf.Set("Dir::Bin::methods","/usr/lib/apt/methods");
|
||||
+ Cnf.Set("Dir::Bin::methods","/usr/lib/apt");
|
||||
Cnf.Set("Acquire::ComprExtension", ".bz2");
|
||||
|
||||
bool Res = true;
|
||||
diff -uprk.orig apt-0.5.5cnc4.1.orig/apt-pkg/rpm/rpmpm.cc apt-0.5.5cnc4.1/apt-pkg/rpm/rpmpm.cc
|
||||
--- apt-0.5.5cnc4.1.orig/apt-pkg/rpm/rpmpm.cc 2003-06-25 18:35:05 +0400
|
||||
+++ apt-0.5.5cnc4.1/apt-pkg/rpm/rpmpm.cc 2003-06-25 18:43:01 +0400
|
||||
@@ -332,7 +332,7 @@ bool pkgRPMPM::ExecRPM(Item::RPMOps op,
|
||||
}
|
||||
}
|
||||
|
||||
- if (_config->FindB("RPM::Order",false) == false)
|
||||
+ if (_config->FindB("RPM::Order",true) == false)
|
||||
Args[n++] = "--noorder";
|
||||
|
||||
string cmd;
|
||||
diff -uprk.orig apt-0.5.5cnc4.1.orig/buildlib/archtable apt-0.5.5cnc4.1/buildlib/archtable
|
||||
--- apt-0.5.5cnc4.1.orig/buildlib/archtable 2003-03-08 02:14:52 +0300
|
||||
+++ apt-0.5.5cnc4.1/buildlib/archtable 2003-06-25 18:37:36 +0400
|
||||
@@ -5,8 +5,10 @@
|
||||
|
||||
# The left side is a regex for awk
|
||||
|
||||
-i.86 i386
|
||||
-pentium i386
|
||||
+i[34]86 i386
|
||||
+i.86 i586
|
||||
+pentium.* i586
|
||||
+athlon i586
|
||||
sparc sparc
|
||||
sparc64 sparc
|
||||
alpha.* alpha
|
40
apt-0.5.5cnc4-alt-install_virtual.patch
Normal file
40
apt-0.5.5cnc4-alt-install_virtual.patch
Normal file
@ -0,0 +1,40 @@
|
||||
2003-06-24 Dmitry V. Levin <ldv@altlinux.org>
|
||||
|
||||
* cmdline/apt-get.cc (TryToInstall):
|
||||
Optimize pure virtual packages install.
|
||||
Add APT::Install::Virtual support.
|
||||
|
||||
--- apt-0.5.5cnc4.1.orig/cmdline/apt-get.cc 2003-06-24 21:24:10 +0400
|
||||
+++ apt-0.5.5cnc4.1/cmdline/apt-get.cc 2003-06-24 21:29:08 +0400
|
||||
@@ -1042,13 +1042,25 @@ bool TryToInstall(pkgCache::PkgIterator
|
||||
{
|
||||
/* This is a pure virtual package and there is a single available
|
||||
provides */
|
||||
- if (Cache[Pkg].CandidateVer == 0 && Pkg->ProvidesList != 0 &&
|
||||
- Pkg.ProvidesList()->NextProvides == 0)
|
||||
+ if (Cache[Pkg].CandidateVer == 0 && Pkg->ProvidesList != 0)
|
||||
{
|
||||
- pkgCache::PkgIterator Tmp = Pkg.ProvidesList().OwnerPkg();
|
||||
- ioprintf(c1out,_("Note, selecting %s instead of %s\n"),
|
||||
- Tmp.Name(),Pkg.Name());
|
||||
- Pkg = Tmp;
|
||||
+ if (!Remove)
|
||||
+ for (pkgCache::PrvIterator pv = Pkg.ProvidesList(); pv.end() == false; pv++)
|
||||
+ {
|
||||
+ pkgCache::PkgIterator po = pv.OwnerPkg();
|
||||
+ // Just marked for install?
|
||||
+ if (Cache[po].Install() && Cache[po].NewInstall())
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ if ((Pkg.ProvidesList()->NextProvides == 0 ||
|
||||
+ (!Remove && _config->FindB("APT::Install::Virtual", false))))
|
||||
+ {
|
||||
+ pkgCache::PkgIterator po = Pkg.ProvidesList().OwnerPkg();
|
||||
+ ioprintf(c1out,_("Note, selecting %s instead of %s\n"),
|
||||
+ po.Name(),Pkg.Name());
|
||||
+ Pkg = po;
|
||||
+ }
|
||||
}
|
||||
|
||||
// Handle the no-upgrade case
|
31
apt-0.5.5cnc4-alt-rpm_cmd.patch
Normal file
31
apt-0.5.5cnc4-alt-rpm_cmd.patch
Normal file
@ -0,0 +1,31 @@
|
||||
2002-10-23 Dmitry V. Levin <ldv@altlinux.org>
|
||||
|
||||
* apt-pkg/rpm/rpmpm.cc(pkgRPMPM::ExecRPM):
|
||||
Report actual options being passed to rpm.
|
||||
|
||||
--- apt-0.5.5cnc4/apt-pkg/rpm/rpmpm.cc.orig 2003-03-07 17:40:44 +0300
|
||||
+++ apt-0.5.5cnc4/apt-pkg/rpm/rpmpm.cc 2003-03-07 19:24:07 +0300
|
||||
@@ -333,6 +333,14 @@ bool pkgRPMPM::ExecRPM(Item::RPMOps op,
|
||||
if (_config->FindB("RPM::Order",false) == false)
|
||||
Args[n++] = "--noorder";
|
||||
|
||||
+ string cmd;
|
||||
+ for (unsigned i = 0; i < n; ++i)
|
||||
+ {
|
||||
+ if (!cmd.empty())
|
||||
+ cmd += ' ';
|
||||
+ cmd += Args[i];
|
||||
+ }
|
||||
+
|
||||
for (vector<const char*>::iterator I = files.begin(); I != files.end(); I++)
|
||||
Args[n++] = *I;
|
||||
|
||||
@@ -346,7 +354,7 @@ bool pkgRPMPM::ExecRPM(Item::RPMOps op,
|
||||
return true;
|
||||
}
|
||||
|
||||
- cout << _("Executing RPM (")<<operation<<")..." << endl;
|
||||
+ cout << _("Executing RPM (")<<cmd<<")..." << endl;
|
||||
|
||||
cout << flush;
|
||||
clog << flush;
|
26
apt-0.5.5cnc4-alt-tinfo.patch
Normal file
26
apt-0.5.5cnc4-alt-tinfo.patch
Normal file
@ -0,0 +1,26 @@
|
||||
--- apt-0.5.5cnc4.1/configure.in.orig 2003-03-08 03:07:11 +0300
|
||||
+++ apt-0.5.5cnc4.1/configure.in 2003-03-11 13:08:10 +0300
|
||||
@@ -125,10 +125,10 @@
|
||||
[AC_MSG_RESULT(no)])
|
||||
|
||||
dnl Check for apt-shell dependencies
|
||||
-AC_CHECK_LIB(ncurses,tputs,
|
||||
+AC_CHECK_LIB(tinfo,tputs,
|
||||
[AC_CHECK_HEADER(readline/readline.h,
|
||||
[AC_CHECK_LIB(readline,readline,
|
||||
- [COMPILE_APTSHELL=yes],,[-lncurses])])])
|
||||
+ [COMPILE_APTSHELL=yes],,[-ltinfo])])])
|
||||
AC_SUBST(COMPILE_APTSHELL)
|
||||
|
||||
dnl Converts the ARCH to be something singular for this general CPU family
|
||||
--- apt-0.5.5cnc4.1/cmdline/makefile.orig 2003-03-08 02:10:32 +0300
|
||||
+++ apt-0.5.5cnc4.1/cmdline/makefile 2003-03-11 13:08:19 +0300
|
||||
@@ -27,7 +27,7 @@
|
||||
ifdef COMPILE_APTSHELL
|
||||
# The apt-shell program
|
||||
PROGRAM=apt-shell
|
||||
-SLIBS = -lapt-pkg -lreadline -lncurses $(RPMLIBS)
|
||||
+SLIBS = -lapt-pkg -lreadline -ltinfo $(RPMLIBS)
|
||||
LIB_MAKES = apt-pkg/makefile
|
||||
SOURCE = apt-shell.cc acqprogress.cc
|
||||
include $(PROGRAM_H)
|
55
apt-0.5.5cnc4-alt-versionmatch.patch
Normal file
55
apt-0.5.5cnc4-alt-versionmatch.patch
Normal file
@ -0,0 +1,55 @@
|
||||
2003-04-28 Anton Kachalov <mouse@altlinux.org>
|
||||
|
||||
* apt-pkg/versionmatch.cc (pkgVersionMatch::MatchVer):
|
||||
Ignore serial while matching version string.
|
||||
Check both for version and version-release while matching version string.
|
||||
|
||||
--- apt-0.5.5cnc4.1/apt-pkg/versionmatch.cc.orig 2003-03-25 19:40:45 +0300
|
||||
+++ apt-0.5.5cnc4.1/apt-pkg/versionmatch.cc 2003-04-28 19:35:30 +0400
|
||||
@@ -124,18 +124,36 @@ pkgVersionMatch::pkgVersionMatch(string
|
||||
/* */
|
||||
bool pkgVersionMatch::MatchVer(const char *A,string B,bool Prefix)
|
||||
{
|
||||
- const char *Ab = A;
|
||||
- const char *Ae = Ab + strlen(A);
|
||||
+ string s(A), sc(A);
|
||||
+ const char *Ab = s.c_str(), *Ac = sc.c_str();
|
||||
+
|
||||
+ for (string::iterator i = s.begin(), k = sc.begin(); i != s.end(); ++i,++k)
|
||||
+ {
|
||||
+ if (*i == ':')
|
||||
+ {
|
||||
+ Ab = &(*i) + 1;
|
||||
+ Ac = &(*k) + 1;
|
||||
+ }
|
||||
+ else if (*i == '-')
|
||||
+ {
|
||||
+ *i = 0;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ const char *Ae = Ab + strlen(Ab);
|
||||
+ const char *Af = Ac + strlen(Ac);
|
||||
|
||||
// Strings are not a compatible size.
|
||||
- if ((unsigned)(Ae - Ab) != B.length() && Prefix == false ||
|
||||
- (unsigned)(Ae - Ab) < B.length())
|
||||
- return false;
|
||||
-
|
||||
- // Match (leading?)
|
||||
- if (stringcasecmp(B,Ab,Ab + B.length()) == 0)
|
||||
- return true;
|
||||
-
|
||||
+ if (((unsigned)(Ae - Ab) == B.length() || Prefix == true) &&
|
||||
+ (unsigned)(Ae - Ab) >= B.length() &&
|
||||
+ stringcasecmp(B,Ab,Ab + B.length()) == 0)
|
||||
+ return true;
|
||||
+ else if (((unsigned)(Af - Ac) == B.length() || Prefix == true) &&
|
||||
+ (unsigned)(Af - Ac) >= B.length() &&
|
||||
+ stringcasecmp(B,Ac,Ac + B.length()) == 0)
|
||||
+ return true;
|
||||
+
|
||||
return false;
|
||||
}
|
||||
/*}}}*/
|
231
apt-0.5.5cnc4-alt-versionmatch2.patch
Normal file
231
apt-0.5.5cnc4-alt-versionmatch2.patch
Normal file
@ -0,0 +1,231 @@
|
||||
2003-06-24 Dmitry V. Levin <ldv@altlinux.org>
|
||||
|
||||
* apt-pkg/versionmatch.cc (pkgVersionMatch::MatchVer):
|
||||
Use pkgVersioningSystem's CheckDep for normal (non-prefix) match.
|
||||
* apt-pkg/versionmatch.h (class pkgVersionMatch):
|
||||
Added "int VerOp" private member.
|
||||
Added argument to constructor.
|
||||
* apt-pkg/versionmatch.cc (pkgVersionMatch::pkgVersionMatch):
|
||||
Initialize VerOp.
|
||||
* cmdline/apt-get.cc (DoInstall):
|
||||
Changed parser to initialize VerOp.
|
||||
* cmdline/apt-get.cc (TryToChangeVer): Use it.
|
||||
* cmdline/apt-get.cc (op2str): New function.
|
||||
* cmdline/apt-get.cc (TryToChangeVer): Use it.
|
||||
|
||||
diff -uprk.orig apt-0.5.5cnc4.1.orig/apt-pkg/versionmatch.cc apt-0.5.5cnc4.1/apt-pkg/versionmatch.cc
|
||||
--- apt-0.5.5cnc4.1.orig/apt-pkg/versionmatch.cc 2003-06-24 15:43:54 +0400
|
||||
+++ apt-0.5.5cnc4.1/apt-pkg/versionmatch.cc 2003-06-24 15:18:19 +0400
|
||||
@@ -15,6 +15,7 @@
|
||||
#pragma implementation "apt-pkg/versionmatch.h"
|
||||
#endif
|
||||
#include <apt-pkg/versionmatch.h>
|
||||
+#include <apt-pkg/version.h>
|
||||
#include <apt-pkg/configuration.h>
|
||||
|
||||
#include <apt-pkg/strutl.h>
|
||||
@@ -27,7 +28,7 @@
|
||||
// VersionMatch::pkgVersionMatch - Constructor /*{{{*/
|
||||
// ---------------------------------------------------------------------
|
||||
/* Break up the data string according to the selected type */
|
||||
-pkgVersionMatch::pkgVersionMatch(string Data,MatchType Type) : Type(Type)
|
||||
+pkgVersionMatch::pkgVersionMatch(string Data,MatchType Type,int Op) : VerOp(Op), Type(Type)
|
||||
{
|
||||
MatchAll = false;
|
||||
VerPrefixMatch = false;
|
||||
@@ -162,13 +163,22 @@ bool pkgVersionMatch::MatchVer(const cha
|
||||
/* */
|
||||
pkgCache::VerIterator pkgVersionMatch::Find(pkgCache::PkgIterator Pkg)
|
||||
{
|
||||
+ pkgVersioningSystem *VS = Pkg.Cache()->VS;
|
||||
pkgCache::VerIterator Ver = Pkg.VersionList();
|
||||
+
|
||||
for (; Ver.end() == false; Ver++)
|
||||
{
|
||||
if (Type == Version)
|
||||
{
|
||||
- if (MatchVer(Ver.VerStr(),VerStr,VerPrefixMatch) == true)
|
||||
- return Ver;
|
||||
+ if (VerPrefixMatch)
|
||||
+ {
|
||||
+ if (MatchVer(Ver.VerStr(),VerStr,VerPrefixMatch) == true)
|
||||
+ return Ver;
|
||||
+ } else {
|
||||
+ if (VS->CheckDep(Ver.VerStr(),VerOp,VerStr.c_str()) == true)
|
||||
+ return Ver;
|
||||
+ }
|
||||
+
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -185,9 +195,14 @@ pkgCache::VerIterator pkgVersionMatch::F
|
||||
{
|
||||
if (Type == Version)
|
||||
{
|
||||
- if (MatchVer(Prv.ProvideVersion(),VerStr,VerPrefixMatch) == true)
|
||||
- return Prv.OwnerVer();
|
||||
- continue;
|
||||
+ if (VerPrefixMatch)
|
||||
+ {
|
||||
+ if (MatchVer(Prv.ProvideVersion(),VerStr,VerPrefixMatch) == true)
|
||||
+ return Prv.OwnerVer();
|
||||
+ } else {
|
||||
+ if (VS->CheckDep(Prv.ProvideVersion(),VerOp,VerStr.c_str()) == true)
|
||||
+ return Prv.OwnerVer();
|
||||
+ }
|
||||
}
|
||||
}
|
||||
// This will be Ended by now.
|
||||
diff -uprk.orig apt-0.5.5cnc4.1.orig/apt-pkg/versionmatch.h apt-0.5.5cnc4.1/apt-pkg/versionmatch.h
|
||||
--- apt-0.5.5cnc4.1.orig/apt-pkg/versionmatch.h 2003-03-08 02:12:11 +0300
|
||||
+++ apt-0.5.5cnc4.1/apt-pkg/versionmatch.h 2003-06-24 14:22:28 +0400
|
||||
@@ -45,6 +45,7 @@ class pkgVersionMatch
|
||||
// Version Matching
|
||||
string VerStr;
|
||||
bool VerPrefixMatch;
|
||||
+ int VerOp;
|
||||
|
||||
// Release Matching
|
||||
string RelVerStr;
|
||||
@@ -66,7 +67,7 @@ class pkgVersionMatch
|
||||
bool FileMatch(pkgCache::PkgFileIterator File);
|
||||
pkgCache::VerIterator Find(pkgCache::PkgIterator Pkg);
|
||||
|
||||
- pkgVersionMatch(string Data,MatchType Type);
|
||||
+ pkgVersionMatch(string Data,MatchType Type,int Op = 0);
|
||||
};
|
||||
|
||||
#endif
|
||||
diff -uprk.orig apt-0.5.5cnc4.1.orig/cmdline/apt-get.cc apt-0.5.5cnc4.1/cmdline/apt-get.cc
|
||||
--- apt-0.5.5cnc4.1.orig/cmdline/apt-get.cc 2003-06-24 15:43:54 +0400
|
||||
+++ apt-0.5.5cnc4.1/cmdline/apt-get.cc 2003-06-24 15:39:37 +0400
|
||||
@@ -1172,29 +1172,40 @@ bool TryToInstall(pkgCache::PkgIterator
|
||||
return true;
|
||||
}
|
||||
/*}}}*/
|
||||
+static const char *op2str(int op)
|
||||
+{
|
||||
+ switch (op & 0x0f)
|
||||
+ {
|
||||
+ case pkgCache::Dep::LessEq: return "<=";
|
||||
+ case pkgCache::Dep::GreaterEq: return ">=";
|
||||
+ case pkgCache::Dep::Less: return "<";
|
||||
+ case pkgCache::Dep::Greater: return ">";
|
||||
+ case pkgCache::Dep::Equals: return "=";
|
||||
+ case pkgCache::Dep::NotEquals: return "!";
|
||||
+ default: return "";
|
||||
+ }
|
||||
+};
|
||||
+
|
||||
// TryToChangeVer - Try to change a candidate version /*{{{*/
|
||||
// ---------------------------------------------------------------------
|
||||
/* */
|
||||
bool TryToChangeVer(pkgCache::PkgIterator &Pkg,pkgDepCache &Cache,
|
||||
- const char *VerTag,bool IsRel)
|
||||
+ int VerOp,const char *VerTag,bool IsRel)
|
||||
{
|
||||
pkgVersionMatch Match(VerTag,(IsRel == true?pkgVersionMatch::Release :
|
||||
- pkgVersionMatch::Version));
|
||||
+ pkgVersionMatch::Version),VerOp);
|
||||
|
||||
pkgCache::VerIterator Ver = Match.Find(Pkg);
|
||||
|
||||
if (Ver.end() == true)
|
||||
- {
|
||||
- if (IsRel == true)
|
||||
- return _error->Error(_("Release '%s' for '%s' was not found"),
|
||||
- VerTag,Pkg.Name());
|
||||
- return _error->Error(_("Version '%s' for '%s' was not found"),
|
||||
- VerTag,Pkg.Name());
|
||||
- }
|
||||
+ return _error->Error(_("%s %s'%s' for '%s' was not found"),
|
||||
+ IsRel ? _("Release") : _("Version"),
|
||||
+ op2str(VerOp), VerTag,Pkg.Name());
|
||||
|
||||
if (strcmp(VerTag,Ver.VerStr()) != 0)
|
||||
{
|
||||
- ioprintf(c1out,_("Selected version %s (%s) for %s\n"),
|
||||
+ ioprintf(c1out,_("Selected %s %s (%s) for %s\n"),
|
||||
+ IsRel ? _("release") : _("version"),
|
||||
Ver.VerStr(),Ver.RelStr().c_str(),Pkg.Name());
|
||||
}
|
||||
|
||||
@@ -1455,6 +1466,7 @@ bool DoInstall(CommandLine &CmdL)
|
||||
bool Remove = DefRemove;
|
||||
char *VerTag = 0;
|
||||
bool VerIsRel = false;
|
||||
+ int VerOp = 0;
|
||||
while (Cache->FindPkg(S).end() == true)
|
||||
{
|
||||
// Handle an optional end tag indicating what to do
|
||||
@@ -1472,15 +1484,47 @@ bool DoInstall(CommandLine &CmdL)
|
||||
continue;
|
||||
}
|
||||
|
||||
- char *Slash = strchr(S,'=');
|
||||
- if (Slash != 0)
|
||||
+ char *sep = strpbrk(S,"=><");
|
||||
+ if (sep)
|
||||
{
|
||||
+ char *p;
|
||||
+ int eq = 0, gt = 0, lt = 0;
|
||||
+
|
||||
VerIsRel = false;
|
||||
- *Slash = 0;
|
||||
- VerTag = Slash + 1;
|
||||
+ for (p = sep; *p && strchr("=><",*p); ++p)
|
||||
+ switch (*p)
|
||||
+ {
|
||||
+ case '=': eq = 1; break;
|
||||
+ case '>': gt = 1; break;
|
||||
+ case '<': lt = 1; break;
|
||||
+ }
|
||||
+ if (eq)
|
||||
+ {
|
||||
+ if (lt && gt)
|
||||
+ return _error->Error(_("Couldn't parse name: %s"),S);
|
||||
+ else if (lt)
|
||||
+ VerOp = pkgCache::Dep::LessEq;
|
||||
+ else if (gt)
|
||||
+ VerOp = pkgCache::Dep::GreaterEq;
|
||||
+ else
|
||||
+ VerOp = pkgCache::Dep::Equals;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ if (lt && gt)
|
||||
+ VerOp = pkgCache::Dep::NotEquals;
|
||||
+ else if (lt)
|
||||
+ VerOp = pkgCache::Dep::Less;
|
||||
+ else if (gt)
|
||||
+ VerOp = pkgCache::Dep::Greater;
|
||||
+ else
|
||||
+ return _error->Error(_("Couldn't parse name: %s"),S);
|
||||
+ }
|
||||
+ *sep = '\0';
|
||||
+ VerTag = p;
|
||||
}
|
||||
|
||||
- Slash = strchr(S,'/');
|
||||
+ char *Slash = strchr(S,'/');
|
||||
if (Slash != 0)
|
||||
{
|
||||
VerIsRel = true;
|
||||
@@ -1530,7 +1574,7 @@ bool DoInstall(CommandLine &CmdL)
|
||||
Pkg.Name(),S);
|
||||
|
||||
if (VerTag != 0)
|
||||
- if (TryToChangeVer(Pkg,Cache,VerTag,VerIsRel) == false)
|
||||
+ if (TryToChangeVer(Pkg,Cache,VerOp,VerTag,VerIsRel) == false)
|
||||
return false;
|
||||
|
||||
Hit |= TryToInstall(Pkg,Cache,Fix,Remove,BrokenFix,
|
||||
@@ -1544,7 +1588,7 @@ bool DoInstall(CommandLine &CmdL)
|
||||
else
|
||||
{
|
||||
if (VerTag != 0)
|
||||
- if (TryToChangeVer(Pkg,Cache,VerTag,VerIsRel) == false)
|
||||
+ if (TryToChangeVer(Pkg,Cache,VerOp,VerTag,VerIsRel) == false)
|
||||
return false;
|
||||
if (TryToInstall(Pkg,Cache,Fix,Remove,BrokenFix,ExpectedInst) == false)
|
||||
return false;
|
32
apt-0.5.5cnc4.1-alt-fixpriorsort.patch
Normal file
32
apt-0.5.5cnc4.1-alt-fixpriorsort.patch
Normal file
@ -0,0 +1,32 @@
|
||||
--- apt-0.5.5cnc4.1/apt-pkg/algorithms.cc.orig 2003-09-28 14:06:16 +0400
|
||||
+++ apt-0.5.5cnc4.1/apt-pkg/algorithms.cc 2003-09-28 14:09:16 +0400
|
||||
@@ -1411,27 +1411,28 @@
|
||||
static int PrioComp(const void *A,const void *B)
|
||||
{
|
||||
pkgCache::VerIterator L(*PrioCache,*(pkgCache::Version **)A);
|
||||
pkgCache::VerIterator R(*PrioCache,*(pkgCache::Version **)B);
|
||||
|
||||
// CNC:2002-11-27
|
||||
if ((R.ParentPkg()->Flags & pkgCache::Flag::Essential) == pkgCache::Flag::Essential &&
|
||||
(L.ParentPkg()->Flags & pkgCache::Flag::Essential) != pkgCache::Flag::Essential)
|
||||
return 1;
|
||||
if ((R.ParentPkg()->Flags & pkgCache::Flag::Essential) != pkgCache::Flag::Essential &&
|
||||
(L.ParentPkg()->Flags & pkgCache::Flag::Essential) == pkgCache::Flag::Essential)
|
||||
return -1;
|
||||
|
||||
if (L->Priority != R->Priority)
|
||||
return L->Priority - R->Priority;
|
||||
- return strcmp(L.ParentPkg().Name(),R.ParentPkg().Name());
|
||||
+ // PrioComp("gcc2","gcc3") == 1
|
||||
+ return strcmp(R.ParentPkg().Name(),L.ParentPkg().Name());
|
||||
}
|
||||
void pkgPrioSortList(pkgCache &Cache,pkgCache::Version **List)
|
||||
{
|
||||
unsigned long Count = 0;
|
||||
PrioCache = &Cache;
|
||||
for (pkgCache::Version **I = List; *I != 0; I++)
|
||||
Count++;
|
||||
qsort(List,Count,sizeof(*List),PrioComp);
|
||||
}
|
||||
/*}}}*/
|
||||
// vim:sts=3:sw=3
|
168
apt-0.5.5cnc4.1-alt-parseargs.patch
Normal file
168
apt-0.5.5cnc4.1-alt-parseargs.patch
Normal file
@ -0,0 +1,168 @@
|
||||
diff -uprk.orig apt-0.5.5cnc4.1.orig/apt-pkg/init.cc apt-0.5.5cnc4.1/apt-pkg/init.cc
|
||||
--- apt-0.5.5cnc4.1.orig/apt-pkg/init.cc 2003-09-28 14:11:04 +0400
|
||||
+++ apt-0.5.5cnc4.1/apt-pkg/init.cc 2003-09-28 14:11:22 +0400
|
||||
@@ -36,44 +36,44 @@ bool pkgInitConfig(Configuration &Cnf)
|
||||
// General APT things
|
||||
if (strcmp(COMMON_OS,"linux") == 0 ||
|
||||
strcmp(COMMON_OS,"unknown") == 0)
|
||||
- Cnf.Set("APT::Architecture",COMMON_CPU);
|
||||
+ Cnf.CndSet("APT::Architecture",COMMON_CPU);
|
||||
else
|
||||
- Cnf.Set("APT::Architecture",COMMON_OS "-" COMMON_CPU);
|
||||
+ Cnf.CndSet("APT::Architecture",COMMON_OS "-" COMMON_CPU);
|
||||
// CNC:2002-09-10
|
||||
- //Cnf.Set("APT::Build-Essential::", "build-essential");
|
||||
- Cnf.Set("Dir","/");
|
||||
+ //Cnf.CndSet("APT::Build-Essential::", "build-essential");
|
||||
+ Cnf.CndSet("Dir","/");
|
||||
|
||||
// State
|
||||
- Cnf.Set("Dir::State","var/lib/apt/");
|
||||
+ Cnf.CndSet("Dir::State","var/lib/apt/");
|
||||
|
||||
/* Just in case something goes horribly wrong, we can fall back to the
|
||||
old /var/state paths.. */
|
||||
struct stat St;
|
||||
if (stat("/var/lib/apt/.",&St) != 0 &&
|
||||
stat("/var/state/apt/.",&St) == 0)
|
||||
- Cnf.Set("Dir::State","var/state/apt/");
|
||||
+ Cnf.CndSet("Dir::State","var/state/apt/");
|
||||
|
||||
- Cnf.Set("Dir::State::lists","lists/");
|
||||
- Cnf.Set("Dir::State::cdroms","cdroms.list");
|
||||
+ Cnf.CndSet("Dir::State::lists","lists/");
|
||||
+ Cnf.CndSet("Dir::State::cdroms","cdroms.list");
|
||||
|
||||
// Cache
|
||||
- Cnf.Set("Dir::Cache","var/cache/apt/");
|
||||
- Cnf.Set("Dir::Cache::archives","archives/");
|
||||
- Cnf.Set("Dir::Cache::srcpkgcache","srcpkgcache.bin");
|
||||
- Cnf.Set("Dir::Cache::pkgcache","pkgcache.bin");
|
||||
+ Cnf.CndSet("Dir::Cache","var/cache/apt/");
|
||||
+ Cnf.CndSet("Dir::Cache::archives","archives/");
|
||||
+ Cnf.CndSet("Dir::Cache::srcpkgcache","srcpkgcache.bin");
|
||||
+ Cnf.CndSet("Dir::Cache::pkgcache","pkgcache.bin");
|
||||
|
||||
// Configuration
|
||||
- Cnf.Set("Dir::Etc","etc/apt/");
|
||||
- Cnf.Set("Dir::Etc::sourcelist","sources.list");
|
||||
+ Cnf.CndSet("Dir::Etc","etc/apt/");
|
||||
+ Cnf.CndSet("Dir::Etc::sourcelist","sources.list");
|
||||
// CNC:2003-03-03
|
||||
- Cnf.Set("Dir::Etc::sourceparts","sources.list.d");
|
||||
- Cnf.Set("Dir::Etc::vendorlist","vendors.list");
|
||||
- Cnf.Set("Dir::Etc::vendorparts","vendors.list.d");
|
||||
- Cnf.Set("Dir::Etc::main","apt.conf");
|
||||
- Cnf.Set("Dir::Etc::parts","apt.conf.d");
|
||||
- Cnf.Set("Dir::Etc::preferences","preferences");
|
||||
- Cnf.Set("Dir::Bin::methods","/usr/lib/apt");
|
||||
- Cnf.Set("Acquire::ComprExtension", ".bz2");
|
||||
+ Cnf.CndSet("Dir::Etc::sourceparts","sources.list.d");
|
||||
+ Cnf.CndSet("Dir::Etc::vendorlist","vendors.list");
|
||||
+ Cnf.CndSet("Dir::Etc::vendorparts","vendors.list.d");
|
||||
+ Cnf.CndSet("Dir::Etc::main","apt.conf");
|
||||
+ Cnf.CndSet("Dir::Etc::parts","apt.conf.d");
|
||||
+ Cnf.CndSet("Dir::Etc::preferences","preferences");
|
||||
+ Cnf.CndSet("Dir::Bin::methods","/usr/lib/apt");
|
||||
+ Cnf.CndSet("Acquire::ComprExtension", ".bz2");
|
||||
|
||||
bool Res = true;
|
||||
|
||||
diff -uprk.orig apt-0.5.5cnc4.1.orig/cmdline/apt-cache.cc apt-0.5.5cnc4.1/cmdline/apt-cache.cc
|
||||
--- apt-0.5.5cnc4.1.orig/cmdline/apt-cache.cc 2003-03-08 02:10:43 +0300
|
||||
+++ apt-0.5.5cnc4.1/cmdline/apt-cache.cc 2003-09-28 14:11:22 +0400
|
||||
@@ -1611,8 +1611,8 @@ int main(int argc,const char *argv[])
|
||||
|
||||
// Parse the command line and initialize the package library
|
||||
CommandLine CmdL(Args,_config);
|
||||
- if (pkgInitConfig(*_config) == false ||
|
||||
- CmdL.Parse(argc,argv) == false ||
|
||||
+ if (CmdL.Parse(argc,argv) == false ||
|
||||
+ pkgInitConfig(*_config) == false ||
|
||||
pkgInitSystem(*_config,_system) == false)
|
||||
{
|
||||
_error->DumpErrors();
|
||||
diff -uprk.orig apt-0.5.5cnc4.1.orig/cmdline/apt-cdrom.cc apt-0.5.5cnc4.1/cmdline/apt-cdrom.cc
|
||||
--- apt-0.5.5cnc4.1.orig/cmdline/apt-cdrom.cc 2003-09-28 14:11:04 +0400
|
||||
+++ apt-0.5.5cnc4.1/cmdline/apt-cdrom.cc 2003-09-28 14:11:22 +0400
|
||||
@@ -904,8 +904,8 @@ int main(int argc,const char *argv[])
|
||||
|
||||
// Parse the command line and initialize the package library
|
||||
CommandLine CmdL(Args,_config);
|
||||
- if (pkgInitConfig(*_config) == false ||
|
||||
- CmdL.Parse(argc,argv) == false ||
|
||||
+ if (CmdL.Parse(argc,argv) == false ||
|
||||
+ pkgInitConfig(*_config) == false ||
|
||||
pkgInitSystem(*_config,_system) == false)
|
||||
{
|
||||
_error->DumpErrors();
|
||||
diff -uprk.orig apt-0.5.5cnc4.1.orig/cmdline/apt-config.cc apt-0.5.5cnc4.1/cmdline/apt-config.cc
|
||||
--- apt-0.5.5cnc4.1.orig/cmdline/apt-config.cc 2003-03-08 02:10:37 +0300
|
||||
+++ apt-0.5.5cnc4.1/cmdline/apt-config.cc 2003-09-28 14:11:22 +0400
|
||||
@@ -109,8 +109,8 @@ int main(int argc,const char *argv[])
|
||||
|
||||
// Parse the command line and initialize the package library
|
||||
CommandLine CmdL(Args,_config);
|
||||
- if (pkgInitConfig(*_config) == false ||
|
||||
- CmdL.Parse(argc,argv) == false ||
|
||||
+ if (CmdL.Parse(argc,argv) == false ||
|
||||
+ pkgInitConfig(*_config) == false ||
|
||||
pkgInitSystem(*_config,_system) == false)
|
||||
{
|
||||
_error->DumpErrors();
|
||||
diff -uprk.orig apt-0.5.5cnc4.1.orig/cmdline/apt-extracttemplates.cc apt-0.5.5cnc4.1/cmdline/apt-extracttemplates.cc
|
||||
--- apt-0.5.5cnc4.1.orig/cmdline/apt-extracttemplates.cc 2003-03-08 02:10:21 +0300
|
||||
+++ apt-0.5.5cnc4.1/cmdline/apt-extracttemplates.cc 2003-09-28 14:11:22 +0400
|
||||
@@ -359,8 +359,8 @@ int main(int argc, const char **argv)
|
||||
|
||||
// Parse the command line and initialize the package library
|
||||
CommandLine CmdL(Args,_config);
|
||||
- if (pkgInitConfig(*_config) == false ||
|
||||
- CmdL.Parse(argc,argv) == false ||
|
||||
+ if (CmdL.Parse(argc,argv) == false ||
|
||||
+ pkgInitConfig(*_config) == false ||
|
||||
pkgInitSystem(*_config,_system) == false)
|
||||
{
|
||||
_error->DumpErrors();
|
||||
diff -uprk.orig apt-0.5.5cnc4.1.orig/cmdline/apt-get.cc apt-0.5.5cnc4.1/cmdline/apt-get.cc
|
||||
--- apt-0.5.5cnc4.1.orig/cmdline/apt-get.cc 2003-09-28 14:11:04 +0400
|
||||
+++ apt-0.5.5cnc4.1/cmdline/apt-get.cc 2003-09-28 14:11:22 +0400
|
||||
@@ -2497,8 +2497,8 @@ int main(int argc,const char *argv[])
|
||||
|
||||
// Parse the command line and initialize the package library
|
||||
CommandLine CmdL(Args,_config);
|
||||
- if (pkgInitConfig(*_config) == false ||
|
||||
- CmdL.Parse(argc,argv) == false ||
|
||||
+ if (CmdL.Parse(argc,argv) == false ||
|
||||
+ pkgInitConfig(*_config) == false ||
|
||||
pkgInitSystem(*_config,_system) == false)
|
||||
{
|
||||
if (_config->FindB("version") == true)
|
||||
diff -uprk.orig apt-0.5.5cnc4.1.orig/cmdline/apt-shell.cc apt-0.5.5cnc4.1/cmdline/apt-shell.cc
|
||||
--- apt-0.5.5cnc4.1.orig/cmdline/apt-shell.cc 2003-03-08 02:10:37 +0300
|
||||
+++ apt-0.5.5cnc4.1/cmdline/apt-shell.cc 2003-09-28 14:11:22 +0400
|
||||
@@ -3738,8 +3738,8 @@ int main(int argc,const char *argv[])
|
||||
|
||||
// Parse the command line and initialize the package library
|
||||
CommandLine CmdL(CommandArgs(""),_config);
|
||||
- if (pkgInitConfig(*_config) == false ||
|
||||
- CmdL.Parse(argc,argv) == false ||
|
||||
+ if (CmdL.Parse(argc,argv) == false ||
|
||||
+ pkgInitConfig(*_config) == false ||
|
||||
pkgInitSystem(*_config,_system) == false)
|
||||
{
|
||||
if (_config->FindB("version") == true)
|
||||
diff -uprk.orig apt-0.5.5cnc4.1.orig/cmdline/apt-sortpkgs.cc apt-0.5.5cnc4.1/cmdline/apt-sortpkgs.cc
|
||||
--- apt-0.5.5cnc4.1.orig/cmdline/apt-sortpkgs.cc 2003-03-08 02:10:30 +0300
|
||||
+++ apt-0.5.5cnc4.1/cmdline/apt-sortpkgs.cc 2003-09-28 14:11:22 +0400
|
||||
@@ -180,8 +180,8 @@ int main(unsigned int argc,const char *a
|
||||
|
||||
// Parse the command line and initialize the package library
|
||||
CommandLine CmdL(Args,_config);
|
||||
- if (pkgInitConfig(*_config) == false ||
|
||||
- CmdL.Parse(argc,argv) == false ||
|
||||
+ if (CmdL.Parse(argc,argv) == false ||
|
||||
+ pkgInitConfig(*_config) == false ||
|
||||
pkgInitSystem(*_config,_system) == false)
|
||||
{
|
||||
_error->DumpErrors();
|
46
apt-0.5.5cnc4.1-alt-rpm-fancypercent.patch
Normal file
46
apt-0.5.5cnc4.1-alt-rpm-fancypercent.patch
Normal file
@ -0,0 +1,46 @@
|
||||
2003-09-28 Dmitry V. Levin <ldv@altlinux.org>
|
||||
|
||||
* apt-pkg/rpm/rpmpm.cc(pkgRPMPM::ExecRPM):
|
||||
Honor "quiet" config option.
|
||||
Pass "fancypercent" option.
|
||||
|
||||
--- apt-0.5.5cnc4.1/apt-pkg/rpm/rpmpm.cc.orig 2003-09-28 14:18:22 +0400
|
||||
+++ apt-0.5.5cnc4.1/apt-pkg/rpm/rpmpm.cc 2003-09-28 14:22:42 +0400
|
||||
@@ -227,6 +227,7 @@ bool pkgRPMPM::ExecRPM(Item::RPMOps op,
|
||||
const char *operation;
|
||||
unsigned int n = 0;
|
||||
bool Interactive = _config->FindB("RPM::Interactive",true);
|
||||
+ int quiet = _config->FindI("quiet",0);
|
||||
|
||||
Args[n++] = _config->Find("Dir::Bin::rpm","rpm").c_str();
|
||||
|
||||
@@ -235,7 +236,7 @@ bool pkgRPMPM::ExecRPM(Item::RPMOps op,
|
||||
switch (op)
|
||||
{
|
||||
case Item::RPMInstall:
|
||||
- if (Interactive)
|
||||
+ if (Interactive && quiet < 2)
|
||||
operation = "-ivh";
|
||||
else
|
||||
operation = "-iv";
|
||||
@@ -243,7 +244,7 @@ bool pkgRPMPM::ExecRPM(Item::RPMOps op,
|
||||
break;
|
||||
|
||||
case Item::RPMUpgrade:
|
||||
- if (Interactive)
|
||||
+ if (Interactive && quiet < 2)
|
||||
operation = "-Uvh";
|
||||
else
|
||||
operation = "-Uv";
|
||||
@@ -256,8 +257,10 @@ bool pkgRPMPM::ExecRPM(Item::RPMOps op,
|
||||
}
|
||||
Args[n++] = operation;
|
||||
|
||||
- if (Interactive == false && op != Item::RPMErase)
|
||||
+ if (Interactive == false && quiet == 0 && op != Item::RPMErase)
|
||||
Args[n++] = "--percent";
|
||||
+ if (Interactive && quiet == 0)
|
||||
+ Args[n++] = "--fancypercent";
|
||||
|
||||
string rootdir = _config->Find("RPM::RootDir", "");
|
||||
if (!rootdir.empty())
|
94
apt-0.5.5cnc4.1-alt-virtual_scores.patch
Normal file
94
apt-0.5.5cnc4.1-alt-virtual_scores.patch
Normal file
@ -0,0 +1,94 @@
|
||||
diff -uprk.orig apt-0.5.5cnc4.1.orig/apt-pkg/algorithms.cc apt-0.5.5cnc4.1/apt-pkg/algorithms.cc
|
||||
--- apt-0.5.5cnc4.1.orig/apt-pkg/algorithms.cc 2003-09-29 17:21:22 +0400
|
||||
+++ apt-0.5.5cnc4.1/apt-pkg/algorithms.cc 2003-09-29 17:29:26 +0400
|
||||
@@ -540,6 +540,9 @@ int pkgProblemResolver::ScoreSort(const
|
||||
// ProblemResolver::MakeScores - Make the score table /*{{{*/
|
||||
// ---------------------------------------------------------------------
|
||||
/* */
|
||||
+
|
||||
+#include "rpm/rpmpackagedata.h"
|
||||
+
|
||||
void pkgProblemResolver::MakeScores()
|
||||
{
|
||||
unsigned long Size = Cache.Head().PackageCount;
|
||||
@@ -623,13 +626,28 @@ void pkgProblemResolver::MakeScores()
|
||||
|
||||
/* Protected things are pushed really high up. This number should put them
|
||||
ahead of everything */
|
||||
+ RPMPackageData *rpmdata = new RPMPackageData();
|
||||
for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
|
||||
{
|
||||
if ((Flags[I->ID] & Protected) != 0)
|
||||
Scores[I->ID] += 10000;
|
||||
if ((I->Flags & pkgCache::Flag::Essential) == pkgCache::Flag::Essential)
|
||||
Scores[I->ID] += 5000;
|
||||
+ pkgCache::State::VerPriority p = rpmdata->VerPriority(I.Name());
|
||||
+ switch (p) {
|
||||
+ case pkgCache::State::Important:
|
||||
+ Scores[I->ID] += 1000;
|
||||
+ case pkgCache::State::Required:
|
||||
+ Scores[I->ID] += 1000;
|
||||
+ case pkgCache::State::Standard:
|
||||
+ Scores[I->ID] += 1000;
|
||||
+ case pkgCache::State::Optional:
|
||||
+ case pkgCache::State::Extra:
|
||||
+ default:
|
||||
+ break;
|
||||
+ }
|
||||
}
|
||||
+ This = this;
|
||||
}
|
||||
/*}}}*/
|
||||
// ProblemResolver::DoUpgrade - Attempt to upgrade this package /*{{{*/
|
||||
diff -uprk.orig apt-0.5.5cnc4.1.orig/apt-pkg/algorithms.h apt-0.5.5cnc4.1/apt-pkg/algorithms.h
|
||||
--- apt-0.5.5cnc4.1.orig/apt-pkg/algorithms.h 2003-03-08 02:11:36 +0300
|
||||
+++ apt-0.5.5cnc4.1/apt-pkg/algorithms.h 2003-09-29 17:25:17 +0400
|
||||
@@ -96,7 +96,6 @@ class pkgProblemResolver
|
||||
|
||||
// Sort stuff
|
||||
static pkgProblemResolver *This;
|
||||
- static int ScoreSort(const void *a,const void *b);
|
||||
|
||||
struct PackageKill
|
||||
{
|
||||
@@ -104,7 +103,6 @@ class pkgProblemResolver
|
||||
DepIterator Dep;
|
||||
};
|
||||
|
||||
- void MakeScores();
|
||||
bool DoUpgrade(pkgCache::PkgIterator Pkg);
|
||||
|
||||
public:
|
||||
@@ -125,6 +123,10 @@ class pkgProblemResolver
|
||||
|
||||
pkgProblemResolver(pkgDepCache *Cache);
|
||||
~pkgProblemResolver();
|
||||
+
|
||||
+ // Sort stuff
|
||||
+ static int ScoreSort(const void *a,const void *b);
|
||||
+ void MakeScores();
|
||||
};
|
||||
|
||||
bool pkgDistUpgrade(pkgDepCache &Cache);
|
||||
diff -uprk.orig apt-0.5.5cnc4.1.orig/cmdline/apt-get.cc apt-0.5.5cnc4.1/cmdline/apt-get.cc
|
||||
--- apt-0.5.5cnc4.1.orig/cmdline/apt-get.cc 2003-09-29 17:21:22 +0400
|
||||
+++ apt-0.5.5cnc4.1/cmdline/apt-get.cc 2003-09-29 17:27:28 +0400
|
||||
@@ -1056,7 +1056,17 @@ bool TryToInstall(pkgCache::PkgIterator
|
||||
if ((Pkg.ProvidesList()->NextProvides == 0 ||
|
||||
(!Remove && _config->FindB("APT::Install::Virtual", false))))
|
||||
{
|
||||
- pkgCache::PkgIterator po = Pkg.ProvidesList().OwnerPkg();
|
||||
+ unsigned long Size = 0;
|
||||
+ for (pkgCache::PrvIterator I = Pkg.ProvidesList(); I.end() == false; I++)
|
||||
+ Size++;
|
||||
+ SPtrArray<pkgCache::Package *> PList = new pkgCache::Package *[Size];
|
||||
+ pkgCache::Package **PEnd = PList;
|
||||
+ for (pkgCache::PrvIterator I = Pkg.ProvidesList(); I.end() == false; I++)
|
||||
+ *PEnd++ = I.OwnerPkg();
|
||||
+ Fix.MakeScores();
|
||||
+ qsort(PList,PEnd - PList,sizeof(*PList),&(Fix.ScoreSort));
|
||||
+ pkgCache::PkgIterator po = pkgCache::PkgIterator(*Pkg.Cache(), *PList);
|
||||
+
|
||||
ioprintf(c1out,_("Note, selecting %s instead of %s\n"),
|
||||
po.Name(),Pkg.Name());
|
||||
Pkg = po;
|
61
apt-cnc-20030322-algo.patch
Normal file
61
apt-cnc-20030322-algo.patch
Normal file
@ -0,0 +1,61 @@
|
||||
diff -ur apt-0.5.5cnc4.1/apt-pkg/algorithms.cc apt-0.5.5cnc4.1_20030324a/apt-pkg/algorithms.cc
|
||||
--- apt-0.5.5cnc4.1/apt-pkg/algorithms.cc 2003-03-08 02:12:08 +0300
|
||||
+++ apt-0.5.5cnc4.1_20030324a/apt-pkg/algorithms.cc 2003-03-24 20:27:31 +0300
|
||||
@@ -419,7 +419,8 @@
|
||||
if (_config->FindB("APT::Remove-Depends",false) == true)
|
||||
Fix.RemoveDepends();
|
||||
|
||||
- return Fix.Resolve();
|
||||
+ // CNC:2003-03-22
|
||||
+ return Fix.Resolve(true);
|
||||
}
|
||||
/*}}}*/
|
||||
// AllUpgrade - Upgrade as many packages as possible /*{{{*/
|
||||
@@ -1029,6 +1030,22 @@
|
||||
if ((Flags[Pkg->ID] & Protected) != 0)
|
||||
continue;
|
||||
|
||||
+ // CNC:2003-03-22
|
||||
+ pkgDepCache::State State(&Cache);
|
||||
+ if (BrokenFix == true && DoUpgrade(Pkg) == true)
|
||||
+ {
|
||||
+ if (Cache[I].InstBroken() == false &&
|
||||
+ State.BrokenCount() >= Cache.BrokenCount())
|
||||
+ {
|
||||
+ if (Debug == true)
|
||||
+ clog << " Installing " << Pkg.Name() << endl;
|
||||
+ Change = true;
|
||||
+ break;
|
||||
+ }
|
||||
+ else
|
||||
+ State.Restore();
|
||||
+ }
|
||||
+
|
||||
if (Debug == true)
|
||||
clog << " Added " << Pkg.Name() << " to the remove list" << endl;
|
||||
|
||||
@@ -1405,7 +1422,7 @@
|
||||
return -1;
|
||||
|
||||
if (L->Priority != R->Priority)
|
||||
- return R->Priority - L->Priority;
|
||||
+ return L->Priority - R->Priority;
|
||||
return strcmp(L.ParentPkg().Name(),R.ParentPkg().Name());
|
||||
}
|
||||
void pkgPrioSortList(pkgCache &Cache,pkgCache::Version **List)
|
||||
diff -ur apt-0.5.5cnc4.1/apt-pkg/rpm/rpmpackagedata.h apt-0.5.5cnc4.1_20030324a/apt-pkg/rpm/rpmpackagedata.h
|
||||
--- apt-0.5.5cnc4.1/apt-pkg/rpm/rpmpackagedata.h 2003-03-08 02:12:32 +0300
|
||||
+++ apt-0.5.5cnc4.1_20030324a/apt-pkg/rpm/rpmpackagedata.h 2003-03-21 02:30:15 +0300
|
||||
@@ -67,7 +67,11 @@
|
||||
public:
|
||||
|
||||
inline pkgCache::State::VerPriority VerPriority(string Package)
|
||||
- {return Priorities[Package];};
|
||||
+ {
|
||||
+ if (Priorities.find(Package) != Priorities.end())
|
||||
+ return Priorities[Package];
|
||||
+ return pkgCache::State::Optional;
|
||||
+ };
|
||||
inline pkgCache::Flag::PkgFlags PkgFlags(string Package)
|
||||
{return Flags[Package];};
|
||||
|
60
apt.conf
60
apt.conf
@ -1,52 +1,22 @@
|
||||
Dir
|
||||
{
|
||||
Bin
|
||||
{
|
||||
Methods "/usr/lib/apt";
|
||||
};
|
||||
};
|
||||
|
||||
APT
|
||||
{
|
||||
Get
|
||||
{
|
||||
Show-Upgraded "true";
|
||||
};
|
||||
|
||||
GPG
|
||||
{
|
||||
Pubring "/usr/lib/alt-gpgkeys/pubring.gpg";
|
||||
};
|
||||
|
||||
Architecture "i586";
|
||||
};
|
||||
|
||||
Debug
|
||||
{
|
||||
Acquire::cdrom "false";
|
||||
Acquire::Ftp "false";
|
||||
Acquire::http "false";
|
||||
aptcdrom "false";
|
||||
NoLocking "false";
|
||||
pkgRPMPM "false";
|
||||
pkgAcquire::Auth "false";
|
||||
pkgAcquire::Worker "false";
|
||||
pkgAcquire "false";
|
||||
pkgProblemResolver "false";
|
||||
pkgInitConfig "false";
|
||||
pkgOrderList "false";
|
||||
pkgPackageManager "false";
|
||||
pkgPolicy "false";
|
||||
identcdrom "false";
|
||||
};
|
||||
/*
|
||||
* This is the main configuration file for the APT suite of tools,
|
||||
* see apt.conf(5) for details.
|
||||
*/
|
||||
|
||||
// See apt-cdrom(8) for details.
|
||||
Acquire::CDROM::Copy "true";
|
||||
Acquire::CDROM::mount "/mnt/cdrom";
|
||||
|
||||
RPM
|
||||
{
|
||||
Allow-Duplicated {"^(NVIDIA_)?(kernel|alsa)[0-9]*(-adv|-linus)?($|-up|-smp|-secure|-custom|-enterprise|-BOOT|-tape|-aureal)";};
|
||||
Hold {"^(kernel|alsa)[0-9]*-source";};
|
||||
Interactive "true";
|
||||
Order "true";
|
||||
Allow-Duplicated {
|
||||
// Old-style kernels.
|
||||
"^(NVIDIA_)?(kernel|alsa)[0-9]*(-adv|-linus)?($|-up|-smp|-secure|-custom|-enterprise|-BOOT|-tape|-aureal)";
|
||||
// New-style kernels.
|
||||
"^kernel-(image|modules)-.*";
|
||||
};
|
||||
Hold {
|
||||
// Old-style kernels.
|
||||
"^(kernel|alsa)[0-9]+-source";
|
||||
};
|
||||
};
|
||||
|
@ -1,8 +1,8 @@
|
||||
# hey Emacs, its -*- mode: rpm-spec; coding: cyrillic-cp1251; -*-
|
||||
|
||||
Name: apt
|
||||
Version: 0.5.5cnc1
|
||||
Release: alt3
|
||||
Version: 0.5.5cnc4.1
|
||||
Release: alt7
|
||||
|
||||
Summary: Debian's Advanced Packaging Tool with RPM support
|
||||
Summary(ru_RU.CP1251): Debian APT - Óñîâåðøåíñòâîâàííîå ñðåäñòâî óïðàâëåíèÿ ïàêåòàìè ñ ïîääåðæêîé RPM
|
||||
@ -10,6 +10,8 @@ License: GPL
|
||||
Group: System/Configuration/Packaging
|
||||
Packager: APT Development Team <apt@packages.altlinux.org>
|
||||
|
||||
%def_without static
|
||||
|
||||
Source0: http://moin.conectiva.com.br/files/AptRpm/attachments/%name-%version.tar.bz2
|
||||
Source1: apt.conf
|
||||
Source2: genbasedir
|
||||
@ -17,34 +19,30 @@ Source3: README.rsync
|
||||
Source4: apt.8
|
||||
Source5: apt.ru.po
|
||||
|
||||
Patch1: apt-0.5.5cnc1-alt-distro.patch
|
||||
#Patch2: apt-0.5.4cnc1-alt-INLINEDEPFLAG.patch
|
||||
Patch3: apt-0.5.4cnc1-alt-configure-build.patch
|
||||
Patch4: apt-0.5.4cnc9-alt-getsrc.patch
|
||||
Patch5: apt-0.5.4cnc3-alt-md5hash-debug.patch
|
||||
Patch6: apt-0.5.4cnc9-alt-rsync.patch
|
||||
Patch7: apt-0.5.4cnc8-alt-rpm_cmd.patch
|
||||
Patch8: apt-0.5.4cnc8-alt-rpm-fancypercent.patch
|
||||
#Patch9: apt-0.5.4cnc9-alt-algo.patch
|
||||
#Patch10: apt-0.5.4cnc9-alt-replace.patch
|
||||
#Patch11: apt-0.5.4cnc9-alt-fixes.patch
|
||||
#Patch12: apt-0.5.4cnc9-alt-CachedMD5.patch
|
||||
Patch13: apt-0.5.5cnc1-alt-pkgpriorities.patch
|
||||
Patch14: apt-0.5.4cnc9-alt-bz2.patch
|
||||
#Patch15: apt-0.5.4cnc9-alt-rename-segfault.patch
|
||||
Patch16: apt-0.5.4cnc9-alt-rpmlistparser-kernel.patch
|
||||
Patch17: apt-0.5.4cnc9-alt-packagemanager-CheckRConflicts.patch
|
||||
Patch18: apt-0.5.4cnc9-alt-install_virtual.patch
|
||||
Patch19: apt-0.5.4cnc9-alt-specialchars.patch
|
||||
#Patch20: apt-0.5.4cnc9-alt-rpmrecords_epoch.patch
|
||||
#Patch21: apt-0.5.4cnc9-alt-lockfix.patch
|
||||
Patch22: apt-0.5.4cnc9-alt-install_virtual_version.patch
|
||||
Patch23: apt-0.5.5cnc1-alt-methods_gpg_homedir.patch
|
||||
Patch24: apt-0.5.4cnc9-alt-pkgorderlist_score.patch
|
||||
#Patch25: apt-0.5.4cnc9-alt-cdrom-unmount.patch
|
||||
Patch26: apt-0.5.5cnc1-alt-APT_DOMAIN.patch
|
||||
Patch27: apt-0.5.5cnc1-mattdm-manbuild.patch
|
||||
Patch28: apt-0.5.5cnc1-alt-debsystem.patch
|
||||
Patch1: apt-0.5.5cnc2-alt-distro.patch
|
||||
Patch2: apt-0.5.5cnc2-alt-rpm.patch
|
||||
Patch3: apt-0.5.4cnc9-alt-getsrc.patch
|
||||
Patch4: apt-0.5.4cnc3-alt-md5hash-debug.patch
|
||||
Patch5: apt-0.5.4cnc9-alt-rsync.patch
|
||||
Patch6: apt-0.5.5cnc4-alt-rpm_cmd.patch
|
||||
Patch7: apt-0.5.5cnc4.1-alt-rpm-fancypercent.patch
|
||||
Patch8: apt-0.5.5cnc1-alt-pkgpriorities.patch
|
||||
Patch9: apt-0.5.4cnc9-alt-bz2.patch
|
||||
Patch10: apt-0.5.4cnc9-alt-packagemanager-CheckRConflicts.patch
|
||||
Patch11: apt-0.5.5cnc4-alt-install_virtual.patch
|
||||
Patch12: apt-0.5.4cnc9-alt-install_virtual_version.patch
|
||||
Patch13: apt-0.5.5cnc1-alt-methods_gpg_homedir.patch
|
||||
Patch14: apt-0.5.4cnc9-alt-pkgorderlist_score.patch
|
||||
Patch15: apt-0.5.5cnc1-alt-debsystem.patch
|
||||
Patch16: apt-0.5.5cnc3-alt-i18n-apt-cdrom.patch
|
||||
Patch17: apt-0.5.5cnc4-alt-tinfo.patch
|
||||
Patch18: apt-cnc-20030322-algo.patch
|
||||
Patch19: apt-0.5.5cnc4-alt-versionmatch.patch
|
||||
Patch20: apt-0.5.5cnc4-alt-versionmatch2.patch
|
||||
Patch21: apt-0.5.5cnc4-alt-defaults.patch
|
||||
Patch22: apt-0.5.5cnc4.1-alt-fixpriorsort.patch
|
||||
Patch23: apt-0.5.5cnc4.1-alt-parseargs.patch
|
||||
Patch24: apt-0.5.5cnc4.1-alt-virtual_scores.patch
|
||||
|
||||
# Need to be adopted. Or not?
|
||||
Patch31: apt-0.3.19cnc53-stelian-apt-pkg-algorithms-scores.patch
|
||||
@ -60,8 +58,8 @@ Obsoletes: apt-0.5
|
||||
|
||||
BuildPreReq: librpm-devel >= 4.0.4, rpm-build >= 4.0.4
|
||||
|
||||
# Automatically added by buildreq on Wed Feb 12 2003
|
||||
BuildRequires: bzlib-devel docbook-dtds docbook-utils gcc-c++ libdb2-devel libpopt-devel librpm-devel libstdc++-devel openjade perl-SGMLSpm sgml-common xml-common zlib-devel
|
||||
# Automatically added by buildreq on Tue Mar 11 2003
|
||||
BuildRequires: docbook-dtds docbook-utils gcc-c++ libreadline-devel librpm-devel libstdc++-devel libtinfo-devel openjade perl-SGMLSpm sgml-common xml-common
|
||||
|
||||
%define risk_usage_en This package is still under development.
|
||||
|
||||
@ -193,33 +191,29 @@ This package contains method 'rsync' for APT.
|
||||
%prep
|
||||
%setup -q -n apt-%version
|
||||
%patch1 -p1
|
||||
#%patch2 -p1
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
%patch5 -p1
|
||||
%patch6 -p1
|
||||
%patch7 -p1
|
||||
%patch8 -p1
|
||||
#%patch9 -p1
|
||||
#%patch10 -p1
|
||||
#%patch11 -p1
|
||||
#%patch12 -p1
|
||||
%patch9 -p1
|
||||
%patch10 -p1
|
||||
%patch11 -p1
|
||||
%patch12 -p1
|
||||
%patch13 -p1
|
||||
%patch14 -p1
|
||||
#%patch15 -p1
|
||||
%patch15 -p1
|
||||
%patch16 -p1
|
||||
%patch17 -p1
|
||||
%patch18 -p1
|
||||
%patch19 -p1
|
||||
#%patch20 -p1
|
||||
#%patch21 -p1
|
||||
%patch20 -p1
|
||||
%patch21 -p1
|
||||
%patch22 -p1
|
||||
%patch23 -p1
|
||||
%patch24 -p1
|
||||
#%patch25 -p1
|
||||
%patch26 -p1
|
||||
%patch27 -p1
|
||||
%patch28 -p1
|
||||
|
||||
# Need to be adopted. Or not?
|
||||
#%patch31 -p1
|
||||
@ -231,6 +225,8 @@ This package contains method 'rsync' for APT.
|
||||
%__install -p -m644 %SOURCE3 %SOURCE4 .
|
||||
%__install -p -m644 %SOURCE5 po/ru.po
|
||||
|
||||
find -type f -name \*.orig -print -delete
|
||||
|
||||
%build
|
||||
%add_optflags -fno-exceptions -D_GNU_SOURCE
|
||||
pushd doc
|
||||
@ -258,15 +254,17 @@ find -type f -print0 |
|
||||
|
||||
%make clean
|
||||
|
||||
%make_build STATICLIBS=1 NOISY=1
|
||||
%make_build %{?_enable_static:STATICLIBS=1} NOISY=1
|
||||
|
||||
%install
|
||||
%__mkdir_p $RPM_BUILD_ROOT{%_bindir,%_libdir/apt,%_mandir/man{1,5,8},%_includedir/apt-pkg,%_includedir/apt-inst,%_sysconfdir/apt/{vendors.list.d,apt.conf.d}}
|
||||
%__mkdir_p $RPM_BUILD_ROOT%_localstatedir/apt/lists/partial
|
||||
%__mkdir_p $RPM_BUILD_ROOT{%_bindir,%_libdir/apt,%_mandir/man{1,5,8},%_includedir/apt-pkg,%_includedir/apt-inst,%_sysconfdir/apt/{apt.conf,sources.list,vendors.list}.d}
|
||||
%__mkdir_p $RPM_BUILD_ROOT%_localstatedir/apt/{lists/partial,prefetch}
|
||||
%__mkdir_p $RPM_BUILD_ROOT/var/cache/apt/{archives/partial,gen{pkg,src}list}
|
||||
|
||||
%__cp -a bin/lib*.so* $RPM_BUILD_ROOT%_libdir/
|
||||
%if_enabled static
|
||||
%__cp -a bin/lib*.a* $RPM_BUILD_ROOT%_libdir/
|
||||
%endif
|
||||
|
||||
%__install -p -m755 bin/methods/* $RPM_BUILD_ROOT%_libdir/apt/
|
||||
%__install -p -m755 bin/apt-* $RPM_BUILD_ROOT%_bindir/
|
||||
@ -311,8 +309,7 @@ fi
|
||||
%exclude %_libdir/apt/rsync
|
||||
%dir %_sysconfdir/apt
|
||||
%config(noreplace) %_sysconfdir/apt/apt.conf
|
||||
%dir %_sysconfdir/apt/apt.conf.d
|
||||
%dir %_sysconfdir/apt/vendors.list.d
|
||||
%dir %_sysconfdir/apt/*.d
|
||||
%_mandir/man?/*
|
||||
%docdir
|
||||
%_localstatedir/apt
|
||||
@ -337,14 +334,74 @@ fi
|
||||
%_libdir/*.so
|
||||
%_includedir/*
|
||||
|
||||
%if_enabled static
|
||||
%files -n libapt-devel-static
|
||||
%_libdir/*.a
|
||||
%endif
|
||||
|
||||
%files rsync
|
||||
%dir %_libdir/apt
|
||||
%_libdir/apt/rsync
|
||||
|
||||
%changelog
|
||||
* Sun Sep 28 2003 Dmitry V. Levin <ldv@altlinux.org> 0.5.5cnc4.1-alt7
|
||||
- apt-pkg/rpm/rpmpm.cc(pkgRPMPM::ExecRPM): honor "quiet" option.
|
||||
- Additional sorting hacks for virtual packages (mouse).
|
||||
|
||||
* Wed Sep 03 2003 Rider <rider@altlinux.ru> 0.5.5cnc4.1-alt6
|
||||
- Fixed sorting of equal packages names with different versions (Mouse).
|
||||
- Fixed parsing command line arguments (Mouse).
|
||||
|
||||
* Tue Jun 24 2003 Dmitry V. Levin <ldv@altlinux.org> 0.5.5cnc4.1-alt5
|
||||
- apt-get: Optimize pure virtual packages install.
|
||||
- libapt,apt-get: Use pkgVersioningSystem's CheckDep algorithm
|
||||
for normal version match.
|
||||
- Changed some defaults in code rather then in /etc/apt.conf;
|
||||
cleaned up /etc/apt.conf file.
|
||||
- Do not build static libraries by default.
|
||||
|
||||
* Mon Apr 28 2003 Dmitry V. Levin <ldv@altlinux.org> 0.5.5cnc4.1-alt4
|
||||
- apt-get: substitute virtual package with real one (mouse).
|
||||
- libapt: ignore serial and check both for version and
|
||||
version-release while matching version string (mouse).
|
||||
- Mouse birthday edition.
|
||||
|
||||
* Tue Mar 25 2003 Dmitry V. Levin <ldv@altlinux.org> 0.5.5cnc4.1-alt3
|
||||
- Applied cnc-20030322 algorithm changes.
|
||||
- Updated russian translation (avd).
|
||||
|
||||
* Tue Mar 11 2003 Dmitry V. Levin <ldv@altlinux.org> 0.5.5cnc4.1-alt2
|
||||
- Fixed -lncurses/-ltinfo linkage.
|
||||
- Updated buildrequires.
|
||||
|
||||
* Sat Mar 08 2003 Dmitry V. Levin <ldv@altlinux.org> 0.5.5cnc4.1-alt1
|
||||
- Updated to 0.5.5cnc4.1
|
||||
|
||||
* Fri Mar 07 2003 Dmitry V. Levin <ldv@altlinux.org> 0.5.5cnc4-alt1
|
||||
- Updated to 0.5.5cnc4, renumbered patches.
|
||||
- Updated patches:
|
||||
+ alt-rpm_cmd
|
||||
- Removed patches due to upstream fixes:
|
||||
+ alt-APT_DOMAIN
|
||||
+ alt-specialchars
|
||||
- Packaged directories:
|
||||
+ Dir::Etc::sourceparts (/etc/apt/sources.list.d);
|
||||
+ Dir::State::prefetch (/var/lib/apt/prefetch).
|
||||
- apt-cdrom: i18n'ed (avd).
|
||||
- Updated russian translation (avd).
|
||||
|
||||
* Fri Feb 28 2003 Dmitry V. Levin <ldv@altlinux.org> 0.5.5cnc3-alt1
|
||||
- Updated to 0.5.5cnc3
|
||||
|
||||
* Sun Feb 23 2003 Dmitry V. Levin <ldv@altlinux.org> 0.5.5cnc2-alt1
|
||||
- Updated to 0.5.5cnc2
|
||||
- Merged upstream patches:
|
||||
+ alt-rpmlistparser-kernel
|
||||
+ mattdm-manbuild
|
||||
- Updated genbasedir (svd).
|
||||
- Cleaned up genbasedir a bit.
|
||||
- Cleaned up and updated buildrequires.
|
||||
|
||||
* Thu Feb 13 2003 Dmitry V. Levin <ldv@altlinux.org> 0.5.5cnc1-alt3
|
||||
- Introduced APT::Ignore-dpkg support and set this flag by default,
|
||||
to address #0002119.
|
||||
@ -941,5 +998,5 @@ fi
|
||||
- initial package creation. Yeah, it's totally broken for sure.
|
||||
|
||||
# Local Variables:
|
||||
# compile-command: "rpmbuild --target=i586 -ba apt.spec"
|
||||
# compile-command: "rpmbuild -ba --target=i586 apt.spec"
|
||||
# End:
|
@ -1 +0,0 @@
|
||||
build
|
@ -8,8 +8,6 @@ To compile this you need a couple things
|
||||
- A working ANSI C++ compiler, this is not g++ 2.7.*
|
||||
g++ 2.8 works OK and newer egcs work well also. Nobody has tried it
|
||||
on other compilers :< You will need a properly working STL as well.
|
||||
g++ 3 does not presently work because they made the STL headers
|
||||
use namespaces.
|
||||
- A C library with the usual POSIX functions and a BSD socket layer.
|
||||
If you OS conforms to the Single Unix Spec then you are fine:
|
||||
http://www.opengroup.org/onlinepubs/7908799/index.html
|
||||
|
@ -11,15 +11,16 @@ default: startup all
|
||||
|
||||
.PHONY: headers library clean veryclean all binary program doc
|
||||
all headers library clean veryclean binary program doc dirs:
|
||||
# CNC:2003-02-15
|
||||
$(MAKE) -C apt-pkg $@
|
||||
$(MAKE) -C apt-inst $@
|
||||
#$(MAKE) -C apt-inst $@
|
||||
$(MAKE) -C methods $@
|
||||
$(MAKE) -C cmdline $@
|
||||
$(MAKE) -C ftparchive $@
|
||||
$(MAKE) -C dselect $@
|
||||
#$(MAKE) -C ftparchive $@
|
||||
#$(MAKE) -C dselect $@
|
||||
$(MAKE) -C doc $@
|
||||
$(MAKE) -C po $@
|
||||
$(MAKE) -C tools $@
|
||||
$(MAKE) -C po $@
|
||||
|
||||
# Some very common aliases
|
||||
.PHONY: maintainer-clean dist-clean distclean pristine sanity
|
||||
|
@ -1,38 +0,0 @@
|
||||
|
||||
RPM enabled APT
|
||||
|
||||
WARNING
|
||||
=======
|
||||
This is an EARLY DEVELOPMENT release of apt-get. It might
|
||||
F*&# UP YOUR SYSTEM BEYOND REPAIR. So use at your own
|
||||
risk etc etc bla bla.
|
||||
|
||||
DO NOT TRY TO COMPILE THIS ON A DEBIAN SYSTEM.
|
||||
THIS IS A WORK IN PROGRESS AND WILL NOT WORK ON DEBIAN
|
||||
RIGHT NOW.
|
||||
|
||||
If you find a problem, contact niemeyer@conectiva.com,
|
||||
not the original developers.
|
||||
|
||||
|
||||
WTF is this??
|
||||
=============
|
||||
|
||||
This is a port of debian's apt tools to RPM based
|
||||
distro (at least Conectiva). apt-get is an advanced
|
||||
package management utility frontend (dpkg in debian,
|
||||
rpm in Conectiva and similars), which allows you to easily
|
||||
perform package installation, upgrading and removal.
|
||||
Dependencies are automatically handled, so if you
|
||||
try to install a package that needs others to be installed,
|
||||
it will download all needed packages and install them.
|
||||
|
||||
|
||||
How to Use It
|
||||
=============
|
||||
|
||||
The manpages are properly updated, but if you
|
||||
want simpler/friendlier documentation, you can
|
||||
get the APT+RPM HOWTO at:
|
||||
http://bazar.conectiva.com.br/~godoy/apt-howto/
|
||||
|
2
apt/TODO
2
apt/TODO
@ -1 +1,3 @@
|
||||
- Implement hashing in file method.
|
||||
- Build program to check for dependencies between repositories.
|
||||
- Implement apt-cache provides/whatprovides
|
||||
|
@ -1,6 +1,6 @@
|
||||
// -*- mode: cpp; mode: fold -*-
|
||||
// Description /*{{{*/
|
||||
// $Id: arfile.cc,v 1.2 2002/07/25 18:07:17 niemeyer Exp $
|
||||
// $Id: arfile.cc,v 1.5 2003/02/10 00:36:12 doogie Exp $
|
||||
/* ######################################################################
|
||||
|
||||
AR File - Handle an 'AR' archive
|
||||
@ -17,6 +17,7 @@
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "apt-pkg/arfile.h"
|
||||
#endif
|
||||
#include <apti18n.h>
|
||||
#include <apt-pkg/arfile.h>
|
||||
#include <apt-pkg/strutl.h>
|
||||
#include <apt-pkg/error.h>
|
||||
@ -69,7 +70,7 @@ bool ARArchive::LoadHeaders()
|
||||
if (File.Read(Magic,sizeof(Magic)) == false)
|
||||
return false;
|
||||
if (memcmp(Magic,"!<arch>\012",sizeof(Magic)) != 0)
|
||||
return _error->Error("Invalid archive signature");
|
||||
return _error->Error(_("Invalid archive signature"));
|
||||
Left -= sizeof(Magic);
|
||||
|
||||
// Read the member list
|
||||
@ -77,7 +78,7 @@ bool ARArchive::LoadHeaders()
|
||||
{
|
||||
MemberHeader Head;
|
||||
if (File.Read(&Head,sizeof(Head)) == false)
|
||||
return _error->Error("Error reading archive member header");
|
||||
return _error->Error(_("Error reading archive member header"));
|
||||
Left -= sizeof(Head);
|
||||
|
||||
// Convert all of the integer members
|
||||
@ -89,7 +90,7 @@ bool ARArchive::LoadHeaders()
|
||||
StrToNum(Head.Size,Memb->Size,sizeof(Head.Size)) == false)
|
||||
{
|
||||
delete Memb;
|
||||
return _error->Error("Invalid archive member header");
|
||||
return _error->Error(_("Invalid archive member header"));
|
||||
}
|
||||
|
||||
// Check for an extra long name string
|
||||
@ -101,7 +102,7 @@ bool ARArchive::LoadHeaders()
|
||||
Len >= strlen(S))
|
||||
{
|
||||
delete Memb;
|
||||
return _error->Error("Invalid archive member header");
|
||||
return _error->Error(_("Invalid archive member header"));
|
||||
}
|
||||
if (File.Read(S,Len) == false)
|
||||
return false;
|
||||
@ -127,11 +128,11 @@ bool ARArchive::LoadHeaders()
|
||||
if (File.Skip(Memb->Size + Skip) == false)
|
||||
return false;
|
||||
if (Left < (signed)(Memb->Size + Skip))
|
||||
return _error->Error("Archive is too short");
|
||||
return _error->Error(_("Archive is too short"));
|
||||
Left -= Memb->Size + Skip;
|
||||
}
|
||||
if (Left != 0)
|
||||
return _error->Error("Failed to read the archive headers");
|
||||
return _error->Error(_("Failed to read the archive headers"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
// -*- mode: cpp; mode: fold -*-
|
||||
// Description /*{{{*/
|
||||
// $Id: extracttar.cc,v 1.4 2003/01/29 18:43:47 niemeyer Exp $
|
||||
// $Id: extracttar.cc,v 1.7 2003/02/10 00:36:12 doogie Exp $
|
||||
/* ######################################################################
|
||||
|
||||
Extract a Tar - Tar Extractor
|
||||
@ -19,6 +19,7 @@
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "apt-pkg/extracttar.h"
|
||||
#endif
|
||||
#include <apti18n.h>
|
||||
#include <apt-pkg/extracttar.h>
|
||||
|
||||
#include <apt-pkg/error.h>
|
||||
@ -111,7 +112,7 @@ bool ExtractTar::StartGzip()
|
||||
{
|
||||
int Pipes[2];
|
||||
if (pipe(Pipes) != 0)
|
||||
return _error->Errno("pipe","Failed to create pipes");
|
||||
return _error->Errno("pipe",_("Failed to create pipes"));
|
||||
|
||||
// Fork off the process
|
||||
GZPid = ExecFork();
|
||||
@ -136,7 +137,7 @@ bool ExtractTar::StartGzip()
|
||||
Args[1] = "-d";
|
||||
Args[2] = 0;
|
||||
execv(Args[0],(char **)Args);
|
||||
cerr << "Failed to exec gzip " << Args[0] << endl;
|
||||
cerr << _("Failed to exec gzip ") << Args[0] << endl;
|
||||
_exit(100);
|
||||
}
|
||||
|
||||
@ -173,7 +174,7 @@ bool ExtractTar::Go(pkgDirStream &Stream)
|
||||
TarHeader *Tar = (TarHeader *)Block;
|
||||
unsigned long CheckSum;
|
||||
if (StrToNum(Tar->Checksum,CheckSum,sizeof(Tar->Checksum),8) == false)
|
||||
return _error->Error("Corrupted archive");
|
||||
return _error->Error(_("Corrupted archive"));
|
||||
|
||||
/* Compute the checksum field. The actual checksum is blanked out
|
||||
with spaces so it is not included in the computation */
|
||||
@ -188,7 +189,7 @@ bool ExtractTar::Go(pkgDirStream &Stream)
|
||||
return Done(true);
|
||||
|
||||
if (NewSum != CheckSum)
|
||||
return _error->Error("Tar Checksum failed, archive corrupted");
|
||||
return _error->Error(_("Tar Checksum failed, archive corrupted"));
|
||||
|
||||
// Decode all of the fields
|
||||
pkgDirStream::Item Itm;
|
||||
@ -199,7 +200,7 @@ bool ExtractTar::Go(pkgDirStream &Stream)
|
||||
StrToNum(Tar->MTime,Itm.MTime,sizeof(Tar->MTime),8) == false ||
|
||||
StrToNum(Tar->Major,Itm.Major,sizeof(Tar->Major),8) == false ||
|
||||
StrToNum(Tar->Minor,Itm.Minor,sizeof(Tar->Minor),8) == false)
|
||||
return _error->Error("Corrupted archive");
|
||||
return _error->Error(_("Corrupted archive"));
|
||||
|
||||
// Grab the filename
|
||||
if (LastLongName.empty() == false)
|
||||
@ -291,7 +292,7 @@ bool ExtractTar::Go(pkgDirStream &Stream)
|
||||
|
||||
default:
|
||||
BadRecord = true;
|
||||
_error->Warning("Unkown TAR header type %u, member %s",(unsigned)Tar->LinkFlag,Tar->Name);
|
||||
_error->Warning(_("Unkown TAR header type %u, member %s"),(unsigned)Tar->LinkFlag,Tar->Name);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
// -*- mode: cpp; mode: fold -*-
|
||||
// Description /*{{{*/
|
||||
// $Id: debfile.cc,v 1.2 2002/07/25 18:07:17 niemeyer Exp $
|
||||
// $Id: debfile.cc,v 1.3 2003/02/10 00:36:12 doogie Exp $
|
||||
/* ######################################################################
|
||||
|
||||
Debian Archive File (.deb)
|
||||
@ -20,6 +20,7 @@
|
||||
#pragma implementation "apt-pkg/debfile.h"
|
||||
#endif
|
||||
|
||||
#include <apti18n.h>
|
||||
#include <apt-pkg/debfile.h>
|
||||
#include <apt-pkg/extracttar.h>
|
||||
#include <apt-pkg/error.h>
|
||||
@ -51,7 +52,7 @@ debDebFile::debDebFile(FileFd &File) : File(File), AR(File)
|
||||
bool debDebFile::CheckMember(const char *Name)
|
||||
{
|
||||
if (AR.FindMember(Name) == 0)
|
||||
return _error->Error("This is not a valid DEB archive, missing '%s' member",Name);
|
||||
return _error->Error(_("This is not a valid DEB archive, missing '%s' member"),Name);
|
||||
return true;
|
||||
}
|
||||
/*}}}*/
|
||||
@ -68,7 +69,7 @@ const ARArchive::Member *debDebFile::GotoMember(const char *Name)
|
||||
const ARArchive::Member *Member = AR.FindMember(Name);
|
||||
if (Member == 0)
|
||||
{
|
||||
_error->Error("Internal Error, could not locate member %s",Name);
|
||||
_error->Error(_("Internal Error, could not locate member %s"),Name);
|
||||
return 0;
|
||||
}
|
||||
if (File.Seek(Member->Start) == false)
|
||||
@ -100,7 +101,7 @@ bool debDebFile::ExtractControl(pkgDataBase &DB)
|
||||
if (DB.GetMetaTmp(Tmp) == false)
|
||||
return false;
|
||||
if (chdir(Tmp.c_str()) != 0)
|
||||
return _error->Errno("chdir","Couldn't change to %s",Tmp.c_str());
|
||||
return _error->Errno("chdir",_("Couldn't change to %s"),Tmp.c_str());
|
||||
|
||||
// Do extraction
|
||||
if (Tar.Go(Extract) == false)
|
||||
@ -121,7 +122,7 @@ bool debDebFile::ExtractArchive(pkgDirStream &Stream)
|
||||
// Get the archive member and positition the file
|
||||
const ARArchive::Member *Member = AR.FindMember("data.tar.gz");
|
||||
if (Member == 0)
|
||||
return _error->Error("Internal Error, could not locate member");
|
||||
return _error->Error(_("Internal Error, could not locate member"));
|
||||
if (File.Seek(Member->Start) == false)
|
||||
return false;
|
||||
|
||||
@ -154,7 +155,7 @@ pkgCache::VerIterator debDebFile::MergeControl(pkgDataBase &DB)
|
||||
return pkgCache::VerIterator(DB.GetCache());
|
||||
|
||||
if (Ver.end() == true)
|
||||
_error->Error("Failed to locate a valid control file");
|
||||
_error->Error(_("Failed to locate a valid control file"));
|
||||
return Ver;
|
||||
}
|
||||
/*}}}*/
|
||||
@ -239,7 +240,7 @@ bool debDebFile::MemControlExtract::Read(debDebFile &Deb)
|
||||
Control[Length] = '\n';
|
||||
Control[Length+1] = '\n';
|
||||
if (Section.Scan(Control,Length+2) == false)
|
||||
return _error->Error("Unparsible control file");
|
||||
return _error->Error(_("Unparsible control file"));
|
||||
return true;
|
||||
}
|
||||
/*}}}*/
|
||||
|
@ -1,6 +1,6 @@
|
||||
// -*- mode: cpp; mode: fold -*-
|
||||
// Description /*{{{*/
|
||||
// $Id: dpkgdb.cc,v 1.4 2003/01/29 18:43:47 niemeyer Exp $
|
||||
// $Id: dpkgdb.cc,v 1.7 2003/02/10 00:36:12 doogie Exp $
|
||||
/* ######################################################################
|
||||
|
||||
DPKGv1 Database Implemenation
|
||||
@ -17,6 +17,7 @@
|
||||
#pragma implementation "apt-pkg/dpkgdb.h"
|
||||
#endif
|
||||
|
||||
#include <apti18n.h>
|
||||
#include <apt-pkg/dpkgdb.h>
|
||||
#include <apt-pkg/configuration.h>
|
||||
#include <apt-pkg/error.h>
|
||||
@ -51,13 +52,13 @@ static bool EraseDir(const char *Dir)
|
||||
if (errno == ENOTDIR)
|
||||
{
|
||||
if (unlink(Dir) != 0)
|
||||
return _error->Errno("unlink","Failed to remove %s",Dir);
|
||||
return _error->Errno("unlink",_("Failed to remove %s"),Dir);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Should not happen
|
||||
if (errno != ENOTEMPTY)
|
||||
return _error->Errno("rmdir","Failed to remove %s",Dir);
|
||||
return _error->Errno("rmdir",_("Failed to remove %s"),Dir);
|
||||
|
||||
// Purge it using rm
|
||||
int Pid = ExecFork();
|
||||
@ -106,20 +107,20 @@ bool debDpkgDB::InitMetaTmp(string &Dir)
|
||||
{
|
||||
string Tmp = AdminDir + "tmp.ci/";
|
||||
if (EraseDir(Tmp.c_str()) == false)
|
||||
return _error->Error("Unable to create %s",Tmp.c_str());
|
||||
return _error->Error(_("Unable to create %s"),Tmp.c_str());
|
||||
if (mkdir(Tmp.c_str(),0755) != 0)
|
||||
return _error->Errno("mkdir","Unable to create %s",Tmp.c_str());
|
||||
return _error->Errno("mkdir",_("Unable to create %s"),Tmp.c_str());
|
||||
|
||||
// Verify it is on the same filesystem as the main info directory
|
||||
dev_t Dev;
|
||||
struct stat St;
|
||||
if (stat((AdminDir + "info").c_str(),&St) != 0)
|
||||
return _error->Errno("stat","Failed to stat %sinfo",AdminDir.c_str());
|
||||
return _error->Errno("stat",_("Failed to stat %sinfo"),AdminDir.c_str());
|
||||
Dev = St.st_dev;
|
||||
if (stat(Tmp.c_str(),&St) != 0)
|
||||
return _error->Errno("stat","Failed to stat %s",Tmp.c_str());
|
||||
return _error->Errno("stat",_("Failed to stat %s"),Tmp.c_str());
|
||||
if (Dev != St.st_dev)
|
||||
return _error->Error("The info and temp directories need to be on the same filesystem");
|
||||
return _error->Error(_("The info and temp directories need to be on the same filesystem"));
|
||||
|
||||
// Done
|
||||
Dir = Tmp;
|
||||
@ -135,7 +136,7 @@ bool debDpkgDB::ReadyPkgCache(OpProgress &Progress)
|
||||
{
|
||||
if (Cache != 0)
|
||||
{
|
||||
Progress.OverallProgress(1,1,1,"Reading Package Lists");
|
||||
Progress.OverallProgress(1,1,1,_("Reading Package Lists"));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -176,7 +177,7 @@ bool debDpkgDB::ReadFList(OpProgress &Progress)
|
||||
path components */
|
||||
string Cwd = SafeGetCWD();
|
||||
if (chdir((AdminDir + "info/").c_str()) != 0)
|
||||
return _error->Errno("chdir","Failed to change to the admin dir %sinfo",AdminDir.c_str());
|
||||
return _error->Errno("chdir",_("Failed to change to the admin dir %sinfo"),AdminDir.c_str());
|
||||
|
||||
// Allocate a buffer. Anything larger than this buffer will be mmaped
|
||||
unsigned long BufSize = 32*1024;
|
||||
@ -197,11 +198,11 @@ bool debDpkgDB::ReadFList(OpProgress &Progress)
|
||||
pkgFLCache::PkgIterator FlPkg = FList->GetPkg(I.Name(),0,true);
|
||||
if (FlPkg.end() == true)
|
||||
{
|
||||
_error->Error("Internal Error getting a Package Name");
|
||||
_error->Error(_("Internal Error getting a Package Name"));
|
||||
break;
|
||||
}
|
||||
|
||||
Progress.OverallProgress(Count,Total,1,"Reading File Listing");
|
||||
Progress.OverallProgress(Count,Total,1,_("Reading File Listing"));
|
||||
|
||||
// Open the list file
|
||||
snprintf(Name,sizeof(Name),"%s.list",I.Name());
|
||||
@ -212,9 +213,9 @@ bool debDpkgDB::ReadFList(OpProgress &Progress)
|
||||
struct stat Stat;
|
||||
if (Fd == -1 || fstat(Fd,&Stat) != 0)
|
||||
{
|
||||
_error->Errno("open","Failed to open the list file '%sinfo/%s'. If you "
|
||||
_error->Errno("open",_("Failed to open the list file '%sinfo/%s'. If you "
|
||||
"cannot restore this file then make it empty "
|
||||
"and immediately re-install the same version of the package!",
|
||||
"and immediately re-install the same version of the package!"),
|
||||
AdminDir.c_str(),Name);
|
||||
break;
|
||||
}
|
||||
@ -225,7 +226,7 @@ bool debDpkgDB::ReadFList(OpProgress &Progress)
|
||||
{
|
||||
if (read(Fd,Buffer,Stat.st_size) != Stat.st_size)
|
||||
{
|
||||
_error->Errno("read","Failed reading the list file %sinfo/%s",
|
||||
_error->Errno("read",_("Failed reading the list file %sinfo/%s"),
|
||||
AdminDir.c_str(),Name);
|
||||
close(Fd);
|
||||
break;
|
||||
@ -238,7 +239,7 @@ bool debDpkgDB::ReadFList(OpProgress &Progress)
|
||||
File = (char *)mmap(0,Stat.st_size,PROT_READ,MAP_PRIVATE,Fd,0);
|
||||
if (File == (char *)(-1))
|
||||
{
|
||||
_error->Errno("mmap","Failed reading the list file %sinfo/%s",
|
||||
_error->Errno("mmap",_("Failed reading the list file %sinfo/%s"),
|
||||
AdminDir.c_str(),Name);
|
||||
close(Fd);
|
||||
break;
|
||||
@ -262,7 +263,7 @@ bool debDpkgDB::ReadFList(OpProgress &Progress)
|
||||
FlPkg.Offset(),true,false);
|
||||
if (Node.end() == true)
|
||||
{
|
||||
_error->Error("Internal Error getting a Node");
|
||||
_error->Error(_("Internal Error getting a Node"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -305,7 +306,7 @@ bool debDpkgDB::ReadDiversions()
|
||||
|
||||
FILE *Fd = fopen((AdminDir + "diversions").c_str(),"r");
|
||||
if (Fd == 0)
|
||||
return _error->Errno("fopen","Failed to open the diversions file %sdiversions",AdminDir.c_str());
|
||||
return _error->Errno("fopen",_("Failed to open the diversions file %sdiversions"),AdminDir.c_str());
|
||||
|
||||
FList->BeginDiverLoad();
|
||||
while (1)
|
||||
@ -320,24 +321,24 @@ bool debDpkgDB::ReadDiversions()
|
||||
if (fgets(To,sizeof(To),Fd) == 0 ||
|
||||
fgets(Package,sizeof(Package),Fd) == 0)
|
||||
{
|
||||
_error->Error("The diversion file is corrupted");
|
||||
_error->Error(_("The diversion file is corrupted"));
|
||||
break;
|
||||
}
|
||||
|
||||
// Strip the \ns
|
||||
unsigned long Len = strlen(From);
|
||||
if (Len < 2 || From[Len-1] != '\n')
|
||||
_error->Error("Invalid line in the diversion file: %s",From);
|
||||
_error->Error(_("Invalid line in the diversion file: %s"),From);
|
||||
else
|
||||
From[Len-1] = 0;
|
||||
Len = strlen(To);
|
||||
if (Len < 2 || To[Len-1] != '\n')
|
||||
_error->Error("Invalid line in the diversion file: %s",To);
|
||||
_error->Error(_("Invalid line in the diversion file: %s"),To);
|
||||
else
|
||||
To[Len-1] = 0;
|
||||
Len = strlen(Package);
|
||||
if (Len < 2 || Package[Len-1] != '\n')
|
||||
_error->Error("Invalid line in the diversion file: %s",Package);
|
||||
_error->Error(_("Invalid line in the diversion file: %s"),Package);
|
||||
else
|
||||
Package[Len-1] = 0;
|
||||
|
||||
@ -351,14 +352,14 @@ bool debDpkgDB::ReadDiversions()
|
||||
pkgFLCache::PkgIterator FlPkg = FList->GetPkg(Package,0,true);
|
||||
if (FlPkg.end() == true)
|
||||
{
|
||||
_error->Error("Internal Error getting a Package Name");
|
||||
_error->Error(_("Internal Error getting a Package Name"));
|
||||
break;
|
||||
}
|
||||
|
||||
// Install the diversion
|
||||
if (FList->AddDiversion(FlPkg,From,To) == false)
|
||||
{
|
||||
_error->Error("Internal Error adding a diversion");
|
||||
_error->Error(_("Internal Error adding a diversion"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -379,10 +380,10 @@ bool debDpkgDB::ReadDiversions()
|
||||
bool debDpkgDB::ReadyFileList(OpProgress &Progress)
|
||||
{
|
||||
if (Cache == 0)
|
||||
return _error->Error("The pkg cache must be initialize first");
|
||||
return _error->Error(_("The pkg cache must be initialize first"));
|
||||
if (FList != 0)
|
||||
{
|
||||
Progress.OverallProgress(1,1,1,"Reading File List");
|
||||
Progress.OverallProgress(1,1,1,_("Reading File List"));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -439,12 +440,12 @@ bool debDpkgDB::ReadConfFiles()
|
||||
const char *PkgStart;
|
||||
const char *PkgEnd;
|
||||
if (Section.Find("Package",PkgStart,PkgEnd) == false)
|
||||
return _error->Error("Failed to find a Package: Header, offset %lu",Offset);
|
||||
return _error->Error(_("Failed to find a Package: Header, offset %lu"),Offset);
|
||||
|
||||
// Snag a package record for it
|
||||
pkgFLCache::PkgIterator FlPkg = FList->GetPkg(PkgStart,PkgEnd,true);
|
||||
if (FlPkg.end() == true)
|
||||
return _error->Error("Internal Error getting a Package Name");
|
||||
return _error->Error(_("Internal Error getting a Package Name"));
|
||||
|
||||
// Parse the conf file lines
|
||||
while (1)
|
||||
@ -461,12 +462,12 @@ bool debDpkgDB::ReadConfFiles()
|
||||
const char *EndMd5 = StartMd5;
|
||||
for (; isspace(*EndMd5) == 0 && EndMd5 < Stop; EndMd5++);
|
||||
if (StartMd5 == EndMd5 || Start == End)
|
||||
return _error->Error("Bad ConfFile section in the status file. Offset %lu",Offset);
|
||||
return _error->Error(_("Bad ConfFile section in the status file. Offset %lu"),Offset);
|
||||
|
||||
// Insert a new entry
|
||||
unsigned char MD5[16];
|
||||
if (Hex2Num(string(StartMd5,EndMd5-StartMd5),MD5,16) == false)
|
||||
return _error->Error("Error parsing MD5. Offset %lu",Offset);
|
||||
return _error->Error(_("Error parsing MD5. Offset %lu"),Offset);
|
||||
|
||||
if (FList->AddConfFile(Start,End,FlPkg,MD5) == false)
|
||||
return false;
|
||||
|
@ -1,6 +1,6 @@
|
||||
// -*- mode: cpp; mode: fold -*-
|
||||
// Description /*{{{*/
|
||||
// $Id: dirstream.cc,v 1.2 2002/07/25 18:07:17 niemeyer Exp $
|
||||
// $Id: dirstream.cc,v 1.3 2003/02/10 00:36:12 doogie Exp $
|
||||
/* ######################################################################
|
||||
|
||||
Directory Stream
|
||||
@ -15,6 +15,7 @@
|
||||
#pragma implementation "apt-pkg/dirstream.h"
|
||||
#endif
|
||||
|
||||
#include <apti18n.h>
|
||||
#include <apt-pkg/dirstream.h>
|
||||
#include <apt-pkg/error.h>
|
||||
|
||||
@ -41,15 +42,15 @@ bool pkgDirStream::DoItem(Item &Itm,int &Fd)
|
||||
int iFd = open(Itm.Name,O_NDELAY|O_WRONLY|O_CREAT|O_TRUNC|O_APPEND,
|
||||
Itm.Mode);
|
||||
if (iFd < 0)
|
||||
return _error->Errno("open","Failed write file %s",
|
||||
return _error->Errno("open",_("Failed write file %s"),
|
||||
Itm.Name);
|
||||
|
||||
// fchmod deals with umask and fchown sets the ownership
|
||||
if (fchmod(iFd,Itm.Mode) != 0)
|
||||
return _error->Errno("fchmod","Failed write file %s",
|
||||
return _error->Errno("fchmod",_("Failed write file %s"),
|
||||
Itm.Name);
|
||||
if (fchown(iFd,Itm.UID,Itm.GID) != 0 && errno != EPERM)
|
||||
return _error->Errno("fchown","Failed write file %s",
|
||||
return _error->Errno("fchown",_("Failed write file %s"),
|
||||
Itm.Name);
|
||||
Fd = iFd;
|
||||
return true;
|
||||
@ -76,7 +77,7 @@ bool pkgDirStream::FinishedFile(Item &Itm,int Fd)
|
||||
return true;
|
||||
|
||||
if (close(Fd) != 0)
|
||||
return _error->Errno("close","Failed to close file %s",Itm.Name);
|
||||
return _error->Errno("close",_("Failed to close file %s"),Itm.Name);
|
||||
|
||||
/* Set the modification times. The only way it can fail is if someone
|
||||
has futzed with our file, which is intolerable :> */
|
||||
@ -84,7 +85,7 @@ bool pkgDirStream::FinishedFile(Item &Itm,int Fd)
|
||||
Time.actime = Itm.MTime;
|
||||
Time.modtime = Itm.MTime;
|
||||
if (utime(Itm.Name,&Time) != 0)
|
||||
_error->Errno("utime","Failed to close file %s",Itm.Name);
|
||||
_error->Errno("utime",_("Failed to close file %s"),Itm.Name);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
// -*- mode: cpp; mode: fold -*-
|
||||
// Description /*{{{*/
|
||||
// $Id: extract.cc,v 1.4 2003/01/29 18:43:47 niemeyer Exp $
|
||||
// $Id: extract.cc,v 1.6 2003/02/10 00:36:12 doogie Exp $
|
||||
/* ######################################################################
|
||||
|
||||
Archive Extraction Directory Stream
|
||||
@ -47,6 +47,7 @@
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "apt-pkg/extract.h"
|
||||
#endif
|
||||
#include <apti18n.h>
|
||||
#include <apt-pkg/extract.h>
|
||||
#include <apt-pkg/error.h>
|
||||
#include <apt-pkg/debversion.h>
|
||||
@ -92,7 +93,7 @@ bool pkgExtract::DoItem(Item &Itm,int &Fd)
|
||||
for (; *I != 0 && End < FileName + sizeof(FileName); I++, End++)
|
||||
*End = *I;
|
||||
if (End + 20 >= FileName + sizeof(FileName))
|
||||
return _error->Error("The path %s is too long",Itm.Name);
|
||||
return _error->Error(_("The path %s is too long"),Itm.Name);
|
||||
for (; End > FileName && End[-1] == '/'; End--);
|
||||
*End = 0;
|
||||
Itm.Name = FileName;
|
||||
@ -123,7 +124,7 @@ bool pkgExtract::DoItem(Item &Itm,int &Fd)
|
||||
which case this needs to be modified anyhow.. */
|
||||
if ((RealNde->Flags & pkgFLCache::Node::Unpacked) ==
|
||||
pkgFLCache::Node::Unpacked)
|
||||
return _error->Error("Unpacking %s more than once",Itm.Name);
|
||||
return _error->Error(_("Unpacking %s more than once"),Itm.Name);
|
||||
|
||||
if (Nde.end() == true)
|
||||
Nde = RealNde;
|
||||
@ -133,7 +134,7 @@ bool pkgExtract::DoItem(Item &Itm,int &Fd)
|
||||
if ((Nde->Flags & pkgFLCache::Node::Diversion) != 0)
|
||||
{
|
||||
if (Itm.Type == Item::Directory)
|
||||
return _error->Error("The directory %s is diverted",Itm.Name);
|
||||
return _error->Error(_("The directory %s is diverted"),Itm.Name);
|
||||
|
||||
/* A package overwriting a diversion target is just the same as
|
||||
overwriting a normally owned file and is checked for below in
|
||||
@ -143,8 +144,8 @@ bool pkgExtract::DoItem(Item &Itm,int &Fd)
|
||||
that is never, ever permitted */
|
||||
pkgFLCache::DiverIterator Div = Nde.Diversion();
|
||||
if (Div.DivertTo() == Nde)
|
||||
return _error->Error("The package is trying to write to the "
|
||||
"diversion target %s/%s",Nde.DirN(),Nde.File());
|
||||
return _error->Error(_("The package is trying to write to the "
|
||||
"diversion target %s/%s"),Nde.DirN(),Nde.File());
|
||||
|
||||
// See if it is us and we are following it in the right direction
|
||||
if (Div->OwnerPkg != FLPkg.Offset() && Div.DivertFrom() == Nde)
|
||||
@ -153,7 +154,7 @@ bool pkgExtract::DoItem(Item &Itm,int &Fd)
|
||||
End = FileName + snprintf(FileName,sizeof(FileName)-20,"%s/%s",
|
||||
Nde.DirN(),Nde.File());
|
||||
if (End <= FileName)
|
||||
return _error->Error("The diversion path is too long");
|
||||
return _error->Error(_("The diversion path is too long"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -163,7 +164,7 @@ bool pkgExtract::DoItem(Item &Itm,int &Fd)
|
||||
{
|
||||
string Res = flNoLink(Itm.Name);
|
||||
if (Res.length() > sizeof(FileName))
|
||||
return _error->Error("The path %s is too long",Res.c_str());
|
||||
return _error->Error(_("The path %s is too long"),Res.c_str());
|
||||
if (Debug == true)
|
||||
clog << "Followed conf file from " << FileName << " to " << Res << endl;
|
||||
Itm.Name = strcpy(FileName,Res.c_str());
|
||||
@ -177,19 +178,19 @@ bool pkgExtract::DoItem(Item &Itm,int &Fd)
|
||||
{
|
||||
// This is bad news.
|
||||
if (errno != ENOENT)
|
||||
return _error->Errno("stat","Failed to stat %s",Itm.Name);
|
||||
return _error->Errno("stat",_("Failed to stat %s"),Itm.Name);
|
||||
|
||||
// See if we can recover the backup file
|
||||
if (Nde.end() == false)
|
||||
{
|
||||
snprintf(Temp,sizeof(Temp),"%s.%s",Itm.Name,TempExt);
|
||||
if (rename(Temp,Itm.Name) != 0 && errno != ENOENT)
|
||||
return _error->Errno("rename","Failed to rename %s to %s",
|
||||
return _error->Errno("rename",_("Failed to rename %s to %s"),
|
||||
Temp,Itm.Name);
|
||||
if (stat(Itm.Name,&LExisting) != 0)
|
||||
{
|
||||
if (errno != ENOENT)
|
||||
return _error->Errno("stat","Failed to stat %s",Itm.Name);
|
||||
return _error->Errno("stat",_("Failed to stat %s"),Itm.Name);
|
||||
}
|
||||
else
|
||||
EValid = true;
|
||||
@ -206,7 +207,7 @@ bool pkgExtract::DoItem(Item &Itm,int &Fd)
|
||||
if (stat(Itm.Name,&Existing) != 0)
|
||||
{
|
||||
if (errno != ENOENT)
|
||||
return _error->Errno("stat","Failed to stat %s",Itm.Name);
|
||||
return _error->Errno("stat",_("Failed to stat %s"),Itm.Name);
|
||||
Existing = LExisting;
|
||||
}
|
||||
}
|
||||
@ -239,13 +240,13 @@ bool pkgExtract::DoItem(Item &Itm,int &Fd)
|
||||
if (S_ISDIR(Existing.st_mode) != 0)
|
||||
{
|
||||
if (CheckDirReplace(Itm.Name) == false)
|
||||
return _error->Error("The directory %s is being replaced by a non-directory",Itm.Name);
|
||||
return _error->Error(_("The directory %s is being replaced by a non-directory"),Itm.Name);
|
||||
}
|
||||
|
||||
if (Debug == true)
|
||||
clog << "Extract " << string(Itm.Name,End) << endl;
|
||||
/* if (Count != 0)
|
||||
return _error->Error("Done");*/
|
||||
return _error->Error(_("Done"));*/
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -279,11 +280,11 @@ bool pkgExtract::Aborted()
|
||||
pkgFLCache::NodeIterator Nde(FLCache,FLCache.HashNode(Files));
|
||||
for (; Nde.end() == false && Files->File != Nde->File; Nde++);
|
||||
if (Nde.end() == true)
|
||||
return _error->Error("Failed to locate node in its hash bucket");
|
||||
return _error->Error(_("Failed to locate node in its hash bucket"));
|
||||
|
||||
if (snprintf(FileName,sizeof(FileName)-20,"%s/%s",
|
||||
Nde.DirN(),Nde.File()) <= 0)
|
||||
return _error->Error("The path is too long");
|
||||
return _error->Error(_("The path is too long"));
|
||||
|
||||
// Deal with diversions
|
||||
if ((Nde->Flags & pkgFLCache::Node::Diversion) != 0)
|
||||
@ -296,7 +297,7 @@ bool pkgExtract::Aborted()
|
||||
Nde = Div.DivertTo();
|
||||
if (snprintf(FileName,sizeof(FileName)-20,"%s/%s",
|
||||
Nde.DirN(),Nde.File()) <= 0)
|
||||
return _error->Error("The diversion path is too long");
|
||||
return _error->Error(_("The diversion path is too long"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -413,7 +414,7 @@ bool pkgExtract::HandleOverwrites(pkgFLCache::NodeIterator Nde,
|
||||
pkgCache::PkgIterator Pkg = Dep.TargetPkg();
|
||||
if (Pkg->CurrentVer == 0)
|
||||
{
|
||||
_error->Warning("Overwrite package match with no version for %s",Pkg.Name());
|
||||
_error->Warning(_("Overwrite package match with no version for %s"),Pkg.Name());
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -430,7 +431,7 @@ bool pkgExtract::HandleOverwrites(pkgFLCache::NodeIterator Nde,
|
||||
|
||||
// Negative Hit
|
||||
if (Ok == false)
|
||||
return _error->Error("File %s/%s overwrites the one in the package %s",
|
||||
return _error->Error(_("File %s/%s overwrites the one in the package %s"),
|
||||
Nde.DirN(),Nde.File(),FPkg.Name());
|
||||
}
|
||||
|
||||
@ -463,7 +464,7 @@ bool pkgExtract::CheckDirReplace(string Dir,unsigned int Depth)
|
||||
|
||||
DIR *D = opendir(Dir.c_str());
|
||||
if (D == 0)
|
||||
return _error->Errno("opendir","Unable to read %s",Dir.c_str());
|
||||
return _error->Errno("opendir",_("Unable to read %s"),Dir.c_str());
|
||||
|
||||
string File;
|
||||
for (struct dirent *Dent = readdir(D); Dent != 0; Dent = readdir(D))
|
||||
@ -490,7 +491,7 @@ bool pkgExtract::CheckDirReplace(string Dir,unsigned int Depth)
|
||||
if (lstat(File.c_str(),&St) != 0)
|
||||
{
|
||||
closedir(D);
|
||||
return _error->Errno("lstat","Unable to stat %s",File.c_str());
|
||||
return _error->Errno("lstat",_("Unable to stat %s"),File.c_str());
|
||||
}
|
||||
|
||||
// Recurse down directories
|
||||
|
@ -1,6 +1,6 @@
|
||||
// -*- mode: cpp; mode: fold -*-
|
||||
// Description /*{{{*/
|
||||
// $Id: filelist.cc,v 1.2 2002/07/25 18:07:17 niemeyer Exp $
|
||||
// $Id: filelist.cc,v 1.4 2003/02/10 00:36:12 doogie Exp $
|
||||
/* ######################################################################
|
||||
|
||||
File Listing - Manages a Cache of File -> Package names.
|
||||
@ -36,6 +36,7 @@
|
||||
#pragma implementation "apt-pkg/filelist.h"
|
||||
#endif
|
||||
|
||||
#include <apti18n.h>
|
||||
#include <apt-pkg/filelist.h>
|
||||
#include <apt-pkg/mmap.h>
|
||||
#include <apt-pkg/error.h>
|
||||
@ -380,7 +381,7 @@ void pkgFLCache::DropNode(map_ptrloc N)
|
||||
NodeIterator Nde(*this,NodeP + N);
|
||||
|
||||
if (Nde->NextPkg != 0)
|
||||
_error->Warning("DropNode called on still linked node");
|
||||
_error->Warning(_("DropNode called on still linked node"));
|
||||
|
||||
// Locate it in the hash table
|
||||
Node *Last = 0;
|
||||
@ -412,7 +413,7 @@ void pkgFLCache::DropNode(map_ptrloc N)
|
||||
break;
|
||||
}
|
||||
|
||||
_error->Error("Failed to locate the hash element!");
|
||||
_error->Error(_("Failed to locate the hash element!"));
|
||||
}
|
||||
/*}}}*/
|
||||
// FLCache::BeginDiverLoad - Start reading new diversions /*{{{*/
|
||||
@ -459,12 +460,12 @@ bool pkgFLCache::AddDiversion(PkgIterator const &Owner,
|
||||
NodeIterator FromN = GetNode(From,From+strlen(From),0,true,true);
|
||||
NodeIterator ToN = GetNode(To,To+strlen(To),0,true,true);
|
||||
if (FromN.end() == true || ToN.end() == true)
|
||||
return _error->Error("Failed to allocate diversion");
|
||||
return _error->Error(_("Failed to allocate diversion"));
|
||||
|
||||
// Should never happen
|
||||
if ((FromN->Flags & Node::Diversion) != Node::Diversion ||
|
||||
(ToN->Flags & Node::Diversion) != Node::Diversion)
|
||||
return _error->Error("Internal Error in AddDiversion");
|
||||
return _error->Error(_("Internal Error in AddDiversion"));
|
||||
|
||||
// Now, try to reclaim an existing diversion..
|
||||
map_ptrloc Diver = 0;
|
||||
@ -477,7 +478,7 @@ bool pkgFLCache::AddDiversion(PkgIterator const &Owner,
|
||||
{
|
||||
// It could be that the other diversion is no longer in use
|
||||
if ((DiverP[ToN->Pointer].Flags & Diversion::Touched) == Diversion::Touched)
|
||||
return _error->Error("Trying to overwrite a diversion, %s -> %s and %s/%s",
|
||||
return _error->Error(_("Trying to overwrite a diversion, %s -> %s and %s/%s"),
|
||||
From,To,ToN.File(),ToN.Dir().Name());
|
||||
|
||||
// We can erase it.
|
||||
@ -506,7 +507,7 @@ bool pkgFLCache::AddDiversion(PkgIterator const &Owner,
|
||||
// Can only have one diversion of the same files
|
||||
Diversion *Div = DiverP + Diver;
|
||||
if ((Div->Flags & Diversion::Touched) == Diversion::Touched)
|
||||
return _error->Error("Double add of diversion %s -> %s",From,To);
|
||||
return _error->Error(_("Double add of diversion %s -> %s"),From,To);
|
||||
|
||||
// Setup the From/To links
|
||||
if (Div->DivertFrom != FromN.Offset() && Div->DivertFrom != ToN.Offset())
|
||||
@ -549,7 +550,7 @@ bool pkgFLCache::AddConfFile(const char *Name,const char *NameEnd,
|
||||
continue;
|
||||
|
||||
if ((Nde->Flags & Node::ConfFile) == Node::ConfFile)
|
||||
return _error->Error("Duplicate conf file %s/%s",Nde.DirN(),Nde.File());
|
||||
return _error->Error(_("Duplicate conf file %s/%s"),Nde.DirN(),Nde.File());
|
||||
|
||||
// Allocate a new conf file structure
|
||||
map_ptrloc Conf = Map.Allocate(sizeof(ConfFile));
|
||||
|
@ -15,6 +15,7 @@ LIBEXT=$(GLIBC_VER)$(LIBSTDCPP_VER)
|
||||
MAJOR=1.0
|
||||
MINOR=0
|
||||
SLIBS=$(PTHREADLIB) -lapt-pkg
|
||||
APT_DOMAIN:=libapt-inst$(MAJOR)
|
||||
|
||||
# Source code for the contributed non-core things
|
||||
SOURCE = contrib/extracttar.cc contrib/arfile.cc
|
||||
|
@ -1,6 +1,6 @@
|
||||
// -*- mode: cpp; mode: fold -*-
|
||||
// Description /*{{{*/
|
||||
// $Id: acquire-item.cc,v 1.6 2003/01/29 14:03:40 niemeyer Exp $
|
||||
// $Id: acquire-item.cc,v 1.46 2003/02/02 22:19:17 jgg Exp $
|
||||
/* ######################################################################
|
||||
|
||||
Acquire Item - Item to acquire
|
||||
@ -163,7 +163,6 @@ void pkgAcquire::Item::Rename(string From,string To)
|
||||
if (rename(From.c_str(),To.c_str()) != 0)
|
||||
{
|
||||
char S[300];
|
||||
// CNC:2003-01-29 - Fix potential buffer overflow bug. */
|
||||
snprintf(S,sizeof(S),_("rename failed, %s (%s -> %s)."),strerror(errno),
|
||||
From.c_str(),To.c_str());
|
||||
Status = StatError;
|
||||
|
@ -1,6 +1,6 @@
|
||||
// -*- mode: cpp; mode: fold -*-
|
||||
// Description /*{{{*/
|
||||
// $Id: acquire-item.h,v 1.2 2003/01/29 13:04:48 niemeyer Exp $
|
||||
// $Id: acquire-item.h,v 1.26 2003/02/02 03:13:13 doogie Exp $
|
||||
/* ######################################################################
|
||||
|
||||
Acquire Item - Item to acquire
|
||||
@ -101,7 +101,7 @@ class pkgAcqIndex : public pkgAcquire::Item
|
||||
virtual void Done(string Message,unsigned long Size,string Md5Hash,
|
||||
pkgAcquire::MethodConfig *Cnf);
|
||||
virtual string Custom600Headers();
|
||||
virtual string DescURI() {return RealURI;};
|
||||
virtual string DescURI() {return RealURI;}; // CNC:2003-02-14
|
||||
|
||||
// CNC:2002-07-03
|
||||
pkgAcqIndex(pkgAcquire *Owner,pkgRepository *Repository,string URI,
|
||||
|
@ -142,9 +142,18 @@ bool pkgSimulate::Configure(PkgIterator iPkg)
|
||||
// Print out each package and the failed dependencies
|
||||
for (pkgCache::DepIterator D = Sim[Pkg].InstVerIter(Sim).DependsList(); D.end() == false; D++)
|
||||
{
|
||||
// CNC:2003-02-17 - IsImportantDep() currently calls IsCritical(), so
|
||||
// these two are currently doing the same thing. Check
|
||||
// comments in IsImportantDep() definition.
|
||||
#if 0
|
||||
if (Sim.IsImportantDep(D) == false ||
|
||||
(Sim[D] & pkgDepCache::DepInstall) != 0)
|
||||
continue;
|
||||
#else
|
||||
if (D.IsCritical() == false ||
|
||||
(Sim[D] & pkgDepCache::DepInstall) != 0)
|
||||
continue;
|
||||
#endif
|
||||
|
||||
if (D->Type == pkgCache::Dep::Obsoletes)
|
||||
cout << " Obsoletes:" << D.TargetPkg().Name();
|
||||
@ -341,7 +350,8 @@ bool pkgDistUpgrade(pkgDepCache &Cache)
|
||||
Cache[D.ParentPkg()].CandidateVer != 0 &&
|
||||
Cache[D.ParentPkg()].CandidateVerIter(Cache).Downloadable() == true &&
|
||||
(pkgCache::Version*)D.ParentVer() == Cache[D.ParentPkg()].CandidateVer &&
|
||||
Cache.VS().CheckDep(I.CurrentVer().VerStr(), D) == true)
|
||||
Cache.VS().CheckDep(I.CurrentVer().VerStr(), D) == true &&
|
||||
Cache.GetPkgPriority(D.ParentPkg()) >= Cache.GetPkgPriority(I))
|
||||
{
|
||||
Cache.MarkInstall(D.ParentPkg(),true);
|
||||
Obsoleted = true;
|
||||
@ -374,7 +384,8 @@ bool pkgDistUpgrade(pkgDepCache &Cache)
|
||||
Cache[D.ParentPkg()].CandidateVer != 0 &&
|
||||
Cache[D.ParentPkg()].CandidateVerIter(Cache).Downloadable() == true &&
|
||||
(pkgCache::Version*)D.ParentVer() == Cache[D.ParentPkg()].CandidateVer &&
|
||||
Cache.VS().CheckDep(I.CurrentVer().VerStr(), D) == true)
|
||||
Cache.VS().CheckDep(I.CurrentVer().VerStr(), D) == true &&
|
||||
Cache.GetPkgPriority(D.ParentPkg()) >= Cache.GetPkgPriority(I))
|
||||
{
|
||||
Cache.MarkInstall(D.ParentPkg(),false);
|
||||
Obsoleted = true;
|
||||
|
@ -186,7 +186,20 @@ class pkgCache::DepIterator
|
||||
inline PkgIterator ParentPkg() {return PkgIterator(*Owner,Owner->PkgP + Owner->VerP[Dep->ParentVer].ParentPkg);};
|
||||
inline bool Reverse() {return Type == DepRev;};
|
||||
inline unsigned long Index() const {return Dep - Owner->DepP;};
|
||||
bool IsCritical();
|
||||
// CNC:2003-02-17 - This is a very used function, so it's now
|
||||
// inlined here.
|
||||
inline bool IsCritical()
|
||||
{
|
||||
switch (Dep->Type) {
|
||||
case pkgCache::Dep::Conflicts:
|
||||
case pkgCache::Dep::Obsoletes:
|
||||
case pkgCache::Dep::Depends:
|
||||
case pkgCache::Dep::PreDepends:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
void GlobOr(DepIterator &Start,DepIterator &End);
|
||||
Version **AllTargets();
|
||||
bool SmartTargetPkg(PkgIterator &Result);
|
||||
|
@ -1,6 +1,6 @@
|
||||
// -*- mode: cpp; mode: fold -*-
|
||||
// Description /*{{{*/
|
||||
// $Id: cmndline.cc,v 1.3 2003/01/29 18:43:48 niemeyer Exp $
|
||||
// $Id: cmndline.cc,v 1.15 2003/02/10 01:40:58 doogie Exp $
|
||||
/* ######################################################################
|
||||
|
||||
Command Line Class - Sophisticated command line parser
|
||||
@ -198,13 +198,13 @@ bool CommandLine::HandleOpt(int &I,int argc,const char *argv[],
|
||||
const char *J;
|
||||
for (J = Argument; *J != 0 && *J != '='; J++);
|
||||
if (*J == 0)
|
||||
return _error->Error(_("Option %s: Configuration item sepecification must have an =<val>."),argv[I]);
|
||||
return _error->Error(_("Option %s: Configuration item specification must have an =<val>."),argv[I]);
|
||||
|
||||
// = is trailing
|
||||
if (J[1] == 0)
|
||||
{
|
||||
if (I+1 >= argc)
|
||||
return _error->Error(_("Option %s: Configuration item sepecification must have an =<val>."),argv[I]);
|
||||
return _error->Error(_("Option %s: Configuration item specification must have an =<val>."),argv[I]);
|
||||
Conf->Set(string(Argument,J-Argument),string(argv[I++ +1]));
|
||||
}
|
||||
else
|
||||
|
@ -50,6 +50,35 @@ Configuration::Configuration(const Item *Root) : Root((Item *)Root), ToFree(fals
|
||||
{
|
||||
};
|
||||
|
||||
// CNC:2003-02-23 - Copy constructor.
|
||||
Configuration::Configuration(Configuration &Conf) : ToFree(true)
|
||||
{
|
||||
Root = new Item;
|
||||
if (Conf.Root->Child)
|
||||
CopyChildren(Conf.Root, Root);
|
||||
}
|
||||
|
||||
void Configuration::CopyChildren(Item *From, Item *To)
|
||||
{
|
||||
Item *Parent = To;
|
||||
To->Child = new Item;
|
||||
From = From->Child;
|
||||
To = To->Child;
|
||||
while (1) {
|
||||
To->Parent = Parent;
|
||||
To->Value = From->Value;
|
||||
To->Tag = From->Tag;
|
||||
if (From->Child)
|
||||
CopyChildren(From, To);
|
||||
From = From->Next;
|
||||
if (From) {
|
||||
To->Next = new Item;
|
||||
To = To->Next;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*}}}*/
|
||||
// Configuration::~Configuration - Destructor /*{{{*/
|
||||
// ---------------------------------------------------------------------
|
||||
@ -736,3 +765,5 @@ bool ReadConfigDir(Configuration &Conf,string Dir,bool AsSectional,
|
||||
return true;
|
||||
}
|
||||
/*}}}*/
|
||||
|
||||
// vim:sts=3:sw=3
|
||||
|
@ -65,6 +65,9 @@ class Configuration
|
||||
{
|
||||
return ((Configuration *)this)->Lookup(Name,false);
|
||||
}
|
||||
|
||||
// CNC:2003-02-23 - Helper for copy constructor.
|
||||
void CopyChildren(Item *From, Item *To);
|
||||
|
||||
public:
|
||||
|
||||
@ -94,6 +97,9 @@ class Configuration
|
||||
inline void Dump() { Dump(std::clog); };
|
||||
void Dump(std::ostream& str);
|
||||
|
||||
// CNC:2003-02-23 - Copy constructor.
|
||||
Configuration(Configuration &Conf);
|
||||
|
||||
Configuration(const Item *Root);
|
||||
Configuration();
|
||||
~Configuration();
|
||||
@ -107,4 +113,19 @@ bool ReadConfigFile(Configuration &Conf,string FName,bool AsSectional = false,
|
||||
bool ReadConfigDir(Configuration &Conf,string Dir,bool AsSectional = false,
|
||||
unsigned Depth = 0);
|
||||
|
||||
#ifdef SWIG
|
||||
struct Configuration::Item
|
||||
{
|
||||
string Value;
|
||||
string Tag;
|
||||
Item *Parent;
|
||||
Item *Child;
|
||||
Item *Next;
|
||||
|
||||
string FullTag(const Item *Stop = 0) const;
|
||||
|
||||
Item() : Parent(0), Child(0), Next(0) {};
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -66,7 +66,8 @@ using namespace std;
|
||||
// GlobalError::GlobalError - Constructor /*{{{*/
|
||||
// ---------------------------------------------------------------------
|
||||
/* */
|
||||
GlobalError::GlobalError() : List(0), PendingFlag(false)
|
||||
// CNC:2003-02-26
|
||||
GlobalError::GlobalError() : List(0), PendingFlag(false), Stack(0)
|
||||
{
|
||||
}
|
||||
/*}}}*/
|
||||
@ -235,3 +236,61 @@ void GlobalError::Insert(Item *Itm)
|
||||
*End = Itm;
|
||||
}
|
||||
/*}}}*/
|
||||
|
||||
// CNC:2003-02-24
|
||||
// GlobalError::*State() - Functions allowing a given error state to be /*}}}*/
|
||||
// saved and restored later on.
|
||||
// ---------------------------------------------------------------------
|
||||
/* */
|
||||
void GlobalError::PushState()
|
||||
{
|
||||
State *New = new State;
|
||||
New->List = List;
|
||||
New->Next = Stack;
|
||||
Stack = New;
|
||||
List = 0;
|
||||
PendingFlag = false;
|
||||
}
|
||||
|
||||
bool GlobalError::PopState()
|
||||
{
|
||||
if (Stack == 0)
|
||||
return false;
|
||||
State *Top = Stack;
|
||||
Item **End = &Top->List;
|
||||
for (Item *I = Top->List; I != 0; I = I->Next)
|
||||
End = &I->Next;
|
||||
*End = List;
|
||||
List = Top->List;
|
||||
PendingFlag |= Top->PendingFlag;
|
||||
Stack = Top->Next;
|
||||
delete Top;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GlobalError::PopBackState()
|
||||
{
|
||||
if (Stack == 0)
|
||||
return false;
|
||||
State *Bottom = Stack;
|
||||
State *PreBottom = 0;
|
||||
while (Bottom->Next != 0) {
|
||||
PreBottom = Bottom;
|
||||
Bottom = Bottom->Next;
|
||||
}
|
||||
Item **End = &Bottom->List;
|
||||
for (Item *I = Bottom->List; I != 0; I = I->Next)
|
||||
End = &I->Next;
|
||||
*End = List;
|
||||
List = Bottom->List;
|
||||
PendingFlag |= Bottom->PendingFlag;
|
||||
delete Bottom;
|
||||
if (PreBottom != 0)
|
||||
PreBottom->Next = 0;
|
||||
else
|
||||
Stack = 0;
|
||||
return true;
|
||||
}
|
||||
/*}}}*/
|
||||
|
||||
// vim:sts=3:sw=3
|
||||
|
@ -69,9 +69,25 @@ class GlobalError
|
||||
Item *List;
|
||||
bool PendingFlag;
|
||||
void Insert(Item *I);
|
||||
|
||||
// CNC:2003-02-24 - Introduced a stack of errors. This allows one to
|
||||
// delay error handling until a later time.
|
||||
struct State
|
||||
{
|
||||
Item *List;
|
||||
bool PendingFlag;
|
||||
State *Next;
|
||||
};
|
||||
|
||||
State *Stack;
|
||||
|
||||
public:
|
||||
|
||||
// CNC:2003-02-24 - See above.
|
||||
void PushState();
|
||||
bool PopState();
|
||||
bool PopBackState();
|
||||
|
||||
#ifndef SWIG
|
||||
// Call to generate an error from a library call.
|
||||
bool Errno(const char *Function,const char *Description,...) APT_MFORMAT2;
|
||||
@ -112,3 +128,5 @@ GlobalError *_GetErrorObj();
|
||||
#undef APT_MFORMAT2
|
||||
|
||||
#endif
|
||||
|
||||
// vim:sts=3:sw=3
|
||||
|
@ -21,8 +21,6 @@
|
||||
#include <apt-pkg/error.h>
|
||||
#include <apt-pkg/sptr.h>
|
||||
|
||||
#include <apti18n.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
@ -32,8 +30,13 @@
|
||||
#include <sys/wait.h>
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
|
||||
// CNC:2003-02-14 - Ralf Corsepius told RH8 with GCC 3.2.1 fails
|
||||
// compiling without moving this header to here.
|
||||
#include <apti18n.h>
|
||||
/*}}}*/
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
// CopyFile - Buffered copy of a file /*{{{*/
|
||||
|
@ -1,6 +1,6 @@
|
||||
// -*- mode: cpp; mode: fold -*-
|
||||
// Description /*{{{*/
|
||||
// $Id: strutl.cc,v 1.3 2003/01/29 18:43:48 niemeyer Exp $
|
||||
// $Id: strutl.cc,v 1.47 2003/02/02 22:20:27 jgg Exp $
|
||||
/* ######################################################################
|
||||
|
||||
String Util - Some useful string functions.
|
||||
@ -946,8 +946,8 @@ unsigned long RegexChoice(RxChoiceList *Rxs,const char **ListBegin,
|
||||
/*}}}*/
|
||||
// ioprintf - C format string outputter to C++ iostreams /*{{{*/
|
||||
// ---------------------------------------------------------------------
|
||||
/* This is used to make the internationalization strinc easier to translate
|
||||
and to allow reordering of parameters */
|
||||
/* This is used to make the internationalization strings easier to translate
|
||||
and to allow reordering of parameters */
|
||||
void ioprintf(ostream &out,const char *format,...)
|
||||
{
|
||||
va_list args;
|
||||
@ -959,6 +959,28 @@ void ioprintf(ostream &out,const char *format,...)
|
||||
out << S;
|
||||
}
|
||||
/*}}}*/
|
||||
// safe_snprintf - Safer snprintf /*{{{*/
|
||||
// ---------------------------------------------------------------------
|
||||
/* This is a snprintf that will never (ever) go past 'End' and returns a
|
||||
pointer to the end of the new string. The returned string is always null
|
||||
terminated unless Buffer == end. This is a better alterantive to using
|
||||
consecutive snprintfs. */
|
||||
char *safe_snprintf(char *Buffer,char *End,const char *Format,...)
|
||||
{
|
||||
va_list args;
|
||||
unsigned long Did;
|
||||
|
||||
va_start(args,Format);
|
||||
|
||||
if (End <= Buffer)
|
||||
return End;
|
||||
|
||||
Did = vsnprintf(Buffer,End - Buffer,Format,args);
|
||||
if (Did < 0 || Buffer + Did > End)
|
||||
return End;
|
||||
return Buffer + Did;
|
||||
}
|
||||
/*}}}*/
|
||||
|
||||
// CheckDomainList - See if Host is in a , seperate list /*{{{*/
|
||||
// ---------------------------------------------------------------------
|
||||
|
@ -1,6 +1,6 @@
|
||||
// -*- mode: cpp; mode: fold -*-
|
||||
// Description /*{{{*/
|
||||
// $Id: strutl.h,v 1.1 2002/07/23 17:54:51 niemeyer Exp $
|
||||
// $Id: strutl.h,v 1.22 2003/02/02 22:20:27 jgg Exp $
|
||||
/* ######################################################################
|
||||
|
||||
String Util - These are some useful string functions
|
||||
@ -33,8 +33,10 @@ using std::ostream;
|
||||
#ifdef __GNUG__
|
||||
// Methods have a hidden this parameter that is visible to this attribute
|
||||
#define APT_FORMAT2 __attribute__ ((format (printf, 2, 3)))
|
||||
#define APT_FORMAT3 __attribute__ ((format (printf, 3, 4)))
|
||||
#else
|
||||
#define APT_FORMAT2
|
||||
#define APT_FORMAT3
|
||||
#endif
|
||||
|
||||
char *_strstrip(char *String);
|
||||
@ -57,6 +59,7 @@ bool Hex2Num(string Str,unsigned char *Num,unsigned int Length);
|
||||
bool TokSplitString(char Tok,char *Input,char **List,
|
||||
unsigned long ListMax);
|
||||
void ioprintf(ostream &out,const char *format,...) APT_FORMAT2;
|
||||
char *safe_snprintf(char *Buffer,char *End,const char *Format,...) APT_FORMAT3;
|
||||
bool CheckDomainList(string Host,string List);
|
||||
|
||||
#define APT_MKSTRCMP(name,func) \
|
||||
|
@ -107,6 +107,11 @@ bool pkgDepCache::Init(OpProgress *Prog)
|
||||
set to the package which was used to satisfy the dep. */
|
||||
bool pkgDepCache::CheckDep(DepIterator Dep,int Type,PkgIterator &Res)
|
||||
{
|
||||
// CNC:2003-02-17 - This function is the main path when checking
|
||||
// dependencies, so we must avoid as much overhead
|
||||
// as possible. It has several changes to improve
|
||||
// performance.
|
||||
#if 0
|
||||
Res = Dep.TargetPkg();
|
||||
|
||||
/* Check simple depends. A depends -should- never self match but
|
||||
@ -118,17 +123,19 @@ bool pkgDepCache::CheckDep(DepIterator Dep,int Type,PkgIterator &Res)
|
||||
PkgIterator Pkg = Dep.TargetPkg();
|
||||
// Check the base package
|
||||
if (Type == NowVersion && Pkg->CurrentVer != 0)
|
||||
if (VS().CheckDep(Pkg.CurrentVer().VerStr(),Dep) == true) // CNC:2002-07-10
|
||||
// CNC:2002-07-10 - RPM must check the dependency type to properly
|
||||
// define if it would be satisfied or not.
|
||||
if (VS().CheckDep(Pkg.CurrentVer().VerStr(),Dep) == true)
|
||||
return true;
|
||||
|
||||
if (Type == InstallVersion && PkgState[Pkg->ID].InstallVer != 0)
|
||||
if (VS().CheckDep(PkgState[Pkg->ID].InstVerIter(*this).VerStr(),
|
||||
Dep) == true) // CNC:2002-07-10
|
||||
Dep) == true)
|
||||
return true;
|
||||
|
||||
if (Type == CandidateVersion && PkgState[Pkg->ID].CandidateVer != 0)
|
||||
if (VS().CheckDep(PkgState[Pkg->ID].CandidateVerIter(*this).VerStr(),
|
||||
Dep) == true) // CNC:2002-07-10
|
||||
Dep) == true)
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -181,6 +188,113 @@ bool pkgDepCache::CheckDep(DepIterator Dep,int Type,PkgIterator &Res)
|
||||
return true;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
Res = Dep.TargetPkg();
|
||||
|
||||
// CNC:2003-02-17 - Res is currently not changed. If it happens to
|
||||
// be changed in this function (besides when
|
||||
// returning anyway), assign a new Dep.TargetPkg()
|
||||
// to Dep_TargetPkg instead of using Res.
|
||||
//
|
||||
PkgIterator &Dep_TargetPkg = Res;
|
||||
PkgIterator Dep_ParentPkg = Dep.ParentPkg();
|
||||
pkgVersioningSystem &VS = this->VS();
|
||||
|
||||
/* Check simple depends. A depends -should- never self match but
|
||||
we allow it anyhow because dpkg does. Technically it is a packaging
|
||||
bug. Conflicts may never self match */
|
||||
if (Dep_TargetPkg != Dep_ParentPkg ||
|
||||
(Dep->Type != Dep::Conflicts && Dep->Type != Dep::Obsoletes))
|
||||
{
|
||||
PkgIterator &Pkg = Dep_TargetPkg;
|
||||
|
||||
// Check the base package
|
||||
switch (Type)
|
||||
{
|
||||
case NowVersion:
|
||||
if (Pkg->CurrentVer != 0)
|
||||
// CNC:2002-07-10 - RPM must check the dependency type to
|
||||
// properly define if it would be satisfied
|
||||
// or not.
|
||||
if (VS.CheckDep(Pkg.CurrentVer().VerStr(),Dep) == true)
|
||||
return true;
|
||||
break;
|
||||
|
||||
case InstallVersion:
|
||||
if (PkgState[Pkg->ID].InstallVer != 0)
|
||||
if (VS.CheckDep(PkgState[Pkg->ID].InstVerIter(*this).VerStr(),
|
||||
Dep) == true)
|
||||
return true;
|
||||
break;
|
||||
|
||||
case CandidateVersion:
|
||||
if (PkgState[Pkg->ID].CandidateVer != 0)
|
||||
if (VS.CheckDep(PkgState[Pkg->ID].CandidateVerIter(*this).VerStr(),
|
||||
Dep) == true)
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (Dep->Type == Dep::Obsoletes)
|
||||
return false;
|
||||
|
||||
// Check the providing packages
|
||||
PrvIterator P = Dep_TargetPkg.ProvidesList();
|
||||
PkgIterator &Pkg = Dep_ParentPkg;
|
||||
for (; P.end() != true; P++)
|
||||
{
|
||||
PkgIterator P_OwnerPkg = P.OwnerPkg();
|
||||
|
||||
/* Provides may never be applied against the same package if it is
|
||||
a conflicts. See the comment above. */
|
||||
if (P_OwnerPkg == Pkg && Dep->Type == Dep::Conflicts)
|
||||
continue;
|
||||
|
||||
// Check if the provides is a hit
|
||||
switch (Type)
|
||||
{
|
||||
case NowVersion:
|
||||
{
|
||||
if (P_OwnerPkg.CurrentVer() != P.OwnerVer())
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
case InstallVersion:
|
||||
{
|
||||
StateCache &State = PkgState[P_OwnerPkg->ID];
|
||||
if (State.InstallVer != (Version *)P.OwnerVer())
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
case CandidateVersion:
|
||||
{
|
||||
StateCache &State = PkgState[P_OwnerPkg->ID];
|
||||
if (State.CandidateVer != (Version *)P.OwnerVer())
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Compare the versions.
|
||||
if (VS.CheckDep(P.ProvideVersion(),Dep) == true) // CNC:2002-07-10
|
||||
{
|
||||
Res = P_OwnerPkg;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// CNC:2002-07-05
|
||||
if (_system->IgnoreDep(VS,Dep) == true)
|
||||
{
|
||||
Res = Dep_TargetPkg;
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
/*}}}*/
|
||||
@ -340,6 +454,10 @@ unsigned char pkgDepCache::VersionState(DepIterator D,unsigned char Check,
|
||||
LastOR = (D->CompareOp & Dep::Or) == Dep::Or;
|
||||
}
|
||||
|
||||
// CNC:2003-02-17 - IsImportantDep() currently calls IsCritical(), so
|
||||
// these two are currently doing the same thing. Check
|
||||
// comments in IsImportantDep() definition.
|
||||
#if 0
|
||||
// Minimum deps that must be satisfied to have a working package
|
||||
if (Start.IsCritical() == true)
|
||||
if ((State & Check) != Check)
|
||||
@ -349,6 +467,13 @@ unsigned char pkgDepCache::VersionState(DepIterator D,unsigned char Check,
|
||||
if (IsImportantDep(Start) == true &&
|
||||
(State & Check) != Check)
|
||||
Dep &= ~SetPolicy;
|
||||
#else
|
||||
if (Start.IsCritical() == true)
|
||||
if ((State & Check) != Check) {
|
||||
Dep &= ~SetMin;
|
||||
Dep &= ~SetPolicy;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return Dep;
|
||||
@ -669,6 +794,10 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
|
||||
if (Result == false)
|
||||
continue;
|
||||
|
||||
// CNC:2003-02-17 - IsImportantDep() currently calls IsCritical(), so
|
||||
// these two are currently doing the same thing. Check
|
||||
// comments in IsImportantDep() definition.
|
||||
#if 0
|
||||
/* Check if this dep should be consider for install. If it is a user
|
||||
defined important dep and we are installed a new package then
|
||||
it will be installed. Otherwise we only worry about critical deps */
|
||||
@ -676,6 +805,10 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
|
||||
continue;
|
||||
if (Pkg->CurrentVer != 0 && Start.IsCritical() == false)
|
||||
continue;
|
||||
#else
|
||||
if (Start.IsCritical() == false)
|
||||
continue;
|
||||
#endif
|
||||
|
||||
/* If we are in an or group locate the first or that can
|
||||
succeed. We have already cached this.. */
|
||||
@ -870,7 +1003,66 @@ pkgCache::VerIterator pkgDepCache::Policy::GetCandidateVer(PkgIterator Pkg)
|
||||
/* */
|
||||
bool pkgDepCache::Policy::IsImportantDep(DepIterator Dep)
|
||||
{
|
||||
// CNC:2002-03-17 - Every place that uses this function seems to
|
||||
// currently check for IsCritical() as well. Since
|
||||
// this is a virtual (heavy) function, we'll try
|
||||
// not to use it while not necessary.
|
||||
return Dep.IsCritical();
|
||||
}
|
||||
/*}}}*/
|
||||
|
||||
// CNC:2003-02-24
|
||||
// pkgDepCache::State::* - Routines to work on the state of a DepCache. /*{{{*/
|
||||
// ---------------------------------------------------------------------
|
||||
/* */
|
||||
void pkgDepCache::State::Save(pkgDepCache *dep)
|
||||
{
|
||||
Dep = dep;
|
||||
delete [] PkgState;
|
||||
delete [] DepState;
|
||||
delete [] PkgIgnore;
|
||||
int Size = Dep->Head().PackageCount;
|
||||
PkgState = new StateCache[Size];
|
||||
PkgIgnore = new bool[Size];
|
||||
DepState = new unsigned char[Dep->Head().DependsCount];
|
||||
memcpy(PkgState, Dep->PkgState, Size*sizeof(*PkgState));
|
||||
memset(PkgIgnore, 0, Size*sizeof(*PkgIgnore));
|
||||
memcpy(DepState, Dep->DepState, Dep->Head().DependsCount*sizeof(*DepState));
|
||||
iUsrSize = Dep->iUsrSize;
|
||||
iDownloadSize= Dep->iDownloadSize;
|
||||
iInstCount = Dep->iInstCount;
|
||||
iDelCount = Dep->iDelCount;
|
||||
iKeepCount = Dep->iKeepCount;
|
||||
iBrokenCount = Dep->iBrokenCount;
|
||||
iBadCount = Dep->iBadCount;
|
||||
}
|
||||
|
||||
void pkgDepCache::State::Restore()
|
||||
{
|
||||
int Size = Dep->Head().PackageCount;
|
||||
memcpy(Dep->PkgState, PkgState, Size*sizeof(*PkgState));
|
||||
memcpy(Dep->DepState, DepState, Dep->Head().DependsCount*sizeof(*DepState));
|
||||
Dep->iUsrSize = iUsrSize;
|
||||
Dep->iDownloadSize= iDownloadSize;
|
||||
Dep->iInstCount = iInstCount;
|
||||
Dep->iDelCount = iDelCount;
|
||||
Dep->iKeepCount = iKeepCount;
|
||||
Dep->iBrokenCount = iBrokenCount;
|
||||
Dep->iBadCount = iBadCount;
|
||||
}
|
||||
|
||||
bool pkgDepCache::State::Changed()
|
||||
{
|
||||
int Size = Dep->Head().PackageCount;
|
||||
StateCache *NewPkgState = Dep->PkgState;
|
||||
for (int i = 0; i != Size; i++) {
|
||||
if (PkgIgnore[i] == false &&
|
||||
((PkgState[i].Status != NewPkgState[i].Status) ||
|
||||
(PkgState[i].Mode != NewPkgState[i].Mode)))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/*}}}*/
|
||||
|
||||
// vim:sts=3:sw=3
|
||||
|
@ -116,6 +116,10 @@ class pkgDepCache : protected pkgCache::Namespace
|
||||
|
||||
virtual VerIterator GetCandidateVer(PkgIterator Pkg);
|
||||
virtual bool IsImportantDep(DepIterator Dep);
|
||||
// CNC:2003-03-05 - We need access to the priority in pkgDistUpgrade
|
||||
// while checking for obsoleting packages.
|
||||
virtual signed short GetPkgPriority(pkgCache::PkgIterator const &Pkg)
|
||||
{ return 0; };
|
||||
|
||||
virtual ~Policy() {};
|
||||
};
|
||||
@ -164,6 +168,10 @@ class pkgDepCache : protected pkgCache::Namespace
|
||||
|
||||
public:
|
||||
|
||||
// CNC:2003-02-23 - See below.
|
||||
class State;
|
||||
friend class State;
|
||||
|
||||
// Legacy.. We look like a pkgCache
|
||||
inline operator pkgCache &() {return *Cache;};
|
||||
inline Header &Head() {return *Cache->HeaderP;};
|
||||
@ -177,6 +185,8 @@ class pkgDepCache : protected pkgCache::Namespace
|
||||
inline VerIterator GetCandidateVer(PkgIterator Pkg) {return LocalPolicy->GetCandidateVer(Pkg);};
|
||||
inline bool IsImportantDep(DepIterator Dep) {return LocalPolicy->IsImportantDep(Dep);};
|
||||
inline Policy &GetPolicy() {return *LocalPolicy;};
|
||||
// CNC:2003-03-05 - See above.
|
||||
inline signed short GetPkgPriority(pkgCache::PkgIterator const &Pkg) {return LocalPolicy->GetPkgPriority(Pkg);};
|
||||
|
||||
// Accessors
|
||||
inline StateCache &operator [](PkgIterator const &I) {return PkgState[I->ID];};
|
||||
@ -208,6 +218,52 @@ class pkgDepCache : protected pkgCache::Namespace
|
||||
virtual ~pkgDepCache();
|
||||
};
|
||||
|
||||
// CNC:2003-02-24 - Class to work on the state of a depcache.
|
||||
class pkgDepCache::State
|
||||
{
|
||||
protected:
|
||||
|
||||
pkgDepCache *Dep;
|
||||
|
||||
StateCache *PkgState;
|
||||
unsigned char *DepState;
|
||||
double iUsrSize;
|
||||
double iDownloadSize;
|
||||
unsigned long iInstCount;
|
||||
unsigned long iDelCount;
|
||||
unsigned long iKeepCount;
|
||||
unsigned long iBrokenCount;
|
||||
unsigned long iBadCount;
|
||||
|
||||
bool *PkgIgnore;
|
||||
|
||||
public:
|
||||
|
||||
void Save(pkgDepCache *Dep);
|
||||
void Restore();
|
||||
bool Changed();
|
||||
|
||||
void Ignore(PkgIterator const &I) {PkgIgnore[I->ID] = true;};
|
||||
|
||||
StateCache &operator [](pkgCache::PkgIterator const &I) {return PkgState[I->ID];};
|
||||
|
||||
// Size queries
|
||||
inline double UsrSize() {return iUsrSize;};
|
||||
inline double DebSize() {return iDownloadSize;};
|
||||
inline unsigned long DelCount() {return iDelCount;};
|
||||
inline unsigned long KeepCount() {return iKeepCount;};
|
||||
inline unsigned long InstCount() {return iInstCount;};
|
||||
inline unsigned long BrokenCount() {return iBrokenCount;};
|
||||
inline unsigned long BadCount() {return iBadCount;};
|
||||
|
||||
State(pkgDepCache *Dep=NULL)
|
||||
: Dep(0), PkgState(0), DepState(0), PkgIgnore(0)
|
||||
{ if (Dep != NULL) Save(Dep); };
|
||||
~State()
|
||||
{ delete[] PkgState; delete[] DepState; delete[] PkgIgnore; };
|
||||
};
|
||||
|
||||
|
||||
/* This is an exact copy of the structure above, nested in pkgDepCache.
|
||||
* This is defined again here since SWIG doesn't know how to handle nested
|
||||
* structures yet. It will be dropped once that situation changes. */
|
||||
@ -256,3 +312,5 @@ class pkgDepCache : protected pkgCache::Namespace
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
// vim:sts=3:sw=3
|
||||
|
@ -1,6 +1,6 @@
|
||||
// -*- mode: cpp; mode: fold -*-
|
||||
// Description /*{{{*/
|
||||
// $Id: init.cc,v 1.5 2003/01/29 18:43:48 niemeyer Exp $
|
||||
// $Id: init.cc,v 1.20 2003/02/09 20:31:05 doogie Exp $
|
||||
/* ######################################################################
|
||||
|
||||
Init - Initialize the package library
|
||||
@ -65,6 +65,8 @@ bool pkgInitConfig(Configuration &Cnf)
|
||||
// Configuration
|
||||
Cnf.Set("Dir::Etc","etc/apt/");
|
||||
Cnf.Set("Dir::Etc::sourcelist","sources.list");
|
||||
// CNC:2003-03-03
|
||||
Cnf.Set("Dir::Etc::sourceparts","sources.list.d");
|
||||
Cnf.Set("Dir::Etc::vendorlist","vendors.list");
|
||||
Cnf.Set("Dir::Etc::vendorparts","vendors.list.d");
|
||||
Cnf.Set("Dir::Etc::main","apt.conf");
|
||||
@ -95,20 +97,37 @@ bool pkgInitConfig(Configuration &Cnf)
|
||||
if (Cnf.FindB("Debug::pkgInitConfig",false) == true)
|
||||
Cnf.Dump();
|
||||
|
||||
#ifdef APT_DOMAIN
|
||||
if (Cnf.Exists("Dir::Locale"))
|
||||
{
|
||||
bindtextdomain(APT_DOMAIN,Cnf.FindDir("Dir::Locale").c_str());
|
||||
bindtextdomain(textdomain(0),Cnf.FindDir("Dir::Locale").c_str());
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
/*}}}*/
|
||||
|
||||
// CNC:2003-02-16 - We must do that to force a statically linked libapt-pkg
|
||||
// library to include the package systems into the binary.
|
||||
#include <apt-pkg/rpmsystem.h>
|
||||
//#include <apt-pkg/debsystem.h>
|
||||
void ForceLinkage()
|
||||
{
|
||||
rpmSystem *rpmsys = &rpmSys;
|
||||
rpmsys->ArchiveSupported("");
|
||||
//debSystem *debsys = &debSys;
|
||||
//depsys->ArchiveSupported("");
|
||||
}
|
||||
|
||||
// pkgInitSystem - Initialize the _system calss /*{{{*/
|
||||
// ---------------------------------------------------------------------
|
||||
/* */
|
||||
bool pkgInitSystem(Configuration &Cnf,pkgSystem *&Sys)
|
||||
{
|
||||
ForceLinkage(); // CNC:2003-02-16 - See above.
|
||||
|
||||
Sys = 0;
|
||||
string Label = Cnf.Find("Apt::System","");
|
||||
if (Label.empty() == false)
|
||||
|
@ -17,7 +17,7 @@ LIBEXT=$(GLIBC_VER)$(LIBSTDCPP_VER)
|
||||
MAJOR=3.3
|
||||
MINOR=0
|
||||
# CNC:2002-07-03
|
||||
SLIBS=$(PTHREADLIB) $(RPMLIBS)
|
||||
SLIBS=$(PTHREADLIB) $(INTLLIBS) $(RPMLIBS)
|
||||
APT_DOMAIN:=libapt-pkg$(MAJOR)
|
||||
|
||||
# Source code for the contributed non-core things
|
||||
@ -45,6 +45,9 @@ HEADERS+= algorithms.h depcache.h pkgcachegen.h cacheiterators.h \
|
||||
clean.h srcrecords.h cachefile.h versionmatch.h policy.h \
|
||||
pkgsystem.h indexfile.h repository.h
|
||||
|
||||
# CNC:2003-02-15
|
||||
WITH_DEB=no
|
||||
ifeq ($(WITH_DEB),yes)
|
||||
# Source code for the debian specific components
|
||||
# In theory the deb headers do not need to be exported..
|
||||
SOURCE+= deb/deblistparser.cc deb/debrecords.cc deb/dpkgpm.cc \
|
||||
@ -52,6 +55,7 @@ SOURCE+= deb/deblistparser.cc deb/debrecords.cc deb/dpkgpm.cc \
|
||||
deb/debindexfile.cc deb/debindexfile.cc
|
||||
HEADERS+= debversion.h debsrcrecords.h dpkgpm.h debrecords.h \
|
||||
deblistparser.h debsystem.h debindexfile.h
|
||||
endif
|
||||
|
||||
# CNC:2002-07-03
|
||||
# Source code for the rpm specific components
|
||||
@ -59,7 +63,8 @@ SOURCE+= rpm/rpmhandler.cc rpm/rpmindexfile.cc rpm/rpmlistparser.cc \
|
||||
rpm/rpmpackagedata.cc rpm/rpmpm.cc rpm/rpmrecords.cc \
|
||||
rpm/rpmsrcrecords.cc rpm/rpmsystem.cc rpm/rpmversion.cc
|
||||
HEADERS+= rpmhandler.h rpmindexfile.h rpmlistparser.h rpmpackagedata.h \
|
||||
rpmpm.h rpmrecords.h rpmsrcrecords.h rpmsystem.h rpmversion.h
|
||||
rpmpm.h rpmrecords.h rpmsrcrecords.h rpmsystem.h rpmversion.h \
|
||||
rpmmisc.h
|
||||
|
||||
HEADERS := $(addprefix apt-pkg/,$(HEADERS))
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
// -*- mode: cpp; mode: fold -*-
|
||||
// Description /*{{{*/
|
||||
// $Id: pkgcache.cc,v 1.2 2002/07/23 20:50:56 niemeyer Exp $
|
||||
// $Id: pkgcache.cc,v 1.37 2003/02/10 01:40:58 doogie Exp $
|
||||
/* ######################################################################
|
||||
|
||||
Package Cache - Accessor code for the cache
|
||||
@ -144,10 +144,12 @@ bool pkgCache::ReMap()
|
||||
// Chcek the arhcitecture
|
||||
if (HeaderP->Architecture == 0 ||
|
||||
_config->Find("APT::Architecture") != StrP + HeaderP->Architecture)
|
||||
return _error->Error(_("The package cache was build for a different architecture"));
|
||||
return _error->Error(_("The package cache was built for a different architecture"));
|
||||
return true;
|
||||
}
|
||||
/*}}}*/
|
||||
// CNC:2003-02-16 - Inlined in pkgcache.h and hacked for better performance.
|
||||
#if 0
|
||||
// Cache::Hash - Hash a string /*{{{*/
|
||||
// ---------------------------------------------------------------------
|
||||
/* This is used to generate the hash entries for the HashTable. With my
|
||||
@ -168,6 +170,7 @@ unsigned long pkgCache::sHash(const char *Str) const
|
||||
Hash = 5*Hash + tolower(*I);
|
||||
return Hash % _count(HeaderP->HashTable);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*}}}*/
|
||||
// Cache::FindPkg - Locate a package by name /*{{{*/
|
||||
@ -177,15 +180,39 @@ pkgCache::PkgIterator pkgCache::FindPkg(string Name)
|
||||
{
|
||||
// Look at the hash bucket
|
||||
Package *Pkg = PkgP + HeaderP->HashTable[Hash(Name)];
|
||||
const char *name = Name.c_str(); // CNC:2003-02-17
|
||||
for (; Pkg != PkgP; Pkg = PkgP + Pkg->NextPackage)
|
||||
{
|
||||
if (Pkg->Name != 0 && StrP[Pkg->Name] == Name[0] &&
|
||||
stringcmp(Name,StrP + Pkg->Name) == 0) // CNC:2002-07-23
|
||||
// CNC:2003-02-17 - We use case sensitive package names. Also,
|
||||
// store Pkg->Name in a temporary variable.
|
||||
map_ptrloc PkgName = Pkg->Name;
|
||||
if (PkgName != 0 && StrP[PkgName] == name[0] &&
|
||||
strcmp(name,StrP + PkgName) == 0)
|
||||
return PkgIterator(*this,Pkg);
|
||||
}
|
||||
return PkgIterator(*this,0);
|
||||
}
|
||||
/*}}}*/
|
||||
|
||||
// CNC:2003-02-17 - A slightly changed FindPkg(), hacked for performance.
|
||||
// Cache::FindPackage - Locate a package (not an iterator) by name /*{{{*/
|
||||
// ---------------------------------------------------------------------
|
||||
/* Returns 0 on error, pointer to the package otherwise */
|
||||
pkgCache::Package *pkgCache::FindPackage(const char *Name)
|
||||
{
|
||||
// Look at the hash bucket
|
||||
Package *Pkg = PkgP + HeaderP->HashTable[Hash(Name)];
|
||||
for (; Pkg != PkgP; Pkg = PkgP + Pkg->NextPackage)
|
||||
{
|
||||
// CNC:2003-02-17 - We use case sensitive package names. Also,
|
||||
// store Pkg->Name in a temporary variable.
|
||||
map_ptrloc PkgName = Pkg->Name;
|
||||
if (PkgName != 0 && StrP[PkgName] == Name[0] &&
|
||||
strcmp(Name,StrP + PkgName) == 0)
|
||||
return Pkg;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
// Cache::CompTypeDeb - Return a string describing the compare type /*{{{*/
|
||||
// ---------------------------------------------------------------------
|
||||
/* This returns a string representation of the dependency compare
|
||||
@ -282,6 +309,8 @@ pkgCache::PkgIterator::OkState pkgCache::PkgIterator::State() const
|
||||
// ---------------------------------------------------------------------
|
||||
/* Currently critical deps are defined as depends, predepends and
|
||||
conflicts. */
|
||||
// CNC:2003-02-17 - Inlined in cacheiterators.h.
|
||||
#if 0
|
||||
bool pkgCache::DepIterator::IsCritical()
|
||||
{
|
||||
if (Dep->Type == pkgCache::Dep::Conflicts ||
|
||||
@ -291,6 +320,7 @@ bool pkgCache::DepIterator::IsCritical()
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
/*}}}*/
|
||||
// DepIterator::SmartTargetPkg - Resolve dep target pointers w/provides /*{{{*/
|
||||
// ---------------------------------------------------------------------
|
||||
|
@ -108,8 +108,9 @@ class pkgCache
|
||||
string CacheFile;
|
||||
MMap ⤅
|
||||
|
||||
unsigned long sHash(string S) const;
|
||||
unsigned long sHash(const char *S) const;
|
||||
// CNC:2003-02-16 - Inlined here.
|
||||
inline unsigned long sHash(const char *S) const;
|
||||
inline unsigned long sHash(string S) const {return sHash(S.c_str());};
|
||||
|
||||
public:
|
||||
|
||||
@ -138,6 +139,8 @@ class pkgCache
|
||||
|
||||
// Accessors
|
||||
PkgIterator FindPkg(string Name);
|
||||
// CNC:2003-02-17 - A slightly changed FindPkg(), hacked for performance.
|
||||
Package *FindPackage(const char *Name);
|
||||
Header &Head() {return *HeaderP;};
|
||||
inline PkgIterator PkgBegin();
|
||||
inline PkgIterator PkgEnd();
|
||||
@ -194,7 +197,7 @@ struct pkgCache::Header
|
||||
DynamicMMap::Pool Pools[7];
|
||||
|
||||
// Rapid package name lookup
|
||||
map_ptrloc HashTable[2*1048];
|
||||
map_ptrloc HashTable[8*1048];
|
||||
|
||||
bool CheckSizes(Header &Against) const;
|
||||
Header();
|
||||
@ -302,6 +305,19 @@ struct pkgCache::StringItem
|
||||
|
||||
#include <apt-pkg/cacheiterators.h>
|
||||
|
||||
// CNC:2003-02-16 - Inlined here.
|
||||
#include <ctype.h>
|
||||
#define hash_count(a) (sizeof(a)/sizeof(a[0]))
|
||||
inline unsigned long pkgCache::sHash(const char *Str) const
|
||||
{
|
||||
unsigned long Hash = 0;
|
||||
for (const char *I = Str; *I != 0; I++)
|
||||
//Hash = 5*Hash + tolower(*I);
|
||||
Hash = 5*Hash + *I;
|
||||
return Hash % hash_count(HeaderP->HashTable);
|
||||
}
|
||||
#undef hash_count
|
||||
|
||||
inline pkgCache::PkgIterator pkgCache::PkgBegin()
|
||||
{return PkgIterator(*this);};
|
||||
inline pkgCache::PkgIterator pkgCache::PkgEnd()
|
||||
@ -330,3 +346,5 @@ class pkgCache::Namespace
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
// vim:sts=3:sw=3
|
||||
|
@ -1,6 +1,6 @@
|
||||
// -*- mode: cpp; mode: fold -*-
|
||||
// Description /*{{{*/
|
||||
// $Id: pkgcachegen.cc,v 1.5 2002/10/03 22:21:23 niemeyer Exp $
|
||||
// $Id: pkgcachegen.cc,v 1.53 2003/02/02 02:44:20 doogie Exp $
|
||||
/* ######################################################################
|
||||
|
||||
Package Cache Generator - Generator for the cache structure.
|
||||
@ -104,6 +104,12 @@ bool pkgCacheGenerator::MergeList(ListParser &List,
|
||||
{
|
||||
List.Owner = this;
|
||||
|
||||
// CNC:2003-02-20 - When --reinstall is used during a cache building
|
||||
// process, the algorithm is sligthly changed to
|
||||
// order the "better" architectures before, even if
|
||||
// they are already in the system.
|
||||
bool ReInstall = _config->FindB("APT::Get::ReInstall", false);
|
||||
|
||||
unsigned int Counter = 0;
|
||||
while (List.Step() == true)
|
||||
{
|
||||
@ -116,8 +122,13 @@ bool pkgCacheGenerator::MergeList(ListParser &List,
|
||||
if (NewPackage(Pkg,PackageName) == false)
|
||||
return _error->Error(_("Error occured while processing %s (NewPackage)"),PackageName.c_str());
|
||||
Counter++;
|
||||
if (Counter % 100 == 0 && Progress != 0)
|
||||
Progress->Progress(List.Offset());
|
||||
// CNC:2003-02-16
|
||||
if (Counter % 100 == 0 && Progress != 0) {
|
||||
if (List.OrderedOffset() == true)
|
||||
Progress->Progress(List.Offset());
|
||||
else
|
||||
Progress->Progress(Counter);
|
||||
}
|
||||
|
||||
/* Get a pointer to the version structure. We know the list is sorted
|
||||
so we use that fact in the search. Insertion of new versions is
|
||||
@ -139,8 +150,14 @@ bool pkgCacheGenerator::MergeList(ListParser &List,
|
||||
int Res = 1;
|
||||
for (; Ver.end() == false; Last = &Ver->NextVer, Ver++)
|
||||
{
|
||||
// CNC:2002-07-09
|
||||
Res = Cache.VS->CmpVersionArch(Version,Arch,Ver.VerStr(),Ver.Arch());
|
||||
// 2003-02-20 - If the package is already installed, the
|
||||
// architecture doesn't matter, unless
|
||||
// --reinstall has been used.
|
||||
if (!ReInstall && List.IsDatabase())
|
||||
Res = Cache.VS->CmpVersion(Version, Ver.VerStr());
|
||||
else
|
||||
Res = Cache.VS->CmpVersionArch(Version,Arch,
|
||||
Ver.VerStr(),Ver.Arch());
|
||||
if (Res >= 0)
|
||||
break;
|
||||
}
|
||||
@ -172,6 +189,8 @@ bool pkgCacheGenerator::MergeList(ListParser &List,
|
||||
// Skip to the end of the same version set.
|
||||
if (Res == 0)
|
||||
{
|
||||
// CNC:2003-02-20 - Unless this package is already installed.
|
||||
if (!List.IsDatabase())
|
||||
for (; Ver.end() == false; Last = &Ver->NextVer, Ver++)
|
||||
{
|
||||
// CNC:2002-07-09
|
||||
@ -244,11 +263,26 @@ bool pkgCacheGenerator::MergeFileProvides(ListParser &List)
|
||||
|
||||
pkgCache::PkgIterator Pkg = Cache.FindPkg(PackageName);
|
||||
if (Pkg.end() == true)
|
||||
#if 0
|
||||
// CNC:2003-03-03 - Ignore missing packages. This will happen when
|
||||
// a package is placed in Allow-Duplicated and
|
||||
// then removed, but the source cache is still
|
||||
// counting with it as Allow-Duplicated. No good
|
||||
// way to handle that right now.
|
||||
return _error->Error(_("Error occured while processing %s (FindPkg)"),
|
||||
PackageName.c_str());
|
||||
#else
|
||||
continue;
|
||||
#endif
|
||||
|
||||
Counter++;
|
||||
if (Counter % 100 == 0 && Progress != 0)
|
||||
Progress->Progress(List.Offset());
|
||||
// CNC:2003-02-16
|
||||
if (Counter % 100 == 0 && Progress != 0) {
|
||||
if (List.OrderedOffset() == true)
|
||||
Progress->Progress(List.Offset());
|
||||
else
|
||||
Progress->Progress(Counter);
|
||||
}
|
||||
|
||||
unsigned long Hash = List.VersionHash();
|
||||
pkgCache::VerIterator Ver = Pkg.VersionList();
|
||||
@ -263,8 +297,15 @@ bool pkgCacheGenerator::MergeFileProvides(ListParser &List)
|
||||
}
|
||||
}
|
||||
|
||||
// CNC:2003-03-03 - Ignore missing versions. This will happen when
|
||||
// a package is placed in Allow-Duplicated and
|
||||
// then removed, but the source cache is still
|
||||
// counting with it as Allow-Duplicated. No good
|
||||
// way to handle that right now.
|
||||
#if 0
|
||||
if (Ver.end() == true)
|
||||
_error->Warning(_("Package %s %s was not found while processing file dependencies"),PackageName.c_str(),Version.c_str());
|
||||
#endif
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -275,9 +316,18 @@ bool pkgCacheGenerator::MergeFileProvides(ListParser &List)
|
||||
/* This creates a new package structure and adds it to the hash table */
|
||||
bool pkgCacheGenerator::NewPackage(pkgCache::PkgIterator &Pkg,string Name)
|
||||
{
|
||||
// CNC:2003-02-17 - Optimized.
|
||||
#if 0
|
||||
Pkg = Cache.FindPkg(Name);
|
||||
if (Pkg.end() == false)
|
||||
return true;
|
||||
#else
|
||||
pkgCache::Package *P = Cache.FindPackage(Name.c_str());
|
||||
if (P != NULL) {
|
||||
Pkg = pkgCache::PkgIterator(Cache, P);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Get a structure
|
||||
unsigned long Package = Map.Allocate(sizeof(pkgCache::Package));
|
||||
@ -557,6 +607,15 @@ static bool CheckValidity(string CacheFile, FileIterator Start,
|
||||
if (CacheFile.empty() == true || FileExists(CacheFile) == false)
|
||||
return false;
|
||||
|
||||
// CNC:2003-02-20 - When --reinstall is used during a cache building
|
||||
// process, the algorithm is sligthly changed to
|
||||
// order the "better" architectures before, even if
|
||||
// they are already in the system. Thus, we rebuild
|
||||
// the cache when it's used.
|
||||
bool ReInstall = _config->FindB("APT::Get::ReInstall", false);
|
||||
if (ReInstall == true)
|
||||
return false;
|
||||
|
||||
// Map it
|
||||
FileFd CacheF(CacheFile,FileFd::ReadOnly);
|
||||
SPtr<MMap> Map = new MMap(CacheF,MMap::Public | MMap::ReadOnly);
|
||||
@ -655,23 +714,38 @@ static bool BuildCache(pkgCacheGenerator &Gen,
|
||||
return false;
|
||||
}
|
||||
|
||||
// CNC:2003-03-03 - Code that was here has been moved to its own function.
|
||||
|
||||
return true;
|
||||
}
|
||||
/*}}}*/
|
||||
// CNC:2003-03-03
|
||||
// CollectFileProvides - Merge the file provides into the cache /*{{{*/
|
||||
// ---------------------------------------------------------------------
|
||||
/* */
|
||||
static bool CollectFileProvides(pkgCacheGenerator &Gen,
|
||||
OpProgress &Progress,
|
||||
FileIterator Start, FileIterator End)
|
||||
{
|
||||
FileIterator I;
|
||||
if (Gen.HasFileDeps() == true)
|
||||
{
|
||||
Progress.Done();
|
||||
TotalSize = ComputeSize(Start, End);
|
||||
CurrentSize = 0;
|
||||
unsigned long TotalSize = ComputeSize(Start, End);
|
||||
unsigned long CurrentSize = 0;
|
||||
for (I = Start; I != End; I++)
|
||||
{
|
||||
if ((*I)->HasPackages() == false || (*I)->Exists() == false)
|
||||
continue;
|
||||
|
||||
unsigned long Size = (*I)->Size();
|
||||
Progress.OverallProgress(CurrentSize,TotalSize,Size,_("Collecting File Provides"));
|
||||
CurrentSize += Size;
|
||||
if ((*I)->MergeFileProvides(Gen,Progress) == false)
|
||||
return false;
|
||||
}
|
||||
// CNC:2002-07-04
|
||||
Progress.Done();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
/*}}}*/
|
||||
@ -686,7 +760,7 @@ static bool BuildCache(pkgCacheGenerator &Gen,
|
||||
bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress,
|
||||
MMap **OutMap,bool AllowMem)
|
||||
{
|
||||
unsigned long MapSize = _config->FindI("APT::Cache-Limit",6*1024*1024);
|
||||
unsigned long MapSize = _config->FindI("APT::Cache-Limit",12*1024*1024);
|
||||
|
||||
vector<pkgIndexFile *> Files(List.begin(),List.end());
|
||||
unsigned long EndOfSource = Files.size();
|
||||
@ -747,7 +821,6 @@ bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress,
|
||||
// Lets try the source cache.
|
||||
unsigned long CurrentSize = 0;
|
||||
unsigned long TotalSize = 0;
|
||||
#if DISABLED
|
||||
if (CheckValidity(SrcCacheFile,Files.begin(),
|
||||
Files.begin()+EndOfSource) == true)
|
||||
{
|
||||
@ -766,6 +839,13 @@ bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress,
|
||||
if (BuildCache(Gen,Progress,CurrentSize,TotalSize,
|
||||
Files.begin()+EndOfSource,Files.end()) == false)
|
||||
return false;
|
||||
|
||||
// CNC:2003-03-03
|
||||
// Collect file provides over *all* files (sources + database), since
|
||||
// the cache is saved without them.
|
||||
if (CollectFileProvides(Gen,Progress,
|
||||
Files.begin(),Files.end()) == false)
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -780,6 +860,10 @@ bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress,
|
||||
return false;
|
||||
|
||||
// Write it back
|
||||
// CNC:2003-03-03 - Notice that it is without the file provides. This
|
||||
// is on purpose, since file requires introduced later on the status
|
||||
// cache (database) must be considered when collecting file provides,
|
||||
// even if using the sources cache (above).
|
||||
if (Writeable == true && SrcCacheFile.empty() == false)
|
||||
{
|
||||
FileFd SCacheF(SrcCacheFile,FileFd::WriteEmpty);
|
||||
@ -806,20 +890,14 @@ bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress,
|
||||
if (BuildCache(Gen,Progress,CurrentSize,TotalSize,
|
||||
Files.begin()+EndOfSource,Files.end()) == false)
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
{
|
||||
TotalSize = ComputeSize(Files.begin(),Files.end());
|
||||
|
||||
// Build the whole cache at once
|
||||
pkgCacheGenerator Gen(Map.Get(),&Progress);
|
||||
if (_error->PendingError() == true)
|
||||
return false;
|
||||
if (BuildCache(Gen,Progress,CurrentSize,TotalSize,
|
||||
Files.begin(),Files.end()) == false)
|
||||
|
||||
// CNC:2003-03-03
|
||||
// Collect file provides over *all* files (sources + database), since
|
||||
// the cache is saved without them.
|
||||
if (CollectFileProvides(Gen,Progress,
|
||||
Files.begin(),Files.end()) == false)
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (_error->PendingError() == true)
|
||||
return false;
|
||||
@ -835,6 +913,10 @@ bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress,
|
||||
*OutMap = Map.UnGuard();
|
||||
}
|
||||
}
|
||||
|
||||
// CNC:2003-03-07 - Signal to the system so that it can free it's
|
||||
// internal caches, if any.
|
||||
_system->CacheBuilt();
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -844,7 +926,7 @@ bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress,
|
||||
/* */
|
||||
bool pkgMakeOnlyStatusCache(OpProgress &Progress,DynamicMMap **OutMap)
|
||||
{
|
||||
unsigned long MapSize = _config->FindI("APT::Cache-Limit",4*1024*1024);
|
||||
unsigned long MapSize = _config->FindI("APT::Cache-Limit",8*1024*1024);
|
||||
vector<pkgIndexFile *> Files;
|
||||
unsigned long EndOfSource = Files.size();
|
||||
if (_system->AddStatusFiles(Files) == false)
|
||||
@ -865,10 +947,22 @@ bool pkgMakeOnlyStatusCache(OpProgress &Progress,DynamicMMap **OutMap)
|
||||
if (BuildCache(Gen,Progress,CurrentSize,TotalSize,
|
||||
Files.begin()+EndOfSource,Files.end()) == false)
|
||||
return false;
|
||||
|
||||
// CNC:2003-03-03
|
||||
// Collect file provides over *all* files (sources + database), since
|
||||
// the cache is saved without them.
|
||||
if (CollectFileProvides(Gen,Progress,
|
||||
Files.begin(),Files.end()) == false)
|
||||
return false;
|
||||
|
||||
if (_error->PendingError() == true)
|
||||
return false;
|
||||
*OutMap = Map.UnGuard();
|
||||
|
||||
// CNC:2003-03-07 - Signal to the system so that it can free it's
|
||||
// internal caches, if any.
|
||||
_system->CacheBuilt();
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -53,12 +53,14 @@ class pkgCacheGenerator
|
||||
// Flag file dependencies
|
||||
bool FoundFileDeps;
|
||||
|
||||
bool NewPackage(pkgCache::PkgIterator &Pkg,string Pkg);
|
||||
bool NewFileVer(pkgCache::VerIterator &Ver,ListParser &List);
|
||||
unsigned long NewVersion(pkgCache::VerIterator &Ver,string VerStr,unsigned long Next);
|
||||
|
||||
public:
|
||||
|
||||
// CNC:2003-02-27 - We need this in rpmListParser.
|
||||
bool NewPackage(pkgCache::PkgIterator &Pkg,string Pkg);
|
||||
|
||||
unsigned long WriteUniqString(const char *S,unsigned int Size);
|
||||
inline unsigned long WriteUniqString(string S) {return WriteUniqString(S.c_str(),S.length());};
|
||||
|
||||
@ -80,9 +82,6 @@ class pkgCacheGenerator
|
||||
// This is the abstract package list parser class.
|
||||
class pkgCacheGenerator::ListParser
|
||||
{
|
||||
pkgCacheGenerator *Owner;
|
||||
friend class pkgCacheGenerator;
|
||||
|
||||
// Some cache items
|
||||
pkgCache::VerIterator OldDepVer;
|
||||
map_ptrloc *OldDepLast;
|
||||
@ -92,6 +91,10 @@ class pkgCacheGenerator::ListParser
|
||||
|
||||
protected:
|
||||
|
||||
// CNC:2003-02-27 - We need Owner in rpmListParser.
|
||||
pkgCacheGenerator *Owner;
|
||||
friend class pkgCacheGenerator;
|
||||
|
||||
inline unsigned long WriteUniqString(string S) {return Owner->WriteUniqString(S);};
|
||||
inline unsigned long WriteUniqString(const char *S,unsigned int Size) {return Owner->WriteUniqString(S,Size);};
|
||||
inline unsigned long WriteString(string S) {return Owner->Map.WriteString(S);};
|
||||
@ -114,6 +117,18 @@ class pkgCacheGenerator::ListParser
|
||||
pkgCache::VerIterator Ver) = 0;
|
||||
virtual unsigned long Offset() = 0;
|
||||
virtual unsigned long Size() = 0;
|
||||
|
||||
// CNC:2003-02-16 - If this is false, the Size of the pkgIndexFile must
|
||||
// provide the number of elements, since a sequential
|
||||
// counter will be used to verify progress.
|
||||
virtual bool OrderedOffset() {return true;};
|
||||
|
||||
// CNC:2003-02-20 - This method will help on package ordering tasks,
|
||||
// ensuring that if a package with the same version
|
||||
// is installed, it won't be unexpectedly downloaded,
|
||||
// even if with a "better" architecture or different
|
||||
// dependencies.
|
||||
virtual bool IsDatabase() {return false;};
|
||||
|
||||
virtual bool Step() = 0;
|
||||
|
||||
|
@ -71,6 +71,9 @@ class pkgSystem
|
||||
|
||||
// CNC:2002-07-06
|
||||
virtual bool LockRead() {return true;};
|
||||
|
||||
// CNC:2003-03-07 - Signal to system that the cache has been built.
|
||||
virtual void CacheBuilt() {};
|
||||
|
||||
/* Various helper classes to interface with specific bits of this
|
||||
environment */
|
||||
|
@ -241,6 +241,49 @@ signed short pkgPolicy::GetPriority(pkgCache::PkgIterator const &Pkg)
|
||||
return 0;
|
||||
}
|
||||
/*}}}*/
|
||||
// CNC:2003-03-06
|
||||
// Policy::GetPkgPriority - Return a package priority /*{{{*/
|
||||
// ---------------------------------------------------------------------
|
||||
/* Evaluate the package pins and the default list to deteremine what the
|
||||
best package is. This is a hacked version of GetCandidateVer(). */
|
||||
signed short pkgPolicy::GetPkgPriority(const pkgCache::PkgIterator &Pkg)
|
||||
{
|
||||
// Look for a package pin and evaluate it.
|
||||
signed Max = GetPriority(Pkg);
|
||||
|
||||
/* Falling through to the default version.. Setting Max to zero
|
||||
effectively excludes everything <= 0 which are the non-automatic
|
||||
priorities.. The status file is given a prio of 100 which will exclude
|
||||
not-automatic sources, except in a single shot not-installed mode.
|
||||
The second pseduo-status file is at prio 1000, above which will permit
|
||||
the user to force-downgrade things.
|
||||
|
||||
The user pin is subject to the same priority rules as default
|
||||
selections. Thus there are two ways to create a pin - a pin that
|
||||
tracks the default when the default is taken away, and a permanent
|
||||
pin that stays at that setting.
|
||||
*/
|
||||
for (pkgCache::VerIterator Ver = Pkg.VersionList(); Ver.end() == false; Ver++)
|
||||
{
|
||||
for (pkgCache::VerFileIterator VF = Ver.FileList(); VF.end() == false; VF++)
|
||||
{
|
||||
/* If this is the status file, and the current version is not the
|
||||
version in the status file (ie it is not installed, or somesuch)
|
||||
then it is not a candidate for installation, ever. This weeds
|
||||
out bogus entries that may be due to config-file states, or
|
||||
other. */
|
||||
if ((VF.File()->Flags & pkgCache::Flag::NotSource) == pkgCache::Flag::NotSource &&
|
||||
Pkg.CurrentVer() != Ver)
|
||||
continue;
|
||||
|
||||
signed Prio = PFPriority[VF.File()->ID];
|
||||
if (Prio > Max)
|
||||
Max = Prio;
|
||||
}
|
||||
}
|
||||
return Max;
|
||||
}
|
||||
/*}}}*/
|
||||
|
||||
// ReadPinFile - Load the pin file into a Policy /*{{{*/
|
||||
// ---------------------------------------------------------------------
|
||||
|
@ -77,8 +77,15 @@ class pkgPolicy : public pkgDepCache::Policy
|
||||
signed short GetPriority(pkgCache::PkgIterator const &Pkg);
|
||||
pkgCache::VerIterator GetMatch(pkgCache::PkgIterator Pkg);
|
||||
|
||||
// CNC:2003-03-06
|
||||
virtual signed short GetPkgPriority(const pkgCache::PkgIterator &Pkg);
|
||||
|
||||
// Things for the cache interface.
|
||||
virtual pkgCache::VerIterator GetCandidateVer(pkgCache::PkgIterator Pkg);
|
||||
// CNC:2002-03-17 - Every place that uses this function seems to
|
||||
// currently check for IsCritical() as well. Since
|
||||
// this is a virtual (heavy) function, we'll try
|
||||
// not to use it while not necessary.
|
||||
virtual bool IsImportantDep(pkgCache::DepIterator Dep) {return pkgDepCache::Policy::IsImportantDep(Dep);};
|
||||
bool InitDefaults();
|
||||
|
||||
|
@ -12,12 +12,17 @@
|
||||
#ifdef HAVE_RPM
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <utime.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <apt-pkg/error.h>
|
||||
#include <apt-pkg/configuration.h>
|
||||
#include <apt-pkg/md5.h>
|
||||
|
||||
#include <apt-pkg/rpmhandler.h>
|
||||
#include <apt-pkg/rpmpackagedata.h>
|
||||
|
||||
#include <apti18n.h>
|
||||
|
||||
@ -31,6 +36,7 @@
|
||||
|
||||
RPMFileHandler::RPMFileHandler(string File)
|
||||
{
|
||||
ID = File;
|
||||
FD = Fopen(File.c_str(), "r");
|
||||
if (FD == NULL)
|
||||
{
|
||||
@ -94,11 +100,201 @@ void RPMFileHandler::Rewind()
|
||||
_error->Error(_("could not rewind RPMFileHandler"));
|
||||
}
|
||||
|
||||
string RPMFileHandler::FileName()
|
||||
{
|
||||
char *str;
|
||||
int_32 count, type;
|
||||
assert(HeaderP != NULL);
|
||||
int rc = headerGetEntry(HeaderP, CRPMTAG_FILENAME,
|
||||
&type, (void**)&str, &count);
|
||||
assert(rc != 0);
|
||||
return str;
|
||||
}
|
||||
|
||||
string RPMFileHandler::Directory()
|
||||
{
|
||||
char *str;
|
||||
int_32 count, type;
|
||||
assert(HeaderP != NULL);
|
||||
int rc = headerGetEntry(HeaderP, CRPMTAG_DIRECTORY,
|
||||
&type, (void**)&str, &count);
|
||||
return (rc?str:"");
|
||||
}
|
||||
|
||||
unsigned long RPMFileHandler::FileSize()
|
||||
{
|
||||
int_32 count, type;
|
||||
int_32 *num;
|
||||
int rc = headerGetEntry(HeaderP, CRPMTAG_FILESIZE,
|
||||
&type, (void**)&num, &count);
|
||||
assert(rc != 0);
|
||||
return (unsigned long)num[0];
|
||||
}
|
||||
|
||||
string RPMFileHandler::MD5Sum()
|
||||
{
|
||||
char *str;
|
||||
int_32 count, type;
|
||||
assert(HeaderP != NULL);
|
||||
int rc = headerGetEntry(HeaderP, CRPMTAG_MD5,
|
||||
&type, (void**)&str, &count);
|
||||
assert(rc != 0);
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
RPMDirHandler::RPMDirHandler(string DirName)
|
||||
: sDirName(DirName)
|
||||
{
|
||||
ID = DirName;
|
||||
Dir = opendir(sDirName.c_str());
|
||||
if (Dir == NULL)
|
||||
return;
|
||||
iSize = 0;
|
||||
while (nextFileName() != NULL)
|
||||
iSize += 1;
|
||||
rewinddir(Dir);
|
||||
#ifdef HAVE_RPM41
|
||||
TS = rpmtsCreate();
|
||||
#endif
|
||||
}
|
||||
|
||||
const char *RPMDirHandler::nextFileName()
|
||||
{
|
||||
for (struct dirent *Ent = readdir(Dir); Ent != 0; Ent = readdir(Dir))
|
||||
{
|
||||
const char *name = Ent->d_name;
|
||||
|
||||
if (name[0] == '.')
|
||||
continue;
|
||||
|
||||
if (flExtension(name) != "rpm")
|
||||
continue;
|
||||
|
||||
// Make sure it is a file and not something else
|
||||
sFilePath = flCombine(sDirName,name);
|
||||
struct stat St;
|
||||
if (stat(sFilePath.c_str(),&St) != 0 || S_ISREG(St.st_mode) == 0)
|
||||
continue;
|
||||
|
||||
sFileName = name;
|
||||
|
||||
return name;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
RPMDirHandler::~RPMDirHandler()
|
||||
{
|
||||
if (HeaderP != NULL)
|
||||
headerFree(HeaderP);
|
||||
#ifdef HAVE_RPM41
|
||||
rpmtsFree(TS);
|
||||
#endif
|
||||
if (Dir != NULL)
|
||||
closedir(Dir);
|
||||
}
|
||||
|
||||
bool RPMDirHandler::Skip()
|
||||
{
|
||||
if (Dir == NULL)
|
||||
return false;
|
||||
if (HeaderP != NULL) {
|
||||
headerFree(HeaderP);
|
||||
HeaderP = NULL;
|
||||
}
|
||||
const char *fname = nextFileName();
|
||||
bool Res = false;
|
||||
for (; fname != NULL; fname = nextFileName()) {
|
||||
iOffset++;
|
||||
if (fname == NULL)
|
||||
break;
|
||||
FD_t FD = Fopen(sFilePath.c_str(), "r");
|
||||
if (FD == NULL)
|
||||
continue;
|
||||
#ifdef HAVE_RPM41
|
||||
int rc = rpmReadPackageFile(TS, FD, fname, &HeaderP);
|
||||
Fclose(FD);
|
||||
if (rc != RPMRC_OK
|
||||
&& rc != RPMRC_NOTTRUSTED
|
||||
&& rc != RPMRC_NOKEY)
|
||||
continue;
|
||||
#else
|
||||
int isSource;
|
||||
int rc = rpmReadPackageHeader(FD, &HeaderP, &isSource, NULL, NULL);
|
||||
Fclose(FD);
|
||||
if (rc != 0)
|
||||
continue;
|
||||
#endif
|
||||
Res = true;
|
||||
break;
|
||||
}
|
||||
return Res;
|
||||
}
|
||||
|
||||
bool RPMDirHandler::Jump(unsigned Offset)
|
||||
{
|
||||
if (Dir == NULL)
|
||||
return false;
|
||||
rewinddir(Dir);
|
||||
iOffset = 0;
|
||||
while (1) {
|
||||
if (iOffset+1 == Offset)
|
||||
return Skip();
|
||||
if (nextFileName() == NULL)
|
||||
break;
|
||||
iOffset++;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void RPMDirHandler::Rewind()
|
||||
{
|
||||
rewinddir(Dir);
|
||||
iOffset = 0;
|
||||
}
|
||||
|
||||
unsigned long RPMDirHandler::FileSize()
|
||||
{
|
||||
if (Dir == NULL)
|
||||
return 0;
|
||||
struct stat St;
|
||||
if (stat(sFilePath.c_str(),&St) != 0) {
|
||||
_error->Errno("stat","Unable to determine the file size");
|
||||
return 0;
|
||||
}
|
||||
return St.st_size;
|
||||
}
|
||||
|
||||
string RPMDirHandler::MD5Sum()
|
||||
{
|
||||
if (Dir == NULL)
|
||||
return "";
|
||||
MD5Summation MD5;
|
||||
FileFd File(sFilePath, FileFd::ReadOnly);
|
||||
MD5.AddFD(File.Fd(), File.Size());
|
||||
File.Close();
|
||||
return MD5.Result().Value();
|
||||
}
|
||||
|
||||
|
||||
RPMDBHandler::RPMDBHandler(bool WriteLock)
|
||||
: WriteLock(WriteLock)
|
||||
{
|
||||
string Dir = _config->Find("RPM::RootDir");
|
||||
rpmReadConfigFiles(NULL, NULL);
|
||||
ID = DataPath(false);
|
||||
|
||||
RPMPackageData::Singleton()->InitMinArchScore();
|
||||
|
||||
// Everytime we open a database for writing, it has its
|
||||
// mtime changed, and kills our cache validity. As we never
|
||||
// change any information in the database directly, we will
|
||||
// restore the mtime and save our cache.
|
||||
struct stat St;
|
||||
stat(DataPath(false).c_str(), &St);
|
||||
DbFileMtime = St.st_mtime;
|
||||
|
||||
#ifdef HAVE_RPM4
|
||||
RpmIter = NULL;
|
||||
#endif
|
||||
@ -127,12 +323,28 @@ RPMDBHandler::RPMDBHandler(bool WriteLock)
|
||||
_error->Error(_("could not create RPM database iterator"));
|
||||
return;
|
||||
}
|
||||
iSize = rpmdbGetIteratorCount(RpmIter);
|
||||
// iSize = rpmdbGetIteratorCount(RpmIter);
|
||||
// This doesn't seem to work right now. Code in rpm (4.0.4, at least)
|
||||
// returns a 0 from rpmdbGetIteratorCount() if rpmxxInitIterator() is
|
||||
// called with RPMDBI_PACKAGES or with keyp == NULL. The algorithm
|
||||
// below will be used until there's support for it.
|
||||
iSize = 0;
|
||||
rpmdbMatchIterator countIt;
|
||||
countIt = rpmxxInitIterator(Handler, RPMDBI_PACKAGES, NULL, 0);
|
||||
while(rpmdbNextIterator(countIt) != NULL)
|
||||
iSize++;
|
||||
rpmdbFreeIterator(countIt);
|
||||
#else
|
||||
struct stat st;
|
||||
stat(DataPath(false).c_str(), &st);
|
||||
iSize = st.st_size;
|
||||
iSize = St.st_size;
|
||||
#endif
|
||||
|
||||
// Restore just after opening the database, and just after closing.
|
||||
if (WriteLock) {
|
||||
struct utimbuf Ut;
|
||||
Ut.actime = DbFileMtime;
|
||||
Ut.modtime = DbFileMtime;
|
||||
utime(DataPath(false).c_str(), &Ut);
|
||||
}
|
||||
}
|
||||
|
||||
RPMDBHandler::~RPMDBHandler()
|
||||
@ -152,6 +364,14 @@ RPMDBHandler::~RPMDBHandler()
|
||||
#else
|
||||
rpmdbClose(Handler);
|
||||
#endif
|
||||
|
||||
// Restore just after opening the database, and just after closing.
|
||||
if (WriteLock) {
|
||||
struct utimbuf Ut;
|
||||
Ut.actime = DbFileMtime;
|
||||
Ut.modtime = DbFileMtime;
|
||||
utime(DataPath(false).c_str(), &Ut);
|
||||
}
|
||||
}
|
||||
|
||||
string RPMDBHandler::DataPath(bool DirectoryOnly)
|
||||
|
@ -24,17 +24,28 @@ class RPMHandler
|
||||
unsigned int iOffset;
|
||||
unsigned int iSize;
|
||||
Header HeaderP;
|
||||
string ID;
|
||||
|
||||
public:
|
||||
|
||||
// Return a unique ID for that handler. Actually, implemented used
|
||||
// the file/dir name.
|
||||
virtual string GetID() { return ID; };
|
||||
|
||||
virtual bool Skip() = 0;
|
||||
virtual bool Jump(unsigned int Offset) = 0;
|
||||
virtual void Rewind() = 0;
|
||||
inline unsigned Offset() {return iOffset;};
|
||||
virtual bool OrderedOffset() {return true;};
|
||||
inline unsigned Size() {return iSize;};
|
||||
inline Header GetHeader() {return HeaderP;};
|
||||
virtual bool IsDatabase() = 0;
|
||||
|
||||
virtual string FileName() {return "";};
|
||||
virtual string Directory() {return "";};
|
||||
virtual unsigned long FileSize() {return 1;};
|
||||
virtual string MD5Sum() {return "";};
|
||||
|
||||
RPMHandler() : iOffset(0), iSize(0), HeaderP(0) {};
|
||||
virtual ~RPMHandler() {};
|
||||
};
|
||||
@ -51,6 +62,11 @@ class RPMFileHandler : public RPMHandler
|
||||
virtual void Rewind();
|
||||
virtual inline bool IsDatabase() {return false;};
|
||||
|
||||
virtual string FileName();
|
||||
virtual string Directory();
|
||||
virtual unsigned long FileSize();
|
||||
virtual string MD5Sum();
|
||||
|
||||
RPMFileHandler(FileFd *File);
|
||||
RPMFileHandler(string File);
|
||||
virtual ~RPMFileHandler();
|
||||
@ -69,6 +85,8 @@ class RPMDBHandler : public RPMHandler
|
||||
#endif
|
||||
bool WriteLock;
|
||||
|
||||
time_t DbFileMtime;
|
||||
|
||||
public:
|
||||
|
||||
static string DataPath(bool DirectoryOnly=true);
|
||||
@ -77,13 +95,45 @@ class RPMDBHandler : public RPMHandler
|
||||
virtual void Rewind();
|
||||
virtual inline bool IsDatabase() {return true;};
|
||||
virtual bool HasWriteLock() {return WriteLock;};
|
||||
virtual time_t Mtime() {return DbFileMtime;}
|
||||
virtual bool OrderedOffset() {return false;};
|
||||
|
||||
RPMDBHandler(bool WriteLock=false);
|
||||
virtual ~RPMDBHandler();
|
||||
};
|
||||
|
||||
class RPMDirHandler : public RPMHandler
|
||||
{
|
||||
|
||||
// Our Extra RPM tags
|
||||
DIR *Dir;
|
||||
string sDirName;
|
||||
string sFileName;
|
||||
string sFilePath;
|
||||
|
||||
#ifdef HAVE_RPM41
|
||||
rpmts TS;
|
||||
#endif
|
||||
|
||||
const char *nextFileName();
|
||||
|
||||
public:
|
||||
|
||||
virtual bool Skip();
|
||||
virtual bool Jump(unsigned int Offset);
|
||||
virtual void Rewind();
|
||||
virtual inline bool IsDatabase() {return false;};
|
||||
|
||||
virtual string FileName() {return (Dir == NULL)?"":sFileName;};
|
||||
virtual unsigned long FileSize();
|
||||
virtual string MD5Sum();
|
||||
|
||||
RPMDirHandler(string DirName);
|
||||
virtual ~RPMDirHandler();
|
||||
};
|
||||
|
||||
|
||||
// Our Extra RPM tags. These should not be accessed directly. Use
|
||||
// the methods in RPMHandler instead.
|
||||
#define CRPMTAG_FILENAME 1000000
|
||||
#define CRPMTAG_FILESIZE 1000001
|
||||
#define CRPMTAG_MD5 1000005
|
||||
|
@ -106,13 +106,96 @@ bool rpmListIndex::GetReleases(pkgAcquire *Owner) const
|
||||
return true;
|
||||
}
|
||||
/*}}}*/
|
||||
// SrcListIndex::CreateHandler - Create a RPMHandler for this file /*{{{*/
|
||||
// rpmListIndex::Info - One liner describing the index URI /*{{{*/
|
||||
// ---------------------------------------------------------------------
|
||||
RPMHandler *rpmSrcListIndex::CreateHandler() const
|
||||
/* */
|
||||
string rpmListIndex::Info(string Type) const
|
||||
{
|
||||
return new RPMFileHandler(IndexFile("srclist"));
|
||||
string Info = ::URI::SiteOnly(URI) + ' ';
|
||||
if (Dist[Dist.size() - 1] == '/')
|
||||
{
|
||||
if (Dist != "/")
|
||||
Info += Dist;
|
||||
}
|
||||
else
|
||||
Info += Dist + '/' + Section;
|
||||
Info += " ";
|
||||
Info += Type;
|
||||
return Info;
|
||||
}
|
||||
/*}}}*/
|
||||
// rpmListIndex::Index* - Return the URI to the index files /*{{{*/
|
||||
// ---------------------------------------------------------------------
|
||||
/* */
|
||||
inline string rpmListIndex::IndexFile(string Type) const
|
||||
{
|
||||
return _config->FindDir("Dir::State::lists")+URItoFileName(IndexURI(Type));
|
||||
}
|
||||
|
||||
|
||||
string rpmListIndex::IndexURI(string Type) const
|
||||
{
|
||||
RPMPackageData *rpmdata = RPMPackageData::Singleton();
|
||||
string Res;
|
||||
if (Dist[Dist.size() - 1] == '/')
|
||||
{
|
||||
if (Dist != "/")
|
||||
Res = URI + Dist;
|
||||
else
|
||||
Res = URI;
|
||||
}
|
||||
else
|
||||
Res = URI + Dist + "/base/";
|
||||
|
||||
Res += Type + '.' + Section;
|
||||
|
||||
if (rpmdata->HasIndexTranslation() == true)
|
||||
{
|
||||
map<string,string> Dict;
|
||||
Dict["uri"] = URI;
|
||||
Dict["dist"] = Dist;
|
||||
Dict["sect"] = Section;
|
||||
Dict["type"] = Type;
|
||||
rpmdata->TranslateIndex(Res, Dict);
|
||||
}
|
||||
|
||||
return Res;
|
||||
}
|
||||
/*}}}*/
|
||||
// rpmListIndex::Exists - Check if the index is available /*{{{*/
|
||||
// ---------------------------------------------------------------------
|
||||
/* */
|
||||
bool rpmListIndex::Exists() const
|
||||
{
|
||||
return FileExists(IndexPath());
|
||||
}
|
||||
/*}}}*/
|
||||
// SrcListIndex::Size - Return the size of the index /*{{{*/
|
||||
// ---------------------------------------------------------------------
|
||||
/* */
|
||||
unsigned long rpmListIndex::Size() const
|
||||
{
|
||||
struct stat S;
|
||||
if (stat(IndexPath().c_str(),&S) != 0)
|
||||
return 0;
|
||||
return S.st_size;
|
||||
}
|
||||
/*}}}*/
|
||||
// rpmListIndex::Describe - Give a descriptive path to the index /*{{{*/
|
||||
// ---------------------------------------------------------------------
|
||||
/* */
|
||||
string rpmListIndex::Describe(bool Short) const
|
||||
{
|
||||
char S[300];
|
||||
if (Short == true)
|
||||
snprintf(S,sizeof(S),"%s",Info(MainType()).c_str());
|
||||
else
|
||||
snprintf(S,sizeof(S),"%s (%s)",Info(MainType()).c_str(),
|
||||
IndexFile(MainType()).c_str());
|
||||
return S;
|
||||
}
|
||||
/*}}}*/
|
||||
|
||||
// SrcListIndex::SourceInfo - Short 1 liner describing a source /*{{{*/
|
||||
// ---------------------------------------------------------------------
|
||||
string rpmSrcListIndex::SourceInfo(pkgSrcRecords::Parser const &Record,
|
||||
@ -137,7 +220,6 @@ string rpmSrcListIndex::SourceInfo(pkgSrcRecords::Parser const &Record,
|
||||
return Res;
|
||||
}
|
||||
/*}}}*/
|
||||
|
||||
// SrcListIndex::ArchiveURI - URI for the archive /*{{{*/
|
||||
// ---------------------------------------------------------------------
|
||||
string rpmSrcListIndex::ArchiveURI(string File) const
|
||||
@ -155,9 +237,6 @@ string rpmSrcListIndex::ArchiveURI(string File) const
|
||||
else
|
||||
Res = URI + Dist;
|
||||
|
||||
/* This should be fixed to include only the filename in
|
||||
* the parameter. Right now it includes the SRPMS.<sect> directory
|
||||
* information as well. It was written that way to make --flat work. */
|
||||
Res += "/" + File;
|
||||
|
||||
if (rpmdata->HasSourceTranslation() == true)
|
||||
@ -183,79 +262,7 @@ string rpmSrcListIndex::ArchiveURI(string File) const
|
||||
/* */
|
||||
pkgSrcRecords::Parser *rpmSrcListIndex::CreateSrcParser() const
|
||||
{
|
||||
string SourcesURI;
|
||||
SourcesURI = IndexFile("srclist");
|
||||
return new rpmSrcRecordParser(_config->FindDir("Dir::State::lists") +
|
||||
SourcesURI, this);
|
||||
}
|
||||
/*}}}*/
|
||||
// SrcListIndex::Describe - Give a descriptive path to the index /*{{{*/
|
||||
// ---------------------------------------------------------------------
|
||||
/* */
|
||||
string rpmSrcListIndex::Describe(bool Short) const
|
||||
{
|
||||
char S[300];
|
||||
if (Short == true)
|
||||
snprintf(S,sizeof(S),"%s",Info("pkglist").c_str());
|
||||
else
|
||||
snprintf(S,sizeof(S),"%s (%s)",Info("pkglist").c_str(),
|
||||
IndexFile("srclist").c_str());
|
||||
return S;
|
||||
}
|
||||
/*}}}*/
|
||||
// SrcListIndex::Info - One liner describing the index URI /*{{{*/
|
||||
// ---------------------------------------------------------------------
|
||||
/* */
|
||||
string rpmSrcListIndex::Info(string Type) const
|
||||
{
|
||||
string Info = ::URI::SiteOnly(URI) + ' ';
|
||||
if (Dist[Dist.size() - 1] == '/')
|
||||
{
|
||||
if (Dist != "/")
|
||||
Info += Dist;
|
||||
}
|
||||
else
|
||||
Info += Dist + '/' + Section;
|
||||
Info += " ";
|
||||
Info += Type;
|
||||
return Info;
|
||||
}
|
||||
/*}}}*/
|
||||
// SrcListIndex::Index* - Return the URI to the index files /*{{{*/
|
||||
// ---------------------------------------------------------------------
|
||||
/* */
|
||||
inline string rpmSrcListIndex::IndexFile(string Type) const
|
||||
{
|
||||
return URItoFileName(IndexURI(Type));
|
||||
}
|
||||
|
||||
string rpmSrcListIndex::IndexURI(string Type) const
|
||||
{
|
||||
RPMPackageData *rpmdata = RPMPackageData::Singleton();
|
||||
string Res;
|
||||
if (Dist[Dist.size() - 1] == '/')
|
||||
{
|
||||
if (Dist != "/")
|
||||
Res = URI + Dist;
|
||||
else
|
||||
Res = URI;
|
||||
}
|
||||
else
|
||||
Res = URI + Dist + "/base/";
|
||||
|
||||
Res += Type+'.'+Section;
|
||||
|
||||
if (rpmdata->HasIndexTranslation() == true)
|
||||
{
|
||||
map<string,string> Dict;
|
||||
Dict["uri"] = URI;
|
||||
Dict["dist"] = Dist;
|
||||
Dict["sect"] = Section;
|
||||
Dict["type"] = Type;
|
||||
rpmdata->TranslateIndex(Res, Dict);
|
||||
}
|
||||
|
||||
return Res;
|
||||
return new rpmSrcRecordParser(IndexPath(), this);
|
||||
}
|
||||
/*}}}*/
|
||||
// SrcListIndex::GetIndexes - Fetch the index files /*{{{*/
|
||||
@ -272,33 +279,7 @@ bool rpmSrcListIndex::GetIndexes(pkgAcquire *Owner) const
|
||||
return true;
|
||||
}
|
||||
/*}}}*/
|
||||
// SrcListIndex::Exists - Check if the index is available /*{{{*/
|
||||
// ---------------------------------------------------------------------
|
||||
/* */
|
||||
bool rpmSrcListIndex::Exists() const
|
||||
{
|
||||
return FileExists(IndexFile("srclist"));
|
||||
}
|
||||
/*}}}*/
|
||||
// SrcListIndex::Size - Return the size of the index /*{{{*/
|
||||
// ---------------------------------------------------------------------
|
||||
/* */
|
||||
unsigned long rpmSrcListIndex::Size() const
|
||||
{
|
||||
struct stat S;
|
||||
if (stat(IndexFile("srclist").c_str(),&S) != 0)
|
||||
return 0;
|
||||
return S.st_size;
|
||||
}
|
||||
/*}}}*/
|
||||
|
||||
// PkgListIndex::CreateHandler - Create a RPMHandler for this file /*{{{*/
|
||||
// ---------------------------------------------------------------------
|
||||
RPMHandler *rpmPkgListIndex::CreateHandler() const
|
||||
{
|
||||
return new RPMFileHandler(IndexFile("pkglist"));
|
||||
}
|
||||
/*}}}*/
|
||||
// PkgListIndex::ArchiveInfo - Short version of the archive url /*{{{*/
|
||||
// ---------------------------------------------------------------------
|
||||
/* This is a shorter version that is designed to be < 60 chars or so */
|
||||
@ -336,7 +317,10 @@ string rpmPkgListIndex::ArchiveURI(string File) const
|
||||
else
|
||||
Res = URI + Dist;
|
||||
|
||||
Res += "/RPMS."+Section + '/' + File;
|
||||
if (File.find("/") != string::npos)
|
||||
Res += '/' + File;
|
||||
else
|
||||
Res += "/RPMS."+Section + '/' + File;
|
||||
|
||||
if (rpmdata->HasBinaryTranslation() == true)
|
||||
{
|
||||
@ -348,77 +332,6 @@ string rpmPkgListIndex::ArchiveURI(string File) const
|
||||
rpmdata->TranslateBinary(Res, Dict);
|
||||
}
|
||||
|
||||
return Res;
|
||||
}
|
||||
/*}}}*/
|
||||
// PkgListIndex::Describe - Give a descriptive path to the index /*{{{*/
|
||||
// ---------------------------------------------------------------------
|
||||
/* This should help the user find the index in the sources.list and
|
||||
in the filesystem for problem solving */
|
||||
string rpmPkgListIndex::Describe(bool Short) const
|
||||
{
|
||||
char S[300];
|
||||
if (Short == true)
|
||||
snprintf(S,sizeof(S),"%s",Info("pkglist").c_str());
|
||||
else
|
||||
snprintf(S,sizeof(S),"%s (%s)",Info("pkglist").c_str(),
|
||||
IndexFile("pkglist").c_str());
|
||||
return S;
|
||||
}
|
||||
/*}}}*/
|
||||
// PkgListIndex::Info - One liner describing the index URI /*{{{*/
|
||||
// ---------------------------------------------------------------------
|
||||
/* */
|
||||
string rpmPkgListIndex::Info(string Type) const
|
||||
{
|
||||
string Info = ::URI::SiteOnly(URI) + ' ';
|
||||
if (Dist[Dist.size() - 1] == '/')
|
||||
{
|
||||
if (Dist != "/")
|
||||
Info += Dist;
|
||||
}
|
||||
else
|
||||
Info += Dist + '/' + Section;
|
||||
Info += " ";
|
||||
Info += Type;
|
||||
return Info;
|
||||
}
|
||||
/*}}}*/
|
||||
// PkgListIndex::Index* - Return the URI to the index files /*{{{*/
|
||||
// ---------------------------------------------------------------------
|
||||
/* */
|
||||
inline string rpmPkgListIndex::IndexFile(string Type) const
|
||||
{
|
||||
return _config->FindDir("Dir::State::lists")+URItoFileName(IndexURI(Type));
|
||||
}
|
||||
|
||||
|
||||
string rpmPkgListIndex::IndexURI(string Type) const
|
||||
{
|
||||
RPMPackageData *rpmdata = RPMPackageData::Singleton();
|
||||
string Res;
|
||||
if (Dist[Dist.size() - 1] == '/')
|
||||
{
|
||||
if (Dist != "/")
|
||||
Res = URI + Dist;
|
||||
else
|
||||
Res = URI;
|
||||
}
|
||||
else
|
||||
Res = URI + Dist + "/base/";
|
||||
|
||||
Res += Type + '.' + Section;
|
||||
|
||||
if (rpmdata->HasIndexTranslation() == true)
|
||||
{
|
||||
map<string,string> Dict;
|
||||
Dict["uri"] = URI;
|
||||
Dict["dist"] = Dist;
|
||||
Dict["sect"] = Section;
|
||||
Dict["type"] = Type;
|
||||
rpmdata->TranslateIndex(Res, Dict);
|
||||
}
|
||||
|
||||
return Res;
|
||||
}
|
||||
/*}}}*/
|
||||
@ -438,34 +351,15 @@ bool rpmPkgListIndex::GetIndexes(pkgAcquire *Owner) const
|
||||
return true;
|
||||
}
|
||||
/*}}}*/
|
||||
// PkgListIndex::Exists - Check if the index is available /*{{{*/
|
||||
// ---------------------------------------------------------------------
|
||||
/* */
|
||||
bool rpmPkgListIndex::Exists() const
|
||||
{
|
||||
return FileExists(IndexFile("pkglist"));
|
||||
}
|
||||
/*}}}*/
|
||||
// PkgListIndex::Size - Return the size of the index /*{{{*/
|
||||
// ---------------------------------------------------------------------
|
||||
/* This is really only used for progress reporting. */
|
||||
unsigned long rpmPkgListIndex::Size() const
|
||||
{
|
||||
struct stat S;
|
||||
if (stat(IndexFile("pkglist").c_str(),&S) != 0)
|
||||
return 0;
|
||||
return S.st_size;
|
||||
}
|
||||
/*}}}*/
|
||||
// PkgListIndex::Merge - Load the index file into a cache /*{{{*/
|
||||
// ---------------------------------------------------------------------
|
||||
/* */
|
||||
bool rpmPkgListIndex::Merge(pkgCacheGenerator &Gen,OpProgress &Prog) const
|
||||
{
|
||||
string PackageFile = IndexFile("pkglist");
|
||||
string PackageFile = IndexPath();
|
||||
RPMHandler *Handler = CreateHandler();
|
||||
|
||||
Prog.SubProgress(0,Info("pkglist"));
|
||||
Prog.SubProgress(0,Info(MainType()));
|
||||
::URI Tmp(URI);
|
||||
if (Gen.SelectFile(PackageFile,Tmp.Host,*this) == false)
|
||||
{
|
||||
@ -519,15 +413,15 @@ bool rpmPkgListIndex::Merge(pkgCacheGenerator &Gen,OpProgress &Prog) const
|
||||
bool rpmPkgListIndex::MergeFileProvides(pkgCacheGenerator &Gen,
|
||||
OpProgress &Prog) const
|
||||
{
|
||||
string PackageFile = IndexFile("pkglist");
|
||||
string PackageFile = IndexPath();
|
||||
RPMHandler *Handler = CreateHandler();
|
||||
rpmListParser Parser(Handler);
|
||||
if (_error->PendingError() == true)
|
||||
{
|
||||
if (_error->PendingError() == true) {
|
||||
delete Handler;
|
||||
return _error->Error(_("Problem opening %s"),PackageFile.c_str());
|
||||
}
|
||||
Prog.SubProgress(0,Info("pkglist"));
|
||||
// We call SubProgress with Size(), since we won't call SelectFile() here.
|
||||
Prog.SubProgress(Size(),Info("pkglist"));
|
||||
if (Gen.MergeFileProvides(Parser) == false)
|
||||
return _error->Error(_("Problem with MergeFileProvides %s"),
|
||||
PackageFile.c_str());
|
||||
@ -540,7 +434,7 @@ bool rpmPkgListIndex::MergeFileProvides(pkgCacheGenerator &Gen,
|
||||
/* */
|
||||
pkgCache::PkgFileIterator rpmPkgListIndex::FindInCache(pkgCache &Cache) const
|
||||
{
|
||||
string FileName = IndexFile("pkglist");
|
||||
string FileName = IndexPath();
|
||||
pkgCache::PkgFileIterator File = Cache.FileBegin();
|
||||
for (; File.end() == false; File++)
|
||||
{
|
||||
@ -550,6 +444,7 @@ pkgCache::PkgFileIterator rpmPkgListIndex::FindInCache(pkgCache &Cache) const
|
||||
struct stat St;
|
||||
if (stat(File.FileName(),&St) != 0)
|
||||
return pkgCache::PkgFileIterator(Cache);
|
||||
|
||||
if ((unsigned)St.st_size != File->Size || St.st_mtime != File->mtime)
|
||||
return pkgCache::PkgFileIterator(Cache);
|
||||
return File;
|
||||
@ -559,7 +454,28 @@ pkgCache::PkgFileIterator rpmPkgListIndex::FindInCache(pkgCache &Cache) const
|
||||
}
|
||||
/*}}}*/
|
||||
|
||||
// DatabaseIndex::rpmDatabaseIndex - Constructor /*{{{*/
|
||||
// PkgDirIndex::Index* - Return the URI to the index files /*{{{*/
|
||||
// ---------------------------------------------------------------------
|
||||
/* */
|
||||
inline string rpmPkgDirIndex::IndexPath() const
|
||||
{
|
||||
return ::URI(ArchiveURI("")).Path;
|
||||
}
|
||||
/*}}}*/
|
||||
// PkgDirIndex::Size - Return the size of the index /*{{{*/
|
||||
// ---------------------------------------------------------------------
|
||||
/* This is really only used for progress reporting. */
|
||||
unsigned long rpmPkgDirIndex::Size() const
|
||||
{
|
||||
// XXX: Must optimize this somehow.
|
||||
RPMHandler *Handler = CreateHandler();
|
||||
unsigned long Res = Handler->Size();
|
||||
delete Handler;
|
||||
return Res;
|
||||
}
|
||||
/*}}}*/
|
||||
|
||||
// DatabaseIndex::rpmDatabaseIndex - Constructor /*{{{*/
|
||||
// ---------------------------------------------------------------------
|
||||
/* */
|
||||
rpmDatabaseIndex::rpmDatabaseIndex()
|
||||
@ -601,7 +517,7 @@ bool rpmDatabaseIndex::Merge(pkgCacheGenerator &Gen,OpProgress &Prog) const
|
||||
if (stat(Handler->DataPath(false).c_str(),&St) != 0)
|
||||
return _error->Errno("fstat","Failed to stat");
|
||||
CFile->Size = St.st_size;
|
||||
CFile->mtime = St.st_mtime;
|
||||
CFile->mtime = Handler->Mtime();
|
||||
|
||||
if (Gen.MergeList(Parser) == false)
|
||||
return _error->Error(_("Problem with MergeList %s"),
|
||||
@ -619,7 +535,8 @@ bool rpmDatabaseIndex::MergeFileProvides(pkgCacheGenerator &Gen,
|
||||
rpmListParser Parser(Handler);
|
||||
if (_error->PendingError() == true)
|
||||
return _error->Error(_("Problem opening RPM database"));
|
||||
Prog.SubProgress(0,"RPM Database");
|
||||
// We call SubProgress with Size(), since we won't call SelectFile() here.
|
||||
Prog.SubProgress(Size(),"RPM Database");
|
||||
if (Gen.MergeFileProvides(Parser) == false)
|
||||
return _error->Error(_("Problem with MergeFileProvides %s"),
|
||||
Handler->DataPath(false).c_str());
|
||||
@ -742,8 +659,29 @@ class rpmSLTypeSrpm : public rpmSLTypeGen
|
||||
}
|
||||
};
|
||||
|
||||
class rpmSLTypeRpmDir : public rpmSLTypeGen
|
||||
{
|
||||
public:
|
||||
|
||||
bool CreateItem(vector<pkgIndexFile *> &List,
|
||||
string URI, string Dist, string Section,
|
||||
pkgSourceList::Vendor const *Vendor) const
|
||||
{
|
||||
pkgRepository *Rep = GetRepository(URI,Dist,Vendor);
|
||||
List.push_back(new rpmPkgDirIndex(URI,Dist,Section,Rep));
|
||||
return true;
|
||||
};
|
||||
|
||||
rpmSLTypeRpmDir()
|
||||
{
|
||||
Name = "rpm-dir";
|
||||
Label = "Local RPM directory tree";
|
||||
}
|
||||
};
|
||||
|
||||
rpmSLTypeRpm _apt_rpmType;
|
||||
rpmSLTypeSrpm _apt_rpmSrcType;
|
||||
rpmSLTypeRpmDir _apt_rpmDirType;
|
||||
/*}}}*/
|
||||
// Index File types for rpm /*{{{*/
|
||||
class rpmIFTypeSrc : public pkgIndexFile::Type
|
||||
@ -784,6 +722,10 @@ const pkgIndexFile::Type *rpmPkgListIndex::GetType() const
|
||||
{
|
||||
return &_apt_Pkg;
|
||||
}
|
||||
const pkgIndexFile::Type *rpmPkgDirIndex::GetType() const
|
||||
{
|
||||
return &_apt_Pkg;
|
||||
}
|
||||
const pkgIndexFile::Type *rpmDatabaseIndex::GetType() const
|
||||
{
|
||||
return &_apt_DB;
|
||||
|
@ -22,6 +22,7 @@
|
||||
#endif
|
||||
|
||||
#include <apt-pkg/indexfile.h>
|
||||
#include <apt-pkg/rpmhandler.h>
|
||||
|
||||
class RPMHandler;
|
||||
class RPMDBHandler;
|
||||
@ -33,6 +34,7 @@ class rpmIndexFile : public pkgIndexFile
|
||||
public:
|
||||
|
||||
virtual RPMHandler *CreateHandler() const = 0;
|
||||
virtual bool HasPackages() const {return false;};
|
||||
|
||||
};
|
||||
|
||||
@ -50,8 +52,8 @@ class rpmDatabaseIndex : public rpmIndexFile
|
||||
|
||||
// Interface for the Cache Generator
|
||||
virtual bool Exists() const {return true;};
|
||||
virtual bool HasPackages() const {return true;};
|
||||
virtual unsigned long Size() const;
|
||||
virtual bool HasPackages() const {return true;};
|
||||
virtual bool Merge(pkgCacheGenerator &Gen,OpProgress &Prog) const;
|
||||
virtual bool MergeFileProvides(pkgCacheGenerator &/*Gen*/,
|
||||
OpProgress &/*Prog*/) const;
|
||||
@ -60,7 +62,7 @@ class rpmDatabaseIndex : public rpmIndexFile
|
||||
rpmDatabaseIndex();
|
||||
};
|
||||
|
||||
class rpmListIndex : public pkgIndexFile
|
||||
class rpmListIndex : public rpmIndexFile
|
||||
{
|
||||
|
||||
protected:
|
||||
@ -74,9 +76,23 @@ class rpmListIndex : public pkgIndexFile
|
||||
string ReleaseURI(string Type) const;
|
||||
string ReleaseInfo(string Type) const;
|
||||
|
||||
string Info(string Type) const;
|
||||
string IndexFile(string Type) const;
|
||||
string IndexURI(string Type) const;
|
||||
|
||||
virtual string MainType() const = 0;
|
||||
virtual string IndexPath() const {return IndexFile(MainType());};
|
||||
|
||||
public:
|
||||
|
||||
bool GetReleases(pkgAcquire *Owner) const;
|
||||
virtual bool GetReleases(pkgAcquire *Owner) const;
|
||||
|
||||
// Interface for the Cache Generator
|
||||
virtual bool Exists() const;
|
||||
virtual unsigned long Size() const;
|
||||
|
||||
// Interface for acquire
|
||||
virtual string Describe(bool Short) const;
|
||||
|
||||
rpmListIndex(string URI,string Dist,string Section,
|
||||
pkgRepository *Repository) :
|
||||
@ -87,29 +103,27 @@ class rpmListIndex : public pkgIndexFile
|
||||
|
||||
class rpmPkgListIndex : public rpmListIndex
|
||||
{
|
||||
string Info(string Type) const;
|
||||
string IndexFile(string Type) const;
|
||||
string IndexURI(string Type) const;
|
||||
|
||||
protected:
|
||||
|
||||
virtual string MainType() const {return "pkglist";}
|
||||
|
||||
public:
|
||||
|
||||
virtual const Type *GetType() const;
|
||||
|
||||
// Creates a RPMHandler suitable for usage with this object
|
||||
virtual RPMHandler *CreateHandler() const;
|
||||
virtual RPMHandler *CreateHandler() const
|
||||
{ return new RPMFileHandler(IndexPath()); };
|
||||
|
||||
// Stuff for accessing files on remote items
|
||||
virtual string ArchiveInfo(pkgCache::VerIterator Ver) const;
|
||||
virtual string ArchiveURI(string File) const;
|
||||
|
||||
// Interface for acquire
|
||||
virtual string Describe(bool Short) const;
|
||||
virtual bool GetIndexes(pkgAcquire *Owner) const;
|
||||
|
||||
// Interface for the Cache Generator
|
||||
virtual bool Exists() const;
|
||||
virtual bool HasPackages() const {return true;};
|
||||
virtual unsigned long Size() const;
|
||||
virtual bool Merge(pkgCacheGenerator &Gen,OpProgress &Prog) const;
|
||||
virtual bool MergeFileProvides(pkgCacheGenerator &/*Gen*/,
|
||||
OpProgress &/*Prog*/) const;
|
||||
@ -124,16 +138,17 @@ class rpmPkgListIndex : public rpmListIndex
|
||||
|
||||
class rpmSrcListIndex : public rpmListIndex
|
||||
{
|
||||
string Info(string Type) const;
|
||||
string IndexFile(string Type) const;
|
||||
string IndexURI(string Type) const;
|
||||
|
||||
protected:
|
||||
|
||||
virtual string MainType() const {return "srclist";}
|
||||
|
||||
public:
|
||||
|
||||
virtual const Type *GetType() const;
|
||||
|
||||
// Creates a RPMHandler suitable for usage with this object
|
||||
virtual RPMHandler *CreateHandler() const;
|
||||
virtual RPMHandler *CreateHandler() const
|
||||
{ return new RPMFileHandler(IndexPath()); };
|
||||
|
||||
// Stuff for accessing files on remote items
|
||||
virtual string SourceInfo(pkgSrcRecords::Parser const &Record,
|
||||
@ -141,16 +156,11 @@ class rpmSrcListIndex : public rpmListIndex
|
||||
virtual string ArchiveURI(string File) const;
|
||||
|
||||
// Interface for acquire
|
||||
virtual string Describe(bool Short) const;
|
||||
virtual bool GetIndexes(pkgAcquire *Owner) const;
|
||||
|
||||
// Interface for the record parsers
|
||||
virtual pkgSrcRecords::Parser *CreateSrcParser() const;
|
||||
|
||||
// Interface for the Cache Generator
|
||||
virtual bool Exists() const;
|
||||
virtual bool HasPackages() const {return false;};
|
||||
virtual unsigned long Size() const;
|
||||
|
||||
rpmSrcListIndex(string URI,string Dist,string Section,
|
||||
pkgRepository *Repository) :
|
||||
@ -158,4 +168,32 @@ class rpmSrcListIndex : public rpmListIndex
|
||||
{};
|
||||
};
|
||||
|
||||
class rpmPkgDirIndex : public rpmPkgListIndex
|
||||
{
|
||||
protected:
|
||||
|
||||
virtual string MainType() const {return "pkgdir";}
|
||||
virtual string IndexPath() const;
|
||||
|
||||
public:
|
||||
|
||||
virtual bool GetReleases(pkgAcquire *Owner) const { return true; }
|
||||
virtual bool GetIndexes(pkgAcquire *Owner) const { return true; }
|
||||
|
||||
// Creates a RPMHandler suitable for usage with this object
|
||||
virtual RPMHandler *CreateHandler() const
|
||||
{ return new RPMDirHandler(IndexPath()); };
|
||||
|
||||
virtual const Type *GetType() const;
|
||||
|
||||
// Interface for the Cache Generator
|
||||
virtual unsigned long Size() const;
|
||||
|
||||
rpmPkgDirIndex(string URI,string Dist,string Section,
|
||||
pkgRepository *Repository) :
|
||||
rpmPkgListIndex(URI,Dist,Section,Repository)
|
||||
{};
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -33,49 +33,31 @@
|
||||
#include <rpm/rpmds.h>
|
||||
#endif
|
||||
|
||||
#define WITH_VERSION_CACHING 1
|
||||
|
||||
// ListParser::rpmListParser - Constructor /*{{{*/
|
||||
// ---------------------------------------------------------------------
|
||||
/* */
|
||||
rpmListParser::rpmListParser(RPMHandler *Handler)
|
||||
: Handler(Handler)
|
||||
: Handler(Handler), VI(0)
|
||||
{
|
||||
Handler->Rewind();
|
||||
header = NULL;
|
||||
if (Handler->IsDatabase() == true)
|
||||
DupPackages = new map<string,unsigned long>();
|
||||
#ifdef WITH_HASH_MAP
|
||||
SeenPackages = new SeenPackagesType(517);
|
||||
#else
|
||||
SeenPackages = new SeenPackagesType;
|
||||
#endif
|
||||
else
|
||||
DupPackages = NULL;
|
||||
GetConfig();
|
||||
SeenPackages = NULL;
|
||||
RpmData = RPMPackageData::Singleton();
|
||||
}
|
||||
/*}}}*/
|
||||
|
||||
rpmListParser::~rpmListParser()
|
||||
{
|
||||
delete DupPackages;
|
||||
}
|
||||
|
||||
unsigned long rpmListParser::Offset()
|
||||
{
|
||||
return Handler->Offset();
|
||||
}
|
||||
|
||||
|
||||
bool rpmListParser::GetConfig()
|
||||
{
|
||||
const Configuration::Item *Top = _config->Tree("RPM::Allow-Duplicated");
|
||||
for (Top = (Top == 0?0:Top->Child); Top != 0; Top = Top->Next)
|
||||
{
|
||||
regex_t *ptrn = new regex_t;
|
||||
if (regcomp(ptrn,Top->Value.c_str(),REG_EXTENDED|REG_ICASE|REG_NOSUB) != 0)
|
||||
{
|
||||
_error->Warning(_("Bad regular expression '%s' in option RPM::AllowedDupPkgs."),
|
||||
Top->Value.c_str());
|
||||
delete ptrn;
|
||||
}
|
||||
else
|
||||
AllowedDupPackages.push_back(ptrn);
|
||||
}
|
||||
return true;
|
||||
delete SeenPackages;
|
||||
}
|
||||
|
||||
// ListParser::UniqFindTagWrite - Find the tag and write a unq string /*{{{*/
|
||||
@ -109,6 +91,16 @@ unsigned long rpmListParser::UniqFindTagWrite(int Tag)
|
||||
/* This is to return the name of the package this section describes */
|
||||
string rpmListParser::Package()
|
||||
{
|
||||
if (CurrentName.empty() == false)
|
||||
return CurrentName;
|
||||
|
||||
#ifdef WITH_VERSION_CACHING
|
||||
if (VI != NULL) {
|
||||
CurrentName = VI->ParentPkg().Name();
|
||||
return CurrentName;
|
||||
}
|
||||
#endif
|
||||
|
||||
char *str;
|
||||
int type, count;
|
||||
|
||||
@ -117,54 +109,48 @@ string rpmListParser::Package()
|
||||
if (headerGetEntry(header, RPMTAG_NAME, &type, (void**)&str, &count) != 1)
|
||||
{
|
||||
_error->Error("Corrupt pkglist: no RPMTAG_NAME in header entry");
|
||||
return string();
|
||||
return "";
|
||||
}
|
||||
|
||||
bool DupOk = false;
|
||||
bool IsDup = false;
|
||||
string Name = str;
|
||||
|
||||
if (strncmp(str,"kernel", 6)==0)
|
||||
DupOk=true;
|
||||
for (vector<regex_t*>::iterator I = AllowedDupPackages.begin();
|
||||
I != AllowedDupPackages.end(); I++)
|
||||
{
|
||||
if (regexec(*I,str,0,0,0) == 0)
|
||||
// If this package can have multiple versions installed at
|
||||
// the same time, then we make it so that the name of the
|
||||
// package is NAME+"#"+VERSION and also add a provides
|
||||
// with the original name and version, to satisfy the
|
||||
// dependencies.
|
||||
if (RpmData->IsDupPackage(Name) == true)
|
||||
IsDup = true;
|
||||
else if (SeenPackages != NULL) {
|
||||
if (SeenPackages->find(Name.c_str()) != SeenPackages->end())
|
||||
{
|
||||
DupOk = true;
|
||||
break;
|
||||
if (_config->FindB("RPM::Allow-Duplicated-Warning", true) == true)
|
||||
_error->Warning(
|
||||
_("There are multiple versions of \"%s\" in your system.\n"
|
||||
"\n"
|
||||
"This package won't be cleanly updated, unless you leave\n"
|
||||
"only one version. To leave multiple versions installed,\n"
|
||||
"you may remove that warning by setting the following\n"
|
||||
"option in your configuration file:\n"
|
||||
"\n"
|
||||
"RPM::Allow-Duplicated { \"^%s$\"; };\n"
|
||||
"\n"
|
||||
"To disable these warnings completely set:\n"
|
||||
"\n"
|
||||
"RPM::Allow-Duplicated-Warning \"false\";\n")
|
||||
, Name.c_str(), Name.c_str());
|
||||
RpmData->SetDupPackage(Name);
|
||||
VirtualizePackage(Name);
|
||||
IsDup = true;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* If this package can have multiple versions installed at
|
||||
* the same time, then we make it so that the name of the
|
||||
* package is NAME+"#"+VERSION+"@"+ARCH and also adds a provides
|
||||
* with the original name and version, to satisfy the
|
||||
* dependencies.
|
||||
*/
|
||||
if (DupOk == true)
|
||||
if (IsDup == true)
|
||||
{
|
||||
Name += "#"+Version()+"@"+Architecture();
|
||||
Name += "#"+Version();
|
||||
Duplicated = true;
|
||||
}
|
||||
else if (DupPackages != NULL)
|
||||
{
|
||||
if (DupPackages->find(Name) != DupPackages->end() &&
|
||||
(*DupPackages)[Name] != Offset())
|
||||
{
|
||||
_error->Error(_("There are two or more versions of the package '%s' installed in your "
|
||||
"system, which is a situation APT can't handle cleanly at the moment.\n"
|
||||
"Please do one of the following:\n"
|
||||
"1) Keep at most one version of the package in the system; or\n"
|
||||
"2) If you do want to keep multiple versions of that package, lookup "
|
||||
"RPM::Allow-Duplicated in the documentation.\n"),
|
||||
Name.c_str());
|
||||
(*DupPackages)[Name] = Offset();
|
||||
return string();
|
||||
}
|
||||
else
|
||||
(*DupPackages)[Name] = Offset();
|
||||
}
|
||||
CurrentName = Name;
|
||||
return Name;
|
||||
}
|
||||
/*}}}*/
|
||||
@ -172,11 +158,16 @@ string rpmListParser::Package()
|
||||
// ---------------------------------------------------------------------
|
||||
string rpmListParser::Architecture()
|
||||
{
|
||||
int type, count;
|
||||
char *arch;
|
||||
int res;
|
||||
res = headerGetEntry(header, RPMTAG_ARCH, &type, (void **)&arch, &count);
|
||||
return string(res?arch:"");
|
||||
#ifdef WITH_VERSION_CACHING
|
||||
if (VI != NULL)
|
||||
return VI->Arch();
|
||||
#endif
|
||||
|
||||
int type, count;
|
||||
char *arch;
|
||||
int res;
|
||||
res = headerGetEntry(header, RPMTAG_ARCH, &type, (void **)&arch, &count);
|
||||
return string(res?arch:"");
|
||||
}
|
||||
/*}}}*/
|
||||
// ListParser::Version - Return the version string /*{{{*/
|
||||
@ -186,11 +177,17 @@ string rpmListParser::Architecture()
|
||||
entry is assumed to only describe package properties */
|
||||
string rpmListParser::Version()
|
||||
{
|
||||
#ifdef WITH_VERSION_CACHING
|
||||
if (VI != NULL)
|
||||
return VI->VerStr();
|
||||
#endif
|
||||
|
||||
char *ver, *rel;
|
||||
int_32 *ser;
|
||||
bool has_epoch = false;
|
||||
int type, count;
|
||||
string str;
|
||||
str.reserve(10);
|
||||
|
||||
if (headerGetEntry(header, RPMTAG_EPOCH, &type, (void **)&ser, &count) == 1
|
||||
&& count > 0)
|
||||
@ -199,14 +196,20 @@ string rpmListParser::Version()
|
||||
headerGetEntry(header, RPMTAG_VERSION, &type, (void **)&ver, &count);
|
||||
headerGetEntry(header, RPMTAG_RELEASE, &type, (void **)&rel, &count);
|
||||
|
||||
if (has_epoch == true)
|
||||
{
|
||||
if (has_epoch == true) {
|
||||
char buf[32];
|
||||
snprintf(buf, sizeof(buf), "%i", ser[0]);
|
||||
str = string(buf)+":"+string(ver)+"-"+string(rel);
|
||||
str += buf;
|
||||
str += ":";
|
||||
str += ver;
|
||||
str += "-";
|
||||
str += rel;
|
||||
}
|
||||
else {
|
||||
str += ver;
|
||||
str += "-";
|
||||
str += rel;
|
||||
}
|
||||
else
|
||||
str = string(ver)+"-"+string(rel);
|
||||
return str;
|
||||
}
|
||||
/*}}}*/
|
||||
@ -217,17 +220,18 @@ bool rpmListParser::NewVersion(pkgCache::VerIterator Ver)
|
||||
{
|
||||
int count, type;
|
||||
int_32 *num;
|
||||
|
||||
#if WITH_VERSION_CACHING
|
||||
// Cache it for future usage.
|
||||
RpmData->SetVersion(Handler->GetID(), Offset(), Ver);
|
||||
#endif
|
||||
|
||||
// Parse the section
|
||||
Ver->Section = UniqFindTagWrite(RPMTAG_GROUP);
|
||||
Ver->Arch = UniqFindTagWrite(RPMTAG_ARCH);
|
||||
|
||||
// Archive Size
|
||||
headerGetEntry(header, CRPMTAG_FILESIZE, &type, (void**)&num, &count);
|
||||
if (count > 0)
|
||||
Ver->Size = (unsigned)num[0];
|
||||
else
|
||||
Ver->Size = 1;
|
||||
Ver->Size = Handler->FileSize();
|
||||
|
||||
// Unpacked Size (in kbytes)
|
||||
headerGetEntry(header, RPMTAG_SIZE, &type, (void**)&num, &count);
|
||||
@ -235,8 +239,6 @@ bool rpmListParser::NewVersion(pkgCache::VerIterator Ver)
|
||||
|
||||
if (ParseDepends(Ver,pkgCache::Dep::Depends) == false)
|
||||
return false;
|
||||
if (ParseDepends(Ver,pkgCache::Dep::PreDepends) == false)
|
||||
return false;
|
||||
if (ParseDepends(Ver,pkgCache::Dep::Conflicts) == false)
|
||||
return false;
|
||||
if (ParseDepends(Ver,pkgCache::Dep::Obsoletes) == false)
|
||||
@ -259,14 +261,14 @@ bool rpmListParser::NewVersion(pkgCache::VerIterator Ver)
|
||||
bool rpmListParser::UsePackage(pkgCache::PkgIterator Pkg,
|
||||
pkgCache::VerIterator Ver)
|
||||
{
|
||||
if (SeenPackages != NULL)
|
||||
(*SeenPackages)[Pkg.Name()] = true;
|
||||
if (Pkg->Section == 0)
|
||||
Pkg->Section = UniqFindTagWrite(RPMTAG_GROUP);
|
||||
RPMPackageData *rpmdata;
|
||||
rpmdata = RPMPackageData::Singleton();
|
||||
if (_error->PendingError())
|
||||
return false;
|
||||
Ver->Priority = rpmdata->VerPriority(Pkg.Name());
|
||||
Pkg->Flags |= rpmdata->PkgFlags(Pkg.Name());
|
||||
Ver->Priority = RpmData->VerPriority(Pkg.Name());
|
||||
Pkg->Flags |= RpmData->PkgFlags(Pkg.Name());
|
||||
if (ParseStatus(Pkg,Ver) == false)
|
||||
return false;
|
||||
return true;
|
||||
@ -284,6 +286,11 @@ static int compare(const void *a, const void *b)
|
||||
|
||||
unsigned short rpmListParser::VersionHash()
|
||||
{
|
||||
#ifdef WITH_VERSION_CACHING
|
||||
if (VI != NULL)
|
||||
return (*VI)->Hash;
|
||||
#endif
|
||||
|
||||
int Sections[] = {
|
||||
RPMTAG_VERSION,
|
||||
RPMTAG_RELEASE,
|
||||
@ -294,13 +301,10 @@ unsigned short rpmListParser::VersionHash()
|
||||
0
|
||||
};
|
||||
unsigned long Result = INIT_FCS;
|
||||
char S[300];
|
||||
char *I;
|
||||
|
||||
for (const int *sec = Sections; *sec != 0; sec++)
|
||||
{
|
||||
char *Start;
|
||||
char *End;
|
||||
char *Str;
|
||||
int Len;
|
||||
int type, count;
|
||||
int res;
|
||||
@ -313,46 +317,25 @@ unsigned short rpmListParser::VersionHash()
|
||||
switch (type)
|
||||
{
|
||||
case RPM_STRING_ARRAY_TYPE:
|
||||
qsort(strings, count, sizeof(char*), compare);
|
||||
|
||||
//qsort(strings, count, sizeof(char*), compare);
|
||||
while (count-- > 0)
|
||||
{
|
||||
Start = strings[count];
|
||||
Len = strlen(Start);
|
||||
End = Start+Len;
|
||||
|
||||
if (Len >= (signed)sizeof(S))
|
||||
continue;
|
||||
Str = strings[count];
|
||||
Len = strlen(Str);
|
||||
|
||||
/* Suse patch.rpm hack. */
|
||||
if (*sec == RPMTAG_REQUIRENAME && Len == 17 && *Start == 'r' &&
|
||||
strcmp(Start, "rpmlib(PatchRPMs)") == 0)
|
||||
if (Len == 17 && *Str == 'r' && *sec == RPMTAG_REQUIRENAME &&
|
||||
strcmp(Str, "rpmlib(PatchRPMs)") == 0)
|
||||
continue;
|
||||
|
||||
/* Strip out any spaces from the text */
|
||||
for (I = S; Start != End; Start++)
|
||||
if (isspace(*Start) == 0)
|
||||
*I++ = *Start;
|
||||
|
||||
Result = AddCRC16(Result,S,I - S);
|
||||
Result = AddCRC16(Result,Str,Len);
|
||||
}
|
||||
break;
|
||||
|
||||
case RPM_STRING_TYPE:
|
||||
Start = (char*)strings;
|
||||
Len = strlen(Start);
|
||||
End = Start+Len;
|
||||
|
||||
if (Len >= (signed)sizeof(S))
|
||||
continue;
|
||||
|
||||
/* Strip out any spaces from the text */
|
||||
for (I = S; Start != End; Start++)
|
||||
if (isspace(*Start) == 0)
|
||||
*I++ = *Start;
|
||||
|
||||
Result = AddCRC16(Result,S,I - S);
|
||||
|
||||
case RPM_STRING_TYPE:
|
||||
Str = (char*)strings;
|
||||
Len = strlen(Str);
|
||||
Result = AddCRC16(Result,Str,Len);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -384,21 +367,22 @@ bool rpmListParser::ParseDepends(pkgCache::VerIterator Ver,
|
||||
char **namel, char **verl, int_32 *flagl,
|
||||
int count, unsigned int Type)
|
||||
{
|
||||
int i;
|
||||
int i = 0;
|
||||
unsigned int Op = 0;
|
||||
bool DepMode = false;
|
||||
if (Type == pkgCache::Dep::Depends)
|
||||
DepMode = true;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
for (; i < count; i++)
|
||||
{
|
||||
|
||||
if (Type == pkgCache::Dep::Depends) {
|
||||
if (DepMode == true) {
|
||||
if (flagl[i] & RPMSENSE_PREREQ)
|
||||
continue;
|
||||
} else if (Type == pkgCache::Dep::PreDepends) {
|
||||
if (!(flagl[i] & RPMSENSE_PREREQ))
|
||||
continue;
|
||||
Type = pkgCache::Dep::PreDepends;
|
||||
else
|
||||
Type = pkgCache::Dep::Depends;
|
||||
}
|
||||
|
||||
if (strncmp(namel[i], "rpmlib", 6) == 0)
|
||||
if (namel[i][0] == 'r' && strncmp(namel[i], "rpmlib", 6) == 0)
|
||||
{
|
||||
#ifdef HAVE_RPM41
|
||||
rpmds ds = rpmdsSingle(RPMTAG_PROVIDENAME,
|
||||
@ -440,13 +424,12 @@ bool rpmListParser::ParseDepends(pkgCache::VerIterator Ver,
|
||||
}
|
||||
}
|
||||
|
||||
if (NewDepends(Ver,string(namel[i]),string(verl[i]),Op,Type) == false)
|
||||
if (NewDepends(Ver,namel[i],verl[i],Op,Type) == false)
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (NewDepends(Ver,string(namel[i]),string(),pkgCache::Dep::NoOp,
|
||||
Type) == false)
|
||||
if (NewDepends(Ver,namel[i],"",pkgCache::Dep::NoOp,Type) == false)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -468,7 +451,6 @@ bool rpmListParser::ParseDepends(pkgCache::VerIterator Ver,
|
||||
switch (Type)
|
||||
{
|
||||
case pkgCache::Dep::Depends:
|
||||
case pkgCache::Dep::PreDepends:
|
||||
res = headerGetEntry(header, RPMTAG_REQUIRENAME, &type,
|
||||
(void **)&namel, &count);
|
||||
if (res != 1)
|
||||
@ -537,12 +519,9 @@ bool rpmListParser::CollectFileProvides(pkgCache &Cache,
|
||||
NULL, (void **) &names, &count);
|
||||
while (count--)
|
||||
{
|
||||
pkgCache::PkgIterator Pkg = Cache.FindPkg(names[count]);
|
||||
if (Pkg.end() == false)
|
||||
{
|
||||
if (!NewProvides(Ver, string(names[count]), string()))
|
||||
return false;
|
||||
}
|
||||
pkgCache::Package *P = Cache.FindPackage(names[count]);
|
||||
if (P != NULL && !NewProvides(Ver, names[count], ""))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -557,7 +536,6 @@ bool rpmListParser::ParseProvides(pkgCache::VerIterator Ver)
|
||||
char **namel = NULL;
|
||||
char **verl = NULL;
|
||||
int res;
|
||||
bool ok = true;
|
||||
|
||||
if (Duplicated == true)
|
||||
{
|
||||
@ -585,23 +563,17 @@ bool rpmListParser::ParseProvides(pkgCache::VerIterator Ver)
|
||||
{
|
||||
if (verl && *verl[i])
|
||||
{
|
||||
if (NewProvides(Ver,string(namel[i]),string(verl[i])) == false)
|
||||
{
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
if (NewProvides(Ver,namel[i],verl[i]) == false)
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (NewProvides(Ver,string(namel[i]),string()) == false)
|
||||
{
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
if (NewProvides(Ver,namel[i],"") == false)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return ok;
|
||||
return true;
|
||||
}
|
||||
/*}}}*/
|
||||
// ListParser::Step - Move to the next section in the file /*{{{*/
|
||||
@ -609,26 +581,26 @@ bool rpmListParser::ParseProvides(pkgCache::VerIterator Ver)
|
||||
/* This has to be carefull to only process the correct architecture */
|
||||
bool rpmListParser::Step()
|
||||
{
|
||||
RPMPackageData *rpmdata = RPMPackageData::Singleton();
|
||||
while (Handler->Skip() == true)
|
||||
{
|
||||
/* See if this is the correct Architecture, if it isn't then we
|
||||
drop the whole section. A missing arch tag can't happen to us */
|
||||
string arch, pkg, tmp;
|
||||
|
||||
header = Handler->GetHeader();
|
||||
pkg = Package();
|
||||
arch = Architecture();
|
||||
|
||||
if (Duplicated == false)
|
||||
pkg = pkg+'#'+Version();
|
||||
CurrentName = "";
|
||||
|
||||
if (rpmdata->IgnorePackage(pkg.substr(0,pkg.find('#'))) == true)
|
||||
#ifdef WITH_VERSION_CACHING
|
||||
VI = RpmData->GetVersion(Handler->GetID(), Offset());
|
||||
if (VI != NULL)
|
||||
return true;
|
||||
#endif
|
||||
|
||||
string RealName = Package();
|
||||
if (Duplicated == true)
|
||||
RealName = RealName.substr(0,RealName.find('#'));
|
||||
if (RpmData->IgnorePackage(RealName) == true)
|
||||
continue;
|
||||
|
||||
#if OLD_BESTARCH
|
||||
bool archOk = false;
|
||||
tmp = rpmSys.BestArchForPackage(pkg);
|
||||
string tmp = rpmSys.BestArchForPackage(RealName);
|
||||
if (tmp.empty() == true && // has packages for a single arch only
|
||||
rpmMachineScore(RPM_MACHTABLE_INSTARCH, arch.c_str()) > 0)
|
||||
archOk = true;
|
||||
@ -638,7 +610,7 @@ bool rpmListParser::Step()
|
||||
return true;
|
||||
#else
|
||||
if (Handler->IsDatabase() == true ||
|
||||
rpmMachineScore(RPM_MACHTABLE_INSTARCH, arch.c_str()) > 0)
|
||||
RpmData->ArchScore(Architecture().c_str()) > 0)
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
@ -680,18 +652,88 @@ bool rpmListParser::LoadReleaseInfo(pkgCache::PkgFileIterator FileI,
|
||||
}
|
||||
/*}}}*/
|
||||
|
||||
|
||||
unsigned long rpmListParser::Size()
|
||||
{
|
||||
uint_32 *size;
|
||||
int type, count;
|
||||
|
||||
if (headerGetEntry(header, RPMTAG_SIZE, &type, (void **)&size, &count)!=1)
|
||||
return 1;
|
||||
|
||||
return (size[0]+512)/1024;
|
||||
}
|
||||
|
||||
// This is a slightly complex operation. It must take a package, and
|
||||
// move every version to new packages, named accordingly to
|
||||
// Allow-Duplicated rules.
|
||||
void rpmListParser::VirtualizePackage(string Name)
|
||||
{
|
||||
pkgCache::PkgIterator FromPkgI = Owner->GetCache().FindPkg(Name);
|
||||
|
||||
// Should always be false
|
||||
if (FromPkgI.end() == true)
|
||||
return;
|
||||
|
||||
pkgCache::VerIterator FromVerI = FromPkgI.VersionList();
|
||||
while (FromVerI.end() == false) {
|
||||
string MangledName = Name+"#"+string(FromVerI.VerStr());
|
||||
|
||||
// Get the new package.
|
||||
pkgCache::PkgIterator ToPkgI = Owner->GetCache().FindPkg(MangledName);
|
||||
if (ToPkgI.end() == true) {
|
||||
// Theoretically, all packages virtualized should pass here at least
|
||||
// once for each new version in the list, since either the package was
|
||||
// already setup as Allow-Duplicated (and this method would never be
|
||||
// called), or the package doesn't exist before getting here. If
|
||||
// we discover that this assumption is false, then we must do
|
||||
// something to order the version list correctly, since the package
|
||||
// could already have some other version there.
|
||||
Owner->NewPackage(ToPkgI, MangledName);
|
||||
|
||||
// Should it get the flags from the original package? Probably not,
|
||||
// or automatic Allow-Duplicated would work differently than
|
||||
// hardcoded ones.
|
||||
ToPkgI->Flags |= RpmData->PkgFlags(MangledName);
|
||||
ToPkgI->Section = FromPkgI->Section;
|
||||
}
|
||||
|
||||
// Move the version to the new package.
|
||||
FromVerI->ParentPkg = ToPkgI.Index();
|
||||
|
||||
// Put it at the end of the version list (about ordering,
|
||||
// read the comment above).
|
||||
map_ptrloc *ToVerLast = &ToPkgI->VersionList;
|
||||
for (pkgCache::VerIterator ToVerLastI = ToPkgI.VersionList();
|
||||
ToVerLastI.end() == false;
|
||||
ToVerLast = &ToVerLastI->NextVer, ToVerLast++);
|
||||
|
||||
*ToVerLast = FromVerI.Index();
|
||||
|
||||
// Provide the real package name with the current version.
|
||||
NewProvides(FromVerI, Name, FromVerI.VerStr());
|
||||
|
||||
// Is this the current version of the old package? If yes, set it
|
||||
// as the current version of the new package as well.
|
||||
if (FromVerI == FromPkgI.CurrentVer()) {
|
||||
ToPkgI->CurrentVer = FromVerI.Index();
|
||||
ToPkgI->SelectedState = pkgCache::State::Install;
|
||||
ToPkgI->InstState = pkgCache::State::Ok;
|
||||
ToPkgI->CurrentState = pkgCache::State::Installed;
|
||||
}
|
||||
|
||||
// Move the iterator before reseting the NextVer.
|
||||
pkgCache::Version *FromVer = (pkgCache::Version*)FromVerI;
|
||||
FromVerI++;
|
||||
FromVer->NextVer = 0;
|
||||
}
|
||||
|
||||
// Reset original package data.
|
||||
FromPkgI->CurrentVer = 0;
|
||||
FromPkgI->VersionList = 0;
|
||||
FromPkgI->Section = 0;
|
||||
FromPkgI->SelectedState = 0;
|
||||
FromPkgI->InstState = 0;
|
||||
FromPkgI->CurrentState = 0;
|
||||
}
|
||||
|
||||
#endif /* HAVE_RPM */
|
||||
|
||||
// vim:sts=3:sw=3
|
||||
|
@ -14,6 +14,8 @@
|
||||
#define PKGLIB_RPMLISTPARSER_H
|
||||
|
||||
#include <apt-pkg/pkgcachegen.h>
|
||||
#include <apt-pkg/rpmhandler.h>
|
||||
#include <apt-pkg/rpmmisc.h>
|
||||
#include <rpm/rpmlib.h>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
@ -22,21 +24,27 @@
|
||||
using namespace std;
|
||||
|
||||
class RPMHandler;
|
||||
class RPMPackageData;
|
||||
|
||||
class rpmListParser : public pkgCacheGenerator::ListParser
|
||||
{
|
||||
RPMHandler *Handler;
|
||||
RPMPackageData *RpmData;
|
||||
Header header;
|
||||
|
||||
string CurrentName;
|
||||
const pkgCache::VerIterator *VI;
|
||||
|
||||
map<string,unsigned long> *DupPackages;
|
||||
vector<string> Essentials;
|
||||
vector<string> Importants;
|
||||
#ifdef WITH_HASH_MAP
|
||||
typedef hash_map<const char*,bool,
|
||||
hash<const char*>,cstr_eq_pred> SeenPackagesType;
|
||||
#else
|
||||
typedef map<const char*,bool,cstr_lt_pred> SeenPackagesType;
|
||||
#endif
|
||||
SeenPackagesType *SeenPackages;
|
||||
|
||||
vector<regex_t*> AllowedDupPackages;
|
||||
bool Duplicated;
|
||||
|
||||
bool GetConfig();
|
||||
|
||||
unsigned long UniqFindTagWrite(int Tag);
|
||||
bool ParseStatus(pkgCache::PkgIterator Pkg,pkgCache::VerIterator Ver);
|
||||
bool ParseDepends(pkgCache::VerIterator Ver,
|
||||
@ -59,13 +67,23 @@ class rpmListParser : public pkgCacheGenerator::ListParser
|
||||
virtual unsigned short VersionHash();
|
||||
virtual bool UsePackage(pkgCache::PkgIterator Pkg,
|
||||
pkgCache::VerIterator Ver);
|
||||
virtual unsigned long Offset();
|
||||
virtual unsigned long Offset()
|
||||
{return Handler->Offset();};
|
||||
virtual unsigned long Size();
|
||||
|
||||
virtual bool OrderedOffset()
|
||||
{return Handler->OrderedOffset();};
|
||||
|
||||
virtual bool IsDatabase()
|
||||
{return Handler->IsDatabase();};
|
||||
|
||||
virtual bool CollectFileProvides(pkgCache &Cache,
|
||||
pkgCache::VerIterator Ver);
|
||||
virtual bool Step();
|
||||
|
||||
bool LoadReleaseInfo(pkgCache::PkgFileIterator FileI,FileFd &File);
|
||||
|
||||
void VirtualizePackage(string Name);
|
||||
|
||||
rpmListParser(RPMHandler *Handler);
|
||||
~rpmListParser();
|
||||
|
36
apt/apt-pkg/rpm/rpmmisc.h
Normal file
36
apt/apt-pkg/rpm/rpmmisc.h
Normal file
@ -0,0 +1,36 @@
|
||||
#ifndef RPMMISC_H
|
||||
#define RPMMISC_H
|
||||
|
||||
#ifdef WITH_HASH_MAP
|
||||
|
||||
#include <ext/hash_map>
|
||||
|
||||
using namespace __gnu_cxx;
|
||||
|
||||
struct hash_string
|
||||
{
|
||||
size_t operator()(string str) const {
|
||||
unsigned long h = 0;
|
||||
const char *s = str.c_str();
|
||||
for (; *s; ++s)
|
||||
h = 5*h + *s;
|
||||
return size_t(h);
|
||||
};
|
||||
};
|
||||
|
||||
struct cstr_eq_pred
|
||||
{
|
||||
size_t operator()(const char *s1, const char *s2) const
|
||||
{ return strcmp(s1, s2) == 0; };
|
||||
};
|
||||
#endif /* WITH_HASH_MAP */
|
||||
|
||||
struct cstr_lt_pred
|
||||
{
|
||||
size_t operator()(const char *s1, const char *s2) const
|
||||
{ return strcmp(s1, s2) < 0; };
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
// vim:sts=3:sw=3
|
@ -3,7 +3,6 @@
|
||||
|
||||
#ifdef HAVE_RPM
|
||||
|
||||
|
||||
#include <apt-pkg/error.h>
|
||||
#include <apt-pkg/rpmpackagedata.h>
|
||||
#include <apt-pkg/fileutl.h>
|
||||
@ -13,7 +12,13 @@
|
||||
|
||||
#include <apti18n.h>
|
||||
|
||||
#include <rpm/rpmlib.h>
|
||||
|
||||
RPMPackageData::RPMPackageData()
|
||||
: MinArchScore(-1)
|
||||
#ifdef WITH_HASH_MAP
|
||||
, ArchScores(31), VerMap(517)
|
||||
#endif
|
||||
{
|
||||
// Populate priorities
|
||||
string FileName = _config->FindFile("Dir::Etc::rpmpriorities");
|
||||
@ -35,11 +40,11 @@ RPMPackageData::RPMPackageData()
|
||||
|
||||
for (int i = 0; i != 6; i++)
|
||||
{
|
||||
static const char *priorities[] =
|
||||
const char *priorities[] =
|
||||
{
|
||||
"Essential", "Important", "Required", "Standard", "Optional", "Extra"
|
||||
};
|
||||
static pkgCache::State::VerPriority states[] = {
|
||||
pkgCache::State::VerPriority states[] = {
|
||||
pkgCache::State::Important,
|
||||
pkgCache::State::Important,
|
||||
pkgCache::State::Required,
|
||||
@ -47,7 +52,7 @@ RPMPackageData::RPMPackageData()
|
||||
pkgCache::State::Optional,
|
||||
pkgCache::State::Extra
|
||||
};
|
||||
static pkgCache::Flag::PkgFlags flags[] = {
|
||||
pkgCache::Flag::PkgFlags flags[] = {
|
||||
pkgCache::Flag::Essential,
|
||||
pkgCache::Flag::Important,
|
||||
pkgCache::Flag::Important,
|
||||
@ -56,7 +61,6 @@ RPMPackageData::RPMPackageData()
|
||||
(pkgCache::Flag::PkgFlags)0
|
||||
};
|
||||
|
||||
|
||||
string Packages = Section.FindS(priorities[i]);
|
||||
if (Packages.empty())
|
||||
continue;
|
||||
@ -80,12 +84,12 @@ RPMPackageData::RPMPackageData()
|
||||
regex_t *ptrn = new regex_t;
|
||||
if (regcomp(ptrn,Top->Value.c_str(),REG_EXTENDED|REG_ICASE|REG_NOSUB) != 0)
|
||||
{
|
||||
_error->Warning(_("Bad regular expression '%s' in option RPM::HoldPackages."),
|
||||
_error->Warning(_("Bad regular expression '%s' in option RPM::Hold."),
|
||||
Top->Value.c_str());
|
||||
delete ptrn;
|
||||
}
|
||||
else
|
||||
HoldPackages.push_front(ptrn);
|
||||
HoldPackages.push_back(ptrn);
|
||||
}
|
||||
|
||||
// Populate ignored packages
|
||||
@ -93,6 +97,21 @@ RPMPackageData::RPMPackageData()
|
||||
for (Top = (Top == 0?0:Top->Child); Top != 0; Top = Top->Next)
|
||||
IgnorePackages[Top->Value] = 1;
|
||||
|
||||
// Populate Allow-Duplicated packages.
|
||||
Top = _config->Tree("RPM::Allow-Duplicated");
|
||||
for (Top = (Top == 0?0:Top->Child); Top != 0; Top = Top->Next)
|
||||
{
|
||||
regex_t *ptrn = new regex_t;
|
||||
if (regcomp(ptrn,Top->Value.c_str(),REG_EXTENDED|REG_ICASE|REG_NOSUB) != 0)
|
||||
{
|
||||
_error->Warning(_("Bad regular expression '%s' in option RPM::Allow-Duplicated."),
|
||||
Top->Value.c_str());
|
||||
delete ptrn;
|
||||
}
|
||||
else
|
||||
DuplicatedPatterns.push_back(ptrn);
|
||||
}
|
||||
|
||||
// Populate fake provides
|
||||
Top = _config->Tree("RPM::Fake-Provides");
|
||||
for (Top = (Top == 0?0:Top->Child); Top != 0; Top = Top->Next)
|
||||
@ -119,12 +138,12 @@ RPMPackageData::RPMPackageData()
|
||||
{
|
||||
// If it's NULL, it was provided with an empty version
|
||||
if (FakeProvides[Name] != NULL)
|
||||
FakeProvides[Name]->push_front(Version);
|
||||
FakeProvides[Name]->push_back(Version);
|
||||
}
|
||||
else
|
||||
{
|
||||
list<string> *VerList = new list<string>;
|
||||
VerList->push_front(Version);
|
||||
vector<string> *VerList = new vector<string>;
|
||||
VerList->push_back(Version);
|
||||
FakeProvides[Name] = VerList;
|
||||
}
|
||||
}
|
||||
@ -145,9 +164,9 @@ RPMPackageData::RPMPackageData()
|
||||
const char *TString[] = {"translate-binary",
|
||||
"translate-source",
|
||||
"translate-index"};
|
||||
list<Translate*> *TList[] = {&BinaryTranslations,
|
||||
&SourceTranslations,
|
||||
&IndexTranslations};
|
||||
vector<Translate*> *TList[] = {&BinaryTranslations,
|
||||
&SourceTranslations,
|
||||
&IndexTranslations};
|
||||
for (int i = 0; i != 3; i++)
|
||||
{
|
||||
Top = Cnf.Tree(TString[i]);
|
||||
@ -164,7 +183,7 @@ RPMPackageData::RPMPackageData()
|
||||
{
|
||||
Configuration Block(Top);
|
||||
t->Template = Block.Find("Template");
|
||||
TList[i]->push_front(t);
|
||||
TList[i]->push_back(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -172,29 +191,22 @@ RPMPackageData::RPMPackageData()
|
||||
|
||||
bool RPMPackageData::HoldPackage(const char *name)
|
||||
{
|
||||
for (list<regex_t*>::iterator I = HoldPackages.begin();
|
||||
for (vector<regex_t*>::iterator I = HoldPackages.begin();
|
||||
I != HoldPackages.end(); I++)
|
||||
if (regexec(*I,name,0,0,0) == 0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool RPMPackageData::IgnorePackage(string Name)
|
||||
{
|
||||
if (IgnorePackages.find(Name) != IgnorePackages.end())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool RPMPackageData::IgnoreDep(pkgVersioningSystem &VS,
|
||||
pkgCache::DepIterator &Dep)
|
||||
{
|
||||
const char *name = Dep.TargetPkg().Name();
|
||||
if (FakeProvides.find(name) != FakeProvides.end()) {
|
||||
list<string> *VerList = FakeProvides[name];
|
||||
vector<string> *VerList = FakeProvides[name];
|
||||
if (VerList == NULL)
|
||||
return true;
|
||||
for (list<string>::iterator I = VerList->begin();
|
||||
for (vector<string>::iterator I = VerList->begin();
|
||||
I != VerList->end(); I++)
|
||||
{
|
||||
if (VS.CheckDep(I->c_str(),Dep->CompareOp,Dep.TargetVer()) == true)
|
||||
@ -229,11 +241,12 @@ static void ParseTemplate(string &Template, map<string,string> &Dict)
|
||||
}
|
||||
}
|
||||
|
||||
void RPMPackageData::GenericTranslate(list<Translate*> &TList, string &FullURI,
|
||||
void RPMPackageData::GenericTranslate(vector<Translate*> &TList,
|
||||
string &FullURI,
|
||||
map<string,string> &Dict)
|
||||
{
|
||||
const char *fulluri = FullURI.c_str();
|
||||
for (list<Translate*>::iterator I = TList.begin(); I != TList.end(); I++)
|
||||
for (vector<Translate*>::iterator I = TList.begin(); I != TList.end(); I++)
|
||||
{
|
||||
if (regexec(&(*I)->Pattern,fulluri,0,0,0) == 0)
|
||||
{
|
||||
@ -244,6 +257,40 @@ void RPMPackageData::GenericTranslate(list<Translate*> &TList, string &FullURI,
|
||||
}
|
||||
}
|
||||
|
||||
void RPMPackageData::InitMinArchScore()
|
||||
{
|
||||
if (MinArchScore != -1)
|
||||
return;
|
||||
string Arch = _config->Find("RPM::Architecture", "");
|
||||
if (Arch.empty() == false)
|
||||
MinArchScore = rpmMachineScore(RPM_MACHTABLE_INSTARCH, Arch.c_str());
|
||||
else
|
||||
MinArchScore = 0;
|
||||
}
|
||||
|
||||
int RPMPackageData::RpmArchScore(const char *Arch)
|
||||
{
|
||||
int Score = rpmMachineScore(RPM_MACHTABLE_INSTARCH, Arch);
|
||||
if (Score >= MinArchScore)
|
||||
return Score;
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool RPMPackageData::IsDupPackage(string Name)
|
||||
{
|
||||
if (DuplicatedPackages.find(Name) != DuplicatedPackages.end())
|
||||
return true;
|
||||
const char *name = Name.c_str();
|
||||
for (vector<regex_t*>::iterator I = DuplicatedPatterns.begin();
|
||||
I != DuplicatedPatterns.end(); I++) {
|
||||
if (regexec(*I,name,0,0,0) == 0) {
|
||||
SetDupPackage(Name);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
RPMPackageData *RPMPackageData::Singleton()
|
||||
{
|
||||
static RPMPackageData *data = NULL;
|
||||
|
@ -1,39 +1,69 @@
|
||||
|
||||
#ifndef _RPMPACKAGEDATA_H_
|
||||
#define _RPMPACKAGEDATA_H_
|
||||
|
||||
#ifndef RPMPACKAGEDATA_H
|
||||
#define RPMPACKAGEDATA_H
|
||||
|
||||
#include <apt-pkg/tagfile.h>
|
||||
#include <apt-pkg/pkgcache.h>
|
||||
#include <apt-pkg/rpmmisc.h>
|
||||
|
||||
#include <map>
|
||||
#include <list>
|
||||
#include <vector>
|
||||
#include <regex.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
struct LessPred
|
||||
{
|
||||
bool operator()(const char* s1, const char* s2) const
|
||||
{ return strcmp(s1, s2) < 0; }
|
||||
};
|
||||
|
||||
class RPMPackageData
|
||||
{
|
||||
protected:
|
||||
|
||||
#ifdef WITH_HASH_MAP
|
||||
hash_map<string,pkgCache::State::VerPriority,hash_string> Priorities;
|
||||
hash_map<string,pkgCache::Flag::PkgFlags,hash_string> Flags;
|
||||
hash_map<string,vector<string>*,hash_string> FakeProvides;
|
||||
hash_map<string,int,hash_string> IgnorePackages;
|
||||
hash_map<string,int,hash_string> DuplicatedPackages;
|
||||
typedef map<string,pkgCache::VerIterator> VerMapValueType;
|
||||
typedef hash_map<unsigned long,VerMapValueType> VerMapType;
|
||||
typedef hash_map<const char*,int,
|
||||
hash<const char*>,cstr_eq_pred> ArchScoresType;
|
||||
#else
|
||||
map<string,pkgCache::State::VerPriority> Priorities;
|
||||
map<string,pkgCache::Flag::PkgFlags> Flags;
|
||||
map<string,list<string>*> FakeProvides;
|
||||
map<string,vector<string>*> FakeProvides;
|
||||
map<string,int> IgnorePackages;
|
||||
list<regex_t*> HoldPackages;
|
||||
map<string,int> DuplicatedPackages;
|
||||
typedef map<string,pkgCache::VerIterator> VerMapValueType;
|
||||
typedef map<unsigned long,VerMapValueType> VerMapType;
|
||||
typedef map<const char*,int,cstr_lt_pred> ArchScoresType;
|
||||
#endif
|
||||
|
||||
vector<regex_t*> HoldPackages;
|
||||
vector<regex_t*> DuplicatedPatterns;
|
||||
|
||||
struct Translate {
|
||||
regex_t Pattern;
|
||||
string Template;
|
||||
};
|
||||
|
||||
list<Translate*> BinaryTranslations;
|
||||
list<Translate*> SourceTranslations;
|
||||
list<Translate*> IndexTranslations;
|
||||
vector<Translate*> BinaryTranslations;
|
||||
vector<Translate*> SourceTranslations;
|
||||
vector<Translate*> IndexTranslations;
|
||||
|
||||
void GenericTranslate(list<Translate*> &TList, string &FullURI,
|
||||
VerMapType VerMap;
|
||||
|
||||
void GenericTranslate(vector<Translate*> &TList, string &FullURI,
|
||||
map<string,string> &Dict);
|
||||
|
||||
int MinArchScore;
|
||||
|
||||
ArchScoresType ArchScores;
|
||||
int RpmArchScore(const char *Arch);
|
||||
|
||||
public:
|
||||
|
||||
inline pkgCache::State::VerPriority VerPriority(string Package)
|
||||
@ -42,10 +72,10 @@ class RPMPackageData
|
||||
{return Flags[Package];};
|
||||
|
||||
bool HoldPackage(const char *name);
|
||||
bool IgnorePackage(string Name);
|
||||
bool IgnoreDep(pkgVersioningSystem &VS,pkgCache::DepIterator &Dep);
|
||||
bool IgnorePackage(string Name)
|
||||
{return IgnorePackages.find(Name) != IgnorePackages.end();};
|
||||
|
||||
static RPMPackageData *Singleton();
|
||||
bool IgnoreDep(pkgVersioningSystem &VS,pkgCache::DepIterator &Dep);
|
||||
|
||||
void TranslateBinary(string &FullURI, map<string,string> &Dict)
|
||||
{return GenericTranslate(BinaryTranslations, FullURI, Dict);};
|
||||
@ -61,8 +91,47 @@ class RPMPackageData
|
||||
bool HasIndexTranslation()
|
||||
{return !IndexTranslations.empty();};
|
||||
|
||||
int ArchScore(const char *Arch)
|
||||
{
|
||||
ArchScoresType::const_iterator I = ArchScores.find(Arch);
|
||||
if (I != ArchScores.end())
|
||||
return I->second;
|
||||
int Ret = RpmArchScore(Arch);
|
||||
// Must iterate and free when deallocating.
|
||||
ArchScores[strdup(Arch)] = Ret;
|
||||
return Ret;
|
||||
}
|
||||
void InitMinArchScore();
|
||||
|
||||
void SetDupPackage(string Name)
|
||||
{DuplicatedPackages[Name] = 1;};
|
||||
bool IsDupPackage(string Name);
|
||||
|
||||
static RPMPackageData *Singleton();
|
||||
|
||||
void SetVersion(string ID, unsigned long Offset,
|
||||
pkgCache::VerIterator &Version)
|
||||
{
|
||||
VerMap[Offset][ID] = Version;
|
||||
};
|
||||
const pkgCache::VerIterator *GetVersion(string ID, unsigned long Offset)
|
||||
{
|
||||
VerMapType::const_iterator I1 = VerMap.find(Offset);
|
||||
if (I1 != VerMap.end()) {
|
||||
VerMapValueType::const_iterator I2 =
|
||||
I1->second.find(ID);
|
||||
if (I2 != I1->second.end())
|
||||
return &I2->second;
|
||||
}
|
||||
return NULL;
|
||||
};
|
||||
|
||||
void CacheBuilt() {VerMap.clear();};
|
||||
|
||||
RPMPackageData();
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
// vim:sts=3:sw=3
|
||||
|
@ -221,7 +221,7 @@ bool pkgRPMPM::RunScriptsWithPkgs(const char *Cnf)
|
||||
|
||||
/*}}}*/
|
||||
|
||||
bool pkgRPMPM::ExecRPM(Item::RPMOps op, list<const char*> &files)
|
||||
bool pkgRPMPM::ExecRPM(Item::RPMOps op, vector<const char*> &files)
|
||||
{
|
||||
const char *Args[10000];
|
||||
const char *operation;
|
||||
@ -230,24 +230,28 @@ bool pkgRPMPM::ExecRPM(Item::RPMOps op, list<const char*> &files)
|
||||
|
||||
Args[n++] = _config->Find("Dir::Bin::rpm","rpm").c_str();
|
||||
|
||||
bool nodeps;
|
||||
|
||||
switch (op)
|
||||
{
|
||||
case Item::RPMInstall:
|
||||
if (Interactive)
|
||||
operation = "-ivh";
|
||||
else
|
||||
operation = "-i";
|
||||
operation = "-iv";
|
||||
nodeps = true;
|
||||
break;
|
||||
|
||||
case Item::RPMUpgrade:
|
||||
if (Interactive)
|
||||
operation = "-Uvh";
|
||||
else
|
||||
operation = "-U";
|
||||
operation = "-Uv";
|
||||
break;
|
||||
|
||||
case Item::RPMErase:
|
||||
operation = "-e";
|
||||
nodeps = true;
|
||||
break;
|
||||
}
|
||||
Args[n++] = operation;
|
||||
@ -265,7 +269,6 @@ bool pkgRPMPM::ExecRPM(Item::RPMOps op, list<const char*> &files)
|
||||
Configuration::Item const *Opts;
|
||||
if (op == Item::RPMErase)
|
||||
{
|
||||
bool nodeps = true;
|
||||
Opts = _config->Tree("RPM::Erase-Options");
|
||||
if (Opts != 0)
|
||||
{
|
||||
@ -279,8 +282,6 @@ bool pkgRPMPM::ExecRPM(Item::RPMOps op, list<const char*> &files)
|
||||
Args[n++] = Opts->Value.c_str();
|
||||
}
|
||||
}
|
||||
if (nodeps == true)
|
||||
Args[n++] = "--nodeps";
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -299,6 +300,8 @@ bool pkgRPMPM::ExecRPM(Item::RPMOps op, list<const char*> &files)
|
||||
replacepkgs = false;
|
||||
else if (Opts->Value == "--replacefiles")
|
||||
replacefiles = false;
|
||||
else if (Opts->Value == "--nodeps")
|
||||
nodeps = false;
|
||||
else if (Opts->Value.empty() == true)
|
||||
continue;
|
||||
Args[n++] = Opts->Value.c_str();
|
||||
@ -312,6 +315,9 @@ bool pkgRPMPM::ExecRPM(Item::RPMOps op, list<const char*> &files)
|
||||
Args[n++] = "--replacefiles";
|
||||
}
|
||||
|
||||
if (nodeps == true)
|
||||
Args[n++] = "--nodeps";
|
||||
|
||||
Opts = _config->Tree("RPM::Options");
|
||||
if (Opts != 0)
|
||||
{
|
||||
@ -327,7 +333,7 @@ bool pkgRPMPM::ExecRPM(Item::RPMOps op, list<const char*> &files)
|
||||
if (_config->FindB("RPM::Order",false) == false)
|
||||
Args[n++] = "--noorder";
|
||||
|
||||
for (list<const char*>::iterator I = files.begin(); I != files.end(); I++)
|
||||
for (vector<const char*>::iterator I = files.begin(); I != files.end(); I++)
|
||||
Args[n++] = *I;
|
||||
|
||||
Args[n++] = 0;
|
||||
@ -416,9 +422,9 @@ bool pkgRPMPM::ExecRPM(Item::RPMOps op, list<const char*> &files)
|
||||
}
|
||||
|
||||
|
||||
bool pkgRPMPM::Process(list<const char*> &install,
|
||||
list<const char*> &upgrade,
|
||||
list<const char*> &uninstall)
|
||||
bool pkgRPMPM::Process(vector<const char*> &install,
|
||||
vector<const char*> &upgrade,
|
||||
vector<const char*> &uninstall)
|
||||
{
|
||||
if (uninstall.empty() == false)
|
||||
ExecRPM(Item::RPMErase, uninstall);
|
||||
@ -441,11 +447,11 @@ bool pkgRPMPM::Go()
|
||||
if (RunScriptsWithPkgs("RPM::Pre-Install-Pkgs") == false)
|
||||
return false;
|
||||
|
||||
list<const char*> install;
|
||||
list<const char*> upgrade;
|
||||
list<const char*> uninstall;
|
||||
vector<const char*> install;
|
||||
vector<const char*> upgrade;
|
||||
vector<const char*> uninstall;
|
||||
|
||||
list<char*> unalloc;
|
||||
vector<char*> unalloc;
|
||||
|
||||
for (vector<Item>::iterator I = List.begin(); I != List.end(); I++)
|
||||
{
|
||||
@ -455,10 +461,12 @@ bool pkgRPMPM::Go()
|
||||
case Item::Remove:
|
||||
if (strchr(I->Pkg.Name(), '#') != NULL)
|
||||
{
|
||||
const char *pkgname = I->Pkg.Name();
|
||||
string Name = string(pkgname, strchr(pkgname, '#')-pkgname)
|
||||
+ "-" + string(I->Pkg.CurrentVer().VerStr());
|
||||
char *name = strdup(Name.c_str());
|
||||
char *name = strdup(I->Pkg.Name());
|
||||
char *p = strchr(name, '#');
|
||||
*(p++) = '-';
|
||||
const char *epoch = strchr(p, ':');
|
||||
if (epoch != NULL)
|
||||
memmove(p, epoch+1, strlen(epoch+1)+1);
|
||||
unalloc.push_back(name);
|
||||
uninstall.push_back(name);
|
||||
}
|
||||
@ -481,13 +489,18 @@ bool pkgRPMPM::Go()
|
||||
}
|
||||
}
|
||||
|
||||
if (Process(install, upgrade, uninstall) == false)
|
||||
return false;
|
||||
bool Ret = true;
|
||||
|
||||
for (list<char *>::iterator I = unalloc.begin(); I != unalloc.end(); I++)
|
||||
if (Process(install, upgrade, uninstall) == false)
|
||||
Ret = false;
|
||||
|
||||
for (vector<char *>::iterator I = unalloc.begin(); I != unalloc.end(); I++)
|
||||
free(*I);
|
||||
|
||||
return RunScripts("RPM::Post-Invoke");
|
||||
if (Ret == true)
|
||||
Ret = RunScripts("RPM::Post-Invoke");
|
||||
|
||||
return Ret;
|
||||
}
|
||||
/*}}}*/
|
||||
// pkgRPMPM::Reset - Dump the contents of the command list /*{{{*/
|
||||
|
@ -17,7 +17,6 @@
|
||||
|
||||
#include <apt-pkg/packagemanager.h>
|
||||
#include <vector>
|
||||
#include <list>
|
||||
|
||||
using namespace std;
|
||||
|
||||
@ -47,10 +46,10 @@ class pkgRPMPM : public pkgPackageManager
|
||||
virtual bool Configure(PkgIterator Pkg);
|
||||
virtual bool Remove(PkgIterator Pkg,bool Purge = false);
|
||||
|
||||
bool ExecRPM(Item::RPMOps op, list<const char*> &files);
|
||||
bool Process(list<const char*> &install,
|
||||
list<const char*> &upgrade,
|
||||
list<const char*> &uninstall);
|
||||
bool ExecRPM(Item::RPMOps op, vector<const char*> &files);
|
||||
bool Process(vector<const char*> &install,
|
||||
vector<const char*> &upgrade,
|
||||
vector<const char*> &uninstall);
|
||||
|
||||
virtual bool Go();
|
||||
virtual void Reset();
|
||||
|
@ -27,10 +27,19 @@
|
||||
// ---------------------------------------------------------------------
|
||||
/* */
|
||||
rpmRecordParser::rpmRecordParser(string File, pkgCache &Cache)
|
||||
: FileHandler(0), HeaderP(0), Buffer(0), BufSize(0), BufUsed(0)
|
||||
: Handler(0), HeaderP(0), Buffer(0), BufSize(0), BufUsed(0)
|
||||
{
|
||||
if (File != RPMDBHandler::DataPath(false))
|
||||
FileHandler = new RPMFileHandler(File);
|
||||
if (File == RPMDBHandler::DataPath(false)) {
|
||||
IsDatabase = true;
|
||||
Handler = rpmSys.GetDBHandler();
|
||||
} else {
|
||||
IsDatabase = false;
|
||||
struct stat Buf;
|
||||
if (stat(File.c_str(),&Buf) == 0 && S_ISDIR(Buf.st_mode))
|
||||
Handler = new RPMDirHandler(File);
|
||||
else
|
||||
Handler = new RPMFileHandler(File);
|
||||
}
|
||||
}
|
||||
/*}}}*/
|
||||
// RecordParser::~rpmRecordParser - Destructor /*{{{*/
|
||||
@ -38,7 +47,10 @@ rpmRecordParser::rpmRecordParser(string File, pkgCache &Cache)
|
||||
/* */
|
||||
rpmRecordParser::~rpmRecordParser()
|
||||
{
|
||||
delete FileHandler;
|
||||
// Can't use Handler->IsDatabase here, since the RPMDBHandler
|
||||
// could already have been destroyed.
|
||||
if (IsDatabase == false)
|
||||
delete Handler;
|
||||
free(Buffer);
|
||||
}
|
||||
/*}}}*/
|
||||
@ -47,13 +59,6 @@ rpmRecordParser::~rpmRecordParser()
|
||||
/* */
|
||||
bool rpmRecordParser::Jump(pkgCache::VerFileIterator const &Ver)
|
||||
{
|
||||
RPMHandler *Handler = FileHandler;
|
||||
if (Handler == NULL)
|
||||
{
|
||||
Handler = rpmSys.GetDBHandler();
|
||||
if (Handler == NULL)
|
||||
return false;
|
||||
}
|
||||
Handler->Jump(Ver->Offset);
|
||||
HeaderP = Handler->GetHeader();
|
||||
return (HeaderP != NULL);
|
||||
@ -64,12 +69,10 @@ bool rpmRecordParser::Jump(pkgCache::VerFileIterator const &Ver)
|
||||
/* */
|
||||
string rpmRecordParser::FileName()
|
||||
{
|
||||
char *str;
|
||||
int_32 count, type;
|
||||
assert(HeaderP != NULL);
|
||||
int rc = headerGetEntry(HeaderP, CRPMTAG_FILENAME,
|
||||
&type, (void**)&str, &count);
|
||||
return string(rc?str:"");
|
||||
string Dir = Handler->Directory();
|
||||
if (Dir.empty() == true)
|
||||
return Handler->FileName();
|
||||
return flCombine(Dir, Handler->FileName());
|
||||
}
|
||||
/*}}}*/
|
||||
// RecordParser::Name - Return the package name /*{{{*/
|
||||
@ -90,12 +93,7 @@ string rpmRecordParser::Name()
|
||||
/* */
|
||||
string rpmRecordParser::MD5Hash()
|
||||
{
|
||||
char *str;
|
||||
int_32 count, type;
|
||||
assert(HeaderP != NULL);
|
||||
int rc = headerGetEntry(HeaderP, CRPMTAG_MD5,
|
||||
&type, (void**)&str, &count);
|
||||
return string(rc?str:"");
|
||||
return Handler->MD5Sum();
|
||||
}
|
||||
/*}}}*/
|
||||
// RecordParser::Maintainer - Return the maintainer email /*{{{*/
|
||||
@ -178,13 +176,13 @@ string rpmRecordParser::SourcePkg()
|
||||
}
|
||||
/*}}}*/
|
||||
|
||||
void rpmRecordParser::BufCat(char *text)
|
||||
void rpmRecordParser::BufCat(const char *text)
|
||||
{
|
||||
if (text != NULL)
|
||||
BufCat(text, text+strlen(text));
|
||||
}
|
||||
|
||||
void rpmRecordParser::BufCat(char *begin, char *end)
|
||||
void rpmRecordParser::BufCat(const char *begin, const char *end)
|
||||
{
|
||||
unsigned len = end - begin;
|
||||
|
||||
@ -204,16 +202,18 @@ void rpmRecordParser::BufCat(char *begin, char *end)
|
||||
BufUsed += len;
|
||||
}
|
||||
|
||||
void rpmRecordParser::BufCatTag(char *tag, char *value)
|
||||
void rpmRecordParser::BufCatTag(const char *tag, const char *value)
|
||||
{
|
||||
BufCat(tag);
|
||||
BufCat(value);
|
||||
}
|
||||
|
||||
void rpmRecordParser::BufCatDep(char *pkg, char *version, int flags)
|
||||
void rpmRecordParser::BufCatDep(const char *pkg,
|
||||
const char *version,
|
||||
int flags)
|
||||
{
|
||||
char buf[16];
|
||||
char *ptr = (char*)buf;
|
||||
char *ptr = buf;
|
||||
|
||||
BufCat(pkg);
|
||||
if (*version)
|
||||
@ -247,9 +247,9 @@ void rpmRecordParser::BufCatDep(char *pkg, char *version, int flags)
|
||||
}
|
||||
}
|
||||
|
||||
void rpmRecordParser::BufCatDescr(char *descr)
|
||||
void rpmRecordParser::BufCatDescr(const char *descr)
|
||||
{
|
||||
char *begin = descr;
|
||||
const char *begin = descr;
|
||||
|
||||
while (*descr)
|
||||
{
|
||||
@ -401,15 +401,12 @@ void rpmRecordParser::GetRec(const char *&Start,const char *&Stop)
|
||||
headerGetEntry(HeaderP, RPMTAG_ARCH, &type, (void **)&str, &count);
|
||||
BufCatTag("\nArchitecture: ", str);
|
||||
|
||||
headerGetEntry(HeaderP, CRPMTAG_FILESIZE, &type, (void **)&num, &count);
|
||||
snprintf(buf, sizeof(buf), "%d", num);
|
||||
snprintf(buf, sizeof(buf), "%d", Handler->FileSize());
|
||||
BufCatTag("\nSize: ", buf);
|
||||
|
||||
headerGetEntry(HeaderP, CRPMTAG_MD5, &type, (void **)&str, &count);
|
||||
BufCatTag("\nMD5Sum: ", str);
|
||||
BufCatTag("\nMD5Sum: ", Handler->MD5Sum().c_str());
|
||||
|
||||
headerGetEntry(HeaderP, CRPMTAG_FILENAME, &type, (void **)&str, &count);
|
||||
BufCatTag("\nFilename: ", str);
|
||||
BufCatTag("\nFilename: ", Handler->FileName().c_str());
|
||||
|
||||
headerGetEntry(HeaderP, RPMTAG_SUMMARY, &type, (void **)&str, &count);
|
||||
BufCatTag("\nDescription: ", str);
|
||||
|
@ -24,11 +24,12 @@
|
||||
#include <rpm/rpmlib.h>
|
||||
|
||||
|
||||
class RPMFileHandler;
|
||||
class RPMHandler;
|
||||
|
||||
class rpmRecordParser : public pkgRecords::Parser
|
||||
{
|
||||
RPMFileHandler *FileHandler;
|
||||
RPMHandler *Handler;
|
||||
bool IsDatabase;
|
||||
|
||||
Header HeaderP;
|
||||
|
||||
@ -36,11 +37,11 @@ class rpmRecordParser : public pkgRecords::Parser
|
||||
unsigned BufSize;
|
||||
unsigned BufUsed;
|
||||
|
||||
void BufCat(char *text);
|
||||
void BufCat(char *begin, char *end);
|
||||
void BufCatTag(char *tag, char *value);
|
||||
void BufCatDep(char *pkg, char *version, int flags);
|
||||
void BufCatDescr(char *descr);
|
||||
void BufCat(const char *text);
|
||||
void BufCat(const char *begin, const char *end);
|
||||
void BufCatTag(const char *tag, const char *value);
|
||||
void BufCatDep(const char *pkg, const char *version, int flags);
|
||||
void BufCatDescr(const char *descr);
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -170,10 +170,7 @@ bool rpmSystem::Initialize(Configuration &Cnf)
|
||||
{
|
||||
_error->Warning("RPM::NoDeps is obsoleted. Add \"--nodeps\" to RPM::Options and RPM::Erase-Options instead.");
|
||||
if (Cnf.FindB("RPM::NoDeps",false))
|
||||
{
|
||||
Cnf.Set("RPM::Options::", "--nodeps");
|
||||
Cnf.Set("RPM::Erase-Options::", "--nodeps");
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -431,6 +428,16 @@ bool rpmSystem::IgnoreDep(pkgVersioningSystem &VS,pkgCache::DepIterator &Dep)
|
||||
return rpmdata->IgnoreDep(VS,Dep);
|
||||
}
|
||||
/*}}}*/
|
||||
|
||||
// System::CacheBuilt - free caches used during cache build /*{{{*/
|
||||
// ---------------------------------------------------------------------
|
||||
/* */
|
||||
void rpmSystem::CacheBuilt()
|
||||
{
|
||||
RPMPackageData *rpmdata = RPMPackageData::Singleton();
|
||||
rpmdata->CacheBuilt();
|
||||
}
|
||||
/*}}}*/
|
||||
#endif /* HAVE_RPM */
|
||||
|
||||
// vim:sts=3:sw=3
|
||||
|
@ -64,6 +64,7 @@ class rpmSystem : public pkgSystem
|
||||
pkgIndexFile *&Found) const;
|
||||
virtual bool ProcessCache(pkgDepCache &Cache,pkgProblemResolver &Fix);
|
||||
virtual bool IgnoreDep(pkgVersioningSystem &VS,pkgCache::DepIterator &Dep);
|
||||
virtual void CacheBuilt();
|
||||
|
||||
rpmSystem();
|
||||
virtual ~rpmSystem();
|
||||
|
@ -21,6 +21,13 @@
|
||||
#include <apti18n.h>
|
||||
|
||||
#include <fstream>
|
||||
|
||||
// CNC:2003-03-03 - This is needed for ReadDir stuff.
|
||||
#include <algorithm>
|
||||
#include <stdio.h>
|
||||
#include <dirent.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
/*}}}*/
|
||||
|
||||
using namespace std;
|
||||
@ -234,22 +241,59 @@ bool pkgSourceList::ReadVendors()
|
||||
/* */
|
||||
bool pkgSourceList::ReadMainList()
|
||||
{
|
||||
return ReadVendors() && Read(_config->FindFile("Dir::Etc::sourcelist"));
|
||||
// CNC:2003-03-03 - Multiple sources list support.
|
||||
bool Res = ReadVendors();
|
||||
if (Res == false)
|
||||
return false;
|
||||
|
||||
Reset();
|
||||
string Parts = _config->FindDir("Dir::Etc::sourceparts");
|
||||
if (FileExists(Parts) == true)
|
||||
Res &= ReadSourceDir(Parts);
|
||||
|
||||
string Main = _config->FindFile("Dir::Etc::sourcelist");
|
||||
if (FileExists(Main) == true)
|
||||
Res &= ReadAppend(Main);
|
||||
|
||||
return Res;
|
||||
}
|
||||
/*}}}*/
|
||||
// CNC:2003-03-03 - Needed to preserve backwards compatibility.
|
||||
// SourceList::Reset - Clear the sourcelist contents /*{{{*/
|
||||
// ---------------------------------------------------------------------
|
||||
/* */
|
||||
void pkgSourceList::Reset()
|
||||
{
|
||||
for (const_iterator I = SrcList.begin(); I != SrcList.end(); I++)
|
||||
delete *I;
|
||||
SrcList.erase(SrcList.begin(),SrcList.end());
|
||||
}
|
||||
/*}}}*/
|
||||
// CNC:2003-03-03 - Function moved to ReadAppend() and Reset().
|
||||
// SourceList::Read - Parse the sourcelist file /*{{{*/
|
||||
// ---------------------------------------------------------------------
|
||||
/* */
|
||||
bool pkgSourceList::Read(string File)
|
||||
{
|
||||
Reset();
|
||||
return ReadAppend(File);
|
||||
}
|
||||
/*}}}*/
|
||||
// SourceList::ReadAppend - Parse a sourcelist file /*{{{*/
|
||||
// ---------------------------------------------------------------------
|
||||
/* */
|
||||
bool pkgSourceList::ReadAppend(string File)
|
||||
{
|
||||
// Open the stream for reading
|
||||
ifstream F(File.c_str(),ios::in /*| ios::nocreate*/);
|
||||
if (!F != 0)
|
||||
return _error->Errno("ifstream::ifstream",_("Opening %s"),File.c_str());
|
||||
|
||||
#if 0 // Now Reset() does this.
|
||||
for (const_iterator I = SrcList.begin(); I != SrcList.end(); I++)
|
||||
delete *I;
|
||||
SrcList.erase(SrcList.begin(),SrcList.end());
|
||||
#endif
|
||||
char Buffer[300];
|
||||
|
||||
int CurLine = 0;
|
||||
@ -264,7 +308,10 @@ bool pkgSourceList::Read(string File)
|
||||
|
||||
|
||||
char *I;
|
||||
for (I = Buffer; *I != 0 && *I != '#'; I++);
|
||||
// CNC:2003-02-20 - Do not break if '#' is inside [].
|
||||
for (I = Buffer; *I != 0 && *I != '#'; I++)
|
||||
if (*I == '[')
|
||||
for (I++; *I != 0 && *I != ']'; I++);
|
||||
*I = 0;
|
||||
|
||||
const char *C = _strstrip(Buffer);
|
||||
@ -357,3 +404,51 @@ bool pkgSourceList::GetReleases(pkgAcquire *Owner) const
|
||||
return true;
|
||||
}
|
||||
/*}}}*/
|
||||
// CNC:2003-03-03 - By Anton V. Denisov <avd@altlinux.org>.
|
||||
// SourceList::ReadSourceDir - Read a directory with sources files
|
||||
// Based on ReadConfigDir() /*{{{*/
|
||||
// ---------------------------------------------------------------------
|
||||
/* */
|
||||
bool pkgSourceList::ReadSourceDir(string Dir)
|
||||
{
|
||||
DIR *D = opendir(Dir.c_str());
|
||||
if (D == 0)
|
||||
return _error->Errno("opendir",_("Unable to read %s"),Dir.c_str());
|
||||
|
||||
vector<string> List;
|
||||
|
||||
for (struct dirent *Ent = readdir(D); Ent != 0; Ent = readdir(D))
|
||||
{
|
||||
if (Ent->d_name[0] == '.')
|
||||
continue;
|
||||
|
||||
// Skip bad file names ala run-parts
|
||||
const char *C = Ent->d_name;
|
||||
for (; *C != 0; C++)
|
||||
if (isalpha(*C) == 0 && isdigit(*C) == 0
|
||||
&& *C != '_' && *C != '-' && *C != '.')
|
||||
break;
|
||||
if (*C != 0)
|
||||
continue;
|
||||
|
||||
// Make sure it is a file and not something else
|
||||
string File = flCombine(Dir,Ent->d_name);
|
||||
struct stat St;
|
||||
if (stat(File.c_str(),&St) != 0 || S_ISREG(St.st_mode) == 0)
|
||||
continue;
|
||||
|
||||
List.push_back(File);
|
||||
}
|
||||
closedir(D);
|
||||
|
||||
sort(List.begin(),List.end());
|
||||
|
||||
// Read the files
|
||||
for (vector<string>::const_iterator I = List.begin(); I != List.end(); I++)
|
||||
if (ReadAppend(*I) == false)
|
||||
return false;
|
||||
return true;
|
||||
|
||||
}
|
||||
/*}}}*/
|
||||
|
||||
|
@ -94,6 +94,11 @@ class pkgSourceList
|
||||
bool ReadMainList();
|
||||
bool Read(string File);
|
||||
bool ReadVendors();
|
||||
|
||||
// CNC:2003-03-03
|
||||
void Reset();
|
||||
bool ReadAppend(string File);
|
||||
bool ReadSourceDir(string Dir);
|
||||
|
||||
// List accessors
|
||||
inline const_iterator begin() const {return SrcList.begin();};
|
||||
|
@ -84,8 +84,10 @@ class pkgVersioningSystem
|
||||
virtual ~pkgVersioningSystem() {};
|
||||
};
|
||||
|
||||
|
||||
#ifdef APT_COMPATIBILITY
|
||||
#include <apt-pkg/debversion.h>
|
||||
// CNC:2003-02-21 - We're not compiling the deb subsystem.
|
||||
//#include <apt-pkg/debversion.h>
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -16,6 +16,9 @@
|
||||
# endif
|
||||
#else
|
||||
// apt will not use any gettext
|
||||
// CNC:2003-02-14
|
||||
# define bindtextdomain(a, b)
|
||||
# define textdomain(a)
|
||||
# define setlocale(a, b)
|
||||
# define _(x) x
|
||||
#endif
|
||||
|
160
apt/buildlib/config.guess
vendored
160
apt/buildlib/config.guess
vendored
@ -1,9 +1,9 @@
|
||||
#! /bin/sh
|
||||
# Attempt to guess a canonical system name.
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
||||
# 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
|
||||
|
||||
timestamp='2002-09-03'
|
||||
timestamp='2003-01-10'
|
||||
|
||||
# This file is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by
|
||||
@ -98,30 +98,31 @@ trap 'exit 1' 1 2 15
|
||||
# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
|
||||
# use `HOST_CC' if defined, but it is deprecated.
|
||||
|
||||
# This shell variable is my proudest work .. or something. --bje
|
||||
# Portable tmp directory creation inspired by the Autoconf team.
|
||||
|
||||
set_cc_for_build='tmpdir=${TMPDIR-/tmp}/config-guess-$$ ;
|
||||
(old=`umask` && umask 077 && mkdir $tmpdir && umask $old && unset old)
|
||||
|| (echo "$me: cannot create $tmpdir" >&2 && exit 1) ;
|
||||
dummy=$tmpdir/dummy ;
|
||||
files="$dummy.c $dummy.o $dummy.rel $dummy" ;
|
||||
trap '"'"'rm -f $files; rmdir $tmpdir; exit 1'"'"' 1 2 15 ;
|
||||
set_cc_for_build='
|
||||
trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
|
||||
trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
|
||||
: ${TMPDIR=/tmp} ;
|
||||
{ tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
|
||||
{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
|
||||
{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
|
||||
dummy=$tmp/dummy ;
|
||||
tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
|
||||
case $CC_FOR_BUILD,$HOST_CC,$CC in
|
||||
,,) echo "int x;" > $dummy.c ;
|
||||
for c in cc gcc c89 c99 ; do
|
||||
if ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ; then
|
||||
if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
|
||||
CC_FOR_BUILD="$c"; break ;
|
||||
fi ;
|
||||
done ;
|
||||
rm -f $files ;
|
||||
if test x"$CC_FOR_BUILD" = x ; then
|
||||
CC_FOR_BUILD=no_compiler_found ;
|
||||
fi
|
||||
;;
|
||||
,,*) CC_FOR_BUILD=$CC ;;
|
||||
,*,*) CC_FOR_BUILD=$HOST_CC ;;
|
||||
esac ;
|
||||
unset files'
|
||||
esac ;'
|
||||
|
||||
# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
|
||||
# (ghazi@noc.rutgers.edu 1994-08-24)
|
||||
@ -178,7 +179,18 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
;;
|
||||
esac
|
||||
# The OS release
|
||||
release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
|
||||
# Debian GNU/NetBSD machines have a different userland, and
|
||||
# thus, need a distinct triplet. However, they do not need
|
||||
# kernel version information, so it can be replaced with a
|
||||
# suitable tag, in the style of linux-gnu.
|
||||
case "${UNAME_VERSION}" in
|
||||
Debian*)
|
||||
release='-gnu'
|
||||
;;
|
||||
*)
|
||||
release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
|
||||
;;
|
||||
esac
|
||||
# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
|
||||
# contains redundant information, the shorter form:
|
||||
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
|
||||
@ -223,6 +235,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
*:OpenBSD:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
*:MicroBSD:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-microbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
alpha:OSF1:*:*)
|
||||
if test $UNAME_RELEASE = "V4.0"; then
|
||||
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
|
||||
@ -257,7 +272,7 @@ main:
|
||||
jsr \$26,exit
|
||||
.end main
|
||||
EOF
|
||||
$CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
|
||||
$CC_FOR_BUILD -o $dummy $dummy.s 2>/dev/null
|
||||
if test "$?" = 0 ; then
|
||||
case `$dummy` in
|
||||
0-0)
|
||||
@ -286,7 +301,6 @@ EOF
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
rm -f $dummy.s $dummy && rmdir $tmpdir
|
||||
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
|
||||
exit 0 ;;
|
||||
Alpha\ *:Windows_NT*:*)
|
||||
@ -437,10 +451,9 @@ EOF
|
||||
exit (-1);
|
||||
}
|
||||
EOF
|
||||
$CC_FOR_BUILD $dummy.c -o $dummy \
|
||||
$CC_FOR_BUILD -o $dummy $dummy.c \
|
||||
&& $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
|
||||
&& rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
|
||||
rm -f $dummy.c $dummy && rmdir $tmpdir
|
||||
&& exit 0
|
||||
echo mips-mips-riscos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
Motorola:PowerMAX_OS:*:*)
|
||||
@ -449,7 +462,7 @@ EOF
|
||||
Motorola:*:4.3:PL8-*)
|
||||
echo powerpc-harris-powermax
|
||||
exit 0 ;;
|
||||
Night_Hawk:*:*:PowerMAX_OS)
|
||||
Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
|
||||
echo powerpc-harris-powermax
|
||||
exit 0 ;;
|
||||
Night_Hawk:Power_UNIX:*:*)
|
||||
@ -524,8 +537,7 @@ EOF
|
||||
exit(0);
|
||||
}
|
||||
EOF
|
||||
$CC_FOR_BUILD $dummy.c -o $dummy && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
|
||||
rm -f $dummy.c $dummy && rmdir $tmpdir
|
||||
$CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
|
||||
echo rs6000-ibm-aix3.2.5
|
||||
elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
|
||||
echo rs6000-ibm-aix3.2.4
|
||||
@ -623,11 +635,21 @@ EOF
|
||||
exit (0);
|
||||
}
|
||||
EOF
|
||||
(CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null) && HP_ARCH=`$dummy`
|
||||
if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi
|
||||
rm -f $dummy.c $dummy && rmdir $tmpdir
|
||||
(CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
|
||||
test -z "$HP_ARCH" && HP_ARCH=hppa
|
||||
fi ;;
|
||||
esac
|
||||
if [ ${HP_ARCH} = "hppa2.0w" ]
|
||||
then
|
||||
# avoid double evaluation of $set_cc_for_build
|
||||
test -n "$CC_FOR_BUILD" || eval $set_cc_for_build
|
||||
if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null
|
||||
then
|
||||
HP_ARCH="hppa2.0w"
|
||||
else
|
||||
HP_ARCH="hppa64"
|
||||
fi
|
||||
fi
|
||||
echo ${HP_ARCH}-hp-hpux${HPUX_REV}
|
||||
exit 0 ;;
|
||||
ia64:HP-UX:*:*)
|
||||
@ -661,8 +683,7 @@ EOF
|
||||
exit (0);
|
||||
}
|
||||
EOF
|
||||
$CC_FOR_BUILD $dummy.c -o $dummy && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
|
||||
rm -f $dummy.c $dummy && rmdir $tmpdir
|
||||
$CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
|
||||
echo unknown-hitachi-hiuxwe2
|
||||
exit 0 ;;
|
||||
9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
|
||||
@ -720,15 +741,15 @@ EOF
|
||||
CRAY*TS:*:*:*)
|
||||
echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
|
||||
exit 0 ;;
|
||||
CRAY*T3D:*:*:*)
|
||||
echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
|
||||
exit 0 ;;
|
||||
CRAY*T3E:*:*:*)
|
||||
echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
|
||||
exit 0 ;;
|
||||
CRAY*SV1:*:*:*)
|
||||
echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
|
||||
exit 0 ;;
|
||||
*:UNICOS/mp:*:*)
|
||||
echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
|
||||
exit 0 ;;
|
||||
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
|
||||
FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
|
||||
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
|
||||
@ -756,7 +777,6 @@ EOF
|
||||
#endif
|
||||
EOF
|
||||
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
|
||||
rm -f $dummy.c && rmdir $tmpdir
|
||||
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC}
|
||||
exit 0 ;;
|
||||
i*:CYGWIN*:*)
|
||||
@ -769,13 +789,16 @@ EOF
|
||||
echo ${UNAME_MACHINE}-pc-pw32
|
||||
exit 0 ;;
|
||||
x86:Interix*:3*)
|
||||
echo i386-pc-interix3
|
||||
echo i586-pc-interix3
|
||||
exit 0 ;;
|
||||
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
|
||||
echo i${UNAME_MACHINE}-pc-mks
|
||||
exit 0 ;;
|
||||
i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
|
||||
# How do we know it's Interix rather than the generic POSIX subsystem?
|
||||
# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
|
||||
# UNAME_MACHINE based on the output of uname instead of i386?
|
||||
echo i386-pc-interix
|
||||
echo i586-pc-interix
|
||||
exit 0 ;;
|
||||
i*:UWIN*:*)
|
||||
echo ${UNAME_MACHINE}-pc-uwin
|
||||
@ -818,8 +841,26 @@ EOF
|
||||
#endif
|
||||
EOF
|
||||
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
|
||||
rm -f $dummy.c && rmdir $tmpdir
|
||||
test x"${CPU}" != x && echo "${CPU}-pc-linux-gnu" && exit 0
|
||||
test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
|
||||
;;
|
||||
mips64:Linux:*:*)
|
||||
eval $set_cc_for_build
|
||||
sed 's/^ //' << EOF >$dummy.c
|
||||
#undef CPU
|
||||
#undef mips64
|
||||
#undef mips64el
|
||||
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
|
||||
CPU=mips64el
|
||||
#else
|
||||
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
|
||||
CPU=mips64
|
||||
#else
|
||||
CPU=
|
||||
#endif
|
||||
#endif
|
||||
EOF
|
||||
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
|
||||
test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
|
||||
;;
|
||||
ppc:Linux:*:*)
|
||||
echo powerpc-unknown-linux-gnu
|
||||
@ -914,7 +955,6 @@ EOF
|
||||
#endif
|
||||
EOF
|
||||
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
|
||||
rm -f $dummy.c && rmdir $tmpdir
|
||||
test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
|
||||
test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
|
||||
;;
|
||||
@ -932,6 +972,23 @@ EOF
|
||||
# Use sysv4.2uw... so that sysv4* matches it.
|
||||
echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
|
||||
exit 0 ;;
|
||||
i*86:OS/2:*:*)
|
||||
# If we were able to find `uname', then EMX Unix compatibility
|
||||
# is probably installed.
|
||||
echo ${UNAME_MACHINE}-pc-os2-emx
|
||||
exit 0 ;;
|
||||
i*86:XTS-300:*:STOP)
|
||||
echo ${UNAME_MACHINE}-unknown-stop
|
||||
exit 0 ;;
|
||||
i*86:atheos:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-atheos
|
||||
exit 0 ;;
|
||||
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
|
||||
echo i386-unknown-lynxos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
i*86:*DOS:*:*)
|
||||
echo ${UNAME_MACHINE}-pc-msdosdjgpp
|
||||
exit 0 ;;
|
||||
i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
|
||||
UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
|
||||
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
|
||||
@ -966,9 +1023,6 @@ EOF
|
||||
echo ${UNAME_MACHINE}-pc-sysv32
|
||||
fi
|
||||
exit 0 ;;
|
||||
i*86:*DOS:*:*)
|
||||
echo ${UNAME_MACHINE}-pc-msdosdjgpp
|
||||
exit 0 ;;
|
||||
pc:*:*:*)
|
||||
# Left here for compatibility:
|
||||
# uname -m prints for DJGPP always 'pc', but it prints nothing about
|
||||
@ -995,9 +1049,12 @@ EOF
|
||||
mc68k:UNIX:SYSTEM5:3.51m)
|
||||
echo m68k-convergent-sysv
|
||||
exit 0 ;;
|
||||
M680?0:D-NIX:5.3:*)
|
||||
echo m68k-diab-dnix
|
||||
exit 0 ;;
|
||||
M68*:*:R3V[567]*:*)
|
||||
test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
|
||||
3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0)
|
||||
3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0)
|
||||
OS_REL=''
|
||||
test -r /etc/.relid \
|
||||
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
|
||||
@ -1014,9 +1071,6 @@ EOF
|
||||
mc68030:UNIX_System_V:4.*:*)
|
||||
echo m68k-atari-sysv4
|
||||
exit 0 ;;
|
||||
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
|
||||
echo i386-unknown-lynxos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
TSUNAMI:LynxOS:2.*:*)
|
||||
echo sparc-unknown-lynxos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
@ -1098,7 +1152,11 @@ EOF
|
||||
echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
*:Darwin:*:*)
|
||||
echo `uname -p`-apple-darwin${UNAME_RELEASE}
|
||||
case `uname -p` in
|
||||
*86) UNAME_PROCESSOR=i686 ;;
|
||||
powerpc) UNAME_PROCESSOR=powerpc ;;
|
||||
esac
|
||||
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
*:procnto*:*:* | *:QNX:[0123456789]*:*)
|
||||
UNAME_PROCESSOR=`uname -p`
|
||||
@ -1134,11 +1192,6 @@ EOF
|
||||
fi
|
||||
echo ${UNAME_MACHINE}-unknown-plan9
|
||||
exit 0 ;;
|
||||
i*86:OS/2:*:*)
|
||||
# If we were able to find `uname', then EMX Unix compatibility
|
||||
# is probably installed.
|
||||
echo ${UNAME_MACHINE}-pc-os2-emx
|
||||
exit 0 ;;
|
||||
*:TOPS-10:*:*)
|
||||
echo pdp10-unknown-tops10
|
||||
exit 0 ;;
|
||||
@ -1157,12 +1210,6 @@ EOF
|
||||
*:ITS:*:*)
|
||||
echo pdp10-unknown-its
|
||||
exit 0 ;;
|
||||
i*86:XTS-300:*:STOP)
|
||||
echo ${UNAME_MACHINE}-unknown-stop
|
||||
exit 0 ;;
|
||||
i*86:atheos:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-atheos
|
||||
exit 0 ;;
|
||||
esac
|
||||
|
||||
#echo '(No uname command or uname output not recognized.)' 1>&2
|
||||
@ -1283,8 +1330,7 @@ main ()
|
||||
}
|
||||
EOF
|
||||
|
||||
$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
|
||||
rm -f $dummy.c $dummy && rmdir $tmpdir
|
||||
$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0
|
||||
|
||||
# Apollos put the system type in the environment.
|
||||
|
||||
|
@ -52,3 +52,4 @@
|
||||
#undef HAVE_LOCALE_H
|
||||
#undef HAVE_LIBINTL_H
|
||||
#undef LOCALEDIR
|
||||
#undef WITH_HASH_MAP
|
||||
|
513
apt/buildlib/config.rpath
Normal file
513
apt/buildlib/config.rpath
Normal file
@ -0,0 +1,513 @@
|
||||
#! /bin/sh
|
||||
# Output a system dependent set of variables, describing how to set the
|
||||
# run time search path of shared libraries in an executable.
|
||||
#
|
||||
# Copyright 1996-2002 Free Software Foundation, Inc.
|
||||
# Taken from GNU libtool, 2001
|
||||
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
#
|
||||
# The first argument passed to this file is the canonical host specification,
|
||||
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
|
||||
# or
|
||||
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
|
||||
# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
|
||||
# should be set by the caller.
|
||||
#
|
||||
# The set of defined variables is at the end of this script.
|
||||
|
||||
# All known linkers require a `.a' archive for static linking (except M$VC,
|
||||
# which needs '.lib').
|
||||
libext=a
|
||||
shlibext=
|
||||
|
||||
host="$1"
|
||||
host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
|
||||
host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
|
||||
host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
|
||||
|
||||
wl=
|
||||
if test "$GCC" = yes; then
|
||||
wl='-Wl,'
|
||||
else
|
||||
case "$host_os" in
|
||||
aix3* | aix4* | aix5*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
hpux9* | hpux10* | hpux11*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
irix5* | irix6*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
linux*)
|
||||
echo '__INTEL_COMPILER' > conftest.$ac_ext
|
||||
if $CC -E conftest.$ac_ext >/dev/null | grep __INTEL_COMPILER >/dev/null
|
||||
then
|
||||
:
|
||||
else
|
||||
# Intel icc
|
||||
wl='-Qoption,ld,'
|
||||
fi
|
||||
;;
|
||||
osf3* | osf4* | osf5*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
solaris*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
sunos4*)
|
||||
wl='-Qoption ld '
|
||||
;;
|
||||
sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
|
||||
if test "x$host_vendor" = xsni; then
|
||||
wl='-LD'
|
||||
else
|
||||
wl='-Wl,'
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
hardcode_libdir_flag_spec=
|
||||
hardcode_libdir_separator=
|
||||
hardcode_direct=no
|
||||
hardcode_minus_L=no
|
||||
|
||||
case "$host_os" in
|
||||
cygwin* | mingw* | pw32*)
|
||||
# FIXME: the MSVC++ port hasn't been tested in a loooong time
|
||||
# When not using gcc, we currently assume that we are using
|
||||
# Microsoft Visual C++.
|
||||
if test "$GCC" != yes; then
|
||||
with_gnu_ld=no
|
||||
fi
|
||||
;;
|
||||
openbsd*)
|
||||
with_gnu_ld=no
|
||||
;;
|
||||
esac
|
||||
|
||||
ld_shlibs=yes
|
||||
if test "$with_gnu_ld" = yes; then
|
||||
case "$host_os" in
|
||||
aix3* | aix4* | aix5*)
|
||||
# On AIX, the GNU linker is very broken
|
||||
ld_shlibs=no
|
||||
;;
|
||||
amigaos*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_minus_L=yes
|
||||
# Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
|
||||
# that the semantics of dynamic libraries on AmigaOS, at least up
|
||||
# to version 4, is to share data among multiple programs linked
|
||||
# with the same dynamic library. Since this doesn't match the
|
||||
# behavior of shared libraries on other platforms, we can use
|
||||
# them.
|
||||
ld_shlibs=no
|
||||
;;
|
||||
beos*)
|
||||
if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
|
||||
:
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
cygwin* | mingw* | pw32*)
|
||||
# hardcode_libdir_flag_spec is actually meaningless, as there is
|
||||
# no search path for DLLs.
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
;;
|
||||
solaris* | sysv5*)
|
||||
if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then
|
||||
ld_shlibs=no
|
||||
elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
|
||||
:
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
sunos4*)
|
||||
hardcode_direct=yes
|
||||
;;
|
||||
*)
|
||||
if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
|
||||
:
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
if test "$ld_shlibs" = yes; then
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
fi
|
||||
else
|
||||
case "$host_os" in
|
||||
aix3*)
|
||||
# Note: this linker hardcodes the directories in LIBPATH if there
|
||||
# are no directories specified by -L.
|
||||
hardcode_minus_L=yes
|
||||
if test "$GCC" = yes; then
|
||||
# Neither direct hardcoding nor static linking is supported with a
|
||||
# broken collect2.
|
||||
hardcode_direct=unsupported
|
||||
fi
|
||||
;;
|
||||
aix4* | aix5*)
|
||||
if test "$host_cpu" = ia64; then
|
||||
# On IA64, the linker does run time linking by default, so we don't
|
||||
# have to do anything special.
|
||||
aix_use_runtimelinking=no
|
||||
else
|
||||
aix_use_runtimelinking=no
|
||||
# Test if we are trying to use run time linking or normal
|
||||
# AIX style linking. If -brtl is somewhere in LDFLAGS, we
|
||||
# need to do runtime linking.
|
||||
case $host_os in aix4.[23]|aix4.[23].*|aix5*)
|
||||
for ld_flag in $LDFLAGS; do
|
||||
if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
|
||||
aix_use_runtimelinking=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
esac
|
||||
fi
|
||||
hardcode_direct=yes
|
||||
hardcode_libdir_separator=':'
|
||||
if test "$GCC" = yes; then
|
||||
case $host_os in aix4.[012]|aix4.[012].*)
|
||||
collect2name=`${CC} -print-prog-name=collect2`
|
||||
if test -f "$collect2name" && \
|
||||
strings "$collect2name" | grep resolve_lib_name >/dev/null
|
||||
then
|
||||
# We have reworked collect2
|
||||
hardcode_direct=yes
|
||||
else
|
||||
# We have old collect2
|
||||
hardcode_direct=unsupported
|
||||
hardcode_minus_L=yes
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_libdir_separator=
|
||||
fi
|
||||
esac
|
||||
fi
|
||||
if test "$aix_use_runtimelinking" = yes; then
|
||||
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
|
||||
else
|
||||
if test "$host_cpu" = ia64; then
|
||||
hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
|
||||
else
|
||||
hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib'
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
amigaos*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_minus_L=yes
|
||||
# see comment about different semantics on the GNU ld section
|
||||
ld_shlibs=no
|
||||
;;
|
||||
cygwin* | mingw* | pw32*)
|
||||
# When not using gcc, we currently assume that we are using
|
||||
# Microsoft Visual C++.
|
||||
# hardcode_libdir_flag_spec is actually meaningless, as there is
|
||||
# no search path for DLLs.
|
||||
hardcode_libdir_flag_spec=' '
|
||||
libext=lib
|
||||
;;
|
||||
darwin* | rhapsody*)
|
||||
hardcode_direct=yes
|
||||
;;
|
||||
freebsd1*)
|
||||
ld_shlibs=no
|
||||
;;
|
||||
freebsd2.2*)
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
hardcode_direct=yes
|
||||
;;
|
||||
freebsd2*)
|
||||
hardcode_direct=yes
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
freebsd*)
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
hardcode_direct=yes
|
||||
;;
|
||||
hpux9* | hpux10* | hpux11*)
|
||||
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
hardcode_direct=yes
|
||||
hardcode_minus_L=yes # Not in the search PATH, but as the default
|
||||
# location of the library.
|
||||
;;
|
||||
irix5* | irix6*)
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
;;
|
||||
netbsd*)
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
hardcode_direct=yes
|
||||
;;
|
||||
newsos6)
|
||||
hardcode_direct=yes
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
;;
|
||||
openbsd*)
|
||||
hardcode_direct=yes
|
||||
if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
|
||||
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
|
||||
else
|
||||
case "$host_os" in
|
||||
openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
;;
|
||||
*)
|
||||
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
;;
|
||||
os2*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
osf3*)
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
;;
|
||||
osf4* | osf5*)
|
||||
if test "$GCC" = yes; then
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
else
|
||||
# Both cc and cxx compiler support -rpath directly
|
||||
hardcode_libdir_flag_spec='-rpath $libdir'
|
||||
fi
|
||||
hardcode_libdir_separator=:
|
||||
;;
|
||||
sco3.2v5*)
|
||||
;;
|
||||
solaris*)
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
;;
|
||||
sunos4*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_direct=yes
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
sysv4)
|
||||
if test "x$host_vendor" = xsno; then
|
||||
hardcode_direct=yes # is this really true???
|
||||
else
|
||||
hardcode_direct=no # Motorola manual says yes, but my tests say they lie
|
||||
fi
|
||||
;;
|
||||
sysv4.3*)
|
||||
;;
|
||||
sysv5*)
|
||||
hardcode_libdir_flag_spec=
|
||||
;;
|
||||
uts4*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
;;
|
||||
dgux*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
;;
|
||||
sysv4*MP*)
|
||||
if test -d /usr/nec; then
|
||||
ld_shlibs=yes
|
||||
fi
|
||||
;;
|
||||
sysv4.2uw2*)
|
||||
hardcode_direct=yes
|
||||
hardcode_minus_L=no
|
||||
;;
|
||||
sysv5uw7* | unixware7*)
|
||||
;;
|
||||
*)
|
||||
ld_shlibs=no
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Check dynamic linker characteristics
|
||||
libname_spec='lib$name'
|
||||
sys_lib_dlsearch_path_spec="/lib /usr/lib"
|
||||
sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
|
||||
case "$host_os" in
|
||||
aix3*)
|
||||
shlibext=so
|
||||
;;
|
||||
aix4* | aix5*)
|
||||
shlibext=so
|
||||
;;
|
||||
amigaos*)
|
||||
shlibext=ixlibrary
|
||||
;;
|
||||
beos*)
|
||||
shlibext=so
|
||||
;;
|
||||
bsdi4*)
|
||||
shlibext=so
|
||||
sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
|
||||
sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
|
||||
;;
|
||||
cygwin* | mingw* | pw32*)
|
||||
case $GCC,$host_os in
|
||||
yes,cygwin*)
|
||||
shlibext=dll.a
|
||||
;;
|
||||
yes,mingw*)
|
||||
shlibext=dll
|
||||
sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g"`
|
||||
;;
|
||||
yes,pw32*)
|
||||
shlibext=dll
|
||||
;;
|
||||
*)
|
||||
shlibext=dll
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
darwin* | rhapsody*)
|
||||
shlibext=dylib
|
||||
;;
|
||||
freebsd1*)
|
||||
;;
|
||||
freebsd*)
|
||||
shlibext=so
|
||||
;;
|
||||
gnu*)
|
||||
shlibext=so
|
||||
;;
|
||||
hpux9* | hpux10* | hpux11*)
|
||||
shlibext=sl
|
||||
;;
|
||||
irix5* | irix6*)
|
||||
shlibext=so
|
||||
case "$host_os" in
|
||||
irix5*)
|
||||
libsuff= shlibsuff=
|
||||
;;
|
||||
*)
|
||||
case $LD in
|
||||
*-32|*"-32 ") libsuff= shlibsuff= ;;
|
||||
*-n32|*"-n32 ") libsuff=32 shlibsuff=N32 ;;
|
||||
*-64|*"-64 ") libsuff=64 shlibsuff=64 ;;
|
||||
*) libsuff= shlibsuff= ;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
|
||||
sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
|
||||
;;
|
||||
linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*)
|
||||
;;
|
||||
linux-gnu*)
|
||||
shlibext=so
|
||||
;;
|
||||
netbsd*)
|
||||
shlibext=so
|
||||
;;
|
||||
newsos6)
|
||||
shlibext=so
|
||||
;;
|
||||
openbsd*)
|
||||
shlibext=so
|
||||
;;
|
||||
os2*)
|
||||
libname_spec='$name'
|
||||
shlibext=dll
|
||||
;;
|
||||
osf3* | osf4* | osf5*)
|
||||
shlibext=so
|
||||
sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
|
||||
sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
|
||||
;;
|
||||
sco3.2v5*)
|
||||
shlibext=so
|
||||
;;
|
||||
solaris*)
|
||||
shlibext=so
|
||||
;;
|
||||
sunos4*)
|
||||
shlibext=so
|
||||
;;
|
||||
sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
|
||||
shlibext=so
|
||||
case "$host_vendor" in
|
||||
motorola)
|
||||
sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
uts4*)
|
||||
shlibext=so
|
||||
;;
|
||||
dgux*)
|
||||
shlibext=so
|
||||
;;
|
||||
sysv4*MP*)
|
||||
if test -d /usr/nec; then
|
||||
shlibext=so
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
|
||||
escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
|
||||
escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
|
||||
escaped_sys_lib_search_path_spec=`echo "X$sys_lib_search_path_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
|
||||
escaped_sys_lib_dlsearch_path_spec=`echo "X$sys_lib_dlsearch_path_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
|
||||
|
||||
sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
|
||||
|
||||
# How to pass a linker flag through the compiler.
|
||||
wl="$escaped_wl"
|
||||
|
||||
# Static library suffix (normally "a").
|
||||
libext="$libext"
|
||||
|
||||
# Shared library suffix (normally "so").
|
||||
shlibext="$shlibext"
|
||||
|
||||
# Flag to hardcode \$libdir into a binary during linking.
|
||||
# This must work even if \$libdir does not exist.
|
||||
hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
|
||||
|
||||
# Whether we need a single -rpath flag with a separated argument.
|
||||
hardcode_libdir_separator="$hardcode_libdir_separator"
|
||||
|
||||
# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
|
||||
# resulting binary.
|
||||
hardcode_direct="$hardcode_direct"
|
||||
|
||||
# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
|
||||
# resulting binary.
|
||||
hardcode_minus_L="$hardcode_minus_L"
|
||||
|
||||
# Compile-time system search path for libraries
|
||||
sys_lib_search_path_spec="$escaped_sys_lib_search_path_spec"
|
||||
|
||||
# Run-time system search path for libraries
|
||||
sys_lib_dlsearch_path_spec="$escaped_sys_lib_dlsearch_path_spec"
|
||||
|
||||
EOF
|
35
apt/buildlib/config.sub
vendored
35
apt/buildlib/config.sub
vendored
@ -1,9 +1,9 @@
|
||||
#! /bin/sh
|
||||
# Configuration validation subroutine script.
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
||||
# 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
|
||||
|
||||
timestamp='2002-09-05'
|
||||
timestamp='2003-01-03'
|
||||
|
||||
# This file is (in principle) common to ALL GNU software.
|
||||
# The presence of a machine in this file suggests that SOME GNU software
|
||||
@ -118,7 +118,7 @@ esac
|
||||
# Here we must recognize all the valid KERNEL-OS combinations.
|
||||
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
|
||||
case $maybe_os in
|
||||
nto-qnx* | linux-gnu* | freebsd*-gnu* | storm-chaos* | os2-emx* | windows32-* | rtmk-nova*)
|
||||
nto-qnx* | linux-gnu* | freebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
|
||||
os=-$maybe_os
|
||||
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
|
||||
;;
|
||||
@ -245,11 +245,13 @@ case $basic_machine in
|
||||
| mips64vr4300 | mips64vr4300el \
|
||||
| mips64vr5000 | mips64vr5000el \
|
||||
| mipsisa32 | mipsisa32el \
|
||||
| mipsisa32r2 | mipsisa32r2el \
|
||||
| mipsisa64 | mipsisa64el \
|
||||
| mipsisa64sb1 | mipsisa64sb1el \
|
||||
| mipsisa64sr71k | mipsisa64sr71kel \
|
||||
| mipstx39 | mipstx39el \
|
||||
| mn10200 | mn10300 \
|
||||
| msp430 \
|
||||
| ns16k | ns32k \
|
||||
| openrisc | or32 \
|
||||
| pdp10 | pdp11 | pj | pjl \
|
||||
@ -315,11 +317,13 @@ case $basic_machine in
|
||||
| mips64vr4300-* | mips64vr4300el-* \
|
||||
| mips64vr5000-* | mips64vr5000el-* \
|
||||
| mipsisa32-* | mipsisa32el-* \
|
||||
| mipsisa32r2-* | mipsisa32r2el-* \
|
||||
| mipsisa64-* | mipsisa64el-* \
|
||||
| mipsisa64sb1-* | mipsisa64sb1el-* \
|
||||
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
|
||||
| mipstx39 | mipstx39el \
|
||||
| none-* | np1-* | ns16k-* | ns32k-* \
|
||||
| mipstx39-* | mipstx39el-* \
|
||||
| msp430-* \
|
||||
| none-* | np1-* | nv1-* | ns16k-* | ns32k-* \
|
||||
| orion-* \
|
||||
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
|
||||
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
|
||||
@ -716,6 +720,10 @@ case $basic_machine in
|
||||
np1)
|
||||
basic_machine=np1-gould
|
||||
;;
|
||||
nv1)
|
||||
basic_machine=nv1-cray
|
||||
os=-unicosmp
|
||||
;;
|
||||
nsr-tandem)
|
||||
basic_machine=nsr-tandem
|
||||
;;
|
||||
@ -901,10 +909,6 @@ case $basic_machine in
|
||||
basic_machine=i386-sequent
|
||||
os=-dynix
|
||||
;;
|
||||
t3d)
|
||||
basic_machine=alpha-cray
|
||||
os=-unicos
|
||||
;;
|
||||
t3e)
|
||||
basic_machine=alphaev5-cray
|
||||
os=-unicos
|
||||
@ -977,10 +981,6 @@ case $basic_machine in
|
||||
basic_machine=hppa1.1-winbond
|
||||
os=-proelf
|
||||
;;
|
||||
windows32)
|
||||
basic_machine=i386-pc
|
||||
os=-windows32-msvcrt
|
||||
;;
|
||||
xps | xps100)
|
||||
basic_machine=xps100-honeywell
|
||||
;;
|
||||
@ -1113,11 +1113,12 @@ case $os in
|
||||
| -chorusos* | -chorusrdb* \
|
||||
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
||||
| -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
|
||||
| -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \
|
||||
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
|
||||
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
|
||||
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
|
||||
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
|
||||
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* | -powermax*)
|
||||
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
|
||||
| -powermax* | -dnix* | -microbsd*)
|
||||
# Remember, each alternative MUST END IN *, to match a version number.
|
||||
;;
|
||||
-qnx*)
|
||||
@ -1129,8 +1130,10 @@ case $os in
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
-nto-qnx*)
|
||||
;;
|
||||
-nto*)
|
||||
os=-nto-qnx
|
||||
os=`echo $os | sed -e 's|nto|nto-qnx|'`
|
||||
;;
|
||||
-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
|
||||
| -windows* | -osx | -abug | -netware* | -os9* | -beos* \
|
||||
|
@ -5,6 +5,8 @@
|
||||
# Input
|
||||
# $(SOURCE) - The documents to use
|
||||
# $(TO) - The directory to put them in
|
||||
# $(TARGET) - The global target to add the local target as a dependency
|
||||
# to.
|
||||
# All output is writtin to files in the build/$(TO) directory
|
||||
|
||||
# See defaults.mak for information about LOCAL
|
||||
@ -14,7 +16,7 @@ LOCAL := copy-$(firstword $(SOURCE))
|
||||
$(LOCAL)-LIST := $(addprefix $(TO)/,$(SOURCE))
|
||||
|
||||
# Install generation hooks
|
||||
doc: $($(LOCAL)-LIST)
|
||||
$(TARGET): $($(LOCAL)-LIST)
|
||||
veryclean: veryclean/$(LOCAL)
|
||||
|
||||
MKDIRS += $(dir $($(LOCAL)-LIST))
|
||||
|
@ -24,6 +24,9 @@ RANLIB:=@RANLIB@
|
||||
# RPM stuff
|
||||
RPMLIBS:= @RPMLIBS@
|
||||
|
||||
# CNC:2003-03-05
|
||||
COMPILE_APTSHELL = @COMPILE_APTSHELL@
|
||||
|
||||
# Dep generation - this only works for gnu stuff
|
||||
GCC3DEP = @GCC3DEP@
|
||||
INLINEDEPFLAG = -MD
|
||||
@ -33,15 +36,15 @@ DEBIANDOC_HTML = @DEBIANDOC_HTML@
|
||||
DEBIANDOC_TEXT = @DEBIANDOC_TEXT@
|
||||
|
||||
# SGML for the man pages
|
||||
NSGMLS = @NSGMLS@
|
||||
SGMLSPL = @SGMLSPL@
|
||||
DOCBOOK2MAN := $(wildcard /usr/lib/perl5/sgmlspl-specs/docbook2man-spec.pl)
|
||||
DOCBOOK2MAN := @DOCBOOK2MAN@
|
||||
|
||||
# Gettext settings
|
||||
GMSGFMT = @GMSGFMT@
|
||||
XGETTEXT = @XGETTEXT@
|
||||
MSGCOMM:=$(dir $(XGETTEXT))/msgcomm
|
||||
MSGMERGE:=$(dir $(XGETTEXT))/msgmerge
|
||||
# CNC:2002-02-19
|
||||
#MSGMERGE:=$(dir $(XGETTEXT))/msgmerge
|
||||
MSGMERGE = @MSGMERGE@
|
||||
BASH = @BASH@
|
||||
|
||||
# Various library checks
|
||||
@ -52,6 +55,7 @@ PYTHONPREFIX = @PYTHONPREFIX@
|
||||
PYTHONEXECPREFIX = @PYTHONEXECPREFIX@
|
||||
PYTHONINCLUDE = @PYTHONINCLUDE@
|
||||
DB2LIB = @DB2LIB@
|
||||
INTLLIBS = @INTLLIBS@
|
||||
|
||||
# Shim Headerfile control
|
||||
HAVE_C9X = @HAVE_C9X@
|
||||
|
336
apt/buildlib/missing
Normal file
336
apt/buildlib/missing
Normal file
@ -0,0 +1,336 @@
|
||||
#! /bin/sh
|
||||
# Common stub for a few missing GNU programs while installing.
|
||||
# Copyright (C) 1996, 1997, 1999, 2000, 2002 Free Software Foundation, Inc.
|
||||
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
|
||||
|
||||
# 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, 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.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
if test $# -eq 0; then
|
||||
echo 1>&2 "Try \`$0 --help' for more information"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
run=:
|
||||
|
||||
# In the cases where this matters, `missing' is being run in the
|
||||
# srcdir already.
|
||||
if test -f configure.ac; then
|
||||
configure_ac=configure.ac
|
||||
else
|
||||
configure_ac=configure.in
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
--run)
|
||||
# Try to run requested program, and just exit if it succeeds.
|
||||
run=
|
||||
shift
|
||||
"$@" && exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
# If it does not exist, or fails to run (possibly an outdated version),
|
||||
# try to emulate it.
|
||||
case "$1" in
|
||||
|
||||
-h|--h|--he|--hel|--help)
|
||||
echo "\
|
||||
$0 [OPTION]... PROGRAM [ARGUMENT]...
|
||||
|
||||
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
|
||||
error status if there is no known handling for PROGRAM.
|
||||
|
||||
Options:
|
||||
-h, --help display this help and exit
|
||||
-v, --version output version information and exit
|
||||
--run try to run the given command, and emulate it if it fails
|
||||
|
||||
Supported PROGRAM values:
|
||||
aclocal touch file \`aclocal.m4'
|
||||
autoconf touch file \`configure'
|
||||
autoheader touch file \`config.h.in'
|
||||
automake touch all \`Makefile.in' files
|
||||
bison create \`y.tab.[ch]', if possible, from existing .[ch]
|
||||
flex create \`lex.yy.c', if possible, from existing .c
|
||||
help2man touch the output file
|
||||
lex create \`lex.yy.c', if possible, from existing .c
|
||||
makeinfo touch the output file
|
||||
tar try tar, gnutar, gtar, then tar without non-portable flags
|
||||
yacc create \`y.tab.[ch]', if possible, from existing .[ch]"
|
||||
;;
|
||||
|
||||
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
|
||||
echo "missing 0.4 - GNU automake"
|
||||
;;
|
||||
|
||||
-*)
|
||||
echo 1>&2 "$0: Unknown \`$1' option"
|
||||
echo 1>&2 "Try \`$0 --help' for more information"
|
||||
exit 1
|
||||
;;
|
||||
|
||||
aclocal*)
|
||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||
# We have it, but it failed.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
|
||||
to install the \`Automake' and \`Perl' packages. Grab them from
|
||||
any GNU archive site."
|
||||
touch aclocal.m4
|
||||
;;
|
||||
|
||||
autoconf)
|
||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||
# We have it, but it failed.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified \`${configure_ac}'. You might want to install the
|
||||
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
|
||||
archive site."
|
||||
touch configure
|
||||
;;
|
||||
|
||||
autoheader)
|
||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||
# We have it, but it failed.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified \`acconfig.h' or \`${configure_ac}'. You might want
|
||||
to install the \`Autoconf' and \`GNU m4' packages. Grab them
|
||||
from any GNU archive site."
|
||||
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
|
||||
test -z "$files" && files="config.h"
|
||||
touch_files=
|
||||
for f in $files; do
|
||||
case "$f" in
|
||||
*:*) touch_files="$touch_files "`echo "$f" |
|
||||
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
|
||||
*) touch_files="$touch_files $f.in";;
|
||||
esac
|
||||
done
|
||||
touch $touch_files
|
||||
;;
|
||||
|
||||
automake*)
|
||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||
# We have it, but it failed.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
|
||||
You might want to install the \`Automake' and \`Perl' packages.
|
||||
Grab them from any GNU archive site."
|
||||
find . -type f -name Makefile.am -print |
|
||||
sed 's/\.am$/.in/' |
|
||||
while read f; do touch "$f"; done
|
||||
;;
|
||||
|
||||
autom4te)
|
||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||
# We have it, but it failed.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is needed, and you do not seem to have it handy on your
|
||||
system. You might have modified some files without having the
|
||||
proper tools for further handling them.
|
||||
You can get \`$1Help2man' as part of \`Autoconf' from any GNU
|
||||
archive site."
|
||||
|
||||
file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
|
||||
test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
|
||||
if test -f "$file"; then
|
||||
touch $file
|
||||
else
|
||||
test -z "$file" || exec >$file
|
||||
echo "#! /bin/sh"
|
||||
echo "# Created by GNU Automake missing as a replacement of"
|
||||
echo "# $ $@"
|
||||
echo "exit 0"
|
||||
chmod +x $file
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
bison|yacc)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified a \`.y' file. You may need the \`Bison' package
|
||||
in order for those modifications to take effect. You can get
|
||||
\`Bison' from any GNU archive site."
|
||||
rm -f y.tab.c y.tab.h
|
||||
if [ $# -ne 1 ]; then
|
||||
eval LASTARG="\${$#}"
|
||||
case "$LASTARG" in
|
||||
*.y)
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
|
||||
if [ -f "$SRCFILE" ]; then
|
||||
cp "$SRCFILE" y.tab.c
|
||||
fi
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
|
||||
if [ -f "$SRCFILE" ]; then
|
||||
cp "$SRCFILE" y.tab.h
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if [ ! -f y.tab.h ]; then
|
||||
echo >y.tab.h
|
||||
fi
|
||||
if [ ! -f y.tab.c ]; then
|
||||
echo 'main() { return 0; }' >y.tab.c
|
||||
fi
|
||||
;;
|
||||
|
||||
lex|flex)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified a \`.l' file. You may need the \`Flex' package
|
||||
in order for those modifications to take effect. You can get
|
||||
\`Flex' from any GNU archive site."
|
||||
rm -f lex.yy.c
|
||||
if [ $# -ne 1 ]; then
|
||||
eval LASTARG="\${$#}"
|
||||
case "$LASTARG" in
|
||||
*.l)
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
|
||||
if [ -f "$SRCFILE" ]; then
|
||||
cp "$SRCFILE" lex.yy.c
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if [ ! -f lex.yy.c ]; then
|
||||
echo 'main() { return 0; }' >lex.yy.c
|
||||
fi
|
||||
;;
|
||||
|
||||
help2man)
|
||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||
# We have it, but it failed.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified a dependency of a manual page. You may need the
|
||||
\`Help2man' package in order for those modifications to take
|
||||
effect. You can get \`Help2man' from any GNU archive site."
|
||||
|
||||
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
|
||||
if test -z "$file"; then
|
||||
file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
|
||||
fi
|
||||
if [ -f "$file" ]; then
|
||||
touch $file
|
||||
else
|
||||
test -z "$file" || exec >$file
|
||||
echo ".ab help2man is required to generate this page"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
makeinfo)
|
||||
if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
|
||||
# We have makeinfo, but it failed.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified a \`.texi' or \`.texinfo' file, or any other file
|
||||
indirectly affecting the aspect of the manual. The spurious
|
||||
call might also be the consequence of using a buggy \`make' (AIX,
|
||||
DU, IRIX). You might want to install the \`Texinfo' package or
|
||||
the \`GNU make' package. Grab either from any GNU archive site."
|
||||
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
|
||||
if test -z "$file"; then
|
||||
file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
|
||||
file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
|
||||
fi
|
||||
touch $file
|
||||
;;
|
||||
|
||||
tar)
|
||||
shift
|
||||
if test -n "$run"; then
|
||||
echo 1>&2 "ERROR: \`tar' requires --run"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# We have already tried tar in the generic part.
|
||||
# Look for gnutar/gtar before invocation to avoid ugly error
|
||||
# messages.
|
||||
if (gnutar --version > /dev/null 2>&1); then
|
||||
gnutar "$@" && exit 0
|
||||
fi
|
||||
if (gtar --version > /dev/null 2>&1); then
|
||||
gtar "$@" && exit 0
|
||||
fi
|
||||
firstarg="$1"
|
||||
if shift; then
|
||||
case "$firstarg" in
|
||||
*o*)
|
||||
firstarg=`echo "$firstarg" | sed s/o//`
|
||||
tar "$firstarg" "$@" && exit 0
|
||||
;;
|
||||
esac
|
||||
case "$firstarg" in
|
||||
*h*)
|
||||
firstarg=`echo "$firstarg" | sed s/h//`
|
||||
tar "$firstarg" "$@" && exit 0
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: I can't seem to be able to run \`tar' with the given arguments.
|
||||
You may want to install GNU tar or Free paxutils, or check the
|
||||
command line arguments."
|
||||
exit 1
|
||||
;;
|
||||
|
||||
*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is needed, and you do not seem to have it handy on your
|
||||
system. You might have modified some files without having the
|
||||
proper tools for further handling them. Check the \`README' file,
|
||||
it often tells you about the needed prerequirements for installing
|
||||
this package. You may also peek at any GNU archive site, in case
|
||||
some other package would contain this missing \`$1' program."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
@ -14,7 +14,7 @@ MKDIRS += $(PO_DOMAINS)/$(MY_DOMAIN)
|
||||
$(PO_DOMAINS)/$(MY_DOMAIN)/$(LOCAL).$(TYPE)list: SRC := $(addprefix $(SUBDIR)/,$(SOURCE))
|
||||
$(PO_DOMAINS)/$(MY_DOMAIN)/$(LOCAL).$(TYPE)list: makefile
|
||||
(echo $(SRC) | xargs -n1 echo) > $@
|
||||
all: $(PO_DOMAINS)/$(MY_DOMAIN)/$(LOCAL).$(TYPE)list
|
||||
binary program: $(PO_DOMAINS)/$(MY_DOMAIN)/$(LOCAL).$(TYPE)list
|
||||
|
||||
veryclean: veryclean/$(LOCAL)
|
||||
veryclean/po/$(LOCAL): LIST := $(PO_DOMAINS)/$(MY_DOMAIN)/$(LOCAL).$(TYPE)list
|
||||
|
@ -11,8 +11,6 @@
|
||||
# See defaults.mak for information about LOCAL
|
||||
|
||||
# Some local definitions
|
||||
ifdef NSGMLS
|
||||
ifdef SGMLSPL
|
||||
ifdef DOCBOOK2MAN
|
||||
|
||||
LOCAL := sgml-manpage-$(firstword $(SOURCE))
|
||||
@ -24,7 +22,7 @@ veryclean: veryclean/$(LOCAL)
|
||||
|
||||
$($(LOCAL)-LIST) :: % : %.sgml $(INCLUDES)
|
||||
echo Creating man page $@
|
||||
$(NSGMLS) $< | $(SGMLSPL) $(DOCBOOK2MAN)
|
||||
$(DOCBOOK2MAN) $<
|
||||
|
||||
# Clean rule
|
||||
.PHONY: veryclean/$(LOCAL)
|
||||
@ -33,8 +31,6 @@ veryclean/$(LOCAL):
|
||||
|
||||
HAVE_SGML=yes
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
INCLUDES :=
|
||||
|
||||
|
@ -18,6 +18,9 @@ $(LOCAL)-DEP := $(addprefix $(DEP)/,$(addsuffix .o.d,$(notdir $(basename $(SOURC
|
||||
$(LOCAL)-HEADERS := $(addprefix $(INCLUDE)/,$(HEADERS))
|
||||
$(LOCAL)-LIB := $(LIB)/lib$(LIBRARY).a
|
||||
|
||||
# CNC:2003-02-14
|
||||
include $(PODOMAIN_H)
|
||||
|
||||
# Install the command hooks
|
||||
headers: $($(LOCAL)-HEADERS)
|
||||
library: $($(LOCAL)-LIB)
|
||||
|
@ -1,6 +1,6 @@
|
||||
// -*- mode: cpp; mode: fold -*-
|
||||
// Description /*{{{*/
|
||||
// $Id: acqprogress.cc,v 1.1 2002/07/23 17:54:51 niemeyer Exp $
|
||||
// $Id: acqprogress.cc,v 1.23 2003/02/02 22:24:11 jgg Exp $
|
||||
/* ######################################################################
|
||||
|
||||
Acquire Progress - Command line progress meter
|
||||
@ -152,7 +152,7 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner)
|
||||
|
||||
enum {Long = 0,Medium,Short} Mode = Long;
|
||||
|
||||
char Buffer[1024];
|
||||
char Buffer[sizeof(BlankLine)];
|
||||
char *End = Buffer + sizeof(Buffer);
|
||||
char *S = Buffer;
|
||||
if (ScreenWidth >= sizeof(Buffer))
|
||||
|
@ -1,6 +1,6 @@
|
||||
// -*- mode: cpp; mode: fold -*-
|
||||
// Description /*{{{*/
|
||||
// $Id: acqprogress.h,v 1.1 2002/07/23 17:54:51 niemeyer Exp $
|
||||
// $Id: acqprogress.h,v 1.5 2003/02/02 22:24:11 jgg Exp $
|
||||
/* ######################################################################
|
||||
|
||||
Acquire Progress - Command line progress meter
|
||||
@ -15,7 +15,7 @@
|
||||
class AcqTextStatus : public pkgAcquireStatus
|
||||
{
|
||||
unsigned int &ScreenWidth;
|
||||
char BlankLine[300];
|
||||
char BlankLine[1024];
|
||||
unsigned long ID;
|
||||
unsigned long Quiet;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
// -*- mode: cpp; mode: fold -*-
|
||||
// Description /*{{{*/
|
||||
// $Id: apt-cache.cc,v 1.5 2003/01/29 18:43:48 niemeyer Exp $
|
||||
// $Id: apt-cache.cc,v 1.61 2003/02/10 01:40:58 doogie Exp $
|
||||
/* ######################################################################
|
||||
|
||||
apt-cache - Manages the cache files
|
||||
@ -31,7 +31,9 @@
|
||||
#include <config.h>
|
||||
#include <apti18n.h>
|
||||
|
||||
#include <locale.h>
|
||||
// CNC:2003-02-14 - apti18n.h includes libintl.h which includes locale.h,
|
||||
// as reported by Radu Greab.
|
||||
//#include <locale.h>
|
||||
#include <iostream>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
@ -563,7 +565,8 @@ bool Depends(CommandLine &CmdL)
|
||||
continue;
|
||||
}
|
||||
|
||||
cout << Pkg.Name() << endl;
|
||||
// CNC:2003-03-03
|
||||
cout << Pkg.Name() << "-" << Ver.VerStr() << endl;
|
||||
|
||||
for (pkgCache::DepIterator D = Ver.DependsList(); D.end() == false; D++)
|
||||
{
|
||||
@ -576,8 +579,12 @@ bool Depends(CommandLine &CmdL)
|
||||
pkgCache::PkgIterator Trg = D.TargetPkg();
|
||||
if (Trg->VersionList == 0)
|
||||
cout << D.DepType() << ": <" << Trg.Name() << ">" << endl;
|
||||
else
|
||||
// CNC:2003-03-03
|
||||
else if (D.TargetVer() == 0)
|
||||
cout << D.DepType() << ": " << Trg.Name() << endl;
|
||||
else
|
||||
cout << D.DepType() << ": " << Trg.Name()
|
||||
<< " " << D.CompType() << " " << D.TargetVer() << endl;
|
||||
|
||||
if (Recurse == true)
|
||||
Colours[D.TargetPkg()->ID]++;
|
||||
@ -591,7 +598,9 @@ bool Depends(CommandLine &CmdL)
|
||||
if (V != Cache.VerP + V.ParentPkg()->VersionList ||
|
||||
V->ParentPkg == D->Package)
|
||||
continue;
|
||||
cout << " " << V.ParentPkg().Name() << endl;
|
||||
// CNC:2003-03-03
|
||||
cout << " " << V.ParentPkg().Name()
|
||||
<< "-" << V.VerStr() << endl;
|
||||
|
||||
if (Recurse == true)
|
||||
Colours[D.ParentPkg()->ID]++;
|
||||
@ -601,6 +610,229 @@ bool Depends(CommandLine &CmdL)
|
||||
}
|
||||
while (DidSomething == true);
|
||||
|
||||
return true;
|
||||
}
|
||||
/*}}}*/
|
||||
// CNC:2003-02-19
|
||||
// WhatDepends - Print out a reverse dependency tree /*{{{*/
|
||||
// ---------------------------------------------------------------------
|
||||
/* */
|
||||
bool WhatDepends(CommandLine &CmdL)
|
||||
{
|
||||
pkgCache &Cache = *GCache;
|
||||
SPtrArray<unsigned> Colours = new unsigned[Cache.Head().PackageCount];
|
||||
memset(Colours,0,sizeof(*Colours)*Cache.Head().PackageCount);
|
||||
|
||||
for (const char **I = CmdL.FileList + 1; *I != 0; I++)
|
||||
{
|
||||
pkgCache::PkgIterator Pkg = Cache.FindPkg(*I);
|
||||
if (Pkg.end() == true)
|
||||
{
|
||||
_error->Warning(_("Unable to locate package %s"),*I);
|
||||
continue;
|
||||
}
|
||||
Colours[Pkg->ID] = 1;
|
||||
}
|
||||
|
||||
bool Recurse = _config->FindB("APT::Cache::RecurseDepends",false);
|
||||
bool DidSomething;
|
||||
do
|
||||
{
|
||||
DidSomething = false;
|
||||
for (pkgCache::PkgIterator Pkg = Cache.PkgBegin(); Pkg.end() == false; Pkg++)
|
||||
{
|
||||
if (Colours[Pkg->ID] != 1)
|
||||
continue;
|
||||
Colours[Pkg->ID] = 2;
|
||||
DidSomething = true;
|
||||
|
||||
pkgCache::VerIterator Ver = Pkg.VersionList();
|
||||
if (Ver.end() == true)
|
||||
cout << '<' << Pkg.Name() << '>' << endl;
|
||||
else
|
||||
cout << Pkg.Name() << "-" << Ver.VerStr() << endl;
|
||||
|
||||
SPtrArray<unsigned> LocalColours =
|
||||
new unsigned[Cache.Head().PackageCount];
|
||||
memset(LocalColours,0,sizeof(*LocalColours)*Cache.Head().PackageCount);
|
||||
|
||||
// Display all dependencies directly on the package.
|
||||
for (pkgCache::DepIterator RD = Pkg.RevDependsList();
|
||||
RD.end() == false; RD++)
|
||||
{
|
||||
pkgCache::PkgIterator Parent = RD.ParentPkg();
|
||||
|
||||
if (LocalColours[Parent->ID] == 1)
|
||||
continue;
|
||||
LocalColours[Parent->ID] = 1;
|
||||
|
||||
if (Ver.end() == false && RD.TargetVer() &&
|
||||
Cache.VS->CheckDep(Ver.VerStr(),RD) == false)
|
||||
continue;
|
||||
|
||||
if (Recurse == true && Colours[Parent->ID] == 0)
|
||||
Colours[Parent->ID] = 1;
|
||||
|
||||
pkgCache::VerIterator ParentVer = Parent.VersionList();
|
||||
|
||||
// Show the package
|
||||
cout << " " << Parent.Name()
|
||||
<< "-" << ParentVer.VerStr() << endl;
|
||||
|
||||
// Display all dependencies from that package that relate
|
||||
// to the queried package.
|
||||
for (pkgCache::DepIterator D = ParentVer.DependsList();
|
||||
D.end() == false; D++)
|
||||
{
|
||||
// Go on if it's the same package and version or
|
||||
// if it's the same package and has no versions
|
||||
// (a virtual package).
|
||||
if (D.TargetPkg() != Pkg ||
|
||||
Ver.end() == false &&
|
||||
Cache.VS->CheckDep(Ver.VerStr(),D) == false) {
|
||||
// Oops. Either it's not the same package, or the
|
||||
// version didn't match. Check virtual provides from
|
||||
// the queried package version and verify if this
|
||||
// dependency matches one of those.
|
||||
bool Hit = false;
|
||||
for (pkgCache::PrvIterator Prv = Ver.ProvidesList();
|
||||
Prv.end() == false; Prv++) {
|
||||
if (Prv.ParentPkg() == D.TargetPkg() &&
|
||||
(Prv.ParentPkg()->VersionList == 0 ||
|
||||
Cache.VS->CheckDep(Prv.ProvideVersion(),D)==false)) {
|
||||
Hit = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (Hit == false)
|
||||
continue;
|
||||
}
|
||||
|
||||
// Bingo!
|
||||
pkgCache::PkgIterator Trg = D.TargetPkg();
|
||||
if (Trg->VersionList == 0)
|
||||
cout << " " << D.DepType()
|
||||
<< ": <" << Trg.Name() << ">" << endl;
|
||||
else if (D.TargetVer() == 0)
|
||||
cout << " " << D.DepType()
|
||||
<< ": " << Trg.Name() << endl;
|
||||
else
|
||||
cout << " " << D.DepType()
|
||||
<< ": " << Trg.Name()
|
||||
<< " " << D.CompType() << " "
|
||||
<< D.TargetVer() << endl;
|
||||
|
||||
// Display all solutions
|
||||
SPtrArray<pkgCache::Version *> List = D.AllTargets();
|
||||
pkgPrioSortList(Cache,List);
|
||||
for (pkgCache::Version **I = List; *I != 0; I++)
|
||||
{
|
||||
pkgCache::VerIterator V(Cache,*I);
|
||||
if (V != Cache.VerP + V.ParentPkg()->VersionList ||
|
||||
V->ParentPkg == D->Package)
|
||||
continue;
|
||||
cout << " " << V.ParentPkg().Name()
|
||||
<< "-" << V.VerStr() << endl;
|
||||
|
||||
if (Recurse == true)
|
||||
Colours[D.ParentPkg()->ID]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Is this a virtual package the user queried directly?
|
||||
if (Ver.end())
|
||||
continue;
|
||||
|
||||
// Display all dependencies on virtual provides, which were not
|
||||
// yet shown in the step above.
|
||||
for (pkgCache::PrvIterator RDPrv = Ver.ProvidesList();
|
||||
RDPrv.end() == false; RDPrv++) {
|
||||
for (pkgCache::DepIterator RD = RDPrv.ParentPkg().RevDependsList();
|
||||
RD.end() == false; RD++)
|
||||
{
|
||||
pkgCache::PkgIterator Parent = RD.ParentPkg();
|
||||
|
||||
if (LocalColours[Parent->ID] == 1)
|
||||
continue;
|
||||
LocalColours[Parent->ID] = 1;
|
||||
|
||||
if (Ver.end() == false &&
|
||||
Cache.VS->CheckDep(Ver.VerStr(),RD) == false)
|
||||
continue;
|
||||
|
||||
if (Recurse == true && Colours[Parent->ID] == 0)
|
||||
Colours[Parent->ID] = 1;
|
||||
|
||||
pkgCache::VerIterator ParentVer = Parent.VersionList();
|
||||
|
||||
// Show the package
|
||||
cout << " " << Parent.Name()
|
||||
<< "-" << ParentVer.VerStr() << endl;
|
||||
|
||||
for (pkgCache::DepIterator D = ParentVer.DependsList();
|
||||
D.end() == false; D++)
|
||||
{
|
||||
// Go on if it's the same package and version or
|
||||
// if it's the same package and has no versions
|
||||
// (a virtual package).
|
||||
if (D.TargetPkg() != RDPrv.ParentPkg() ||
|
||||
Ver.end() == false &&
|
||||
Cache.VS->CheckDep(Ver.VerStr(),D) == false) {
|
||||
// Oops. Either it's not the same package, or the
|
||||
// version didn't match. Check virtual provides from
|
||||
// the queried package version and verify if this
|
||||
// dependency matches one of those.
|
||||
bool Hit = false;
|
||||
for (pkgCache::PrvIterator Prv = Ver.ProvidesList();
|
||||
Prv.end() == false; Prv++) {
|
||||
if (Prv.ParentPkg() == D.TargetPkg() &&
|
||||
(Prv.ParentPkg()->VersionList == 0 ||
|
||||
Cache.VS->CheckDep(Prv.ProvideVersion(),D)) == false) {
|
||||
Hit = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (Hit == false)
|
||||
continue;
|
||||
}
|
||||
|
||||
// Bingo!
|
||||
pkgCache::PkgIterator Trg = D.TargetPkg();
|
||||
if (Trg->VersionList == 0)
|
||||
cout << " " << D.DepType()
|
||||
<< ": <" << Trg.Name() << ">" << endl;
|
||||
else if (D.TargetVer() == 0)
|
||||
cout << " " << D.DepType()
|
||||
<< ": " << Trg.Name() << endl;
|
||||
else
|
||||
cout << " " << D.DepType()
|
||||
<< ": " << Trg.Name()
|
||||
<< " " << D.CompType() << " "
|
||||
<< D.TargetVer() << endl;
|
||||
|
||||
// Display all solutions
|
||||
SPtrArray<pkgCache::Version *> List = D.AllTargets();
|
||||
pkgPrioSortList(Cache,List);
|
||||
for (pkgCache::Version **I = List; *I != 0; I++)
|
||||
{
|
||||
pkgCache::VerIterator V(Cache,*I);
|
||||
if (V != Cache.VerP + V.ParentPkg()->VersionList ||
|
||||
V->ParentPkg == D->Package)
|
||||
continue;
|
||||
cout << " " << V.ParentPkg().Name()
|
||||
<< "-" << V.VerStr() << endl;
|
||||
|
||||
if (Recurse == true)
|
||||
Colours[D.ParentPkg()->ID]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
while (DidSomething == true);
|
||||
|
||||
return true;
|
||||
}
|
||||
/*}}}*/
|
||||
@ -1287,7 +1519,8 @@ bool ShowHelp(CommandLine &Cmd)
|
||||
|
||||
cout <<
|
||||
_("Usage: apt-cache [options] command\n"
|
||||
" apt-cache [options] add file1 [file1 ...]\n"
|
||||
// CNC:2003-02-20 - Use file2, not file1 twice.
|
||||
" apt-cache [options] add file1 [file2 ...]\n"
|
||||
" apt-cache [options] showpkg pkg1 [pkg2 ...]\n"
|
||||
" apt-cache [options] showsrc pkg1 [pkg2 ...]\n"
|
||||
"\n"
|
||||
@ -1295,7 +1528,7 @@ bool ShowHelp(CommandLine &Cmd)
|
||||
"cache files, and query information from them\n"
|
||||
"\n"
|
||||
"Commands:\n"
|
||||
" add - Add an package file to the source cache\n"
|
||||
" add - Add a package file to the source cache\n"
|
||||
" gencaches - Build both the package and source cache\n"
|
||||
" showpkg - Show some general information for a single package\n"
|
||||
" showsrc - Show source records\n"
|
||||
@ -1306,6 +1539,7 @@ bool ShowHelp(CommandLine &Cmd)
|
||||
" search - Search the package list for a regex pattern\n"
|
||||
" show - Show a readable record for the package\n"
|
||||
" depends - Show raw dependency information for a package\n"
|
||||
" whatdepends - Show raw dependency information on a package\n"
|
||||
" pkgnames - List the names of all packages\n"
|
||||
" dotty - Generate package graphs for GraphVis\n"
|
||||
" policy - Show policy settings\n"
|
||||
@ -1362,6 +1596,7 @@ int main(int argc,const char *argv[])
|
||||
{"unmet",&UnMet},
|
||||
{"search",&Search},
|
||||
{"depends",&Depends},
|
||||
{"whatdepends",&WhatDepends},
|
||||
{"dotty",&Dotty},
|
||||
{"show",&ShowPackage},
|
||||
{"pkgnames",&ShowPkgNames},
|
||||
|
@ -1,6 +1,6 @@
|
||||
// -*- mode: cpp; mode: fold -*-
|
||||
// Description /*{{{*/
|
||||
// $Id: apt-cdrom.cc,v 1.5 2003/01/29 15:11:14 niemeyer Exp $
|
||||
// $Id: apt-cdrom.cc,v 1.42 2002/02/15 03:40:00 jgg Exp $
|
||||
/* ######################################################################
|
||||
|
||||
APT CDROM - Tool for handling APT's CDROM database.
|
||||
@ -21,9 +21,16 @@
|
||||
#include <config.h>
|
||||
#include <apti18n.h>
|
||||
|
||||
#include "rpmindexcopy.h" // CNC:2002-07-11
|
||||
// CNC:2002-07-11
|
||||
#ifdef HAVE_RPM
|
||||
#include "rpmindexcopy.h"
|
||||
#else
|
||||
#include "indexcopy.h"
|
||||
#endif
|
||||
|
||||
#include <locale.h>
|
||||
// CNC:2003-02-14 - apti18n.h includes libintl.h which includes locale.h,
|
||||
// as reported by Radu Greab.
|
||||
//#include <locale.h>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
@ -69,7 +76,11 @@ bool FindPackages(string CD,vector<string> &List,vector<string> &SList,
|
||||
return true;
|
||||
|
||||
// CNC:2002-07-11
|
||||
#if 0
|
||||
#ifdef HAVE_RPM
|
||||
bool Found = false;
|
||||
if (stat("release",&Buf) == 0)
|
||||
Found = true;
|
||||
#else
|
||||
/* Aha! We found some package files. We assume that everything under
|
||||
this dir is controlled by those package files so we don't look down
|
||||
anymore */
|
||||
@ -89,10 +100,6 @@ bool FindPackages(string CD,vector<string> &List,vector<string> &SList,
|
||||
if (_config->FindB("APT::CDROM::Thorough",false) == false)
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
bool Found = false;
|
||||
if (stat("release",&Buf) == 0)
|
||||
Found = true;
|
||||
#endif
|
||||
|
||||
DIR *D = opendir(".");
|
||||
@ -107,14 +114,18 @@ bool FindPackages(string CD,vector<string> &List,vector<string> &SList,
|
||||
strcmp(Dir->d_name,"..") == 0 ||
|
||||
//strcmp(Dir->d_name,"source") == 0 ||
|
||||
strcmp(Dir->d_name,".disk") == 0 ||
|
||||
// CNC:2002-07-11
|
||||
//strcmp(Dir->d_name,"experimental") == 0 ||
|
||||
//strcmp(Dir->d_name,"binary-all") == 0)
|
||||
// CNC:2002-07-11
|
||||
#ifdef HAVE_RPM
|
||||
strncmp(Dir->d_name,"RPMS",4) == 0 ||
|
||||
strncmp(Dir->d_name,"doc",3) == 0)
|
||||
#else
|
||||
strcmp(Dir->d_name,"experimental") == 0 ||
|
||||
strcmp(Dir->d_name,"binary-all") == 0)
|
||||
#endif
|
||||
continue;
|
||||
|
||||
// CNC:2002-07-11
|
||||
// CNC:2002-07-11
|
||||
#ifdef HAVE_RPM
|
||||
if (strncmp(Dir->d_name, "pkglist.", 8) == 0 &&
|
||||
strcmp(Dir->d_name+strlen(Dir->d_name)-4, ".bz2") == 0)
|
||||
{
|
||||
@ -132,6 +143,7 @@ bool FindPackages(string CD,vector<string> &List,vector<string> &SList,
|
||||
if (_config->FindB("APT::CDROM::Thorough",false) == false &&
|
||||
Found == true)
|
||||
continue;
|
||||
#endif
|
||||
|
||||
// See if the name is a sub directory
|
||||
struct stat Buf;
|
||||
@ -164,8 +176,6 @@ bool FindPackages(string CD,vector<string> &List,vector<string> &SList,
|
||||
return !_error->PendingError();
|
||||
}
|
||||
/*}}}*/
|
||||
// CNC:2002-07-11
|
||||
#if 0
|
||||
// DropBinaryArch - Dump dirs with a string like /binary-<foo>/ /*{{{*/
|
||||
// ---------------------------------------------------------------------
|
||||
/* Here we drop everything that is not this machines arch */
|
||||
@ -211,6 +221,10 @@ bool DropBinaryArch(vector<string> &List)
|
||||
int Score(string Path)
|
||||
{
|
||||
int Res = 0;
|
||||
#ifdef HAVE_RPM
|
||||
if (Path.find("base/") != string::npos)
|
||||
Res = 1;
|
||||
#else
|
||||
if (Path.find("stable/") != string::npos)
|
||||
Res += 29;
|
||||
if (Path.find("/binary-") != string::npos)
|
||||
@ -233,6 +247,7 @@ int Score(string Path)
|
||||
Res += 10;
|
||||
if (Path.find("/debian/") != string::npos)
|
||||
Res -= 10;
|
||||
#endif
|
||||
return Res;
|
||||
}
|
||||
/*}}}*/
|
||||
@ -246,7 +261,9 @@ bool DropRepeats(vector<string> &List,const char *Name)
|
||||
for (unsigned int I = 0; I != List.size(); I++)
|
||||
{
|
||||
struct stat Buf;
|
||||
if (stat((List[I] + Name).c_str(),&Buf) != 0 &&
|
||||
// CNC:2003-02-14
|
||||
if (stat((List[I]).c_str(),&Buf) != 0 &&
|
||||
stat((List[I] + Name).c_str(),&Buf) != 0 &&
|
||||
stat((List[I] + Name + ".gz").c_str(),&Buf) != 0)
|
||||
_error->Errno("stat","Failed to stat %s%s",List[I].c_str(),
|
||||
Name);
|
||||
@ -289,7 +306,6 @@ bool DropRepeats(vector<string> &List,const char *Name)
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
/*}}}*/
|
||||
|
||||
// ReduceSourceList - Takes the path list and reduces it /*{{{*/
|
||||
@ -418,12 +434,19 @@ bool WriteSourceList(string Name,vector<string> &List,bool Source)
|
||||
string ShortURI = "cdrom:[" + Name + "]/";
|
||||
string ShortURI2 = "cdrom:" + Name + "/"; // For Compatibility
|
||||
|
||||
// CNC:2002-07-11
|
||||
const char *Type;
|
||||
// CNC:2002-07-11
|
||||
#ifdef HAVE_RPM
|
||||
if (Source == true)
|
||||
Type = "rpm-src";
|
||||
else
|
||||
Type = "rpm";
|
||||
#else
|
||||
if (Source == true)
|
||||
Type = "deb-src";
|
||||
else
|
||||
Type = "deb";
|
||||
#endif
|
||||
|
||||
char Buffer[300];
|
||||
int CurLine = 0;
|
||||
@ -484,9 +507,14 @@ bool WriteSourceList(string Name,vector<string> &List,bool Source)
|
||||
if (Space == string::npos)
|
||||
return _error->Error("Internal error");
|
||||
|
||||
// CNC:2002-07-11
|
||||
// CNC:2002-07-11
|
||||
#ifdef HAVE_RPM
|
||||
Out << "rpm cdrom:[" << Name << "]/" << string(*I,0,Space) <<
|
||||
" " << string(*I,Space+1) << endl;
|
||||
#else
|
||||
Out << "deb cdrom:[" << Name << "]/" << string(*I,0,Space) <<
|
||||
" " << string(*I,Space+1) << endl;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -620,9 +648,12 @@ bool DoAdd(CommandLine &)
|
||||
cout << *I << endl;
|
||||
}
|
||||
|
||||
// CNC:2002-07-11
|
||||
#if 0
|
||||
// Fix up the list
|
||||
// CNC:2002-07-11
|
||||
#ifdef HAVE_RPM
|
||||
DropRepeats(List,"pkglist");
|
||||
DropRepeats(sList,"srclist");
|
||||
#else
|
||||
DropBinaryArch(List);
|
||||
DropRepeats(List,"Packages");
|
||||
DropRepeats(sList,"Sources");
|
||||
@ -633,8 +664,8 @@ bool DoAdd(CommandLine &)
|
||||
// CNC:2002-07-11
|
||||
if (List.size() == 0 && sList.size() == 0)
|
||||
{
|
||||
if (_config->FindB("APT::CDROM::NoMount",false) == false)
|
||||
UnmountCdrom(CDROM);
|
||||
if (Mounted && _config->FindB("APT::CDROM::NoMount",false) == false)
|
||||
UnmountCdrom(CDROM);
|
||||
return _error->Error("Unable to locate any package files, perhaps this is not an APT enabled disc");
|
||||
|
||||
}
|
||||
@ -667,8 +698,12 @@ bool DoAdd(CommandLine &)
|
||||
if (_config->FindB("APT::CDROM::Rename",false) == true ||
|
||||
Name.empty() == true)
|
||||
{
|
||||
// CNC:2002-07-11
|
||||
// CNC:2002-07-11
|
||||
#ifdef HAVE_RPM
|
||||
cout << "Please provide a name for this Disc, such as 'Conectiva Disk 1'";
|
||||
#else
|
||||
cout << "Please provide a name for this Disc, such as 'Debian 2.1r1 Disk 1'";
|
||||
#endif
|
||||
while (1)
|
||||
{
|
||||
Name = PromptLine("");
|
||||
@ -694,9 +729,14 @@ bool DoAdd(CommandLine &)
|
||||
cout << "This Disc is called:" << endl << " '" << Name << "'" << endl;
|
||||
|
||||
// Copy the package files to the state directory
|
||||
// CNC:2002-07-11
|
||||
// CNC:2002-07-11
|
||||
#ifdef HAVE_RPM
|
||||
RPMPackageCopy Copy;
|
||||
RPMSourceCopy SrcCopy;
|
||||
#else
|
||||
PackageCopy Copy;
|
||||
SourceCopy SrcCopy;
|
||||
#endif
|
||||
// CNC:2002-10-29
|
||||
if (Copy.CopyPackages(ScanDir,Name,List) == false ||
|
||||
SrcCopy.CopyPackages(ScanDir,Name,sList) == false)
|
||||
@ -726,9 +766,14 @@ bool DoAdd(CommandLine &)
|
||||
if (Space == string::npos)
|
||||
return _error->Error("Internal error");
|
||||
|
||||
// CNC:2002-07-11
|
||||
// CNC:2002-07-11
|
||||
#ifdef HAVE_RPM
|
||||
cout << "rpm cdrom:[" << Name << "]/" << string(*I,0,Space) <<
|
||||
" " << string(*I,Space+1) << endl;
|
||||
#else
|
||||
cout << "deb cdrom:[" << Name << "]/" << string(*I,0,Space) <<
|
||||
" " << string(*I,Space+1) << endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
for (vector<string>::iterator I = sList.begin(); I != sList.end(); I++)
|
||||
@ -737,9 +782,14 @@ bool DoAdd(CommandLine &)
|
||||
if (Space == string::npos)
|
||||
return _error->Error("Internal error");
|
||||
|
||||
// CNC:2002-07-11
|
||||
// CNC:2002-07-11
|
||||
#ifdef HAVE_RPM
|
||||
cout << "rpm-src cdrom:[" << Name << "]/" << string(*I,0,Space) <<
|
||||
" " << string(*I,Space+1) << endl;
|
||||
#else
|
||||
cout << "deb-src cdrom:[" << Name << "]/" << string(*I,0,Space) <<
|
||||
" " << string(*I,Space+1) << endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
cout << "Repeat this process for the rest of the CDs in your set." << endl;
|
||||
|
@ -24,7 +24,9 @@
|
||||
#include <config.h>
|
||||
#include <apti18n.h>
|
||||
|
||||
#include <locale.h>
|
||||
// CNC:2003-02-14 - apti18n.h includes libintl.h which includes locale.h,
|
||||
// as reported by Radu Greab.
|
||||
//#include <locale.h>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
/*}}}*/
|
||||
|
@ -35,7 +35,9 @@
|
||||
#include <unistd.h>
|
||||
#include <fstream>
|
||||
|
||||
#include <locale.h>
|
||||
// CNC:2003-02-14 - apti18n.h includes libintl.h which includes locale.h,
|
||||
// as reported by Radu Greab.
|
||||
//#include <locale.h>
|
||||
#include <config.h>
|
||||
#include <apti18n.h>
|
||||
#include "apt-extracttemplates.h"
|
||||
|
@ -1,6 +1,6 @@
|
||||
// -*- mode: cpp; mode: fold -*-
|
||||
// Description /*{{{*/
|
||||
// $Id: apt-get.cc,v 1.14 2003/01/29 18:43:48 niemeyer Exp $
|
||||
// $Id: apt-get.cc,v 1.126 2003/02/12 16:14:08 doogie Exp $
|
||||
/* ######################################################################
|
||||
|
||||
apt-get - Cover for dpkg
|
||||
@ -45,7 +45,9 @@
|
||||
|
||||
#include "acqprogress.h"
|
||||
|
||||
#include <locale.h>
|
||||
// CNC:2003-02-14 - apti18n.h includes libintl.h which includes locale.h,
|
||||
// as reported by Radu Greab.
|
||||
//#include <locale.h>
|
||||
#include <fstream>
|
||||
#include <termios.h>
|
||||
#include <sys/ioctl.h>
|
||||
@ -154,6 +156,14 @@ bool ShowList(ostream &out,string Title,string List)
|
||||
{
|
||||
if (List.empty() == true)
|
||||
return true;
|
||||
// trim trailing space
|
||||
int NonSpace = List.find_last_not_of(' ');
|
||||
if (NonSpace != -1)
|
||||
{
|
||||
List = List.erase(NonSpace + 1);
|
||||
if (List.empty() == true)
|
||||
return true;
|
||||
}
|
||||
|
||||
// Acount for the leading space
|
||||
int ScreenWidth = ::ScreenWidth - 3;
|
||||
@ -230,8 +240,16 @@ void ShowBroken(ostream &out,CacheFile &Cache,bool Now)
|
||||
pkgCache::DepIterator End;
|
||||
D.GlobOr(Start,End);
|
||||
|
||||
// CNC:2003-02-22 - IsImportantDep() currently calls IsCritical(), so
|
||||
// these two are currently doing the same thing. Check
|
||||
// comments in IsImportantDep() definition.
|
||||
#if 0
|
||||
if (Cache->IsImportantDep(End) == false)
|
||||
continue;
|
||||
#else
|
||||
if (End.IsCritical() == false)
|
||||
continue;
|
||||
#endif
|
||||
|
||||
if (Now == true)
|
||||
{
|
||||
@ -581,6 +599,31 @@ void Stats(ostream &out,pkgDepCache &Dep)
|
||||
Dep.BadCount());
|
||||
}
|
||||
/*}}}*/
|
||||
// CNC:2003-03-06
|
||||
// CheckOnly - Check if the cache has any changes to be applied /*{{{*/
|
||||
// ---------------------------------------------------------------------
|
||||
/* Returns true if CheckOnly is active. */
|
||||
bool CheckOnly(CacheFile &Cache)
|
||||
{
|
||||
if (_config->FindB("APT::Get::Check-Only", false) == false)
|
||||
return false;
|
||||
if (Cache->InstCount() != 0 || Cache->DelCount() != 0) {
|
||||
if (_config->FindB("APT::Get::Show-Upgraded",true) == true)
|
||||
ShowUpgraded(c1out,Cache);
|
||||
ShowDel(c1out,Cache);
|
||||
ShowNew(c1out,Cache);
|
||||
//ShowKept(c1out,Cache);
|
||||
ShowHold(c1out,Cache);
|
||||
ShowDowngraded(c1out,Cache);
|
||||
ShowEssential(c1out,Cache);
|
||||
Stats(c1out,Cache);
|
||||
_error->Error(_("There are changes to be made"));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
/*}}}*/
|
||||
|
||||
|
||||
// CacheFile::NameComp - QSort compare by name /*{{{*/
|
||||
// ---------------------------------------------------------------------
|
||||
@ -686,8 +729,8 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true,
|
||||
bool Essential = false;
|
||||
|
||||
// Show all the various warning indicators
|
||||
// CNC:2002-07-06
|
||||
if (_config->FindB("APT::Get::Show-Upgraded",false) == true)
|
||||
// CNC:2002-03-06 - Change Show-Upgraded default to true, and move upwards.
|
||||
if (_config->FindB("apt::get::show-upgraded",true) == true)
|
||||
ShowUpgraded(c1out,Cache);
|
||||
ShowDel(c1out,Cache);
|
||||
ShowNew(c1out,Cache);
|
||||
@ -797,7 +840,7 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true,
|
||||
OutputDir.c_str());
|
||||
// CNC:2002-07-11
|
||||
if (unsigned(Buf.f_bavail) < (FetchBytes - FetchPBytes)/Buf.f_bsize)
|
||||
return _error->Error(_("Sorry, you don't have enough free space in %s to hold all packages."),
|
||||
return _error->Error(_("You don't have enough free space in %s."),
|
||||
OutputDir.c_str());
|
||||
}
|
||||
|
||||
@ -862,6 +905,9 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true,
|
||||
after. */
|
||||
if (_config->FindB("APT::Get::Download-Only",false) == true)
|
||||
_system->UnLock();
|
||||
|
||||
// CNC:2003-02-24
|
||||
bool Ret = true;
|
||||
|
||||
// Run it
|
||||
while (1)
|
||||
@ -890,6 +936,9 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true,
|
||||
|
||||
if (Fetcher.Run() == pkgAcquire::Failed)
|
||||
return false;
|
||||
|
||||
// CNC:2003-02-24
|
||||
_error->PopState();
|
||||
|
||||
// Print out errors
|
||||
bool Failed = false;
|
||||
@ -953,21 +1002,28 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true,
|
||||
_system->UnLock();
|
||||
pkgPackageManager::OrderResult Res = PM->DoInstall();
|
||||
if (Res == pkgPackageManager::Failed || _error->PendingError() == true)
|
||||
return false;
|
||||
{
|
||||
if (Transient == false)
|
||||
return false;
|
||||
Ret = false;
|
||||
}
|
||||
|
||||
// CNC:2002-07-06
|
||||
if (Res == pkgPackageManager::Completed)
|
||||
{
|
||||
CommandLine *CmdL = NULL; // Watch out! If used will blow up!
|
||||
bool ret = true;
|
||||
if (_config->FindB("APT::Post-Install::Clean",false) == true)
|
||||
ret = DoClean(*CmdL);
|
||||
Ret &= DoClean(*CmdL);
|
||||
else if (_config->FindB("APT::Post-Install::AutoClean",false) == true)
|
||||
ret = DoAutoClean(*CmdL);
|
||||
return ret;
|
||||
Ret &= DoAutoClean(*CmdL);
|
||||
return Ret;
|
||||
}
|
||||
|
||||
_system->Lock();
|
||||
}
|
||||
|
||||
// CNC:2003-02-24
|
||||
_error->PushState();
|
||||
|
||||
// Reload the fetcher object and loop again for media swapping
|
||||
Fetcher.Shutdown();
|
||||
@ -1351,6 +1407,10 @@ bool DoUpgrade(CommandLine &CmdL)
|
||||
ShowBroken(c1out,Cache,false);
|
||||
return _error->Error(_("Internal Error, AllUpgrade broke stuff"));
|
||||
}
|
||||
|
||||
// CNC:2003-03-06
|
||||
if (CheckOnly(Cache) == true)
|
||||
return true;
|
||||
|
||||
return InstallPackages(Cache,true);
|
||||
}
|
||||
@ -1553,6 +1613,10 @@ bool DoInstall(CommandLine &CmdL)
|
||||
ShowList(c1out,_("The following extra packages will be installed:"),List);
|
||||
}
|
||||
|
||||
// CNC:2003-03-06
|
||||
if (CheckOnly(Cache) == true)
|
||||
return true;
|
||||
|
||||
// See if we need to prompt
|
||||
if (Cache->InstCount() == ExpectedInst && Cache->DelCount() == 0)
|
||||
return InstallPackages(Cache,false,false);
|
||||
@ -1577,6 +1641,10 @@ bool DoDistUpgrade(CommandLine &CmdL)
|
||||
return false;
|
||||
}
|
||||
|
||||
// CNC:2003-03-06
|
||||
if (CheckOnly(Cache) == true)
|
||||
return true;
|
||||
|
||||
c0out << _("Done") << endl;
|
||||
|
||||
return InstallPackages(Cache,true);
|
||||
@ -1652,6 +1720,10 @@ bool DoDSelectUpgrade(CommandLine &CmdL)
|
||||
ShowBroken(c1out,Cache,false);
|
||||
return _error->Error("Internal Error, problem resolver broke stuff");
|
||||
}
|
||||
|
||||
// CNC:2003-03-06
|
||||
if (CheckOnly(Cache) == true)
|
||||
return true;
|
||||
|
||||
return InstallPackages(Cache,false);
|
||||
}
|
||||
@ -1826,7 +1898,7 @@ bool DoSource(CommandLine &CmdL)
|
||||
OutputDir.c_str());
|
||||
// CNC:2002-07-12
|
||||
if (unsigned(Buf.f_bavail) < (FetchBytes - FetchPBytes)/Buf.f_bsize)
|
||||
return _error->Error(_("Sorry, you don't have enough free space in %s"),
|
||||
return _error->Error(_("You don't have enough free space in %s"),
|
||||
OutputDir.c_str());
|
||||
|
||||
// Number of bytes
|
||||
@ -2049,32 +2121,53 @@ bool DoBuildDep(CommandLine &CmdL)
|
||||
pkgProblemResolver Fix(Cache);
|
||||
for (D = BuildDeps.begin(); D != BuildDeps.end(); D++)
|
||||
{
|
||||
pkgCache::PkgIterator Pkg = Cache->FindPkg((*D).Package);
|
||||
if (Pkg.end() == true)
|
||||
{
|
||||
/* for a build-conflict; ignore unknown packages */
|
||||
if ((*D).Type == pkgSrcRecords::Parser::BuildConflict ||
|
||||
(*D).Type == pkgSrcRecords::Parser::BuildConflictIndep)
|
||||
continue;
|
||||
|
||||
return _error->Error(_("%s dependency on %s cannot be satisfied because the package %s cannot be found"),
|
||||
Last->BuildDepType((*D).Type),Src.c_str(),(*D).Package.c_str());
|
||||
}
|
||||
pkgCache::VerIterator IV = (*Cache)[Pkg].InstVerIter(*Cache);
|
||||
|
||||
if ((*D).Type == pkgSrcRecords::Parser::BuildConflict ||
|
||||
if ((*D).Type == pkgSrcRecords::Parser::BuildConflict ||
|
||||
(*D).Type == pkgSrcRecords::Parser::BuildConflictIndep)
|
||||
{
|
||||
/*
|
||||
* conflict; need to remove if we have an installed version
|
||||
* that satisfies the version criterial
|
||||
*/
|
||||
if (IV.end() == false &&
|
||||
Cache->VS().CheckDep(IV.VerStr(),(*D).Op,(*D).Version.c_str()) == true)
|
||||
TryToInstall(Pkg,Cache,Fix,true,false,ExpectedInst);
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
pkgCache::PkgIterator Pkg = Cache->FindPkg((*D).Package);
|
||||
// Build-conflicts on unknown packages are silently ignored
|
||||
if (Pkg.end() == true)
|
||||
continue;
|
||||
|
||||
pkgCache::VerIterator IV = (*Cache)[Pkg].InstVerIter(*Cache);
|
||||
|
||||
/*
|
||||
* Remove if we have an installed version that satisfies the
|
||||
* version criteria
|
||||
*/
|
||||
if (IV.end() == false &&
|
||||
Cache->VS().CheckDep(IV.VerStr(),(*D).Op,(*D).Version.c_str()) == true)
|
||||
TryToInstall(Pkg,Cache,Fix,true,false,ExpectedInst);
|
||||
}
|
||||
else // BuildDep || BuildDepIndep
|
||||
{
|
||||
pkgCache::PkgIterator Pkg = Cache->FindPkg((*D).Package);
|
||||
if (Pkg.end() == true)
|
||||
{
|
||||
// Check if there are any alternatives
|
||||
if (((*D).Op & pkgCache::Dep::Or) != pkgCache::Dep::Or)
|
||||
return _error->Error(_("%s dependency for %s cannot be satisfied "
|
||||
"because the package %s cannot be found"),
|
||||
Last->BuildDepType((*D).Type),Src.c_str(),
|
||||
(*D).Package.c_str());
|
||||
// Try the next alternative
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* if there are alternatives, we've already picked one, so skip
|
||||
* the rest
|
||||
*
|
||||
* TODO: this means that if there's a build-dep on A|B and B is
|
||||
* installed, we'll still try to install A; more importantly,
|
||||
* if A is currently broken, we cannot go back and try B. To fix
|
||||
* this would require we do a Resolve cycle for each package we
|
||||
* add to the install list. Ugh
|
||||
*/
|
||||
while (D != BuildDeps.end() &&
|
||||
(((*D).Op & pkgCache::Dep::Or) == pkgCache::Dep::Or))
|
||||
D++;
|
||||
|
||||
/*
|
||||
* If this is a virtual package, we need to check the list of
|
||||
* packages that provide it and see if any of those are
|
||||
@ -2084,22 +2177,35 @@ bool DoBuildDep(CommandLine &CmdL)
|
||||
for (; Prv.end() != true; Prv++)
|
||||
if ((*Cache)[Prv.OwnerPkg()].InstVerIter(*Cache).end() == false)
|
||||
break;
|
||||
|
||||
// Get installed version and version we are going to install
|
||||
pkgCache::VerIterator IV = (*Cache)[Pkg].InstVerIter(*Cache);
|
||||
pkgCache::VerIterator CV = (*Cache)[Pkg].CandidateVerIter(*Cache);
|
||||
|
||||
if (Prv.end() == true)
|
||||
{
|
||||
/*
|
||||
* depends; need to install or upgrade if we don't have the
|
||||
* package installed or if the version does not satisfy the
|
||||
* build dep. This is complicated by the fact that if we
|
||||
* depend on a version lower than what we already have
|
||||
* installed it is not clear what should be done; in practice
|
||||
* this case should be rare though and right now nothing
|
||||
* is done about it :-(
|
||||
*/
|
||||
if (IV.end() == true ||
|
||||
Cache->VS().CheckDep(IV.VerStr(),(*D).Op,(*D).Version.c_str()) == false)
|
||||
TryToInstall(Pkg,Cache,Fix,false,false,ExpectedInst);
|
||||
}
|
||||
for (; CV.end() != true; CV++)
|
||||
{
|
||||
if (Cache->VS().CheckDep(CV.VerStr(),(*D).Op,(*D).Version.c_str()) == true)
|
||||
break;
|
||||
}
|
||||
if (CV.end() == true)
|
||||
return _error->Error(_("%s dependency for %s cannot be satisfied "
|
||||
"because no available versions of package %s "
|
||||
"can satisfy version requirements"),
|
||||
Last->BuildDepType((*D).Type),Src.c_str(),
|
||||
(*D).Package.c_str());
|
||||
|
||||
/*
|
||||
* TODO: if we depend on a version lower than what we already have
|
||||
* installed it is not clear what should be done; in practice
|
||||
* this case should be rare, and right now nothing is
|
||||
* done about it :-(
|
||||
*/
|
||||
if (Prv.end() == true && // Nothing provides it; and
|
||||
(IV.end() == true || // It is not installed, or
|
||||
Cache->VS().CheckDep(IV.VerStr(),(*D).Op,(*D).Version.c_str()) == false))
|
||||
// the version installed doesn't
|
||||
// satisfy constraints
|
||||
TryToInstall(Pkg,Cache,Fix,false,false,ExpectedInst);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2115,6 +2221,11 @@ bool DoBuildDep(CommandLine &CmdL)
|
||||
|
||||
if (InstallPackages(Cache, false, true) == false)
|
||||
return _error->Error(_("Failed to process build dependencies"));
|
||||
|
||||
// CNC:2003-03-06
|
||||
if (CheckOnly(Cache) == true)
|
||||
return true;
|
||||
|
||||
return true;
|
||||
}
|
||||
/*}}}*/
|
||||
@ -2198,7 +2309,8 @@ bool ShowHelp(CommandLine &CmdL)
|
||||
"Commands:\n"
|
||||
" update - Retrieve new lists of packages\n"
|
||||
" upgrade - Perform an upgrade\n"
|
||||
" install - Install new packages (pkg is libc6 not libc6.deb)\n"
|
||||
// CNC:2003-02-20 - Use .rpm extension in documentation.
|
||||
" install - Install new packages (pkg is libc6 not libc6.rpm)\n"
|
||||
" remove - Remove packages\n"
|
||||
" source - Download source archives\n"
|
||||
" build-dep - Configure build-dependencies for source packages\n"
|
||||
@ -2298,6 +2410,7 @@ int main(int argc,const char *argv[])
|
||||
{0,"remove","APT::Get::Remove",0},
|
||||
{0,"only-source","APT::Get::Only-Source",0},
|
||||
{0,"arch-only","APT::Get::Arch-Only",0},
|
||||
{0,"check-only","APT::Get::Check-Only",0}, // CNC:2003-03-06
|
||||
{'c',"config-file",0,CommandLine::ConfigFile},
|
||||
{'o',"option",0,CommandLine::ArbItem},
|
||||
{0,0,0,0}};
|
||||
|
3883
apt/cmdline/apt-shell.cc
Normal file
3883
apt/cmdline/apt-shell.cc
Normal file
File diff suppressed because it is too large
Load Diff
@ -25,7 +25,9 @@
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
#include <locale.h>
|
||||
// CNC:2003-02-14 - apti18n.h includes libintl.h which includes locale.h,
|
||||
// as reported by Radu Greab.
|
||||
//#include <locale.h>
|
||||
#include <unistd.h>
|
||||
/*}}}*/
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user