diff options
Diffstat (limited to 'apt-pkg')
-rw-r--r-- | apt-pkg/cdrom.cc | 2 | ||||
-rw-r--r-- | apt-pkg/contrib/fileutl.cc | 18 | ||||
-rw-r--r-- | apt-pkg/contrib/fileutl.h | 4 | ||||
-rw-r--r-- | apt-pkg/deb/dpkgpm.cc | 15 |
4 files changed, 33 insertions, 6 deletions
diff --git a/apt-pkg/cdrom.cc b/apt-pkg/cdrom.cc index 93deb49c4..e3e0027fc 100644 --- a/apt-pkg/cdrom.cc +++ b/apt-pkg/cdrom.cc @@ -383,7 +383,7 @@ bool pkgCdrom::WriteDatabase(Configuration &Cnf) Out.close(); - rename(DFile.c_str(),string(DFile + '~').c_str()); + link(DFile.c_str(),string(DFile + '~').c_str()); if (rename(NewFile.c_str(),DFile.c_str()) != 0) return _error->Errno("rename","Failed to rename %s.new to %s", DFile.c_str(),DFile.c_str()); diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index 49b2f3828..2a3b8a87d 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -700,6 +700,24 @@ bool FileFd::Open(string FileName,OpenMode Mode, unsigned long Perms) SetCloseExec(iFd,true); return true; } + +bool FileFd::OpenDescriptor(int Fd, OpenMode Mode, bool AutoClose) +{ + Close(); + Flags = (AutoClose) ? FileFd::AutoClose : 0; + iFd = Fd; + if (Mode == ReadOnlyGzip) { + gz = gzdopen (iFd, "r"); + if (gz == NULL) { + if (AutoClose) + close (iFd); + return _error->Errno("gzdopen",_("Could not open file descriptor %d"), + Fd); + } + } + this->FileName = ""; + return true; +} /*}}}*/ // FileFd::~File - Closes the file /*{{{*/ // --------------------------------------------------------------------- diff --git a/apt-pkg/contrib/fileutl.h b/apt-pkg/contrib/fileutl.h index 0f70ab722..62705478d 100644 --- a/apt-pkg/contrib/fileutl.h +++ b/apt-pkg/contrib/fileutl.h @@ -28,6 +28,9 @@ #include <zlib.h> +/* Define this for python-apt */ +#define APT_HAS_GZIP 1 + using std::string; class FileFd @@ -60,6 +63,7 @@ class FileFd unsigned long Tell(); unsigned long Size(); bool Open(string FileName,OpenMode Mode,unsigned long Perms = 0666); + bool OpenDescriptor(int Fd, OpenMode Mode, bool AutoClose=false); bool Close(); bool Sync(); diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 67291063c..aa0b04bd5 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -675,17 +675,22 @@ bool pkgDPkgPM::OpenLog() for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; I++) { if (Cache[I].NewInstall()) - install += I.Name() + string(" (") + Cache[I].CandVersion + string("), "); + { + install += I.FullName(false) + string(" (") + Cache[I].CandVersion; + if (Cache[I].Flags & pkgCache::Flag::Auto) + install+= ", automatic"; + install += string("), "); + } else if (Cache[I].Upgrade()) - upgrade += I.Name() + string(" (") + Cache[I].CurVersion + string(", ") + Cache[I].CandVersion + string("), "); + upgrade += I.FullName(false) + string(" (") + Cache[I].CurVersion + string(", ") + Cache[I].CandVersion + string("), "); else if (Cache[I].Downgrade()) - downgrade += I.Name() + string(" (") + Cache[I].CurVersion + string(", ") + Cache[I].CandVersion + string("), "); + downgrade += I.FullName(false) + string(" (") + Cache[I].CurVersion + string(", ") + Cache[I].CandVersion + string("), "); else if (Cache[I].Delete()) { if ((Cache[I].iFlags & pkgDepCache::Purge) == pkgDepCache::Purge) - purge += I.Name() + string(" (") + Cache[I].CurVersion + string("), "); + purge += I.FullName(false) + string(" (") + Cache[I].CurVersion + string("), "); else - remove += I.Name() + string(" (") + Cache[I].CurVersion + string("), "); + remove += I.FullName(false) + string(" (") + Cache[I].CurVersion + string("), "); } } if (_config->Exists("Commandline::AsString") == true) |