From 3826564e07eaffb05eca5af34a0e76f6f161b89c Mon Sep 17 00:00:00 2001 From: Matt Zimmerman Date: Mon, 13 Dec 2004 10:59:20 +0000 Subject: [PATCH] Merge misc-abi-changes Patches applied: * apt@packages.debian.org/apt--misc-abi-changes--0--base-0 tag of apt@packages.debian.org/apt--main--0--patch-16 * apt@packages.debian.org/apt--misc-abi-changes--0--patch-1 Fix apt-get -s remove to not display the candidate version * apt@packages.debian.org/apt--misc-abi-changes--0--patch-2 Merge from main * apt@packages.debian.org/apt--misc-abi-changes--0--patch-3 Use pid_t throughout to hold process IDs --- apt-inst/deb/dpkgdb.cc | 2 +- apt-pkg/algorithms.cc | 25 ++++++++++++++----------- apt-pkg/algorithms.h | 4 +++- apt-pkg/contrib/fileutl.cc | 4 ++-- apt-pkg/contrib/fileutl.h | 4 ++-- apt-pkg/makefile | 2 +- cmdline/indexcopy.cc | 2 +- debian/changelog | 12 +++++++++++- ftparchive/multicompress.cc | 8 ++++---- ftparchive/multicompress.h | 6 +++--- ftparchive/writer.cc | 2 +- methods/gzip.cc | 2 +- methods/rsh.h | 2 +- po/apt-all.pot | 6 +++--- 14 files changed, 48 insertions(+), 33 deletions(-) diff --git a/apt-inst/deb/dpkgdb.cc b/apt-inst/deb/dpkgdb.cc index 50b361948..7da5a26aa 100644 --- a/apt-inst/deb/dpkgdb.cc +++ b/apt-inst/deb/dpkgdb.cc @@ -61,7 +61,7 @@ static bool EraseDir(const char *Dir) return _error->Errno("rmdir",_("Failed to remove %s"),Dir); // Purge it using rm - int Pid = ExecFork(); + pid_t Pid = ExecFork(); // Spawn the subprocess if (Pid == 0) diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc index 9b37385bf..479927d65 100644 --- a/apt-pkg/algorithms.cc +++ b/apt-pkg/algorithms.cc @@ -50,26 +50,29 @@ pkgSimulate::pkgSimulate(pkgDepCache *Cache) : pkgPackageManager(Cache), /*}}}*/ // Simulate::Describe - Describe a package /*{{{*/ // --------------------------------------------------------------------- -/* Parameter Now == true gives both current and available varsion, - Parameter Now == false gives only the available package version */ -void pkgSimulate::Describe(PkgIterator Pkg,ostream &out,bool Now) +/* Parameter Current == true displays the current package version, + Parameter Candidate == true displays the candidate package version */ +void pkgSimulate::Describe(PkgIterator Pkg,ostream &out,bool Current,bool Candidate) { VerIterator Ver(Sim); out << Pkg.Name(); - if (Now == true) + if (Current == true) { Ver = Pkg.CurrentVer(); if (Ver.end() == false) out << " [" << Ver.VerStr() << ']'; } - Ver = Sim[Pkg].CandidateVerIter(Sim); - if (Ver.end() == true) - return; + if (Candidate == true) + { + Ver = Sim[Pkg].CandidateVerIter(Sim); + if (Ver.end() == true) + return; - out << " (" << Ver.VerStr() << ' ' << Ver.RelStr() << ')'; + out << " (" << Ver.VerStr() << ' ' << Ver.RelStr() << ')'; + } } /*}}}*/ // Simulate::Install - Simulate unpacking of a package /*{{{*/ @@ -82,7 +85,7 @@ bool pkgSimulate::Install(PkgIterator iPkg,string /*File*/) Flags[Pkg->ID] = 1; cout << "Inst "; - Describe(Pkg,cout,true); + Describe(Pkg,cout,true,true); Sim.MarkInstall(Pkg,false); // Look for broken conflicts+predepends. @@ -156,7 +159,7 @@ bool pkgSimulate::Configure(PkgIterator iPkg) else { cout << "Conf "; - Describe(Pkg,cout,false); + Describe(Pkg,cout,false,true); } if (Sim.BrokenCount() != 0) @@ -181,7 +184,7 @@ bool pkgSimulate::Remove(PkgIterator iPkg,bool Purge) cout << "Purg "; else cout << "Remv "; - Describe(Pkg,cout,false); + Describe(Pkg,cout,true,false); if (Sim.BrokenCount() != 0) ShortBreaks(); diff --git a/apt-pkg/algorithms.h b/apt-pkg/algorithms.h index 0b38e4244..174a7f58d 100644 --- a/apt-pkg/algorithms.h +++ b/apt-pkg/algorithms.h @@ -67,8 +67,10 @@ class pkgSimulate : public pkgPackageManager virtual bool Install(PkgIterator Pkg,string File); virtual bool Configure(PkgIterator Pkg); virtual bool Remove(PkgIterator Pkg,bool Purge); + +private: void ShortBreaks(); - void Describe(PkgIterator iPkg,ostream &out,bool Now); + void Describe(PkgIterator iPkg,ostream &out,bool Current,bool Candidate); public: diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index 4ba8ab05a..7c9f5c0dd 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -306,7 +306,7 @@ bool WaitFd(int Fd,bool write,unsigned long timeout) /* This is used if you want to cleanse the environment for the forked child, it fixes up the important signals and nukes all of the fds, otherwise acts like normal fork. */ -int ExecFork() +pid_t ExecFork() { // Fork off the process pid_t Process = fork(); @@ -340,7 +340,7 @@ int ExecFork() /* Waits for the given sub process. If Reap is set then no errors are generated. Otherwise a failed subprocess will generate a proper descriptive message */ -bool ExecWait(int Pid,const char *Name,bool Reap) +bool ExecWait(pid_t Pid,const char *Name,bool Reap) { if (Pid <= 1) return true; diff --git a/apt-pkg/contrib/fileutl.h b/apt-pkg/contrib/fileutl.h index b6b9cae83..041aa3309 100644 --- a/apt-pkg/contrib/fileutl.h +++ b/apt-pkg/contrib/fileutl.h @@ -87,8 +87,8 @@ string SafeGetCWD(); void SetCloseExec(int Fd,bool Close); void SetNonBlock(int Fd,bool Block); bool WaitFd(int Fd,bool write = false,unsigned long timeout = 0); -int ExecFork(); -bool ExecWait(int Pid,const char *Name,bool Reap = false); +pid_t ExecFork(); +bool ExecWait(pid_t Pid,const char *Name,bool Reap = false); // File string manipulators string flNotDir(string File); diff --git a/apt-pkg/makefile b/apt-pkg/makefile index ec2013b04..e62a7efd5 100644 --- a/apt-pkg/makefile +++ b/apt-pkg/makefile @@ -13,7 +13,7 @@ include ../buildlib/defaults.mak # methods/makefile - FIXME LIBRARY=apt-pkg LIBEXT=$(GLIBC_VER)$(LIBSTDCPP_VER) -MAJOR=3.6 +MAJOR=3.7 MINOR=0 SLIBS=$(PTHREADLIB) $(INTLLIBS) APT_DOMAIN:=libapt-pkg$(MAJOR) diff --git a/cmdline/indexcopy.cc b/cmdline/indexcopy.cc index 3ce12a94b..0a3cd1575 100644 --- a/cmdline/indexcopy.cc +++ b/cmdline/indexcopy.cc @@ -83,7 +83,7 @@ bool IndexCopy::CopyPackages(string CDROM,string Name,vector &List) fclose(tmp); // Fork gzip - int Process = fork(); + pid_t Process = fork(); if (Process < 0) return _error->Errno("fork","Couldn't fork gzip"); diff --git a/debian/changelog b/debian/changelog index 9d26496f2..8dbf5cc8f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,16 @@ apt (0.6.27) hoary; urgency=low - * Merge apt--authentication--0 branch (gpg authentication) + * Merge apt--authentication--0 branch + - Implement gpg authentication for package repositories (Closes: #203741) + - Also includes Michael Vogt's fixes + * Merge apt--misc-abi-changes--0 branch + - Use pid_t throughout to hold process IDs (Closes: #226701) + - Import patch from Debian bug #195510: (Closes: #195510) + - Make Simulate::Describe and Simulate::ShortBreaks private member + functions + - Add a parameter (Candidate) to Describe to control whether the + candidate version is displayed + - Pass an appropriate value for Candidate everywhere Describe is called -- Matt Zimmerman Mon, 13 Dec 2004 01:03:11 -0800 diff --git a/ftparchive/multicompress.cc b/ftparchive/multicompress.cc index fabd460f8..5073e98ac 100644 --- a/ftparchive/multicompress.cc +++ b/ftparchive/multicompress.cc @@ -271,7 +271,7 @@ bool MultiCompress::Finalize(unsigned long &OutSize) /* This opens the compressor, either in compress mode or decompress mode. FileFd is always the compressor input/output file, OutFd is the created pipe, Input for Compress, Output for Decompress. */ -bool MultiCompress::OpenCompress(const CompType *Prog,int &Pid,int FileFd, +bool MultiCompress::OpenCompress(const CompType *Prog,pid_t &Pid,int FileFd, int &OutFd,bool Comp) { Pid = -1; @@ -334,7 +334,7 @@ bool MultiCompress::OpenCompress(const CompType *Prog,int &Pid,int FileFd, // MultiCompress::OpenOld - Open an old file /*{{{*/ // --------------------------------------------------------------------- /* This opens one of the original output files, possibly decompressing it. */ -bool MultiCompress::OpenOld(int &Fd,int &Proc) +bool MultiCompress::OpenOld(int &Fd,pid_t &Proc) { Files *Best = Outputs; for (Files *I = Outputs; I != 0; I = I->Next) @@ -356,7 +356,7 @@ bool MultiCompress::OpenOld(int &Fd,int &Proc) // MultiCompress::CloseOld - Close the old file /*{{{*/ // --------------------------------------------------------------------- /* */ -bool MultiCompress::CloseOld(int Fd,int Proc) +bool MultiCompress::CloseOld(int Fd,pid_t Proc) { close(Fd); if (Proc != -1) @@ -439,7 +439,7 @@ bool MultiCompress::Child(int FD) while (Missing == false) { int CompFd = -1; - int Proc = -1; + pid_t Proc = -1; if (OpenOld(CompFd,Proc) == false) { _error->Discard(); diff --git a/ftparchive/multicompress.h b/ftparchive/multicompress.h index 212dec63d..444d8626f 100644 --- a/ftparchive/multicompress.h +++ b/ftparchive/multicompress.h @@ -55,7 +55,7 @@ class MultiCompress mode_t Permissions; static const CompType Compressors[]; - bool OpenCompress(const CompType *Prog,int &Pid,int FileFd, + bool OpenCompress(const CompType *Prog,pid_t &Pid,int FileFd, int &OutFd,bool Comp); bool Child(int Fd); bool Start(); @@ -68,8 +68,8 @@ class MultiCompress unsigned long UpdateMTime; bool Finalize(unsigned long &OutSize); - bool OpenOld(int &Fd,int &Proc); - bool CloseOld(int Fd,int Proc); + bool OpenOld(int &Fd,pid_t &Proc); + bool CloseOld(int Fd,pid_t Proc); static bool GetStat(string Output,string Compress,struct stat &St); MultiCompress(string Output,string Compress,mode_t Permissions, diff --git a/ftparchive/writer.cc b/ftparchive/writer.cc index e1fd33ad3..35a23a3d7 100644 --- a/ftparchive/writer.cc +++ b/ftparchive/writer.cc @@ -754,7 +754,7 @@ bool ContentsWriter::ReadFromPkgs(string PkgFile,string PkgCompress) // Open the package file int CompFd = -1; - int Proc = -1; + pid_t Proc = -1; if (Pkgs.OpenOld(CompFd,Proc) == false) return false; diff --git a/methods/gzip.cc b/methods/gzip.cc index 75a038979..809afc0fc 100644 --- a/methods/gzip.cc +++ b/methods/gzip.cc @@ -57,7 +57,7 @@ bool GzipMethod::Fetch(FetchItem *Itm) return _error->Errno("pipe",_("Couldn't open pipe for %s"),Prog); // Fork gzip - int Process = ExecFork(); + pid_t Process = ExecFork(); if (Process == 0) { close(GzOut[0]); diff --git a/methods/rsh.h b/methods/rsh.h index bb97f062c..b06d5a94e 100644 --- a/methods/rsh.h +++ b/methods/rsh.h @@ -29,7 +29,7 @@ class RSHConn public: - int Process; + pid_t Process; // Raw connection IO bool WriteMsg(string &Text,bool Sync,const char *Fmt,...); diff --git a/po/apt-all.pot b/po/apt-all.pot index 722d2e280..bb60a995c 100644 --- a/po/apt-all.pot +++ b/po/apt-all.pot @@ -2087,19 +2087,19 @@ msgstr "" msgid "Index file type '%s' is not supported" msgstr "" -#: apt-pkg/algorithms.cc:238 +#: apt-pkg/algorithms.cc:241 #, c-format msgid "" "The package %s needs to be reinstalled, but I can't find an archive for it." msgstr "" -#: apt-pkg/algorithms.cc:1056 +#: apt-pkg/algorithms.cc:1059 msgid "" "Error, pkgProblemResolver::Resolve generated breaks, this may be caused by " "held packages." msgstr "" -#: apt-pkg/algorithms.cc:1058 +#: apt-pkg/algorithms.cc:1061 msgid "Unable to correct problems, you have held broken packages." msgstr "" -- 2.45.2