Skip to content

Commit

Permalink
Fixed dumpavail some more
Browse files Browse the repository at this point in the history
Author: jgg
Date: 1999-03-18 04:52:51 GMT
Fixed dumpavail some more
  • Loading branch information
Arch Librarian committed Sep 20, 2004
1 parent 35c22de commit 5b8c90b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
17 changes: 12 additions & 5 deletions cmdline/apt-cache.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// $Id: apt-cache.cc,v 1.29 1999/03/17 03:25:25 jgg Exp $
// $Id: apt-cache.cc,v 1.30 1999/03/18 04:52:51 jgg Exp $
/* ######################################################################
apt-cache - Manages the cache files
Expand Down Expand Up @@ -333,15 +333,19 @@ bool Dump(CommandLine &Cmd)
/*}}}*/
// GetCandidateVer - Returns the Candidate install version /*{{{*/
// ---------------------------------------------------------------------
/* This should really use the DepCache or something.. Copied from there. */
static pkgCache::VerIterator GetCandidateVer(pkgCache::PkgIterator Pkg)
/* This should really use the DepCache or something.. Copied from there.
Allow current is required to filter out the status file when emitting
an available file. */
static pkgCache::VerIterator GetCandidateVer(pkgCache::PkgIterator Pkg,
bool AllowCurrent = true)
{
/* Not source/not automatic versions cannot be a candidate version
unless they are already installed */
for (pkgCache::VerIterator I = Pkg.VersionList(); I.end() == false; I++)
{
if (Pkg.CurrentVer() == I)
if (Pkg.CurrentVer() == I && AllowCurrent == true)
return I;

for (pkgCache::VerFileIterator J = I.FileList(); J.end() == false; J++)
if ((J.File()->Flags & pkgCache::Flag::NotSource) == 0 &&
(J.File()->Flags & pkgCache::Flag::NotAutomatic) == 0)
Expand All @@ -361,6 +365,9 @@ bool DumpAvail(CommandLine &Cmd)

for (pkgCache::PkgFileIterator I = Cache.FileBegin(); I.end() == false; I++)
{
if ((I->Flags & pkgCache::Flag::NotSource) != 0)
continue;

if (I.IsOk() == false)
{
delete [] Buffer;
Expand All @@ -379,7 +386,7 @@ bool DumpAvail(CommandLine &Cmd)
for (pkgCache::PkgIterator P = Cache.PkgBegin(); P.end() == false; P++)
{
// Find the proper version to use. We should probably use the DepCache.
pkgCache::VerIterator V = GetCandidateVer(P);
pkgCache::VerIterator V = GetCandidateVer(P,false);

if (V.end() == true || V.FileList().File() != I)
continue;
Expand Down
3 changes: 3 additions & 0 deletions dselect/update
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ RES=`apt-config shell OPTS DSelect::UpdateOptions \
PROMPT DSelect::PromptAfterUpdate`
eval $RES

# It looks slightly ugly to have a double / in the dpkg output
CACHEDIR=`echo $CACHEDIR | sed -e "s|/$||"`

$APTGET $OPTS update

echo "Merging Available information"
Expand Down

0 comments on commit 5b8c90b

Please sign in to comment.