acquire-item.h   acquire-item.h 
skipping to change at line 30 skipping to change at line 30
#ifndef PKGLIB_ACQUIRE_ITEM_H #ifndef PKGLIB_ACQUIRE_ITEM_H
#define PKGLIB_ACQUIRE_ITEM_H #define PKGLIB_ACQUIRE_ITEM_H
#include <apt-pkg/acquire.h> #include <apt-pkg/acquire.h>
#include <apt-pkg/indexfile.h> #include <apt-pkg/indexfile.h>
#include <apt-pkg/vendor.h> #include <apt-pkg/vendor.h>
#include <apt-pkg/sourcelist.h> #include <apt-pkg/sourcelist.h>
#include <apt-pkg/pkgrecords.h> #include <apt-pkg/pkgrecords.h>
#include <apt-pkg/indexrecords.h> #include <apt-pkg/indexrecords.h>
#include <apt-pkg/hashes.h> #include <apt-pkg/hashes.h>
#include <apt-pkg/weakptr.h>
/** \addtogroup acquire /** \addtogroup acquire
* @{ * @{
* *
* \file acquire-item.h * \file acquire-item.h
*/ */
/** \brief Represents the process by which a pkgAcquire object should {{{ /** \brief Represents the process by which a pkgAcquire object should {{{
* retrieve a file or a collection of files. * retrieve a file or a collection of files.
* *
* By convention, Item subclasses should insert themselves into the * By convention, Item subclasses should insert themselves into the
* acquire queue when they are created by calling QueueURI(), and * acquire queue when they are created by calling QueueURI(), and
* remove themselves by calling Dequeue() when either Done() or * remove themselves by calling Dequeue() when either Done() or
* Failed() is invoked. Item objects are also responsible for * Failed() is invoked. Item objects are also responsible for
* notifying the download progress indicator (accessible via * notifying the download progress indicator (accessible via
* #Owner->Log) of their status. * #Owner->Log) of their status.
* *
* \see pkgAcquire * \see pkgAcquire
*/ */
class pkgAcquire::Item class pkgAcquire::Item : public WeakPointable
{ {
protected: protected:
/** \brief The acquire object with which this item is associated. */ /** \brief The acquire object with which this item is associated. */
pkgAcquire *Owner; pkgAcquire *Owner;
/** \brief Insert this item into its owner's queue. /** \brief Insert this item into its owner's queue.
* *
* \param ItemDesc Metadata about this item (its URI and * \param ItemDesc Metadata about this item (its URI and
* description). * description).
skipping to change at line 114 skipping to change at line 115
*/ */
StatTransientNetworkError StatTransientNetworkError
} Status; } Status;
/** \brief Contains a textual description of the error encountered /** \brief Contains a textual description of the error encountered
* if #Status is #StatError or #StatAuthError. * if #Status is #StatError or #StatAuthError.
*/ */
string ErrorText; string ErrorText;
/** \brief The size of the object to fetch. */ /** \brief The size of the object to fetch. */
unsigned long FileSize; unsigned long long FileSize;
/** \brief How much of the object was already fetched. */ /** \brief How much of the object was already fetched. */
unsigned long PartialSize; unsigned long long PartialSize;
/** \brief If not \b NULL, contains the name of a subprocess that /** \brief If not \b NULL, contains the name of a subprocess that
* is operating on this object (for instance, "gzip" or "gpgv"). * is operating on this object (for instance, "gzip" or "gpgv").
*/ */
const char *Mode; const char *Mode;
/** \brief A client-supplied unique identifier. /** \brief A client-supplied unique identifier.
* *
* This field is initalized to 0; it is meant to be filled in by * This field is initalized to 0; it is meant to be filled in by
* clients that wish to use it to uniquely identify items. * clients that wish to use it to uniquely identify items.
skipping to change at line 145 skipping to change at line 146
* Subclasses should set this to \b true when appropriate. * Subclasses should set this to \b true when appropriate.
*/ */
bool Complete; bool Complete;
/** \brief If \b true, the URI of this object is "local". /** \brief If \b true, the URI of this object is "local".
* *
* The only effect of this field is to exclude the object from the * The only effect of this field is to exclude the object from the
* download progress indicator's overall statistics. * download progress indicator's overall statistics.
*/ */
bool Local; bool Local;
string UsedMirror;
/** \brief The number of fetch queues into which this item has been /** \brief The number of fetch queues into which this item has been
* inserted. * inserted.
* *
* There is one queue for each source from which an item could be * There is one queue for each source from which an item could be
* downloaded. * downloaded.
* *
* \sa pkgAcquire * \sa pkgAcquire
*/ */
unsigned int QueueCounter; unsigned int QueueCounter;
skipping to change at line 246 skipping to change at line 248
* empty string. * empty string.
*/ */
virtual string HashSum() {return string();}; virtual string HashSum() {return string();};
/** \return the acquire process with which this item is associated. */ /** \return the acquire process with which this item is associated. */
pkgAcquire *GetOwner() {return Owner;}; pkgAcquire *GetOwner() {return Owner;};
/** \return \b true if this object is being fetched from a trusted sourc e. */ /** \return \b true if this object is being fetched from a trusted sourc e. */
virtual bool IsTrusted() {return false;}; virtual bool IsTrusted() {return false;};
// report mirror problems
/** \brief Report mirror problem
*
* This allows reporting mirror failures back to a centralized
* server. The apt-report-mirror-failure script is called for this
*
* \param FailCode A short failure string that is send
*/
void ReportMirrorFailure(string FailCode);
/** \brief Initialize an item. /** \brief Initialize an item.
* *
* Adds the item to the list of items known to the acquire * Adds the item to the list of items known to the acquire
* process, but does not place it into any fetch queues (you must * process, but does not place it into any fetch queues (you must
* manually invoke QueueURI() to do so). * manually invoke QueueURI() to do so).
* *
* Initializes all fields of the item other than Owner to 0, * Initializes all fields of the item other than Owner to 0,
* false, or the empty string. * false, or the empty string.
* *
* \param Owner The new owner of this item. * \param Owner The new owner of this item.
skipping to change at line 424 skipping to change at line 436
/** The patches that remain to be downloaded, including the patch /** The patches that remain to be downloaded, including the patch
* being downloaded right now. This list should be ordered so * being downloaded right now. This list should be ordered so
* that each diff appears before any diff that depends on it. * that each diff appears before any diff that depends on it.
* *
* \todo These are indexed by sha1sum; why not use some sort of * \todo These are indexed by sha1sum; why not use some sort of
* dictionary instead of relying on ordering and stripping them * dictionary instead of relying on ordering and stripping them
* off the front? * off the front?
*/ */
vector<DiffInfo> available_patches; vector<DiffInfo> available_patches;
/** Stop applying patches when reaching that sha1 */
string ServerSha1;
/** The current status of this patch. */ /** The current status of this patch. */
enum DiffState enum DiffState
{ {
/** \brief The diff is in an unknown state. */ /** \brief The diff is in an unknown state. */
StateFetchUnkown, StateFetchUnkown,
/** \brief The diff is currently being fetched. */ /** \brief The diff is currently being fetched. */
StateFetchDiff, StateFetchDiff,
/** \brief The diff is currently being uncompressed. */ /** \brief The diff is currently being uncompressed. */
skipping to change at line 477 skipping to change at line 493
* \param ExpectedHash The expected md5sum of the completely * \param ExpectedHash The expected md5sum of the completely
* reconstructed package index file; the index file will be tested * reconstructed package index file; the index file will be tested
* against this value when it is entirely reconstructed. * against this value when it is entirely reconstructed.
* *
* \param diffs The remaining diffs from the index of diffs. They * \param diffs The remaining diffs from the index of diffs. They
* should be ordered so that each diff appears before any diff * should be ordered so that each diff appears before any diff
* that depends on it. * that depends on it.
*/ */
pkgAcqIndexDiffs(pkgAcquire *Owner,string URI,string URIDesc, pkgAcqIndexDiffs(pkgAcquire *Owner,string URI,string URIDesc,
string ShortDesc, HashString ExpectedHash, string ShortDesc, HashString ExpectedHash,
string ServerSha1,
vector<DiffInfo> diffs=vector<DiffInfo>()); vector<DiffInfo> diffs=vector<DiffInfo>());
}; };
/*}} }*/ /*}} }*/
/** \brief An acquire item that is responsible for fetching an index {{{ /** \brief An acquire item that is responsible for fetching an index {{{
* file (e.g., Packages or Sources). * file (e.g., Packages or Sources).
* *
* \sa pkgAcqDiffIndex, pkgAcqIndexDiffs, pkgAcqIndexTrans * \sa pkgAcqDiffIndex, pkgAcqIndexDiffs, pkgAcqIndexTrans
* *
* \todo Why does pkgAcqIndex have protected members? * \todo Why does pkgAcqIndex have protected members?
*/ */
skipping to change at line 547 skipping to change at line 564
* *
* \param ExpectedHash The expected hashsum of this index file. * \param ExpectedHash The expected hashsum of this index file.
* *
* \param compressExt The compression-related extension with which * \param compressExt The compression-related extension with which
* this index file should be downloaded, or "" to autodetect * this index file should be downloaded, or "" to autodetect
* Compression types can be set with config Acquire::CompressionTypes, * Compression types can be set with config Acquire::CompressionTypes,
* default is ".lzma" or ".bz2" (if the needed binaries are present) * default is ".lzma" or ".bz2" (if the needed binaries are present)
* fallback is ".gz" or none. * fallback is ".gz" or none.
*/ */
pkgAcqIndex(pkgAcquire *Owner,string URI,string URIDesc, pkgAcqIndex(pkgAcquire *Owner,string URI,string URIDesc,
string ShortDesc, HashString ExpectedHash, string compressExt string ShortDesc, HashString ExpectedHash,
=""); string compressExt="");
}; };
/*}} }*/ /*}} }*/
/** \brief An acquire item that is responsible for fetching a {{{ /** \brief An acquire item that is responsible for fetching a {{{
* translated index file. * translated index file.
* *
* The only difference from pkgAcqIndex is that transient failures * The only difference from pkgAcqIndex is that transient failures
* are suppressed: no error occurs if the translated index file is * are suppressed: no error occurs if the translated index file is
* missing. * missing.
*/ */
class pkgAcqIndexTrans : public pkgAcqIndex class pkgAcqIndexTrans : public pkgAcqIndex
{ {
public: public:
virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf); virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf);
virtual string Custom600Headers();
/** \brief Create a pkgAcqIndexTrans. /** \brief Create a pkgAcqIndexTrans.
* *
* \param Owner The pkgAcquire object with which this item is * \param Owner The pkgAcquire object with which this item is
* associated. * associated.
* *
* \param URI The URI of the index file that is to be downloaded. * \param URI The URI of the index file that is to be downloaded.
* *
* \param URIDesc A "URI-style" description of this index file. * \param URIDesc A "URI-style" description of this index file.
* *
skipping to change at line 857 skipping to change at line 876
pkgAcquire::ItemDesc Desc; pkgAcquire::ItemDesc Desc;
/** \brief The hashsum of the file to download, if it is known. */ /** \brief The hashsum of the file to download, if it is known. */
HashString ExpectedHash; HashString ExpectedHash;
/** \brief How many times to retry the download, set from /** \brief How many times to retry the download, set from
* Acquire::Retries. * Acquire::Retries.
*/ */
unsigned int Retries; unsigned int Retries;
/** \brief Should this file be considered a index file */
bool IsIndexFile;
public: public:
// Specialized action members // Specialized action members
virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf); virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf);
virtual void Done(string Message,unsigned long Size,string CalcHash, virtual void Done(string Message,unsigned long Size,string CalcHash,
pkgAcquire::MethodConfig *Cnf); pkgAcquire::MethodConfig *Cnf);
virtual string DescURI() {return Desc.URI;}; virtual string DescURI() {return Desc.URI;};
virtual string HashSum() {return ExpectedHash.toStr(); }; virtual string HashSum() {return ExpectedHash.toStr(); };
virtual string Custom600Headers();
/** \brief Create a new pkgAcqFile object. /** \brief Create a new pkgAcqFile object.
* *
* \param Owner The pkgAcquire object with which this object is * \param Owner The pkgAcquire object with which this object is
* associated. * associated.
* *
* \param URI The URI to download. * \param URI The URI to download.
* *
* \param Hash The hashsum of the file to download, if it is known; * \param Hash The hashsum of the file to download, if it is known;
* otherwise "". * otherwise "".
skipping to change at line 888 skipping to change at line 911
* *
* \param Desc A description of the file being downloaded. * \param Desc A description of the file being downloaded.
* *
* \param ShortDesc A brief description of the file being * \param ShortDesc A brief description of the file being
* downloaded. * downloaded.
* *
* \param DestDir The directory the file should be downloaded into. * \param DestDir The directory the file should be downloaded into.
* *
* \param DestFilename The filename+path the file is downloaded to. * \param DestFilename The filename+path the file is downloaded to.
* *
* \param IsIndexFile The file is considered a IndexFile and cache-cont
rol
* headers like "cache-control: max-age=0" are send
* *
* If DestFilename is empty, download to DestDir/<basename> if * If DestFilename is empty, download to DestDir/<basename> if
* DestDir is non-empty, $CWD/<basename> otherwise. If * DestDir is non-empty, $CWD/<basename> otherwise. If
* DestFilename is NOT empty, DestDir is ignored and DestFilename * DestFilename is NOT empty, DestDir is ignored and DestFilename
* is the absolute name to which the file should be downloaded. * is the absolute name to which the file should be downloaded.
*/ */
pkgAcqFile(pkgAcquire *Owner, string URI, string Hash, unsigned long Siz e, pkgAcqFile(pkgAcquire *Owner, string URI, string Hash, unsigned long Siz e,
string Desc, string ShortDesc, string Desc, string ShortDesc,
const string &DestDir="", const string &DestFilename=""); const string &DestDir="", const string &DestFilename="",
bool IsIndexFile=false);
}; };
/*}} }*/ /*}} }*/
/** @} */ /** @} */
#endif #endif
 End of changes. 14 change blocks. 
6 lines changed or deleted 32 lines changed or added


 acquire-method.h   acquire-method.h 
skipping to change at line 39 skipping to change at line 39
protected: protected:
struct FetchItem struct FetchItem
{ {
FetchItem *Next; FetchItem *Next;
string Uri; string Uri;
string DestFile; string DestFile;
time_t LastModified; time_t LastModified;
bool IndexFile; bool IndexFile;
bool FailIgnore;
}; };
struct FetchResult struct FetchResult
{ {
string MD5Sum; string MD5Sum;
string SHA1Sum; string SHA1Sum;
string SHA256Sum; string SHA256Sum;
vector<string> GPGVOutput; vector<string> GPGVOutput;
time_t LastModified; time_t LastModified;
bool IMSHit; bool IMSHit;
skipping to change at line 61 skipping to change at line 62
unsigned long ResumePoint; unsigned long ResumePoint;
void TakeHashes(Hashes &Hash); void TakeHashes(Hashes &Hash);
FetchResult(); FetchResult();
}; };
// State // State
vector<string> Messages; vector<string> Messages;
FetchItem *Queue; FetchItem *Queue;
FetchItem *QueueBack; FetchItem *QueueBack;
string FailExtra; string FailReason;
string UsedMirror;
string IP;
// Handlers for messages // Handlers for messages
virtual bool Configuration(string Message); virtual bool Configuration(string Message);
virtual bool Fetch(FetchItem * /*Item*/) {return true;}; virtual bool Fetch(FetchItem * /*Item*/) {return true;};
// Outgoing messages // Outgoing messages
void Fail(bool Transient = false); void Fail(bool Transient = false);
inline void Fail(const char *Why, bool Transient = false) {Fail(string(W hy),Transient);}; inline void Fail(const char *Why, bool Transient = false) {Fail(string(W hy),Transient);};
void Fail(string Why, bool Transient = false); virtual void Fail(string Why, bool Transient = false);
void URIStart(FetchResult &Res); virtual void URIStart(FetchResult &Res);
void URIDone(FetchResult &Res,FetchResult *Alt = 0); virtual void URIDone(FetchResult &Res,FetchResult *Alt = 0);
bool MediaFail(string Required,string Drive); bool MediaFail(string Required,string Drive);
virtual void Exit() {}; virtual void Exit() {};
public: public:
enum CnfFlags {SingleInstance = (1<<0), enum CnfFlags {SingleInstance = (1<<0),
Pipeline = (1<<1), SendConfig = (1<<2), Pipeline = (1<<1), SendConfig = (1<<2),
LocalOnly = (1<<3), NeedsCleanup = (1<<4), LocalOnly = (1<<3), NeedsCleanup = (1<<4),
Removable = (1<<5)}; Removable = (1<<5)};
void Log(const char *Format,...); void Log(const char *Format,...);
void Status(const char *Format,...); void Status(const char *Format,...);
void Redirect(const string &NewURI); void Redirect(const string &NewURI);
skipping to change at line 89 skipping to change at line 92
Pipeline = (1<<1), SendConfig = (1<<2), Pipeline = (1<<1), SendConfig = (1<<2),
LocalOnly = (1<<3), NeedsCleanup = (1<<4), LocalOnly = (1<<3), NeedsCleanup = (1<<4),
Removable = (1<<5)}; Removable = (1<<5)};
void Log(const char *Format,...); void Log(const char *Format,...);
void Status(const char *Format,...); void Status(const char *Format,...);
void Redirect(const string &NewURI); void Redirect(const string &NewURI);
int Run(bool Single = false); int Run(bool Single = false);
inline void SetFailExtraMsg(string Msg) {FailExtra = Msg;}; inline void SetFailReason(string Msg) {FailReason = Msg;};
inline void SetIP(string aIP) {IP = aIP;};
pkgAcqMethod(const char *Ver,unsigned long Flags = 0); pkgAcqMethod(const char *Ver,unsigned long Flags = 0);
virtual ~pkgAcqMethod() {}; virtual ~pkgAcqMethod() {};
}; };
/** @} */ /** @} */
#endif #endif
 End of changes. 5 change blocks. 
6 lines changed or deleted 10 lines changed or added


 acquire-worker.h   acquire-worker.h 
skipping to change at line 23 skipping to change at line 23
/** \addtogroup acquire /** \addtogroup acquire
* @{ * @{
* *
* \file acquire-worker.h * \file acquire-worker.h
*/ */
#ifndef PKGLIB_ACQUIRE_WORKER_H #ifndef PKGLIB_ACQUIRE_WORKER_H
#define PKGLIB_ACQUIRE_WORKER_H #define PKGLIB_ACQUIRE_WORKER_H
#include <apt-pkg/acquire.h> #include <apt-pkg/acquire.h>
#include <apt-pkg/weakptr.h>
/** \brief A fetch subprocess. /** \brief A fetch subprocess.
* *
* A worker process is responsible for one stage of the fetch. This * A worker process is responsible for one stage of the fetch. This
* class encapsulates the communications protocol between the master * class encapsulates the communications protocol between the master
* process and the worker, from the master end. * process and the worker, from the master end.
* *
* Each worker is intrinsically placed on two linked lists. The * Each worker is intrinsically placed on two linked lists. The
* Queue list (maintained in the #NextQueue variable) is maintained * Queue list (maintained in the #NextQueue variable) is maintained
* by the pkgAcquire::Queue class; it represents the set of workers * by the pkgAcquire::Queue class; it represents the set of workers
* assigned to a particular queue. The Acquire list (maintained in * assigned to a particular queue. The Acquire list (maintained in
* the #NextAcquire variable) is maintained by the pkgAcquire class; * the #NextAcquire variable) is maintained by the pkgAcquire class;
* it represents the set of active workers for a particular * it represents the set of active workers for a particular
* pkgAcquire object. * pkgAcquire object.
* *
* \todo Like everything else in the Acquire system, this has way too * \todo Like everything else in the Acquire system, this has way too
* many protected items. * many protected items.
* *
* \sa pkgAcqMethod, pkgAcquire::Item, pkgAcquire * \sa pkgAcqMethod, pkgAcquire::Item, pkgAcquire
*/ */
class pkgAcquire::Worker class pkgAcquire::Worker : public WeakPointable
{ {
friend class pkgAcquire; friend class pkgAcquire;
protected: protected:
friend class Queue; friend class Queue;
/** \brief The next link on the Queue list. /** \brief The next link on the Queue list.
* *
* \todo This is always NULL; is it just for future use? * \todo This is always NULL; is it just for future use?
*/ */
 End of changes. 2 change blocks. 
1 lines changed or deleted 2 lines changed or added


 acquire.h   acquire.h 
skipping to change at line 69 skipping to change at line 69
/** \addtogroup acquire /** \addtogroup acquire
* *
* @{ * @{
* *
* \file acquire.h * \file acquire.h
*/ */
#ifndef PKGLIB_ACQUIRE_H #ifndef PKGLIB_ACQUIRE_H
#define PKGLIB_ACQUIRE_H #define PKGLIB_ACQUIRE_H
#include <apt-pkg/macros.h>
#include <apt-pkg/weakptr.h>
#include <vector> #include <vector>
#include <string> #include <string>
using std::vector; using std::vector;
using std::string; using std::string;
#include <sys/time.h> #include <sys/time.h>
#include <unistd.h> #include <unistd.h>
class pkgAcquireStatus; class pkgAcquireStatus;
skipping to change at line 163 skipping to change at line 166
/** \brief Generate one queue for each protocol/host combination; down loads from /** \brief Generate one queue for each protocol/host combination; down loads from
* multiple hosts can proceed in parallel. * multiple hosts can proceed in parallel.
*/ */
QueueHost, QueueHost,
/** \brief Generate a single queue for each protocol; serialize /** \brief Generate a single queue for each protocol; serialize
* downloads from multiple hosts. * downloads from multiple hosts.
*/ */
QueueAccess} QueueMode; QueueAccess} QueueMode;
/** \brief If \b true, debugging information will be dumped to std::clog . */ /** \brief If \b true, debugging information will be dumped to std::clog . */
bool Debug; bool const Debug;
/** \brief If \b true, a download is currently in progress. */ /** \brief If \b true, a download is currently in progress. */
bool Running; bool Running;
/** \brief Add the given item to the list of items. */ /** \brief Add the given item to the list of items. */
void Add(Item *Item); void Add(Item *Item);
/** \brief Remove the given item from the list of items. */ /** \brief Remove the given item from the list of items. */
void Remove(Item *Item); void Remove(Item *Item);
/** \brief Add the given worker to the list of workers. */ /** \brief Add the given worker to the list of workers. */
skipping to change at line 322 skipping to change at line 325
* *
* \param Dir The directory to be cleaned out. * \param Dir The directory to be cleaned out.
* *
* \return \b true if the directory exists and is readable. * \return \b true if the directory exists and is readable.
*/ */
bool Clean(string Dir); bool Clean(string Dir);
/** \return the total size in bytes of all the items included in /** \return the total size in bytes of all the items included in
* this download. * this download.
*/ */
double TotalNeeded(); unsigned long long TotalNeeded();
/** \return the size in bytes of all non-local items included in /** \return the size in bytes of all non-local items included in
* this download. * this download.
*/ */
double FetchNeeded(); unsigned long long FetchNeeded();
/** \return the amount of data to be fetched that is already /** \return the amount of data to be fetched that is already
* present on the filesystem. * present on the filesystem.
*/ */
double PartialPresent(); unsigned long long PartialPresent();
/** \brief Construct a new pkgAcquire. /** \brief Delayed constructor
* *
* \param Log The progress indicator associated with this * \param Progress indicator associated with this download or
* download, or \b NULL for none. This object is not owned by the * \b NULL for none. This object is not owned by the
* download process and will not be deleted when the pkgAcquire * download process and will not be deleted when the pkgAcquire
* object is destroyed. Naturally, it should live for at least as * object is destroyed. Naturally, it should live for at least as
* long as the pkgAcquire object does. * long as the pkgAcquire object does.
* \param Lock defines a lock file that should be acquired to ensure
* only one Acquire class is in action at the time or an empty string
* if no lock file should be used.
*/ */
pkgAcquire(pkgAcquireStatus *Log = 0); bool Setup(pkgAcquireStatus *Progress = NULL, string const &Lock = "");
/** \brief Construct a new pkgAcquire. */
pkgAcquire(pkgAcquireStatus *Log) __deprecated;
pkgAcquire();
/** \brief Destroy this pkgAcquire object. /** \brief Destroy this pkgAcquire object.
* *
* Destroys all queue, method, and item objects associated with * Destroys all queue, method, and item objects associated with
* this download. * this download.
*/ */
virtual ~pkgAcquire(); virtual ~pkgAcquire();
private:
/** \brief FD of the Lock file we acquire in Setup (if any) */
int LockFD;
/** \brief Ensure the existence of the given Path
*
* \param Parent directory of the Path directory - a trailing
* /apt/ will be removed before CreateDirectory call.
* \param Path which should exist after (successful) call
*/
bool CheckDirectory(string const &Parent, string const &Path) const;
}; };
/** \brief Represents a single download source from which an item /** \brief Represents a single download source from which an item
* should be downloaded. * should be downloaded.
* *
* An item may have several assocated ItemDescs over its lifetime. * An item may have several assocated ItemDescs over its lifetime.
*/ */
struct pkgAcquire::ItemDesc struct pkgAcquire::ItemDesc : public WeakPointable
{ {
/** \brief The URI from which to download this item. */ /** \brief The URI from which to download this item. */
string URI; string URI;
/** brief A description of this item. */ /** brief A description of this item. */
string Description; string Description;
/** brief A shorter description of this item. */ /** brief A shorter description of this item. */
string ShortDesc; string ShortDesc;
/** brief The underlying item which is to be downloaded. */ /** brief The underlying item which is to be downloaded. */
Item *Owner; Item *Owner;
}; };
 End of changes. 11 change blocks. 
9 lines changed or deleted 31 lines changed or added


 algorithms.h   algorithms.h 
skipping to change at line 50 skipping to change at line 50
class pkgSimulate : public pkgPackageManager /*{{ {*/ class pkgSimulate : public pkgPackageManager /*{{ {*/
{ {
protected: protected:
class Policy : public pkgDepCache::Policy class Policy : public pkgDepCache::Policy
{ {
pkgDepCache *Cache; pkgDepCache *Cache;
public: public:
virtual VerIterator GetCandidateVer(PkgIterator Pkg) virtual VerIterator GetCandidateVer(PkgIterator const &Pkg)
{ {
return (*Cache)[Pkg].CandidateVerIter(*Cache); return (*Cache)[Pkg].CandidateVerIter(*Cache);
} }
Policy(pkgDepCache *Cache) : Cache(Cache) {}; Policy(pkgDepCache *Cache) : Cache(Cache) {};
}; };
unsigned char *Flags; unsigned char *Flags;
Policy iPolicy; Policy iPolicy;
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 aptconfiguration.h   aptconfiguration.h 
skipping to change at line 42 skipping to change at line 42
* sense in downloading the bz2 file, therefore we will not return bz2 as * sense in downloading the bz2 file, therefore we will not return bz2 as
* a usable compression type. The availability is checked with the settings * a usable compression type. The availability is checked with the settings
* in the Dir::Bin group. * in the Dir::Bin group.
* *
* \param Cached saves the result so we need to calculated it only once * \param Cached saves the result so we need to calculated it only once
* this parameter should ony be used for testing purp oses. * this parameter should ony be used for testing purp oses.
* *
* \return a vector of (all) Language Codes in the prefered usage o rder * \return a vector of (all) Language Codes in the prefered usage o rder
*/ */
std::vector<std::string> static const getCompressionTypes(bool const &Cached = true); std::vector<std::string> static const getCompressionTypes(bool const &Cached = true);
/** \brief Returns a vector of Language Codes
*
* Languages can be defined with their two or five chars long code.
* This methods handles the various ways to set the prefered codes,
* honors the environment and ensures that the codes are not listed
twice.
*
* The special word "environment" will be replaced with the long an
d the short
* code of the local settings and it will be insured that this will
not add
* duplicates. So in an german local the setting "environment, de_D
E, en, de"
* will result in "de_DE, de, en".
*
* Another special word is "none" which separates the prefered from
all codes
* in this setting. So setting and method can be used to get codes
the user want
* to see or to get all language codes APT (should) have Translatio
ns available.
*
* \param All return all codes or only codes for languages we want
to use
* \param Cached saves the result so we need to calculated it only
once
* this parameter should ony be used for testing purp
oses.
* \param Locale don't get the locale from the system but use this
one instead
* this parameter should ony be used for testing purp
oses.
*
* \return a vector of (all) Language Codes in the prefered usage o
rder
*/
std::vector<std::string> static const getLanguages(bool const &All =
false,
bool const &Cached = true, char const ** const Local
e = 0);
/** \brief Returns a vector of Architectures we support
*
* \param Cached saves the result so we need to calculated it only
once
* this parameter should ony be used for testing purp
oses.
*
* \return a vector of Architectures in prefered order
*/
std::vector<std::string> static const getArchitectures(bool const &C
ached = true);
/** \brief Are we interested in the given Architecture?
*
* \param Arch we want to check
* \return true if we are interested, false otherwise
*/
bool static const checkArchitecture(std::string const &Arch);
/*}} }*/ /*}} }*/
}; };
/*}} }*/ /*}} }*/
} }
#endif #endif
 End of changes. 1 change blocks. 
0 lines changed or deleted 61 lines changed or added


 apti18n.h   apti18n.h 
skipping to change at line 15 skipping to change at line 15
in each C file. */ in each C file. */
// Set by autoconf // Set by autoconf
#define USE_NLS 1 #define USE_NLS 1
#ifdef USE_NLS #ifdef USE_NLS
// apt will use the gettext implementation of the C library // apt will use the gettext implementation of the C library
# include <libintl.h> # include <libintl.h>
# ifdef APT_DOMAIN # ifdef APT_DOMAIN
# define _(x) dgettext(APT_DOMAIN,x) # define _(x) dgettext(APT_DOMAIN,x)
# define P_(msg,plural,n) dngettext(APT_DOMAIN,msg,plural,n)
# else # else
# define _(x) gettext(x) # define _(x) gettext(x)
# define P_(msg,plural,n) ngettext(msg,plural,n)
# endif # endif
# define N_(x) x # define N_(x) x
#else #else
// apt will not use any gettext // apt will not use any gettext
# define setlocale(a, b) # define setlocale(a, b)
# define textdomain(a) # define textdomain(a)
# define bindtextdomain(a, b) # define bindtextdomain(a, b)
# define _(x) x # define _(x) x
# define P_(msg,plural,n) (n == 1 ? msg : plural)
# define N_(x) x # define N_(x) x
#endif #endif
 End of changes. 3 change blocks. 
0 lines changed or deleted 3 lines changed or added


 arfile.h   arfile.h 
skipping to change at line 41 skipping to change at line 41
bool LoadHeaders(); bool LoadHeaders();
public: public:
// The stream file // The stream file
FileFd &File; FileFd &File;
// Locate a member by name // Locate a member by name
const Member *FindMember(const char *Name) const; const Member *FindMember(const char *Name) const;
inline Member *Members() { return List; }
ARArchive(FileFd &File); ARArchive(FileFd &File);
~ARArchive(); ~ARArchive();
}; };
// A member of the archive // A member of the archive
struct ARArchive::Member struct ARArchive::Member
{ {
// Fields from the header // Fields from the header
string Name; string Name;
 End of changes. 1 change blocks. 
0 lines changed or deleted 1 lines changed or added


 cachefile.h   cachefile.h 
skipping to change at line 22 skipping to change at line 22
This means it can rebuild caches from the source list and instantiates This means it can rebuild caches from the source list and instantiates
and prepares the standard policy mechanism. and prepares the standard policy mechanism.
##################################################################### */ ##################################################################### */
/*}} }*/ /*}} }*/
#ifndef PKGLIB_CACHEFILE_H #ifndef PKGLIB_CACHEFILE_H
#define PKGLIB_CACHEFILE_H #define PKGLIB_CACHEFILE_H
#include <apt-pkg/depcache.h> #include <apt-pkg/depcache.h>
#include <apt-pkg/acquire.h> #include <apt-pkg/acquire.h>
#include <apt-pkg/policy.h>
#include <apt-pkg/sourcelist.h> #include <apt-pkg/sourcelist.h>
class pkgPolicy;
class pkgCacheFile class pkgCacheFile
{ {
protected: protected:
MMap *Map; MMap *Map;
pkgCache *Cache; pkgCache *Cache;
pkgDepCache *DCache; pkgDepCache *DCache;
pkgSourceList *SrcList;
public: public:
pkgPolicy *Policy; pkgPolicy *Policy;
// We look pretty much exactly like a pointer to a dep cache // We look pretty much exactly like a pointer to a dep cache
inline operator pkgCache &() {return *Cache;}; inline operator pkgCache &() {return *Cache;};
inline operator pkgCache *() {return Cache;}; inline operator pkgCache *() {return Cache;};
inline operator pkgDepCache &() {return *DCache;}; inline operator pkgDepCache &() {return *DCache;};
inline operator pkgDepCache *() {return DCache;}; inline operator pkgDepCache *() {return DCache;};
inline operator pkgPolicy &() {return *Policy;};
inline operator pkgPolicy *() {return Policy;};
inline operator pkgSourceList &() {return *SrcList;};
inline operator pkgSourceList *() {return SrcList;};
inline pkgDepCache *operator ->() {return DCache;}; inline pkgDepCache *operator ->() {return DCache;};
inline pkgDepCache &operator *() {return *DCache;}; inline pkgDepCache &operator *() {return *DCache;};
inline pkgDepCache::StateCache &operator [](pkgCache::PkgIterator const &I) {return (*DCache)[I];}; inline pkgDepCache::StateCache &operator [](pkgCache::PkgIterator const &I) {return (*DCache)[I];};
inline unsigned char &operator [](pkgCache::DepIterator const &I) {retur n (*DCache)[I];}; inline unsigned char &operator [](pkgCache::DepIterator const &I) {retur n (*DCache)[I];};
bool BuildCaches(OpProgress &Progress,bool WithLock = true); bool BuildCaches(OpProgress *Progress = NULL,bool WithLock = true);
bool Open(OpProgress &Progress,bool WithLock = true); __deprecated bool BuildCaches(OpProgress &Progress,bool const &WithLock
= true) { return BuildCaches(&Progress, WithLock); };
bool BuildSourceList(OpProgress *Progress = NULL);
bool BuildPolicy(OpProgress *Progress = NULL);
bool BuildDepCache(OpProgress *Progress = NULL);
bool Open(OpProgress *Progress = NULL, bool WithLock = true);
inline bool ReadOnlyOpen(OpProgress *Progress = NULL) { return Open(Prog
ress, false); };
__deprecated bool Open(OpProgress &Progress,bool const &WithLock = true)
{ return Open(&Progress, WithLock); };
void Close(); void Close();
inline pkgCache* GetPkgCache() { BuildCaches(NULL, false); return Cache;
};
inline pkgDepCache* GetDepCache() { BuildDepCache(); return DCache; };
inline pkgPolicy* GetPolicy() { BuildPolicy(); return Policy; };
inline pkgSourceList* GetSourceList() { BuildSourceList(); return SrcLis
t; };
inline bool IsPkgCacheBuilt() const { return (Cache != NULL); };
inline bool IsDepCacheBuilt() const { return (DCache != NULL); };
inline bool IsPolicyBuilt() const { return (Policy != NULL); };
inline bool IsSrcListBuilt() const { return (SrcList != NULL); };
pkgCacheFile(); pkgCacheFile();
~pkgCacheFile(); virtual ~pkgCacheFile();
}; };
#endif #endif
 End of changes. 8 change blocks. 
5 lines changed or deleted 30 lines changed or added


 cacheiterators.h   cacheiterators.h 
// -*- mode: cpp; mode: fold -*- // -*- mode: cpp; mode: fold -*-
// Description /*{{ {*/ // Description /*{{ {*/
// $Id: cacheiterators.h,v 1.18.2.1 2004/05/08 22:44:27 mdz Exp $
/* ###################################################################### /* ######################################################################
Cache Iterators - Iterators for navigating the cache structure Cache Iterators - Iterators for navigating the cache structure
The iterators all provides ++,==,!=,->,* and end for their type. The iterators all provides ++,==,!=,->,* and end for their type.
The end function can be used to tell if the list has been fully The end function can be used to tell if the list has been fully
traversed. traversed.
Unlike STL iterators these contain helper functions to access the data Unlike STL iterators these contain helper functions to access the data
that is being iterated over. This is because the data structures can't that is being iterated over. This is because the data structures can't
skipping to change at line 33 skipping to change at line 32
structure passed to the constructor, which should be the structure structure passed to the constructor, which should be the structure
that has the depends pointer as a member. The provide iterator has the that has the depends pointer as a member. The provide iterator has the
same system. same system.
This header is not user includable, please use apt-pkg/pkgcache.h This header is not user includable, please use apt-pkg/pkgcache.h
##################################################################### */ ##################################################################### */
/*}} }*/ /*}} }*/
#ifndef PKGLIB_CACHEITERATORS_H #ifndef PKGLIB_CACHEITERATORS_H
#define PKGLIB_CACHEITERATORS_H #define PKGLIB_CACHEITERATORS_H
#include<iterator>
// Package Iterator /*{{ #include<string.h>
{*/ // abstract Iterator template /*{{
class pkgCache::PkgIterator {*/
{ /* This template provides the very basic iterator methods we
friend class pkgCache; need to have for doing some walk-over-the-cache magic */
Package *Pkg; template<typename Str, typename Itr> class pkgCache::Iterator :
pkgCache *Owner; public std::iterator<std::forward_iterator_tag, Str>
long HashIndex; {
protected:
protected: Str *S;
pkgCache *Owner;
// This constructor is the 'begin' constructor, never use it.
inline PkgIterator(pkgCache &Owner) : Owner(&Owner), HashIndex(-1)
{
Pkg = Owner.PkgP;
operator ++(0);
};
public:
enum OkState {NeedsNothing,NeedsUnpack,NeedsConfigure};
// Iteration /** \brief Returns the Pointer for this struct in the owner
void operator ++(int); * The implementation of this method should be pretty short
inline void operator ++() {operator ++(0);}; * as it will only return the Pointer into the mmap stored
inline bool end() const {return Owner == 0 || Pkg == Owner->PkgP?true:fa * in the owner but the name of this pointer is different for
lse;}; * each stucture and we want to abstract here at least for the
* basic methods from the actual structure.
* \return Pointer to the first structure of this type
*/
virtual Str* OwnerPointer() const = 0;
// Comparison public:
inline bool operator ==(const PkgIterator &B) const {return Pkg == B.Pkg // Iteration
;}; virtual void operator ++(int) = 0;
inline bool operator !=(const PkgIterator &B) const {return Pkg != B.Pkg virtual void operator ++() = 0; // Should be {operator ++(0);};
;}; inline bool end() const {return Owner == 0 || S == OwnerPointer();};
// Accessors // Comparison
inline Package *operator ->() {return Pkg;}; inline bool operator ==(const Itr &B) const {return S == B.S;};
inline Package const *operator ->() const {return Pkg;}; inline bool operator !=(const Itr &B) const {return S != B.S;};
inline Package const &operator *() const {return *Pkg;};
inline operator Package *() {return Pkg == Owner->PkgP?0:Pkg;};
inline operator Package const *() const {return Pkg == Owner->PkgP?0:Pkg
;};
inline pkgCache *Cache() {return Owner;};
inline const char *Name() const {return Pkg->Name == 0?0:Owner->StrP + P // Accessors
kg->Name;}; inline Str *operator ->() {return S;};
inline const char *Section() const {return Pkg->Section == 0?0:Owner->St inline Str const *operator ->() const {return S;};
rP + Pkg->Section;}; inline operator Str *() {return S == OwnerPointer() ? 0 : S;};
inline bool Purge() const {return Pkg->CurrentState == pkgCache::State:: inline operator Str const *() const {return S == OwnerPointer() ? 0
Purge || : S;};
(Pkg->CurrentVer == 0 && Pkg->CurrentState == pkgCache::State::NotI inline Str &operator *() {return *S;};
nstalled);}; inline Str const &operator *() const {return *S;};
inline VerIterator VersionList() const; inline pkgCache *Cache() const {return Owner;};
inline VerIterator CurrentVer() const;
inline DepIterator RevDependsList() const;
inline PrvIterator ProvidesList() const;
inline unsigned long Index() const {return Pkg - Owner->PkgP;};
OkState State() const;
//Nice printable representation // Mixed stuff
friend std::ostream& operator<<(std::ostream& out, pkgCache::PkgIterator inline void operator =(const Itr &B) {S = B.S; Owner = B.Owner;};
Pkg); inline bool IsGood() const { return S && Owner && ! end();};
inline unsigned long Index() const {return S - OwnerPointer();};
const char *CandVersion() const; void ReMap(void const * const oldMap, void const * const newMap) {
const char *CurVersion() const; if (Owner == 0 || S == 0)
return;
S += (Str*)(newMap) - (Str*)(oldMap);
}
// Constructors // Constructors - look out for the variable assigning
inline PkgIterator(pkgCache &Owner,Package *Trg) : Pkg(Trg), Owner(&Owne inline Iterator() : S(0), Owner(0) {};
r), inline Iterator(pkgCache &Owner,Str *T = 0) : S(T), Owner(&Owner) {}
HashIndex(0) ;
{
if (Pkg == 0)
Pkg = Owner.PkgP;
};
inline PkgIterator() : Pkg(0), Owner(0), HashIndex(0) {};
}; };
/*}} }*/ /*}} }*/
// Version Iterator /*{{ // Group Iterator /*{{
{*/ {*/
class pkgCache::VerIterator /* Packages with the same name are collected in a Group so someone only
{ interest in package names can iterate easily over the names, so the
Version *Ver; different architectures can be treated as of the "same" package
pkgCache *Owner; (apt internally treat them as totally different packages) */
class pkgCache::GrpIterator: public Iterator<Group, GrpIterator> {
void _dummy(); long HashIndex;
public: protected:
inline Group* OwnerPointer() const {
return Owner->GrpP;
};
// Iteration public:
void operator ++(int) {if (Ver != Owner->VerP) Ver = Owner->VerP + Ver-> // This constructor is the 'begin' constructor, never use it.
NextVer;}; inline GrpIterator(pkgCache &Owner) : Iterator<Group, GrpIterator>(O
inline void operator ++() {operator ++(0);}; wner), HashIndex(-1) {
inline bool end() const {return Owner == 0 || (Ver == Owner->VerP?true:f S = OwnerPointer();
alse);}; operator ++(0);
inline void operator =(const VerIterator &B) {Ver = B.Ver; Owner = B.Own };
er;};
// Comparison virtual void operator ++(int);
inline bool operator ==(const VerIterator &B) const {return Ver == B.Ver virtual void operator ++() {operator ++(0);};
;};
inline bool operator !=(const VerIterator &B) const {return Ver != B.Ver
;};
int CompareVer(const VerIterator &B) const;
// Testing inline const char *Name() const {return S->Name == 0?0:Owner->StrP +
inline bool IsGood() const { return Ver && Owner && ! end();}; S->Name;};
inline PkgIterator PackageList() const;
PkgIterator FindPkg(string Arch = "any") const;
/** \brief find the package with the "best" architecture
// Accessors The best architecture is either the "native" or the first
inline Version *operator ->() {return Ver;}; in the list of Architectures which is not an end-Pointer
inline Version const *operator ->() const {return Ver;};
inline Version &operator *() {return *Ver;};
inline Version const &operator *() const {return *Ver;};
inline operator Version *() {return Ver == Owner->VerP?0:Ver;};
inline operator Version const *() const {return Ver == Owner->VerP?0:Ver
;};
inline pkgCache *Cache() {return Owner;};
inline const char *VerStr() const {return Ver->VerStr == 0?0:Owner->StrP \param PreferNonVirtual tries to respond with a non-virtual pack
+ Ver->VerStr;}; age
inline const char *Section() const {return Ver->Section == 0?0:Owner->St and only if this fails returns the best virtual package *
rP + Ver->Section;}; /
inline const char *Arch() const {return Ver->Arch == 0?0:Owner->StrP + V PkgIterator FindPreferredPkg(bool const &PreferNonVirtual = true) co
er->Arch;}; nst;
inline PkgIterator ParentPkg() const {return PkgIterator(*Owner,Owner->P PkgIterator NextPkg(PkgIterator const &Pkg) const;
kgP + Ver->ParentPkg);};
inline DescIterator DescriptionList() const;
DescIterator TranslatedDescription() const;
inline DepIterator DependsList() const;
inline PrvIterator ProvidesList() const;
inline VerFileIterator FileList() const;
inline unsigned long Index() const {return Ver - Owner->VerP;};
bool Downloadable() const;
inline const char *PriorityType() {return Owner->Priority(Ver->Priority)
;};
string RelStr();
bool Automatic() const; // Constructors
VerFileIterator NewestFile() const; inline GrpIterator(pkgCache &Owner, Group *Trg) : Iterator<Group, Gr
pIterator>(Owner, Trg), HashIndex(0) {
if (S == 0)
S = OwnerPointer();
};
inline GrpIterator() : Iterator<Group, GrpIterator>(), HashIndex(0)
{};
inline VerIterator() : Ver(0), Owner(0) {};
inline VerIterator(pkgCache &Owner,Version *Trg = 0) : Ver(Trg),
Owner(&Owner)
{
if (Ver == 0)
Ver = Owner.VerP;
};
}; };
/*}} }*/ /*}} }*/
// Description Iterator // Package Iterator /*{{
/*{{{*/ {*/
class pkgCache::DescIterator class pkgCache::PkgIterator: public Iterator<Package, PkgIterator> {
{ long HashIndex;
Description *Desc;
pkgCache *Owner;
void _dummy(); protected:
inline Package* OwnerPointer() const {
return Owner->PkgP;
};
public: public:
// This constructor is the 'begin' constructor, never use it.
inline PkgIterator(pkgCache &Owner) : Iterator<Package, PkgIterator>
(Owner), HashIndex(-1) {
S = OwnerPointer();
operator ++(0);
};
// Iteration virtual void operator ++(int);
void operator ++(int) {if (Desc != Owner->DescP) Desc = Owner->DescP + D virtual void operator ++() {operator ++(0);};
esc->NextDesc;};
inline void operator ++() {operator ++(0);};
inline bool end() const {return Owner == 0 || Desc == Owner->DescP?true:
false;};
inline void operator =(const DescIterator &B) {Desc = B.Desc; Owner = B.
Owner;};
// Comparison enum OkState {NeedsNothing,NeedsUnpack,NeedsConfigure};
inline bool operator ==(const DescIterator &B) const {return Desc == B.D
esc;};
inline bool operator !=(const DescIterator &B) const {return Desc != B.D
esc;};
int CompareDesc(const DescIterator &B) const;
// Accessors // Accessors
inline Description *operator ->() {return Desc;}; inline const char *Name() const {return S->Name == 0?0:Owner->StrP +
inline Description const *operator ->() const {return Desc;}; S->Name;};
inline Description &operator *() {return *Desc;}; inline const char *Section() const {return S->Section == 0?0:Owner->
inline Description const &operator *() const {return *Desc;}; StrP + S->Section;};
inline operator Description *() {return Desc == Owner->DescP?0:Desc;}; inline bool Purge() const {return S->CurrentState == pkgCache::State
inline operator Description const *() const {return Desc == Owner->DescP ::Purge ||
?0:Desc;}; (S->CurrentVer == 0 && S->CurrentState == pkgCache::State::N
inline pkgCache *Cache() {return Owner;}; otInstalled);};
inline const char *Arch() const {return S->Arch == 0?0:Owner->StrP +
S->Arch;};
inline GrpIterator Group() const { return GrpIterator(*Owner, Owner-
>GrpP + S->Group);};
inline const char *LanguageCode() const {return Owner->StrP + Desc->lang inline VerIterator VersionList() const;
uage_code;}; inline VerIterator CurrentVer() const;
inline const char *md5() const {return Owner->StrP + Desc->md5sum;}; inline DepIterator RevDependsList() const;
inline DescFileIterator FileList() const; inline PrvIterator ProvidesList() const;
inline unsigned long Index() const {return Desc - Owner->DescP;}; OkState State() const;
const char *CandVersion() const;
const char *CurVersion() const;
inline DescIterator() : Desc(0), Owner(0) {}; //Nice printable representation
inline DescIterator(pkgCache &Owner,Description *Trg = 0) : Desc(Trg), friend std::ostream& operator <<(std::ostream& out, PkgIterator i);
Owner(&Owner) std::string FullName(bool const &Pretty = false) const;
{
if (Desc == 0) // Constructors
Desc = Owner.DescP; inline PkgIterator(pkgCache &Owner,Package *Trg) : Iterator<Package,
}; PkgIterator>(Owner, Trg), HashIndex(0) {
if (S == 0)
S = OwnerPointer();
};
inline PkgIterator() : Iterator<Package, PkgIterator>(), HashIndex(0
) {};
}; };
/*}} }*/ /*}} }*/
// Dependency iterator /*{{ // Version Iterator /*{{
{*/ {*/
class pkgCache::DepIterator class pkgCache::VerIterator : public Iterator<Version, VerIterator> {
{ protected:
Dependency *Dep; inline Version* OwnerPointer() const {
enum {DepVer, DepRev} Type; return Owner->VerP;
pkgCache *Owner; };
void _dummy(); public:
// Iteration
void operator ++(int) {if (S != Owner->VerP) S = Owner->VerP + S->Ne
xtVer;};
inline void operator ++() {operator ++(0);};
public: // Comparison
int CompareVer(const VerIterator &B) const;
/** \brief compares two version and returns if they are similar
// Iteration This method should be used to identify if two pseudo versions ar
void operator ++(int) {if (Dep != Owner->DepP) Dep = Owner->DepP + e
(Type == DepVer?Dep->NextDepends:Dep->NextRevDepends);}; refering to the same "real" version */
inline void operator ++() {operator ++(0);}; inline bool SimilarVer(const VerIterator &B) const {
inline bool end() const {return Owner == 0 || Dep == Owner->DepP?true:fa return (B.end() == false && S->Hash == B->Hash && strcmp(Ver
lse;}; Str(), B.VerStr()) == 0);
};
// Comparison // Accessors
inline bool operator ==(const DepIterator &B) const {return Dep == B.Dep inline const char *VerStr() const {return S->VerStr == 0?0:Owner->St
;}; rP + S->VerStr;};
inline bool operator !=(const DepIterator &B) const {return Dep != B.Dep inline const char *Section() const {return S->Section == 0?0:Owner->
;}; StrP + S->Section;};
inline const char *Arch() const {
if(S->MultiArch == pkgCache::Version::All)
return "all";
return S->ParentPkg == 0?0:Owner->StrP + ParentPkg()->Arch;
};
inline const char *Arch(bool const pseudo) const {
if(pseudo == false)
return Arch();
return S->ParentPkg == 0?0:Owner->StrP + ParentPkg()->Arch;
};
inline PkgIterator ParentPkg() const {return PkgIterator(*Owner,Owne
r->PkgP + S->ParentPkg);};
// Accessors inline DescIterator DescriptionList() const;
inline Dependency *operator ->() {return Dep;}; DescIterator TranslatedDescription() const;
inline Dependency const *operator ->() const {return Dep;}; inline DepIterator DependsList() const;
inline Dependency &operator *() {return *Dep;}; inline PrvIterator ProvidesList() const;
inline Dependency const &operator *() const {return *Dep;}; inline VerFileIterator FileList() const;
inline operator Dependency *() {return Dep == Owner->DepP?0:Dep;}; bool Downloadable() const;
inline operator Dependency const *() const {return Dep == Owner->DepP?0: inline const char *PriorityType() const {return Owner->Priority(S->P
Dep;}; riority);};
inline pkgCache *Cache() {return Owner;}; string RelStr() const;
inline const char *TargetVer() const {return Dep->Version == 0?0:Owner-> bool Automatic() const;
StrP + Dep->Version;}; bool Pseudo() const;
inline PkgIterator TargetPkg() {return PkgIterator(*Owner,Owner->PkgP + VerFileIterator NewestFile() const;
Dep->Package);};
inline PkgIterator SmartTargetPkg() {PkgIterator R(*Owner,0);SmartTarget
Pkg(R);return R;};
inline VerIterator ParentVer() {return VerIterator(*Owner,Owner->VerP +
Dep->ParentVer);};
inline PkgIterator ParentPkg() {return PkgIterator(*Owner,Owner->PkgP +
Owner->VerP[Dep->ParentVer].ParentPkg);};
inline bool Reverse() {return Type == DepRev;};
inline unsigned long Index() const {return Dep - Owner->DepP;};
bool IsCritical();
void GlobOr(DepIterator &Start,DepIterator &End);
Version **AllTargets();
bool SmartTargetPkg(PkgIterator &Result);
inline const char *CompType() {return Owner->CompType(Dep->CompareOp);};
inline const char *DepType() {return Owner->DepType(Dep->Type);};
inline DepIterator(pkgCache &Owner,Dependency *Trg,Version * = 0) : inline VerIterator(pkgCache &Owner,Version *Trg = 0) : Iterator<Vers
Dep(Trg), Type(DepVer), Owner(&Owner) ion, VerIterator>(Owner, Trg) {
{ if (S == 0)
if (Dep == 0) S = OwnerPointer();
Dep = Owner.DepP; };
}; inline VerIterator() : Iterator<Version, VerIterator>() {};
inline DepIterator(pkgCache &Owner,Dependency *Trg,Package *) :
Dep(Trg), Type(DepRev), Owner(&Owner)
{
if (Dep == 0)
Dep = Owner.DepP;
};
inline DepIterator() : Dep(0), Type(DepVer), Owner(0) {};
}; };
/*}} }*/ /*}} }*/
// Provides iterator /*{{ // Description Iterator
{*/ /*{{{*/
class pkgCache::PrvIterator class pkgCache::DescIterator : public Iterator<Description, DescIterator> {
{ protected:
Provides *Prv; inline Description* OwnerPointer() const {
enum {PrvVer, PrvPkg} Type; return Owner->DescP;
pkgCache *Owner; };
void _dummy(); public:
// Iteration
void operator ++(int) {if (S != Owner->DescP) S = Owner->DescP + S->
NextDesc;};
inline void operator ++() {operator ++(0);};
public: // Comparison
int CompareDesc(const DescIterator &B) const;
// Iteration // Accessors
void operator ++(int) {if (Prv != Owner->ProvideP) Prv = Owner->ProvideP inline const char *LanguageCode() const {return Owner->StrP + S->lan
+ guage_code;};
(Type == PrvVer?Prv->NextPkgProv:Prv->NextProvides);}; inline const char *md5() const {return Owner->StrP + S->md5sum;};
inline void operator ++() {operator ++(0);}; inline DescFileIterator FileList() const;
inline bool end() const {return Owner == 0 || Prv == Owner->ProvideP?tru
e:false;};
// Comparison inline DescIterator() : Iterator<Description, DescIterator>() {};
inline bool operator ==(const PrvIterator &B) const {return Prv == B.Prv inline DescIterator(pkgCache &Owner,Description *Trg = 0) : Iterator
;}; <Description, DescIterator>(Owner, Trg) {
inline bool operator !=(const PrvIterator &B) const {return Prv != B.Prv if (S == 0)
;}; S = Owner.DescP;
};
};
/*}}
}*/
// Dependency iterator /*{{
{*/
class pkgCache::DepIterator : public Iterator<Dependency, DepIterator> {
enum {DepVer, DepRev} Type;
// Accessors protected:
inline Provides *operator ->() {return Prv;}; inline Dependency* OwnerPointer() const {
inline Provides const *operator ->() const {return Prv;}; return Owner->DepP;
inline Provides &operator *() {return *Prv;}; };
inline Provides const &operator *() const {return *Prv;};
inline operator Provides *() {return Prv == Owner->ProvideP?0:Prv;};
inline operator Provides const *() const {return Prv == Owner->ProvideP?
0:Prv;};
inline pkgCache *Cache() {return Owner;};
inline const char *Name() const {return Owner->StrP + Owner->PkgP[Prv->P public:
arentPkg].Name;}; // Iteration
inline const char *ProvideVersion() const {return Prv->ProvideVersion == void operator ++(int) {if (S != Owner->DepP) S = Owner->DepP +
0?0:Owner->StrP + Prv->ProvideVersion;}; (Type == DepVer ? S->NextDepends : S->NextRevDepends);};
inline PkgIterator ParentPkg() {return PkgIterator(*Owner,Owner->PkgP + inline void operator ++() {operator ++(0);};
Prv->ParentPkg);};
inline VerIterator OwnerVer() {return VerIterator(*Owner,Owner->VerP + P
rv->Version);};
inline PkgIterator OwnerPkg() {return PkgIterator(*Owner,Owner->PkgP + O
wner->VerP[Prv->Version].ParentPkg);};
inline unsigned long Index() const {return Prv - Owner->ProvideP;};
inline PrvIterator() : Prv(0), Type(PrvVer), Owner(0) {}; // Accessors
inline const char *TargetVer() const {return S->Version == 0?0:Owner
->StrP + S->Version;};
inline PkgIterator TargetPkg() const {return PkgIterator(*Owner,Owne
r->PkgP + S->Package);};
inline PkgIterator SmartTargetPkg() const {PkgIterator R(*Owner,0);S
martTargetPkg(R);return R;};
inline VerIterator ParentVer() const {return VerIterator(*Owner,Owne
r->VerP + S->ParentVer);};
inline PkgIterator ParentPkg() const {return PkgIterator(*Owner,Owne
r->PkgP + Owner->VerP[S->ParentVer].ParentPkg);};
inline bool Reverse() const {return Type == DepRev;};
bool IsCritical() const;
void GlobOr(DepIterator &Start,DepIterator &End);
Version **AllTargets() const;
bool SmartTargetPkg(PkgIterator &Result) const;
inline const char *CompType() const {return Owner->CompType(S->Compa
reOp);};
inline const char *DepType() const {return Owner->DepType(S->Type);}
;
inline PrvIterator(pkgCache &Owner,Provides *Trg,Version *) : //Nice printable representation
Prv(Trg), Type(PrvVer), Owner(&Owner) friend std::ostream& operator <<(std::ostream& out, DepIterator D);
{
if (Prv == 0) inline DepIterator(pkgCache &Owner, Dependency *Trg, Version* = 0) :
Prv = Owner.ProvideP; Iterator<Dependency, DepIterator>(Owner, Trg), Type(DepVer)
}; {
inline PrvIterator(pkgCache &Owner,Provides *Trg,Package *) : if (S == 0)
Prv(Trg), Type(PrvPkg), Owner(&Owner) S = Owner.DepP;
{ };
if (Prv == 0) inline DepIterator(pkgCache &Owner, Dependency *Trg, Package*) :
Prv = Owner.ProvideP; Iterator<Dependency, DepIterator>(Owner, Trg), Type(DepRev)
}; {
if (S == 0)
S = Owner.DepP;
};
inline DepIterator() : Iterator<Dependency, DepIterator>(), Type(Dep
Ver) {};
}; };
/*}} }*/ /*}} }*/
// Package file // Provides iterator /*{{
/*{{{*/ {*/
class pkgCache::PkgFileIterator class pkgCache::PrvIterator : public Iterator<Provides, PrvIterator> {
{ enum {PrvVer, PrvPkg} Type;
pkgCache *Owner;
PackageFile *File;
public: protected:
inline Provides* OwnerPointer() const {
return Owner->ProvideP;
};
// Iteration public:
void operator ++(int) {if (File!= Owner->PkgFileP) File = Owner->PkgFile // Iteration
P + File->NextFile;}; void operator ++(int) {if (S != Owner->ProvideP) S = Owner->ProvideP
inline void operator ++() {operator ++(0);}; +
inline bool end() const {return Owner == 0 || File == Owner->PkgFileP?tr (Type == PrvVer?S->NextPkgProv:S->NextProvides);};
ue:false;}; inline void operator ++() {operator ++(0);};
// Comparison // Accessors
inline bool operator ==(const PkgFileIterator &B) const {return File == inline const char *Name() const {return Owner->StrP + Owner->PkgP[S-
B.File;}; >ParentPkg].Name;};
inline bool operator !=(const PkgFileIterator &B) const {return File != inline const char *ProvideVersion() const {return S->ProvideVersion
B.File;}; == 0?0:Owner->StrP + S->ProvideVersion;};
inline PkgIterator ParentPkg() const {return PkgIterator(*Owner,Owne
r->PkgP + S->ParentPkg);};
inline VerIterator OwnerVer() const {return VerIterator(*Owner,Owner
->VerP + S->Version);};
inline PkgIterator OwnerPkg() const {return PkgIterator(*Owner,Owner
->PkgP + Owner->VerP[S->Version].ParentPkg);};
// Accessors inline PrvIterator() : Iterator<Provides, PrvIterator>(), Type(PrvVe
inline PackageFile *operator ->() {return File;}; r) {};
inline PackageFile const *operator ->() const {return File;};
inline PackageFile const &operator *() const {return *File;};
inline operator PackageFile *() {return File == Owner->PkgFileP?0:File;}
;
inline operator PackageFile const *() const {return File == Owner->PkgFi
leP?0:File;};
inline pkgCache *Cache() {return Owner;};
inline const char *FileName() const {return File->FileName == 0?0:Owner- inline PrvIterator(pkgCache &Owner, Provides *Trg, Version*) :
>StrP + File->FileName;}; Iterator<Provides, PrvIterator>(Owner, Trg), Type(PrvVer) {
inline const char *Archive() const {return File->Archive == 0?0:Owner->S if (S == 0)
trP + File->Archive;}; S = Owner.ProvideP;
inline const char *Component() const {return File->Component == 0?0:Owne };
r->StrP + File->Component;}; inline PrvIterator(pkgCache &Owner, Provides *Trg, Package*) :
inline const char *Version() const {return File->Version == 0?0:Owner->S Iterator<Provides, PrvIterator>(Owner, Trg), Type(PrvPkg) {
trP + File->Version;}; if (S == 0)
inline const char *Origin() const {return File->Origin == 0?0:Owner->Str S = Owner.ProvideP;
P + File->Origin;}; };
inline const char *Codename() const {return File->Codename ==0?0:Owner-> };
StrP + File->Codename;}; /*}}
inline const char *Label() const {return File->Label == 0?0:Owner->StrP }*/
+ File->Label;}; // Package file
inline const char *Site() const {return File->Site == 0?0:Owner->StrP + /*{{{*/
File->Site;}; class pkgCache::PkgFileIterator : public Iterator<PackageFile, PkgFileItera
inline const char *Architecture() const {return File->Architecture == 0? tor> {
0:Owner->StrP + File->Architecture;}; protected:
inline const char *IndexType() const {return File->IndexType == 0?0:Owne inline PackageFile* OwnerPointer() const {
r->StrP + File->IndexType;}; return Owner->PkgFileP;
};
inline unsigned long Index() const {return File - Owner->PkgFileP;}; public:
// Iteration
void operator ++(int) {if (S != Owner->PkgFileP) S = Owner->PkgFileP
+ S->NextFile;};
inline void operator ++() {operator ++(0);};
bool IsOk(); // Accessors
string RelStr(); inline const char *FileName() const {return S->FileName == 0?0:Owner
->StrP + S->FileName;};
inline const char *Archive() const {return S->Archive == 0?0:Owner->
StrP + S->Archive;};
inline const char *Component() const {return S->Component == 0?0:Own
er->StrP + S->Component;};
inline const char *Version() const {return S->Version == 0?0:Owner->
StrP + S->Version;};
inline const char *Origin() const {return S->Origin == 0?0:Owner->St
rP + S->Origin;};
inline const char *Codename() const {return S->Codename ==0?0:Owner-
>StrP + S->Codename;};
inline const char *Label() const {return S->Label == 0?0:Owner->StrP
+ S->Label;};
inline const char *Site() const {return S->Site == 0?0:Owner->StrP +
S->Site;};
inline const char *Architecture() const {return S->Architecture == 0
?0:Owner->StrP + S->Architecture;};
inline const char *IndexType() const {return S->IndexType == 0?0:Own
er->StrP + S->IndexType;};
// Constructors bool IsOk();
inline PkgFileIterator() : Owner(0), File(0) {}; string RelStr();
inline PkgFileIterator(pkgCache &Owner) : Owner(&Owner), File(Owner.PkgF
ileP) {}; // Constructors
inline PkgFileIterator(pkgCache &Owner,PackageFile *Trg) : Owner(&Owner) inline PkgFileIterator() : Iterator<PackageFile, PkgFileIterator>()
, File(Trg) {}; {};
inline PkgFileIterator(pkgCache &Owner) : Iterator<PackageFile, PkgF
ileIterator>(Owner, Owner.PkgFileP) {};
inline PkgFileIterator(pkgCache &Owner,PackageFile *Trg) : Iterator<
PackageFile, PkgFileIterator>(Owner, Trg) {};
}; };
/*}} }*/ /*}} }*/
// Version File /*{{{*/ // Version File /*{{{*/
class pkgCache::VerFileIterator class pkgCache::VerFileIterator : public pkgCache::Iterator<VerFile, VerFil
{ eIterator> {
pkgCache *Owner; protected:
VerFile *FileP; inline VerFile* OwnerPointer() const {
return Owner->VerFileP;
public: };
// Iteration
void operator ++(int) {if (FileP != Owner->VerFileP) FileP = Owner->VerF
ileP + FileP->NextFile;};
inline void operator ++() {operator ++(0);};
inline bool end() const {return Owner == 0 || FileP == Owner->VerFileP?t
rue:false;};
// Comparison
inline bool operator ==(const VerFileIterator &B) const {return FileP ==
B.FileP;};
inline bool operator !=(const VerFileIterator &B) const {return FileP !=
B.FileP;};
// Accessors public:
inline VerFile *operator ->() {return FileP;}; // Iteration
inline VerFile const *operator ->() const {return FileP;}; void operator ++(int) {if (S != Owner->VerFileP) S = Owner->VerFileP
inline VerFile const &operator *() const {return *FileP;}; + S->NextFile;};
inline operator VerFile *() {return FileP == Owner->VerFileP?0:FileP;}; inline void operator ++() {operator ++(0);};
inline operator VerFile const *() const {return FileP == Owner->VerFileP
?0:FileP;};
inline pkgCache *Cache() {return Owner;};
inline PkgFileIterator File() const {return PkgFileIterator(*Owner,FileP // Accessors
->File + Owner->PkgFileP);}; inline PkgFileIterator File() const {return PkgFileIterator(*Owner,S
inline unsigned long Index() const {return FileP - Owner->VerFileP;}; ->File + Owner->PkgFileP);};
&gt;File + Owner-&gt;PkgFileP);}; inline VerFileIterator() : Iterator<VerFile, VerFileIterator>() {};
inline VerFileIterator() : Owner(0), FileP(0) {}; inline VerFileIterator(pkgCache &Owner,VerFile *Trg) : Iterator<VerF
inline VerFileIterator(pkgCache &Owner,VerFile *Trg) : Owner(&Owner), Fi ile, VerFileIterator>(Owner, Trg) {};
leP(Trg) {};
}; };
/*}} }*/ /*}} }*/
// Description File /*{{ {*/ // Description File /*{{ {*/
class pkgCache::DescFileIterator class pkgCache::DescFileIterator : public Iterator<DescFile, DescFileIterat
{ or> {
pkgCache *Owner; protected:
DescFile *FileP; inline DescFile* OwnerPointer() const {
return Owner->DescFileP;
public: };
// Iteration
void operator ++(int) {if (FileP != Owner->DescFileP) FileP = Owner->Des
cFileP + FileP->NextFile;};
inline void operator ++() {operator ++(0);};
inline bool end() const {return Owner == 0 || FileP == Owner->DescFileP
?true:false;};
// Comparison
inline bool operator ==(const DescFileIterator &B) const {return FileP =
= B.FileP;};
inline bool operator !=(const DescFileIterator &B) const {return FileP !
= B.FileP;};
// Accessors public:
inline DescFile *operator ->() {return FileP;}; // Iteration
inline DescFile const *operator ->() const {return FileP;}; void operator ++(int) {if (S != Owner->DescFileP) S = Owner->DescFil
inline DescFile const &operator *() const {return *FileP;}; eP + S->NextFile;};
inline operator DescFile *() {return FileP == Owner->DescFileP?0:FileP;} inline void operator ++() {operator ++(0);};
;
inline operator DescFile const *() const {return FileP == Owner->DescFil
eP?0:FileP;};
inline pkgCache *Cache() {return Owner;};
inline PkgFileIterator File() const {return PkgFileIterator(*Owner,FileP // Accessors
->File + Owner->PkgFileP);}; inline PkgFileIterator File() const {return PkgFileIterator(*Owner,S
inline unsigned long Index() const {return FileP - Owner->DescFileP;}; ->File + Owner->PkgFileP);};
&gt;File + Owner-&gt;PkgFileP);}; inline DescFileIterator() : Iterator<DescFile, DescFileIterator>() {
inline DescFileIterator() : Owner(0), FileP(0) {}; };
inline DescFileIterator(pkgCache &Owner,DescFile *Trg) : Owner(&Owner), inline DescFileIterator(pkgCache &Owner,DescFile *Trg) : Iterator<De
FileP(Trg) {}; scFile, DescFileIterator>(Owner, Trg) {};
}; };
/*}} }*/ /*}} }*/
// Inlined Begin functions cant be in the class because of order problems / *{{{*/ // Inlined Begin functions cant be in the class because of order problems / *{{{*/
inline pkgCache::PkgIterator pkgCache::GrpIterator::PackageList() const
{return PkgIterator(*Owner,Owner->PkgP + S->FirstPackage);};
inline pkgCache::VerIterator pkgCache::PkgIterator::VersionList() const inline pkgCache::VerIterator pkgCache::PkgIterator::VersionList() const
{return VerIterator(*Owner,Owner->VerP + Pkg->VersionList);}; {return VerIterator(*Owner,Owner->VerP + S->VersionList);};
inline pkgCache::VerIterator pkgCache::PkgIterator::CurrentVer() const inline pkgCache::VerIterator pkgCache::PkgIterator::CurrentVer() const
{return VerIterator(*Owner,Owner->VerP + Pkg->CurrentVer);}; {return VerIterator(*Owner,Owner->VerP + S->CurrentVer);};
inline pkgCache::DepIterator pkgCache::PkgIterator::RevDependsList() const inline pkgCache::DepIterator pkgCache::PkgIterator::RevDependsList() const
{return DepIterator(*Owner,Owner->DepP + Pkg->RevDepends,Pkg);}; {return DepIterator(*Owner,Owner->DepP + S->RevDepends,S);};
inline pkgCache::PrvIterator pkgCache::PkgIterator::ProvidesList() const inline pkgCache::PrvIterator pkgCache::PkgIterator::ProvidesList() const
{return PrvIterator(*Owner,Owner->ProvideP + Pkg->ProvidesList,Pkg); }; {return PrvIterator(*Owner,Owner->ProvideP + S->ProvidesList,S);};
inline pkgCache::DescIterator pkgCache::VerIterator::DescriptionList() cons t inline pkgCache::DescIterator pkgCache::VerIterator::DescriptionList() cons t
{return DescIterator(*Owner,Owner->DescP + Ver->DescriptionList);}; {return DescIterator(*Owner,Owner->DescP + S->DescriptionList);};
inline pkgCache::PrvIterator pkgCache::VerIterator::ProvidesList() const inline pkgCache::PrvIterator pkgCache::VerIterator::ProvidesList() const
{return PrvIterator(*Owner,Owner->ProvideP + Ver->ProvidesList,Ver); }; {return PrvIterator(*Owner,Owner->ProvideP + S->ProvidesList,S);};
inline pkgCache::DepIterator pkgCache::VerIterator::DependsList() const inline pkgCache::DepIterator pkgCache::VerIterator::DependsList() const
{return DepIterator(*Owner,Owner->DepP + Ver->DependsList,Ver);}; {return DepIterator(*Owner,Owner->DepP + S->DependsList,S);};
inline pkgCache::VerFileIterator pkgCache::VerIterator::FileList() const inline pkgCache::VerFileIterator pkgCache::VerIterator::FileList() const
{return VerFileIterator(*Owner,Owner->VerFileP + Ver->FileList);}; {return VerFileIterator(*Owner,Owner->VerFileP + S->FileList);};
inline pkgCache::DescFileIterator pkgCache::DescIterator::FileList() const inline pkgCache::DescFileIterator pkgCache::DescIterator::FileList() const
{return DescFileIterator(*Owner,Owner->DescFileP + Desc->FileList);} ; {return DescFileIterator(*Owner,Owner->DescFileP + S->FileList);};
/*}} }*/ /*}} }*/
#endif #endif
 End of changes. 71 change blocks. 
420 lines changed or deleted 409 lines changed or added


 cmndline.h   cmndline.h 
skipping to change at line 61 skipping to change at line 61
public: public:
struct Args; struct Args;
struct Dispatch; struct Dispatch;
protected: protected:
Args *ArgList; Args *ArgList;
Configuration *Conf; Configuration *Conf;
bool HandleOpt(int &I,int argc,const char *argv[], bool HandleOpt(int &I,int argc,const char *argv[],
const char *&Opt,Args *A,bool PreceedeMatch = false); const char *&Opt,Args *A,bool PreceedeMatch = false);
void static SaveInConfig(unsigned int const &argc, char const * const * const argv);
public: public:
enum AFlags enum AFlags
{ {
HasArg = (1 << 0), HasArg = (1 << 0),
IntLevel = (1 << 1), IntLevel = (1 << 1),
Boolean = (1 << 2), Boolean = (1 << 2),
InvBoolean = (1 << 3), InvBoolean = (1 << 3),
ConfigFile = (1 << 4) | HasArg, ConfigFile = (1 << 4) | HasArg,
 End of changes. 1 change blocks. 
0 lines changed or deleted 1 lines changed or added


 config.h   config.h 
skipping to change at line 41 skipping to change at line 41
/* Define if we have enabled pthread support */ /* Define if we have enabled pthread support */
/* #undef HAVE_PTHREAD */ /* #undef HAVE_PTHREAD */
/* If there is no socklen_t, define this for the netdb shim */ /* If there is no socklen_t, define this for the netdb shim */
/* #undef NEED_SOCKLEN_T_DEFINE */ /* #undef NEED_SOCKLEN_T_DEFINE */
/* Define the arch name string */ /* Define the arch name string */
#define COMMON_ARCH "i386" #define COMMON_ARCH "i386"
/* The version number string */ /* The version number string */
#define VERSION "0.7.25.3" #define VERSION "0.8.0"
/* The package name string */ /* The package name string */
#define PACKAGE "apt" #define PACKAGE "apt"
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 configuration.h   configuration.h 
skipping to change at line 31 skipping to change at line 31
A special extension, support for ordered lists is provided by using the A special extension, support for ordered lists is provided by using the
special syntax, "block::list::" the trailing :: designates the special syntax, "block::list::" the trailing :: designates the
item as a list. To access the list you must use the tree function on item as a list. To access the list you must use the tree function on
"block::list". "block::list".
##################################################################### */ ##################################################################### */
/*}} }*/ /*}} }*/
#ifndef PKGLIB_CONFIGURATION_H #ifndef PKGLIB_CONFIGURATION_H
#define PKGLIB_CONFIGURATION_H #define PKGLIB_CONFIGURATION_H
#include <regex.h>
#include <string> #include <string>
#include <vector> #include <vector>
#include <iostream> #include <iostream>
using std::string; using std::string;
class Configuration class Configuration
{ {
public: public:
skipping to change at line 59 skipping to change at line 61
string FullTag(const Item *Stop = 0) const; string FullTag(const Item *Stop = 0) const;
Item() : Parent(0), Child(0), Next(0) {}; Item() : Parent(0), Child(0), Next(0) {};
}; };
private: private:
Item *Root; Item *Root;
bool ToFree; bool ToFree;
Item *Lookup(Item *Head,const char *S,unsigned long Len,bool Create); Item *Lookup(Item *Head,const char *S,unsigned long const &Len,bool cons
Item *Lookup(const char *Name,bool Create); t &Create);
Item *Lookup(const char *Name,const bool &Create);
inline const Item *Lookup(const char *Name) const inline const Item *Lookup(const char *Name) const
{ {
return ((Configuration *)this)->Lookup(Name,false); return ((Configuration *)this)->Lookup(Name,false);
} }
public: public:
string Find(const char *Name,const char *Default = 0) const; string Find(const char *Name,const char *Default = 0) const;
string Find(const string Name,const char *Default = 0) const {return Fin string Find(string const &Name,const char *Default = 0) const {return Fi
d(Name.c_str(),Default);}; nd(Name.c_str(),Default);};
string Find(string const &Name, string const &Default) const {return Fin
d(Name.c_str(),Default.c_str());};
string FindFile(const char *Name,const char *Default = 0) const; string FindFile(const char *Name,const char *Default = 0) const;
string FindDir(const char *Name,const char *Default = 0) const; string FindDir(const char *Name,const char *Default = 0) const;
std::vector<string> FindVector(const string &Name) const; std::vector<string> FindVector(string const &Name) const;
std::vector<string> FindVector(const char *Name) const; std::vector<string> FindVector(const char *Name) const;
int FindI(const char *Name,int Default = 0) const; int FindI(const char *Name,int const &Default = 0) const;
int FindI(const string Name,int Default = 0) const {return FindI(Name.c_ int FindI(string const &Name,int const &Default = 0) const {return FindI
str(),Default);}; (Name.c_str(),Default);};
bool FindB(const char *Name,bool Default = false) const; bool FindB(const char *Name,bool const &Default = false) const;
bool FindB(const string Name,bool Default = false) const {return FindB(N bool FindB(string const &Name,bool const &Default = false) const {return
ame.c_str(),Default);}; FindB(Name.c_str(),Default);};
string FindAny(const char *Name,const char *Default = 0) const; string FindAny(const char *Name,const char *Default = 0) const;
inline void Set(const string Name,string Value) {Set(Name.c_str(),Value) ;}; inline void Set(const string &Name,const string &Value) {Set(Name.c_str( ),Value);};
void CndSet(const char *Name,const string &Value); void CndSet(const char *Name,const string &Value);
void Set(const char *Name,const string &Value); void Set(const char *Name,const string &Value);
void Set(const char *Name,int Value); void Set(const char *Name,const int &Value);
inline bool Exists(const string Name) const {return Exists(Name.c_str()) ;}; inline bool Exists(const string &Name) const {return Exists(Name.c_str() );};
bool Exists(const char *Name) const; bool Exists(const char *Name) const;
bool ExistsAny(const char *Name) const; bool ExistsAny(const char *Name) const;
// clear a whole tree // clear a whole tree
void Clear(const string Name); void Clear(const string &Name);
// remove a certain value from a list (e.g. the list of "APT::Keep-Fds") // remove a certain value from a list (e.g. the list of "APT::Keep-Fds")
void Clear(const string List, string Value); void Clear(string const &List, string const &Value);
void Clear(const string List, int Value); void Clear(string const &List, int const &Value);
inline const Item *Tree(const char *Name) const {return Lookup(Name);}; inline const Item *Tree(const char *Name) const {return Lookup(Name);};
inline void Dump() { Dump(std::clog); }; inline void Dump() { Dump(std::clog); };
void Dump(std::ostream& str); void Dump(std::ostream& str);
Configuration(const Item *Root); Configuration(const Item *Root);
Configuration(); Configuration();
~Configuration(); ~Configuration();
/** \brief match a string against a configurable list of patterns */
class MatchAgainstConfig
{
std::vector<regex_t *> patterns;
public:
MatchAgainstConfig(char const * Config);
virtual ~MatchAgainstConfig();
/** \brief Returns \b true for a string matching one of the patterns *
/
bool Match(char const * str) const;
bool Match(std::string const &str) const { return Match(str.c_str());
};
/** \brief returns if the matcher setup was successful */
bool wasConstructedSuccessfully() const { return patterns.empty() == f
alse; }
};
}; };
extern Configuration *_config; extern Configuration *_config;
bool ReadConfigFile(Configuration &Conf,const string &FName, bool ReadConfigFile(Configuration &Conf,const string &FName,
bool AsSectional = false, bool const &AsSectional = false,
unsigned Depth = 0); unsigned const &Depth = 0);
bool ReadConfigDir(Configuration &Conf,const string &Dir, bool ReadConfigDir(Configuration &Conf,const string &Dir,
bool AsSectional = false, bool const &AsSectional = false,
unsigned Depth = 0); unsigned const &Depth = 0);
#endif #endif
 End of changes. 13 change blocks. 
21 lines changed or deleted 46 lines changed or added


 debindexfile.h   debindexfile.h 
skipping to change at line 36 skipping to change at line 36
virtual const Type *GetType() const; virtual const Type *GetType() const;
// Interface for acquire // Interface for acquire
virtual string Describe(bool Short) const {return File;}; virtual string Describe(bool Short) const {return File;};
// Interface for the Cache Generator // Interface for the Cache Generator
virtual bool Exists() const; virtual bool Exists() const;
virtual bool HasPackages() const {return true;}; virtual bool HasPackages() const {return true;};
virtual unsigned long Size() const; virtual unsigned long Size() const;
virtual bool Merge(pkgCacheGenerator &Gen,OpProgress &Prog) const; virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const;
virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const; virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
debStatusIndex(string File); debStatusIndex(string File);
}; };
class debPackagesIndex : public pkgIndexFile class debPackagesIndex : public pkgIndexFile
{ {
string URI; string URI;
string Dist; string Dist;
string Section; string Section;
string Architecture;
string Info(const char *Type) const; string Info(const char *Type) const;
string IndexFile(const char *Type) const; string IndexFile(const char *Type) const;
string IndexURI(const char *Type) const; string IndexURI(const char *Type) const;
public: public:
virtual const Type *GetType() const; virtual const Type *GetType() const;
// Stuff for accessing files on remote items // Stuff for accessing files on remote items
virtual string ArchiveInfo(pkgCache::VerIterator Ver) const; virtual string ArchiveInfo(pkgCache::VerIterator Ver) const;
virtual string ArchiveURI(string File) const {return URI + File;}; virtual string ArchiveURI(string File) const {return URI + File;};
// Interface for acquire // Interface for acquire
virtual string Describe(bool Short) const; virtual string Describe(bool Short) const;
// Interface for the Cache Generator // Interface for the Cache Generator
virtual bool Exists() const; virtual bool Exists() const;
virtual bool HasPackages() const {return true;}; virtual bool HasPackages() const {return true;};
virtual unsigned long Size() const; virtual unsigned long Size() const;
virtual bool Merge(pkgCacheGenerator &Gen,OpProgress &Prog) const; virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const;
virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const; virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
debPackagesIndex(string URI,string Dist,string Section,bool Trusted); debPackagesIndex(string const &URI, string const &Dist, string const &Se
ction,
bool const &Trusted, string const &Arch = "native");
}; };
class debTranslationsIndex : public pkgIndexFile class debTranslationsIndex : public pkgIndexFile
{ {
string URI; string URI;
string Dist; string Dist;
string Section; string Section;
const char * const Language;
string Info(const char *Type) const; string Info(const char *Type) const;
string IndexFile(const char *Type) const; string IndexFile(const char *Type) const;
string IndexURI(const char *Type) const; string IndexURI(const char *Type) const;
inline string TranslationFile() const {return "Translation-" + LanguageC ode();}; inline string TranslationFile() const {return string("Translation-").app end(Language);};
public: public:
virtual const Type *GetType() const; virtual const Type *GetType() const;
// Interface for acquire // Interface for acquire
virtual string Describe(bool Short) const; virtual string Describe(bool Short) const;
virtual bool GetIndexes(pkgAcquire *Owner) const; virtual bool GetIndexes(pkgAcquire *Owner) const;
// Interface for the Cache Generator // Interface for the Cache Generator
virtual bool Exists() const; virtual bool Exists() const;
virtual bool HasPackages() const; virtual bool HasPackages() const;
virtual unsigned long Size() const; virtual unsigned long Size() const;
virtual bool Merge(pkgCacheGenerator &Gen,OpProgress &Prog) const; virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const;
virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const; virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
debTranslationsIndex(string URI,string Dist,string Section); debTranslationsIndex(string URI,string Dist,string Section, char const * const Language);
}; };
class debSourcesIndex : public pkgIndexFile class debSourcesIndex : public pkgIndexFile
{ {
string URI; string URI;
string Dist; string Dist;
string Section; string Section;
string Info(const char *Type) const; string Info(const char *Type) const;
string IndexFile(const char *Type) const; string IndexFile(const char *Type) const;
 End of changes. 8 change blocks. 
6 lines changed or deleted 10 lines changed or added


 deblistparser.h   deblistparser.h 
skipping to change at line 35 skipping to change at line 35
const char *Str; const char *Str;
unsigned char Val; unsigned char Val;
}; };
private: private:
pkgTagFile Tags; pkgTagFile Tags;
pkgTagSection Section; pkgTagSection Section;
unsigned long iOffset; unsigned long iOffset;
string Arch; string Arch;
std::vector<std::string> Architectures;
bool MultiArchEnabled;
unsigned long UniqFindTagWrite(const char *Tag); unsigned long UniqFindTagWrite(const char *Tag);
bool ParseStatus(pkgCache::PkgIterator Pkg,pkgCache::VerIterator Ver); bool ParseStatus(pkgCache::PkgIterator &Pkg,pkgCache::VerIterator &Ver);
bool ParseDepends(pkgCache::VerIterator Ver,const char *Tag, bool ParseDepends(pkgCache::VerIterator &Ver,const char *Tag,
unsigned int Type); unsigned int Type);
bool ParseProvides(pkgCache::VerIterator Ver); bool ParseProvides(pkgCache::VerIterator &Ver);
static bool GrabWord(string Word,WordList *List,unsigned char &Out); static bool GrabWord(string Word,WordList *List,unsigned char &Out);
public: public:
static unsigned char GetPrio(string Str); static unsigned char GetPrio(string Str);
// These all operate against the current section // These all operate against the current section
virtual string Package(); virtual string Package();
virtual string Architecture();
virtual bool ArchitectureAll();
virtual string Version(); virtual string Version();
virtual bool NewVersion(pkgCache::VerIterator Ver); virtual bool NewVersion(pkgCache::VerIterator &Ver);
virtual string Description(); virtual string Description();
virtual string DescriptionLanguage(); virtual string DescriptionLanguage();
virtual MD5SumValue Description_md5(); virtual MD5SumValue Description_md5();
virtual unsigned short VersionHash(); virtual unsigned short VersionHash();
virtual bool UsePackage(pkgCache::PkgIterator Pkg, virtual bool UsePackage(pkgCache::PkgIterator &Pkg,
pkgCache::VerIterator Ver); pkgCache::VerIterator &Ver);
virtual unsigned long Offset() {return iOffset;}; virtual unsigned long Offset() {return iOffset;};
virtual unsigned long Size() {return Section.size();}; virtual unsigned long Size() {return Section.size();};
virtual bool Step(); virtual bool Step();
bool LoadReleaseInfo(pkgCache::PkgFileIterator FileI,FileFd &File, bool LoadReleaseInfo(pkgCache::PkgFileIterator &FileI,FileFd &File,
string section); string section);
static const char *ParseDepends(const char *Start,const char *Stop, static const char *ParseDepends(const char *Start,const char *Stop,
string &Package,string &Ver,unsigned int &Op, string &Package,string &Ver,unsigned int &Op,
bool ParseArchFlags = false); bool const &ParseArchFlags = false,
bool const &StripMultiArch = false);
static const char *ConvertRelation(const char *I,unsigned int &Op); static const char *ConvertRelation(const char *I,unsigned int &Op);
debListParser(FileFd *File); debListParser(FileFd *File, string const &Arch = "");
}; };
#endif #endif
 End of changes. 9 change blocks. 
9 lines changed or deleted 14 lines changed or added


 debmetaindex.h   debmetaindex.h 
// ijones, walters // ijones, walters
#ifndef PKGLIB_DEBMETAINDEX_H #ifndef PKGLIB_DEBMETAINDEX_H
#define PKGLIB_DEBMETAINDEX_H #define PKGLIB_DEBMETAINDEX_H
#include <apt-pkg/metaindex.h> #include <apt-pkg/metaindex.h>
#include <apt-pkg/sourcelist.h> #include <apt-pkg/sourcelist.h>
#include <map>
class debReleaseIndex : public metaIndex { class debReleaseIndex : public metaIndex {
public: public:
class debSectionEntry class debSectionEntry
{ {
public: public:
debSectionEntry (string Section, bool IsSrc); debSectionEntry (string const &Section, bool const &IsSrc);
bool IsSrc; string const Section;
string Section; bool const IsSrc;
}; };
private: private:
vector <const debSectionEntry *> SectionEntries; std::map<string, vector<debSectionEntry const*> > ArchEntries;
public: public:
debReleaseIndex(string URI, string Dist); debReleaseIndex(string const &URI, string const &Dist);
~debReleaseIndex(); ~debReleaseIndex();
virtual string ArchiveURI(string File) const {return URI + File;}; virtual string ArchiveURI(string const &File) const {return URI + File;}
virtual bool GetIndexes(pkgAcquire *Owner, bool GetAll=false) const; ;
virtual bool GetIndexes(pkgAcquire *Owner, bool const &GetAll=false) con
st;
vector <struct IndexTarget *>* ComputeIndexTargets() const; vector <struct IndexTarget *>* ComputeIndexTargets() const;
string Info(const char *Type, const string Section) const; string Info(const char *Type, string const &Section, string const &Arch= "") const;
string MetaIndexInfo(const char *Type) const; string MetaIndexInfo(const char *Type) const;
string MetaIndexFile(const char *Types) const; string MetaIndexFile(const char *Types) const;
string MetaIndexURI(const char *Type) const; string MetaIndexURI(const char *Type) const;
string IndexURI(const char *Type, const string Section) const; string IndexURI(const char *Type, string const &Section, string const &A
string IndexURISuffix(const char *Type, const string Section) const; rch="native") const;
string SourceIndexURI(const char *Type, const string Section) const; string IndexURISuffix(const char *Type, string const &Section, string co
string SourceIndexURISuffix(const char *Type, const string Section) cons nst &Arch="native") const;
t; string SourceIndexURI(const char *Type, const string &Section) const;
string SourceIndexURISuffix(const char *Type, const string &Section) con
st;
virtual vector <pkgIndexFile *> *GetIndexFiles(); virtual vector <pkgIndexFile *> *GetIndexFiles();
virtual bool IsTrusted() const; virtual bool IsTrusted() const;
void PushSectionEntry(vector<string> const &Archs, const debSectionEntry
*Entry);
void PushSectionEntry(string const &Arch, const debSectionEntry *Entry);
void PushSectionEntry(const debSectionEntry *Entry); void PushSectionEntry(const debSectionEntry *Entry);
}; };
#endif #endif
 End of changes. 8 change blocks. 
13 lines changed or deleted 22 lines changed or added


 debsrcrecords.h   debsrcrecords.h 
skipping to change at line 32 skipping to change at line 32
pkgTagSection Sect; pkgTagSection Sect;
char *StaticBinList[400]; char *StaticBinList[400];
unsigned long iOffset; unsigned long iOffset;
char *Buffer; char *Buffer;
unsigned int BufSize; unsigned int BufSize;
public: public:
virtual bool Restart() {return Tags.Jump(Sect,0);}; virtual bool Restart() {return Tags.Jump(Sect,0);};
virtual bool Step() {iOffset = Tags.Offset(); return Tags.Step(Sect);}; virtual bool Step() {iOffset = Tags.Offset(); return Tags.Step(Sect);};
virtual bool Jump(unsigned long Off) {iOffset = Off; return Tags.Jump(Se ct,Off);}; virtual bool Jump(unsigned long const &Off) {iOffset = Off; return Tags. Jump(Sect,Off);};
virtual string Package() const {return Sect.FindS("Package");}; virtual string Package() const {return Sect.FindS("Package");};
virtual string Version() const {return Sect.FindS("Version");}; virtual string Version() const {return Sect.FindS("Version");};
virtual string Maintainer() const {return Sect.FindS("Maintainer");}; virtual string Maintainer() const {return Sect.FindS("Maintainer");};
virtual string Section() const {return Sect.FindS("Section");}; virtual string Section() const {return Sect.FindS("Section");};
virtual const char **Binaries(); virtual const char **Binaries();
virtual bool BuildDepends(vector<BuildDepRec> &BuildDeps, bool ArchOnly) ; virtual bool BuildDepends(vector<BuildDepRec> &BuildDeps, bool const &Ar chOnly, bool const &StripMultiArch = true);
virtual unsigned long Offset() {return iOffset;}; virtual unsigned long Offset() {return iOffset;};
virtual string AsStr() virtual string AsStr()
{ {
const char *Start=0,*Stop=0; const char *Start=0,*Stop=0;
Sect.GetSection(Start,Stop); Sect.GetSection(Start,Stop);
return string(Start,Stop); return string(Start,Stop);
}; };
virtual bool Files(vector<pkgSrcRecords::File> &F); virtual bool Files(vector<pkgSrcRecords::File> &F);
debSrcRecordParser(string File,pkgIndexFile const *Index) debSrcRecordParser(string const &File,pkgIndexFile const *Index)
: Parser(Index), Fd(File,FileFd::ReadOnly), Tags(&Fd,102400), : Parser(Index), Fd(File,FileFd::ReadOnlyGzip), Tags(&Fd,102400),
Buffer(0), BufSize(0) {} Buffer(0), BufSize(0) {}
~debSrcRecordParser(); ~debSrcRecordParser();
}; };
#endif #endif
 End of changes. 3 change blocks. 
4 lines changed or deleted 4 lines changed or added


 depcache.h   depcache.h 
skipping to change at line 41 skipping to change at line 41
state (Delete, Keep, Install) field and can be either the Current Versio n state (Delete, Keep, Install) field and can be either the Current Versio n
or the Candidate version. or the Candidate version.
The Candidate version is what is shown the 'Install Version' field. The Candidate version is what is shown the 'Install Version' field.
##################################################################### */ ##################################################################### */
/*}} }*/ /*}} }*/
#ifndef PKGLIB_DEPCACHE_H #ifndef PKGLIB_DEPCACHE_H
#define PKGLIB_DEPCACHE_H #define PKGLIB_DEPCACHE_H
#include <apt-pkg/configuration.h>
#include <apt-pkg/pkgcache.h> #include <apt-pkg/pkgcache.h>
#include <apt-pkg/progress.h> #include <apt-pkg/progress.h>
#include <apt-pkg/error.h>
#include <regex.h>
#include <vector> #include <vector>
#include <memory> #include <memory>
#include <set>
class pkgDepCache : protected pkgCache::Namespace class pkgDepCache : protected pkgCache::Namespace
{ {
public: public:
/** \brief An arbitrary predicate on packages. */ /** \brief An arbitrary predicate on packages. */
class InRootSetFunc class InRootSetFunc
{ {
public: public:
virtual bool InRootSet(const pkgCache::PkgIterator &pkg) {return false ;}; virtual bool InRootSet(const pkgCache::PkgIterator &pkg) {return false ;};
skipping to change at line 80 skipping to change at line 81
* \param ver The version of the package that is to be marked. * \param ver The version of the package that is to be marked.
* *
* \param follow_recommends If \b true, recommendations of the * \param follow_recommends If \b true, recommendations of the
* package will be recursively marked. * package will be recursively marked.
* *
* \param follow_suggests If \b true, suggestions of the package * \param follow_suggests If \b true, suggestions of the package
* will be recursively marked. * will be recursively marked.
*/ */
void MarkPackage(const pkgCache::PkgIterator &pkg, void MarkPackage(const pkgCache::PkgIterator &pkg,
const pkgCache::VerIterator &ver, const pkgCache::VerIterator &ver,
bool follow_recommends, bool const &follow_recommends,
bool follow_suggests); bool const &follow_suggests);
/** \brief Update the Marked field of all packages. /** \brief Update the Marked field of all packages.
* *
* Each package's StateCache::Marked field will be set to \b true * Each package's StateCache::Marked field will be set to \b true
* if and only if it can be reached from the root set. By * if and only if it can be reached from the root set. By
* default, the root set consists of the set of manually installed * default, the root set consists of the set of manually installed
* or essential packages, but it can be extended using the * or essential packages, but it can be extended using the
* parameter #rootFunc. * parameter #rootFunc.
* *
* \param rootFunc A callback that can be used to add extra * \param rootFunc A callback that can be used to add extra
skipping to change at line 185 skipping to change at line 186
* *
* If this is the last action group, the automatic cache * If this is the last action group, the automatic cache
* cleanup operations will be undertaken. * cleanup operations will be undertaken.
*/ */
~ActionGroup(); ~ActionGroup();
}; };
/** \brief Returns \b true for packages matching a regular /** \brief Returns \b true for packages matching a regular
* expression in APT::NeverAutoRemove. * expression in APT::NeverAutoRemove.
*/ */
class DefaultRootSetFunc : public InRootSetFunc class DefaultRootSetFunc : public InRootSetFunc, public Configuration::M atchAgainstConfig
{ {
std::vector<regex_t *> rootSetRegexp;
bool constructedSuccessfully;
public: public:
DefaultRootSetFunc(); DefaultRootSetFunc() : Configuration::MatchAgainstConfig("APT::NeverRe
~DefaultRootSetFunc(); move") {};
virtual ~DefaultRootSetFunc() {};
/** \return \b true if the class initialized successfully, \b
* false otherwise. Used to avoid throwing an exception, since
* APT classes generally don't.
*/
bool wasConstructedSuccessfully() const { return constructedSuccessful
ly; }
bool InRootSet(const pkgCache::PkgIterator &pkg); bool InRootSet(const pkgCache::PkgIterator &pkg) { return pkg.end() == true && Match(pkg.Name()); };
}; };
struct StateCache struct StateCache
{ {
// Epoch stripped text versions of the two version fields // Epoch stripped text versions of the two version fields
const char *CandVersion; const char *CandVersion;
const char *CurVersion; const char *CurVersion;
// Pointer to the candidate install version. // Pointer to the candidate install version.
Version *CandidateVer; Version *CandidateVer;
skipping to change at line 267 skipping to change at line 259
// Helper functions // Helper functions
void BuildGroupOrs(VerIterator const &V); void BuildGroupOrs(VerIterator const &V);
void UpdateVerState(PkgIterator Pkg); void UpdateVerState(PkgIterator Pkg);
// User Policy control // User Policy control
class Policy class Policy
{ {
public: public:
virtual VerIterator GetCandidateVer(PkgIterator Pkg); virtual VerIterator GetCandidateVer(PkgIterator const &Pkg);
virtual bool IsImportantDep(DepIterator Dep); virtual bool IsImportantDep(DepIterator const &Dep);
virtual ~Policy() {}; virtual ~Policy() {};
}; };
private: private:
/** The number of open "action groups"; certain post-action /** The number of open "action groups"; certain post-action
* operations are suppressed if this number is > 0. * operations are suppressed if this number is > 0.
*/ */
int group_level; int group_level;
friend class ActionGroup; friend class ActionGroup;
protected: protected:
// State information // State information
pkgCache *Cache; pkgCache *Cache;
StateCache *PkgState; StateCache *PkgState;
unsigned char *DepState; unsigned char *DepState;
double iUsrSize; /** Stores the space changes after installation */
double iDownloadSize; signed long long iUsrSize;
/** Stores how much we need to download to get the packages */
unsigned long long iDownloadSize;
unsigned long iInstCount; unsigned long iInstCount;
unsigned long iDelCount; unsigned long iDelCount;
unsigned long iKeepCount; unsigned long iKeepCount;
unsigned long iBrokenCount; unsigned long iBrokenCount;
unsigned long iPolicyBrokenCount; unsigned long iPolicyBrokenCount;
unsigned long iBadCount; unsigned long iBadCount;
bool DebugMarker; bool DebugMarker;
bool DebugAutoInstall; bool DebugAutoInstall;
skipping to change at line 322 skipping to change at line 316
unsigned char DependencyState(DepIterator &D); unsigned char DependencyState(DepIterator &D);
unsigned char VersionState(DepIterator D,unsigned char Check, unsigned char VersionState(DepIterator D,unsigned char Check,
unsigned char SetMin, unsigned char SetMin,
unsigned char SetPolicy); unsigned char SetPolicy);
// Recalculates various portions of the cache, call after changing somet hing // Recalculates various portions of the cache, call after changing somet hing
void Update(DepIterator Dep); // Mostly internal void Update(DepIterator Dep); // Mostly internal
void Update(PkgIterator const &P); void Update(PkgIterator const &P);
// Count manipulators // Count manipulators
void AddSizes(const PkgIterator &Pkg,signed long Mult = 1); void AddSizes(const PkgIterator &Pkg, bool const &Invert = false);
inline void RemoveSizes(const PkgIterator &Pkg) {AddSizes(Pkg,-1);}; inline void RemoveSizes(const PkgIterator &Pkg) {AddSizes(Pkg, true);};
void AddSizes(const PkgIterator &Pkg,signed long Mult) __deprecated;
void AddStates(const PkgIterator &Pkg,int Add = 1); void AddStates(const PkgIterator &Pkg,int Add = 1);
inline void RemoveStates(const PkgIterator &Pkg) {AddStates(Pkg,-1);}; inline void RemoveStates(const PkgIterator &Pkg) {AddStates(Pkg,-1);};
public: public:
// Legacy.. We look like a pkgCache // Legacy.. We look like a pkgCache
inline operator pkgCache &() {return *Cache;}; inline operator pkgCache &() {return *Cache;};
inline Header &Head() {return *Cache->HeaderP;}; inline Header &Head() {return *Cache->HeaderP;};
inline GrpIterator GrpBegin() {return Cache->GrpBegin();};
inline PkgIterator PkgBegin() {return Cache->PkgBegin();}; inline PkgIterator PkgBegin() {return Cache->PkgBegin();};
inline GrpIterator FindGrp(string const &Name) {return Cache->FindGrp(Na me);};
inline PkgIterator FindPkg(string const &Name) {return Cache->FindPkg(Na me);}; inline PkgIterator FindPkg(string const &Name) {return Cache->FindPkg(Na me);};
inline PkgIterator FindPkg(string const &Name, string const &Arch) {retu rn Cache->FindPkg(Name, Arch);};
inline pkgCache &GetCache() {return *Cache;}; inline pkgCache &GetCache() {return *Cache;};
inline pkgVersioningSystem &VS() {return *Cache->VS;}; inline pkgVersioningSystem &VS() {return *Cache->VS;};
// Policy implementation // Policy implementation
inline VerIterator GetCandidateVer(PkgIterator Pkg) {return LocalPolicy- >GetCandidateVer(Pkg);}; inline VerIterator GetCandidateVer(PkgIterator const &Pkg) {return Local Policy->GetCandidateVer(Pkg);};
inline bool IsImportantDep(DepIterator Dep) {return LocalPolicy->IsImpor tantDep(Dep);}; inline bool IsImportantDep(DepIterator Dep) {return LocalPolicy->IsImpor tantDep(Dep);};
inline Policy &GetPolicy() {return *LocalPolicy;}; inline Policy &GetPolicy() {return *LocalPolicy;};
// Accessors // Accessors
inline StateCache &operator [](PkgIterator const &I) {return PkgState[I- >ID];}; inline StateCache &operator [](PkgIterator const &I) {return PkgState[I- >ID];};
inline unsigned char &operator [](DepIterator const &I) {return DepState [I->ID];}; inline unsigned char &operator [](DepIterator const &I) {return DepState [I->ID];};
/** \return A function identifying packages in the root set other /** \return A function identifying packages in the root set other
* than manually installed packages and essential packages, or \b * than manually installed packages and essential packages, or \b
* NULL if an error occurs. * NULL if an error occurs.
skipping to change at line 400 skipping to change at line 398
// @{ // @{
void MarkKeep(PkgIterator const &Pkg, bool Soft = false, void MarkKeep(PkgIterator const &Pkg, bool Soft = false,
bool FromUser = true, unsigned long Depth = 0); bool FromUser = true, unsigned long Depth = 0);
void MarkDelete(PkgIterator const &Pkg, bool Purge = false, void MarkDelete(PkgIterator const &Pkg, bool Purge = false,
unsigned long Depth = 0, bool FromUser = true); unsigned long Depth = 0, bool FromUser = true);
void MarkInstall(PkgIterator const &Pkg,bool AutoInst = true, void MarkInstall(PkgIterator const &Pkg,bool AutoInst = true,
unsigned long Depth = 0, bool FromUser = true, unsigned long Depth = 0, bool FromUser = true,
bool ForceImportantDeps = false); bool ForceImportantDeps = false);
void SetReInstall(PkgIterator const &Pkg,bool To); void SetReInstall(PkgIterator const &Pkg,bool To);
void SetCandidateVersion(VerIterator TargetVer); void SetCandidateVersion(VerIterator TargetVer, bool const &Pseudo = tru e);
/** Set the "is automatically installed" flag of Pkg. */ /** Set the "is automatically installed" flag of Pkg. */
void MarkAuto(const PkgIterator &Pkg, bool Auto); void MarkAuto(const PkgIterator &Pkg, bool Auto);
// @} // @}
/** \return \b true if it's OK for MarkInstall to install /** \return \b true if it's OK for MarkInstall to install
* the given package. * the given package.
* *
* See the default implementation for a simple example how this * See the default implementation for a simple example how this
* method can be used. * method can be used.
skipping to change at line 444 skipping to change at line 442
* *
* The parameters are the same as in the calling MarkDelete: * The parameters are the same as in the calling MarkDelete:
* \param Pkg the package that MarkDelete wants to remove. * \param Pkg the package that MarkDelete wants to remove.
* \param Purge should we purge instead of "only" remove? * \param Purge should we purge instead of "only" remove?
* \param Depth recursive deep of this Marker call * \param Depth recursive deep of this Marker call
* \param FromUser was the remove requested by the user? * \param FromUser was the remove requested by the user?
*/ */
virtual bool IsDeleteOk(const PkgIterator &Pkg,bool Purge = false, virtual bool IsDeleteOk(const PkgIterator &Pkg,bool Purge = false,
unsigned long Depth = 0, bool FromUser = true); unsigned long Depth = 0, bool FromUser = true);
// This is for debuging
void Update(OpProgress *Prog = 0);
// read persistent states // read persistent states
bool readStateFile(OpProgress *prog); bool readStateFile(OpProgress *prog);
bool writeStateFile(OpProgress *prog, bool InstalledOnly=false); bool writeStateFile(OpProgress *prog, bool InstalledOnly=true);
// Size queries // Size queries
inline double UsrSize() {return iUsrSize;}; inline signed long long UsrSize() {return iUsrSize;};
inline double DebSize() {return iDownloadSize;}; inline unsigned long long DebSize() {return iDownloadSize;};
inline unsigned long DelCount() {return iDelCount;}; inline unsigned long DelCount() {return iDelCount;};
inline unsigned long KeepCount() {return iKeepCount;}; inline unsigned long KeepCount() {return iKeepCount;};
inline unsigned long InstCount() {return iInstCount;}; inline unsigned long InstCount() {return iInstCount;};
inline unsigned long BrokenCount() {return iBrokenCount;}; inline unsigned long BrokenCount() {return iBrokenCount;};
inline unsigned long PolicyBrokenCount() {return iPolicyBrokenCount;}; inline unsigned long PolicyBrokenCount() {return iPolicyBrokenCount;};
inline unsigned long BadCount() {return iBadCount;}; inline unsigned long BadCount() {return iBadCount;};
bool Init(OpProgress *Prog); bool Init(OpProgress *Prog);
// Generate all state information
void Update(OpProgress *Prog = 0);
pkgDepCache(pkgCache *Cache,Policy *Plcy = 0); pkgDepCache(pkgCache *Cache,Policy *Plcy = 0);
virtual ~pkgDepCache(); virtual ~pkgDepCache();
private:
// Helper for Update(OpProgress) to remove pseudoinstalled arch all pack
ages
bool RemovePseudoInstalledPkg(PkgIterator &Pkg, std::set<unsigned long>
&recheck);
bool ReInstallPseudoForGroup(unsigned long const &Grp, std::set<unsigned
long> &recheck);
bool ReInstallPseudoForGroup(pkgCache::PkgIterator const &P, std::set<un
signed long> &recheck);
}; };
#endif #endif
 End of changes. 21 change blocks. 
32 lines changed or deleted 39 lines changed or added


 dpkgpm.h   dpkgpm.h 
skipping to change at line 31 skipping to change at line 31
class pkgDPkgPM : public pkgPackageManager class pkgDPkgPM : public pkgPackageManager
{ {
private: private:
bool stdin_is_dev_null; bool stdin_is_dev_null;
// the buffer we use for the dpkg status-fd reading // the buffer we use for the dpkg status-fd reading
char dpkgbuf[1024]; char dpkgbuf[1024];
int dpkgbuf_pos; int dpkgbuf_pos;
FILE *term_out; FILE *term_out;
FILE *history_out;
string dpkg_error;
/** \brief record the disappear action and handle accordingly
dpkg let packages disappear then they have no files any longer and
nothing depends on them. We need to collect this as dpkg as well as
APT doesn't know beforehand that the package will disappear, so the
only possible option is to tell the user afterwards about it.
To enhance the experience we also try to forward the auto-install
flag so the disappear-causer(s) are not autoremoved next time -
for the transfer to happen the disappeared version needs to depend
on the package the flag should be forwarded to and this package
needs to declare a Replaces on the disappeared package.
\param pkgname Name of the package that disappeared
*/
void handleDisappearAction(string const &pkgname);
protected: protected:
int pkgFailures;
// progress reporting // progress reporting
struct DpkgState struct DpkgState
{ {
const char *state; // the dpkg state (e.g. "unpack") const char *state; // the dpkg state (e.g. "unpack")
const char *str; // the human readable translation of the state const char *str; // the human readable translation of the state
}; };
// the dpkg states that the pkg will run through, the string is // the dpkg states that the pkg will run through, the string is
// the package, the vector contains the dpkg states that the package // the package, the vector contains the dpkg states that the package
skipping to change at line 68 skipping to change at line 87
Item(Ops Op,PkgIterator Pkg,string File = "") : Op(Op), Item(Ops Op,PkgIterator Pkg,string File = "") : Op(Op),
File(File), Pkg(Pkg) {}; File(File), Pkg(Pkg) {};
Item() {}; Item() {};
}; };
vector<Item> List; vector<Item> List;
// Helpers // Helpers
bool RunScriptsWithPkgs(const char *Cnf); bool RunScriptsWithPkgs(const char *Cnf);
bool SendV2Pkgs(FILE *F); bool SendV2Pkgs(FILE *F);
void WriteHistoryTag(string const &tag, string value);
// apport integration
void WriteApportReport(const char *pkgpath, const char *errormsg);
// dpkg log // dpkg log
bool OpenLog(); bool OpenLog();
bool CloseLog(); bool CloseLog();
// input processing // input processing
void DoStdin(int master); void DoStdin(int master);
void DoTerminalPty(int master); void DoTerminalPty(int master);
void DoDpkgStatusFd(int statusfd, int OutStatusFd); void DoDpkgStatusFd(int statusfd, int OutStatusFd);
void ProcessDpkgStatusLine(int OutStatusFd, char *line); void ProcessDpkgStatusLine(int OutStatusFd, char *line);
 End of changes. 3 change blocks. 
0 lines changed or deleted 22 lines changed or added


 error.h   error.h 
skipping to change at line 45 skipping to change at line 45
This source is placed in the Public Domain, do with it what you will This source is placed in the Public Domain, do with it what you will
It was originally written by Jason Gunthorpe. It was originally written by Jason Gunthorpe.
##################################################################### */ ##################################################################### */
/*}} }*/ /*}} }*/
#ifndef PKGLIB_ERROR_H #ifndef PKGLIB_ERROR_H
#define PKGLIB_ERROR_H #define PKGLIB_ERROR_H
#include <apt-pkg/macros.h> #include <apt-pkg/macros.h>
#include <iostream>
#include <list>
#include <string> #include <string>
class GlobalError #include <stdarg.h>
class GlobalError /*{{
{*/
{ {
struct Item public:
{ /*{{{*/
std::string Text; /** \brief a message can have one of following severity */
bool Error; enum MsgType {
Item *Next; /** \brief Message will be printed instantly as it is likely
}; that
this error will lead to a complete crash */
FATAL = 40,
/** \brief An error does hinder the correct execution and sh
ould be corrected */
ERROR = 30,
/** \brief indicates problem that can lead to errors later o
n */
WARNING = 20,
/** \brief deprecation warnings, old fallback behavior, … */
NOTICE = 10,
/** \brief for developers only in areas it is hard to print
something directly */
DEBUG = 0
};
Item *List; /** \brief add a fatal error message with errno to the list
bool PendingFlag; *
void Insert(Item *I); * \param Function name of the function generating the error
* \param Description format string for the error message
*
* \return \b false
*/
bool FatalE(const char *Function,const char *Description,...) __like
_printf(3) __cold;
public: /** \brief add an Error message with errno to the list
*
* \param Function name of the function generating the error
* \param Description format string for the error message
*
* \return \b false
*/
bool Errno(const char *Function,const char *Description,...) __like_
printf(3) __cold;
// Call to generate an error from a library call. /** \brief add a warning message with errno to the list
bool Errno(const char *Function,const char *Description,...) __like_prin *
tf_2 __cold; * A warning should be considered less severe than an error and
bool WarningE(const char *Function,const char *Description,...) __like_p * may be ignored by the client.
rintf_2 __cold; *
* \param Function Name of the function generates the warning.
* \param Description Format string for the warning message.
*
* \return \b false
*/
bool WarningE(const char *Function,const char *Description,...) __li
ke_printf(3) __cold;
/* A warning should be considered less severe than an error, and may be /** \brief add a notice message with errno to the list
ignored by the client. */ *
bool Error(const char *Description,...) __like_printf_1 __cold; * \param Function name of the function generating the error
bool Warning(const char *Description,...) __like_printf_1 __cold; * \param Description format string for the error message
*
* \return \b false
*/
bool NoticeE(const char *Function,const char *Description,...) __lik
e_printf(3) __cold;
// Simple accessors /** \brief add a debug message with errno to the list
inline bool PendingError() {return PendingFlag;}; *
inline bool empty() {return List == 0;}; * \param Function name of the function generating the error
bool PopMessage(std::string &Text); * \param Description format string for the error message
void Discard(); *
* \return \b false
*/
bool DebugE(const char *Function,const char *Description,...) __like
_printf(3) __cold;
// Usefull routine to dump to cerr /** \brief adds an errno message with the given type
void DumpErrors(); *
* \param type of the error message
* \param Function which failed
* \param Description of the error
*/
bool InsertErrno(MsgType const &type, const char* Function,
const char* Description,...) __like_printf(4) __col
d;
GlobalError(); /** \brief add an fatal error message to the list
*
* Most of the stuff we consider as "error" is also "fatal" for
* the user as the application will not have the expected result,
* but a fatal message here means that it gets printed directly
* to stderr in addiction to adding it to the list as the error
* leads sometimes to crashes and a maybe duplicated message
* is better than "Segfault" as the only displayed text
*
* \param Description Format string for the fatal error message.
*
* \return \b false
*/
bool Fatal(const char *Description,...) __like_printf(2) __cold;
/** \brief add an Error message to the list
*
* \param Description Format string for the error message.
*
* \return \b false
*/
bool Error(const char *Description,...) __like_printf(2) __cold;
/** \brief add a warning message to the list
*
* A warning should be considered less severe than an error and
* may be ignored by the client.
*
* \param Description Format string for the message
*
* \return \b false
*/
bool Warning(const char *Description,...) __like_printf(2) __cold;
/** \brief add a notice message to the list
*
* A notice should be considered less severe than an error or a
* warning and can be ignored by the client without further problem
s
* for some times, but he should consider fixing the problem.
* This error type can be used for e.g. deprecation warnings of opt
ions.
*
* \param Description Format string for the message
*
* \return \b false
*/
bool Notice(const char *Description,...) __like_printf(2) __cold;
/** \brief add a debug message to the list
*
* \param Description Format string for the message
*
* \return \b false
*/
bool Debug(const char *Description,...) __like_printf(2) __cold;
/** \brief adds an error message with the given type
*
* \param type of the error message
* \param Description of the error
*/
bool Insert(MsgType const &type, const char* Description,...) __like
_printf(3) __cold;
/** \brief is an error in the list?
*
* \return \b true if an error is included in the list, \b false ot
herwise
*/
inline bool PendingError() const {return PendingFlag;};
/** \brief is the list empty?
*
* The default checks if the list is empty or contains only notices
,
* if you want to check if also no notices happend set the paramete
r
* flag to \b false.
*
* \param WithoutNotice does notices count, default is \b true, so
no
*
* \return \b true if an the list is empty, \b false otherwise
*/
bool empty(MsgType const &trashhold = WARNING) const;
/** \brief returns and removes the first (or last) message in the li
st
*
* \param[out] Text message of the first/last item
*
* \return \b true if the message was an error, \b false otherwise
*/
bool PopMessage(std::string &Text);
/** \brief clears the list of messages */
void Discard();
/** \brief outputs the list of messages to the given stream
*
* Note that all messages are discarded, also the notices
* displayed or not.
*
* \param[out] out output stream to write the messages in
* \param threshold minimim level considered
* \param mergeStack
*/
void DumpErrors(std::ostream &out, MsgType const &threshold = WARNIN
G,
bool const &mergeStack = true);
/** \brief dumps the list of messages to std::cerr
*
* Note that all messages are discarded, also the notices
* displayed or not.
*
* \param threshold minimum level printed
*/
void inline DumpErrors(MsgType const &threshold) {
DumpErrors(std::cerr, threshold);
}
// mvo: we do this instead of using a default parameter in the
// previous declaration to avoid a (subtle) API break for
// e.g. sigc++ and mem_fun0
/** \brief dumps the messages of type WARNING or higher to std::cerr
*
* Note that all messages are discarded, displayed or not.
*
*/
void inline DumpErrors() {
DumpErrors(WARNING);
}
/** \brief put the current Messages into the stack
*
* All "old" messages will be pushed into a stack to
* them later back, but for now the Message query will be
* empty and performs as no messages were present before.
*
* The stack can be as deep as you want - all stack operations
* will only operate on the last element in the stack.
*/
void PushToStack();
/** \brief throw away all current messages */
void RevertToStack();
/** \brief merge current and stack together */
void MergeWithStack();
/** \brief return the deep of the stack */
size_t StackCount() const {
return Stacks.size();
}
GlobalError();
/*}}
}*/
private: /*{{
{*/
struct Item {
std::string Text;
MsgType Type;
Item(char const *Text, MsgType const &Type) :
Text(Text), Type(Type) {};
friend std::ostream& operator<< (std::ostream &out, Item i)
{
switch(i.Type) {
case FATAL:
case ERROR: out << "E"; break;
case WARNING: out << "W"; break;
case NOTICE: out << "N"; break;
case DEBUG: out << "D"; break;
}
return out << ": " << i.Text;
}
};
std::list<Item> Messages;
bool PendingFlag;
struct MsgStack {
std::list<Item> const Messages;
bool const PendingFlag;
MsgStack(std::list<Item> const &Messages, bool const &Pendin
g) :
Messages(Messages), PendingFlag(Pending) {};
};
std::list<MsgStack> Stacks;
bool InsertErrno(MsgType type, const char* Function,
const char* Description, va_list &args);
bool Insert(MsgType type, const char* Description,
va_list &args);
/*}}
}*/
}; };
/*}} }*/
// The 'extra-ansi' syntax is used to help with collisions. // The 'extra-ansi' syntax is used to help with collisions.
GlobalError *_GetErrorObj(); GlobalError *_GetErrorObj();
#define _error _GetErrorObj() #define _error _GetErrorObj()
#endif #endif
 End of changes. 11 change blocks. 
28 lines changed or deleted 286 lines changed or added


 fileutl.h   fileutl.h 
skipping to change at line 24 skipping to change at line 24
that need to accept filenames. that need to accept filenames.
This source is placed in the Public Domain, do with it what you will This source is placed in the Public Domain, do with it what you will
It was originally written by Jason Gunthorpe. It was originally written by Jason Gunthorpe.
##################################################################### */ ##################################################################### */
/*}} }*/ /*}} }*/
#ifndef PKGLIB_FILEUTL_H #ifndef PKGLIB_FILEUTL_H
#define PKGLIB_FILEUTL_H #define PKGLIB_FILEUTL_H
#include <apt-pkg/macros.h>
#include <string> #include <string>
#include <vector> #include <vector>
#include <zlib.h>
/* Define this for python-apt */
#define APT_HAS_GZIP 1
using std::string; using std::string;
class FileFd class FileFd
{ {
protected: protected:
int iFd; int iFd;
enum LocalFlags {AutoClose = (1<<0),Fail = (1<<1),DelOnFail = (1<<2), enum LocalFlags {AutoClose = (1<<0),Fail = (1<<1),DelOnFail = (1<<2),
HitEof = (1<<3)}; HitEof = (1<<3), Replace = (1<<4) };
unsigned long Flags; unsigned long Flags;
string FileName; string FileName;
string TemporaryFileName;
gzFile gz;
public: public:
enum OpenMode {ReadOnly,WriteEmpty,WriteExists,WriteAny,WriteTemp}; enum OpenMode {ReadOnly,WriteEmpty,WriteExists,WriteAny,WriteTemp,ReadOn
lyGzip,
WriteAtomic};
inline bool Read(void *To,unsigned long Size,bool AllowEof) inline bool Read(void *To,unsigned long Size,bool AllowEof)
{ {
unsigned long Jnk; unsigned long Jnk;
if (AllowEof) if (AllowEof)
return Read(To,Size,&Jnk); return Read(To,Size,&Jnk);
return Read(To,Size); return Read(To,Size);
} }
bool Read(void *To,unsigned long Size,unsigned long *Actual = 0); bool Read(void *To,unsigned long Size,unsigned long *Actual = 0);
bool Write(const void *From,unsigned long Size); bool Write(const void *From,unsigned long Size);
bool Seek(unsigned long To); bool Seek(unsigned long To);
bool Skip(unsigned long To); bool Skip(unsigned long To);
bool Truncate(unsigned long To); bool Truncate(unsigned long To);
unsigned long Tell(); unsigned long Tell();
unsigned long Size(); unsigned long Size();
bool Open(string FileName,OpenMode Mode,unsigned long Perms = 0666); bool Open(string FileName,OpenMode Mode,unsigned long Perms = 0666);
bool OpenDescriptor(int Fd, OpenMode Mode, bool AutoClose=false);
bool Close(); bool Close();
bool Sync(); bool Sync();
// Simple manipulators // Simple manipulators
inline int Fd() {return iFd;}; inline int Fd() {return iFd;};
inline void Fd(int fd) {iFd = fd;}; inline void Fd(int fd) {iFd = fd;};
inline bool IsOpen() {return iFd >= 0;}; inline bool IsOpen() {return iFd >= 0;};
inline bool Failed() {return (Flags & Fail) == Fail;}; inline bool Failed() {return (Flags & Fail) == Fail;};
inline void EraseOnFailure() {Flags |= DelOnFail;}; inline void EraseOnFailure() {Flags |= DelOnFail;};
inline void OpFail() {Flags |= Fail;}; inline void OpFail() {Flags |= Fail;};
inline bool Eof() {return (Flags & HitEof) == HitEof;}; inline bool Eof() {return (Flags & HitEof) == HitEof;};
inline string &Name() {return FileName;}; inline string &Name() {return FileName;};
FileFd(string FileName,OpenMode Mode,unsigned long Perms = 0666) : iFd(- 1), FileFd(string FileName,OpenMode Mode,unsigned long Perms = 0666) : iFd(- 1),
Flags(0) Flags(0), gz(NULL)
{ {
Open(FileName,Mode,Perms); Open(FileName,Mode,Perms);
}; };
FileFd(int Fd = -1) : iFd(Fd), Flags(AutoClose) {}; FileFd(int Fd = -1) : iFd(Fd), Flags(AutoClose), gz(NULL) {};
FileFd(int Fd,bool) : iFd(Fd), Flags(0) {}; FileFd(int Fd,bool) : iFd(Fd), Flags(0), gz(NULL) {};
virtual ~FileFd(); virtual ~FileFd();
}; };
bool RunScripts(const char *Cnf); bool RunScripts(const char *Cnf);
bool CopyFile(FileFd &From,FileFd &To); bool CopyFile(FileFd &From,FileFd &To);
int GetLock(string File,bool Errors = true); int GetLock(string File,bool Errors = true);
bool FileExists(string File); bool FileExists(string File);
// FIXME: next ABI-Break: merge the two method-headers bool DirectoryExists(string const &Path) __attrib_const;
std::vector<string> GetListOfFilesInDir(string const &Dir, string const &Ex bool CreateDirectory(string const &Parent, string const &Path);
t,
bool const &SortList);
std::vector<string> GetListOfFilesInDir(string const &Dir, string const &Ex t, std::vector<string> GetListOfFilesInDir(string const &Dir, string const &Ex t,
bool const &SortList, bool const &Al lowNoExt); bool const &SortList, bool const &Al lowNoExt=false);
std::vector<string> GetListOfFilesInDir(string const &Dir, std::vector<stri ng> const &Ext, std::vector<string> GetListOfFilesInDir(string const &Dir, std::vector<stri ng> const &Ext,
bool const &SortList); bool const &SortList);
string SafeGetCWD(); string SafeGetCWD();
void SetCloseExec(int Fd,bool Close); void SetCloseExec(int Fd,bool Close);
void SetNonBlock(int Fd,bool Block); void SetNonBlock(int Fd,bool Block);
bool WaitFd(int Fd,bool write = false,unsigned long timeout = 0); bool WaitFd(int Fd,bool write = false,unsigned long timeout = 0);
pid_t ExecFork(); pid_t ExecFork();
bool ExecWait(pid_t Pid,const char *Name,bool Reap = false); bool ExecWait(pid_t Pid,const char *Name,bool Reap = false);
// File string manipulators // File string manipulators
 End of changes. 10 change blocks. 
10 lines changed or deleted 20 lines changed or added


 indexcopy.h   indexcopy.h 
skipping to change at line 92 skipping to change at line 92
/*}} }*/ /*}} }*/
class SigVerify /*{{{*/ class SigVerify /*{{{*/
{ {
bool Verify(string prefix,string file, indexRecords *records); bool Verify(string prefix,string file, indexRecords *records);
bool CopyMetaIndex(string CDROM, string CDName, bool CopyMetaIndex(string CDROM, string CDName,
string prefix, string file); string prefix, string file);
public: public:
bool CopyAndVerify(string CDROM,string Name,vector<string> &SigList, bool CopyAndVerify(string CDROM,string Name,vector<string> &SigList,
vector<string> PkgList,vector<string> SrcList); vector<string> PkgList,vector<string> SrcList);
/** \brief generates and run the command to verify a file with gpgv */
static bool RunGPGV(std::string const &File, std::string const &FileOut,
int const &statusfd, int fd[2]);
inline static bool RunGPGV(std::string const &File, std::string const &F
ileOut,
int const &statusfd = -1) {
int fd[2];
return RunGPGV(File, FileOut, statusfd, fd);
};
}; };
/*}} }*/ /*}} }*/
#endif #endif
 End of changes. 1 change blocks. 
0 lines changed or deleted 10 lines changed or added


 indexfile.h   indexfile.h 
skipping to change at line 76 skipping to change at line 76
// Interface for acquire // Interface for acquire
virtual string ArchiveURI(string /*File*/) const {return string();}; virtual string ArchiveURI(string /*File*/) const {return string();};
// Interface for the record parsers // Interface for the record parsers
virtual pkgSrcRecords::Parser *CreateSrcParser() const {return 0;}; virtual pkgSrcRecords::Parser *CreateSrcParser() const {return 0;};
// Interface for the Cache Generator // Interface for the Cache Generator
virtual bool Exists() const = 0; virtual bool Exists() const = 0;
virtual bool HasPackages() const = 0; virtual bool HasPackages() const = 0;
virtual unsigned long Size() const = 0; virtual unsigned long Size() const = 0;
virtual bool Merge(pkgCacheGenerator &/*Gen*/,OpProgress &/*Prog*/) cons virtual bool Merge(pkgCacheGenerator &/*Gen*/,OpProgress* /*Prog*/) cons
t {return false;}; t { return false; };
virtual bool MergeFileProvides(pkgCacheGenerator &/*Gen*/,OpProgress &/* __deprecated virtual bool Merge(pkgCacheGenerator &Gen, OpProgress &Prog
Prog*/) const {return true;}; ) const
{ return Merge(Gen, &Prog); };
virtual bool MergeFileProvides(pkgCacheGenerator &/*Gen*/,OpProgress* /*
Prog*/) const {return true;};
__deprecated virtual bool MergeFileProvides(pkgCacheGenerator &Gen, OpPr
ogress &Prog) const
{return MergeFileProvides(Gen, &Prog);};
virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const; virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
static bool TranslationsAvailable(); static bool TranslationsAvailable();
static bool CheckLanguageCode(const char *Lang); static bool CheckLanguageCode(const char *Lang);
static string LanguageCode(); static string LanguageCode();
bool IsTrusted() const { return Trusted; }; bool IsTrusted() const { return Trusted; };
pkgIndexFile(bool Trusted): Trusted(Trusted) {}; pkgIndexFile(bool Trusted): Trusted(Trusted) {};
virtual ~pkgIndexFile() {}; virtual ~pkgIndexFile() {};
 End of changes. 1 change blocks. 
4 lines changed or deleted 10 lines changed or added


 indexrecords.h   indexrecords.h 
skipping to change at line 14 skipping to change at line 14
/*}} }*/ /*}} }*/
#ifndef PKGLIB_INDEXRECORDS_H #ifndef PKGLIB_INDEXRECORDS_H
#define PKGLIB_INDEXRECORDS_H #define PKGLIB_INDEXRECORDS_H
#include <apt-pkg/pkgcache.h> #include <apt-pkg/pkgcache.h>
#include <apt-pkg/fileutl.h> #include <apt-pkg/fileutl.h>
#include <apt-pkg/hashes.h> #include <apt-pkg/hashes.h>
#include <map> #include <map>
#include <vector> #include <vector>
#include <ctime>
class indexRecords class indexRecords
{ {
bool parseSumData(const char *&Start, const char *End, string &Name, bool parseSumData(const char *&Start, const char *End, string &Name,
string &Hash, size_t &Size); string &Hash, size_t &Size);
public: public:
struct checkSum; struct checkSum;
string ErrorText; string ErrorText;
protected: protected:
string Dist; string Dist;
string Suite; string Suite;
string ExpectedDist; string ExpectedDist;
time_t ValidUntil;
std::map<string,checkSum *> Entries; std::map<string,checkSum *> Entries;
public: public:
indexRecords(); indexRecords();
indexRecords(const string ExpectedDist); indexRecords(const string ExpectedDist);
// Lookup function // Lookup function
virtual const checkSum *Lookup(const string MetaKey); virtual const checkSum *Lookup(const string MetaKey);
/** \brief tests if a checksum for this file is available */
bool Exists(string const &MetaKey) const;
std::vector<std::string> MetaKeys(); std::vector<std::string> MetaKeys();
virtual bool Load(string Filename); virtual bool Load(string Filename);
string GetDist() const; string GetDist() const;
time_t GetValidUntil() const;
virtual bool CheckDist(const string MaybeDist) const; virtual bool CheckDist(const string MaybeDist) const;
string GetExpectedDist() const; string GetExpectedDist() const;
virtual ~indexRecords(){}; virtual ~indexRecords(){};
}; };
struct indexRecords::checkSum struct indexRecords::checkSum
{ {
string MetaKeyFilename; string MetaKeyFilename;
HashString Hash; HashString Hash;
size_t Size; size_t Size;
 End of changes. 4 change blocks. 
0 lines changed or deleted 6 lines changed or added


 init.h   init.h 
skipping to change at line 25 skipping to change at line 25
#include <apt-pkg/configuration.h> #include <apt-pkg/configuration.h>
#include <apt-pkg/pkgsystem.h> #include <apt-pkg/pkgsystem.h>
// These lines are extracted by the makefiles and the buildsystem // These lines are extracted by the makefiles and the buildsystem
// Increasing MAJOR or MINOR results in the need of recompiling all // Increasing MAJOR or MINOR results in the need of recompiling all
// reverse-dependencies of libapt-pkg against the new SONAME. // reverse-dependencies of libapt-pkg against the new SONAME.
// Non-ABI-Breaks should only increase RELEASE number. // Non-ABI-Breaks should only increase RELEASE number.
// See also buildlib/libversion.mak // See also buildlib/libversion.mak
#define APT_PKG_MAJOR 4 #define APT_PKG_MAJOR 4
#define APT_PKG_MINOR 8 #define APT_PKG_MINOR 10
#define APT_PKG_RELEASE 0 #define APT_PKG_RELEASE 0
extern const char *pkgVersion; extern const char *pkgVersion;
extern const char *pkgLibVersion; extern const char *pkgLibVersion;
bool pkgInitConfig(Configuration &Cnf); bool pkgInitConfig(Configuration &Cnf);
bool pkgInitSystem(Configuration &Cnf,pkgSystem *&Sys); bool pkgInitSystem(Configuration &Cnf,pkgSystem *&Sys);
#ifdef APT_COMPATIBILITY #ifdef APT_COMPATIBILITY
#if APT_COMPATIBILITY != 986 #if APT_COMPATIBILITY != 986
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 macros.h   macros.h 
skipping to change at line 59 skipping to change at line 59
#define _count(a) (sizeof(a)/sizeof(a[0])) #define _count(a) (sizeof(a)/sizeof(a[0]))
// Flag Macros // Flag Macros
#define FLAG(f) (1L << (f)) #define FLAG(f) (1L << (f))
#define SETFLAG(v,f) ((v) |= FLAG(f)) #define SETFLAG(v,f) ((v) |= FLAG(f))
#define CLRFLAG(v,f) ((v) &=~FLAG(f)) #define CLRFLAG(v,f) ((v) &=~FLAG(f))
#define CHKFLAG(v,f) ((v) & FLAG(f) ? true : false) #define CHKFLAG(v,f) ((v) & FLAG(f) ? true : false)
// some nice optional GNUC features // some nice optional GNUC features
#if __GNUC__ >= 3 #if __GNUC__ >= 3
#define __must_check __attribute__ ((warn_unused_result)) #define __must_check __attribute__ ((warn_unused_result))
#define __deprecated __attribute__ ((deprecated)) #define __deprecated __attribute__ ((deprecated))
/* likely() and unlikely() can be used to mark boolean expressions #define __attrib_const __attribute__ ((__const__))
as (not) likely true which will help the compiler to optimise */ /* likely() and unlikely() can be used to mark boolean expressions
#define likely(x) __builtin_expect (!!(x), 1) as (not) likely true which will help the compiler to optimise */
#define unlikely(x) __builtin_expect (!!(x), 0) #define likely(x) __builtin_expect (!!(x), 1)
#define unlikely(x) __builtin_expect (!!(x), 0)
#else #else
#define __must_check /* no warn_unused_result */ #define __must_check /* no warn_unused_result */
#define __deprecated /* no deprecated */ #define __deprecated /* no deprecated */
#define likely(x) (x) #define __attrib_const /* no const attribute */
#define unlikely(x) (x) #define likely(x) (x)
#define unlikely(x) (x)
#endif #endif
// cold functions are unlikely() to be called // cold functions are unlikely() to be called
#if (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) || __GNUC__ > 4 #if (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) || __GNUC__ > 4
#define __cold __attribute__ ((__cold__)) #define __cold __attribute__ ((__cold__))
#define __hot __attribute__ ((__hot__))
#else #else
#define __cold /* no cold marker */ #define __cold /* no cold marker */
#define __hot /* no hot marker */
#endif #endif
#ifdef __GNUG__ #ifdef __GNUG__
// Methods have a hidden this parameter that is visible to this attribute // Methods have a hidden this parameter that is visible to this attribute
#define __like_printf_1 __attribute__ ((format (printf, 2, 3))) #define __like_printf(n) __attribute__((format(printf, n, n +
#define __like_printf_2 __attribute__ ((format (printf, 3, 4))) 1)))
#else #else
#define __like_printf_1 #define __like_printf(n) /* no like-printf */
#define __like_printf_2
#endif #endif
#endif #endif
 End of changes. 6 change blocks. 
16 lines changed or deleted 19 lines changed or added


 metaindex.h   metaindex.h 
skipping to change at line 34 skipping to change at line 34
bool Trusted; bool Trusted;
public: public:
// Various accessors // Various accessors
virtual string GetURI() const {return URI;} virtual string GetURI() const {return URI;}
virtual string GetDist() const {return Dist;} virtual string GetDist() const {return Dist;}
virtual const char* GetType() const {return Type;} virtual const char* GetType() const {return Type;}
// Interface for acquire // Interface for acquire
virtual string ArchiveURI(string /*File*/) const = 0; virtual string ArchiveURI(string const& /*File*/) const = 0;
virtual bool GetIndexes(pkgAcquire *Owner, bool GetAll=false) const = 0; virtual bool GetIndexes(pkgAcquire *Owner, bool const &GetAll=false) con
st = 0;
virtual vector<pkgIndexFile *> *GetIndexFiles() = 0; virtual vector<pkgIndexFile *> *GetIndexFiles() = 0;
virtual bool IsTrusted() const = 0; virtual bool IsTrusted() const = 0;
virtual ~metaIndex() { virtual ~metaIndex() {
if (Indexes == 0) if (Indexes == 0)
return; return;
for (vector<pkgIndexFile *>::iterator I = (*Indexes).begin(); I != (* Indexes).end(); ++I) for (vector<pkgIndexFile *>::iterator I = (*Indexes).begin(); I != (* Indexes).end(); ++I)
delete *I; delete *I;
delete Indexes; delete Indexes;
 End of changes. 1 change blocks. 
2 lines changed or deleted 3 lines changed or added


 mmap.h   mmap.h 
skipping to change at line 46 skipping to change at line 46
typedef unsigned int map_ptrloc; typedef unsigned int map_ptrloc;
class MMap class MMap
{ {
protected: protected:
unsigned long Flags; unsigned long Flags;
unsigned long iSize; unsigned long iSize;
void *Base; void *Base;
// In case mmap can not be used, we keep a dup of the file
// descriptor that should have been mmaped so that we can write to
// the file in Sync().
FileFd *SyncToFd;
bool Map(FileFd &Fd); bool Map(FileFd &Fd);
bool Close(bool DoSync = true); bool Close(bool DoSync = true);
public: public:
enum OpenFlags {NoImmMap = (1<<0),Public = (1<<1),ReadOnly = (1<<2), enum OpenFlags {NoImmMap = (1<<0),Public = (1<<1),ReadOnly = (1<<2),
UnMapped = (1<<3)}; UnMapped = (1<<3), Moveable = (1<<4), Fallback = (1 << 5 )};
// Simple accessors // Simple accessors
inline operator void *() {return Base;}; inline operator void *() {return Base;};
inline void *Data() {return Base;}; inline void *Data() {return Base;};
inline unsigned long Size() {return iSize;}; inline unsigned long Size() {return iSize;};
// File manipulators // File manipulators
bool Sync(); bool Sync();
bool Sync(unsigned long Start,unsigned long Stop); bool Sync(unsigned long Start,unsigned long Stop);
skipping to change at line 84 skipping to change at line 89
{ {
unsigned long ItemSize; unsigned long ItemSize;
unsigned long Start; unsigned long Start;
unsigned long Count; unsigned long Count;
}; };
protected: protected:
FileFd *Fd; FileFd *Fd;
unsigned long WorkSpace; unsigned long WorkSpace;
unsigned long const GrowFactor;
unsigned long const Limit;
Pool *Pools; Pool *Pools;
unsigned int PoolCount; unsigned int PoolCount;
bool Grow(); bool Grow();
public: public:
// Allocation // Allocation
unsigned long RawAllocate(unsigned long Size,unsigned long Aln = 0); unsigned long RawAllocate(unsigned long Size,unsigned long Aln = 0);
unsigned long Allocate(unsigned long ItemSize); unsigned long Allocate(unsigned long ItemSize);
unsigned long WriteString(const char *String,unsigned long Len = (unsign ed long)-1); unsigned long WriteString(const char *String,unsigned long Len = (unsign ed long)-1);
inline unsigned long WriteString(const string &S) {return WriteString(S. c_str(),S.length());}; inline unsigned long WriteString(const string &S) {return WriteString(S. c_str(),S.length());};
void UsePools(Pool &P,unsigned int Count) {Pools = &P; PoolCount = Count ;}; void UsePools(Pool &P,unsigned int Count) {Pools = &P; PoolCount = Count ;};
DynamicMMap(FileFd &F,unsigned long Flags,unsigned long WorkSpace = 2*10 DynamicMMap(FileFd &F,unsigned long Flags,unsigned long const &WorkSpace
24*1024); = 2*1024*1024,
DynamicMMap(unsigned long Flags,unsigned long WorkSpace = 2*1024*1024); unsigned long const &Grow = 1024*1024, unsigned long const &L
imit = 0);
DynamicMMap(unsigned long Flags,unsigned long const &WorkSpace = 2*1024*
1024,
unsigned long const &Grow = 1024*1024, unsigned long const &L
imit = 0);
virtual ~DynamicMMap(); virtual ~DynamicMMap();
}; };
#endif #endif
 End of changes. 4 change blocks. 
4 lines changed or deleted 16 lines changed or added


 packagemanager.h   packagemanager.h 
skipping to change at line 30 skipping to change at line 30
##################################################################### */ ##################################################################### */
/*}} }*/ /*}} }*/
#ifndef PKGLIB_PACKAGEMANAGER_H #ifndef PKGLIB_PACKAGEMANAGER_H
#define PKGLIB_PACKAGEMANAGER_H #define PKGLIB_PACKAGEMANAGER_H
#include <string> #include <string>
#include <iostream> #include <iostream>
#include <apt-pkg/pkgcache.h> #include <apt-pkg/pkgcache.h>
#include <apt-pkg/depcache.h> #include <apt-pkg/depcache.h>
#include <set>
using std::string; using std::string;
class pkgAcquire; class pkgAcquire;
class pkgDepCache; class pkgDepCache;
class pkgSourceList; class pkgSourceList;
class pkgOrderList; class pkgOrderList;
class pkgRecords; class pkgRecords;
class pkgPackageManager : protected pkgCache::Namespace class pkgPackageManager : protected pkgCache::Namespace
{ {
public: public:
enum OrderResult {Completed,Failed,Incomplete}; enum OrderResult {Completed,Failed,Incomplete};
protected: protected:
string *FileNames; string *FileNames;
pkgDepCache &Cache; pkgDepCache &Cache;
pkgOrderList *List; pkgOrderList *List;
bool Debug; bool Debug;
/** \brief saves packages dpkg let disappear
This way APT can retreat from trying to configure these
packages later on and a frontend can choose to display a
notice to inform the user about these disappears.
*/
std::set<std::string> disappearedPkgs;
bool DepAdd(pkgOrderList &Order,PkgIterator P,int Depth = 0); bool DepAdd(pkgOrderList &Order,PkgIterator P,int Depth = 0);
void ImmediateAdd(PkgIterator P, bool UseInstallVer, unsigned const int &Depth = 0); void ImmediateAdd(PkgIterator P, bool UseInstallVer, unsigned const int &Depth = 0);
virtual OrderResult OrderInstall(); virtual OrderResult OrderInstall();
bool CheckRConflicts(PkgIterator Pkg,DepIterator Dep,const char *Ver); bool CheckRConflicts(PkgIterator Pkg,DepIterator Dep,const char *Ver);
bool CreateOrderList(); bool CreateOrderList();
// Analysis helpers // Analysis helpers
bool DepAlwaysTrue(DepIterator D); bool DepAlwaysTrue(DepIterator D);
// Install helpers // Install helpers
skipping to change at line 96 skipping to change at line 105
// uses apt // uses apt
OrderResult DoInstallPreFork() { OrderResult DoInstallPreFork() {
Res = OrderInstall(); Res = OrderInstall();
return Res; return Res;
}; };
// stuff that needs to be done after the fork // stuff that needs to be done after the fork
OrderResult DoInstallPostFork(int statusFd=-1); OrderResult DoInstallPostFork(int statusFd=-1);
bool FixMissing(); bool FixMissing();
/** \brief returns all packages dpkg let disappear */
inline std::set<std::string> GetDisappearedPackages() { return disappear
edPkgs; };
pkgPackageManager(pkgDepCache *Cache); pkgPackageManager(pkgDepCache *Cache);
virtual ~pkgPackageManager(); virtual ~pkgPackageManager();
}; };
#endif #endif
 End of changes. 3 change blocks. 
0 lines changed or deleted 13 lines changed or added


 pkgcache.h   pkgcache.h 
// -*- mode: cpp; mode: fold -*- // -*- mode: cpp; mode: fold -*-
// Description /*{{ {*/ // Description /*{{ {*/
// $Id: pkgcache.h,v 1.25 2001/07/01 22:28:24 jgg Exp $ /**\file pkgcache.h
/* ###################################################################### \brief pkgCache - Structure definitions for the cache file
Cache - Structure definitions for the cache file The goal of the cache file is two fold:
Firstly to speed loading and processing of the package file array and
secondly to reduce memory consumption of the package file array.
Please see doc/apt-pkg/cache.sgml for a more detailed description of The implementation is aimed at an environment with many primary package
this format. Also be sure to keep that file up-to-date!! files, for instance someone that has a Package file for their CD-ROM, a
Package file for the latest version of the distribution on the CD-ROM an
d a
package file for the development version. Always present is the informat
ion
contained in the status file which might be considered a separate packag
e
file.
Please understand, this is designed as a <b>Cache file</b> it is not mea
nt to be
used on any system other than the one it was created for. It is not mean
t to
be authoritative either, i.e. if a system crash or software failure occu
rs it
must be perfectly acceptable for the cache file to be in an inconsistent
state. Furthermore at any time the cache file may be erased without losi
ng
any information.
Also the structures and storage layout is optimized for use by the APT
and may not be suitable for all purposes. However it should be possible
to extend it with associate cache files that contain other information.
To keep memory use down the cache file only contains often used fields a
nd
fields that are inexpensive to store, the Package file has a full list o
f
fields. Also the client may assume that all items are perfectly valid an
d
need not perform checks against their correctness. Removal of informatio
n
from the cache is possible, but blanks will be left in the file, and
unused strings will also be present. The recommended implementation is t
o
simply rebuild the cache each time any of the data files change. It is
possible to add a new package file to the cache without any negative sid
e
effects.
<b>Note on Pointer access</b>
Clients should always use the CacheIterators classes for access to the Clients should always use the CacheIterators classes for access to the
cache. They provide a simple STL-like method for traversing the links cache and the data in it. They also provide a simple STL-like method for
of the datastructure. traversing the links of the datastructure.
See pkgcachegen.h for information about generating cache structures. Every item in every structure is stored as the index to that structure.
What this means is that once the files is mmaped every data access has t
o
go through a fix up stage to get a real memory pointer. This is done
by taking the index, multiplying it by the type size and then adding
it to the start address of the memory block. This sounds complex, but
in C it is a single array dereference. Because all items are aligned to
their size and indexes are stored as multiples of the size of the struct
ure
the format is immediately portable to all possible architectures - BUT t
he
generated files are -NOT-.
##################################################################### */ This scheme allows code like this to be written:
<example>
void *Map = mmap(...);
Package *PkgList = (Package *)Map;
Header *Head = (Header *)Map;
char *Strings = (char *)Map;
cout << (Strings + PkgList[Head->HashTable[0]]->Name) << endl;
</example>
Notice the lack of casting or multiplication. The net result is to retur
n
the name of the first package in the first hash bucket, without error
checks.
The generator uses allocation pools to group similarly sized structures
in
large blocks to eliminate any alignment overhead. The generator also
assures that no structures overlap and all indexes are unique. Although
at first glance it may seem like there is the potential for two structur
es
to exist at the same point the generator never allows this to happen.
(See the discussion of free space pools)
See \ref pkgcachegen.h for more information about generating cache struc
tures. */
/*}} }*/ /*}} }*/
#ifndef PKGLIB_PKGCACHE_H #ifndef PKGLIB_PKGCACHE_H
#define PKGLIB_PKGCACHE_H #define PKGLIB_PKGCACHE_H
#include <string> #include <string>
#include <time.h> #include <time.h>
#include <apt-pkg/mmap.h> #include <apt-pkg/mmap.h>
using std::string; using std::string;
class pkgVersioningSystem; class pkgVersioningSystem;
class pkgCache /*{{ {*/ class pkgCache /*{{ {*/
{ {
public: public:
// Cache element predeclarations // Cache element predeclarations
struct Header; struct Header;
struct Group;
struct Package; struct Package;
struct PackageFile; struct PackageFile;
struct Version; struct Version;
struct Description; struct Description;
struct Provides; struct Provides;
struct Dependency; struct Dependency;
struct StringItem; struct StringItem;
struct VerFile; struct VerFile;
struct DescFile; struct DescFile;
// Iterators // Iterators
template<typename Str, typename Itr> class Iterator;
class GrpIterator;
class PkgIterator; class PkgIterator;
class VerIterator; class VerIterator;
class DescIterator; class DescIterator;
class DepIterator; class DepIterator;
class PrvIterator; class PrvIterator;
class PkgFileIterator; class PkgFileIterator;
class VerFileIterator; class VerFileIterator;
class DescFileIterator; class DescFileIterator;
friend class PkgIterator;
friend class VerIterator;
friend class DescInterator;
friend class DepIterator;
friend class PrvIterator;
friend class PkgFileIterator;
friend class VerFileIterator;
friend class DescFileIterator;
class Namespace; class Namespace;
// These are all the constants used in the cache structures // These are all the constants used in the cache structures
// WARNING - if you change these lists you must also edit // WARNING - if you change these lists you must also edit
// the stringification in pkgcache.cc and also consider whether // the stringification in pkgcache.cc and also consider whether
// the cache file will become incompatible. // the cache file will become incompatible.
struct Dep struct Dep
{ {
enum DepType {Depends=1,PreDepends=2,Suggests=3,Recommends=4, enum DepType {Depends=1,PreDepends=2,Suggests=3,Recommends=4,
Conflicts=5,Replaces=6,Obsoletes=7,DpkgBreaks=8,Enhances=9}; Conflicts=5,Replaces=6,Obsoletes=7,DpkgBreaks=8,Enhances=9};
/** \brief available compare operators
The lower 4 bits are used to indicate what operator is being spec
ified and
the upper 4 bits are flags. OR indicates that the next package is
or'd with the current package. */
enum DepCompareOp {Or=0x10,NoOp=0,LessEq=0x1,GreaterEq=0x2,Less=0x3, enum DepCompareOp {Or=0x10,NoOp=0,LessEq=0x1,GreaterEq=0x2,Less=0x3,
Greater=0x4,Equals=0x5,NotEquals=0x6}; Greater=0x4,Equals=0x5,NotEquals=0x6};
}; };
struct State struct State
{ {
/** \brief priority of a package version
Zero is used for unparsable or absent Priority fields. */
enum VerPriority {Important=1,Required=2,Standard=3,Optional=4,Extra= 5}; enum VerPriority {Important=1,Required=2,Standard=3,Optional=4,Extra= 5};
enum PkgSelectedState {Unknown=0,Install=1,Hold=2,DeInstall=3,Purge=4 }; enum PkgSelectedState {Unknown=0,Install=1,Hold=2,DeInstall=3,Purge=4 };
enum PkgInstState {Ok=0,ReInstReq=1,HoldInst=2,HoldReInstReq=3}; enum PkgInstState {Ok=0,ReInstReq=1,HoldInst=2,HoldReInstReq=3};
enum PkgCurrentState {NotInstalled=0,UnPacked=1,HalfConfigured=2, enum PkgCurrentState {NotInstalled=0,UnPacked=1,HalfConfigured=2,
HalfInstalled=4,ConfigFiles=5,Installed=6, HalfInstalled=4,ConfigFiles=5,Installed=6,
TriggersAwaited=7,TriggersPending=8}; TriggersAwaited=7,TriggersPending=8};
}; };
struct Flag struct Flag
{ {
skipping to change at line 106 skipping to change at line 164
string CacheFile; string CacheFile;
MMap &Map; MMap &Map;
unsigned long sHash(const string &S) const; unsigned long sHash(const string &S) const;
unsigned long sHash(const char *S) const; unsigned long sHash(const char *S) const;
public: public:
// Pointers to the arrays of items // Pointers to the arrays of items
Header *HeaderP; Header *HeaderP;
Group *GrpP;
Package *PkgP; Package *PkgP;
VerFile *VerFileP; VerFile *VerFileP;
DescFile *DescFileP; DescFile *DescFileP;
PackageFile *PkgFileP; PackageFile *PkgFileP;
Version *VerP; Version *VerP;
Description *DescP; Description *DescP;
Provides *ProvideP; Provides *ProvideP;
Dependency *DepP; Dependency *DepP;
StringItem *StringItemP; StringItem *StringItemP;
char *StrP; char *StrP;
virtual bool ReMap(); virtual bool ReMap(bool const &Errorchecks = true);
inline bool Sync() {return Map.Sync();}; inline bool Sync() {return Map.Sync();};
inline MMap &GetMap() {return Map;}; inline MMap &GetMap() {return Map;};
inline void *DataEnd() {return ((unsigned char *)Map.Data()) + Map.Size( );}; inline void *DataEnd() {return ((unsigned char *)Map.Data()) + Map.Size( );};
// String hashing function (512 range) // String hashing function (512 range)
inline unsigned long Hash(const string &S) const {return sHash(S);}; inline unsigned long Hash(const string &S) const {return sHash(S);};
inline unsigned long Hash(const char *S) const {return sHash(S);}; inline unsigned long Hash(const char *S) const {return sHash(S);};
// Usefull transformation things // Useful transformation things
const char *Priority(unsigned char Priority); const char *Priority(unsigned char Priority);
// Accessors // Accessors
GrpIterator FindGrp(const string &Name);
PkgIterator FindPkg(const string &Name); PkgIterator FindPkg(const string &Name);
PkgIterator FindPkg(const string &Name, const string &Arch);
Header &Head() {return *HeaderP;}; Header &Head() {return *HeaderP;};
inline GrpIterator GrpBegin();
inline GrpIterator GrpEnd();
inline PkgIterator PkgBegin(); inline PkgIterator PkgBegin();
inline PkgIterator PkgEnd(); inline PkgIterator PkgEnd();
inline PkgFileIterator FileBegin(); inline PkgFileIterator FileBegin();
inline PkgFileIterator FileEnd(); inline PkgFileIterator FileEnd();
inline bool MultiArchCache() const { return MultiArchEnabled; };
// Make me a function // Make me a function
pkgVersioningSystem *VS; pkgVersioningSystem *VS;
// Converters // Converters
static const char *CompTypeDeb(unsigned char Comp); static const char *CompTypeDeb(unsigned char Comp);
static const char *CompType(unsigned char Comp); static const char *CompType(unsigned char Comp);
static const char *DepType(unsigned char Dep); static const char *DepType(unsigned char Dep);
pkgCache(MMap *Map,bool DoMap = true); pkgCache(MMap *Map,bool DoMap = true);
virtual ~pkgCache() {}; virtual ~pkgCache() {};
private:
bool MultiArchEnabled;
PkgIterator SingleArchFindPkg(const string &Name);
}; };
/*}} }*/ /*}} }*/
// Header structure /*{{ {*/ // Header structure /*{{ {*/
struct pkgCache::Header struct pkgCache::Header
{ {
// Signature information /** \brief Signature information
This must contain the hex value 0x98FE76DC which is designed to
verify that the system loading the image has the same byte order
and byte size as the system saving the image */
unsigned long Signature; unsigned long Signature;
/** These contain the version of the cache file */
short MajorVersion; short MajorVersion;
short MinorVersion; short MinorVersion;
/** \brief indicates if the cache should be erased
Dirty is true if the cache file was opened for reading, the client
expects to have written things to it and have not fully synced it.
The file should be erased and rebuilt if it is true. */
bool Dirty; bool Dirty;
// Size of structure values /** \brief Size of structure values
All *Sz variables contains the sizeof() that particular structure.
It is used as an extra consistency check on the structure of the fil
e.
If any of the size values do not exactly match what the client expec
ts
then the client should refuse the load the file. */
unsigned short HeaderSz; unsigned short HeaderSz;
unsigned short GroupSz;
unsigned short PackageSz; unsigned short PackageSz;
unsigned short PackageFileSz; unsigned short PackageFileSz;
unsigned short VersionSz; unsigned short VersionSz;
unsigned short DescriptionSz; unsigned short DescriptionSz;
unsigned short DependencySz; unsigned short DependencySz;
unsigned short ProvidesSz; unsigned short ProvidesSz;
unsigned short VerFileSz; unsigned short VerFileSz;
unsigned short DescFileSz; unsigned short DescFileSz;
// Structure counts /** \brief Structure counts
These indicate the number of each structure contained in the cache.
PackageCount is especially useful for generating user state structur
es.
See Package::Id for more info. */
unsigned long GroupCount;
unsigned long PackageCount; unsigned long PackageCount;
unsigned long VersionCount; unsigned long VersionCount;
unsigned long DescriptionCount; unsigned long DescriptionCount;
unsigned long DependsCount; unsigned long DependsCount;
unsigned long PackageFileCount; unsigned long PackageFileCount;
unsigned long VerFileCount; unsigned long VerFileCount;
unsigned long DescFileCount; unsigned long DescFileCount;
unsigned long ProvidesCount; unsigned long ProvidesCount;
// Offsets /** \brief index of the first PackageFile structure
map_ptrloc FileList; // struct PackageFile
map_ptrloc StringList; // struct StringItem The PackageFile structures are singly linked lists that represent
map_ptrloc VerSysName; // StringTable all package files that have been merged into the cache. */
map_ptrloc Architecture; // StringTable map_ptrloc FileList;
/** \brief index of the first StringItem structure
The cache contains a list of all the unique strings (StringItems).
The parser reads this list into memory so it can match strings
against it.*/
map_ptrloc StringList;
/** \brief String representing the version system used */
map_ptrloc VerSysName;
/** \brief Architecture(s) the cache was built against */
map_ptrloc Architecture;
/** \brief The maximum size of a raw entry from the original Package fil
e */
unsigned long MaxVerFileSize; unsigned long MaxVerFileSize;
/** \brief The maximum size of a raw entry from the original Translation file */
unsigned long MaxDescFileSize; unsigned long MaxDescFileSize;
/* Allocation pools, there should be one of these for each structure /** \brief The Pool structures manage the allocation pools that the gene
excluding the header */ rator uses
DynamicMMap::Pool Pools[8];
// Rapid package name lookup Start indicates the first byte of the pool, Count is the number of o
map_ptrloc HashTable[2*1048]; bjects
remaining in the pool and ItemSize is the structure size (alignment
factor)
of the pool. An ItemSize of 0 indicates the pool is empty. There sho
uld be
the same number of pools as there are structure types. The generator
stores this information so future additions can make use of any unus
ed pool
blocks. */
DynamicMMap::Pool Pools[9];
/** \brief hash tables providing rapid group/package name lookup
Each group/package name is inserted into the hash table using pkgCac
he::Hash(const &string)
By iterating over each entry in the hash table it is possible to ite
rate over
the entire list of packages. Hash Collisions are handled with a sing
ly linked
list of packages based at the hash item. The linked list contains on
ly
packages that match the hashing function.
In the PkgHashTable is it possible that multiple packages have the s
ame name -
these packages are stored as a sequence in the list.
Beware: The Hashmethod assumes that the hash table sizes are equal *
/
map_ptrloc PkgHashTable[2*1048];
map_ptrloc GrpHashTable[2*1048];
bool CheckSizes(Header &Against) const; bool CheckSizes(Header &Against) const;
Header(); Header();
}; };
/*}} }*/ /*}} }*/
struct pkgCache::Package /*{{ // Group structure /*{{
{*/ {*/
/** \brief groups architecture depending packages together
On or more packages with the same name form a group, so we have
a simple way to access a package built for different architectures
Group exists in a singly linked list of group records starting at
the hash index of the name in the pkgCache::Header::GrpHashTable */
struct pkgCache::Group
{ {
// Pointers /** \brief Name of the group */
map_ptrloc Name; // Stringtable map_ptrloc Name; // StringItem
// Linked List
/** \brief Link to the first package which belongs to the group */
map_ptrloc FirstPackage; // Package
/** \brief Link to the last package which belongs to the group */
map_ptrloc LastPackage; // Package
/** \brief Link to the next Group */
map_ptrloc Next; // Group
/** \brief unique sequel ID */
unsigned int ID;
};
/*}}
}*/
// Package structure /*{{
{*/
/** \brief contains information for a single unique package
There can be any number of versions of a given package.
Package exists in a singly linked list of package records starting at
the hash index of the name in the pkgCache::Header::PkgHashTable
A package can be created for every architecture so package names are
not unique, but it is garanteed that packages with the same name
are sequencel ordered in the list. Packages with the same name can be
accessed with the Group.
*/
struct pkgCache::Package
{
/** \brief Name of the package */
map_ptrloc Name; // StringItem
/** \brief Architecture of the package */
map_ptrloc Arch; // StringItem
/** \brief Base of a singly linked list of versions
Each structure represents a unique version of the package.
The version structures contain links into PackageFile and the
original text file as well as detailed information about the size
and dependencies of the specific package. In this way multiple
versions of a package can be cleanly handled by the system.
Furthermore, this linked list is guaranteed to be sorted
from Highest version to lowest version with no duplicate entries. */
map_ptrloc VersionList; // Version map_ptrloc VersionList; // Version
/** \brief index to the installed version */
map_ptrloc CurrentVer; // Version map_ptrloc CurrentVer; // Version
map_ptrloc Section; // StringTable (StringItem) /** \brief indicates the deduced section
Should be the index to the string "Unknown" or to the section
of the last parsed item. */
map_ptrloc Section; // StringItem
/** \brief index of the group this package belongs to */
map_ptrloc Group; // Group the Package belongs to
// Linked list // Linked list
/** \brief Link to the next package in the same bucket */
map_ptrloc NextPackage; // Package map_ptrloc NextPackage; // Package
/** \brief List of all dependencies on this package */
map_ptrloc RevDepends; // Dependency map_ptrloc RevDepends; // Dependency
/** \brief List of all "packages" this package provide */
map_ptrloc ProvidesList; // Provides map_ptrloc ProvidesList; // Provides
// Install/Remove/Purge etc // Install/Remove/Purge etc
/** \brief state that the user wishes the package to be in */
unsigned char SelectedState; // What unsigned char SelectedState; // What
/** \brief installation state of the package
This should be "ok" but in case the installation failed
it will be different.
*/
unsigned char InstState; // Flags unsigned char InstState; // Flags
/** \brief indicates if the package is installed */
unsigned char CurrentState; // State unsigned char CurrentState; // State
/** \brief unique sequel ID
ID is a unique value from 0 to Header->PackageCount assigned by the
generator.
This allows clients to create an array of size PackageCount and use
it to store
state information for the package map. For instance the status file
emitter uses
this to track which packages have been emitted already. */
unsigned int ID; unsigned int ID;
/** \brief some useful indicators of the package's state */
unsigned long Flags; unsigned long Flags;
}; };
/*}} }*/ /*}} }*/
struct pkgCache::PackageFile /*{{ // Package File structure /*{{
{*/ {*/
/** \brief stores information about the files used to generate the cache
Package files are referenced by Version structures to be able to know
after the generation still from which Packages file includes this Versi
on
as we need this information later on e.g. for pinning. */
struct pkgCache::PackageFile
{ {
// Names /** \brief physical disk file that this PackageFile represents */
map_ptrloc FileName; // Stringtable map_ptrloc FileName; // StringItem
map_ptrloc Archive; // Stringtable /** \brief the release information
map_ptrloc Codename; // Stringtable
map_ptrloc Component; // Stringtable Please see the files document for a description of what the
map_ptrloc Version; // Stringtable release information means. */
map_ptrloc Origin; // Stringtable map_ptrloc Archive; // StringItem
map_ptrloc Label; // Stringtable map_ptrloc Codename; // StringItem
map_ptrloc Architecture; // Stringtable map_ptrloc Component; // StringItem
map_ptrloc Site; // Stringtable map_ptrloc Version; // StringItem
map_ptrloc IndexType; // Stringtable map_ptrloc Origin; // StringItem
map_ptrloc Label; // StringItem
map_ptrloc Architecture; // StringItem
/** \brief The site the index file was fetched from */
map_ptrloc Site; // StringItem
/** \brief indicates what sort of index file this is
@TODO enumerate at least the possible indexes */
map_ptrloc IndexType; // StringItem
/** \brief Size of the file
Used together with the modification time as a
simple check to ensure that the Packages
file has not been altered since Cache generation. */
unsigned long Size; unsigned long Size;
/** \brief Modification time for the file */
time_t mtime;
/* @TODO document PackageFile::Flags */
unsigned long Flags; unsigned long Flags;
// Linked list // Linked list
/** \brief Link to the next PackageFile in the Cache */
map_ptrloc NextFile; // PackageFile map_ptrloc NextFile; // PackageFile
/** \brief unique sequel ID */
unsigned int ID; unsigned int ID;
time_t mtime; // Modification time for the file
}; };
/*}} }*/ /*}} }*/
struct pkgCache::VerFile /*{{ // VerFile structure /*{{
{*/ {*/
/** \brief associates a version with a PackageFile
This allows a full description of all Versions in all files
(and hence all sources) under consideration. */
struct pkgCache::VerFile
{ {
/** \brief index of the package file that this version was found in */
map_ptrloc File; // PackageFile map_ptrloc File; // PackageFile
/** \brief next step in the linked list */
map_ptrloc NextFile; // PkgVerFile map_ptrloc NextFile; // PkgVerFile
/** \brief position in the package file */
map_ptrloc Offset; // File offset map_ptrloc Offset; // File offset
unsigned short Size; /* @TODO document pkgCache::VerFile::Size */
unsigned long Size;
}; };
/*}} }*/ /*}} }*/
struct pkgCache::DescFile /*{{ // DescFile structure /*{{
{*/ {*/
/** \brief associates a description with a Translation file */
struct pkgCache::DescFile
{ {
/** \brief index of the file that this description was found in */
map_ptrloc File; // PackageFile map_ptrloc File; // PackageFile
/** \brief next step in the linked list */
map_ptrloc NextFile; // PkgVerFile map_ptrloc NextFile; // PkgVerFile
/** \brief position in the file */
map_ptrloc Offset; // File offset map_ptrloc Offset; // File offset
unsigned short Size; /* @TODO document pkgCache::DescFile::Size */
unsigned long Size;
}; };
/*}} }*/ /*}} }*/
struct pkgCache::Version /*{{ // Version structure /*{{
{*/ {*/
/** \brief information for a single version of a package
The version list is always sorted from highest version to lowest
version by the generator. Equal version numbers are either merged
or handled as separate versions based on the Hash value. */
struct pkgCache::Version
{ {
map_ptrloc VerStr; // Stringtable /** \brief complete version string */
map_ptrloc Section; // StringTable (StringItem) map_ptrloc VerStr; // StringItem
map_ptrloc Arch; // StringTable /** \brief section this version is filled in */
map_ptrloc Section; // StringItem
/** \brief stores the MultiArch capabilities of this version
// Lists None is the default and doesn't trigger special behaviour,
Foreign means that this version can fulfill dependencies even
if it is built for another architecture as the requester.
Same indicates that builds for different architectures can
be co-installed on the system and All is the marker for a
version with the Architecture: all. */
enum {None, All, Foreign, Same, Allowed} MultiArch;
/** \brief references all the PackageFile's that this version came from
FileList can be used to determine what distribution(s) the Version
applies to. If FileList is 0 then this is a blank version.
The structure should also have a 0 in all other fields excluding
pkgCache::Version::VerStr and Possibly pkgCache::Version::NextVer. *
/
map_ptrloc FileList; // VerFile map_ptrloc FileList; // VerFile
/** \brief next (lower or equal) version in the linked list */
map_ptrloc NextVer; // Version map_ptrloc NextVer; // Version
/** \brief next description in the linked list */
map_ptrloc DescriptionList; // Description map_ptrloc DescriptionList; // Description
/** \brief base of the dependency list */
map_ptrloc DependsList; // Dependency map_ptrloc DependsList; // Dependency
/** \brief links to the owning package
This allows reverse dependencies to determine the package */
map_ptrloc ParentPkg; // Package map_ptrloc ParentPkg; // Package
/** \brief list of pkgCache::Provides */
map_ptrloc ProvidesList; // Provides map_ptrloc ProvidesList; // Provides
map_ptrloc Size; // These are the .deb size /** \brief archive size for this version
map_ptrloc InstalledSize;
For Debian this is the size of the .deb file. */
unsigned long long Size; // These are the .deb size
/** \brief uncompressed size for this version */
unsigned long long InstalledSize;
/** \brief characteristic value representing this version
No two packages in existence should have the same VerStr
and Hash with different contents. */
unsigned short Hash; unsigned short Hash;
/** \brief unique sequel ID */
unsigned int ID; unsigned int ID;
/** \brief parsed priority value */
unsigned char Priority; unsigned char Priority;
}; };
/*}} }*/ /*}} }*/
struct pkgCache::Description /*{{ // Description structure /*{{
{*/ {*/
/** \brief datamember of a linked list of available description for a versi
on */
struct pkgCache::Description
{ {
// Language Code store the description translation language code. If /** \brief Language code of this description (translation)
// the value has a 0 lenght then this is readed using the Package
// file else the Translation-CODE are used.
map_ptrloc language_code; // StringTable
map_ptrloc md5sum; // StringTable
// Linked list If the value has a 0 length then this is read using the Package
file else the Translation-CODE file is used. */
map_ptrloc language_code; // StringItem
/** \brief MD5sum of the original description
Used to map Translations of a description to a version
and to check that the Translation is up-to-date. */
map_ptrloc md5sum; // StringItem
/* @TODO document pkgCache::Description::FileList */
map_ptrloc FileList; // DescFile map_ptrloc FileList; // DescFile
/** \brief next translation for this description */
map_ptrloc NextDesc; // Description map_ptrloc NextDesc; // Description
/** \brief the text is a description of this package */
map_ptrloc ParentPkg; // Package map_ptrloc ParentPkg; // Package
/** \brief unique sequel ID */
unsigned int ID; unsigned int ID;
}; };
/*}} }*/ /*}} }*/
struct pkgCache::Dependency /*{{ // Dependency structure
{*/ /*{{{*/
/** \brief information for a single dependency record
The records are split up like this to ease processing by the client.
The base of the linked list is pkgCache::Version::DependsList.
All forms of dependencies are recorded here including Depends,
Recommends, Suggests, Enhances, Conflicts, Replaces and Breaks. */
struct pkgCache::Dependency
{ {
map_ptrloc Version; // Stringtable /** \brief string of the version the dependency is applied against */
map_ptrloc Version; // StringItem
/** \brief index of the package this depends applies to
The generator will - if the package does not already exist -
create a blank (no version records) package. */
map_ptrloc Package; // Package map_ptrloc Package; // Package
/** \brief next dependency of this version */
map_ptrloc NextDepends; // Dependency map_ptrloc NextDepends; // Dependency
/** \brief next reverse dependency of this package */
map_ptrloc NextRevDepends; // Dependency map_ptrloc NextRevDepends; // Dependency
/** \brief version of the package which has the reverse depends */
map_ptrloc ParentVer; // Version map_ptrloc ParentVer; // Version
// Specific types of depends /** \brief unique sequel ID */
map_ptrloc ID; map_ptrloc ID;
/** \brief Dependency type - Depends, Recommends, Conflicts, etc */
unsigned char Type; unsigned char Type;
/** \brief comparison operator specified on the depends line
If the high bit is set then it is a logical OR with the previous rec
ord. */
unsigned char CompareOp; unsigned char CompareOp;
}; };
/*}} }*/ /*}} }*/
struct pkgCache::Provides /*{{ // Provides structure /*{{
{*/ {*/
/** \brief handles virtual packages
When a Provides: line is encountered a new provides record is added
associating the package with a virtual package name.
The provides structures are linked off the package structures.
This simplifies the analysis of dependencies and other aspects A provid
es
refers to a specific version of a specific package, not all versions ne
ed to
provide that provides.*/
struct pkgCache::Provides
{ {
map_ptrloc ParentPkg; // Pacakge /** \brief index of the package providing this */
map_ptrloc ParentPkg; // Package
/** \brief index of the version this provide line applies to */
map_ptrloc Version; // Version map_ptrloc Version; // Version
map_ptrloc ProvideVersion; // Stringtable /** \brief version in the provides line (if any)
This version allows dependencies to depend on specific versions of a
Provides, as well as allowing Provides to override existing packages
.
This is experimental. Note that Debian doesn't allow versioned provi
des */
map_ptrloc ProvideVersion; // StringItem
/** \brief next provides (based of package) */
map_ptrloc NextProvides; // Provides map_ptrloc NextProvides; // Provides
/** \brief next provides (based of version) */
map_ptrloc NextPkgProv; // Provides map_ptrloc NextPkgProv; // Provides
}; };
/*}} }*/ /*}} }*/
struct pkgCache::StringItem /*{{ // StringItem structure
{*/ /*{{{*/
/** \brief used for generating single instances of strings
Some things like Section Name are are useful to have as unique tags.
It is part of a linked list based at pkgCache::Header::StringList
All strings are simply inlined any place in the file that is natural
for the writer. The client should make no assumptions about the positio
ning
of strings. All StringItems should be null-terminated. */
struct pkgCache::StringItem
{ {
map_ptrloc String; // Stringtable /** \brief string this refers to */
map_ptrloc String; // StringItem
/** \brief Next link in the chain */
map_ptrloc NextItem; // StringItem map_ptrloc NextItem; // StringItem
}; };
/*}} }*/ /*}} }*/
#include <apt-pkg/cacheiterators.h> #include <apt-pkg/cacheiterators.h>
inline pkgCache::GrpIterator pkgCache::GrpBegin()
{return GrpIterator(*this);};
inline pkgCache::GrpIterator pkgCache::GrpEnd()
{return GrpIterator(*this,GrpP);};
inline pkgCache::PkgIterator pkgCache::PkgBegin() inline pkgCache::PkgIterator pkgCache::PkgBegin()
{return PkgIterator(*this);}; {return PkgIterator(*this);};
inline pkgCache::PkgIterator pkgCache::PkgEnd() inline pkgCache::PkgIterator pkgCache::PkgEnd()
{return PkgIterator(*this,PkgP);}; {return PkgIterator(*this,PkgP);};
inline pkgCache::PkgFileIterator pkgCache::FileBegin() inline pkgCache::PkgFileIterator pkgCache::FileBegin()
{return PkgFileIterator(*this,PkgFileP + HeaderP->FileList);}; {return PkgFileIterator(*this,PkgFileP + HeaderP->FileList);};
inline pkgCache::PkgFileIterator pkgCache::FileEnd() inline pkgCache::PkgFileIterator pkgCache::FileEnd()
{return PkgFileIterator(*this,PkgFileP);}; {return PkgFileIterator(*this,PkgFileP);};
// Oh I wish for Real Name Space Support // Oh I wish for Real Name Space Support
class pkgCache::Namespace /*{{ {*/ class pkgCache::Namespace /*{{ {*/
{ {
public: public:
typedef pkgCache::GrpIterator GrpIterator;
typedef pkgCache::PkgIterator PkgIterator; typedef pkgCache::PkgIterator PkgIterator;
typedef pkgCache::VerIterator VerIterator; typedef pkgCache::VerIterator VerIterator;
typedef pkgCache::DescIterator DescIterator; typedef pkgCache::DescIterator DescIterator;
typedef pkgCache::DepIterator DepIterator; typedef pkgCache::DepIterator DepIterator;
typedef pkgCache::PrvIterator PrvIterator; typedef pkgCache::PrvIterator PrvIterator;
typedef pkgCache::PkgFileIterator PkgFileIterator; typedef pkgCache::PkgFileIterator PkgFileIterator;
typedef pkgCache::VerFileIterator VerFileIterator; typedef pkgCache::VerFileIterator VerFileIterator;
typedef pkgCache::Version Version; typedef pkgCache::Version Version;
typedef pkgCache::Description Description; typedef pkgCache::Description Description;
typedef pkgCache::Package Package; typedef pkgCache::Package Package;
 End of changes. 91 change blocks. 
85 lines changed or deleted 466 lines changed or added


 pkgcachegen.h   pkgcachegen.h 
skipping to change at line 25 skipping to change at line 25
their contents their contents
##################################################################### */ ##################################################################### */
/*}} }*/ /*}} }*/
#ifndef PKGLIB_PKGCACHEGEN_H #ifndef PKGLIB_PKGCACHEGEN_H
#define PKGLIB_PKGCACHEGEN_H #define PKGLIB_PKGCACHEGEN_H
#include <apt-pkg/pkgcache.h> #include <apt-pkg/pkgcache.h>
#include <apt-pkg/md5.h> #include <apt-pkg/md5.h>
#include <vector>
class pkgSourceList; class pkgSourceList;
class OpProgress; class OpProgress;
class MMap; class MMap;
class pkgIndexFile; class pkgIndexFile;
class pkgCacheGenerator /*{{{*/ class pkgCacheGenerator /*{{{*/
{ {
private: private:
pkgCache::StringItem *UniqHash[26]; pkgCache::StringItem *UniqHash[26];
map_ptrloc WriteStringInMap(std::string const &String) { return WriteStr
ingInMap(String.c_str()); };
map_ptrloc WriteStringInMap(const char *String);
map_ptrloc WriteStringInMap(const char *String, const unsigned long &Len
);
map_ptrloc AllocateInMap(const unsigned long &size);
public: public:
class ListParser; class ListParser;
friend class ListParser; friend class ListParser;
template<typename Iter> class Dynamic {
public:
static std::vector<Iter*> toReMap;
Dynamic(Iter &I) {
toReMap.push_back(&I);
}
~Dynamic() {
toReMap.pop_back();
}
};
protected: protected:
DynamicMMap &Map; DynamicMMap &Map;
pkgCache Cache; pkgCache Cache;
OpProgress *Progress; OpProgress *Progress;
string PkgFileName; string PkgFileName;
pkgCache::PackageFile *CurrentFile; pkgCache::PackageFile *CurrentFile;
// Flag file dependencies // Flag file dependencies
bool FoundFileDeps; bool FoundFileDeps;
bool NewPackage(pkgCache::PkgIterator &Pkg,const string &PkgName); bool NewGroup(pkgCache::GrpIterator &Grp,const string &Name);
bool NewPackage(pkgCache::PkgIterator &Pkg,const string &Name, const str
ing &Arch);
bool NewFileVer(pkgCache::VerIterator &Ver,ListParser &List); bool NewFileVer(pkgCache::VerIterator &Ver,ListParser &List);
bool NewFileDesc(pkgCache::DescIterator &Desc,ListParser &List); bool NewFileDesc(pkgCache::DescIterator &Desc,ListParser &List);
bool NewDepends(pkgCache::PkgIterator &Pkg, pkgCache::VerIterator &Ver,
string const &Version, unsigned int const &Op,
unsigned int const &Type, map_ptrloc *OldDepLast);
unsigned long NewVersion(pkgCache::VerIterator &Ver,const string &VerStr ,unsigned long Next); unsigned long NewVersion(pkgCache::VerIterator &Ver,const string &VerStr ,unsigned long Next);
map_ptrloc NewDescription(pkgCache::DescIterator &Desc,const string &Lan g,const MD5SumValue &md5sum,map_ptrloc Next); map_ptrloc NewDescription(pkgCache::DescIterator &Desc,const string &Lan g,const MD5SumValue &md5sum,map_ptrloc Next);
public: public:
unsigned long WriteUniqString(const char *S,unsigned int Size); unsigned long WriteUniqString(const char *S,unsigned int Size);
inline unsigned long WriteUniqString(const string &S) {return WriteUniqS tring(S.c_str(),S.length());}; inline unsigned long WriteUniqString(const string &S) {return WriteUniqS tring(S.c_str(),S.length());};
void DropProgress() {Progress = 0;}; void DropProgress() {Progress = 0;};
bool SelectFile(const string &File,const string &Site,pkgIndexFile const &Index, bool SelectFile(const string &File,const string &Site,pkgIndexFile const &Index,
unsigned long Flags = 0); unsigned long Flags = 0);
bool MergeList(ListParser &List,pkgCache::VerIterator *Ver = 0); bool MergeList(ListParser &List,pkgCache::VerIterator *Ver = 0);
inline pkgCache &GetCache() {return Cache;}; inline pkgCache &GetCache() {return Cache;};
inline pkgCache::PkgFileIterator GetCurFile() inline pkgCache::PkgFileIterator GetCurFile()
{return pkgCache::PkgFileIterator(Cache,CurrentFile);}; {return pkgCache::PkgFileIterator(Cache,CurrentFile);};
bool HasFileDeps() {return FoundFileDeps;}; bool HasFileDeps() {return FoundFileDeps;};
bool MergeFileProvides(ListParser &List); bool MergeFileProvides(ListParser &List);
bool FinishCache(OpProgress *Progress);
static bool MakeStatusCache(pkgSourceList &List,OpProgress *Progress,
MMap **OutMap = 0,bool AllowMem = false);
static bool MakeOnlyStatusCache(OpProgress *Progress,DynamicMMap **OutMa
p);
static DynamicMMap* CreateDynamicMMap(FileFd *CacheF, unsigned long Flag
s = 0);
void ReMap(void const * const oldMap, void const * const newMap);
pkgCacheGenerator(DynamicMMap *Map,OpProgress *Progress); pkgCacheGenerator(DynamicMMap *Map,OpProgress *Progress);
~pkgCacheGenerator(); ~pkgCacheGenerator();
}; };
/*}} }*/ /*}} }*/
// This is the abstract package list parser class. /*{{ {*/ // This is the abstract package list parser class. /*{{ {*/
class pkgCacheGenerator::ListParser class pkgCacheGenerator::ListParser
{ {
pkgCacheGenerator *Owner; pkgCacheGenerator *Owner;
friend class pkgCacheGenerator; friend class pkgCacheGenerator;
skipping to change at line 96 skipping to change at line 126
pkgCache::VerIterator OldDepVer; pkgCache::VerIterator OldDepVer;
map_ptrloc *OldDepLast; map_ptrloc *OldDepLast;
// Flag file dependencies // Flag file dependencies
bool FoundFileDeps; bool FoundFileDeps;
protected: protected:
inline unsigned long WriteUniqString(string S) {return Owner->WriteUniqS tring(S);}; inline unsigned long WriteUniqString(string S) {return Owner->WriteUniqS tring(S);};
inline unsigned long WriteUniqString(const char *S,unsigned int Size) {r eturn Owner->WriteUniqString(S,Size);}; inline unsigned long WriteUniqString(const char *S,unsigned int Size) {r eturn Owner->WriteUniqString(S,Size);};
inline unsigned long WriteString(const string &S) {return Owner->Map.Wri inline unsigned long WriteString(const string &S) {return Owner->WriteSt
teString(S);}; ringInMap(S);};
inline unsigned long WriteString(const char *S,unsigned int Size) {retur inline unsigned long WriteString(const char *S,unsigned int Size) {retur
n Owner->Map.WriteString(S,Size);}; n Owner->WriteStringInMap(S,Size);};
bool NewDepends(pkgCache::VerIterator Ver,const string &Package, bool NewDepends(pkgCache::VerIterator &Ver,const string &Package, const
string &Arch,
const string &Version,unsigned int Op, const string &Version,unsigned int Op,
unsigned int Type); unsigned int Type);
bool NewProvides(pkgCache::VerIterator Ver,const string &Package, bool NewProvides(pkgCache::VerIterator &Ver,const string &PkgName,
const string &Version); const string &PkgArch, const string &Version);
public: public:
// These all operate against the current section // These all operate against the current section
virtual string Package() = 0; virtual string Package() = 0;
virtual string Architecture() = 0;
virtual bool ArchitectureAll() = 0;
virtual string Version() = 0; virtual string Version() = 0;
virtual bool NewVersion(pkgCache::VerIterator Ver) = 0; virtual bool NewVersion(pkgCache::VerIterator &Ver) = 0;
virtual string Description() = 0; virtual string Description() = 0;
virtual string DescriptionLanguage() = 0; virtual string DescriptionLanguage() = 0;
virtual MD5SumValue Description_md5() = 0; virtual MD5SumValue Description_md5() = 0;
virtual unsigned short VersionHash() = 0; virtual unsigned short VersionHash() = 0;
virtual bool UsePackage(pkgCache::PkgIterator Pkg, virtual bool UsePackage(pkgCache::PkgIterator &Pkg,
pkgCache::VerIterator Ver) = 0; pkgCache::VerIterator &Ver) = 0;
virtual unsigned long Offset() = 0; virtual unsigned long Offset() = 0;
virtual unsigned long Size() = 0; virtual unsigned long Size() = 0;
virtual bool Step() = 0; virtual bool Step() = 0;
inline bool HasFileDeps() {return FoundFileDeps;}; inline bool HasFileDeps() {return FoundFileDeps;};
virtual bool CollectFileProvides(pkgCache &Cache, virtual bool CollectFileProvides(pkgCache &Cache,
pkgCache::VerIterator Ver) {return true; }; pkgCache::VerIterator &Ver) {return true ;};
ListParser() : FoundFileDeps(false) {}; ListParser() : FoundFileDeps(false) {};
virtual ~ListParser() {}; virtual ~ListParser() {};
}; };
/*}} }*/ /*}} }*/
bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress, bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress,
MMap **OutMap = 0,bool AllowMem = false); MMap **OutMap = 0,bool AllowMem = false);
bool pkgMakeOnlyStatusCache(OpProgress &Progress,DynamicMMap **OutMap); bool pkgMakeOnlyStatusCache(OpProgress &Progress,DynamicMMap **OutMap);
#ifdef APT_COMPATIBILITY #ifdef APT_COMPATIBILITY
#if APT_COMPATIBILITY != 986 #if APT_COMPATIBILITY != 986
#warning "Using APT_COMPATIBILITY" #warning "Using APT_COMPATIBILITY"
#endif #endif
MMap *pkgMakeStatusCacheMem(pkgSourceList &List,OpProgress &Progress) MMap *pkgMakeStatusCacheMem(pkgSourceList &List,OpProgress &Progress)
{ {
skipping to change at line 140 skipping to change at line 173
MMap **OutMap = 0,bool AllowMem = false); MMap **OutMap = 0,bool AllowMem = false);
bool pkgMakeOnlyStatusCache(OpProgress &Progress,DynamicMMap **OutMap); bool pkgMakeOnlyStatusCache(OpProgress &Progress,DynamicMMap **OutMap);
#ifdef APT_COMPATIBILITY #ifdef APT_COMPATIBILITY
#if APT_COMPATIBILITY != 986 #if APT_COMPATIBILITY != 986
#warning "Using APT_COMPATIBILITY" #warning "Using APT_COMPATIBILITY"
#endif #endif
MMap *pkgMakeStatusCacheMem(pkgSourceList &List,OpProgress &Progress) MMap *pkgMakeStatusCacheMem(pkgSourceList &List,OpProgress &Progress)
{ {
MMap *Map = 0; MMap *Map = 0;
if (pkgMakeStatusCache(List,Progress,&Map,true) == false) if (pkgCacheGenerator::MakeStatusCache(List,&Progress,&Map,true) == fals e)
return 0; return 0;
return Map; return Map;
} }
#endif #endif
#endif #endif
 End of changes. 14 change blocks. 
13 lines changed or deleted 52 lines changed or added


 policy.h   policy.h 
skipping to change at line 74 skipping to change at line 74
bool StatusOverride; bool StatusOverride;
public: public:
// Things for manipulating pins // Things for manipulating pins
void CreatePin(pkgVersionMatch::MatchType Type,string Pkg, void CreatePin(pkgVersionMatch::MatchType Type,string Pkg,
string Data,signed short Priority); string Data,signed short Priority);
inline signed short GetPriority(pkgCache::PkgFileIterator const &File) inline signed short GetPriority(pkgCache::PkgFileIterator const &File)
{return PFPriority[File->ID];}; {return PFPriority[File->ID];};
signed short GetPriority(pkgCache::PkgIterator const &Pkg); signed short GetPriority(pkgCache::PkgIterator const &Pkg);
pkgCache::VerIterator GetMatch(pkgCache::PkgIterator Pkg); pkgCache::VerIterator GetMatch(pkgCache::PkgIterator const &Pkg);
// Things for the cache interface. // Things for the cache interface.
virtual pkgCache::VerIterator GetCandidateVer(pkgCache::PkgIterator Pkg) virtual pkgCache::VerIterator GetCandidateVer(pkgCache::PkgIterator cons
; t &Pkg);
virtual bool IsImportantDep(pkgCache::DepIterator Dep) {return pkgDepCac virtual bool IsImportantDep(pkgCache::DepIterator const &Dep) {return pk
he::Policy::IsImportantDep(Dep);}; gDepCache::Policy::IsImportantDep(Dep);};
bool InitDefaults(); bool InitDefaults();
pkgPolicy(pkgCache *Owner); pkgPolicy(pkgCache *Owner);
virtual ~pkgPolicy() {delete [] PFPriority; delete [] Pins;}; virtual ~pkgPolicy() {delete [] PFPriority; delete [] Pins;};
}; };
bool ReadPinFile(pkgPolicy &Plcy,string File = ""); bool ReadPinFile(pkgPolicy &Plcy,string File = "");
bool ReadPinDir(pkgPolicy &Plcy,string Dir = ""); bool ReadPinDir(pkgPolicy &Plcy,string Dir = "");
#endif #endif
 End of changes. 2 change blocks. 
5 lines changed or deleted 5 lines changed or added


 sourcelist.h   sourcelist.h 
skipping to change at line 32 skipping to change at line 32
wired. Before loading the source list the vendor list is loaded. wired. Before loading the source list the vendor list is loaded.
This doesn't load key data, just the checks to perform. This doesn't load key data, just the checks to perform.
##################################################################### */ ##################################################################### */
/*}} }*/ /*}} }*/
#ifndef PKGLIB_SOURCELIST_H #ifndef PKGLIB_SOURCELIST_H
#define PKGLIB_SOURCELIST_H #define PKGLIB_SOURCELIST_H
#include <string> #include <string>
#include <vector> #include <vector>
#include <map>
#include <apt-pkg/pkgcache.h> #include <apt-pkg/pkgcache.h>
#include <apt-pkg/metaindex.h> #include <apt-pkg/metaindex.h>
using std::string; using std::string;
using std::vector; using std::vector;
class pkgAquire; class pkgAquire;
class pkgSourceList class pkgSourceList
{ {
public: public:
skipping to change at line 59 skipping to change at line 60
static Type **GlobalList; static Type **GlobalList;
static unsigned long GlobalListLen; static unsigned long GlobalListLen;
static Type *GetType(const char *Type); static Type *GetType(const char *Type);
const char *Name; const char *Name;
const char *Label; const char *Label;
bool FixupURI(string &URI) const; bool FixupURI(string &URI) const;
virtual bool ParseLine(vector<metaIndex *> &List, virtual bool ParseLine(vector<metaIndex *> &List,
const char *Buffer, const char *Buffer,
unsigned long CurLine,string File) const; unsigned long const &CurLine,string const &File
virtual bool CreateItem(vector<metaIndex *> &List,string URI, ) const;
string Dist,string Section) const = 0; virtual bool CreateItem(vector<metaIndex *> &List,string const &URI,
string const &Dist,string const &Section,
std::map<string, string> const &Options) const
= 0;
Type(); Type();
virtual ~Type() {}; virtual ~Type() {};
}; };
typedef vector<metaIndex *>::const_iterator const_iterator; typedef vector<metaIndex *>::const_iterator const_iterator;
protected: protected:
vector<metaIndex *> SrcList; vector<metaIndex *> SrcList;
 End of changes. 2 change blocks. 
3 lines changed or deleted 7 lines changed or added


 srcrecords.h   srcrecords.h 
skipping to change at line 61 skipping to change at line 61
string Package; string Package;
string Version; string Version;
unsigned int Op; unsigned int Op;
unsigned char Type; unsigned char Type;
}; };
inline const pkgIndexFile &Index() const {return *iIndex;}; inline const pkgIndexFile &Index() const {return *iIndex;};
virtual bool Restart() = 0; virtual bool Restart() = 0;
virtual bool Step() = 0; virtual bool Step() = 0;
virtual bool Jump(unsigned long Off) = 0; virtual bool Jump(unsigned long const &Off) = 0;
virtual unsigned long Offset() = 0; virtual unsigned long Offset() = 0;
virtual string AsStr() = 0; virtual string AsStr() = 0;
virtual string Package() const = 0; virtual string Package() const = 0;
virtual string Version() const = 0; virtual string Version() const = 0;
virtual string Maintainer() const = 0; virtual string Maintainer() const = 0;
virtual string Section() const = 0; virtual string Section() const = 0;
virtual const char **Binaries() = 0; // Ownership does not transfer virtual const char **Binaries() = 0; // Ownership does not transfer
virtual bool BuildDepends(vector<BuildDepRec> &BuildDeps, bool ArchOn virtual bool BuildDepends(vector<BuildDepRec> &BuildDeps, bool const
ly) = 0; &ArchOnly, bool const &StripMultiArch = true) = 0;
static const char *BuildDepType(unsigned char Type); static const char *BuildDepType(unsigned char const &Type);
virtual bool Files(vector<pkgSrcRecords::File> &F) = 0; virtual bool Files(vector<pkgSrcRecords::File> &F) = 0;
Parser(const pkgIndexFile *Index) : iIndex(Index) {}; Parser(const pkgIndexFile *Index) : iIndex(Index) {};
virtual ~Parser() {}; virtual ~Parser() {};
}; };
private: private:
// The list of files and the current parser pointer // The list of files and the current parser pointer
vector<Parser*> Files; vector<Parser*> Files;
vector<Parser *>::iterator Current; vector<Parser *>::iterator Current;
public: public:
// Reset the search // Reset the search
bool Restart(); bool Restart();
// Locate a package by name // Locate a package by name
Parser *Find(const char *Package,bool SrcOnly = false); Parser *Find(const char *Package,bool const &SrcOnly = false);
pkgSrcRecords(pkgSourceList &List); pkgSrcRecords(pkgSourceList &List);
~pkgSrcRecords(); ~pkgSrcRecords();
}; };
#endif #endif
 End of changes. 3 change blocks. 
5 lines changed or deleted 5 lines changed or added


 strutl.h   strutl.h 
skipping to change at line 26 skipping to change at line 26
#ifndef STRUTL_H #ifndef STRUTL_H
#define STRUTL_H #define STRUTL_H
#include <stdlib.h> #include <stdlib.h>
#include <string> #include <string>
#include <cstring> #include <cstring>
#include <vector> #include <vector>
#include <iostream> #include <iostream>
#include <time.h> #include <time.h>
#include "macros.h"
using std::string; using std::string;
using std::vector; using std::vector;
using std::ostream; using std::ostream;
#ifdef __GNUG__
// Methods have a hidden this parameter that is visible to this attribute
#define APT_FORMAT2 __attribute__ ((format (printf, 2, 3)))
#define APT_FORMAT3 __attribute__ ((format (printf, 3, 4)))
#else
#define APT_FORMAT2
#define APT_FORMAT3
#endif
bool UTF8ToCodeset(const char *codeset, const string &orig, string *dest); bool UTF8ToCodeset(const char *codeset, const string &orig, string *dest);
char *_strstrip(char *String); char *_strstrip(char *String);
char *_strtabexpand(char *String,size_t Len); char *_strtabexpand(char *String,size_t Len);
bool ParseQuoteWord(const char *&String,string &Res); bool ParseQuoteWord(const char *&String,string &Res);
bool ParseCWord(const char *&String,string &Res); bool ParseCWord(const char *&String,string &Res);
string QuoteString(const string &Str,const char *Bad); string QuoteString(const string &Str,const char *Bad);
string DeQuoteString(const string &Str); string DeQuoteString(const string &Str);
string DeQuoteString(string::const_iterator const &begin, string::const_ite rator const &end);
string SizeToStr(double Bytes); string SizeToStr(double Bytes);
string TimeToStr(unsigned long Sec); string TimeToStr(unsigned long Sec);
string Base64Encode(const string &Str); string Base64Encode(const string &Str);
string OutputInDepth(const unsigned long Depth, const char* Separator=" ") ; string OutputInDepth(const unsigned long Depth, const char* Separator=" ") ;
string URItoFileName(const string &URI); string URItoFileName(const string &URI);
string TimeRFC1123(time_t Date); string TimeRFC1123(time_t Date);
bool StrToTime(const string &Val,time_t &Result); bool RFC1123StrToTime(const char* const str,time_t &time) __must_check;
bool FTPMDTMStrToTime(const char* const str,time_t &time) __must_check;
__deprecated bool StrToTime(const string &Val,time_t &Result);
string LookupTag(const string &Message,const char *Tag,const char *Default = 0); string LookupTag(const string &Message,const char *Tag,const char *Default = 0);
int StringToBool(const string &Text,int Default = -1); int StringToBool(const string &Text,int Default = -1);
bool ReadMessages(int Fd, vector<string> &List); bool ReadMessages(int Fd, vector<string> &List);
bool StrToNum(const char *Str,unsigned long &Res,unsigned Len,unsigned Base = 0); bool StrToNum(const char *Str,unsigned long &Res,unsigned Len,unsigned Base = 0);
bool Hex2Num(const string &Str,unsigned char *Num,unsigned int Length); bool Hex2Num(const string &Str,unsigned char *Num,unsigned int Length);
bool TokSplitString(char Tok,char *Input,char **List, bool TokSplitString(char Tok,char *Input,char **List,
unsigned long ListMax); unsigned long ListMax);
void ioprintf(ostream &out,const char *format,...) APT_FORMAT2; vector<string> VectorizeString(string const &haystack, char const &split) _
void strprintf(string &out,const char *format,...) APT_FORMAT2; _attrib_const;
char *safe_snprintf(char *Buffer,char *End,const char *Format,...) APT_FORM void ioprintf(ostream &out,const char *format,...) __like_printf(2);
AT3; void strprintf(string &out,const char *format,...) __like_printf(2);
char *safe_snprintf(char *Buffer,char *End,const char *Format,...) __like_p
rintf(3);
bool CheckDomainList(const string &Host, const string &List); bool CheckDomainList(const string &Host, const string &List);
int tolower_ascii(int c); int tolower_ascii(int const c) __attrib_const __hot;
#define APT_MKSTRCMP(name,func) \ #define APT_MKSTRCMP(name,func) \
inline int name(const char *A,const char *B) {return func(A,A+strlen(A),B,B +strlen(B));}; \ inline int name(const char *A,const char *B) {return func(A,A+strlen(A),B,B +strlen(B));}; \
inline int name(const char *A,const char *AEnd,const char *B) {return func( A,AEnd,B,B+strlen(B));}; \ inline int name(const char *A,const char *AEnd,const char *B) {return func( A,AEnd,B,B+strlen(B));}; \
inline int name(const string& A,const char *B) {return func(A.c_str(),A.c_s tr()+A.length(),B,B+strlen(B));}; \ inline int name(const string& A,const char *B) {return func(A.c_str(),A.c_s tr()+A.length(),B,B+strlen(B));}; \
inline int name(const string& A,const string& B) {return func(A.c_str(),A.c _str()+A.length(),B.c_str(),B.c_str()+B.length());}; \ inline int name(const string& A,const string& B) {return func(A.c_str(),A.c _str()+A.length(),B.c_str(),B.c_str()+B.length());}; \
inline int name(const string& A,const char *B,const char *BEnd) {return fun c(A.c_str(),A.c_str()+A.length(),B,BEnd);}; inline int name(const string& A,const char *B,const char *BEnd) {return fun c(A.c_str(),A.c_str()+A.length(),B,BEnd);};
#define APT_MKSTRCMP2(name,func) \ #define APT_MKSTRCMP2(name,func) \
inline int name(const char *A,const char *AEnd,const char *B) {return func( A,AEnd,B,B+strlen(B));}; \ inline int name(const char *A,const char *AEnd,const char *B) {return func( A,AEnd,B,B+strlen(B));}; \
skipping to change at line 121 skipping to change at line 118
string User; string User;
string Password; string Password;
string Host; string Host;
string Path; string Path;
unsigned int Port; unsigned int Port;
operator string(); operator string();
inline void operator =(const string &From) {CopyFrom(From);}; inline void operator =(const string &From) {CopyFrom(From);};
inline bool empty() {return Access.empty();}; inline bool empty() {return Access.empty();};
static string SiteOnly(const string &URI); static string SiteOnly(const string &URI);
static string NoUserPassword(const string &URI);
URI(string Path) {CopyFrom(Path);}; URI(string Path) {CopyFrom(Path);};
URI() : Port(0) {}; URI() : Port(0) {};
}; };
struct SubstVar struct SubstVar
{ {
const char *Subst; const char *Subst;
const string *Contents; const string *Contents;
}; };
skipping to change at line 143 skipping to change at line 141
struct RxChoiceList struct RxChoiceList
{ {
void *UserData; void *UserData;
const char *Str; const char *Str;
bool Hit; bool Hit;
}; };
unsigned long RegexChoice(RxChoiceList *Rxs,const char **ListBegin, unsigned long RegexChoice(RxChoiceList *Rxs,const char **ListBegin,
const char **ListEnd); const char **ListEnd);
#undef APT_FORMAT2
#endif #endif
 End of changes. 8 change blocks. 
17 lines changed or deleted 14 lines changed or added


 tagfile.h   tagfile.h 
skipping to change at line 36 skipping to change at line 36
class pkgTagSection class pkgTagSection
{ {
const char *Section; const char *Section;
// We have a limit of 256 tags per section. // We have a limit of 256 tags per section.
unsigned int Indexes[256]; unsigned int Indexes[256];
unsigned int AlphaIndexes[0x100]; unsigned int AlphaIndexes[0x100];
unsigned int TagCount; unsigned int TagCount;
/* This very simple hash function for the last 8 letters gives
very good performance on the debian package files */
inline static unsigned long AlphaHash(const char *Text, const char *End
= 0)
{
unsigned long Res = 0;
for (; Text != End && *Text != ':' && *Text != 0; Text++)
Res = ((unsigned long)(*Text) & 0xDF) ^ (Res << 1);
return Res & 0xFF;
}
protected: protected:
const char *Stop; const char *Stop;
public: public:
inline bool operator ==(const pkgTagSection &rhs) {return Section == rhs .Section;}; inline bool operator ==(const pkgTagSection &rhs) {return Section == rhs .Section;};
inline bool operator !=(const pkgTagSection &rhs) {return Section != rhs .Section;}; inline bool operator !=(const pkgTagSection &rhs) {return Section != rhs .Section;};
bool Find(const char *Tag,const char *&Start, const char *&End) const; bool Find(const char *Tag,const char *&Start, const char *&End) const;
bool Find(const char *Tag,unsigned &Pos) const; bool Find(const char *Tag,unsigned &Pos) const;
string FindS(const char *Tag) const; string FindS(const char *Tag) const;
signed int FindI(const char *Tag,signed long Default = 0) const ; signed int FindI(const char *Tag,signed long Default = 0) const ;
unsigned long long FindULL(const char *Tag, unsigned long long const &De fault = 0) const;
bool FindFlag(const char *Tag,unsigned long &Flags, bool FindFlag(const char *Tag,unsigned long &Flags,
unsigned long Flag) const; unsigned long Flag) const;
bool Scan(const char *Start,unsigned long MaxLength); bool Scan(const char *Start,unsigned long MaxLength);
inline unsigned long size() const {return Stop - Section;}; inline unsigned long size() const {return Stop - Section;};
void Trim(); void Trim();
virtual void TrimRecord(bool BeforeRecord, const char* &End); virtual void TrimRecord(bool BeforeRecord, const char* &End);
inline unsigned int Count() const {return TagCount;}; inline unsigned int Count() const {return TagCount;};
inline bool Exists(const char* const Tag) {return AlphaIndexes[AlphaHash
(Tag)] != 0;}
inline void Get(const char *&Start,const char *&Stop,unsigned int I) con st inline void Get(const char *&Start,const char *&Stop,unsigned int I) con st
{Start = Section + Indexes[I]; Stop = Section + Indexes[ I+1];} {Start = Section + Indexes[I]; Stop = Section + Indexes[ I+1];}
inline void GetSection(const char *&Start,const char *&Stop) const inline void GetSection(const char *&Start,const char *&Stop) const
{ {
Start = Section; Start = Section;
Stop = this->Stop; Stop = this->Stop;
}; };
pkgTagSection() : Section(0), Stop(0) {}; pkgTagSection() : Section(0), Stop(0) {};
 End of changes. 3 change blocks. 
0 lines changed or deleted 15 lines changed or added


 versionmatch.h   versionmatch.h 
skipping to change at line 26 skipping to change at line 26
Release: * Release: *
Origin: ftp.debian.org Origin: ftp.debian.org
Release may be a complex type that can specify matches for any of: Release may be a complex type that can specify matches for any of:
Version (v= with prefix) Version (v= with prefix)
Origin (o=) Origin (o=)
Archive (a=) eg, unstable, testing, stable Archive (a=) eg, unstable, testing, stable
Codename (n=) e.g. etch, lenny, squeeze, sid Codename (n=) e.g. etch, lenny, squeeze, sid
Label (l=) Label (l=)
Component (c=) Component (c=)
Binary Architecture (b=)
If there are no equals signs in the string then it is scanned in short If there are no equals signs in the string then it is scanned in short
form - if it starts with a number it is Version otherwise it is an form - if it starts with a number it is Version otherwise it is an
Archive or a Codename. Archive or a Codename.
Release may be a '*' to match all releases. Release may be a '*' to match all releases.
##################################################################### */ ##################################################################### */
/*}} }*/ /*}} }*/
#ifndef PKGLIB_VERSIONMATCH_H #ifndef PKGLIB_VERSIONMATCH_H
#define PKGLIB_VERSIONMATCH_H #define PKGLIB_VERSIONMATCH_H
skipping to change at line 57 skipping to change at line 58
// Release Matching // Release Matching
string RelVerStr; string RelVerStr;
bool RelVerPrefixMatch; bool RelVerPrefixMatch;
string RelOrigin; string RelOrigin;
string RelRelease; string RelRelease;
string RelCodename; string RelCodename;
string RelArchive; string RelArchive;
string RelLabel; string RelLabel;
string RelComponent; string RelComponent;
string RelArchitecture;
bool MatchAll; bool MatchAll;
// Origin Matching // Origin Matching
string OrSite; string OrSite;
public: public:
enum MatchType {None = 0,Version,Release,Origin} Type; enum MatchType {None = 0,Version,Release,Origin} Type;
bool MatchVer(const char *A,string B,bool Prefix); bool MatchVer(const char *A,string B,bool Prefix);
bool ExpressionMatches(const char *pattern, const char *string);
bool ExpressionMatches(const std::string& pattern, const char *string);
bool FileMatch(pkgCache::PkgFileIterator File); bool FileMatch(pkgCache::PkgFileIterator File);
pkgCache::VerIterator Find(pkgCache::PkgIterator Pkg); pkgCache::VerIterator Find(pkgCache::PkgIterator Pkg);
pkgVersionMatch(string Data,MatchType Type); pkgVersionMatch(string Data,MatchType Type);
}; };
#endif #endif
 End of changes. 3 change blocks. 
0 lines changed or deleted 4 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/