summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorMichael Vogt <egon@bottom>2007-06-09 01:44:03 +0200
committerMichael Vogt <egon@bottom>2007-06-09 01:44:03 +0200
commitf32484472374cb6c93fef0cd4ee9f71a7b80ec8a (patch)
treece174fb35ed7266a2d123c7bf8883463ab04d603 /apt-pkg
parent256f68abcf71157df78ab1aee08e46ff1b4f2b66 (diff)
parentfb2894d268d4821e0dd4f2b803ff2043b1ec3162 (diff)
* merged from apt--mvo
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/depcache.cc10
-rw-r--r--apt-pkg/depcache.h2
2 files changed, 9 insertions, 3 deletions
diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc
index ac667d51d..fe981ea76 100644
--- a/apt-pkg/depcache.cc
+++ b/apt-pkg/depcache.cc
@@ -23,6 +23,8 @@
#include <sstream>
#include <set>
+#include <sys/stat.h>
+
#include <apti18n.h>
pkgDepCache::ActionGroup::ActionGroup(pkgDepCache &cache) :
@@ -176,7 +178,7 @@ bool pkgDepCache::readStateFile(OpProgress *Prog)
return true;
}
-bool pkgDepCache::writeStateFile(OpProgress *prog)
+bool pkgDepCache::writeStateFile(OpProgress *prog, bool InstalledOnly)
{
if(_config->FindB("Debug::pkgAutoRemove",false))
std::clog << "pkgDepCache::writeStateFile()" << std::endl;
@@ -238,6 +240,9 @@ bool pkgDepCache::writeStateFile(OpProgress *prog)
std::clog << "Skipping already written " << pkg.Name() << std::endl;
continue;
}
+ // skip not installed ones if requested
+ if(InstalledOnly && pkg->CurrentVer == 0)
+ continue;
if(_config->FindB("Debug::pkgAutoRemove",false))
std::clog << "Writing new AutoInstall: "
<< pkg.Name() << std::endl;
@@ -250,8 +255,9 @@ bool pkgDepCache::writeStateFile(OpProgress *prog)
}
fclose(OutFile);
- // move the outfile over the real file
+ // move the outfile over the real file and set permissions
rename(outfile.c_str(), state.c_str());
+ chmod(state.c_str(), 0644);
return true;
}
diff --git a/apt-pkg/depcache.h b/apt-pkg/depcache.h
index b2bcfb58a..84fed7f37 100644
--- a/apt-pkg/depcache.h
+++ b/apt-pkg/depcache.h
@@ -403,7 +403,7 @@ class pkgDepCache : protected pkgCache::Namespace
// read persistent states
bool readStateFile(OpProgress *prog);
- bool writeStateFile(OpProgress *prog);
+ bool writeStateFile(OpProgress *prog, bool InstalledOnly=false);
// Size queries
inline double UsrSize() {return iUsrSize;};