summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apt-pkg/algorithms.cc65
-rw-r--r--apt-pkg/contrib/fileutl.cc41
-rw-r--r--apt-pkg/contrib/fileutl.h3
-rw-r--r--apt-pkg/deb/deblistparser.cc13
-rw-r--r--apt-pkg/packagemanager.cc31
-rw-r--r--apt-pkg/sourcelist.cc6
-rw-r--r--cmdline/apt-get.cc29
-rw-r--r--configure.in2
-rw-r--r--debian/changelog14
-rw-r--r--test/makefile10
-rw-r--r--test/scratch.cc151
11 files changed, 238 insertions, 127 deletions
diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc
index d84ce2e21..dd0928562 100644
--- a/apt-pkg/algorithms.cc
+++ b/apt-pkg/algorithms.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: algorithms.cc,v 1.23 1999/07/30 02:54:25 jgg Exp $
+// $Id: algorithms.cc,v 1.24 1999/09/30 06:30:34 jgg Exp $
/* ######################################################################
Algorithms - A set of misc algorithms
@@ -715,13 +715,18 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
// Isolate the problem dependency
PackageKill KillList[100];
PackageKill *LEnd = KillList;
- for (pkgCache::DepIterator D = Cache[I].InstVerIter(Cache).DependsList(); D.end() == false;)
+ bool InOr = false;
+ pkgCache::DepIterator Start;
+ pkgCache::DepIterator End;
+ for (pkgCache::DepIterator D = Cache[I].InstVerIter(Cache).DependsList();
+ D.end() == false || InOr == true;)
{
// Compute a single dependency element (glob or)
- pkgCache::DepIterator Start;
- pkgCache::DepIterator End;
- D.GlobOr(Start,End);
-
+ if (InOr == false)
+ D.GlobOr(Start,End);
+ else
+ Start++;
+
// We only worry about critical deps.
if (End.IsCritical() != true)
continue;
@@ -730,25 +735,27 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
if ((Cache[End] & pkgDepCache::DepGInstall) == pkgDepCache::DepGInstall)
continue;
+ InOr = Start != End;
+
// Hm, the group is broken.. I have no idea how to handle this
- if (Start != End)
+/* if (Start != End)
{
if (Debug == true)
clog << "Note, a broken or group was found in " << I.Name() << "." << endl;
if ((Flags[I->ID] & Protected) != Protected)
Cache.MarkDelete(I);
break;
- }
+ }*/
if (Debug == true)
- clog << "Package " << I.Name() << " has broken dep on " << End.TargetPkg().Name() << endl;
+ clog << "Package " << I.Name() << " has broken dep on " << Start.TargetPkg().Name() << endl;
/* Look across the version list. If there are no possible
targets then we keep the package and bail. This is necessary
if a package has a dep on another package that cant be found */
- pkgCache::Version **VList = End.AllTargets();
+ pkgCache::Version **VList = Start.AllTargets();
if (*VList == 0 && (Flags[I->ID] & Protected) != Protected &&
- End->Type != pkgCache::Dep::Conflicts &&
+ Start->Type != pkgCache::Dep::Conflicts &&
Cache[I].NowBroken() == false)
{
Change = true;
@@ -763,10 +770,10 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
pkgCache::PkgIterator Pkg = Ver.ParentPkg();
if (Debug == true)
- clog << " Considering " << Pkg.Name() << ' ' << (int)Scores[Pkg->ID] <<
+ clog << " Considering " << Pkg.Name() << ' ' << (int)Scores[Pkg->ID] <<
" as a solution to " << I.Name() << ' ' << (int)Scores[I->ID] << endl;
if (Scores[I->ID] <= Scores[Pkg->ID] ||
- ((Cache[End] & pkgDepCache::DepGNow) == 0 &&
+ ((Cache[Start] & pkgDepCache::DepNow) == 0 &&
End->Type != pkgCache::Dep::Conflicts))
{
// Try a little harder to fix protected packages..
@@ -783,17 +790,21 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
if (Cache[I].InstBroken() == false)
{
if (Debug == true)
- clog << " Holding Back " << I.Name() << " rather than change " << End.TargetPkg().Name() << endl;
+ clog << " Holding Back " << I.Name() << " rather than change " << Start.TargetPkg().Name() << endl;
}
else
- {
+ {
if (BrokenFix == false || DoUpgrade(I) == false)
{
- if (Debug == true)
- clog << " Removing " << I.Name() << " rather than change " << End.TargetPkg().Name() << endl;
- Cache.MarkDelete(I);
- if (Counter > 1)
- Scores[I->ID] = Scores[Pkg->ID];
+ // Consider other options
+ if (InOr == false)
+ {
+ if (Debug == true)
+ clog << " Removing " << I.Name() << " rather than change " << Start.TargetPkg().Name() << endl;
+ Cache.MarkDelete(I);
+ if (Counter > 1)
+ Scores[I->ID] = Scores[Pkg->ID];
+ }
}
}
@@ -811,25 +822,25 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
LEnd->Dep = End;
LEnd++;
- if (End->Type != pkgCache::Dep::Conflicts)
+ if (Start->Type != pkgCache::Dep::Conflicts)
break;
}
}
// Hm, nothing can possibly satisify this dep. Nuke it.
- if (VList[0] == 0 && End->Type != pkgCache::Dep::Conflicts &&
- (Flags[I->ID] & Protected) != Protected)
+ if (VList[0] == 0 && Start->Type != pkgCache::Dep::Conflicts &&
+ (Flags[I->ID] & Protected) != Protected && InOr == false)
{
Cache.MarkKeep(I);
if (Cache[I].InstBroken() == false)
{
if (Debug == true)
- clog << " Holding Back " << I.Name() << " because I can't find " << End.TargetPkg().Name() << endl;
+ clog << " Holding Back " << I.Name() << " because I can't find " << Start.TargetPkg().Name() << endl;
}
else
{
if (Debug == true)
- clog << " Removing " << I.Name() << " because I can't find " << End.TargetPkg().Name() << endl;
+ clog << " Removing " << I.Name() << " because I can't find " << Start.TargetPkg().Name() << endl;
Cache.MarkDelete(I);
}
@@ -837,6 +848,10 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
Done = true;
}
+ // Try some more
+ if (InOr == true)
+ continue;
+
delete [] VList;
if (Done == true)
break;
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc
index a2c6ab370..ddb07532d 100644
--- a/apt-pkg/contrib/fileutl.cc
+++ b/apt-pkg/contrib/fileutl.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: fileutl.cc,v 1.30 1999/07/26 17:46:08 jgg Exp $
+// $Id: fileutl.cc,v 1.31 1999/09/30 06:30:34 jgg Exp $
/* ######################################################################
File Utilities
@@ -150,6 +150,45 @@ string flNotFile(string File)
return string(File,0,Res);
}
/*}}}*/
+// flNoLink - If file is a symlink then deref it /*{{{*/
+// ---------------------------------------------------------------------
+/* If the name is not a link then the returned path is the input. */
+string flNoLink(string File)
+{
+ struct stat St;
+ if (lstat(File.c_str(),&St) != 0 || S_ISLNK(St.st_mode) == 0)
+ return File;
+ if (stat(File.c_str(),&St) != 0)
+ return File;
+
+ /* Loop resolving the link. There is no need to limit the number of
+ loops because the stat call above ensures that the symlink is not
+ circular */
+ char Buffer[1024];
+ string NFile = File;
+ while (1)
+ {
+ // Read the link
+ int Res;
+ if ((Res = readlink(NFile.c_str(),Buffer,sizeof(Buffer))) <= 0 ||
+ (unsigned)Res >= sizeof(Buffer))
+ return File;
+
+ // Append or replace the previous path
+ Buffer[Res] = 0;
+ if (Buffer[0] == '/')
+ NFile = Buffer;
+ else
+ NFile = flNotFile(NFile) + Buffer;
+
+ // See if we are done
+ if (lstat(NFile.c_str(),&St) != 0)
+ return File;
+ if (S_ISLNK(St.st_mode) == 0)
+ return NFile;
+ }
+}
+ /*}}}*/
// SetCloseExec - Set the close on exec flag /*{{{*/
// ---------------------------------------------------------------------
/* */
diff --git a/apt-pkg/contrib/fileutl.h b/apt-pkg/contrib/fileutl.h
index fe904acf5..7ad630ce3 100644
--- a/apt-pkg/contrib/fileutl.h
+++ b/apt-pkg/contrib/fileutl.h
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: fileutl.h,v 1.21 1999/07/26 17:46:08 jgg Exp $
+// $Id: fileutl.h,v 1.22 1999/09/30 06:30:34 jgg Exp $
/* ######################################################################
File Utilities
@@ -83,5 +83,6 @@ bool ExecWait(int Pid,const char *Name,bool Reap = false);
// File string manipulators
string flNotDir(string File);
string flNotFile(string File);
+string flNoLink(string File);
#endif
diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc
index 59d15f7d0..9da03a7f6 100644
--- a/apt-pkg/deb/deblistparser.cc
+++ b/apt-pkg/deb/deblistparser.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: deblistparser.cc,v 1.22 1999/07/30 02:54:25 jgg Exp $
+// $Id: deblistparser.cc,v 1.23 1999/09/30 06:30:34 jgg Exp $
/* ######################################################################
Package Cache Generator - Generator for the cache structure.
@@ -88,7 +88,7 @@ bool debListParser::NewVersion(pkgCache::VerIterator Ver)
{"extra",pkgCache::State::Extra}};
if (GrabWord(string(Start,Stop-Start),PrioList,
_count(PrioList),Ver->Priority) == false)
- return _error->Error("Malformed Priority line");
+ Ver->Priority = pkgCache::State::Extra;
}
if (ParseDepends(Ver,"Depends",pkgCache::Dep::Depends) == false)
@@ -154,11 +154,18 @@ unsigned short debListParser::VersionHash()
continue;
/* Strip out any spaces from the text, this undoes dpkgs reformatting
- of certain fields */
+ of certain fields. dpkg also has the rather interesting notion of
+ reformatting depends operators < -> <= */
char *I = S;
for (; Start != End; Start++)
+ {
if (isspace(*Start) == 0)
*I++ = tolower(*Start);
+ if (*Start == '<' && Start[1] != '<' && Start[1] != '=')
+ *I++ = '=';
+ if (*Start == '>' && Start[1] != '>' && Start[1] != '=')
+ *I++ = '=';
+ }
Result = AddCRC16(Result,S,I - S);
}
diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc
index 28a8d7fb2..b76f78b3c 100644
--- a/apt-pkg/packagemanager.cc
+++ b/apt-pkg/packagemanager.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: packagemanager.cc,v 1.20 1999/08/12 05:59:54 jgg Exp $
+// $Id: packagemanager.cc,v 1.21 1999/09/30 06:30:34 jgg Exp $
/* ######################################################################
Package Manager - Abstacts the package manager
@@ -414,12 +414,17 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg)
/* See if this packages install version has any predependencies
that are not met by 'now' packages. */
for (DepIterator D = Cache[Pkg].InstVerIter(Cache).DependsList();
- D.end() == false; D++)
+ D.end() == false; )
{
- if (D->Type == pkgCache::Dep::PreDepends)
+ // Compute a single dependency element (glob or)
+ pkgCache::DepIterator Start;
+ pkgCache::DepIterator End;
+ D.GlobOr(Start,End);
+
+ while (End->Type == pkgCache::Dep::PreDepends)
{
// Look for possible ok targets.
- Version **VList = D.AllTargets();
+ Version **VList = Start.AllTargets();
bool Bad = true;
for (Version **I = VList; *I != 0 && Bad == true; I++)
{
@@ -450,18 +455,24 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg)
}
delete [] VList;
-
- if (Bad == true)
- return _error->Error("Internal Error, Couldn't configure a pre-depend");
- continue;
+ /* If this or element did not match then continue on to the
+ next or element until a matching element is found*/
+ if (Bad == true)
+ {
+ if (Start == End)
+ return _error->Error("Internal Error, Couldn't configure a pre-depend");
+ Start++;
+ }
+ else
+ break;
}
- if (D->Type == pkgCache::Dep::Conflicts)
+ if (End->Type == pkgCache::Dep::Conflicts)
{
/* Look for conflicts. Two packages that are both in the install
state cannot conflict so we don't check.. */
- Version **VList = D.AllTargets();
+ Version **VList = End.AllTargets();
for (Version **I = VList; *I != 0; I++)
{
VerIterator Ver(Cache,*I);
diff --git a/apt-pkg/sourcelist.cc b/apt-pkg/sourcelist.cc
index 77f2acbc0..48d32f908 100644
--- a/apt-pkg/sourcelist.cc
+++ b/apt-pkg/sourcelist.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: sourcelist.cc,v 1.15 1999/09/09 06:15:51 jgg Exp $
+// $Id: sourcelist.cc,v 1.16 1999/09/30 06:30:34 jgg Exp $
/* ######################################################################
List of Sources
@@ -172,6 +172,8 @@ string pkgSourceList::Item::PackagesURI() const
{
if (Dist != "/")
Res = URI + Dist;
+ else
+ Res = URI;
}
else
Res = URI + "dists/" + Dist + '/' + Section +
@@ -240,6 +242,8 @@ string pkgSourceList::Item::ReleaseURI() const
{
if (Dist != "/")
Res = URI + Dist;
+ else
+ Res = URI;
}
else
Res = URI + "dists/" + Dist + '/' + Section +
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc
index acb085aba..652e86e48 100644
--- a/cmdline/apt-get.cc
+++ b/cmdline/apt-get.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: apt-get.cc,v 1.76 1999/09/16 02:08:09 jgg Exp $
+// $Id: apt-get.cc,v 1.77 1999/09/30 06:30:34 jgg Exp $
/* ######################################################################
apt-get - Cover for dpkg
@@ -154,7 +154,7 @@ bool ShowList(ostream &out,string Title,string List)
/* This prints out the names of all the packages that are broken along
with the name of each each broken dependency and a quite version
description. */
-void ShowBroken(ostream &out,CacheFile &Cache)
+void ShowBroken(ostream &out,CacheFile &Cache,bool Now)
{
out << "Sorry, but the following packages have unmet dependencies:" << endl;
for (unsigned J = 0; J < Cache->Head().PackageCount; J++)
@@ -198,15 +198,14 @@ void ShowBroken(ostream &out,CacheFile &Cache)
")";
/* Show a summary of the target package if possible. In the case
- of virtual packages we show nothing */
-
+ of virtual packages we show nothing */
pkgCache::PkgIterator Targ = End.TargetPkg();
if (Targ->ProvidesList == 0)
{
out << " but ";
pkgCache::VerIterator Ver = Cache[Targ].InstVerIter(Cache);
if (Ver.end() == false)
- out << Ver.VerStr() << " is installed";
+ out << Ver.VerStr() << (Now?" is installed":" is to be installed");
else
{
if (Cache[Targ].CandidateVerIter(Cache).end() == true)
@@ -217,7 +216,7 @@ void ShowBroken(ostream &out,CacheFile &Cache)
out << "it is a virtual package";
}
else
- out << "it is not installed";
+ out << (Now?"it is not installed":"it is not going to be installed");
}
}
@@ -467,7 +466,7 @@ bool CacheFile::CheckDeps(bool AllowBroken)
if (pkgFixBroken(*Cache) == false || Cache->BrokenCount() != 0)
{
c1out << " failed." << endl;
- ShowBroken(c1out,*this);
+ ShowBroken(c1out,*this,true);
return _error->Error("Unable to correct dependencies");
}
@@ -479,7 +478,7 @@ bool CacheFile::CheckDeps(bool AllowBroken)
else
{
c1out << "You might want to run `apt-get -f install' to correct these." << endl;
- ShowBroken(c1out,*this);
+ ShowBroken(c1out,*this,true);
return _error->Error("Unmet dependencies. Try using -f.");
}
@@ -522,7 +521,7 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true,bool Saftey =
// Sanity check
if (Cache->BrokenCount() != 0)
{
- ShowBroken(c1out,Cache);
+ ShowBroken(c1out,Cache,false);
return _error->Error("Internal Error, InstallPackages was called with broken packages!");
}
@@ -810,7 +809,7 @@ bool DoUpgrade(CommandLine &CmdL)
// Do the upgrade
if (pkgAllUpgrade(Cache) == false)
{
- ShowBroken(c1out,Cache);
+ ShowBroken(c1out,Cache,false);
return _error->Error("Internal Error, AllUpgrade broke stuff");
}
@@ -953,7 +952,7 @@ bool DoInstall(CommandLine &CmdL)
if (BrokenFix == true && Cache->BrokenCount() != 0)
{
c1out << "You might want to run `apt-get -f install' to correct these:" << endl;
- ShowBroken(c1out,Cache);
+ ShowBroken(c1out,Cache,false);
return _error->Error("Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).");
}
@@ -980,7 +979,7 @@ bool DoInstall(CommandLine &CmdL)
c1out << "The following information may help to resolve the situation:" << endl;
c1out << endl;
- ShowBroken(c1out,Cache);
+ ShowBroken(c1out,Cache,false);
return _error->Error("Sorry, broken packages");
}
@@ -1027,7 +1026,7 @@ bool DoDistUpgrade(CommandLine &CmdL)
if (pkgDistUpgrade(*Cache) == false)
{
c0out << "Failed" << endl;
- ShowBroken(c1out,Cache);
+ ShowBroken(c1out,Cache,false);
return false;
}
@@ -1095,7 +1094,7 @@ bool DoDSelectUpgrade(CommandLine &CmdL)
if (Fix.Resolve() == false)
{
- ShowBroken(c1out,Cache);
+ ShowBroken(c1out,Cache,false);
return _error->Error("Internal Error, problem resolver broke stuff");
}
}
@@ -1103,7 +1102,7 @@ bool DoDSelectUpgrade(CommandLine &CmdL)
// Now upgrade everything
if (pkgAllUpgrade(Cache) == false)
{
- ShowBroken(c1out,Cache);
+ ShowBroken(c1out,Cache,false);
return _error->Error("Internal Error, problem resolver broke stuff");
}
diff --git a/configure.in b/configure.in
index dd1c0230b..425552588 100644
--- a/configure.in
+++ b/configure.in
@@ -17,7 +17,7 @@ AC_CONFIG_AUX_DIR(buildlib)
AC_CONFIG_HEADER(include/config.h:buildlib/config.h.in)
dnl -- SET THIS TO THE RELEASE VERSION --
-AC_DEFINE_UNQUOTED(VERSION,"0.3.12")
+AC_DEFINE_UNQUOTED(VERSION,"0.3.12.1")
AC_DEFINE_UNQUOTED(PACKAGE,"apt")
dnl Tom's host stuff
diff --git a/debian/changelog b/debian/changelog
index 04f7712a8..25beaa8bf 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,10 +1,20 @@
+apt (0.3.13.1) unstable; urgency=low
+
+ * Fix Perl or group pre-depends thing Closes: #46091, #46096, #46233
+ * Fix handling of dpkg's conversions from < -> <= Closes: #46094
+ * Make unparsable priorities non-fatal Closes: #46266, #46267
+ * Fix handling of '/' for the dist name. Closes: #43830, #45640, #45692
+
+ -- Jason Gunthorpe <jgg@debian.org> Fri, 3 Sep 1999 09:04:28 -0700
+
apt (0.3.12.1) unstable; urgency=low
* Fix timestamp miss in FTP. Closes: #44363
* Fix sorting of Kept packages. Closes: #44377
* Fix Segfault for dselect-upgrade. Closes: #44436
- * Fix handling of '/' for the dist name. Closes #43830
- * Added APT::Get::Diff-Only and Tar-Only options. Closes #44384
+ * Added APT::Get::Diff-Only and Tar-Only options. Closes: #44384
+
+ * Fix dpkg-preexec. Closes: #44706
-- Jason Gunthorpe <jgg@debian.org> Fri, 3 Sep 1999 09:04:28 -0700
diff --git a/test/makefile b/test/makefile
index 49a501d3d..466c073c7 100644
--- a/test/makefile
+++ b/test/makefile
@@ -13,11 +13,17 @@ include $(PROGRAM_H)
# Scratch program to test incomplete code fragments in
PROGRAM=scratch-test
-SLIBS = -lapt-pkg
-LIB_MAKES = apt-pkg/makefile
+SLIBS = -lapt-inst -lapt-pkg
+LIB_MAKES = apt-pkg/makefile apt-inst/makefile
SOURCE = scratch.cc
include $(PROGRAM_H)
+PROGRAM=testextract
+SLIBS = -lapt-inst -lapt-pkg
+LIB_MAKES = apt-pkg/makefile apt-inst/makefile
+SOURCE = testextract.cc
+include $(PROGRAM_H)
+
# Version compare tester
PROGRAM=versiontest
SLIBS = -lapt-pkg
diff --git a/test/scratch.cc b/test/scratch.cc
index c48f3f594..6f55e53d0 100644
--- a/test/scratch.cc
+++ b/test/scratch.cc
@@ -1,83 +1,102 @@
-#include <string>
-/*void basic_string<char,string_char_traits<char>,alloc>::Rep::release()
-{
- cout << "Release " << (void *)this << ' ' << ref << endl;
- if (--ref == 0) delete this;
-}
-
-basic_string<char,string_char_traits<char>,alloc>::~basic_string()
-{
- cout << "Destroy " << (void *)this << ',' << rep()->ref << endl;
- rep ()->release ();
-}*/
-
-
-
-#include <apt-pkg/tagfile.h>
-#include <apt-pkg/strutl.h>
-
-#include <apt-pkg/cachefile.h>
-#include <apt-pkg/pkgrecords.h>
+#include <apt-pkg/dpkgdb.h>
+#include <apt-pkg/debfile.h>
#include <apt-pkg/error.h>
+#include <apt-pkg/configuration.h>
+#include <apt-pkg/progress.h>
+#include <apt-pkg/extract.h>
#include <apt-pkg/init.h>
-
-#include <signal.h>
-#include <stdio.h>
-#include <malloc.h>
-
-struct Rep
-{
- size_t len, res, ref;
- bool selfish;
-};
+#include <apt-pkg/fileutl.h>
int main(int argc,char *argv[])
{
- pkgCacheFile Cache;
- OpProgress Prog;
pkgInitialize(*_config);
- if (Cache.Open(Prog,false) == false)
+
+ cout << flNoLink(argv[1]) << endl;
+
+ #if 0
+/* DynamicMMap *FileMap = new DynamicMMap(MMap::Public);
+ pkgFLCache *FList = new pkgFLCache(*FileMap);
+
+ char *Name = "/tmp/test";
+ pkgFLCache::PkgIterator Pkg(*FList,0);
+ pkgFLCache::NodeIterator Node = FList->GetNode(Name,Name+strlen(Name),Pkg.Offset(),true,false);
+ cout << (pkgFLCache::Node *)Node << endl;
+ Node = FList->GetNode(Name,Name+strlen(Name),Pkg.Offset(),true,false);
+ cout << (pkgFLCache::Node *)Node << endl;
+*/
+// #if 0
+ _config->Set("Dir::State::status","/tmp/testing/status");
+
+ debDpkgDB Db;
+
+ {
+ OpTextProgress Prog;
+
+ if (Db.ReadyPkgCache(Prog) == false)
+ cerr << "Error!" << endl;
+ Prog.Done();
+
+ if (Db.ReadyFileList(Prog) == false)
+ cerr << "Error!" << endl;
+ }
+
+ if (_error->PendingError() == true)
{
_error->DumpErrors();
return 0;
}
- pkgRecords rec(*Cache);
- while (1)
+/* Db.GetFLCache().BeginDiverLoad();
+ pkgFLCache::PkgIterator Pkg(Db.GetFLCache(),0);
+ if (Db.GetFLCache().AddDiversion(Pkg,"/usr/include/linux/kerneld.h","/usr/bin/nslookup") == false)
+ cerr << "Error!" << endl;
+
+ const char *Tmp = "/usr/include/linux/kerneld.h";
+ pkgFLCache::NodeIterator Nde = Db.GetFLCache().GetNode(Tmp,Tmp+strlen(Tmp),0,false,false);
+ map_ptrloc Loc = Nde->File;
+
+ for (; Nde.end() == false && Nde->File == Loc; Nde++)
+ cout << Nde->Flags << ',' << Nde->Pointer << ',' << Nde.File() << endl;
+ Db.GetFLCache().FinishDiverLoad();*/
+
+/* unsigned int I = 0;
+ pkgFLCache &Fl = Db.GetFLCache();
+ while (I < Fl.HeaderP->HashSize)
+ {
+ cout << I << endl;
+ pkgFLCache::NodeIterator Node(Fl,Fl.NodeP + Fl.HeaderP->FileHash + I++);
+ if (Node->Pointer == 0)
+ continue;
+ for (; Node.end() == false; Node++)
+ {
+ cout << Node.DirN() << '/' << Node.File();
+ if (Node->Flags == pkgFLCache::Node::Diversion)
+ cout << " (div)";
+ if (Node->Flags == pkgFLCache::Node::ConfFile)
+ cout << " (conf)";
+ cout << endl;
+ }
+ }*/
+
+ for (int I = 1; I < argc; I++)
{
- pkgCache::VerIterator V = (*Cache)[Cache->PkgBegin()].CandidateVerIter(*Cache);
- pkgRecords::Parser &Parse = rec.Lookup(V.FileList());
- string Foo = Parse.ShortDesc();
+ FileFd F(argv[I],FileFd::ReadOnly);
+ debDebFile Deb(F);
- cout << (reinterpret_cast<Rep *>(Foo.begin()) - 1)[0].ref << endl;
+ if (Deb.ExtractControl(Db) == false)
+ cerr << "Error!" << endl;
+ cout << argv[I] << endl;
-// cout << Foo << endl;
+ pkgCache::VerIterator Ver = Deb.MergeControl(Db);
+ if (Ver.end() == true)
+ cerr << "Failed" << endl;
+ else
+ cout << Ver.ParentPkg().Name() << ' ' << Ver.VerStr() << endl;
-// cout << rec.Lookup(V.FileList()).ShortDesc() << endl;
- malloc_stats();
+ pkgExtract Extract(Db.GetFLCache(),Ver);
+ Deb.ExtractArchive(Extract);
}
-
-#if 0
- URI U(argv[1]);
- cout << U.Access << endl;
- cout << U.User << endl;
- cout << U.Password << endl;
- cout << U.Host << endl;
- cout << U.Path << endl;
- cout << U.Port << endl;
-
-/*
- FileFd F(argv[1],FileFd::ReadOnly);
- pkgTagFile Reader(F);
-
- pkgTagSection Sect;
- while (Reader.Step(Sect) == true)
- {
- Sect.FindS("Package");
- Sect.FindS("Section");
- Sect.FindS("Version");
- Sect.FindI("Size");
- };*/
-#endif
- return 0;
+// #endif
+#endif
+ _error->DumpErrors();
}