acquire-item.h   acquire-item.h 
skipping to change at line 24 skipping to change at line 24
A Archive class is provided for downloading .deb files. It does Hash A Archive class is provided for downloading .deb files. It does Hash
checking and source location as well as a retry algorithm. checking and source location as well as a retry algorithm.
##################################################################### */ ##################################################################### */
/*}} }*/ /*}} }*/
#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/hashes.h>
#include <apt-pkg/weakptr.h>
#include <apt-pkg/pkgcache.h>
#ifndef APT_8_CLEANER_HEADERS
#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> #endif
#include <apt-pkg/weakptr.h>
/** \addtogroup acquire /** \addtogroup acquire
* @{ * @{
* *
* \file acquire-item.h * \file acquire-item.h
*/ */
class indexRecords;
class pkgRecords;
class pkgSourceList;
/** \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.
* *
skipping to change at line 77 skipping to change at line 85
/** \brief Rename a file without modifying its timestamp. /** \brief Rename a file without modifying its timestamp.
* *
* Many item methods call this as their final action. * Many item methods call this as their final action.
* *
* \param From The file to be renamed. * \param From The file to be renamed.
* *
* \param To The new name of #From. If #To exists it will be * \param To The new name of #From. If #To exists it will be
* overwritten. * overwritten.
*/ */
void Rename(string From,string To); void Rename(std::string From,std::string To);
public: public:
/** \brief The current status of this item. */ /** \brief The current status of this item. */
enum ItemState enum ItemState
{ {
/** \brief The item is waiting to be downloaded. */ /** \brief The item is waiting to be downloaded. */
StatIdle, StatIdle,
/** \brief The item is currently being downloaded. */ /** \brief The item is currently being downloaded. */
skipping to change at line 112 skipping to change at line 120
/** \brief The item was could not be downloaded because of /** \brief The item was could not be downloaded because of
* a transient network error (e.g. network down) * a transient network error (e.g. network down)
*/ */
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; std::string ErrorText;
/** \brief The size of the object to fetch. */ /** \brief The size of the object to fetch. */
unsigned long 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 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").
*/ */
skipping to change at line 146 skipping to change at line 154
* 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; std::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;
/** \brief The name of the file into which the retrieved object /** \brief The name of the file into which the retrieved object
* will be written. * will be written.
*/ */
string DestFile; std::string DestFile;
/** \brief Invoked by the acquire worker when the object couldn't /** \brief Invoked by the acquire worker when the object couldn't
* be fetched. * be fetched.
* *
* This is a branch of the continuation of the fetch process. * This is a branch of the continuation of the fetch process.
* *
* \param Message An RFC822-formatted message from the acquire * \param Message An RFC822-formatted message from the acquire
* method describing what went wrong. Use LookupTag() to parse * method describing what went wrong. Use LookupTag() to parse
* it. * it.
* *
* \param Cnf The method via which the worker tried to fetch this objec t. * \param Cnf The method via which the worker tried to fetch this objec t.
* *
* \sa pkgAcqMethod * \sa pkgAcqMethod
*/ */
virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf); virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
/** \brief Invoked by the acquire worker when the object was /** \brief Invoked by the acquire worker when the object was
* fetched successfully. * fetched successfully.
* *
* Note that the object might \e not have been written to * Note that the object might \e not have been written to
* DestFile; check for the presence of an Alt-Filename entry in * DestFile; check for the presence of an Alt-Filename entry in
* Message to find the file to which it was really written. * Message to find the file to which it was really written.
* *
* Done is often used to switch from one stage of the processing * Done is often used to switch from one stage of the processing
* to the next (e.g. fetching, unpacking, copying). It is one * to the next (e.g. fetching, unpacking, copying). It is one
* branch of the continuation of the fetch process. * branch of the continuation of the fetch process.
* *
* \param Message Data from the acquire method. Use LookupTag() * \param Message Data from the acquire method. Use LookupTag()
* to parse it. * to parse it.
* \param Size The size of the object that was fetched. * \param Size The size of the object that was fetched.
* \param Hash The HashSum of the object that was fetched. * \param Hash The HashSum of the object that was fetched.
* \param Cnf The method via which the object was fetched. * \param Cnf The method via which the object was fetched.
* *
* \sa pkgAcqMethod * \sa pkgAcqMethod
*/ */
virtual void Done(string Message,unsigned long Size,string Hash, virtual void Done(std::string Message,unsigned long long Size,std::strin g Hash,
pkgAcquire::MethodConfig *Cnf); pkgAcquire::MethodConfig *Cnf);
/** \brief Invoked when the worker starts to fetch this object. /** \brief Invoked when the worker starts to fetch this object.
* *
* \param Message RFC822-formatted data from the worker process. * \param Message RFC822-formatted data from the worker process.
* Use LookupTag() to parse it. * Use LookupTag() to parse it.
* *
* \param Size The size of the object being fetched. * \param Size The size of the object being fetched.
* *
* \sa pkgAcqMethod * \sa pkgAcqMethod
*/ */
virtual void Start(string Message,unsigned long Size); virtual void Start(std::string Message,unsigned long long Size);
/** \brief Custom headers to be sent to the fetch process. /** \brief Custom headers to be sent to the fetch process.
* *
* \return a string containing RFC822-style headers that are to be * \return a string containing RFC822-style headers that are to be
* inserted into the 600 URI Acquire message sent to the fetch * inserted into the 600 URI Acquire message sent to the fetch
* subprocess. The headers are inserted after a newline-less * subprocess. The headers are inserted after a newline-less
* line, so they should (if nonempty) have a leading newline and * line, so they should (if nonempty) have a leading newline and
* no trailing newline. * no trailing newline.
*/ */
virtual string Custom600Headers() {return string();}; virtual std::string Custom600Headers() {return std::string();};
/** \brief A "descriptive" URI-like string. /** \brief A "descriptive" URI-like string.
* *
* \return a URI that should be used to describe what is being fetched. * \return a URI that should be used to describe what is being fetched.
*/ */
virtual string DescURI() = 0; virtual std::string DescURI() = 0;
/** \brief Short item description. /** \brief Short item description.
* *
* \return a brief description of the object being fetched. * \return a brief description of the object being fetched.
*/ */
virtual string ShortDesc() {return DescURI();} virtual std::string ShortDesc() {return DescURI();}
/** \brief Invoked by the worker when the download is completely done. * / /** \brief Invoked by the worker when the download is completely done. * /
virtual void Finished() {}; virtual void Finished() {};
/** \brief HashSum /** \brief HashSum
* *
* \return the HashSum of this object, if applicable; otherwise, an * \return the HashSum of this object, if applicable; otherwise, an
* empty string. * empty string.
*/ */
virtual string HashSum() {return string();}; virtual std::string HashSum() {return std::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 // report mirror problems
/** \brief Report mirror problem /** \brief Report mirror problem
* *
* This allows reporting mirror failures back to a centralized * This allows reporting mirror failures back to a centralized
* server. The apt-report-mirror-failure script is called for this * server. The apt-report-mirror-failure script is called for this
* *
* \param FailCode A short failure string that is send * \param FailCode A short failure string that is send
*/ */
void ReportMirrorFailure(string FailCode); void ReportMirrorFailure(std::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.
* *
skipping to change at line 280 skipping to change at line 288
/** \brief Remove this item from its owner's queue by invoking /** \brief Remove this item from its owner's queue by invoking
* pkgAcquire::Remove. * pkgAcquire::Remove.
*/ */
virtual ~Item(); virtual ~Item();
}; };
/*}} }*/ /*}} }*/
/** \brief Information about an index patch (aka diff). */ /*{{ {*/ /** \brief Information about an index patch (aka diff). */ /*{{ {*/
struct DiffInfo { struct DiffInfo {
/** The filename of the diff. */ /** The filename of the diff. */
string file; std::string file;
/** The sha1 hash of the diff. */ /** The sha1 hash of the diff. */
string sha1; std::string sha1;
/** The size of the diff. */ /** The size of the diff. */
unsigned long size; unsigned long size;
}; };
/*}} }*/ /*}} }*/
/** \brief An item that is responsible for fetching a SubIndex {{{ /** \brief An item that is responsible for fetching a SubIndex {{{
* *
* The MetaIndex file includes only records for important indexes * The MetaIndex file includes only records for important indexes
* and records for these SubIndex files so these can carry records * and records for these SubIndex files so these can carry records
* for addition files like PDiffs and Translations * for addition files like PDiffs and Translations
skipping to change at line 310 skipping to change at line 318
/** \brief The item that is currently being downloaded. */ /** \brief The item that is currently being downloaded. */
pkgAcquire::ItemDesc Desc; pkgAcquire::ItemDesc Desc;
/** \brief The Hash that this file should have after download /** \brief The Hash that this file should have after download
*/ */
HashString ExpectedHash; HashString ExpectedHash;
public: public:
// Specialized action members // Specialized action members
virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf); virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
virtual void Done(string Message,unsigned long Size,string Md5Hash, virtual void Done(std::string Message,unsigned long long Size,std::strin
g Md5Hash,
pkgAcquire::MethodConfig *Cnf); pkgAcquire::MethodConfig *Cnf);
virtual string DescURI() {return Desc.URI;}; virtual std::string DescURI() {return Desc.URI;};
virtual string Custom600Headers(); virtual std::string Custom600Headers();
virtual bool ParseIndex(string const &IndexFile); virtual bool ParseIndex(std::string const &IndexFile);
/** \brief Create a new pkgAcqSubIndex. /** \brief Create a new pkgAcqSubIndex.
* *
* \param Owner The Acquire object that owns this item. * \param Owner The Acquire object that owns this item.
* *
* \param URI The URI of the list file to download. * \param URI The URI of the list file to download.
* *
* \param URIDesc A long description of the list file to download. * \param URIDesc A long description of the list file to download.
* *
* \param ShortDesc A short description of the list file to download. * \param ShortDesc A short description of the list file to download.
* *
* \param ExpectedHash The list file's MD5 signature. * \param ExpectedHash The list file's MD5 signature.
*/ */
pkgAcqSubIndex(pkgAcquire *Owner, string const &URI,string const &URIDes pkgAcqSubIndex(pkgAcquire *Owner, std::string const &URI,std::string con
c, st &URIDesc,
string const &ShortDesc, HashString const &ExpectedHash); std::string const &ShortDesc, HashString const &ExpectedH
ash);
}; };
/*}} }*/ /*}} }*/
/** \brief An item that is responsible for fetching an index file of {{{ /** \brief An item that is responsible for fetching an index file of {{{
* package list diffs and starting the package list's download. * package list diffs and starting the package list's download.
* *
* This item downloads the Index file and parses it, then enqueues * This item downloads the Index file and parses it, then enqueues
* additional downloads of either the individual patches (using * additional downloads of either the individual patches (using
* pkgAcqIndexDiffs) or the entire Packages file (using pkgAcqIndex). * pkgAcqIndexDiffs) or the entire Packages file (using pkgAcqIndex).
* *
* \sa pkgAcqIndexDiffs, pkgAcqIndex * \sa pkgAcqIndexDiffs, pkgAcqIndex
skipping to change at line 354 skipping to change at line 362
protected: protected:
/** \brief If \b true, debugging information will be written to std::clo g. */ /** \brief If \b true, debugging information will be written to std::clo g. */
bool Debug; bool Debug;
/** \brief The item that is currently being downloaded. */ /** \brief The item that is currently being downloaded. */
pkgAcquire::ItemDesc Desc; pkgAcquire::ItemDesc Desc;
/** \brief The URI of the index file to recreate at our end (either /** \brief The URI of the index file to recreate at our end (either
* by downloading it or by applying partial patches). * by downloading it or by applying partial patches).
*/ */
string RealURI; std::string RealURI;
/** \brief The Hash that the real index file should have after /** \brief The Hash that the real index file should have after
* all patches have been applied. * all patches have been applied.
*/ */
HashString ExpectedHash; HashString ExpectedHash;
/** \brief The index file which will be patched to generate the new /** \brief The index file which will be patched to generate the new
* file. * file.
*/ */
string CurrentPackagesFile; std::string CurrentPackagesFile;
/** \brief A description of the Packages file (stored in /** \brief A description of the Packages file (stored in
* pkgAcquire::ItemDesc::Description). * pkgAcquire::ItemDesc::Description).
*/ */
string Description; std::string Description;
public: public:
// Specialized action members // Specialized action members
virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf); virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
virtual void Done(string Message,unsigned long Size,string Md5Hash, virtual void Done(std::string Message,unsigned long long Size,std::strin
g Md5Hash,
pkgAcquire::MethodConfig *Cnf); pkgAcquire::MethodConfig *Cnf);
virtual string DescURI() {return RealURI + "Index";}; virtual std::string DescURI() {return RealURI + "Index";};
virtual string Custom600Headers(); virtual std::string Custom600Headers();
/** \brief Parse the Index file for a set of Packages diffs. /** \brief Parse the Index file for a set of Packages diffs.
* *
* Parses the Index file and creates additional download items as * Parses the Index file and creates additional download items as
* necessary. * necessary.
* *
* \param IndexDiffFile The name of the Index file. * \param IndexDiffFile The name of the Index file.
* *
* \return \b true if the Index file was successfully parsed, \b * \return \b true if the Index file was successfully parsed, \b
* false otherwise. * false otherwise.
*/ */
bool ParseDiffIndex(string IndexDiffFile); bool ParseDiffIndex(std::string IndexDiffFile);
/** \brief Create a new pkgAcqDiffIndex. /** \brief Create a new pkgAcqDiffIndex.
* *
* \param Owner The Acquire object that owns this item. * \param Owner The Acquire object that owns this item.
* *
* \param URI The URI of the list file to download. * \param URI The URI of the list file to download.
* *
* \param URIDesc A long description of the list file to download. * \param URIDesc A long description of the list file to download.
* *
* \param ShortDesc A short description of the list file to download. * \param ShortDesc A short description of the list file to download.
* *
* \param ExpectedHash The list file's MD5 signature. * \param ExpectedHash The list file's MD5 signature.
*/ */
pkgAcqDiffIndex(pkgAcquire *Owner,string URI,string URIDesc, pkgAcqDiffIndex(pkgAcquire *Owner,std::string URI,std::string URIDesc,
string ShortDesc, HashString ExpectedHash); std::string ShortDesc, HashString ExpectedHash);
}; };
/*}} }*/ /*}} }*/
/** \brief An item that is responsible for fetching all the patches {{{ /** \brief An item that is responsible for fetching all the patches {{{
* that need to be applied to a given package index file. * that need to be applied to a given package index file.
* *
* After downloading and applying a single patch, this item will * After downloading and applying a single patch, this item will
* enqueue a new pkgAcqIndexDiffs to download and apply the remaining * enqueue a new pkgAcqIndexDiffs to download and apply the remaining
* patches. If no patch can be found that applies to an intermediate * patches. If no patch can be found that applies to an intermediate
* file or if one of the patches cannot be downloaded, falls back to * file or if one of the patches cannot be downloaded, falls back to
* downloading the entire package index file using pkgAcqIndex. * downloading the entire package index file using pkgAcqIndex.
skipping to change at line 461 skipping to change at line 469
bool Debug; bool Debug;
/** \brief A description of the item that is currently being /** \brief A description of the item that is currently being
* downloaded. * downloaded.
*/ */
pkgAcquire::ItemDesc Desc; pkgAcquire::ItemDesc Desc;
/** \brief The URI of the package index file that is being /** \brief The URI of the package index file that is being
* reconstructed. * reconstructed.
*/ */
string RealURI; std::string RealURI;
/** \brief The HashSum of the package index file that is being /** \brief The HashSum of the package index file that is being
* reconstructed. * reconstructed.
*/ */
HashString ExpectedHash; HashString ExpectedHash;
/** A description of the file being downloaded. */ /** A description of the file being downloaded. */
string Description; std::string Description;
/** 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; std::vector<DiffInfo> available_patches;
/** Stop applying patches when reaching that sha1 */ /** Stop applying patches when reaching that sha1 */
string ServerSha1; std::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,
skipping to change at line 507 skipping to change at line 515
StateApplyDiff StateApplyDiff
} State; } State;
public: public:
/** \brief Called when the patch file failed to be downloaded. /** \brief Called when the patch file failed to be downloaded.
* *
* This method will fall back to downloading the whole index file * This method will fall back to downloading the whole index file
* outright; its arguments are ignored. * outright; its arguments are ignored.
*/ */
virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf); virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
virtual void Done(string Message,unsigned long Size,string Md5Hash, virtual void Done(std::string Message,unsigned long long Size,std::strin g Md5Hash,
pkgAcquire::MethodConfig *Cnf); pkgAcquire::MethodConfig *Cnf);
virtual string DescURI() {return RealURI + "Index";}; virtual std::string DescURI() {return RealURI + "Index";};
/** \brief Create an index diff item. /** \brief Create an index diff item.
* *
* After filling in its basic fields, this invokes Finish(true) if * After filling in its basic fields, this invokes Finish(true) if
* #diffs is empty, or QueueNextDiff() otherwise. * #diffs is empty, or QueueNextDiff() otherwise.
* *
* \param Owner The pkgAcquire object that owns this item. * \param Owner The pkgAcquire object that owns this item.
* *
* \param URI The URI of the package index file being * \param URI The URI of the package index file being
* reconstructed. * reconstructed.
skipping to change at line 535 skipping to change at line 543
* \param ShortDesc A brief description of this item. * \param ShortDesc A brief description of this item.
* *
* \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,std::string URI,std::string URIDesc,
string ShortDesc, HashString ExpectedHash, std::string ShortDesc, HashString ExpectedHash,
string ServerSha1, std::string ServerSha1,
vector<DiffInfo> diffs=vector<DiffInfo>()); std::vector<DiffInfo> diffs=std::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?
*/ */
class pkgAcqIndex : public pkgAcquire::Item class pkgAcqIndex : public pkgAcquire::Item
skipping to change at line 560 skipping to change at line 568
protected: protected:
/** \brief If \b true, the index file has been decompressed. */ /** \brief If \b true, the index file has been decompressed. */
bool Decompression; bool Decompression;
/** \brief If \b true, the partially downloaded file will be /** \brief If \b true, the partially downloaded file will be
* removed when the download completes. * removed when the download completes.
*/ */
bool Erase; bool Erase;
/** \brief Verify for correctness by checking if a "Package"
* tag is found in the index. This can be set to
* false for optional index targets
*
*/
// FIXME: instead of a bool it should use a verify string that will
// then be used in the pkgAcqIndex::Done method to ensure that
// the downloaded file contains the expected tag
bool Verify;
/** \brief The download request that is currently being /** \brief The download request that is currently being
* processed. * processed.
*/ */
pkgAcquire::ItemDesc Desc; pkgAcquire::ItemDesc Desc;
/** \brief The object that is actually being fetched (minus any /** \brief The object that is actually being fetched (minus any
* compression-related extensions). * compression-related extensions).
*/ */
string RealURI; std::string RealURI;
/** \brief The expected hashsum of the decompressed index file. */ /** \brief The expected hashsum of the decompressed index file. */
HashString ExpectedHash; HashString ExpectedHash;
/** \brief The compression-related file extensions that are being /** \brief The compression-related file extensions that are being
* added to the downloaded file one by one if first fails (e.g., "gz bz 2"). * added to the downloaded file one by one if first fails (e.g., "gz bz 2").
*/ */
string CompressionExtension; std::string CompressionExtension;
public: public:
// Specialized action members // Specialized action members
virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf); virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
virtual void Done(string Message,unsigned long Size,string Md5Hash, virtual void Done(std::string Message,unsigned long long Size,std::strin
g Md5Hash,
pkgAcquire::MethodConfig *Cnf); pkgAcquire::MethodConfig *Cnf);
virtual string Custom600Headers(); virtual std::string Custom600Headers();
virtual string DescURI() {return Desc.URI;}; virtual std::string DescURI() {return Desc.URI;};
virtual string HashSum() {return ExpectedHash.toStr(); }; virtual std::string HashSum() {return ExpectedHash.toStr(); };
/** \brief Create a pkgAcqIndex. /** \brief Create a pkgAcqIndex.
* *
* \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.
* *
* \param ShortDesc A brief description of this index file. * \param ShortDesc A brief description of this index file.
* *
* \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,std::string URI,std::string URIDesc,
string ShortDesc, HashString ExpectedHash, std::string ShortDesc, HashString ExpectedHash,
string compressExt=""); std::string compressExt="");
pkgAcqIndex(pkgAcquire *Owner, struct IndexTarget const * const Target, pkgAcqIndex(pkgAcquire *Owner, struct IndexTarget const * const Target,
HashString const &ExpectedHash, indexRecords const *MetaIndexParser); HashString const &ExpectedHash, indexRecords const *MetaIndexParser);
void Init(string const &URI, string const &URIDesc, string const &ShortD esc); void Init(std::string const &URI, std::string const &URIDesc, std::strin g const &ShortDesc);
}; };
/*}} }*/ /*}} }*/
/** \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(std::string Message,pkgAcquire::MethodConfig *Cnf);
virtual string Custom600Headers(); virtual std::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.
* *
* \param ShortDesc A brief description of this index file. * \param ShortDesc A brief description of this index file.
*/ */
pkgAcqIndexTrans(pkgAcquire *Owner,string URI,string URIDesc, pkgAcqIndexTrans(pkgAcquire *Owner,std::string URI,std::string URIDesc,
string ShortDesc); std::string ShortDesc);
pkgAcqIndexTrans(pkgAcquire *Owner, struct IndexTarget const * const Tar get, pkgAcqIndexTrans(pkgAcquire *Owner, struct IndexTarget const * const Tar get,
HashString const &ExpectedHash, indexRecords const *Meta IndexParser); HashString const &ExpectedHash, indexRecords const *Meta IndexParser);
}; };
/*}} }*/ /*}} }*/
/** \brief Information about an index file. */ /*{{ {*/ /** \brief Information about an index file. */ /*{{ {*/
struct IndexTarget class IndexTarget
{ {
public:
/** \brief A URI from which the index file can be downloaded. */ /** \brief A URI from which the index file can be downloaded. */
string URI; std::string URI;
/** \brief A description of the index file. */ /** \brief A description of the index file. */
string Description; std::string Description;
/** \brief A shorter description of the index file. */ /** \brief A shorter description of the index file. */
string ShortDesc; std::string ShortDesc;
/** \brief The key by which this index file should be /** \brief The key by which this index file should be
* looked up within the meta signature file. * looked up within the meta signature file.
*/ */
string MetaKey; std::string MetaKey;
//FIXME: We should use virtual methods here instead… virtual bool IsOptional() const {
bool IsOptional() const; return false;
bool IsSubIndex() const; }
virtual bool IsSubIndex() const {
return false;
}
}; };
/*}} }*/ /*}} }*/
/** \brief Information about an optional index file. */ /*{{{*/ /** \brief Information about an optional index file. */ /*{{{*/
struct OptionalIndexTarget : public IndexTarget class OptionalIndexTarget : public IndexTarget
{
virtual bool IsOptional() const {
return true;
}
};
/*}}
}*/
/** \brief Information about an subindex index file. */
/*{{{*/
class SubIndexTarget : public IndexTarget
{
virtual bool IsSubIndex() const {
return true;
}
};
/*}}
}*/
/** \brief Information about an subindex index file. */
/*{{{*/
class OptionalSubIndexTarget : public OptionalIndexTarget
{ {
virtual bool IsSubIndex() const {
return true;
}
}; };
/*}} }*/ /*}} }*/
/** \brief An acquire item that downloads the detached signature {{{ /** \brief An acquire item that downloads the detached signature {{{
* of a meta-index (Release) file, then queues up the release * of a meta-index (Release) file, then queues up the release
* file itself. * file itself.
* *
* \todo Why protected members? * \todo Why protected members?
* *
* \sa pkgAcqMetaIndex * \sa pkgAcqMetaIndex
*/ */
class pkgAcqMetaSig : public pkgAcquire::Item class pkgAcqMetaSig : public pkgAcquire::Item
{ {
protected: protected:
/** \brief The last good signature file */ /** \brief The last good signature file */
string LastGoodSig; std::string LastGoodSig;
/** \brief The fetch request that is currently being processed. */ /** \brief The fetch request that is currently being processed. */
pkgAcquire::ItemDesc Desc; pkgAcquire::ItemDesc Desc;
/** \brief The URI of the signature file. Unlike Desc.URI, this is /** \brief The URI of the signature file. Unlike Desc.URI, this is
* never modified; it is used to determine the file that is being * never modified; it is used to determine the file that is being
* downloaded. * downloaded.
*/ */
string RealURI; std::string RealURI;
/** \brief The URI of the meta-index file to be fetched after the signat ure. */ /** \brief The URI of the meta-index file to be fetched after the signat ure. */
string MetaIndexURI; std::string MetaIndexURI;
/** \brief A "URI-style" description of the meta-index file to be /** \brief A "URI-style" description of the meta-index file to be
* fetched after the signature. * fetched after the signature.
*/ */
string MetaIndexURIDesc; std::string MetaIndexURIDesc;
/** \brief A brief description of the meta-index file to be fetched /** \brief A brief description of the meta-index file to be fetched
* after the signature. * after the signature.
*/ */
string MetaIndexShortDesc; std::string MetaIndexShortDesc;
/** \brief A package-system-specific parser for the meta-index file. */ /** \brief A package-system-specific parser for the meta-index file. */
indexRecords* MetaIndexParser; indexRecords* MetaIndexParser;
/** \brief The index files which should be looked up in the meta-index /** \brief The index files which should be looked up in the meta-index
* and then downloaded. * and then downloaded.
* *
* \todo Why a list of pointers instead of a list of structs? * \todo Why a list of pointers instead of a list of structs?
*/ */
const vector<struct IndexTarget*>* IndexTargets; const std::vector<struct IndexTarget*>* IndexTargets;
public: public:
// Specialized action members // Specialized action members
virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf); virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
virtual void Done(string Message,unsigned long Size,string Md5Hash, virtual void Done(std::string Message,unsigned long long Size,std::strin
g Md5Hash,
pkgAcquire::MethodConfig *Cnf); pkgAcquire::MethodConfig *Cnf);
virtual string Custom600Headers(); virtual std::string Custom600Headers();
virtual string DescURI() {return RealURI; }; virtual std::string DescURI() {return RealURI; };
/** \brief Create a new pkgAcqMetaSig. */ /** \brief Create a new pkgAcqMetaSig. */
pkgAcqMetaSig(pkgAcquire *Owner,string URI,string URIDesc, string ShortD pkgAcqMetaSig(pkgAcquire *Owner,std::string URI,std::string URIDesc, std
esc, ::string ShortDesc,
string MetaIndexURI, string MetaIndexURIDesc, string MetaIn std::string MetaIndexURI, std::string MetaIndexURIDesc, std
dexShortDesc, ::string MetaIndexShortDesc,
const vector<struct IndexTarget*>* IndexTargets, const std::vector<struct IndexTarget*>* IndexTargets,
indexRecords* MetaIndexParser); indexRecords* MetaIndexParser);
}; };
/*}} }*/ /*}} }*/
/** \brief An item that is responsible for downloading the meta-index {{{ /** \brief An item that is responsible for downloading the meta-index {{{
* file (i.e., Release) itself and verifying its signature. * file (i.e., Release) itself and verifying its signature.
* *
* Once the download and verification are complete, the downloads of * Once the download and verification are complete, the downloads of
* the individual index files are queued up using pkgAcqDiffIndex. * the individual index files are queued up using pkgAcqDiffIndex.
* If the meta-index file had a valid signature, the expected hashsums * If the meta-index file had a valid signature, the expected hashsums
* of the index files will be the md5sums listed in the meta-index; * of the index files will be the md5sums listed in the meta-index;
skipping to change at line 755 skipping to change at line 796
*/ */
class pkgAcqMetaIndex : public pkgAcquire::Item class pkgAcqMetaIndex : public pkgAcquire::Item
{ {
protected: protected:
/** \brief The fetch command that is currently being processed. */ /** \brief The fetch command that is currently being processed. */
pkgAcquire::ItemDesc Desc; pkgAcquire::ItemDesc Desc;
/** \brief The URI that is actually being downloaded; never /** \brief The URI that is actually being downloaded; never
* modified by pkgAcqMetaIndex. * modified by pkgAcqMetaIndex.
*/ */
string RealURI; std::string RealURI;
/** \brief The file in which the signature for this index was stored. /** \brief The file in which the signature for this index was stored.
* *
* If empty, the signature and the md5sums of the individual * If empty, the signature and the md5sums of the individual
* indices will not be checked. * indices will not be checked.
*/ */
string SigFile; std::string SigFile;
/** \brief The index files to download. */ /** \brief The index files to download. */
const vector<struct IndexTarget*>* IndexTargets; const std::vector<struct IndexTarget*>* IndexTargets;
/** \brief The parser for the meta-index file. */ /** \brief The parser for the meta-index file. */
indexRecords* MetaIndexParser; indexRecords* MetaIndexParser;
/** \brief If \b true, the index's signature is currently being verified . /** \brief If \b true, the index's signature is currently being verified .
*/ */
bool AuthPass; bool AuthPass;
// required to deal gracefully with problems caused by incorrect ims hit s // required to deal gracefully with problems caused by incorrect ims hit s
bool IMSHit; bool IMSHit;
/** \brief Check that the release file is a release file for the /** \brief Check that the release file is a release file for the
* correct distribution. * correct distribution.
* *
* \return \b true if no fatal errors were encountered. * \return \b true if no fatal errors were encountered.
*/ */
bool VerifyVendor(string Message); bool VerifyVendor(std::string Message);
/** \brief Called when a file is finished being retrieved. /** \brief Called when a file is finished being retrieved.
* *
* If the file was not downloaded to DestFile, a copy process is * If the file was not downloaded to DestFile, a copy process is
* set up to copy it to DestFile; otherwise, Complete is set to \b * set up to copy it to DestFile; otherwise, Complete is set to \b
* true and the file is moved to its final location. * true and the file is moved to its final location.
* *
* \param Message The message block received from the fetch * \param Message The message block received from the fetch
* subprocess. * subprocess.
*/ */
void RetrievalDone(string Message); void RetrievalDone(std::string Message);
/** \brief Called when authentication succeeded. /** \brief Called when authentication succeeded.
* *
* Sanity-checks the authenticated file, queues up the individual * Sanity-checks the authenticated file, queues up the individual
* index files for download, and saves the signature in the lists * index files for download, and saves the signature in the lists
* directory next to the authenticated list file. * directory next to the authenticated list file.
* *
* \param Message The message block received from the fetch * \param Message The message block received from the fetch
* subprocess. * subprocess.
*/ */
void AuthDone(string Message); void AuthDone(std::string Message);
/** \brief Starts downloading the individual index files. /** \brief Starts downloading the individual index files.
* *
* \param verify If \b true, only indices whose expected hashsum * \param verify If \b true, only indices whose expected hashsum
* can be determined from the meta-index will be downloaded, and * can be determined from the meta-index will be downloaded, and
* the hashsums of indices will be checked (reporting * the hashsums of indices will be checked (reporting
* #StatAuthError if there is a mismatch). If verify is \b false, * #StatAuthError if there is a mismatch). If verify is \b false,
* no hashsum checking will be performed. * no hashsum checking will be performed.
*/ */
void QueueIndexes(bool verify); void QueueIndexes(bool verify);
public: public:
// Specialized action members // Specialized action members
virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf); virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
virtual void Done(string Message,unsigned long Size, string Hash, virtual void Done(std::string Message,unsigned long long Size, std::stri
ng Hash,
pkgAcquire::MethodConfig *Cnf); pkgAcquire::MethodConfig *Cnf);
virtual string Custom600Headers(); virtual std::string Custom600Headers();
virtual string DescURI() {return RealURI; }; virtual std::string DescURI() {return RealURI; };
/** \brief Create a new pkgAcqMetaIndex. */ /** \brief Create a new pkgAcqMetaIndex. */
pkgAcqMetaIndex(pkgAcquire *Owner, pkgAcqMetaIndex(pkgAcquire *Owner,
string URI,string URIDesc, string ShortDesc, std::string URI,std::string URIDesc, std::string ShortDes
string SigFile, c,
const vector<struct IndexTarget*>* IndexTargets, std::string SigFile,
const std::vector<struct IndexTarget*>* IndexTargets,
indexRecords* MetaIndexParser); indexRecords* MetaIndexParser);
}; };
/*}} }*/ /*}} }*/
/** \brief An item repsonsible for downloading clearsigned metaindexes {{{* / /** \brief An item repsonsible for downloading clearsigned metaindexes {{{* /
class pkgAcqMetaClearSig : public pkgAcqMetaIndex class pkgAcqMetaClearSig : public pkgAcqMetaIndex
{ {
/** \brief The URI of the meta-index file for the detached signature */ /** \brief The URI of the meta-index file for the detached signature */
string MetaIndexURI; std::string MetaIndexURI;
/** \brief A "URI-style" description of the meta-index file */ /** \brief A "URI-style" description of the meta-index file */
string MetaIndexURIDesc; std::string MetaIndexURIDesc;
/** \brief A brief description of the meta-index file */ /** \brief A brief description of the meta-index file */
string MetaIndexShortDesc; std::string MetaIndexShortDesc;
/** \brief The URI of the detached meta-signature file if the clearsigne d one failed. */ /** \brief The URI of the detached meta-signature file if the clearsigne d one failed. */
string MetaSigURI; std::string MetaSigURI;
/** \brief A "URI-style" description of the meta-signature file */ /** \brief A "URI-style" description of the meta-signature file */
string MetaSigURIDesc; std::string MetaSigURIDesc;
/** \brief A brief description of the meta-signature file */ /** \brief A brief description of the meta-signature file */
string MetaSigShortDesc; std::string MetaSigShortDesc;
public: public:
void Failed(string Message,pkgAcquire::MethodConfig *Cnf); void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
virtual string Custom600Headers(); virtual std::string Custom600Headers();
/** \brief Create a new pkgAcqMetaClearSig. */ /** \brief Create a new pkgAcqMetaClearSig. */
pkgAcqMetaClearSig(pkgAcquire *Owner, pkgAcqMetaClearSig(pkgAcquire *Owner,
string const &URI, string const &URIDesc, string const &Shor std::string const &URI, std::string const &URIDesc, std::str
tDesc, ing const &ShortDesc,
string const &MetaIndexURI, string const &MetaIndexURIDesc, std::string const &MetaIndexURI, std::string const &MetaInde
string const &MetaIndexShortDesc, xURIDesc, std::string const &MetaIndexShortDesc,
string const &MetaSigURI, string const &MetaSigURIDesc, stri std::string const &MetaSigURI, std::string const &MetaSigURI
ng const &MetaSigShortDesc, Desc, std::string const &MetaSigShortDesc,
const vector<struct IndexTarget*>* IndexTargets, const std::vector<struct IndexTarget*>* IndexTargets,
indexRecords* MetaIndexParser); indexRecords* MetaIndexParser);
}; };
/*}} }*/ /*}} }*/
/** \brief An item that is responsible for fetching a package file. {{{ /** \brief An item that is responsible for fetching a package file. {{{
* *
* If the package file already exists in the cache, nothing will be * If the package file already exists in the cache, nothing will be
* done. * done.
*/ */
class pkgAcqArchive : public pkgAcquire::Item class pkgAcqArchive : public pkgAcquire::Item
{ {
skipping to change at line 896 skipping to change at line 937
* corresponding to each version of the package. * corresponding to each version of the package.
*/ */
pkgRecords *Recs; pkgRecords *Recs;
/** \brief The hashsum of this package. */ /** \brief The hashsum of this package. */
HashString ExpectedHash; HashString ExpectedHash;
/** \brief A location in which the actual filename of the package /** \brief A location in which the actual filename of the package
* should be stored. * should be stored.
*/ */
string &StoreFilename; std::string &StoreFilename;
/** \brief The next file for this version to try to download. */ /** \brief The next file for this version to try to download. */
pkgCache::VerFileIterator Vf; pkgCache::VerFileIterator Vf;
/** \brief How many (more) times to try to find a new source from /** \brief How many (more) times to try to find a new source from
* which to download this package version if it fails. * which to download this package version if it fails.
* *
* Set from Acquire::Retries. * Set from Acquire::Retries.
*/ */
unsigned int Retries; unsigned int Retries;
skipping to change at line 918 skipping to change at line 959
/** \brief \b true if this version file is being downloaded from a /** \brief \b true if this version file is being downloaded from a
* trusted source. * trusted source.
*/ */
bool Trusted; bool Trusted;
/** \brief Queue up the next available file for this version. */ /** \brief Queue up the next available file for this version. */
bool QueueNext(); bool QueueNext();
public: public:
virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf); virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
virtual void Done(string Message,unsigned long Size,string Hash, virtual void Done(std::string Message,unsigned long long Size,std::strin
g Hash,
pkgAcquire::MethodConfig *Cnf); pkgAcquire::MethodConfig *Cnf);
virtual string DescURI() {return Desc.URI;}; virtual std::string DescURI() {return Desc.URI;};
virtual string ShortDesc() {return Desc.ShortDesc;}; virtual std::string ShortDesc() {return Desc.ShortDesc;};
virtual void Finished(); virtual void Finished();
virtual string HashSum() {return ExpectedHash.toStr(); }; virtual std::string HashSum() {return ExpectedHash.toStr(); };
virtual bool IsTrusted(); virtual bool IsTrusted();
/** \brief Create a new pkgAcqArchive. /** \brief Create a new pkgAcqArchive.
* *
* \param Owner The pkgAcquire object with which this item is * \param Owner The pkgAcquire object with which this item is
* associated. * associated.
* *
* \param Sources The sources from which to download version * \param Sources The sources from which to download version
* files. * files.
* *
skipping to change at line 947 skipping to change at line 988
* *
* \param Version The package version to download. * \param Version The package version to download.
* *
* \param StoreFilename A location in which the actual filename of * \param StoreFilename A location in which the actual filename of
* the package should be stored. It will be set to a guessed * the package should be stored. It will be set to a guessed
* basename in the constructor, and filled in with a fully * basename in the constructor, and filled in with a fully
* qualified filename once the download finishes. * qualified filename once the download finishes.
*/ */
pkgAcqArchive(pkgAcquire *Owner,pkgSourceList *Sources, pkgAcqArchive(pkgAcquire *Owner,pkgSourceList *Sources,
pkgRecords *Recs,pkgCache::VerIterator const &Version, pkgRecords *Recs,pkgCache::VerIterator const &Version,
string &StoreFilename); std::string &StoreFilename);
}; };
/*}} }*/ /*}} }*/
/** \brief Retrieve an arbitrary file to the current directory. {{{ /** \brief Retrieve an arbitrary file to the current directory. {{{
* *
* The file is retrieved even if it is accessed via a URL type that * The file is retrieved even if it is accessed via a URL type that
* normally is a NOP, such as "file". If the download fails, the * normally is a NOP, such as "file". If the download fails, the
* partial file is renamed to get a ".FAILED" extension. * partial file is renamed to get a ".FAILED" extension.
*/ */
class pkgAcqFile : public pkgAcquire::Item class pkgAcqFile : public pkgAcquire::Item
{ {
skipping to change at line 975 skipping to change at line 1016
* Acquire::Retries. * Acquire::Retries.
*/ */
unsigned int Retries; unsigned int Retries;
/** \brief Should this file be considered a index file */ /** \brief Should this file be considered a index file */
bool IsIndexFile; bool IsIndexFile;
public: public:
// Specialized action members // Specialized action members
virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf); virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
virtual void Done(string Message,unsigned long Size,string CalcHash, virtual void Done(std::string Message,unsigned long long Size,std::strin
g CalcHash,
pkgAcquire::MethodConfig *Cnf); pkgAcquire::MethodConfig *Cnf);
virtual string DescURI() {return Desc.URI;}; virtual std::string DescURI() {return Desc.URI;};
virtual string HashSum() {return ExpectedHash.toStr(); }; virtual std::string HashSum() {return ExpectedHash.toStr(); };
virtual string Custom600Headers(); virtual std::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 1013 skipping to change at line 1054
* *
* \param IsIndexFile The file is considered a IndexFile and cache-cont rol * \param IsIndexFile The file is considered a IndexFile and cache-cont rol
* headers like "cache-control: max-age=0" are send * 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 pkgAcqFile(pkgAcquire *Owner, std::string URI, std::string Hash, unsigne
e, d long long Size,
string Desc, string ShortDesc, std::string Desc, std::string ShortDesc,
const string &DestDir="", const string &DestFilename="", const std::string &DestDir="", const std::string &DestFilename
="",
bool IsIndexFile=false); bool IsIndexFile=false);
}; };
/*}} }*/ /*}} }*/
/** @} */ /** @} */
#endif #endif
 End of changes. 87 change blocks. 
128 lines changed or deleted 183 lines changed or added


 acquire-method.h   acquire-method.h 
skipping to change at line 23 skipping to change at line 23
/** \addtogroup acquire /** \addtogroup acquire
* @{ * @{
* *
* \file acquire-method.h * \file acquire-method.h
*/ */
#ifndef PKGLIB_ACQUIRE_METHOD_H #ifndef PKGLIB_ACQUIRE_METHOD_H
#define PKGLIB_ACQUIRE_METHOD_H #define PKGLIB_ACQUIRE_METHOD_H
#include <stdarg.h>
#include <string>
#include <vector>
#ifndef APT_8_CLEANER_HEADERS
#include <apt-pkg/configuration.h> #include <apt-pkg/configuration.h>
#include <apt-pkg/strutl.h> #include <apt-pkg/strutl.h>
#endif
#include <stdarg.h>
class Hashes; class Hashes;
class pkgAcqMethod class pkgAcqMethod
{ {
protected: protected:
struct FetchItem struct FetchItem
{ {
FetchItem *Next; FetchItem *Next;
string Uri; std::string Uri;
string DestFile; std::string DestFile;
time_t LastModified; time_t LastModified;
bool IndexFile; bool IndexFile;
bool FailIgnore; bool FailIgnore;
}; };
struct FetchResult struct FetchResult
{ {
string MD5Sum; std::string MD5Sum;
string SHA1Sum; std::string SHA1Sum;
string SHA256Sum; std::string SHA256Sum;
vector<string> GPGVOutput; std::string SHA512Sum;
std::vector<std::string> GPGVOutput;
time_t LastModified; time_t LastModified;
bool IMSHit; bool IMSHit;
string Filename; std::string Filename;
unsigned long Size; unsigned long long Size;
unsigned long ResumePoint; unsigned long long ResumePoint;
void TakeHashes(Hashes &Hash); void TakeHashes(Hashes &Hash);
FetchResult(); FetchResult();
}; };
// State // State
vector<string> Messages; std::vector<std::string> Messages;
FetchItem *Queue; FetchItem *Queue;
FetchItem *QueueBack; FetchItem *QueueBack;
string FailReason; std::string FailReason;
string UsedMirror; std::string UsedMirror;
string IP; std::string IP;
// Handlers for messages // Handlers for messages
virtual bool Configuration(string Message); virtual bool Configuration(std::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 inline void Fail(const char *Why, bool Transient = false) {Fail(std::str
hy),Transient);}; ing(Why),Transient);};
virtual void Fail(string Why, bool Transient = false); virtual void Fail(std::string Why, bool Transient = false);
virtual void URIStart(FetchResult &Res); virtual void URIStart(FetchResult &Res);
virtual void URIDone(FetchResult &Res,FetchResult *Alt = 0); virtual void URIDone(FetchResult &Res,FetchResult *Alt = 0);
bool MediaFail(string Required,string Drive); bool MediaFail(std::string Required,std::string Drive);
virtual void Exit() {}; virtual void Exit() {};
void PrintStatus(char const * const header, const char* Format, va_list &args) const; void PrintStatus(char const * const header, const char* Format, va_list &args) const;
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 std::string &NewURI);
int Run(bool Single = false); int Run(bool Single = false);
inline void SetFailReason(string Msg) {FailReason = Msg;}; inline void SetFailReason(std::string Msg) {FailReason = Msg;};
inline void SetIP(string aIP) {IP = aIP;}; inline void SetIP(std::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. 12 change blocks. 
23 lines changed or deleted 29 lines changed or added


 acquire-worker.h   acquire-worker.h 
skipping to change at line 46 skipping to change at line 46
* 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 : public WeakPointable class pkgAcquire::Worker : public WeakPointable
{ {
/** \brief dpointer placeholder (for later in case we need it) */
void *d;
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?
*/ */
Worker *NextQueue; Worker *NextQueue;
skipping to change at line 78 skipping to change at line 81
/** \brief The configuration of this method. On startup, the /** \brief The configuration of this method. On startup, the
* target of this pointer is filled in with basic data about the * target of this pointer is filled in with basic data about the
* method, as reported by the worker. * method, as reported by the worker.
*/ */
MethodConfig *Config; MethodConfig *Config;
/** \brief The access method to be used by this worker. /** \brief The access method to be used by this worker.
* *
* \todo Doesn't this duplicate Config->Access? * \todo Doesn't this duplicate Config->Access?
*/ */
string Access; std::string Access;
/** \brief The PID of the subprocess. */ /** \brief The PID of the subprocess. */
pid_t Process; pid_t Process;
/** \brief A file descriptor connected to the standard output of /** \brief A file descriptor connected to the standard output of
* the subprocess. * the subprocess.
* *
* Used to read messages and data from the subprocess. * Used to read messages and data from the subprocess.
*/ */
int InFd; int InFd;
skipping to change at line 117 skipping to change at line 120
* \todo Is this right? * \todo Is this right?
*/ */
bool OutReady; bool OutReady;
/** If \b true, debugging output will be sent to std::clog. */ /** If \b true, debugging output will be sent to std::clog. */
bool Debug; bool Debug;
/** \brief The raw text values of messages received from the /** \brief The raw text values of messages received from the
* worker, in sequence. * worker, in sequence.
*/ */
vector<string> MessageQueue; std::vector<std::string> MessageQueue;
/** \brief Buffers pending writes to the subprocess. /** \brief Buffers pending writes to the subprocess.
* *
* \todo Wouldn't a std::dequeue be more appropriate? * \todo Wouldn't a std::dequeue be more appropriate?
*/ */
string OutQueue; std::string OutQueue;
/** \brief Common code for the constructor. /** \brief Common code for the constructor.
* *
* Initializes NextQueue and NextAcquire to NULL; Process, InFd, * Initializes NextQueue and NextAcquire to NULL; Process, InFd,
* and OutFd to -1, OutReady and InReady to \b false, and Debug * and OutFd to -1, OutReady and InReady to \b false, and Debug
* from _config. * from _config.
*/ */
void Construct(); void Construct();
/** \brief Retrieve any available messages from the subprocess. /** \brief Retrieve any available messages from the subprocess.
skipping to change at line 182 skipping to change at line 185
/** \brief Handle a 100 Capabilities response from the subprocess. /** \brief Handle a 100 Capabilities response from the subprocess.
* *
* \param Message the raw text of the message from the subprocess. * \param Message the raw text of the message from the subprocess.
* *
* The message will be parsed and its contents used to fill * The message will be parsed and its contents used to fill
* #Config. If #Config is NULL, this routine is a NOP. * #Config. If #Config is NULL, this routine is a NOP.
* *
* \return \b true. * \return \b true.
*/ */
bool Capabilities(string Message); bool Capabilities(std::string Message);
/** \brief Send a 601 Configuration message (containing the APT /** \brief Send a 601 Configuration message (containing the APT
* configuration) to the subprocess. * configuration) to the subprocess.
* *
* The APT configuration will be send to the subprocess in a * The APT configuration will be send to the subprocess in a
* message of the following form: * message of the following form:
* *
* <pre> * <pre>
* 601 Configuration * 601 Configuration
* Config-Item: Fully-Qualified-Item=Val * Config-Item: Fully-Qualified-Item=Val
skipping to change at line 213 skipping to change at line 216
* *
* \param Message the raw text of the message; the Media field * \param Message the raw text of the message; the Media field
* indicates what type of media should be changed, and the Drive * indicates what type of media should be changed, and the Drive
* field indicates where the media is located. * field indicates where the media is located.
* *
* Invokes pkgAcquireStatus::MediaChange(Media, Drive) to ask the * Invokes pkgAcquireStatus::MediaChange(Media, Drive) to ask the
* user to swap disks; informs the subprocess of the result (via * user to swap disks; informs the subprocess of the result (via
* 603 Media Changed, with the Failed field set to \b true if the * 603 Media Changed, with the Failed field set to \b true if the
* user cancelled the media change). * user cancelled the media change).
*/ */
bool MediaChange(string Message); bool MediaChange(std::string Message);
/** \brief Invoked when the worked process dies unexpectedly. /** \brief Invoked when the worked process dies unexpectedly.
* *
* Waits for the subprocess to terminate and generates an error if * Waits for the subprocess to terminate and generates an error if
* it terminated abnormally, then closes and blanks out all file * it terminated abnormally, then closes and blanks out all file
* descriptors. Discards all pending messages from the * descriptors. Discards all pending messages from the
* subprocess. * subprocess.
* *
* \return \b false. * \return \b false.
*/ */
skipping to change at line 241 skipping to change at line 244
void ItemDone(); void ItemDone();
public: public:
/** \brief The queue entry that is currently being downloaded. */ /** \brief The queue entry that is currently being downloaded. */
pkgAcquire::Queue::QItem *CurrentItem; pkgAcquire::Queue::QItem *CurrentItem;
/** \brief The most recent status string received from the /** \brief The most recent status string received from the
* subprocess. * subprocess.
*/ */
string Status; std::string Status;
/** \brief How many bytes of the file have been downloaded. Zero /** \brief How many bytes of the file have been downloaded. Zero
* if the current progress of the file cannot be determined. * if the current progress of the file cannot be determined.
*/ */
unsigned long CurrentSize; unsigned long long CurrentSize;
/** \brief The total number of bytes to be downloaded. Zero if the /** \brief The total number of bytes to be downloaded. Zero if the
* total size of the final is unknown. * total size of the final is unknown.
*/ */
unsigned long TotalSize; unsigned long long TotalSize;
/** \brief How much of the file was already downloaded prior to /** \brief How much of the file was already downloaded prior to
* starting this worker. * starting this worker.
*/ */
unsigned long ResumePoint; unsigned long long ResumePoint;
/** \brief Tell the subprocess to download the given item. /** \brief Tell the subprocess to download the given item.
* *
* \param Item the item to queue up. * \param Item the item to queue up.
* \return \b true if the item was successfully enqueued. * \return \b true if the item was successfully enqueued.
* *
* Queues up a 600 URI Acquire message for the given item to be * Queues up a 600 URI Acquire message for the given item to be
* sent at the next possible moment. Does \e not flush the output * sent at the next possible moment. Does \e not flush the output
* queue. * queue.
*/ */
skipping to change at line 316 skipping to change at line 319
* \param Config A location in which to store information about * \param Config A location in which to store information about
* the fetch method. * the fetch method.
*/ */
Worker(MethodConfig *Config); Worker(MethodConfig *Config);
/** \brief Clean up this worker. /** \brief Clean up this worker.
* *
* Closes the file descriptors; if MethodConfig::NeedsCleanup is * Closes the file descriptors; if MethodConfig::NeedsCleanup is
* \b false, also rudely interrupts the worker with a SIGINT. * \b false, also rudely interrupts the worker with a SIGINT.
*/ */
~Worker(); virtual ~Worker();
}; };
/** @} */ /** @} */
#endif #endif
 End of changes. 11 change blocks. 
10 lines changed or deleted 13 lines changed or added


 acquire.h   acquire.h 
skipping to change at line 75 skipping to change at line 75
#ifndef PKGLIB_ACQUIRE_H #ifndef PKGLIB_ACQUIRE_H
#define PKGLIB_ACQUIRE_H #define PKGLIB_ACQUIRE_H
#include <apt-pkg/macros.h> #include <apt-pkg/macros.h>
#include <apt-pkg/weakptr.h> #include <apt-pkg/weakptr.h>
#include <vector> #include <vector>
#include <string> #include <string>
using std::vector;
using std::string;
#include <sys/time.h> #include <sys/time.h>
#include <unistd.h> #include <unistd.h>
#ifndef APT_8_CLEANER_HEADERS
using std::vector;
using std::string;
#endif
class pkgAcquireStatus; class pkgAcquireStatus;
/** \brief The core download scheduler. {{{ /** \brief The core download scheduler. {{{
* *
* This class represents an ongoing download. It manages the lists * This class represents an ongoing download. It manages the lists
* of active and pending downloads and handles setting up and tearing * of active and pending downloads and handles setting up and tearing
* down download-related structures. * down download-related structures.
* *
* \todo Why all the protected data items and methods? * \todo Why all the protected data items and methods?
*/ */
class pkgAcquire class pkgAcquire
{ {
private:
/** \brief FD of the Lock file we acquire in Setup (if any) */
int LockFD;
/** \brief dpointer placeholder (for later in case we need it) */
void *d;
public: public:
class Item; class Item;
class Queue; class Queue;
class Worker; class Worker;
struct MethodConfig; struct MethodConfig;
struct ItemDesc; struct ItemDesc;
friend class Item; friend class Item;
friend class Queue; friend class Queue;
typedef vector<Item *>::iterator ItemIterator; typedef std::vector<Item *>::iterator ItemIterator;
typedef vector<Item *>::const_iterator ItemCIterator; typedef std::vector<Item *>::const_iterator ItemCIterator;
protected: protected:
/** \brief A list of items to download. /** \brief A list of items to download.
* *
* This is built monotonically as items are created and only * This is built monotonically as items are created and only
* emptied when the download shuts down. * emptied when the download shuts down.
*/ */
vector<Item *> Items; std::vector<Item *> Items;
/** \brief The head of the list of active queues. /** \brief The head of the list of active queues.
* *
* \todo why a hand-managed list of queues instead of std::list or * \todo why a hand-managed list of queues instead of std::list or
* std::set? * std::set?
*/ */
Queue *Queues; Queue *Queues;
/** \brief The head of the list of active workers. /** \brief The head of the list of active workers.
* *
skipping to change at line 144 skipping to change at line 152
* string output by a method on startup (see * string output by a method on startup (see
* pkgAcqMethod::pkgAcqMethod and pkgAcquire::GetConfig). * pkgAcqMethod::pkgAcqMethod and pkgAcquire::GetConfig).
* *
* \todo why a hand-managed config dictionary instead of std::map? * \todo why a hand-managed config dictionary instead of std::map?
*/ */
MethodConfig *Configs; MethodConfig *Configs;
/** \brief The progress indicator for this download. */ /** \brief The progress indicator for this download. */
pkgAcquireStatus *Log; pkgAcquireStatus *Log;
/** \brief The total size of the files which are to be fetched. /** \brief The number of files which are to be fetched. */
*
* This is not necessarily the total number of bytes to download
* when, e.g., download resumption and list updates via patches
* are taken into account.
*/
unsigned long ToFetch; unsigned long ToFetch;
// Configurable parameters for the scheduler // Configurable parameters for the scheduler
/** \brief Represents the queuing strategy for remote URIs. */ /** \brief Represents the queuing strategy for remote URIs. */
enum QueueStrategy { enum QueueStrategy {
/** \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,
skipping to change at line 203 skipping to change at line 206
/** \brief Determine the fetch method and queue of a URI. /** \brief Determine the fetch method and queue of a URI.
* *
* \param URI The URI to fetch. * \param URI The URI to fetch.
* *
* \param[out] Config A location in which to place the method via * \param[out] Config A location in which to place the method via
* which the URI is to be fetched. * which the URI is to be fetched.
* *
* \return the string-name of the queue in which a fetch request * \return the string-name of the queue in which a fetch request
* for the given URI should be placed. * for the given URI should be placed.
*/ */
string QueueName(string URI,MethodConfig const *&Config); std::string QueueName(std::string URI,MethodConfig const *&Config);
/** \brief Build up the set of file descriptors upon which select() shou ld /** \brief Build up the set of file descriptors upon which select() shou ld
* block. * block.
* *
* The default implementation inserts the file descriptors * The default implementation inserts the file descriptors
* corresponding to active downloads. * corresponding to active downloads.
* *
* \param[out] Fd The largest file descriptor in the generated sets. * \param[out] Fd The largest file descriptor in the generated sets.
* *
* \param[out] RSet The set of file descriptors that should be * \param[out] RSet The set of file descriptors that should be
skipping to change at line 249 skipping to change at line 252
void Bump(); void Bump();
public: public:
/** \brief Retrieve information about a fetch method by name. /** \brief Retrieve information about a fetch method by name.
* *
* \param Access The name of the method to look up. * \param Access The name of the method to look up.
* *
* \return the method whose name is Access, or \b NULL if no such metho d exists. * \return the method whose name is Access, or \b NULL if no such metho d exists.
*/ */
MethodConfig *GetConfig(string Access); MethodConfig *GetConfig(std::string Access);
/** \brief Provides information on how a download terminated. */ /** \brief Provides information on how a download terminated. */
enum RunResult { enum RunResult {
/** \brief All files were fetched successfully. */ /** \brief All files were fetched successfully. */
Continue, Continue,
/** \brief Some files failed to download. */ /** \brief Some files failed to download. */
Failed, Failed,
/** \brief The download was cancelled by the user (i.e., #Log's /** \brief The download was cancelled by the user (i.e., #Log's
skipping to change at line 320 skipping to change at line 323
UriIterator UriEnd(); UriIterator UriEnd();
/** Deletes each entry in the given directory that is not being /** Deletes each entry in the given directory that is not being
* downloaded by this object. For instance, when downloading new * downloaded by this object. For instance, when downloading new
* list files, calling Clean() will delete the old ones. * list files, calling Clean() will delete the old ones.
* *
* \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(std::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.
*/ */
unsigned long long 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.
*/ */
unsigned long long FetchNeeded(); unsigned long long FetchNeeded();
skipping to change at line 348 skipping to change at line 351
* *
* \param Progress indicator associated with this download or * \param Progress indicator associated with this 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 * \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 * only one Acquire class is in action at the time or an empty string
* if no lock file should be used. * if no lock file should be used.
*/ */
bool Setup(pkgAcquireStatus *Progress = NULL, string const &Lock = ""); bool Setup(pkgAcquireStatus *Progress = NULL, std::string const &Lock = "");
void SetLog(pkgAcquireStatus *Progress) { Log = Progress; } void SetLog(pkgAcquireStatus *Progress) { Log = Progress; }
/** \brief Construct a new pkgAcquire. */ /** \brief Construct a new pkgAcquire. */
pkgAcquire(pkgAcquireStatus *Log) __deprecated; pkgAcquire(pkgAcquireStatus *Log) __deprecated;
pkgAcquire(); 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 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 : public WeakPointable 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; std::string URI;
/** brief A description of this item. */ /** brief A description of this item. */
string Description; std::string Description;
/** brief A shorter description of this item. */ /** brief A shorter description of this item. */
string ShortDesc; std::string ShortDesc;
/** brief The underlying item which is to be downloaded. */ /** brief The underlying item which is to be downloaded. */
Item *Owner; Item *Owner;
}; };
/*}} }*/ /*}} }*/
/** \brief A single download queue in a pkgAcquire object. {{{ /** \brief A single download queue in a pkgAcquire object. {{{
* *
* \todo Why so many protected values? * \todo Why so many protected values?
*/ */
class pkgAcquire::Queue class pkgAcquire::Queue
{ {
friend class pkgAcquire; friend class pkgAcquire;
friend class pkgAcquire::UriIterator; friend class pkgAcquire::UriIterator;
friend class pkgAcquire::Worker; friend class pkgAcquire::Worker;
/** \brief dpointer placeholder (for later in case we need it) */
void *d;
/** \brief The next queue in the pkgAcquire object's list of queues. */ /** \brief The next queue in the pkgAcquire object's list of queues. */
Queue *Next; Queue *Next;
protected: protected:
/** \brief A single item placed in this queue. */ /** \brief A single item placed in this queue. */
struct QItem : pkgAcquire::ItemDesc struct QItem : pkgAcquire::ItemDesc
{ {
/** \brief The next item in the queue. */ /** \brief The next item in the queue. */
QItem *Next; QItem *Next;
skipping to change at line 421 skipping to change at line 424
void operator =(pkgAcquire::ItemDesc const &I) void operator =(pkgAcquire::ItemDesc const &I)
{ {
URI = I.URI; URI = I.URI;
Description = I.Description; Description = I.Description;
ShortDesc = I.ShortDesc; ShortDesc = I.ShortDesc;
Owner = I.Owner; Owner = I.Owner;
}; };
}; };
/** \brief The name of this queue. */ /** \brief The name of this queue. */
string Name; std::string Name;
/** \brief The head of the list of items contained in this queue. /** \brief The head of the list of items contained in this queue.
* *
* \todo why a by-hand list instead of an STL structure? * \todo why a by-hand list instead of an STL structure?
*/ */
QItem *Items; QItem *Items;
/** \brief The head of the list of workers associated with this queue. /** \brief The head of the list of workers associated with this queue.
* *
* \todo This is plural because support exists in Queue for * \todo This is plural because support exists in Queue for
skipping to change at line 476 skipping to change at line 479
bool Dequeue(Item *Owner); bool Dequeue(Item *Owner);
/** \brief Locate an item in this queue. /** \brief Locate an item in this queue.
* *
* \param URI A URI to match against. * \param URI A URI to match against.
* \param Owner A pkgAcquire::Worker to match against. * \param Owner A pkgAcquire::Worker to match against.
* *
* \return the first item in the queue whose URI is #URI and that * \return the first item in the queue whose URI is #URI and that
* is being downloaded by #Owner. * is being downloaded by #Owner.
*/ */
QItem *FindItem(string URI,pkgAcquire::Worker *Owner); QItem *FindItem(std::string URI,pkgAcquire::Worker *Owner);
/** Presumably this should start downloading an item? /** Presumably this should start downloading an item?
* *
* \todo Unimplemented. Implement it or remove? * \todo Unimplemented. Implement it or remove?
*/ */
bool ItemStart(QItem *Itm,unsigned long Size); bool ItemStart(QItem *Itm,unsigned long long Size);
/** \brief Remove the given item from this queue and set its state /** \brief Remove the given item from this queue and set its state
* to pkgAcquire::Item::StatDone. * to pkgAcquire::Item::StatDone.
* *
* If this is the only queue containing the item, the item is also * If this is the only queue containing the item, the item is also
* removed from the main queue by calling pkgAcquire::Dequeue. * removed from the main queue by calling pkgAcquire::Dequeue.
* *
* \param Itm The item to remove. * \param Itm The item to remove.
* *
* \return \b true if no errors are encountered. * \return \b true if no errors are encountered.
skipping to change at line 539 skipping to change at line 542
* \todo Why both this and Cycle()? Are they expected to be * \todo Why both this and Cycle()? Are they expected to be
* different someday? * different someday?
*/ */
void Bump(); void Bump();
/** \brief Create a new Queue. /** \brief Create a new Queue.
* *
* \param Name The name of the new queue. * \param Name The name of the new queue.
* \param Owner The download process that owns the new queue. * \param Owner The download process that owns the new queue.
*/ */
Queue(string Name,pkgAcquire *Owner); Queue(std::string Name,pkgAcquire *Owner);
/** Shut down all the worker processes associated with this queue /** Shut down all the worker processes associated with this queue
* and empty the queue. * and empty the queue.
*/ */
~Queue(); virtual ~Queue();
}; };
/*}} }*/ /*}} }*/
/** \brief Iterates over all the URIs being fetched by a pkgAcquire object. {{{*/ /** \brief Iterates over all the URIs being fetched by a pkgAcquire object. {{{*/
class pkgAcquire::UriIterator class pkgAcquire::UriIterator
{ {
/** \brief dpointer placeholder (for later in case we need it) */
void *d;
/** The next queue to iterate over. */ /** The next queue to iterate over. */
pkgAcquire::Queue *CurQ; pkgAcquire::Queue *CurQ;
/** The item that we currently point at. */ /** The item that we currently point at. */
pkgAcquire::Queue::QItem *CurItem; pkgAcquire::Queue::QItem *CurItem;
public: public:
inline void operator ++() {operator ++(0);}; inline void operator ++() {operator ++(0);};
void operator ++(int) void operator ++(int)
skipping to change at line 585 skipping to change at line 591
* \param Q The queue over which this UriIterator should iterate. * \param Q The queue over which this UriIterator should iterate.
*/ */
UriIterator(pkgAcquire::Queue *Q) : CurQ(Q), CurItem(0) UriIterator(pkgAcquire::Queue *Q) : CurQ(Q), CurItem(0)
{ {
while (CurItem == 0 && CurQ != 0) while (CurItem == 0 && CurQ != 0)
{ {
CurItem = CurQ->Items; CurItem = CurQ->Items;
CurQ = CurQ->Next; CurQ = CurQ->Next;
} }
} }
virtual ~UriIterator() {};
}; };
/*}} }*/ /*}} }*/
/** \brief Information about the properties of a single acquire method. {{{*/ /** \brief Information about the properties of a single acquire method. {{{*/
struct pkgAcquire::MethodConfig struct pkgAcquire::MethodConfig
{ {
/** \brief dpointer placeholder (for later in case we need it) */
void *d;
/** \brief The next link on the acquire method list. /** \brief The next link on the acquire method list.
* *
* \todo Why not an STL container? * \todo Why not an STL container?
*/ */
MethodConfig *Next; MethodConfig *Next;
/** \brief The name of this acquire method (e.g., http). */ /** \brief The name of this acquire method (e.g., http). */
string Access; std::string Access;
/** \brief The implementation version of this acquire method. */ /** \brief The implementation version of this acquire method. */
string Version; std::string Version;
/** \brief If \b true, only one download queue should be created for thi s /** \brief If \b true, only one download queue should be created for thi s
* method. * method.
*/ */
bool SingleInstance; bool SingleInstance;
/** \brief If \b true, this method supports pipelined downloading. */ /** \brief If \b true, this method supports pipelined downloading. */
bool Pipeline; bool Pipeline;
/** \brief If \b true, the worker process should send the entire /** \brief If \b true, the worker process should send the entire
skipping to change at line 638 skipping to change at line 648
/** \brief If \b true, this fetch method acquires files from removable m edia. */ /** \brief If \b true, this fetch method acquires files from removable m edia. */
bool Removable; bool Removable;
/** \brief Set up the default method parameters. /** \brief Set up the default method parameters.
* *
* All fields are initialized to NULL, "", or \b false as * All fields are initialized to NULL, "", or \b false as
* appropriate. * appropriate.
*/ */
MethodConfig(); MethodConfig();
/* \brief Destructor, empty currently */
virtual ~MethodConfig() {};
}; };
/*}} }*/ /*}} }*/
/** \brief A monitor object for downloads controlled by the pkgAcquire clas s. {{{ /** \brief A monitor object for downloads controlled by the pkgAcquire clas s. {{{
* *
* \todo Why protected members? * \todo Why protected members?
*
* \todo Should the double members be uint64_t?
*/ */
class pkgAcquireStatus class pkgAcquireStatus
{ {
/** \brief dpointer placeholder (for later in case we need it) */
void *d;
protected: protected:
/** \brief The last time at which this monitor object was updated. */ /** \brief The last time at which this monitor object was updated. */
struct timeval Time; struct timeval Time;
/** \brief The time at which the download started. */ /** \brief The time at which the download started. */
struct timeval StartTime; struct timeval StartTime;
/** \brief The number of bytes fetched as of the previous call to /** \brief The number of bytes fetched as of the previous call to
* pkgAcquireStatus::Pulse, including local items. * pkgAcquireStatus::Pulse, including local items.
*/ */
double LastBytes; unsigned long long LastBytes;
/** \brief The current rate of download as of the most recent call /** \brief The current rate of download as of the most recent call
* to pkgAcquireStatus::Pulse, in bytes per second. * to pkgAcquireStatus::Pulse, in bytes per second.
*/ */
double CurrentCPS; unsigned long long CurrentCPS;
/** \brief The number of bytes fetched as of the most recent call /** \brief The number of bytes fetched as of the most recent call
* to pkgAcquireStatus::Pulse, including local items. * to pkgAcquireStatus::Pulse, including local items.
*/ */
double CurrentBytes; unsigned long long CurrentBytes;
/** \brief The total number of bytes that need to be fetched. /** \brief The total number of bytes that need to be fetched.
* *
* \warning This member is inaccurate, as new items might be * \warning This member is inaccurate, as new items might be
* enqueued while the download is in progress! * enqueued while the download is in progress!
*/ */
double TotalBytes; unsigned long long TotalBytes;
/** \brief The total number of bytes accounted for by items that /** \brief The total number of bytes accounted for by items that
* were successfully fetched. * were successfully fetched.
*/ */
double FetchedBytes; unsigned long long FetchedBytes;
/** \brief The amount of time that has elapsed since the download /** \brief The amount of time that has elapsed since the download
* started. * started.
*/ */
unsigned long ElapsedTime; unsigned long long ElapsedTime;
/** \brief The total number of items that need to be fetched. /** \brief The total number of items that need to be fetched.
* *
* \warning This member is inaccurate, as new items might be * \warning This member is inaccurate, as new items might be
* enqueued while the download is in progress! * enqueued while the download is in progress!
*/ */
unsigned long TotalItems; unsigned long TotalItems;
/** \brief The number of items that have been successfully downloaded. * / /** \brief The number of items that have been successfully downloaded. * /
unsigned long CurrentItems; unsigned long CurrentItems;
skipping to change at line 719 skipping to change at line 733
* terminates with an error. * terminates with an error.
*/ */
bool MorePulses; bool MorePulses;
/** \brief Invoked when a local or remote file has been completely fetch ed. /** \brief Invoked when a local or remote file has been completely fetch ed.
* *
* \param Size The size of the file fetched. * \param Size The size of the file fetched.
* *
* \param ResumePoint How much of the file was already fetched. * \param ResumePoint How much of the file was already fetched.
*/ */
virtual void Fetched(unsigned long Size,unsigned long ResumePoint); virtual void Fetched(unsigned long long Size,unsigned long long ResumePo int);
/** \brief Invoked when the user should be prompted to change the /** \brief Invoked when the user should be prompted to change the
* inserted removable media. * inserted removable media.
* *
* This method should not return until the user has confirmed to * This method should not return until the user has confirmed to
* the user interface that the media change is complete. * the user interface that the media change is complete.
* *
* \param Media The name of the media type that should be changed. * \param Media The name of the media type that should be changed.
* *
* \param Drive The identifying name of the drive whose media * \param Drive The identifying name of the drive whose media
* should be changed. * should be changed.
* *
* \return \b true if the user confirms the media change, \b * \return \b true if the user confirms the media change, \b
* false if it is cancelled. * false if it is cancelled.
* *
* \todo This is a horrible blocking monster; it should be CPSed * \todo This is a horrible blocking monster; it should be CPSed
* with prejudice. * with prejudice.
*/ */
virtual bool MediaChange(string Media,string Drive) = 0; virtual bool MediaChange(std::string Media,std::string Drive) = 0;
/** \brief Invoked when an item is confirmed to be up-to-date. /** \brief Invoked when an item is confirmed to be up-to-date.
* For instance, when an HTTP download is informed that the file on * For instance, when an HTTP download is informed that the file on
* the server was not modified. * the server was not modified.
*/ */
virtual void IMSHit(pkgAcquire::ItemDesc &/*Itm*/) {}; virtual void IMSHit(pkgAcquire::ItemDesc &/*Itm*/) {};
/** \brief Invoked when some of an item's data is fetched. */ /** \brief Invoked when some of an item's data is fetched. */
virtual void Fetch(pkgAcquire::ItemDesc &/*Itm*/) {}; virtual void Fetch(pkgAcquire::ItemDesc &/*Itm*/) {};
 End of changes. 36 change blocks. 
39 lines changed or deleted 53 lines changed or added


 algorithms.h   algorithms.h 
skipping to change at line 35 skipping to change at line 35
maximizing the number of install state packages while having no broken maximizing the number of install state packages while having no broken
packages. packages.
##################################################################### */ ##################################################################### */
/*}} }*/ /*}} }*/
#ifndef PKGLIB_ALGORITHMS_H #ifndef PKGLIB_ALGORITHMS_H
#define PKGLIB_ALGORITHMS_H #define PKGLIB_ALGORITHMS_H
#include <apt-pkg/packagemanager.h> #include <apt-pkg/packagemanager.h>
#include <apt-pkg/depcache.h> #include <apt-pkg/depcache.h>
#include <apt-pkg/acquire.h>
#include <iostream> #include <iostream>
#ifndef APT_8_CLEANER_HEADERS
#include <apt-pkg/acquire.h>
using std::ostream; using std::ostream;
#endif
class pkgAcquireStatus;
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:
skipping to change at line 65 skipping to change at line 69
Policy(pkgDepCache *Cache) : Cache(Cache) {}; Policy(pkgDepCache *Cache) : Cache(Cache) {};
}; };
unsigned char *Flags; unsigned char *Flags;
Policy iPolicy; Policy iPolicy;
pkgDepCache Sim; pkgDepCache Sim;
pkgDepCache::ActionGroup group; pkgDepCache::ActionGroup group;
// The Actuall installation implementation // The Actuall installation implementation
virtual bool Install(PkgIterator Pkg,string File); virtual bool Install(PkgIterator Pkg,std::string File);
virtual bool Configure(PkgIterator Pkg); virtual bool Configure(PkgIterator Pkg);
virtual bool Remove(PkgIterator Pkg,bool Purge); virtual bool Remove(PkgIterator Pkg,bool Purge);
private: private:
void ShortBreaks(); void ShortBreaks();
void Describe(PkgIterator iPkg,ostream &out,bool Current,bool Candidate) ; void Describe(PkgIterator iPkg,std::ostream &out,bool Current,bool Candi date);
public: public:
pkgSimulate(pkgDepCache *Cache); pkgSimulate(pkgDepCache *Cache);
}; };
/*}} }*/ /*}} }*/
class pkgProblemResolver /*{{ {*/ class pkgProblemResolver /*{{ {*/
{ {
/** \brief dpointer placeholder (for later in case we need it) */
void *d;
pkgDepCache &Cache; pkgDepCache &Cache;
typedef pkgCache::PkgIterator PkgIterator; typedef pkgCache::PkgIterator PkgIterator;
typedef pkgCache::VerIterator VerIterator; typedef pkgCache::VerIterator VerIterator;
typedef pkgCache::DepIterator DepIterator; typedef pkgCache::DepIterator DepIterator;
typedef pkgCache::PrvIterator PrvIterator; typedef pkgCache::PrvIterator PrvIterator;
typedef pkgCache::Version Version; typedef pkgCache::Version Version;
typedef pkgCache::Package Package; typedef pkgCache::Package Package;
enum Flags {Protected = (1 << 0), PreInstalled = (1 << 1), enum Flags {Protected = (1 << 0), PreInstalled = (1 << 1),
Upgradable = (1 << 2), ReInstateTried = (1 << 3), Upgradable = (1 << 2), ReInstateTried = (1 << 3),
ToRemove = (1 << 4)}; ToRemove = (1 << 4)};
signed short *Scores; int *Scores;
unsigned char *Flags; unsigned char *Flags;
bool Debug; bool Debug;
// Sort stuff // Sort stuff
static pkgProblemResolver *This; static pkgProblemResolver *This;
static int ScoreSort(const void *a,const void *b); static int ScoreSort(const void *a,const void *b);
struct PackageKill struct PackageKill
{ {
PkgIterator Pkg; PkgIterator Pkg;
DepIterator Dep; DepIterator Dep;
}; };
void MakeScores(); void MakeScores();
bool DoUpgrade(pkgCache::PkgIterator Pkg); bool DoUpgrade(pkgCache::PkgIterator Pkg);
bool ResolveInternal(bool const BrokenFix = false);
bool ResolveByKeepInternal();
protected: protected:
bool InstOrNewPolicyBroken(pkgCache::PkgIterator Pkg); bool InstOrNewPolicyBroken(pkgCache::PkgIterator Pkg);
public: public:
inline void Protect(pkgCache::PkgIterator Pkg) {Flags[Pkg->ID] |= Protec ted; Cache.MarkProtected(Pkg);}; inline void Protect(pkgCache::PkgIterator Pkg) {Flags[Pkg->ID] |= Protec ted; Cache.MarkProtected(Pkg);};
inline void Remove(pkgCache::PkgIterator Pkg) {Flags[Pkg->ID] |= ToRemov e;}; inline void Remove(pkgCache::PkgIterator Pkg) {Flags[Pkg->ID] |= ToRemov e;};
inline void Clear(pkgCache::PkgIterator Pkg) {Flags[Pkg->ID] &= ~(Protec ted | ToRemove);}; inline void Clear(pkgCache::PkgIterator Pkg) {Flags[Pkg->ID] &= ~(Protec ted | ToRemove);};
// Try to intelligently resolve problems by installing and removing pack ages // Try to intelligently resolve problems by installing and removing pack ages
 End of changes. 8 change blocks. 
4 lines changed or deleted 14 lines changed or added


 arfile.h   arfile.h 
skipping to change at line 19 skipping to change at line 19
stream access to a single member at a time. Basically all this class stream access to a single member at a time. Basically all this class
provides is header parsing and verification. It is up to the client provides is header parsing and verification. It is up to the client
to correctly make use of the stream start/stop points. to correctly make use of the stream start/stop points.
##################################################################### */ ##################################################################### */
/*}} }*/ /*}} }*/
#ifndef PKGLIB_ARFILE_H #ifndef PKGLIB_ARFILE_H
#define PKGLIB_ARFILE_H #define PKGLIB_ARFILE_H
#include <string> #include <string>
#ifndef APT_8_CLEANER_HEADERS
#include <apt-pkg/fileutl.h> #include <apt-pkg/fileutl.h>
#endif
class FileFd;
class ARArchive class ARArchive
{ {
struct MemberHeader; struct MemberHeader;
public: public:
struct Member; struct Member;
protected: protected:
// Linked list of members // Linked list of members
skipping to change at line 51 skipping to change at line 55
inline Member *Members() { return List; } 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; std::string Name;
unsigned long MTime; unsigned long MTime;
unsigned long UID; unsigned long UID;
unsigned long GID; unsigned long GID;
unsigned long Mode; unsigned long Mode;
unsigned long Size; unsigned long long Size;
// Location of the data. // Location of the data.
unsigned long Start; unsigned long Start;
Member *Next; Member *Next;
Member() : Start(0), Next(0) {}; Member() : Start(0), Next(0) {};
}; };
#endif #endif
 End of changes. 4 change blocks. 
2 lines changed or deleted 6 lines changed or added


 assert.h   assert.h 
skipping to change at line 29 skipping to change at line 29
OutputAssertEqual(expect, "==", get, line); OutputAssertEqual(expect, "==", get, line);
assertEquals<unsigned int const&, unsigned int const&>(expect, get, line); assertEquals<unsigned int const&, unsigned int const&>(expect, get, line);
} }
void assertEquals(int const &expect, unsigned int const &get, unsigned long const &line) { void assertEquals(int const &expect, unsigned int const &get, unsigned long const &line) {
if (expect < 0) if (expect < 0)
OutputAssertEqual(expect, "==", get, line); OutputAssertEqual(expect, "==", get, line);
assertEquals<unsigned int const&, unsigned int const&>(expect, get, line); assertEquals<unsigned int const&, unsigned int const&>(expect, get, line);
} }
void assertEquals(unsigned long const &expect, int const &get, unsigned lon
g const &line) {
if (get < 0)
OutputAssertEqual(expect, "==", get, line);
assertEquals<unsigned long const&, unsigned long const&>(expect, get
, line);
}
void assertEquals(int const &expect, unsigned long const &get, unsigned lon
g const &line) {
if (expect < 0)
OutputAssertEqual(expect, "==", get, line);
assertEquals<unsigned long const&, unsigned long const&>(expect, get
, line);
}
#define equalsOr2(x,y,z) assertEqualsOr2(y, z, x, __LINE__) #define equalsOr2(x,y,z) assertEqualsOr2(y, z, x, __LINE__)
template < typename X, typename Y > template < typename X, typename Y >
void OutputAssertEqualOr2(X expect1, X expect2, char const* compare, Y get, unsigned long const &line) { void OutputAssertEqualOr2(X expect1, X expect2, char const* compare, Y get, unsigned long const &line) {
std::cerr << "Test FAILED: »" << expect1 << "« or »" << expect2 < < "« " << compare << " »" << get << "« at line " << line << std::endl; std::cerr << "Test FAILED: »" << expect1 << "« or »" << expect2 < < "« " << compare << " »" << get << "« at line " << line << std::endl;
} }
template < typename X, typename Y > template < typename X, typename Y >
void assertEqualsOr2(X expect1, X expect2, Y get, unsigned long const &line ) { void assertEqualsOr2(X expect1, X expect2, Y get, unsigned long const &line ) {
if (expect1 == get || expect2 == get) if (expect1 == get || expect2 == get)
 End of changes. 1 change blocks. 
0 lines changed or deleted 16 lines changed or added


 cachefile.h   cachefile.h 
skipping to change at line 21 skipping to change at line 21
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/macros.h>
#ifndef APT_8_CLEANER_HEADERS
#include <apt-pkg/acquire.h> #include <apt-pkg/acquire.h>
#include <apt-pkg/policy.h> #include <apt-pkg/policy.h>
#include <apt-pkg/sourcelist.h> #include <apt-pkg/sourcelist.h>
#endif
class pkgPolicy;
class pkgSourceList;
class OpProgress;
class pkgCacheFile class pkgCacheFile
{ {
/** \brief dpointer placeholder (for later in case we need it) */
void *d;
protected: protected:
MMap *Map; MMap *Map;
pkgCache *Cache; pkgCache *Cache;
pkgDepCache *DCache; pkgDepCache *DCache;
pkgSourceList *SrcList; pkgSourceList *SrcList;
public: public:
pkgPolicy *Policy; pkgPolicy *Policy;
 End of changes. 3 change blocks. 
0 lines changed or deleted 11 lines changed or added


 cachefilter.h   cachefilter.h 
skipping to change at line 19 skipping to change at line 19
#include <apt-pkg/pkgcache.h> #include <apt-pkg/pkgcache.h>
#include <string> #include <string>
#include <regex.h> #include <regex.h>
/*}} }*/ /*}} }*/
namespace APT { namespace APT {
namespace CacheFilter { namespace CacheFilter {
// PackageNameMatchesRegEx /*{{ {*/ // PackageNameMatchesRegEx /*{{ {*/
class PackageNameMatchesRegEx { class PackageNameMatchesRegEx {
/** \brief dpointer placeholder (for later in case we need it) */
void *d;
regex_t* pattern; regex_t* pattern;
public: public:
PackageNameMatchesRegEx(std::string const &Pattern); PackageNameMatchesRegEx(std::string const &Pattern);
bool operator() (pkgCache::PkgIterator const &Pkg); bool operator() (pkgCache::PkgIterator const &Pkg);
bool operator() (pkgCache::GrpIterator const &Grp); bool operator() (pkgCache::GrpIterator const &Grp);
~PackageNameMatchesRegEx(); ~PackageNameMatchesRegEx();
}; };
/*}} }*/ /*}} }*/
} }
} }
 End of changes. 1 change blocks. 
0 lines changed or deleted 2 lines changed or added


 cacheiterators.h   cacheiterators.h 
skipping to change at line 35 skipping to change at line 35
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> #include<iterator>
#include<string.h> #include<string.h>
// abstract Iterator template /*{{ {*/ // abstract Iterator template /*{{ {*/
/* This template provides the very basic iterator methods we /* This template provides the very basic iterator methods we
need to have for doing some walk-over-the-cache magic */ need to have for doing some walk-over-the-cache magic */
template<typename Str, typename Itr> class pkgCache::Iterator : template<typename Str, typename Itr> class pkgCache::Iterator :
public std::iterator<std::forward_iterator_tag, Str> { public std::iterator<std::forward_iterator_tag, Str> {
protected: protected:
Str *S; Str *S;
pkgCache *Owner; pkgCache *Owner;
/** \brief Returns the Pointer for this struct in the owner /** \brief Returns the Pointer for this struct in the owner
skipping to change at line 114 skipping to change at line 115
inline GrpIterator(pkgCache &Owner) : Iterator<Group, GrpIterator>(O wner), HashIndex(-1) { inline GrpIterator(pkgCache &Owner) : Iterator<Group, GrpIterator>(O wner), HashIndex(-1) {
S = OwnerPointer(); S = OwnerPointer();
operator ++(0); operator ++(0);
}; };
virtual void operator ++(int); virtual void operator ++(int);
virtual void operator ++() {operator ++(0);}; virtual void operator ++() {operator ++(0);};
inline const char *Name() const {return S->Name == 0?0:Owner->StrP + S->Name;}; inline const char *Name() const {return S->Name == 0?0:Owner->StrP + S->Name;};
inline PkgIterator PackageList() const; inline PkgIterator PackageList() const;
PkgIterator FindPkg(string Arch = "any") const; PkgIterator FindPkg(std::string Arch = "any") const;
/** \brief find the package with the "best" architecture /** \brief find the package with the "best" architecture
The best architecture is either the "native" or the first The best architecture is either the "native" or the first
in the list of Architectures which is not an end-Pointer in the list of Architectures which is not an end-Pointer
\param PreferNonVirtual tries to respond with a non-virtual pack age \param PreferNonVirtual tries to respond with a non-virtual pack age
and only if this fails returns the best virtual package * / and only if this fails returns the best virtual package * /
PkgIterator FindPreferredPkg(bool const &PreferNonVirtual = true) co nst; PkgIterator FindPreferredPkg(bool const &PreferNonVirtual = true) co nst;
PkgIterator NextPkg(PkgIterator const &Pkg) const; PkgIterator NextPkg(PkgIterator const &Pkg) const;
skipping to change at line 209 skipping to change at line 210
This method should be used to identify if two pseudo versions ar e This method should be used to identify if two pseudo versions ar e
refering to the same "real" version */ refering to the same "real" version */
inline bool SimilarVer(const VerIterator &B) const { inline bool SimilarVer(const VerIterator &B) const {
return (B.end() == false && S->Hash == B->Hash && strcmp(Ver Str(), B.VerStr()) == 0); return (B.end() == false && S->Hash == B->Hash && strcmp(Ver Str(), B.VerStr()) == 0);
}; };
// Accessors // Accessors
inline const char *VerStr() const {return S->VerStr == 0?0:Owner->St rP + S->VerStr;}; inline const char *VerStr() const {return S->VerStr == 0?0:Owner->St rP + S->VerStr;};
inline const char *Section() const {return S->Section == 0?0:Owner-> StrP + S->Section;}; inline const char *Section() const {return S->Section == 0?0:Owner-> StrP + S->Section;};
inline const char *Arch() const { inline const char *Arch() const {
if (S->MultiArch == pkgCache::Version::All || if ((S->MultiArch & pkgCache::Version::All) == pkgCache::Ver
S->MultiArch == pkgCache::Version::AllForeign || sion::All)
S->MultiArch == pkgCache::Version::AllAllowed)
return "all"; return "all";
return S->ParentPkg == 0?0:Owner->StrP + ParentPkg()->Arch; return S->ParentPkg == 0?0:Owner->StrP + ParentPkg()->Arch;
}; };
__deprecated inline const char *Arch(bool const pseudo) const {
return S->ParentPkg == 0?0:Owner->StrP + ParentPkg()->Arch;
};
inline PkgIterator ParentPkg() const {return PkgIterator(*Owner,Owne r->PkgP + S->ParentPkg);}; inline PkgIterator ParentPkg() const {return PkgIterator(*Owner,Owne r->PkgP + S->ParentPkg);};
inline DescIterator DescriptionList() const; inline DescIterator DescriptionList() const;
DescIterator TranslatedDescription() const; DescIterator TranslatedDescription() const;
inline DepIterator DependsList() const; inline DepIterator DependsList() const;
inline PrvIterator ProvidesList() const; inline PrvIterator ProvidesList() const;
inline VerFileIterator FileList() const; inline VerFileIterator FileList() const;
bool Downloadable() const; bool Downloadable() const;
inline const char *PriorityType() const {return Owner->Priority(S->P riority);}; inline const char *PriorityType() const {return Owner->Priority(S->P riority);};
string RelStr() const; std::string RelStr() const;
bool Automatic() const; bool Automatic() const;
__deprecated bool Pseudo() const;
VerFileIterator NewestFile() const; VerFileIterator NewestFile() const;
inline VerIterator(pkgCache &Owner,Version *Trg = 0) : Iterator<Vers ion, VerIterator>(Owner, Trg) { inline VerIterator(pkgCache &Owner,Version *Trg = 0) : Iterator<Vers ion, VerIterator>(Owner, Trg) {
if (S == 0) if (S == 0)
S = OwnerPointer(); S = OwnerPointer();
}; };
inline VerIterator() : Iterator<Version, VerIterator>() {}; inline VerIterator() : Iterator<Version, VerIterator>() {};
}; };
/*}} }*/ /*}} }*/
// Description Iterator /*{{{*/ // Description Iterator /*{{{*/
skipping to change at line 291 skipping to change at line 286
// Accessors // Accessors
inline const char *TargetVer() const {return S->Version == 0?0:Owner ->StrP + S->Version;}; 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 TargetPkg() const {return PkgIterator(*Owner,Owne r->PkgP + S->Package);};
inline PkgIterator SmartTargetPkg() const {PkgIterator R(*Owner,0);S martTargetPkg(R);return R;}; 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 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 PkgIterator ParentPkg() const {return PkgIterator(*Owner,Owne r->PkgP + Owner->VerP[S->ParentVer].ParentPkg);};
inline bool Reverse() const {return Type == DepRev;}; inline bool Reverse() const {return Type == DepRev;};
bool IsCritical() const; bool IsCritical() const;
bool IsNegative() const; bool IsNegative() const;
bool IsIgnorable(PrvIterator const &Prv) const;
bool IsIgnorable(PkgIterator const &Pkg) const;
void GlobOr(DepIterator &Start,DepIterator &End); void GlobOr(DepIterator &Start,DepIterator &End);
Version **AllTargets() const; Version **AllTargets() const;
bool SmartTargetPkg(PkgIterator &Result) const; bool SmartTargetPkg(PkgIterator &Result) const;
inline const char *CompType() const {return Owner->CompType(S->Compa reOp);}; inline const char *CompType() const {return Owner->CompType(S->Compa reOp);};
inline const char *DepType() const {return Owner->DepType(S->Type);} ; inline const char *DepType() const {return Owner->DepType(S->Type);} ;
//Nice printable representation //Nice printable representation
friend std::ostream& operator <<(std::ostream& out, DepIterator D); friend std::ostream& operator <<(std::ostream& out, DepIterator D);
inline DepIterator(pkgCache &Owner, Dependency *Trg, Version* = 0) : inline DepIterator(pkgCache &Owner, Dependency *Trg, Version* = 0) :
skipping to change at line 374 skipping to change at line 371
inline const char *Component() const {return S->Component == 0?0:Own er->StrP + S->Component;}; 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 *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 *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 *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 *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 *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 *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;}; inline const char *IndexType() const {return S->IndexType == 0?0:Own er->StrP + S->IndexType;};
bool IsOk(); bool IsOk();
string RelStr(); std::string RelStr();
// Constructors // Constructors
inline PkgFileIterator() : Iterator<PackageFile, PkgFileIterator>() {}; inline PkgFileIterator() : Iterator<PackageFile, PkgFileIterator>() {};
inline PkgFileIterator(pkgCache &Owner) : Iterator<PackageFile, PkgF ileIterator>(Owner, Owner.PkgFileP) {}; inline PkgFileIterator(pkgCache &Owner) : Iterator<PackageFile, PkgF ileIterator>(Owner, Owner.PkgFileP) {};
inline PkgFileIterator(pkgCache &Owner,PackageFile *Trg) : Iterator< PackageFile, PkgFileIterator>(Owner, Trg) {}; inline PkgFileIterator(pkgCache &Owner,PackageFile *Trg) : Iterator< PackageFile, PkgFileIterator>(Owner, Trg) {};
}; };
/*}} }*/ /*}} }*/
// Version File /*{{{*/ // Version File /*{{{*/
class pkgCache::VerFileIterator : public pkgCache::Iterator<VerFile, VerFil eIterator> { class pkgCache::VerFileIterator : public pkgCache::Iterator<VerFile, VerFil eIterator> {
protected: protected:
 End of changes. 8 change blocks. 
10 lines changed or deleted 8 lines changed or added


 cacheset.h   cacheset.h 
skipping to change at line 17 skipping to change at line 17
Provides also a few helper methods which work with these sets */ Provides also a few helper methods which work with these sets */
/*}} }*/ /*}} }*/
#ifndef APT_CACHESET_H #ifndef APT_CACHESET_H
#define APT_CACHESET_H #define APT_CACHESET_H
// Include Files /*{{ {*/ // Include Files /*{{ {*/
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
#include <list> #include <list>
#include <map> #include <map>
#include <set> #include <set>
#include <list>
#include <string> #include <string>
#include <iterator>
#include <apt-pkg/cachefile.h> #include <apt-pkg/error.h>
#include <apt-pkg/pkgcache.h> #include <apt-pkg/pkgcache.h>
#ifndef APT_8_CLEANER_HEADERS
#include <apt-pkg/cachefile.h>
#endif
/*}} }*/ /*}} }*/
class pkgCacheFile;
namespace APT { namespace APT {
class PackageSet; class PackageContainerInterface;
class VersionSet; class VersionContainerInterface;
class CacheSetHelper { /*{{ {*/ class CacheSetHelper { /*{{ {*/
/** \class APT::CacheSetHelper /** \class APT::CacheSetHelper
Simple base class with a lot of virtual methods which can be overridden Simple base class with a lot of virtual methods which can be overridden
to alter the behavior or the output of the CacheSets. to alter the behavior or the output of the CacheSets.
This helper is passed around by the static methods in the CacheSets and This helper is passed around by the static methods in the CacheSets and
used every time they hit an error condition or something could be used every time they hit an error condition or something could be
printed out. printed out.
*/ */
public: /*{{{*/ public: /*{{{*/
CacheSetHelper(bool const &ShowError = true, CacheSetHelper(bool const ShowError = true,
GlobalError::MsgType ErrorType = GlobalError::ERROR) : GlobalError::MsgType ErrorType = GlobalError::ERROR) :
ShowError(ShowError), ErrorType(ErrorType) {}; ShowError(ShowError), ErrorType(ErrorType) {};
virtual ~CacheSetHelper() {}; virtual ~CacheSetHelper() {};
virtual void showTaskSelection(PackageSet const &pkgset, string cons virtual void showTaskSelection(pkgCache::PkgIterator const &pkg, std
t &pattern) {}; ::string const &pattern);
virtual void showRegExSelection(PackageSet const &pkgset, string con virtual void showRegExSelection(pkgCache::PkgIterator const &pkg, st
st &pattern) {}; d::string const &pattern);
virtual void showSelectedVersion(pkgCache::PkgIterator const &Pkg, p kgCache::VerIterator const Ver, virtual void showSelectedVersion(pkgCache::PkgIterator const &Pkg, p kgCache::VerIterator const Ver,
string const &ver, bool const &verIsRel) {} ; std::string const &ver, bool const verIsRel );
virtual pkgCache::PkgIterator canNotFindPkgName(pkgCacheFile &Cache, virtual void canNotFindTask(PackageContainerInterface * const pci, p
std::string const &str); kgCacheFile &Cache, std::string pattern);
virtual PackageSet canNotFindTask(pkgCacheFile &Cache, std::string p virtual void canNotFindRegEx(PackageContainerInterface * const pci,
attern); pkgCacheFile &Cache, std::string pattern);
virtual PackageSet canNotFindRegEx(pkgCacheFile &Cache, std::string virtual void canNotFindPackage(PackageContainerInterface * const pci
pattern); , pkgCacheFile &Cache, std::string const &str);
virtual PackageSet canNotFindPackage(pkgCacheFile &Cache, std::strin
g const &str); virtual void canNotFindAllVer(VersionContainerInterface * const vci,
virtual VersionSet canNotFindAllVer(pkgCacheFile &Cache, pkgCache::P pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg);
kgIterator const &Pkg); virtual void canNotFindInstCandVer(VersionContainerInterface * const
virtual VersionSet canNotFindInstCandVer(pkgCacheFile &Cache, vci, pkgCacheFile &Cache,
pkgCache::PkgIterator const &Pkg); pkgCache::PkgIterator const &Pkg);
virtual VersionSet canNotFindCandInstVer(pkgCacheFile &Cache, virtual void canNotFindCandInstVer(VersionContainerInterface * const
vci,
pkgCacheFile &Cache,
pkgCache::PkgIterator const &Pkg); pkgCache::PkgIterator const &Pkg);
virtual pkgCache::PkgIterator canNotFindPkgName(pkgCacheFile &Cache,
std::string const &str);
virtual pkgCache::VerIterator canNotFindNewestVer(pkgCacheFile &Cach e, virtual pkgCache::VerIterator canNotFindNewestVer(pkgCacheFile &Cach e,
pkgCache::PkgIterator const &Pkg); pkgCache::PkgIterator const &Pkg);
virtual pkgCache::VerIterator canNotFindCandidateVer(pkgCacheFile &C ache, virtual pkgCache::VerIterator canNotFindCandidateVer(pkgCacheFile &C ache,
pkgCache::PkgIterator const &Pkg); pkgCache::PkgIterator const &Pkg);
virtual pkgCache::VerIterator canNotFindInstalledVer(pkgCacheFile &C ache, virtual pkgCache::VerIterator canNotFindInstalledVer(pkgCacheFile &C ache,
pkgCache::PkgIterator const &Pkg); pkgCache::PkgIterator const &Pkg);
bool showErrors() const { return ShowError; }; bool showErrors() const { return ShowError; };
bool showErrors(bool const &newValue) { if (ShowError == newValue) r eturn ShowError; else return ((ShowError = newValue) == false); }; bool showErrors(bool const newValue) { if (ShowError == newValue) re turn ShowError; else return ((ShowError = newValue) == false); };
GlobalError::MsgType errorType() const { return ErrorType; }; GlobalError::MsgType errorType() const { return ErrorType; };
GlobalError::MsgType errorType(GlobalError::MsgType const &newValue) GlobalError::MsgType errorType(GlobalError::MsgType const &newValue)
{ {
if (ErrorType == newValue) return ErrorType; if (ErrorType == newValue) return ErrorType;
else { else {
GlobalError::MsgType const &oldValue = ErrorType; GlobalError::MsgType const &oldValue = ErrorType;
ErrorType = newValue; ErrorType = newValue;
return oldValue; return oldValue;
} }
}; };
/*}} }*/ /*}} }*/
protected: protected:
bool ShowError; bool ShowError;
GlobalError::MsgType ErrorType; GlobalError::MsgType ErrorType;
}; /*}} }*/ }; /*}} }*/
class PackageSet : public std::set<pkgCache::PkgIterator> { /*{{ class PackageContainerInterface { /*{{
{*/ {*/
/** \class APT::PackageSet /** \class PackageContainerInterface
Simple wrapper around a std::set to provide a similar interface to * Interface ensuring that all operations can be executed on the yet to
a set of packages as to the complete set of all packages in the * define concrete PackageContainer - access to all methods is possible,
pkgCache. */ * but in general the wrappers provided by the PackageContainer template
public: * are nicer to use.
/*{{{*/
/** \brief smell like a pkgCache::PkgIterator */ * This class mostly protects use from the need to write all implementation
class const_iterator : public std::set<pkgCache::PkgIterator>::const * of the methods working on containers in the template */
_iterator {/*{{{*/ public:
class const_iterator { /*{{
{*/
public: public:
const_iterator(std::set<pkgCache::PkgIterator>::const_iterat virtual pkgCache::PkgIterator getPkg() const = 0;
or x) : operator pkgCache::PkgIterator(void) const { return getPkg()
std::set<pkgCache::PkgIterator>::const_iterator(x) ; }
{}
operator pkgCache::PkgIterator(void) { return **this; } inline const char *Name() const {return getPkg().Name(); }
inline std::string FullName(bool const Pretty) const { retur
inline const char *Name() const {return (**this).Name(); } n getPkg().FullName(Pretty); }
inline std::string FullName(bool const &Pretty) const { retu inline std::string FullName() const { return getPkg().FullNa
rn (**this).FullName(Pretty); } me(); }
inline std::string FullName() const { return (**this).FullNa inline const char *Section() const {return getPkg().Section(
me(); } ); }
inline const char *Section() const {return (**this).Section( inline bool Purge() const {return getPkg().Purge(); }
); } inline const char *Arch() const {return getPkg().Arch(); }
inline bool Purge() const {return (**this).Purge(); } inline pkgCache::GrpIterator Group() const { return getPkg()
inline const char *Arch() const {return (**this).Arch(); } .Group(); }
inline pkgCache::GrpIterator Group() const { return (**this) inline pkgCache::VerIterator VersionList() const { return ge
.Group(); } tPkg().VersionList(); }
inline pkgCache::VerIterator VersionList() const { return (* inline pkgCache::VerIterator CurrentVer() const { return get
*this).VersionList(); } Pkg().CurrentVer(); }
inline pkgCache::VerIterator CurrentVer() const { return (** inline pkgCache::DepIterator RevDependsList() const { return
this).CurrentVer(); } getPkg().RevDependsList(); }
inline pkgCache::DepIterator RevDependsList() const { return inline pkgCache::PrvIterator ProvidesList() const { return g
(**this).RevDependsList(); } etPkg().ProvidesList(); }
inline pkgCache::PrvIterator ProvidesList() const { return ( inline pkgCache::PkgIterator::OkState State() const { return
**this).ProvidesList(); } getPkg().State(); }
inline pkgCache::PkgIterator::OkState State() const { return inline const char *CandVersion() const { return getPkg().Can
(**this).State(); } dVersion(); }
inline const char *CandVersion() const { return (**this).Can inline const char *CurVersion() const { return getPkg().CurV
dVersion(); } ersion(); }
inline const char *CurVersion() const { return (**this).CurV inline pkgCache *Cache() const { return getPkg().Cache(); };
ersion(); } inline unsigned long Index() const {return getPkg().Index();
inline pkgCache *Cache() const { return (**this).Cache(); }; };
inline unsigned long Index() const {return (**this).Index();
};
// we have only valid iterators here // we have only valid iterators here
inline bool end() const { return false; }; inline bool end() const { return false; };
friend std::ostream& operator<<(std::ostream& out, const_ite inline pkgCache::Package const * operator->() const {return
rator i) { return operator<<(out, (*i)); } &*getPkg();};
};
/*}}
}*/
virtual bool insert(pkgCache::PkgIterator const &P) = 0;
virtual bool empty() const = 0;
virtual void clear() = 0;
inline pkgCache::Package const * operator->() const { enum Constructor { UNKNOWN, REGEX, TASK };
return &***this; virtual void setConstructor(Constructor const &con) = 0;
}; virtual Constructor getConstructor() const = 0;
static bool FromTask(PackageContainerInterface * const pci, pkgCache
File &Cache, std::string pattern, CacheSetHelper &helper);
static bool FromRegEx(PackageContainerInterface * const pci, pkgCach
eFile &Cache, std::string pattern, CacheSetHelper &helper);
static pkgCache::PkgIterator FromName(pkgCacheFile &Cache, std::stri
ng const &pattern, CacheSetHelper &helper);
static bool FromString(PackageContainerInterface * const pci, pkgCac
heFile &Cache, std::string const &pattern, CacheSetHelper &helper);
static bool FromCommandLine(PackageContainerInterface * const pci, p
kgCacheFile &Cache, const char **cmdline, CacheSetHelper &helper);
struct Modifier {
enum Position { NONE, PREFIX, POSTFIX };
unsigned short ID;
const char * const Alias;
Position Pos;
Modifier (unsigned short const &id, const char * const alias
, Position const &pos) : ID(id), Alias(alias), Pos(pos) {};
};
static bool FromModifierCommandLine(unsigned short &modID, PackageCo
ntainerInterface * const pci,
pkgCacheFile &Cache, const char
* cmdline,
std::list<Modifier> const &mods,
CacheSetHelper &helper);
};
/*}}
}*/
template<class Container> class PackageContainer : public PackageContainerI
nterface {/*{{{*/
/** \class APT::PackageContainer
Simple wrapper around a container class like std::set to provide a simi
lar
interface to a set of packages as to the complete set of all packages i
n the
pkgCache. */
Container _cont;
public:
/*{{{*/
/** \brief smell like a pkgCache::PkgIterator */
class const_iterator : public PackageContainerInterface::const_itera
tor,/*{{{*/
public std::iterator<std::forward_iterator_ta
g, typename Container::const_iterator> {
typename Container::const_iterator _iter;
public:
const_iterator(typename Container::const_iterator i) : _iter
(i) {}
pkgCache::PkgIterator getPkg(void) const { return *_iter; }
inline pkgCache::PkgIterator operator*(void) const { return
*_iter; };
operator typename Container::const_iterator(void) const { re
turn _iter; }
inline const_iterator& operator++() { ++_iter; return *this;
}
inline const_iterator operator++(int) { const_iterator tmp(*
this); operator++(); return tmp; }
inline bool operator!=(const_iterator const &i) const { retu
rn _iter != i._iter; };
inline bool operator==(const_iterator const &i) const { retu
rn _iter == i._iter; };
friend std::ostream& operator<<(std::ostream& out, const_ite
rator i) { return operator<<(out, *i); }
};
class iterator : public PackageContainerInterface::const_iterator,
public std::iterator<std::forward_iterator_tag, typ
ename Container::iterator> {
typename Container::iterator _iter;
public:
iterator(typename Container::iterator i) : _iter(i) {}
pkgCache::PkgIterator getPkg(void) const { return *_iter; }
inline pkgCache::PkgIterator operator*(void) const { return
*_iter; };
operator typename Container::iterator(void) const { return _
iter; }
operator typename PackageContainer<Container>::const_iterato
r() { return PackageContainer<Container>::const_iterator(_iter); }
inline iterator& operator++() { ++_iter; return *this; }
inline iterator operator++(int) { iterator tmp(*this); opera
tor++(); return tmp; }
inline bool operator!=(iterator const &i) const { return _it
er != i._iter; };
inline bool operator==(iterator const &i) const { return _it
er == i._iter; };
inline iterator& operator=(iterator const &i) { _iter = i._i
ter; return *this; };
inline iterator& operator=(typename Container::iterator cons
t &i) { _iter = i; return *this; };
friend std::ostream& operator<<(std::ostream& out, iterator
i) { return operator<<(out, *i); }
}; };
// 103. set::iterator is required to be modifiable, but this allows
modification of keys
typedef APT::PackageSet::const_iterator iterator;
/*}} }*/ /*}} }*/
using std::set<pkgCache::PkgIterator>::insert; bool insert(pkgCache::PkgIterator const &P) { if (P.end() == true) r
inline void insert(pkgCache::PkgIterator const &P) { if (P.end() == eturn false; _cont.insert(P); return true; };
false) std::set<pkgCache::PkgIterator>::insert(P); }; template<class Cont> void insert(PackageContainer<Cont> const &pkgco
inline void insert(PackageSet const &pkgset) { insert(pkgset.begin() nt) { _cont.insert((typename Cont::const_iterator)pkgcont.begin(), (typenam
, pkgset.end()); }; e Cont::const_iterator)pkgcont.end()); };
void insert(const_iterator begin, const_iterator end) { _cont.insert
(begin, end); };
bool empty() const { return _cont.empty(); };
void clear() { return _cont.clear(); };
//FIXME: on ABI break, replace the first with the second without boo
l
void erase(iterator position) { _cont.erase((typename Container::ite
rator)position); };
iterator& erase(iterator &position, bool) { return position = _cont.
erase((typename Container::iterator)position); };
size_t erase(const pkgCache::PkgIterator x) { return _cont.erase(x);
};
void erase(iterator first, iterator last) { _cont.erase(first, last)
; };
size_t size() const { return _cont.size(); };
const_iterator begin() const { return const_iterator(_cont.begin());
};
const_iterator end() const { return const_iterator(_cont.end()); };
iterator begin() { return iterator(_cont.begin()); };
iterator end() { return iterator(_cont.end()); };
const_iterator find(pkgCache::PkgIterator const &P) const { return c
onst_iterator(_cont.find(P)); };
void setConstructor(Constructor const &by) { ConstructedBy = by; };
Constructor getConstructor() const { return ConstructedBy; };
PackageContainer() : ConstructedBy(UNKNOWN) {};
PackageContainer(Constructor const &by) : ConstructedBy(by) {};
/** \brief returns all packages in the cache who belong to the given task /** \brief returns all packages in the cache who belong to the given task
A simple helper responsible for search for all members of a task A simple helper responsible for search for all members of a task
in the cache. Optional it prints a a notice about the in the cache. Optional it prints a a notice about the
packages chosen cause of the given task. packages chosen cause of the given task.
\param Cache the packages are in \param Cache the packages are in
\param pattern name of the task \param pattern name of the task
\param helper responsible for error and message handling */ \param helper responsible for error and message handling */
static APT::PackageSet FromTask(pkgCacheFile &Cache, std::string pat static PackageContainer FromTask(pkgCacheFile &Cache, std::string co
tern, CacheSetHelper &helper); nst &pattern, CacheSetHelper &helper) {
static APT::PackageSet FromTask(pkgCacheFile &Cache, std::string con PackageContainer cont(TASK);
st &pattern) { PackageContainerInterface::FromTask(&cont, Cache, pattern, h
elper);
return cont;
}
static PackageContainer FromTask(pkgCacheFile &Cache, std::string co
nst &pattern) {
CacheSetHelper helper; CacheSetHelper helper;
return FromTask(Cache, pattern, helper); return FromTask(Cache, pattern, helper);
} }
/** \brief returns all packages in the cache whose name matchs a giv en pattern /** \brief returns all packages in the cache whose name matchs a giv en pattern
A simple helper responsible for executing a regular expression o n all A simple helper responsible for executing a regular expression o n all
package names in the cache. Optional it prints a a notice about the package names in the cache. Optional it prints a a notice about the
packages chosen cause of the given package. packages chosen cause of the given package.
\param Cache the packages are in \param Cache the packages are in
\param pattern regular expression for package names \param pattern regular expression for package names
\param helper responsible for error and message handling */ \param helper responsible for error and message handling */
static APT::PackageSet FromRegEx(pkgCacheFile &Cache, std::string pa static PackageContainer FromRegEx(pkgCacheFile &Cache, std::string p
ttern, CacheSetHelper &helper); attern, CacheSetHelper &helper) {
static APT::PackageSet FromRegEx(pkgCacheFile &Cache, std::string co PackageContainer cont(REGEX);
nst &pattern) { PackageContainerInterface::FromRegEx(&cont, Cache, pattern,
helper);
return cont;
}
static PackageContainer FromRegEx(pkgCacheFile &Cache, std::string c
onst &pattern) {
CacheSetHelper helper; CacheSetHelper helper;
return FromRegEx(Cache, pattern, helper); return FromRegEx(Cache, pattern, helper);
} }
/** \brief returns all packages specified by a string /** \brief returns a package specified by a string
\param Cache the packages are in \param Cache the package is in
\param string String the package name(s) should be extracted fro \param pattern String the package name should be extracted from
m
\param helper responsible for error and message handling */ \param helper responsible for error and message handling */
static APT::PackageSet FromString(pkgCacheFile &Cache, std::string c static pkgCache::PkgIterator FromName(pkgCacheFile &Cache, std::stri
onst &string, CacheSetHelper &helper); ng const &pattern, CacheSetHelper &helper) {
static APT::PackageSet FromString(pkgCacheFile &Cache, std::string c return PackageContainerInterface::FromName(Cache, pattern, h
onst &string) { elper);
}
static pkgCache::PkgIterator FromName(pkgCacheFile &Cache, std::stri
ng const &pattern) {
CacheSetHelper helper; CacheSetHelper helper;
return FromString(Cache, string, helper); return PackageContainerInterface::FromName(Cache, pattern, h elper);
} }
/** \brief returns a package specified by a string /** \brief returns all packages specified by a string
\param Cache the package is in \param Cache the packages are in
\param string String the package name should be extracted from \param pattern String the package name(s) should be extracted fr
om
\param helper responsible for error and message handling */ \param helper responsible for error and message handling */
static pkgCache::PkgIterator FromName(pkgCacheFile &Cache, std::stri static PackageContainer FromString(pkgCacheFile &Cache, std::string
ng const &string, CacheSetHelper &helper); const &pattern, CacheSetHelper &helper) {
static pkgCache::PkgIterator FromName(pkgCacheFile &Cache, std::stri PackageContainer cont;
ng const &string) { PackageContainerInterface::FromString(&cont, Cache, pattern,
helper);
return cont;
}
static PackageContainer FromString(pkgCacheFile &Cache, std::string
const &pattern) {
CacheSetHelper helper; CacheSetHelper helper;
return FromName(Cache, string, helper); return FromString(Cache, pattern, helper);
} }
/** \brief returns all packages specified on the commandline /** \brief returns all packages specified on the commandline
Get all package names from the commandline and executes regex's if needed. Get all package names from the commandline and executes regex's if needed.
No special package command is supported, just plain names. No special package command is supported, just plain names.
\param Cache the packages are in \param Cache the packages are in
\param cmdline Command line the package names should be extracte d from \param cmdline Command line the package names should be extracte d from
\param helper responsible for error and message handling */ \param helper responsible for error and message handling */
static APT::PackageSet FromCommandLine(pkgCacheFile &Cache, const ch static PackageContainer FromCommandLine(pkgCacheFile &Cache, const c
ar **cmdline, CacheSetHelper &helper); har **cmdline, CacheSetHelper &helper) {
static APT::PackageSet FromCommandLine(pkgCacheFile &Cache, const ch PackageContainer cont;
ar **cmdline) { PackageContainerInterface::FromCommandLine(&cont, Cache, cmd
line, helper);
return cont;
}
static PackageContainer FromCommandLine(pkgCacheFile &Cache, const c
har **cmdline) {
CacheSetHelper helper; CacheSetHelper helper;
return FromCommandLine(Cache, cmdline, helper); return FromCommandLine(Cache, cmdline, helper);
} }
struct Modifier {
enum Position { NONE, PREFIX, POSTFIX };
unsigned short ID;
const char * const Alias;
Position Pos;
Modifier (unsigned short const &id, const char * const alias
, Position const &pos) : ID(id), Alias(alias), Pos(pos) {};
};
/** \brief group packages by a action modifiers /** \brief group packages by a action modifiers
At some point it is needed to get from the same commandline At some point it is needed to get from the same commandline
different package sets grouped by a modifier. Take different package sets grouped by a modifier. Take
apt-get install apt awesome- apt-get install apt awesome-
as an example. as an example.
\param Cache the packages are in \param Cache the packages are in
\param cmdline Command line the package names should be extracte d from \param cmdline Command line the package names should be extracte d from
\param mods list of modifiers the method should accept \param mods list of modifiers the method should accept
\param fallback the default modifier group for a package \param fallback the default modifier group for a package
\param helper responsible for error and message handling */ \param helper responsible for error and message handling */
static std::map<unsigned short, PackageSet> GroupedFromCommandLine( static std::map<unsigned short, PackageContainer> GroupedFromCommand
pkgCacheFile &Cache, const char **cmdline, Line(
std::list<PackageSet::Modifier> const &mods,
unsigned short const &fallback, CacheSetHelper &helper); pkgCacheFile &Cache,
static std::map<unsigned short, PackageSet> GroupedFromCommandLine(
pkgCacheFile &Cache, const char **cmdline, const char **cmdline,
std::list<PackageSet::Modifier> const &mods,
unsigned short const &fallback) { std::list<Modifier> const &mods,
unsigned short const &fallback,
CacheSetHelper &helper) {
std::map<unsigned short, PackageContainer> pkgsets;
for (const char **I = cmdline; *I != 0; ++I) {
unsigned short modID = fallback;
PackageContainer pkgset;
PackageContainerInterface::FromModifierCommandLine(m
odID, &pkgset, Cache, *I, mods, helper);
pkgsets[modID].insert(pkgset);
}
return pkgsets;
}
static std::map<unsigned short, PackageContainer> GroupedFromCommand
Line(
pkgCacheFile &Cache,
const char **cmdline,
std::list<Modifier> const &mods,
unsigned short const &fallback) {
CacheSetHelper helper; CacheSetHelper helper;
return GroupedFromCommandLine(Cache, cmdline, return GroupedFromCommandLine(Cache, cmdline,
mods, fallback, helper); mods, fallback, helper);
} }
enum Constructor { UNKNOWN, REGEX, TASK };
Constructor getConstructor() const { return ConstructedBy; };
PackageSet() : ConstructedBy(UNKNOWN) {};
PackageSet(Constructor const &by) : ConstructedBy(by) {};
/*}} }*/ /*}} }*/
private: /*{{ {*/ private: /*{{ {*/
Constructor ConstructedBy; Constructor ConstructedBy;
/*}} }*/ /*}} }*/
}; /*}} }*/ }; /*}} }*/
class VersionSet : public std::set<pkgCache::VerIterator> { /*{{
{*/
/** \class APT::VersionSet
Simple wrapper around a std::set to provide a similar interface to template<> template<class Cont> void PackageContainer<std::list<pkgCache::P
a set of versions as to the complete set of all versions in the kgIterator> >::insert(PackageContainer<Cont> const &pkgcont) {
pkgCache. */ for (typename PackageContainer<Cont>::const_iterator p = pkgcont.beg
public: in(); p != pkgcont.end(); ++p)
/*{{{*/ _cont.push_back(*p);
};
// these two are 'inline' as otherwise the linker has problems with seeing
these untemplated
// specializations again and again - but we need to see them, so that libra
ry users can use them
template<> inline bool PackageContainer<std::list<pkgCache::PkgIterator> >:
:insert(pkgCache::PkgIterator const &P) {
if (P.end() == true)
return false;
_cont.push_back(P);
return true;
};
template<> inline void PackageContainer<std::list<pkgCache::PkgIterator> >:
:insert(const_iterator begin, const_iterator end) {
for (const_iterator p = begin; p != end; ++p)
_cont.push_back(*p);
};
typedef PackageContainer<std::set<pkgCache::PkgIterator> > PackageSet;
typedef PackageContainer<std::list<pkgCache::PkgIterator> > PackageList;
class VersionContainerInterface { /*{{
{*/
/** \class APT::VersionContainerInterface
Same as APT::PackageContainerInterface, just for Versions */
public:
/** \brief smell like a pkgCache::VerIterator */ /** \brief smell like a pkgCache::VerIterator */
class const_iterator : public std::set<pkgCache::VerIterator>::const _iterator {/*{{{*/ class const_iterator { /*{{ {*/
public: public:
const_iterator(std::set<pkgCache::VerIterator>::const_iterat virtual pkgCache::VerIterator getVer() const = 0;
or x) : operator pkgCache::VerIterator(void) { return getVer(); }
std::set<pkgCache::VerIterator>::const_iterator(x)
{}
operator pkgCache::VerIterator(void) { return **this; }
inline pkgCache *Cache() const { return (**this).Cache(); }; inline pkgCache *Cache() const { return getVer().Cache(); };
inline unsigned long Index() const {return (**this).Index(); inline unsigned long Index() const {return getVer().Index();
}; };
inline int CompareVer(const pkgCache::VerIterator &B) const
{ return getVer().CompareVer(B); };
inline const char *VerStr() const { return getVer().VerStr()
; };
inline const char *Section() const { return getVer().Section
(); };
inline const char *Arch() const { return getVer().Arch(); };
inline pkgCache::PkgIterator ParentPkg() const { return getV
er().ParentPkg(); };
inline pkgCache::DescIterator DescriptionList() const { retu
rn getVer().DescriptionList(); };
inline pkgCache::DescIterator TranslatedDescription() const
{ return getVer().TranslatedDescription(); };
inline pkgCache::DepIterator DependsList() const { return ge
tVer().DependsList(); };
inline pkgCache::PrvIterator ProvidesList() const { return g
etVer().ProvidesList(); };
inline pkgCache::VerFileIterator FileList() const { return g
etVer().FileList(); };
inline bool Downloadable() const { return getVer().Downloada
ble(); };
inline const char *PriorityType() const { return getVer().Pr
iorityType(); };
inline std::string RelStr() const { return getVer().RelStr()
; };
inline bool Automatic() const { return getVer().Automatic();
};
inline pkgCache::VerFileIterator NewestFile() const { return
getVer().NewestFile(); };
// we have only valid iterators here // we have only valid iterators here
inline bool end() const { return false; }; inline bool end() const { return false; };
inline pkgCache::Version const * operator->() const { inline pkgCache::Version const * operator->() const { return
return &***this; &*getVer(); };
};
inline int CompareVer(const pkgCache::VerIterator &B) const
{ return (**this).CompareVer(B); };
inline const char *VerStr() const { return (**this).VerStr()
; };
inline const char *Section() const { return (**this).Section
(); };
inline const char *Arch() const { return (**this).Arch(); };
__deprecated inline const char *Arch(bool const pseudo) cons
t { return (**this).Arch(); };
inline pkgCache::PkgIterator ParentPkg() const { return (**t
his).ParentPkg(); };
inline pkgCache::DescIterator DescriptionList() const { retu
rn (**this).DescriptionList(); };
inline pkgCache::DescIterator TranslatedDescription() const
{ return (**this).TranslatedDescription(); };
inline pkgCache::DepIterator DependsList() const { return (*
*this).DependsList(); };
inline pkgCache::PrvIterator ProvidesList() const { return (
**this).ProvidesList(); };
inline pkgCache::VerFileIterator FileList() const { return (
**this).FileList(); };
inline bool Downloadable() const { return (**this).Downloada
ble(); };
inline const char *PriorityType() const { return (**this).Pr
iorityType(); };
inline string RelStr() const { return (**this).RelStr(); };
inline bool Automatic() const { return (**this).Automatic();
};
__deprecated inline bool Pseudo() const { return false; };
inline pkgCache::VerFileIterator NewestFile() const { return
(**this).NewestFile(); };
}; };
/*}} }*/ /*}} }*/
// 103. set::iterator is required to be modifiable, but this allows
modification of keys
typedef APT::VersionSet::const_iterator iterator;
using std::set<pkgCache::VerIterator>::insert; virtual bool insert(pkgCache::VerIterator const &V) = 0;
inline void insert(pkgCache::VerIterator const &V) { if (V.end() == virtual bool empty() const = 0;
false) std::set<pkgCache::VerIterator>::insert(V); }; virtual void clear() = 0;
inline void insert(VersionSet const &verset) { insert(verset.begin()
, verset.end()); };
/** \brief specifies which version(s) will be returned if non is giv en */ /** \brief specifies which version(s) will be returned if non is giv en */
enum Version { enum Version {
/** All versions */ /** All versions */
ALL, ALL,
/** Candidate and installed version */ /** Candidate and installed version */
CANDANDINST, CANDANDINST,
/** Candidate version */ /** Candidate version */
CANDIDATE, CANDIDATE,
/** Installed version */ /** Installed version */
INSTALLED, INSTALLED,
/** Candidate or if non installed version */ /** Candidate or if non installed version */
CANDINST, CANDINST,
/** Installed or if non candidate version */ /** Installed or if non candidate version */
INSTCAND, INSTCAND,
/** Newest version */ /** Newest version */
NEWEST NEWEST
}; };
struct Modifier {
enum Position { NONE, PREFIX, POSTFIX };
unsigned short ID;
const char * const Alias;
Position Pos;
Version SelectVersion;
Modifier (unsigned short const &id, const char * const alias
, Position const &pos,
Version const &select) : ID(id), Alias(alias), Pos
(pos),
SelectVersion(select) {};
};
static bool FromCommandLine(VersionContainerInterface * const vci, p
kgCacheFile &Cache,
const char **cmdline, Version const &fal
lback,
CacheSetHelper &helper);
static bool FromString(VersionContainerInterface * const vci, pkgCac
heFile &Cache,
std::string pkg, Version const &fallback, Cac
heSetHelper &helper,
bool const onlyFromName = false);
static bool FromPackage(VersionContainerInterface * const vci, pkgCa
cheFile &Cache,
pkgCache::PkgIterator const &P, Version cons
t &fallback,
CacheSetHelper &helper);
static bool FromModifierCommandLine(unsigned short &modID,
VersionContainerInterface * cons
t vci,
pkgCacheFile &Cache, const char
* cmdline,
std::list<Modifier> const &mods,
CacheSetHelper &helper);
static bool FromDependency(VersionContainerInterface * const vci,
pkgCacheFile &Cache,
pkgCache::DepIterator const &D,
Version const &selector,
CacheSetHelper &helper);
protected: /*{{
{*/
/** \brief returns the candidate version of the package
\param Cache to be used to query for information
\param Pkg we want the candidate version from this package */
static pkgCache::VerIterator getCandidateVer(pkgCacheFile &Cache,
pkgCache::PkgIterator const &Pkg, CacheSetHelper &helper);
/** \brief returns the installed version of the package
\param Cache to be used to query for information
\param Pkg we want the installed version from this package */
static pkgCache::VerIterator getInstalledVer(pkgCacheFile &Cache,
pkgCache::PkgIterator const &Pkg, CacheSetHelper &helper);
/*}}
}*/
};
/*}}
}*/
template<class Container> class VersionContainer : public VersionContainerI
nterface {/*{{{*/
/** \class APT::VersionContainer
Simple wrapper around a container class like std::set to provide a simi
lar
interface to a set of versions as to the complete set of all versions i
n the
pkgCache. */
Container _cont;
public:
/*{{{*/
/** \brief smell like a pkgCache::VerIterator */
class const_iterator : public VersionContainerInterface::const_itera
tor,
public std::iterator<std::forward_iterator_ta
g, typename Container::const_iterator> {/*{{{*/
typename Container::const_iterator _iter;
public:
const_iterator(typename Container::const_iterator i) : _iter
(i) {}
pkgCache::VerIterator getVer(void) const { return *_iter; }
inline pkgCache::VerIterator operator*(void) const { return
*_iter; };
operator typename Container::const_iterator(void) const { re
turn _iter; }
inline const_iterator& operator++() { ++_iter; return *this;
}
inline const_iterator operator++(int) { const_iterator tmp(*
this); operator++(); return tmp; }
inline bool operator!=(const_iterator const &i) const { retu
rn _iter != i._iter; };
inline bool operator==(const_iterator const &i) const { retu
rn _iter == i._iter; };
friend std::ostream& operator<<(std::ostream& out, const_ite
rator i) { return operator<<(out, *i); }
};
class iterator : public VersionContainerInterface::const_iterator,
public std::iterator<std::forward_iterator_tag, typ
ename Container::iterator> {
typename Container::iterator _iter;
public:
iterator(typename Container::iterator i) : _iter(i) {}
pkgCache::VerIterator getVer(void) const { return *_iter; }
inline pkgCache::VerIterator operator*(void) const { return
*_iter; };
operator typename Container::iterator(void) const { return _
iter; }
operator typename VersionContainer<Container>::const_iterato
r() { return VersionContainer<Container>::const_iterator(_iter); }
inline iterator& operator++() { ++_iter; return *this; }
inline iterator operator++(int) { iterator tmp(*this); opera
tor++(); return tmp; }
inline bool operator!=(iterator const &i) const { return _it
er != i._iter; };
inline bool operator==(iterator const &i) const { return _it
er == i._iter; };
inline iterator& operator=(iterator const &i) { _iter = i._i
ter; return *this; };
inline iterator& operator=(typename Container::iterator cons
t &i) { _iter = i; return *this; };
friend std::ostream& operator<<(std::ostream& out, iterator
i) { return operator<<(out, *i); }
};
/*}}
}*/
bool insert(pkgCache::VerIterator const &V) { if (V.end() == true) r
eturn false; _cont.insert(V); return true; };
template<class Cont> void insert(VersionContainer<Cont> const &verco
nt) { _cont.insert((typename Cont::const_iterator)vercont.begin(), (typenam
e Cont::const_iterator)vercont.end()); };
void insert(const_iterator begin, const_iterator end) { _cont.insert
(begin, end); };
bool empty() const { return _cont.empty(); };
void clear() { return _cont.clear(); };
//FIXME: on ABI break, replace the first with the second without boo
l
void erase(iterator position) { _cont.erase((typename Container::ite
rator)position); };
iterator& erase(iterator &position, bool) { return position = _cont.
erase((typename Container::iterator)position); };
size_t erase(const pkgCache::VerIterator x) { return _cont.erase(x);
};
void erase(iterator first, iterator last) { _cont.erase(first, last)
; };
size_t size() const { return _cont.size(); };
const_iterator begin() const { return const_iterator(_cont.begin());
};
const_iterator end() const { return const_iterator(_cont.end()); };
iterator begin() { return iterator(_cont.begin()); };
iterator end() { return iterator(_cont.end()); };
const_iterator find(pkgCache::VerIterator const &V) const { return c
onst_iterator(_cont.find(V)); };
/** \brief returns all versions specified on the commandline /** \brief returns all versions specified on the commandline
Get all versions from the commandline, uses given default versio n if Get all versions from the commandline, uses given default versio n if
non specifically requested and executes regex's if needed on na mes. non specifically requested and executes regex's if needed on na mes.
\param Cache the packages and versions are in \param Cache the packages and versions are in
\param cmdline Command line the versions should be extracted fro m \param cmdline Command line the versions should be extracted fro m
\param helper responsible for error and message handling */ \param helper responsible for error and message handling */
static APT::VersionSet FromCommandLine(pkgCacheFile &Cache, const ch static VersionContainer FromCommandLine(pkgCacheFile &Cache, const c
ar **cmdline, har **cmdline,
APT::VersionSet::Version const &fallback, CacheSetHe Version const &fallback, CacheSetHelper &helper) {
lper &helper); VersionContainer vercon;
static APT::VersionSet FromCommandLine(pkgCacheFile &Cache, const ch VersionContainerInterface::FromCommandLine(&vercon, Cache, c
ar **cmdline, mdline, fallback, helper);
APT::VersionSet::Version const &fallback) { return vercon;
}
static VersionContainer FromCommandLine(pkgCacheFile &Cache, const c
har **cmdline,
Version const &fallback) {
CacheSetHelper helper; CacheSetHelper helper;
return FromCommandLine(Cache, cmdline, fallback, helper); return FromCommandLine(Cache, cmdline, fallback, helper);
} }
static APT::VersionSet FromCommandLine(pkgCacheFile &Cache, const ch ar **cmdline) { static VersionContainer FromCommandLine(pkgCacheFile &Cache, const c har **cmdline) {
return FromCommandLine(Cache, cmdline, CANDINST); return FromCommandLine(Cache, cmdline, CANDINST);
} }
static APT::VersionSet FromString(pkgCacheFile &Cache, std::string p static VersionContainer FromString(pkgCacheFile &Cache, std::string
kg, const &pkg,
APT::VersionSet::Version const &fallback, CacheSetHe Version const &fallback, CacheSetHelper &helper,
lper &helper, bool const onlyFromName = false) {
bool const &onlyFromName = false); VersionContainer vercon;
static APT::VersionSet FromString(pkgCacheFile &Cache, std::string p VersionContainerInterface::FromString(&vercon, Cache, pkg, f
kg, allback, helper);
APT::VersionSet::Version const &fallback) { return vercon;
}
static VersionContainer FromString(pkgCacheFile &Cache, std::string
pkg,
Version const &fallback) {
CacheSetHelper helper; CacheSetHelper helper;
return FromString(Cache, pkg, fallback, helper); return FromString(Cache, pkg, fallback, helper);
} }
static APT::VersionSet FromString(pkgCacheFile &Cache, std::string p kg) { static VersionContainer FromString(pkgCacheFile &Cache, std::string pkg) {
return FromString(Cache, pkg, CANDINST); return FromString(Cache, pkg, CANDINST);
} }
/** \brief returns all versions specified for the package /** \brief returns all versions specified for the package
\param Cache the package and versions are in \param Cache the package and versions are in
\param P the package in question \param P the package in question
\param fallback the version(s) you want to get \param fallback the version(s) you want to get
\param helper the helper used for display and error handling */ \param helper the helper used for display and error handling */
static APT::VersionSet FromPackage(pkgCacheFile &Cache, pkgCache::Pk static VersionContainer FromPackage(pkgCacheFile &Cache, pkgCache::P
gIterator const &P, kgIterator const &P,
VersionSet::Version const &fallback, CacheSetHelper &helper) Version const &fallback, CacheSetHelper &helper) {
; VersionContainer vercon;
static APT::VersionSet FromPackage(pkgCacheFile &Cache, pkgCache::Pk VersionContainerInterface::FromPackage(&vercon, Cache, P, fa
gIterator const &P, llback, helper);
APT::VersionSet::Version const &fallback) { return vercon;
}
static VersionContainer FromPackage(pkgCacheFile &Cache, pkgCache::P
kgIterator const &P,
Version const &fallback) {
CacheSetHelper helper; CacheSetHelper helper;
return FromPackage(Cache, P, fallback, helper); return FromPackage(Cache, P, fallback, helper);
} }
static APT::VersionSet FromPackage(pkgCacheFile &Cache, pkgCache::Pk static VersionContainer FromPackage(pkgCacheFile &Cache, pkgCache::P
gIterator const &P) { kgIterator const &P) {
return FromPackage(Cache, P, CANDINST); return FromPackage(Cache, P, CANDIDATE);
} }
struct Modifier { static std::map<unsigned short, VersionContainer> GroupedFromCommand
enum Position { NONE, PREFIX, POSTFIX }; Line(
unsigned short ID;
const char * const Alias; pkgCacheFile &Cache,
Position Pos;
VersionSet::Version SelectVersion; const char **cmdline,
Modifier (unsigned short const &id, const char * const alias
, Position const &pos, std::list<Modifier> const &mods,
VersionSet::Version const &select) : ID(id), Alias
(alias), Pos(pos), unsigned short const fallback,
SelectVersion(select) {};
}; CacheSetHelper &helper) {
std::map<unsigned short, VersionContainer> versets;
for (const char **I = cmdline; *I != 0; ++I) {
unsigned short modID = fallback;
VersionContainer verset;
VersionContainerInterface::FromModifierCommandLine(m
odID, &verset, Cache, *I, mods, helper);
versets[modID].insert(verset);
}
return versets;
static std::map<unsigned short, VersionSet> GroupedFromCommandLine( }
pkgCacheFile &Cache, const char **cmdline, static std::map<unsigned short, VersionContainer> GroupedFromCommand
std::list<VersionSet::Modifier> const &mods, Line(
unsigned short const &fallback, CacheSetHelper &helper);
static std::map<unsigned short, VersionSet> GroupedFromCommandLine(
pkgCacheFile &Cache, const char **cmdline, pkgCacheFile &Cache, const char **cmdline,
std::list<VersionSet::Modifier> const &mods, std::list<Modifier> const &mods,
unsigned short const &fallback) { unsigned short const fallback) {
CacheSetHelper helper; CacheSetHelper helper;
return GroupedFromCommandLine(Cache, cmdline, return GroupedFromCommandLine(Cache, cmdline,
mods, fallback, helper); mods, fallback, helper);
} }
/*}}
}*/
protected: /*{{
{*/
/** \brief returns the candidate version of the package static VersionContainer FromDependency(pkgCacheFile &Cache, pkgCache
::DepIterator const &D,
\param Cache to be used to query for information Version const &selector, Cach
\param Pkg we want the candidate version from this package */ eSetHelper &helper) {
static pkgCache::VerIterator getCandidateVer(pkgCacheFile &Cache, VersionContainer vercon;
pkgCache::PkgIterator const &Pkg, CacheSetHelper &helper); VersionContainerInterface::FromDependency(&vercon, Cache, D,
selector, helper);
/** \brief returns the installed version of the package return vercon;
}
\param Cache to be used to query for information static VersionContainer FromDependency(pkgCacheFile &Cache, pkgCache
\param Pkg we want the installed version from this package */ ::DepIterator const &D,
static pkgCache::VerIterator getInstalledVer(pkgCacheFile &Cache, Version const &selector) {
pkgCache::PkgIterator const &Pkg, CacheSetHelper &helper); CacheSetHelper helper;
return FromPackage(Cache, D, selector, helper);
}
static VersionContainer FromDependency(pkgCacheFile &Cache, pkgCache
::DepIterator const &D) {
return FromPackage(Cache, D, CANDIDATE);
}
/*}} }*/ /*}} }*/
}; /*}} }*/ }; /*}} }*/
template<> template<class Cont> void VersionContainer<std::list<pkgCache::V
erIterator> >::insert(VersionContainer<Cont> const &vercont) {
for (typename VersionContainer<Cont>::const_iterator v = vercont.beg
in(); v != vercont.end(); ++v)
_cont.push_back(*v);
};
// these two are 'inline' as otherwise the linker has problems with seeing
these untemplated
// specializations again and again - but we need to see them, so that libra
ry users can use them
template<> inline bool VersionContainer<std::list<pkgCache::VerIterator> >:
:insert(pkgCache::VerIterator const &V) {
if (V.end() == true)
return false;
_cont.push_back(V);
return true;
};
template<> inline void VersionContainer<std::list<pkgCache::VerIterator> >:
:insert(const_iterator begin, const_iterator end) {
for (const_iterator v = begin; v != end; ++v)
_cont.push_back(*v);
};
typedef VersionContainer<std::set<pkgCache::VerIterator> > VersionSet;
typedef VersionContainer<std::list<pkgCache::VerIterator> > VersionList;
} }
#endif #endif
 End of changes. 56 change blocks. 
256 lines changed or deleted 648 lines changed or added


 cdrom.h   cdrom.h 
#ifndef PKGLIB_CDROM_H #ifndef PKGLIB_CDROM_H
#define PKGLIB_CDROM_H #define PKGLIB_CDROM_H
#include<apt-pkg/init.h>
#include<string> #include<string>
#include<vector> #include<vector>
#ifndef APT_8_CLEANER_HEADERS
#include <apt-pkg/init.h>
using namespace std; using namespace std;
#endif
class Configuration;
class OpProgress;
class pkgCdromStatus /*{{ {*/ class pkgCdromStatus /*{{ {*/
{ {
protected: protected:
int totalSteps; int totalSteps;
public: public:
pkgCdromStatus() {}; pkgCdromStatus() {};
virtual ~pkgCdromStatus() {}; virtual ~pkgCdromStatus() {};
// total steps // total steps
virtual void SetTotal(int total) { totalSteps = total; }; virtual void SetTotal(int total) { totalSteps = total; };
// update steps, will be called regularly as a "pulse" // update steps, will be called regularly as a "pulse"
virtual void Update(string text="", int current=0) = 0; virtual void Update(std::string text="", int current=0) = 0;
// ask for cdrom insert // ask for cdrom insert
virtual bool ChangeCdrom() = 0; virtual bool ChangeCdrom() = 0;
// ask for cdrom name // ask for cdrom name
virtual bool AskCdromName(string &Name) = 0; virtual bool AskCdromName(std::string &Name) = 0;
// Progress indicator for the Index rewriter // Progress indicator for the Index rewriter
virtual OpProgress* GetOpProgress() {return NULL; }; virtual OpProgress* GetOpProgress() {return NULL; };
}; };
/*}} }*/ /*}} }*/
class pkgCdrom /*{{ {*/ class pkgCdrom /*{{ {*/
{ {
protected: protected:
enum { enum {
STEP_PREPARE = 1, STEP_PREPARE = 1,
STEP_UNMOUNT, STEP_UNMOUNT,
STEP_WAIT, STEP_WAIT,
STEP_MOUNT, STEP_MOUNT,
STEP_IDENT, STEP_IDENT,
STEP_SCAN, STEP_SCAN,
STEP_COPY, STEP_COPY,
STEP_WRITE, STEP_WRITE,
STEP_UNMOUNT3, STEP_UNMOUNT3,
STEP_LAST STEP_LAST
}; };
bool FindPackages(string CD, bool FindPackages(std::string CD,
vector<string> &List, std::vector<std::string> &List,
vector<string> &SList, std::vector<std::string> &SList,
vector<string> &SigList, std::vector<std::string> &SigList,
vector<string> &TransList, std::vector<std::string> &TransList,
string &InfoDir, pkgCdromStatus *log, std::string &InfoDir, pkgCdromStatus *log,
unsigned int Depth = 0); unsigned int Depth = 0);
bool DropBinaryArch(vector<string> &List); bool DropBinaryArch(std::vector<std::string> &List);
bool DropRepeats(vector<string> &List,const char *Name); bool DropRepeats(std::vector<std::string> &List,const char *Name);
void ReduceSourcelist(string CD,vector<string> &List); void ReduceSourcelist(std::string CD,std::vector<std::string> &List);
bool WriteDatabase(Configuration &Cnf); bool WriteDatabase(Configuration &Cnf);
bool WriteSourceList(string Name,vector<string> &List,bool Source); bool WriteSourceList(std::string Name,std::vector<std::string> &List,boo
int Score(string Path); l Source);
int Score(std::string Path);
public: public:
bool Ident(string &ident, pkgCdromStatus *log); bool Ident(std::string &ident, pkgCdromStatus *log);
bool Add(pkgCdromStatus *log); bool Add(pkgCdromStatus *log);
}; };
/*}} }*/ /*}} }*/
// class that uses libudev to find cdrom/removable devices dynamically // class that uses libudev to find cdrom/removable devices dynamically
struct CdromDevice /*{{ {*/ struct CdromDevice /*{{ {*/
{ {
string DeviceName; std::string DeviceName;
bool Mounted; bool Mounted;
string MountPath; std::string MountPath;
}; };
/*}} }*/ /*}} }*/
class pkgUdevCdromDevices /*{{ {*/ class pkgUdevCdromDevices /*{{ {*/
{ {
protected: protected:
// libudev dlopen stucture // libudev dlopen stucture
void *libudev_handle; void *libudev_handle;
struct udev* (*udev_new)(void); struct udev* (*udev_new)(void);
int (*udev_enumerate_add_match_property)(struct udev_enumerate *udev_enu merate, const char *property, const char *value); int (*udev_enumerate_add_match_property)(struct udev_enumerate *udev_enu merate, const char *property, const char *value);
int (*udev_enumerate_scan_devices)(struct udev_enumerate *udev_enumerate ); int (*udev_enumerate_scan_devices)(struct udev_enumerate *udev_enumerate );
struct udev_list_entry* (*udev_enumerate_get_list_entry)(struct udev_enu merate *udev_enumerate); struct udev_list_entry* (*udev_enumerate_get_list_entry)(struct udev_enu merate *udev_enumerate);
struct udev_device* (*udev_device_new_from_syspath)(struct udev *udev, c onst char *syspath); struct udev_device* (*udev_device_new_from_syspath)(struct udev *udev, c onst char *syspath);
struct udev* (*udev_enumerate_get_udev)(struct udev_enumerate *udev_enum erate); struct udev* (*udev_enumerate_get_udev)(struct udev_enumerate *udev_enum erate);
const char* (*udev_list_entry_get_name)(struct udev_list_entry *list_ent ry); const char* (*udev_list_entry_get_name)(struct udev_list_entry *list_ent ry);
const char* (*udev_device_get_devnode)(struct udev_device *udev_device); const char* (*udev_device_get_devnode)(struct udev_device *udev_device);
struct udev_enumerate *(*udev_enumerate_new) (struct udev *udev); struct udev_enumerate *(*udev_enumerate_new) (struct udev *udev);
struct udev_list_entry *(*udev_list_entry_get_next)(struct udev_list_ent ry *list_entry); struct udev_list_entry *(*udev_list_entry_get_next)(struct udev_list_ent ry *list_entry);
const char* (*udev_device_get_property_value)(struct udev_device *udev_d evice, const char *key); const char* (*udev_device_get_property_value)(struct udev_device *udev_d evice, const char *key);
#if 0 // FIXME: uncomment on next ABI break
int (*udev_enumerate_add_match_sysattr)(struct udev_enumerate *udev_enum erate, const char *property, const char *value); int (*udev_enumerate_add_match_sysattr)(struct udev_enumerate *udev_enum erate, const char *property, const char *value);
#endif
// end libudev dlopen // end libudev dlopen
public: public:
pkgUdevCdromDevices(); pkgUdevCdromDevices();
virtual ~pkgUdevCdromDevices(); virtual ~pkgUdevCdromDevices();
// try to open // try to open
bool Dlopen(); bool Dlopen();
// this is the new interface // convenience interface, this will just call ScanForRemovable
vector<CdromDevice> ScanForRemovable(bool CdromOnly); // with "APT::cdrom::CdromOnly"
// FIXME: compat with the old interface/API/ABI only std::vector<CdromDevice> Scan();
vector<CdromDevice> Scan();
std::vector<CdromDevice> ScanForRemovable(bool CdromOnly);
}; };
/*}} }*/ /*}} }*/
#endif #endif
 End of changes. 15 change blocks. 
23 lines changed or deleted 27 lines changed or added


 cdromutl.h   cdromutl.h 
skipping to change at line 15 skipping to change at line 15
CDROM Utilities - Some functions to manipulate CDROM mounts. CDROM Utilities - Some functions to manipulate CDROM mounts.
##################################################################### */ ##################################################################### */
/*}} }*/ /*}} }*/
#ifndef PKGLIB_CDROMUTL_H #ifndef PKGLIB_CDROMUTL_H
#define PKGLIB_CDROMUTL_H #define PKGLIB_CDROMUTL_H
#include <string> #include <string>
#ifndef APT_8_CLEANER_HEADERS
using std::string; using std::string;
#endif
// mount cdrom, DeviceName (e.g. /dev/sr0) is optional // mount cdrom, DeviceName (e.g. /dev/sr0) is optional
bool MountCdrom(string Path, string DeviceName=""); bool MountCdrom(std::string Path, std::string DeviceName="");
bool UnmountCdrom(string Path); bool UnmountCdrom(std::string Path);
bool IdentCdrom(string CD,string &Res,unsigned int Version = 2); bool IdentCdrom(std::string CD,std::string &Res,unsigned int Version = 2);
bool IsMounted(string &Path); bool IsMounted(std::string &Path);
string FindMountPointForDevice(const char *device); std::string FindMountPointForDevice(const char *device);
#endif #endif
 End of changes. 3 change blocks. 
5 lines changed or deleted 7 lines changed or added


 clean.h   clean.h 
skipping to change at line 17 skipping to change at line 17
##################################################################### */ ##################################################################### */
/*}} }*/ /*}} }*/
#ifndef APTPKG_CLEAN_H #ifndef APTPKG_CLEAN_H
#define APTPKG_CLEAN_H #define APTPKG_CLEAN_H
#include <apt-pkg/pkgcache.h> #include <apt-pkg/pkgcache.h>
class pkgArchiveCleaner class pkgArchiveCleaner
{ {
/** \brief dpointer placeholder (for later in case we need it) */
void *d;
protected: protected:
virtual void Erase(const char * /*File*/,string /*Pkg*/,string /*Ver*/,s truct stat & /*St*/) {}; virtual void Erase(const char * /*File*/,std::string /*Pkg*/,std::string /*Ver*/,struct stat & /*St*/) {};
public: public:
bool Go(string Dir,pkgCache &Cache); bool Go(std::string Dir,pkgCache &Cache);
virtual ~pkgArchiveCleaner() {}; virtual ~pkgArchiveCleaner() {};
}; };
#endif #endif
 End of changes. 3 change blocks. 
2 lines changed or deleted 5 lines changed or added


 cmndline.h   cmndline.h 
skipping to change at line 47 skipping to change at line 47
ArbItem - Means the item is an arbitrary configuration string of ArbItem - Means the item is an arbitrary configuration string of
the form item=value, where item is passed directly the form item=value, where item is passed directly
to the configuration class. to the configuration class.
The default, if the flags are 0 is to use Boolean The default, if the flags are 0 is to use Boolean
##################################################################### */ ##################################################################### */
/*}} }*/ /*}} }*/
#ifndef PKGLIB_CMNDLINE_H #ifndef PKGLIB_CMNDLINE_H
#define PKGLIB_CMNDLINE_H #define PKGLIB_CMNDLINE_H
#ifndef APT_8_CLEANER_HEADERS
#include <apt-pkg/configuration.h> #include <apt-pkg/configuration.h>
#endif
class Configuration;
class CommandLine class CommandLine
{ {
public: public:
struct Args; struct Args;
struct Dispatch; struct Dispatch;
protected: protected:
Args *ArgList; Args *ArgList;
 End of changes. 2 change blocks. 
0 lines changed or deleted 4 lines changed or added


 config.h   config.h 
skipping to change at line 23 skipping to change at line 23
/* The number of bytes in a unsigned long. */ /* The number of bytes in a unsigned long. */
/* #undef SIZEOF_LONG */ /* #undef SIZEOF_LONG */
/* The number of bytes in a unsigned short. */ /* The number of bytes in a unsigned short. */
/* #undef SIZEOF_SHORT */ /* #undef SIZEOF_SHORT */
/* Define if we have the timegm() function */ /* Define if we have the timegm() function */
#define HAVE_TIMEGM 1 #define HAVE_TIMEGM 1
/* Define if we have the zlib library for gzip */
#define HAVE_ZLIB 1
/* Define if we have the bz2 library for bzip2 */
#define HAVE_BZ2 1
/* These two are used by the statvfs shim for glibc2.0 and bsd */ /* These two are used by the statvfs shim for glibc2.0 and bsd */
/* Define if we have sys/vfs.h */ /* Define if we have sys/vfs.h */
/* #undef HAVE_VFS_H */ /* #undef HAVE_VFS_H */
#define HAVE_STRUCT_STATFS_F_TYPE 1 #define HAVE_STRUCT_STATFS_F_TYPE 1
/* Define if we have sys/mount.h */ /* Define if we have sys/mount.h */
/* #undef HAVE_MOUNT_H */ /* #undef HAVE_MOUNT_H */
/* 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 to the size of the filesize containing structures */
#define _FILE_OFFSET_BITS 64
/* Define the arch name string */ /* Define the arch name string */
#define COMMON_ARCH "i386" #define COMMON_ARCH "i386"
/* The version number string */
#define VERSION "0.8.15.10"
/* The package name string */ /* The package name string */
#define PACKAGE "apt" #define PACKAGE "apt"
/* The version number string */
#define PACKAGE_VERSION "0.9.0"
#define APT_8_CLEANER_HEADERS
 End of changes. 4 change blocks. 
3 lines changed or deleted 9 lines changed or added


 configuration.h   configuration.h 
skipping to change at line 37 skipping to change at line 37
/*}} }*/ /*}} }*/
#ifndef PKGLIB_CONFIGURATION_H #ifndef PKGLIB_CONFIGURATION_H
#define PKGLIB_CONFIGURATION_H #define PKGLIB_CONFIGURATION_H
#include <regex.h> #include <regex.h>
#include <string> #include <string>
#include <vector> #include <vector>
#include <iostream> #include <iostream>
#ifndef APT_8_CLEANER_HEADERS
using std::string; using std::string;
#endif
class Configuration class Configuration
{ {
public: public:
struct Item struct Item
{ {
string Value; std::string Value;
string Tag; std::string Tag;
Item *Parent; Item *Parent;
Item *Child; Item *Child;
Item *Next; Item *Next;
string FullTag(const Item *Stop = 0) const; std::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 const &Len,bool cons t &Create); Item *Lookup(Item *Head,const char *S,unsigned long const &Len,bool cons t &Create);
Item *Lookup(const char *Name,const bool &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; std::string Find(const char *Name,const char *Default = 0) const;
string Find(string const &Name,const char *Default = 0) const {return Fi std::string Find(std::string const &Name,const char *Default = 0) const
nd(Name.c_str(),Default);}; {return Find(Name.c_str(),Default);};
string Find(string const &Name, string const &Default) const {return Fin std::string Find(std::string const &Name, std::string const &Default) co
d(Name.c_str(),Default.c_str());}; nst {return Find(Name.c_str(),Default.c_str());};
string FindFile(const char *Name,const char *Default = 0) const; std::string FindFile(const char *Name,const char *Default = 0) const;
string FindDir(const char *Name,const char *Default = 0) const; std::string FindDir(const char *Name,const char *Default = 0) const;
std::vector<string> FindVector(const char *Name) const; std::vector<std::string> FindVector(const char *Name) const;
std::vector<string> FindVector(string const &Name) const { return FindVe std::vector<std::string> FindVector(std::string const &Name) const { ret
ctor(Name.c_str()); }; urn FindVector(Name.c_str()); };
int FindI(const char *Name,int const &Default = 0) const; int FindI(const char *Name,int const &Default = 0) const;
int FindI(string const &Name,int const &Default = 0) const {return FindI (Name.c_str(),Default);}; int FindI(std::string const &Name,int const &Default = 0) const {return FindI(Name.c_str(),Default);};
bool FindB(const char *Name,bool const &Default = false) const; bool FindB(const char *Name,bool const &Default = false) const;
bool FindB(string const &Name,bool const &Default = false) const {return bool FindB(std::string const &Name,bool const &Default = false) const {r
FindB(Name.c_str(),Default);}; eturn FindB(Name.c_str(),Default);};
string FindAny(const char *Name,const char *Default = 0) const; std::string FindAny(const char *Name,const char *Default = 0) const;
inline void Set(const string &Name,const string &Value) {Set(Name.c_str( inline void Set(const std::string &Name,const std::string &Value) {Set(N
),Value);}; ame.c_str(),Value);};
void CndSet(const char *Name,const string &Value); void CndSet(const char *Name,const std::string &Value);
void CndSet(const char *Name,const int Value); void CndSet(const char *Name,const int Value);
void Set(const char *Name,const string &Value); void Set(const char *Name,const std::string &Value);
void Set(const char *Name,const 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 std::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 std::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(string const &List, string const &Value); void Clear(std::string const &List, std::string const &Value);
void Clear(string const &List, int const &Value); void Clear(std::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();
skipping to change at line 130 skipping to change at line 132
bool Match(char const * str) const; bool Match(char const * str) const;
bool Match(std::string const &str) const { return Match(str.c_str()); }; bool Match(std::string const &str) const { return Match(str.c_str()); };
/** \brief returns if the matcher setup was successful */ /** \brief returns if the matcher setup was successful */
bool wasConstructedSuccessfully() const { return patterns.empty() == f alse; } 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 std::string &FName,
bool const &AsSectional = false, bool const &AsSectional = false,
unsigned const &Depth = 0); unsigned const &Depth = 0);
bool ReadConfigDir(Configuration &Conf,const string &Dir, bool ReadConfigDir(Configuration &Conf,const std::string &Dir,
bool const &AsSectional = false, bool const &AsSectional = false,
unsigned const &Depth = 0); unsigned const &Depth = 0);
#endif #endif
 End of changes. 14 change blocks. 
27 lines changed or deleted 29 lines changed or added


 crc-16.h   crc-16.h 
skipping to change at line 15 skipping to change at line 15
CRC16 - Compute a 16bit crc very quickly CRC16 - Compute a 16bit crc very quickly
##################################################################### */ ##################################################################### */
/*}} }*/ /*}} }*/
#ifndef APTPKG_CRC16_H #ifndef APTPKG_CRC16_H
#define APTPKG_CRC16_H #define APTPKG_CRC16_H
#define INIT_FCS 0xffff #define INIT_FCS 0xffff
unsigned short AddCRC16(unsigned short fcs, void const *buf, unsigned short AddCRC16(unsigned short fcs, void const *buf,
unsigned long len); unsigned long long len);
#endif #endif
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 debfile.h   debfile.h 
skipping to change at line 27 skipping to change at line 27
The memory control file extractor is useful to extract a single file The memory control file extractor is useful to extract a single file
into memory from the control.tar.gz into memory from the control.tar.gz
##################################################################### */ ##################################################################### */
/*}} }*/ /*}} }*/
#ifndef PKGLIB_DEBFILE_H #ifndef PKGLIB_DEBFILE_H
#define PKGLIB_DEBFILE_H #define PKGLIB_DEBFILE_H
#include <apt-pkg/arfile.h> #include <apt-pkg/arfile.h>
#include <apt-pkg/database.h>
#include <apt-pkg/dirstream.h> #include <apt-pkg/dirstream.h>
#include <apt-pkg/tagfile.h> #include <apt-pkg/tagfile.h>
#include <apt-pkg/pkgcache.h>
class FileFd;
class debDebFile class debDebFile
{ {
protected: protected:
FileFd &File; FileFd &File;
ARArchive AR; ARArchive AR;
bool CheckMember(const char *Name); bool CheckMember(const char *Name);
public: public:
class ControlExtract; class ControlExtract;
class MemControlExtract; class MemControlExtract;
bool ExtractControl(pkgDataBase &DB);
bool ExtractArchive(pkgDirStream &Stream); bool ExtractArchive(pkgDirStream &Stream);
pkgCache::VerIterator MergeControl(pkgDataBase &DB);
const ARArchive::Member *GotoMember(const char *Name); const ARArchive::Member *GotoMember(const char *Name);
inline FileFd &GetFile() {return File;}; inline FileFd &GetFile() {return File;};
debDebFile(FileFd &File); debDebFile(FileFd &File);
}; };
class debDebFile::ControlExtract : public pkgDirStream class debDebFile::ControlExtract : public pkgDirStream
{ {
public: public:
skipping to change at line 70 skipping to change at line 69
class debDebFile::MemControlExtract : public pkgDirStream class debDebFile::MemControlExtract : public pkgDirStream
{ {
bool IsControl; bool IsControl;
public: public:
char *Control; char *Control;
pkgTagSection Section; pkgTagSection Section;
unsigned long Length; unsigned long Length;
string Member; std::string Member;
// Members from DirStream // Members from DirStream
virtual bool DoItem(Item &Itm,int &Fd); virtual bool DoItem(Item &Itm,int &Fd);
virtual bool Process(Item &Itm,const unsigned char *Data, virtual bool Process(Item &Itm,const unsigned char *Data,
unsigned long Size,unsigned long Pos); unsigned long Size,unsigned long Pos);
// Helpers // Helpers
bool Read(debDebFile &Deb); bool Read(debDebFile &Deb);
bool TakeControl(const void *Data,unsigned long Size); bool TakeControl(const void *Data,unsigned long Size);
MemControlExtract() : IsControl(false), Control(0), Length(0), Member("c ontrol") {}; MemControlExtract() : IsControl(false), Control(0), Length(0), Member("c ontrol") {};
MemControlExtract(string Member) : IsControl(false), Control(0), Length( 0), Member(Member) {}; MemControlExtract(std::string Member) : IsControl(false), Control(0), Le ngth(0), Member(Member) {};
~MemControlExtract() {delete [] Control;}; ~MemControlExtract() {delete [] Control;};
}; };
/*}} }*/ /*}} }*/
#endif #endif
 End of changes. 7 change blocks. 
6 lines changed or deleted 5 lines changed or added


 debindexfile.h   debindexfile.h 
skipping to change at line 23 skipping to change at line 23
##################################################################### */ ##################################################################### */
/*}} }*/ /*}} }*/
#ifndef PKGLIB_DEBINDEXFILE_H #ifndef PKGLIB_DEBINDEXFILE_H
#define PKGLIB_DEBINDEXFILE_H #define PKGLIB_DEBINDEXFILE_H
#include <apt-pkg/indexfile.h> #include <apt-pkg/indexfile.h>
class debStatusIndex : public pkgIndexFile class debStatusIndex : public pkgIndexFile
{ {
string File; /** \brief dpointer placeholder (for later in case we need it) */
void *d;
protected:
std::string File;
public: public:
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 std::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;
bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog, unsigned long const Flag) const;
virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const; virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
debStatusIndex(string File); debStatusIndex(std::string File);
virtual ~debStatusIndex() {};
}; };
class debPackagesIndex : public pkgIndexFile class debPackagesIndex : public pkgIndexFile
{ {
string URI; /** \brief dpointer placeholder (for later in case we need it) */
string Dist; void *d;
string Section;
string Architecture; std::string URI;
std::string Dist;
string Info(const char *Type) const; std::string Section;
string IndexFile(const char *Type) const; std::string Architecture;
string IndexURI(const char *Type) const;
std::string Info(const char *Type) const;
std::string IndexFile(const char *Type) const;
std::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 std::string ArchiveInfo(pkgCache::VerIterator Ver) const;
virtual string ArchiveURI(string File) const {return URI + File;}; virtual std::string ArchiveURI(std::string File) const {return URI + Fil
e;};
// Interface for acquire // Interface for acquire
virtual string Describe(bool Short) const; virtual std::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 const &URI, string const &Dist, string const &Se debPackagesIndex(std::string const &URI, std::string const &Dist, std::s
ction, tring const &Section,
bool const &Trusted, string const &Arch = "native"); bool const &Trusted, std::string const &Arch = "nati
ve");
virtual ~debPackagesIndex() {};
}; };
class debTranslationsIndex : public pkgIndexFile class debTranslationsIndex : public pkgIndexFile
{ {
string URI; /** \brief dpointer placeholder (for later in case we need it) */
string Dist; void *d;
string Section;
std::string URI;
std::string Dist;
std::string Section;
const char * const Language; const char * const Language;
string Info(const char *Type) const; std::string Info(const char *Type) const;
string IndexFile(const char *Type) const; std::string IndexFile(const char *Type) const;
string IndexURI(const char *Type) const; std::string IndexURI(const char *Type) const;
inline string TranslationFile() const {return string("Translation-").app end(Language);}; inline std::string TranslationFile() const {return std::string("Translat ion-").append(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 std::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, char const * debTranslationsIndex(std::string URI,std::string Dist,std::string Sectio
const Language); n, char const * const Language);
virtual ~debTranslationsIndex() {};
}; };
class debSourcesIndex : public pkgIndexFile class debSourcesIndex : public pkgIndexFile
{ {
string URI; /** \brief dpointer placeholder (for later in case we need it) */
string Dist; void *d;
string Section;
std::string URI;
string Info(const char *Type) const; std::string Dist;
string IndexFile(const char *Type) const; std::string Section;
string IndexURI(const char *Type) const;
std::string Info(const char *Type) const;
std::string IndexFile(const char *Type) const;
std::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 SourceInfo(pkgSrcRecords::Parser const &Record, virtual std::string SourceInfo(pkgSrcRecords::Parser const &Record,
pkgSrcRecords::File const &File) const; pkgSrcRecords::File const &File) const;
virtual string ArchiveURI(string File) const {return URI + File;}; virtual std::string ArchiveURI(std::string File) const {return URI + Fil e;};
// Interface for acquire // Interface for acquire
virtual string Describe(bool Short) const; virtual std::string Describe(bool Short) const;
// Interface for the record parsers // Interface for the record parsers
virtual pkgSrcRecords::Parser *CreateSrcParser() const; virtual pkgSrcRecords::Parser *CreateSrcParser() const;
// Interface for the Cache Generator // Interface for the Cache Generator
virtual bool Exists() const; virtual bool Exists() const;
virtual bool HasPackages() const {return false;}; virtual bool HasPackages() const {return false;};
virtual unsigned long Size() const; virtual unsigned long Size() const;
debSourcesIndex(string URI,string Dist,string Section,bool Trusted); debSourcesIndex(std::string URI,std::string Dist,std::string Section,boo
l Trusted);
virtual ~debSourcesIndex() {};
}; };
#endif #endif
 End of changes. 18 change blocks. 
38 lines changed or deleted 59 lines changed or added


 deblistparser.h   deblistparser.h 
skipping to change at line 15 skipping to change at line 15
Debian Package List Parser - This implements the abstract parser Debian Package List Parser - This implements the abstract parser
interface for Debian package files interface for Debian package files
##################################################################### */ ##################################################################### */
/*}} }*/ /*}} }*/
#ifndef PKGLIB_DEBLISTPARSER_H #ifndef PKGLIB_DEBLISTPARSER_H
#define PKGLIB_DEBLISTPARSER_H #define PKGLIB_DEBLISTPARSER_H
#include <apt-pkg/pkgcachegen.h> #include <apt-pkg/pkgcachegen.h>
#include <apt-pkg/indexfile.h>
#include <apt-pkg/tagfile.h> #include <apt-pkg/tagfile.h>
#ifndef APT_8_CLEANER_HEADERS
#include <apt-pkg/indexfile.h>
#endif
class debListParser : public pkgCacheGenerator::ListParser class debListParser : public pkgCacheGenerator::ListParser
{ {
public: public:
// Parser Helper // Parser Helper
struct WordList struct WordList
{ {
const char *Str; const char *Str;
unsigned char Val; unsigned char Val;
}; };
private: private:
/** \brief dpointer placeholder (for later in case we need it) */
void *d;
protected:
pkgTagFile Tags; pkgTagFile Tags;
pkgTagSection Section; pkgTagSection Section;
unsigned long iOffset; unsigned long iOffset;
string Arch; std::string Arch;
std::vector<std::string> Architectures; std::vector<std::string> Architectures;
bool MultiArchEnabled; bool MultiArchEnabled;
unsigned long UniqFindTagWrite(const char *Tag); unsigned long UniqFindTagWrite(const char *Tag);
bool ParseStatus(pkgCache::PkgIterator &Pkg,pkgCache::VerIterator &Ver); virtual bool ParseStatus(pkgCache::PkgIterator &Pkg,pkgCache::VerIterato r &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);
bool NewProvidesAllArch(pkgCache::VerIterator &Ver, string const &Packag bool NewProvidesAllArch(pkgCache::VerIterator &Ver, std::string const &P
e, string const &Version); ackage, std::string const &Version);
static bool GrabWord(string Word,WordList *List,unsigned char &Out); static bool GrabWord(std::string Word,WordList *List,unsigned char &Out)
;
public: public:
static unsigned char GetPrio(string Str); static unsigned char GetPrio(std::string Str);
// These all operate against the current section // These all operate against the current section
virtual string Package(); virtual std::string Package();
virtual string Architecture(); virtual std::string Architecture();
virtual bool ArchitectureAll(); virtual bool ArchitectureAll();
virtual string Version(); virtual std::string Version();
virtual bool NewVersion(pkgCache::VerIterator &Ver); virtual bool NewVersion(pkgCache::VerIterator &Ver);
virtual string Description(); virtual std::string Description();
virtual string DescriptionLanguage(); virtual std::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); std::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, std::string &Package,std::string &Ver,unsigned i nt &Op,
bool const &ParseArchFlags = false, bool const &ParseArchFlags = false,
bool const &StripMultiArch = true); bool const &StripMultiArch = true);
static const char *ConvertRelation(const char *I,unsigned int &Op); static const char *ConvertRelation(const char *I,unsigned int &Op);
debListParser(FileFd *File, string const &Arch = ""); debListParser(FileFd *File, std::string const &Arch = "");
virtual ~debListParser() {};
}; };
#endif #endif
 End of changes. 14 change blocks. 
15 lines changed or deleted 23 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 <map> #include <map>
#include <string>
#include <vector>
#ifndef APT_8_CLEANER_HEADERS
#include <apt-pkg/sourcelist.h>
#endif
class debReleaseIndex : public metaIndex { class debReleaseIndex : public metaIndex {
public: public:
class debSectionEntry class debSectionEntry
{ {
public: public:
debSectionEntry (string const &Section, bool const &IsSrc); debSectionEntry (std::string const &Section, bool const &IsSrc);
string const Section; std::string const Section;
bool const IsSrc; bool const IsSrc;
}; };
private: private:
std::map<string, vector<debSectionEntry const*> > ArchEntries; /** \brief dpointer placeholder (for later in case we need it) */
void *d;
std::map<std::string, std::vector<debSectionEntry const*> > ArchEntries;
enum { ALWAYS_TRUSTED, NEVER_TRUSTED, CHECK_TRUST } Trusted;
public: public:
debReleaseIndex(string const &URI, string const &Dist); debReleaseIndex(std::string const &URI, std::string const &Dist);
~debReleaseIndex(); debReleaseIndex(std::string const &URI, std::string const &Dist, bool co
nst Trusted);
virtual ~debReleaseIndex();
virtual string ArchiveURI(string const &File) const {return URI + File;} ; virtual std::string ArchiveURI(std::string const &File) const {return UR I + File;};
virtual bool GetIndexes(pkgAcquire *Owner, bool const &GetAll=false) con st; virtual bool GetIndexes(pkgAcquire *Owner, bool const &GetAll=false) con st;
vector <struct IndexTarget *>* ComputeIndexTargets() const; std::vector <struct IndexTarget *>* ComputeIndexTargets() const;
string Info(const char *Type, string const &Section, string const &Arch= std::string Info(const char *Type, std::string const &Section, std::stri
"") const; ng const &Arch="") const;
string MetaIndexInfo(const char *Type) const; std::string MetaIndexInfo(const char *Type) const;
string MetaIndexFile(const char *Types) const; std::string MetaIndexFile(const char *Types) const;
string MetaIndexURI(const char *Type) const; std::string MetaIndexURI(const char *Type) const;
string IndexURI(const char *Type, string const &Section, string const &A std::string IndexURI(const char *Type, std::string const &Section, std::
rch="native") const; string const &Arch="native") const;
string IndexURISuffix(const char *Type, string const &Section, string co std::string IndexURISuffix(const char *Type, std::string const &Section,
nst &Arch="native") const; std::string const &Arch="native") const;
string SourceIndexURI(const char *Type, const string &Section) const; std::string SourceIndexURI(const char *Type, const std::string &Section)
string SourceIndexURISuffix(const char *Type, const string &Section) con const;
st; std::string SourceIndexURISuffix(const char *Type, const std::string &Se
string TranslationIndexURI(const char *Type, const string &Section) cons ction) const;
t; std::string TranslationIndexURI(const char *Type, const std::string &Sec
string TranslationIndexURISuffix(const char *Type, const string &Section tion) const;
) const; std::string TranslationIndexURISuffix(const char *Type, const std::strin
virtual vector <pkgIndexFile *> *GetIndexFiles(); g &Section) const;
virtual std::vector <pkgIndexFile *> *GetIndexFiles();
void SetTrusted(bool const Trusted);
virtual bool IsTrusted() const; virtual bool IsTrusted() const;
void PushSectionEntry(vector<string> const &Archs, const debSectionEntry void PushSectionEntry(std::vector<std::string> const &Archs, const debSe
*Entry); ctionEntry *Entry);
void PushSectionEntry(string const &Arch, const debSectionEntry *Entry); void PushSectionEntry(std::string const &Arch, const debSectionEntry *En
try);
void PushSectionEntry(const debSectionEntry *Entry); void PushSectionEntry(const debSectionEntry *Entry);
}; };
#endif #endif
 End of changes. 9 change blocks. 
28 lines changed or deleted 41 lines changed or added


 debrecords.h   debrecords.h 
skipping to change at line 18 skipping to change at line 18
This provides display-type parsing for the Packages file. This is This provides display-type parsing for the Packages file. This is
different than the the list parser which provides cache generation different than the the list parser which provides cache generation
services. There should be no overlap between these two. services. There should be no overlap between these two.
##################################################################### */ ##################################################################### */
/*}} }*/ /*}} }*/
#ifndef PKGLIB_DEBRECORDS_H #ifndef PKGLIB_DEBRECORDS_H
#define PKGLIB_DEBRECORDS_H #define PKGLIB_DEBRECORDS_H
#include <apt-pkg/pkgrecords.h> #include <apt-pkg/pkgrecords.h>
#include <apt-pkg/indexfile.h>
#include <apt-pkg/tagfile.h> #include <apt-pkg/tagfile.h>
#include <apt-pkg/fileutl.h>
#ifndef APT_8_CLEANER_HEADERS
#include <apt-pkg/indexfile.h>
#endif
class debRecordParser : public pkgRecords::Parser class debRecordParser : public pkgRecords::Parser
{ {
/** \brief dpointer placeholder (for later in case we need it) */
void *d;
FileFd File; FileFd File;
pkgTagFile Tags; pkgTagFile Tags;
pkgTagSection Section; pkgTagSection Section;
protected: protected:
virtual bool Jump(pkgCache::VerFileIterator const &Ver); virtual bool Jump(pkgCache::VerFileIterator const &Ver);
virtual bool Jump(pkgCache::DescFileIterator const &Desc); virtual bool Jump(pkgCache::DescFileIterator const &Desc);
public: public:
// These refer to the archive file for the Version // These refer to the archive file for the Version
virtual string FileName(); virtual std::string FileName();
virtual string MD5Hash(); virtual std::string MD5Hash();
virtual string SHA1Hash(); virtual std::string SHA1Hash();
virtual string SHA256Hash(); virtual std::string SHA256Hash();
virtual string SourcePkg(); virtual std::string SHA512Hash();
virtual string SourceVer(); virtual std::string SourcePkg();
virtual std::string SourceVer();
// These are some general stats about the package // These are some general stats about the package
virtual string Maintainer(); virtual std::string Maintainer();
virtual string ShortDesc(); virtual std::string ShortDesc();
virtual string LongDesc(); virtual std::string LongDesc();
virtual string Name(); virtual std::string Name();
virtual string Homepage(); virtual std::string Homepage();
// An arbitrary custom field
virtual std::string RecordField(const char *fieldName);
virtual void GetRec(const char *&Start,const char *&Stop); virtual void GetRec(const char *&Start,const char *&Stop);
debRecordParser(string FileName,pkgCache &Cache); debRecordParser(std::string FileName,pkgCache &Cache);
virtual ~debRecordParser() {};
}; };
#endif #endif
 End of changes. 6 change blocks. 
13 lines changed or deleted 25 lines changed or added


 debsrcrecords.h   debsrcrecords.h 
skipping to change at line 20 skipping to change at line 20
/*}} }*/ /*}} }*/
#ifndef PKGLIB_DEBSRCRECORDS_H #ifndef PKGLIB_DEBSRCRECORDS_H
#define PKGLIB_DEBSRCRECORDS_H #define PKGLIB_DEBSRCRECORDS_H
#include <apt-pkg/srcrecords.h> #include <apt-pkg/srcrecords.h>
#include <apt-pkg/tagfile.h> #include <apt-pkg/tagfile.h>
#include <apt-pkg/fileutl.h> #include <apt-pkg/fileutl.h>
class debSrcRecordParser : public pkgSrcRecords::Parser class debSrcRecordParser : public pkgSrcRecords::Parser
{ {
/** \brief dpointer placeholder (for later in case we need it) */
void *d;
FileFd Fd; FileFd Fd;
pkgTagFile Tags; pkgTagFile Tags;
pkgTagSection Sect; pkgTagSection Sect;
char *StaticBinList[400]; std::vector<const char*> StaticBinList;
unsigned long iOffset; unsigned long iOffset;
char *Buffer; char *Buffer;
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 const &Off) {iOffset = Off; return Tags. Jump(Sect,Off);}; virtual bool Jump(unsigned long const &Off) {iOffset = Off; return Tags. Jump(Sect,Off);};
virtual string Package() const {return Sect.FindS("Package");}; virtual std::string Package() const {return Sect.FindS("Package");};
virtual string Version() const {return Sect.FindS("Version");}; virtual std::string Version() const {return Sect.FindS("Version");};
virtual string Maintainer() const {return Sect.FindS("Maintainer");}; virtual std::string Maintainer() const {return Sect.FindS("Maintainer");
virtual string Section() const {return Sect.FindS("Section");}; };
virtual std::string Section() const {return Sect.FindS("Section");};
virtual const char **Binaries(); virtual const char **Binaries();
virtual bool BuildDepends(vector<BuildDepRec> &BuildDeps, bool const &Ar chOnly, bool const &StripMultiArch = true); virtual bool BuildDepends(std::vector<BuildDepRec> &BuildDeps, bool cons t &ArchOnly, bool const &StripMultiArch = true);
virtual unsigned long Offset() {return iOffset;}; virtual unsigned long Offset() {return iOffset;};
virtual string AsStr() virtual std::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 std::string(Start,Stop);
}; };
virtual bool Files(vector<pkgSrcRecords::File> &F); virtual bool Files(std::vector<pkgSrcRecords::File> &F);
debSrcRecordParser(string const &File,pkgIndexFile const *Index) debSrcRecordParser(std::string const &File,pkgIndexFile const *Index)
: Parser(Index), Fd(File,FileFd::ReadOnlyGzip), Tags(&Fd,102400), : Parser(Index), Fd(File,FileFd::ReadOnly, FileFd::Extension), Tags(&
Buffer(0), BufSize(0) {} Fd,102400),
~debSrcRecordParser(); Buffer(NULL) {}
virtual ~debSrcRecordParser();
}; };
#endif #endif
 End of changes. 9 change blocks. 
14 lines changed or deleted 18 lines changed or added


 debsystem.h   debsystem.h 
skipping to change at line 14 skipping to change at line 14
/* ###################################################################### /* ######################################################################
System - Debian version of the System Class System - Debian version of the System Class
##################################################################### */ ##################################################################### */
/*}} }*/ /*}} }*/
#ifndef PKGLIB_DEBSYSTEM_H #ifndef PKGLIB_DEBSYSTEM_H
#define PKGLIB_DEBSYSTEM_H #define PKGLIB_DEBSYSTEM_H
#include <apt-pkg/pkgsystem.h> #include <apt-pkg/pkgsystem.h>
#include <apt-pkg/pkgcache.h>
class debSystemPrivate;
class debStatusIndex; class debStatusIndex;
class pkgDepCache;
class debSystem : public pkgSystem class debSystem : public pkgSystem
{ {
// For locking support // private d-pointer
int LockFD; debSystemPrivate *d;
unsigned LockCount;
bool CheckUpdates(); bool CheckUpdates();
debStatusIndex *StatusFile;
public: public:
virtual bool Lock(); virtual bool Lock();
virtual bool UnLock(bool NoErrors = false); virtual bool UnLock(bool NoErrors = false);
virtual pkgPackageManager *CreatePM(pkgDepCache *Cache) const; virtual pkgPackageManager *CreatePM(pkgDepCache *Cache) const;
virtual bool Initialize(Configuration &Cnf); virtual bool Initialize(Configuration &Cnf);
virtual bool ArchiveSupported(const char *Type); virtual bool ArchiveSupported(const char *Type);
virtual signed Score(Configuration const &Cnf); virtual signed Score(Configuration const &Cnf);
virtual bool AddStatusFiles(std::vector<pkgIndexFile *> &List); virtual bool AddStatusFiles(std::vector<pkgIndexFile *> &List);
virtual bool FindIndex(pkgCache::PkgFileIterator File, virtual bool FindIndex(pkgCache::PkgFileIterator File,
pkgIndexFile *&Found) const; pkgIndexFile *&Found) const;
debSystem(); debSystem();
~debSystem(); virtual ~debSystem();
}; };
extern debSystem debSys; extern debSystem debSys;
#endif #endif
 End of changes. 6 change blocks. 
6 lines changed or deleted 7 lines changed or added


 debversion.h   debversion.h 
skipping to change at line 33 skipping to change at line 33
// Compare versions.. // Compare versions..
virtual int DoCmpVersion(const char *A,const char *Aend, virtual int DoCmpVersion(const char *A,const char *Aend,
const char *B,const char *Bend); const char *B,const char *Bend);
virtual bool CheckDep(const char *PkgVer,int Op,const char *DepVer); virtual bool CheckDep(const char *PkgVer,int Op,const char *DepVer);
virtual int DoCmpReleaseVer(const char *A,const char *Aend, virtual int DoCmpReleaseVer(const char *A,const char *Aend,
const char *B,const char *Bend) const char *B,const char *Bend)
{ {
return DoCmpVersion(A,Aend,B,Bend); return DoCmpVersion(A,Aend,B,Bend);
} }
virtual string UpstreamVersion(const char *A); virtual std::string UpstreamVersion(const char *A);
debVersioningSystem(); debVersioningSystem();
}; };
extern debVersioningSystem debVS; extern debVersioningSystem debVS;
#ifdef APT_COMPATIBILITY
#if APT_COMPATIBILITY != 986
#warning "Using APT_COMPATIBILITY"
#endif
inline int pkgVersionCompare(const char *A, const char *B)
{
return debVS.CmpVersion(A,B);
}
inline int pkgVersionCompare(const char *A, const char *AEnd,
const char *B, const char *BEnd)
{
return debVS.DoCmpVersion(A,AEnd,B,BEnd);
}
inline int pkgVersionCompare(string A,string B)
{
return debVS.CmpVersion(A,B);
}
inline bool pkgCheckDep(const char *DepVer,const char *PkgVer,int Op)
{
return debVS.CheckDep(PkgVer,Op,DepVer);
}
inline string pkgBaseVersion(const char *Ver)
{
return debVS.UpstreamVersion(Ver);
}
#endif
#endif #endif
 End of changes. 2 change blocks. 
29 lines changed or deleted 1 lines changed or added


 depcache.h   depcache.h 
skipping to change at line 43 skipping to change at line 43
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/configuration.h>
#include <apt-pkg/pkgcache.h> #include <apt-pkg/pkgcache.h>
#include <apt-pkg/progress.h>
#include <apt-pkg/error.h>
#include <vector> #include <vector>
#include <memory> #include <memory>
#include <set> #include <set>
#include <list>
#ifndef APT_8_CLEANER_HEADERS
#include <apt-pkg/progress.h>
#include <apt-pkg/error.h>
#endif
class OpProgress;
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 236 skipping to change at line 242
// Update of candidate version // Update of candidate version
const char *StripEpoch(const char *Ver); const char *StripEpoch(const char *Ver);
void Update(PkgIterator Pkg,pkgCache &Cache); void Update(PkgIterator Pkg,pkgCache &Cache);
// Various test members for the current status of the package // Various test members for the current status of the package
inline bool NewInstall() const {return Status == 2 && Mode == ModeIns tall;}; inline bool NewInstall() const {return Status == 2 && Mode == ModeIns tall;};
inline bool Delete() const {return Mode == ModeDelete;}; inline bool Delete() const {return Mode == ModeDelete;};
inline bool Purge() const {return Delete() == true && (iFlags & pkgDe pCache::Purge) == pkgDepCache::Purge; }; inline bool Purge() const {return Delete() == true && (iFlags & pkgDe pCache::Purge) == pkgDepCache::Purge; };
inline bool Keep() const {return Mode == ModeKeep;}; inline bool Keep() const {return Mode == ModeKeep;};
inline bool Protect() const {return (iFlags & Protected) == Protected ;};
inline bool Upgrade() const {return Status > 0 && Mode == ModeInstall ;}; inline bool Upgrade() const {return Status > 0 && Mode == ModeInstall ;};
inline bool Upgradable() const {return Status >= 1;}; inline bool Upgradable() const {return Status >= 1;};
inline bool Downgrade() const {return Status < 0 && Mode == ModeInsta ll;}; inline bool Downgrade() const {return Status < 0 && Mode == ModeInsta ll;};
inline bool Held() const {return Status != 0 && Keep();}; inline bool Held() const {return Status != 0 && Keep();};
inline bool NowBroken() const {return (DepState & DepNowMin) != DepNo wMin;}; inline bool NowBroken() const {return (DepState & DepNowMin) != DepNo wMin;};
inline bool NowPolicyBroken() const {return (DepState & DepNowPolicy) != DepNowPolicy;}; inline bool NowPolicyBroken() const {return (DepState & DepNowPolicy) != DepNowPolicy;};
inline bool InstBroken() const {return (DepState & DepInstMin) != Dep InstMin;}; inline bool InstBroken() const {return (DepState & DepInstMin) != Dep InstMin;};
inline bool InstPolicyBroken() const {return (DepState & DepInstPolic y) != DepInstPolicy;}; inline bool InstPolicyBroken() const {return (DepState & DepInstPolic y) != DepInstPolicy;};
inline bool Install() const {return Mode == ModeInstall;}; inline bool Install() const {return Mode == ModeInstall;};
inline bool ReInstall() const {return Delete() == false && (iFlags & pkgDepCache::ReInstall) == pkgDepCache::ReInstall;}; inline bool ReInstall() const {return Delete() == false && (iFlags & pkgDepCache::ReInstall) == pkgDepCache::ReInstall;};
skipping to change at line 260 skipping to change at line 267
}; };
// 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:
Policy() {
InstallRecommends = _config->FindB("APT::Install-Recommends", fals
e);
InstallSuggests = _config->FindB("APT::Install-Suggests", false);
}
virtual VerIterator GetCandidateVer(PkgIterator const &Pkg); virtual VerIterator GetCandidateVer(PkgIterator const &Pkg);
virtual bool IsImportantDep(DepIterator const &Dep); virtual bool IsImportantDep(DepIterator const &Dep);
virtual signed short GetPriority(PkgIterator const &Pkg);
virtual signed short GetPriority(PkgFileIterator const &File);
virtual ~Policy() {}; virtual ~Policy() {};
private:
bool InstallRecommends;
bool InstallSuggests;
}; };
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;
skipping to change at line 318 skipping to change at line 335
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, bool const &Invert = false); void AddSizes(const PkgIterator &Pkg, bool const Invert = false);
inline void RemoveSizes(const PkgIterator &Pkg) {AddSizes(Pkg, true);}; inline void RemoveSizes(const PkgIterator &Pkg) {AddSizes(Pkg, true);};
void AddSizes(const PkgIterator &Pkg,signed long Mult) __deprecated; void AddStates(const PkgIterator &Pkg, bool const Invert = false);
void AddStates(const PkgIterator &Pkg,int Add = 1); inline void RemoveStates(const PkgIterator &Pkg) {AddStates(Pkg,true);};
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 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 inline GrpIterator FindGrp(std::string const &Name) {return Cache->FindG
me);}; rp(Name);};
inline PkgIterator FindPkg(string const &Name) {return Cache->FindPkg(Na inline PkgIterator FindPkg(std::string const &Name) {return Cache->FindP
me);}; kg(Name);};
inline PkgIterator FindPkg(string const &Name, string const &Arch) {retu inline PkgIterator FindPkg(std::string const &Name, std::string const &A
rn Cache->FindPkg(Name, Arch);}; rch) {return 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 const &Pkg) {return Local Policy->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
skipping to change at line 391 skipping to change at line 407
std::auto_ptr<InRootSetFunc> f(GetRootSetFunc()); std::auto_ptr<InRootSetFunc> f(GetRootSetFunc());
if(f.get() != NULL) if(f.get() != NULL)
return MarkAndSweep(*f.get()); return MarkAndSweep(*f.get());
else else
return false; return false;
} }
/** \name State Manipulators /** \name State Manipulators
*/ */
// @{ // @{
void MarkKeep(PkgIterator const &Pkg, bool Soft = false, bool 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 MarkPurge = false, bool MarkDelete(PkgIterator const &Pkg, bool MarkPurge = false,
unsigned long Depth = 0, bool FromUser = true); unsigned long Depth = 0, bool FromUser = true);
void MarkInstall(PkgIterator const &Pkg,bool AutoInst = true, bool 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 MarkProtected(PkgIterator const &Pkg) { PkgState[Pkg->ID].iFlags |= Protected; }; void MarkProtected(PkgIterator const &Pkg) { PkgState[Pkg->ID].iFlags |= Protected; };
void SetReInstall(PkgIterator const &Pkg,bool To); void SetReInstall(PkgIterator const &Pkg,bool To);
// FIXME: Remove the unused boolean parameter on abi break void SetCandidateVersion(VerIterator TargetVer);
void SetCandidateVersion(VerIterator TargetVer, bool const &Pseudo = tru
e);
bool SetCandidateRelease(pkgCache::VerIterator TargetVer, bool SetCandidateRelease(pkgCache::VerIterator TargetVer,
std::string const &TargetRel); std::string const &TargetRel);
/** Set the candidate version for dependencies too if needed. /** Set the candidate version for dependencies too if needed.
* *
* Sets not only the candidate version as SetCandidateVersion does, * Sets not only the candidate version as SetCandidateVersion does,
* but walks also down the dependency tree and checks if it is required * but walks also down the dependency tree and checks if it is required
* to set the candidate of the dependency to a version from the given * to set the candidate of the dependency to a version from the given
* release, too. * release, too.
* *
* \param TargetVer new candidate version of the package * \param TargetVer new candidate version of the package
skipping to change at line 487 skipping to change at line 502
inline unsigned long BadCount() {return iBadCount;}; inline unsigned long BadCount() {return iBadCount;};
bool Init(OpProgress *Prog); bool Init(OpProgress *Prog);
// Generate all state information // Generate all state information
void Update(OpProgress *Prog = 0); void Update(OpProgress *Prog = 0);
pkgDepCache(pkgCache *Cache,Policy *Plcy = 0); pkgDepCache(pkgCache *Cache,Policy *Plcy = 0);
virtual ~pkgDepCache(); virtual ~pkgDepCache();
private: private:
// Helper for Update(OpProgress) to remove pseudoinstalled arch all pack
ages
// FIXME: they are private so shouldn't affect abi, but just in case…
__deprecated bool RemovePseudoInstalledPkg(PkgIterator &Pkg, std::set<un
signed long> &recheck) { return true; };
__deprecated bool ReInstallPseudoForGroup(unsigned long const &Grp, std:
:set<unsigned long> &recheck) { return true; };
__deprecated bool ReInstallPseudoForGroup(pkgCache::PkgIterator const &P
, std::set<unsigned long> &recheck) { return true; };
bool IsModeChangeOk(ModeList const mode, PkgIterator const &Pkg, bool IsModeChangeOk(ModeList const mode, PkgIterator const &Pkg,
unsigned long const Depth, bool const FromUser); unsigned long const Depth, bool const FromUser);
}; };
#endif #endif
 End of changes. 14 change blocks. 
28 lines changed or deleted 33 lines changed or added


 dpkgpm.h   dpkgpm.h 
skipping to change at line 18 skipping to change at line 18
##################################################################### */ ##################################################################### */
/*}} }*/ /*}} }*/
#ifndef PKGLIB_DPKGPM_H #ifndef PKGLIB_DPKGPM_H
#define PKGLIB_DPKGPM_H #define PKGLIB_DPKGPM_H
#include <apt-pkg/packagemanager.h> #include <apt-pkg/packagemanager.h>
#include <vector> #include <vector>
#include <map> #include <map>
#include <stdio.h> #include <stdio.h>
#ifndef APT_8_CLEANER_HEADERS
using std::vector; using std::vector;
using std::map; using std::map;
#endif
class pkgDPkgPMPrivate;
class pkgDPkgPM : public pkgPackageManager class pkgDPkgPM : public pkgPackageManager
{ {
private: private:
pkgDPkgPMPrivate *d;
bool stdin_is_dev_null;
// the buffer we use for the dpkg status-fd reading
char dpkgbuf[1024];
int dpkgbuf_pos;
FILE *term_out;
FILE *history_out;
string dpkg_error;
/** \brief record the disappear action and handle accordingly /** \brief record the disappear action and handle accordingly
dpkg let packages disappear then they have no files any longer and 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 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 APT doesn't know beforehand that the package will disappear, so the
only possible option is to tell the user afterwards about it. only possible option is to tell the user afterwards about it.
To enhance the experience we also try to forward the auto-install To enhance the experience we also try to forward the auto-install
flag so the disappear-causer(s) are not autoremoved next time - flag so the disappear-causer(s) are not autoremoved next time -
for the transfer to happen the disappeared version needs to depend for the transfer to happen the disappeared version needs to depend
on the package the flag should be forwarded to and this package on the package the flag should be forwarded to and this package
needs to declare a Replaces on the disappeared package. needs to declare a Replaces on the disappeared package.
\param pkgname Name of the package that disappeared \param pkgname Name of the package that disappeared
*/ */
void handleDisappearAction(string const &pkgname); void handleDisappearAction(std::string const &pkgname);
protected: protected:
int pkgFailures; 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
// will go through // will go through
map<string,vector<struct DpkgState> > PackageOps; std::map<std::string,std::vector<struct DpkgState> > PackageOps;
// the dpkg states that are already done; the string is the package // the dpkg states that are already done; the string is the package
// the int is the state that is already done (e.g. a package that is // the int is the state that is already done (e.g. a package that is
// going to be install is already in state "half-installed") // going to be install is already in state "half-installed")
map<string,unsigned int> PackageOpsDone; std::map<std::string,unsigned int> PackageOpsDone;
// progress reporting // progress reporting
unsigned int PackagesDone; unsigned int PackagesDone;
unsigned int PackagesTotal; unsigned int PackagesTotal;
struct Item struct Item
{ {
enum Ops {Install, Configure, Remove, Purge, ConfigurePending, Trigge rsPending} Op; enum Ops {Install, Configure, Remove, Purge, ConfigurePending, Trigge rsPending} Op;
string File; std::string File;
PkgIterator Pkg; PkgIterator Pkg;
Item(Ops Op,PkgIterator Pkg,string File = "") : Op(Op), Item(Ops Op,PkgIterator Pkg,std::string File = "") : Op(Op),
File(File), Pkg(Pkg) {}; File(File), Pkg(Pkg) {};
Item() {}; Item() {};
}; };
vector<Item> List; std::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); void WriteHistoryTag(std::string const &tag, std::string value);
// apport integration // apport integration
void WriteApportReport(const char *pkgpath, const char *errormsg); 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);
// The Actuall installation implementation // The Actuall installation implementation
virtual bool Install(PkgIterator Pkg,string File); virtual bool Install(PkgIterator Pkg,std::string File);
virtual bool Configure(PkgIterator Pkg); virtual bool Configure(PkgIterator Pkg);
virtual bool Remove(PkgIterator Pkg,bool Purge = false); virtual bool Remove(PkgIterator Pkg,bool Purge = false);
virtual bool Go(int StatusFd=-1); virtual bool Go(int StatusFd=-1);
virtual void Reset(); virtual void Reset();
public: public:
pkgDPkgPM(pkgDepCache *Cache); pkgDPkgPM(pkgDepCache *Cache);
virtual ~pkgDPkgPM(); virtual ~pkgDPkgPM();
}; };
void SigINT(int sig);
#endif #endif
 End of changes. 12 change blocks. 
17 lines changed or deleted 15 lines changed or added


 extract.h   extract.h 
skipping to change at line 34 skipping to change at line 34
class pkgExtract : public pkgDirStream class pkgExtract : public pkgDirStream
{ {
pkgFLCache &FLCache; pkgFLCache &FLCache;
pkgCache::VerIterator Ver; pkgCache::VerIterator Ver;
pkgFLCache::PkgIterator FLPkg; pkgFLCache::PkgIterator FLPkg;
char FileName[1024]; char FileName[1024];
bool Debug; bool Debug;
bool HandleOverwrites(pkgFLCache::NodeIterator Nde, bool HandleOverwrites(pkgFLCache::NodeIterator Nde,
bool DiverCheck = false); bool DiverCheck = false);
bool CheckDirReplace(string Dir,unsigned int Depth = 0); bool CheckDirReplace(std::string Dir,unsigned int Depth = 0);
public: public:
virtual bool DoItem(Item &Itm,int &Fd); virtual bool DoItem(Item &Itm,int &Fd);
virtual bool Fail(Item &Itm,int Fd); virtual bool Fail(Item &Itm,int Fd);
virtual bool FinishedFile(Item &Itm,int Fd); virtual bool FinishedFile(Item &Itm,int Fd);
bool Finished(); bool Finished();
bool Aborted(); bool Aborted();
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 extracttar.h   extracttar.h 
skipping to change at line 18 skipping to change at line 18
The tar extractor takes an ordinary gzip compressed tar stream from The tar extractor takes an ordinary gzip compressed tar stream from
the given file and explodes it, passing the individual items to the the given file and explodes it, passing the individual items to the
given Directory Stream for processing. given Directory Stream for processing.
##################################################################### */ ##################################################################### */
/*}} }*/ /*}} }*/
#ifndef PKGLIB_EXTRACTTAR_H #ifndef PKGLIB_EXTRACTTAR_H
#define PKGLIB_EXTRACTTAR_H #define PKGLIB_EXTRACTTAR_H
#include <apt-pkg/fileutl.h> #include <apt-pkg/fileutl.h>
#include <apt-pkg/dirstream.h>
#include <algorithm> #include <string>
#ifndef APT_8_CLEANER_HEADERS
#include <apt-pkg/dirstream.h>
#include <algorithm>
using std::min; using std::min;
#endif
class pkgDirStream;
class ExtractTar class ExtractTar
{ {
protected: protected:
struct TarHeader; struct TarHeader;
// The varios types items can be // The varios types items can be
enum ItemType {NormalFile0 = '\0',NormalFile = '0',HardLink = '1', enum ItemType {NormalFile0 = '\0',NormalFile = '0',HardLink = '1',
SymbolicLink = '2',CharacterDevice = '3', SymbolicLink = '2',CharacterDevice = '3',
BlockDevice = '4',Directory = '5',FIFO = '6', BlockDevice = '4',Directory = '5',FIFO = '6',
GNU_LongLink = 'K',GNU_LongName = 'L'}; GNU_LongLink = 'K',GNU_LongName = 'L'};
FileFd &File; FileFd &File;
unsigned long MaxInSize; unsigned long MaxInSize;
int GZPid; int GZPid;
FileFd InFd; FileFd InFd;
bool Eof; bool Eof;
string DecompressProg; std::string DecompressProg;
// Fork and reap gzip // Fork and reap gzip
bool StartGzip(); bool StartGzip();
bool Done(bool Force); bool Done(bool Force);
public: public:
bool Go(pkgDirStream &Stream); bool Go(pkgDirStream &Stream);
ExtractTar(FileFd &Fd,unsigned long Max,string DecompressionProgram); ExtractTar(FileFd &Fd,unsigned long Max,std::string DecompressionProgram );
virtual ~ExtractTar(); virtual ~ExtractTar();
}; };
#endif #endif
 End of changes. 6 change blocks. 
4 lines changed or deleted 9 lines changed or added


 filelist.h   filelist.h 
skipping to change at line 31 skipping to change at line 31
linked to the package name and to the directory component. linked to the package name and to the directory component.
Each file node has a set of associated flags that indicate the current Each file node has a set of associated flags that indicate the current
state of the file. state of the file.
##################################################################### */ ##################################################################### */
/*}} }*/ /*}} }*/
#ifndef PKGLIB_FILELIST_H #ifndef PKGLIB_FILELIST_H
#define PKGLIB_FILELIST_H #define PKGLIB_FILELIST_H
#include <cstring>
#include <apt-pkg/mmap.h> #include <apt-pkg/mmap.h>
#include <cstring>
#include <string>
class pkgFLCache class pkgFLCache
{ {
public: public:
struct Header; struct Header;
struct Node; struct Node;
struct Directory; struct Directory;
struct Package; struct Package;
struct Diversion; struct Diversion;
struct ConfFile; struct ConfFile;
class NodeIterator; class NodeIterator;
class DirIterator; class DirIterator;
class PkgIterator; class PkgIterator;
class DiverIterator; class DiverIterator;
protected: protected:
string CacheFile; std::string CacheFile;
DynamicMMap &Map; DynamicMMap &Map;
map_ptrloc LastTreeLookup; map_ptrloc LastTreeLookup;
unsigned long LastLookupSize; unsigned long LastLookupSize;
// Helpers for the addition algorithms // Helpers for the addition algorithms
map_ptrloc TreeLookup(map_ptrloc *Base,const char *Text,const char *Text End, map_ptrloc TreeLookup(map_ptrloc *Base,const char *Text,const char *Text End,
unsigned long Size,unsigned int *Count = 0, unsigned long Size,unsigned int *Count = 0,
bool Insert = false); bool Insert = false);
public: public:
 End of changes. 3 change blocks. 
2 lines changed or deleted 4 lines changed or added


 fileutl.h   fileutl.h 
skipping to change at line 25 skipping to change at line 25
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 <apt-pkg/macros.h>
#include <apt-pkg/aptconfiguration.h>
#include <string> #include <string>
#include <vector> #include <vector>
#include <zlib.h> #include <zlib.h>
#ifndef APT_8_CLEANER_HEADERS
using std::string;
#endif
/* Define this for python-apt */ /* Define this for python-apt */
#define APT_HAS_GZIP 1 #define APT_HAS_GZIP 1
using std::string; class FileFdPrivate;
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), Replace = (1<<4) }; HitEof = (1<<3), Replace = (1<<4), Compressed = (1<<5) };
unsigned long Flags; unsigned long Flags;
string FileName; std::string FileName;
string TemporaryFileName; std::string TemporaryFileName;
gzFile gz;
public: public:
enum OpenMode {ReadOnly,WriteEmpty,WriteExists,WriteAny,WriteTemp,ReadOn enum OpenMode {
lyGzip, ReadOnly = (1 << 0),
WriteAtomic}; WriteOnly = (1 << 1),
ReadWrite = ReadOnly | WriteOnly,
Create = (1 << 2),
Exclusive = (1 << 3),
Atomic = Exclusive | (1 << 4),
Empty = (1 << 5),
WriteEmpty = ReadWrite | Create | Empty,
WriteExists = ReadWrite,
WriteAny = ReadWrite | Create,
WriteTemp = ReadWrite | Create | Exclusive,
ReadOnlyGzip,
WriteAtomic = ReadWrite | Create | Atomic
};
enum CompressMode { Auto = 'A', None = 'N', Extension = 'E', Gzip = 'G',
Bzip2 = 'B', Lzma = 'L', Xz = 'X' };
inline bool Read(void *To,unsigned long Size,bool AllowEof) inline bool Read(void *To,unsigned long long Size,bool AllowEof)
{ {
unsigned long Jnk; unsigned long 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 long Size,unsigned long long *Actual =
bool Write(const void *From,unsigned long Size); 0);
bool Seek(unsigned long To); char* ReadLine(char *To, unsigned long long const Size);
bool Skip(unsigned long To); bool Write(const void *From,unsigned long long Size);
bool Truncate(unsigned long To); bool static Write(int Fd, const void *From, unsigned long long Size);
unsigned long Tell(); bool Seek(unsigned long long To);
unsigned long Size(); bool Skip(unsigned long long To);
unsigned long FileSize(); bool Truncate(unsigned long long To);
bool Open(string FileName,OpenMode Mode,unsigned long Perms = 0666); unsigned long long Tell();
bool OpenDescriptor(int Fd, OpenMode Mode, bool AutoClose=false); unsigned long long Size();
unsigned long long FileSize();
time_t ModificationTime();
/* You want to use 'unsigned long long' if you are talking about a file
to be able to support large files (>2 or >4 GB) properly.
This shouldn't happen all to often for the indexes, but deb's might b
e…
And as the auto-conversation converts a 'unsigned long *' to a 'bool'
instead of 'unsigned long long *' we need to provide this explicitely
-
otherwise applications magically start to fail… */
__deprecated bool Read(void *To,unsigned long long Size,unsigned long *A
ctual)
{
unsigned long long R;
bool const T = Read(To, Size, &R);
*Actual = R;
return T;
}
bool Open(std::string FileName,unsigned int const Mode,CompressMode Comp
ress,unsigned long const Perms = 0666);
bool Open(std::string FileName,unsigned int const Mode,APT::Configuratio
n::Compressor const &compressor,unsigned long const Perms = 0666);
inline bool Open(std::string const &FileName,unsigned int const Mode, un
signed long const Perms = 0666) {
return Open(FileName, Mode, None, Perms);
};
bool OpenDescriptor(int Fd, unsigned int const Mode, CompressMode Compre
ss, bool AutoClose=false);
bool OpenDescriptor(int Fd, unsigned int const Mode, APT::Configuration:
:Compressor const &compressor, bool AutoClose=false);
inline bool OpenDescriptor(int Fd, unsigned int const Mode, bool AutoClo
se=false) {
return OpenDescriptor(Fd, Mode, None, AutoClose);
};
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) { OpenDescriptor(fd, ReadWrite);};
inline gzFile gzFd() {return gz;}; __deprecated gzFile gzFd();
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 bool IsCompressed() {return (Flags & Compressed) == Compressed;};
inline std::string &Name() {return FileName;};
FileFd(string FileName,OpenMode Mode,unsigned long Perms = 0666) : iFd(- FileFd(std::string FileName,unsigned int const Mode,unsigned long Perms
1), = 0666) : iFd(-1), Flags(0), d(NULL)
Flags(0), gz(NULL)
{ {
Open(FileName,Mode,Perms); Open(FileName,Mode, None, Perms);
};
FileFd(std::string FileName,unsigned int const Mode, CompressMode Compre
ss, unsigned long Perms = 0666) : iFd(-1), Flags(0), d(NULL)
{
Open(FileName,Mode, Compress, Perms);
};
FileFd() : iFd(-1), Flags(AutoClose), d(NULL) {};
FileFd(int const Fd, unsigned int const Mode = ReadWrite, CompressMode C
ompress = None) : iFd(-1), Flags(0), d(NULL)
{
OpenDescriptor(Fd, Mode, Compress);
};
FileFd(int const Fd, bool const AutoClose) : iFd(-1), Flags(0), d(NULL)
{
OpenDescriptor(Fd, ReadWrite, None, AutoClose);
}; };
FileFd(int Fd = -1) : iFd(Fd), Flags(AutoClose), gz(NULL) {};
FileFd(int Fd,bool) : iFd(Fd), Flags(0), gz(NULL) {};
virtual ~FileFd(); virtual ~FileFd();
private:
FileFdPrivate* d;
bool OpenInternDescriptor(unsigned int const Mode, APT::Configuration::C
ompressor const &compressor);
}; };
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(std::string File,bool Errors = true);
bool FileExists(string File); bool FileExists(std::string File);
bool RealFileExists(string File); bool RealFileExists(std::string File);
bool DirectoryExists(string const &Path) __attrib_const; bool DirectoryExists(std::string const &Path) __attrib_const;
bool CreateDirectory(string const &Parent, string const &Path); bool CreateDirectory(std::string const &Parent, std::string const &Path);
time_t GetModificationTime(string const &Path); time_t GetModificationTime(std::string const &Path);
/** \brief Ensure the existence of the given Path /** \brief Ensure the existence of the given Path
* *
* \param Parent directory of the Path directory - a trailing * \param Parent directory of the Path directory - a trailing
* /apt/ will be removed before CreateDirectory call. * /apt/ will be removed before CreateDirectory call.
* \param Path which should exist after (successful) call * \param Path which should exist after (successful) call
*/ */
bool CreateAPTDirectoryIfNeeded(string const &Parent, string const &Path); bool CreateAPTDirectoryIfNeeded(std::string const &Parent, std::string cons t &Path);
std::vector<string> GetListOfFilesInDir(string const &Dir, string const &Ex t, std::vector<std::string> GetListOfFilesInDir(std::string const &Dir, std::s tring const &Ext,
bool const &SortList, bool const &Al lowNoExt=false); bool const &SortList, bool const &Al lowNoExt=false);
std::vector<string> GetListOfFilesInDir(string const &Dir, std::vector<stri ng> const &Ext, std::vector<std::string> GetListOfFilesInDir(std::string const &Dir, std::v ector<std::string> const &Ext,
bool const &SortList); bool const &SortList);
string SafeGetCWD(); std::vector<std::string> GetListOfFilesInDir(std::string const &Dir, bool S
ortList);
std::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
string flNotDir(string File); std::string flNotDir(std::string File);
string flNotFile(string File); std::string flNotFile(std::string File);
string flNoLink(string File); std::string flNoLink(std::string File);
string flExtension(string File); std::string flExtension(std::string File);
string flCombine(string Dir,string File); std::string flCombine(std::string Dir,std::string File);
#endif #endif
 End of changes. 21 change blocks. 
45 lines changed or deleted 121 lines changed or added


 hashes.h   hashes.h 
skipping to change at line 18 skipping to change at line 18
This is just used to make building the methods simpler, this is the This is just used to make building the methods simpler, this is the
only interface required.. only interface required..
##################################################################### */ ##################################################################### */
/*}} }*/ /*}} }*/
#ifndef APTPKG_HASHES_H #ifndef APTPKG_HASHES_H
#define APTPKG_HASHES_H #define APTPKG_HASHES_H
#include <apt-pkg/md5.h> #include <apt-pkg/md5.h>
#include <apt-pkg/sha1.h> #include <apt-pkg/sha1.h>
#include <apt-pkg/sha256.h> #include <apt-pkg/sha2.h>
#include <apt-pkg/fileutl.h>
#include <algorithm> #include <algorithm>
#include <vector> #include <vector>
#include <cstring> #include <cstring>
#ifndef APT_8_CLEANER_HEADERS
using std::min; using std::min;
using std::vector; using std::vector;
#endif
// helper class that contains hash function name // helper class that contains hash function name
// and hash // and hash
class HashString class HashString
{ {
protected: protected:
string Type; std::string Type;
string Hash; std::string Hash;
static const char * _SupportedHashes[10]; static const char * _SupportedHashes[10];
public: public:
HashString(string Type, string Hash); HashString(std::string Type, std::string Hash);
HashString(string StringedHashString); // init from str as "type:hash" HashString(std::string StringedHashString); // init from str as "type:h
ash"
HashString(); HashString();
// get hash type used // get hash type used
string HashType() { return Type; }; std::string HashType() { return Type; };
// verify the given filename against the currently loaded hash // verify the given filename against the currently loaded hash
bool VerifyFile(string filename) const; bool VerifyFile(std::string filename) const;
// helper // helper
string toStr() const; // convert to str as "type:hash " std::string toStr() const; // convert to str as "type :hash"
bool empty() const; bool empty() const;
// return the list of hashes we support // return the list of hashes we support
static const char** SupportedHashes(); static const char** SupportedHashes();
}; };
class Hashes class Hashes
{ {
public: public:
MD5Summation MD5; MD5Summation MD5;
SHA1Summation SHA1; SHA1Summation SHA1;
SHA256Summation SHA256; SHA256Summation SHA256;
SHA512Summation SHA512;
inline bool Add(const unsigned char *Data,unsigned long Size) inline bool Add(const unsigned char *Data,unsigned long long Size)
{ {
return MD5.Add(Data,Size) && SHA1.Add(Data,Size) && SHA256.Add(Data,S ize); return MD5.Add(Data,Size) && SHA1.Add(Data,Size) && SHA256.Add(Data,S ize) && SHA512.Add(Data,Size);
}; };
inline bool Add(const char *Data) {return Add((unsigned char *)Data,strl en(Data));}; inline bool Add(const char *Data) {return Add((unsigned char *)Data,strl en(Data));};
bool AddFD(int Fd,unsigned long Size); inline bool AddFD(int const Fd,unsigned long long Size = 0)
{ return AddFD(Fd, Size, true, true, true, true); };
bool AddFD(int const Fd, unsigned long long Size, bool const addMD5,
bool const addSHA1, bool const addSHA256, bool const addSHA512
);
inline bool AddFD(FileFd &Fd,unsigned long long Size = 0)
{ return AddFD(Fd, Size, true, true, true, true); };
bool AddFD(FileFd &Fd, unsigned long long Size, bool const addMD5,
bool const addSHA1, bool const addSHA256, bool const addSHA512
);
inline bool Add(const unsigned char *Beg,const unsigned char *End) inline bool Add(const unsigned char *Beg,const unsigned char *End)
{return Add(Beg,End-Beg);}; {return Add(Beg,End-Beg);};
}; };
#endif #endif
 End of changes. 12 change blocks. 
11 lines changed or deleted 25 lines changed or added


 indexcopy.h   indexcopy.h 
skipping to change at line 17 skipping to change at line 17
##################################################################### */ ##################################################################### */
/*}} }*/ /*}} }*/
#ifndef INDEXCOPY_H #ifndef INDEXCOPY_H
#define INDEXCOPY_H #define INDEXCOPY_H
#include <vector> #include <vector>
#include <string> #include <string>
#include <stdio.h> #include <stdio.h>
#ifndef APT_8_CLEANER_HEADERS
using std::string; using std::string;
using std::vector; using std::vector;
#endif
class pkgTagSection; class pkgTagSection;
class FileFd; class FileFd;
class indexRecords; class indexRecords;
class pkgCdromStatus; class pkgCdromStatus;
class IndexCopy /*{{{*/ class IndexCopy /*{{{*/
{ {
/** \brief dpointer placeholder (for later in case we need it) */
void *d;
protected: protected:
pkgTagSection *Section; pkgTagSection *Section;
string ChopDirs(string Path,unsigned int Depth); std::string ChopDirs(std::string Path,unsigned int Depth);
bool ReconstructPrefix(string &Prefix,string OrigPath,string CD, bool ReconstructPrefix(std::string &Prefix,std::string OrigPath,std::str
string File); ing CD,
bool ReconstructChop(unsigned long &Chop,string Dir,string File); std::string File);
void ConvertToSourceList(string CD,string &Path); bool ReconstructChop(unsigned long &Chop,std::string Dir,std::string Fil
bool GrabFirst(string Path,string &To,unsigned int Depth); e);
virtual bool GetFile(string &Filename,unsigned long &Size) = 0; void ConvertToSourceList(std::string CD,std::string &Path);
virtual bool RewriteEntry(FILE *Target,string File) = 0; bool GrabFirst(std::string Path,std::string &To,unsigned int Depth);
virtual bool GetFile(std::string &Filename,unsigned long long &Size) = 0
;
virtual bool RewriteEntry(FILE *Target,std::string File) = 0;
virtual const char *GetFileName() = 0; virtual const char *GetFileName() = 0;
virtual const char *Type() = 0; virtual const char *Type() = 0;
public: public:
bool CopyPackages(string CDROM,string Name,vector<string> &List, bool CopyPackages(std::string CDROM,std::string Name,std::vector<std::st ring> &List,
pkgCdromStatus *log); pkgCdromStatus *log);
virtual ~IndexCopy() {}; virtual ~IndexCopy() {};
}; };
/*}} }*/ /*}} }*/
class PackageCopy : public IndexCopy /*{{ {*/ class PackageCopy : public IndexCopy /*{{ {*/
{ {
protected: protected:
virtual bool GetFile(string &Filename,unsigned long &Size); virtual bool GetFile(std::string &Filename,unsigned long long &Size);
virtual bool RewriteEntry(FILE *Target,string File); virtual bool RewriteEntry(FILE *Target,std::string File);
virtual const char *GetFileName() {return "Packages";}; virtual const char *GetFileName() {return "Packages";};
virtual const char *Type() {return "Package";}; virtual const char *Type() {return "Package";};
public:
}; };
/*}} }*/ /*}} }*/
class SourceCopy : public IndexCopy /*{{ {*/ class SourceCopy : public IndexCopy /*{{ {*/
{ {
protected: protected:
virtual bool GetFile(string &Filename,unsigned long &Size); virtual bool GetFile(std::string &Filename,unsigned long long &Size);
virtual bool RewriteEntry(FILE *Target,string File); virtual bool RewriteEntry(FILE *Target,std::string File);
virtual const char *GetFileName() {return "Sources";}; virtual const char *GetFileName() {return "Sources";};
virtual const char *Type() {return "Source";}; virtual const char *Type() {return "Source";};
public:
}; };
/*}} }*/ /*}} }*/
class TranslationsCopy /*{{ {*/ class TranslationsCopy /*{{ {*/
{ {
protected: protected:
pkgTagSection *Section; pkgTagSection *Section;
public: public:
bool CopyTranslations(string CDROM,string Name,vector<string> &List, bool CopyTranslations(std::string CDROM,std::string Name,std::vector<std ::string> &List,
pkgCdromStatus *log); pkgCdromStatus *log);
}; };
/*}} }*/ /*}} }*/
class SigVerify /*{{{*/ class SigVerify /*{{{*/
{ {
bool Verify(string prefix,string file, indexRecords *records); /** \brief dpointer placeholder (for later in case we need it) */
bool CopyMetaIndex(string CDROM, string CDName, void *d;
string prefix, string file);
bool Verify(std::string prefix,std::string file, indexRecords *records);
bool CopyMetaIndex(std::string CDROM, std::string CDName,
std::string prefix, std::string file);
public: public:
bool CopyAndVerify(string CDROM,string Name,vector<string> &SigList, bool CopyAndVerify(std::string CDROM,std::string Name,std::vector<std::s
vector<string> PkgList,vector<string> SrcList); tring> &SigList,
std::vector<std::string> PkgList,std::vector<std::stri
ng> SrcList);
/** \brief generates and run the command to verify a file with gpgv */ /** \brief generates and run the command to verify a file with gpgv */
static bool RunGPGV(std::string const &File, std::string const &FileOut, static bool RunGPGV(std::string const &File, std::string const &FileOut,
int const &statusfd, int fd[2]); int const &statusfd, int fd[2]);
inline static bool RunGPGV(std::string const &File, std::string const &F ileOut, inline static bool RunGPGV(std::string const &File, std::string const &F ileOut,
int const &statusfd = -1) { int const &statusfd = -1) {
int fd[2]; int fd[2];
return RunGPGV(File, FileOut, statusfd, fd); return RunGPGV(File, FileOut, statusfd, fd);
}; };
}; };
 End of changes. 12 change blocks. 
21 lines changed or deleted 32 lines changed or added


 indexfile.h   indexfile.h 
skipping to change at line 29 skipping to change at line 29
##################################################################### */ ##################################################################### */
/*}} }*/ /*}} }*/
#ifndef PKGLIB_INDEXFILE_H #ifndef PKGLIB_INDEXFILE_H
#define PKGLIB_INDEXFILE_H #define PKGLIB_INDEXFILE_H
#include <string> #include <string>
#include <apt-pkg/pkgcache.h> #include <apt-pkg/pkgcache.h>
#include <apt-pkg/srcrecords.h> #include <apt-pkg/srcrecords.h>
#include <apt-pkg/pkgrecords.h> #include <apt-pkg/pkgrecords.h>
#include <apt-pkg/macros.h>
#ifndef APT_8_CLEANER_HEADERS
using std::string; using std::string;
#endif
class pkgAcquire; class pkgAcquire;
class pkgCacheGenerator; class pkgCacheGenerator;
class OpProgress; class OpProgress;
class pkgIndexFile class pkgIndexFile
{ {
protected: protected:
bool Trusted; bool Trusted;
public: public:
class Type class Type
{ {
public: public:
skipping to change at line 61 skipping to change at line 65
const char *Label; const char *Label;
virtual pkgRecords::Parser *CreatePkgParser(pkgCache::PkgFileIterator /*File*/) const {return 0;}; virtual pkgRecords::Parser *CreatePkgParser(pkgCache::PkgFileIterator /*File*/) const {return 0;};
Type(); Type();
virtual ~Type() {}; virtual ~Type() {};
}; };
virtual const Type *GetType() const = 0; virtual const Type *GetType() const = 0;
// Return descriptive strings of various sorts // Return descriptive strings of various sorts
virtual string ArchiveInfo(pkgCache::VerIterator Ver) const; virtual std::string ArchiveInfo(pkgCache::VerIterator Ver) const;
virtual string SourceInfo(pkgSrcRecords::Parser const &Record, virtual std::string SourceInfo(pkgSrcRecords::Parser const &Record,
pkgSrcRecords::File const &File) const; pkgSrcRecords::File const &File) const;
virtual string Describe(bool Short = false) const = 0; virtual std::string Describe(bool Short = false) const = 0;
// Interface for acquire // Interface for acquire
virtual string ArchiveURI(string /*File*/) const {return string();}; virtual std::string ArchiveURI(std::string /*File*/) const {return std:: 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 t { return false; }; virtual bool Merge(pkgCacheGenerator &/*Gen*/,OpProgress* /*Prog*/) cons t { return false; };
__deprecated virtual bool Merge(pkgCacheGenerator &Gen, OpProgress &Prog ) const __deprecated virtual bool Merge(pkgCacheGenerator &Gen, OpProgress &Prog ) const
{ return Merge(Gen, &Prog); }; { return Merge(Gen, &Prog); };
virtual bool MergeFileProvides(pkgCacheGenerator &/*Gen*/,OpProgress* /* Prog*/) const {return true;}; virtual bool MergeFileProvides(pkgCacheGenerator &/*Gen*/,OpProgress* /* Prog*/) const {return true;};
__deprecated virtual bool MergeFileProvides(pkgCacheGenerator &Gen, OpPr ogress &Prog) const __deprecated virtual bool MergeFileProvides(pkgCacheGenerator &Gen, OpPr ogress &Prog) const
{return MergeFileProvides(Gen, &Prog);}; {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 std::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() {};
}; };
#endif #endif
 End of changes. 8 change blocks. 
5 lines changed or deleted 9 lines changed or added


 indexrecords.h   indexrecords.h 
// -*- mode: cpp; mode: fold -*- // -*- mode: cpp; mode: fold -*-
// Description /*{{ {*/ // Description /*{{ {*/
// $Id: indexrecords.h,v 1.1.2.1 2003/12/24 23:09:17 mdz Exp $ // $Id: indexrecords.h,v 1.1.2.1 2003/12/24 23:09:17 mdz Exp $
/*}} }*/ /*}} }*/
#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/hashes.h> #include <apt-pkg/hashes.h>
#include <map> #include <map>
#include <vector> #include <vector>
#include <ctime> #include <ctime>
#ifndef APT_8_CLEANER_HEADERS
#include <apt-pkg/fileutl.h>
#endif
class indexRecords class indexRecords
{ {
bool parseSumData(const char *&Start, const char *End, string &Name, bool parseSumData(const char *&Start, const char *End, std::string &Name
string &Hash, size_t &Size); ,
std::string &Hash, unsigned long long &Size);
public: public:
struct checkSum; struct checkSum;
string ErrorText; std::string ErrorText;
protected: protected:
string Dist; std::string Dist;
string Suite; std::string Suite;
string ExpectedDist; std::string ExpectedDist;
time_t ValidUntil; time_t ValidUntil;
std::map<string,checkSum *> Entries; std::map<std::string,checkSum *> Entries;
public: public:
indexRecords(); indexRecords();
indexRecords(const string ExpectedDist); indexRecords(const std::string ExpectedDist);
// Lookup function // Lookup function
virtual const checkSum *Lookup(const string MetaKey); virtual const checkSum *Lookup(const std::string MetaKey);
/** \brief tests if a checksum for this file is available */ /** \brief tests if a checksum for this file is available */
bool Exists(string const &MetaKey) const; bool Exists(std::string const &MetaKey) const;
std::vector<std::string> MetaKeys(); std::vector<std::string> MetaKeys();
virtual bool Load(string Filename); virtual bool Load(std::string Filename);
string GetDist() const; std::string GetDist() const;
time_t GetValidUntil() const; time_t GetValidUntil() const;
virtual bool CheckDist(const string MaybeDist) const; virtual bool CheckDist(const std::string MaybeDist) const;
string GetExpectedDist() const; std::string GetExpectedDist() const;
virtual ~indexRecords(){}; virtual ~indexRecords(){};
}; };
struct indexRecords::checkSum struct indexRecords::checkSum
{ {
string MetaKeyFilename; std::string MetaKeyFilename;
HashString Hash; HashString Hash;
size_t Size; unsigned long long Size;
}; };
#endif #endif
 End of changes. 13 change blocks. 
17 lines changed or deleted 21 lines changed or added


 init.h   init.h 
skipping to change at line 16 skipping to change at line 16
Init - Initialize the package library Init - Initialize the package library
This function must be called to configure the config class before This function must be called to configure the config class before
calling many APT library functions. calling many APT library functions.
##################################################################### */ ##################################################################### */
/*}} }*/ /*}} }*/
#ifndef PKGLIB_INIT_H #ifndef PKGLIB_INIT_H
#define PKGLIB_INIT_H #define PKGLIB_INIT_H
#ifndef APT_8_CLEANER_HEADERS
#include <apt-pkg/configuration.h> #include <apt-pkg/configuration.h>
#include <apt-pkg/pkgsystem.h> #include <apt-pkg/pkgsystem.h>
#endif
class pkgSystem;
class Configuration;
// 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 10 #define APT_PKG_MINOR 12
#define APT_PKG_RELEASE 1 #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
#if APT_COMPATIBILITY != 986
#warning "Using APT_COMPATIBILITY"
#endif
inline bool pkgInitialize(Configuration &Cnf)
{
return pkgInitConfig(Cnf) && pkgInitSystem(Cnf,_system);
};
#endif
#endif #endif
 End of changes. 4 change blocks. 
13 lines changed or deleted 7 lines changed or added


 md5.h   md5.h 
skipping to change at line 31 skipping to change at line 31
##################################################################### */ ##################################################################### */
/*}} }*/ /*}} }*/
#ifndef APTPKG_MD5_H #ifndef APTPKG_MD5_H
#define APTPKG_MD5_H #define APTPKG_MD5_H
#include <string> #include <string>
#include <cstring> #include <cstring>
#include <algorithm> #include <algorithm>
#include <stdint.h> #include <stdint.h>
#include "hashsum_template.h"
#ifndef APT_8_CLEANER_HEADERS
using std::string; using std::string;
using std::min; using std::min;
#endif
class MD5Summation; typedef HashSumValue<128> MD5SumValue;
class MD5SumValue
{
friend class MD5Summation;
unsigned char Sum[4*4];
public:
// Accessors
bool operator ==(const MD5SumValue &rhs) const;
string Value() const;
inline void Value(unsigned char S[16])
{for (int I = 0; I != sizeof(Sum); I++) S[I] = Sum[I];};
inline operator string() const {return Value();};
bool Set(string Str);
inline void Set(unsigned char S[16])
{for (int I = 0; I != sizeof(Sum); I++) Sum[I] = S[I];};
MD5SumValue(string Str); class MD5Summation : public SummationImplementation
MD5SumValue();
};
class MD5Summation
{ {
uint32_t Buf[4]; uint32_t Buf[4];
unsigned char Bytes[2*4]; unsigned char Bytes[2*4];
unsigned char In[16*4]; unsigned char In[16*4];
bool Done; bool Done;
public: public:
bool Add(const unsigned char *Data,unsigned long Size); bool Add(const unsigned char *inbuf, unsigned long long inlen);
inline bool Add(const char *Data) {return Add((unsigned char *)Data,strl using SummationImplementation::Add;
en(Data));};
bool AddFD(int Fd,unsigned long Size);
inline bool Add(const unsigned char *Beg,const unsigned char *End)
{return Add(Beg,End-Beg);};
MD5SumValue Result(); MD5SumValue Result();
MD5Summation(); MD5Summation();
}; };
#endif #endif
 End of changes. 5 change blocks. 
29 lines changed or deleted 9 lines changed or added


 metaindex.h   metaindex.h 
#ifndef PKGLIB_METAINDEX_H #ifndef PKGLIB_METAINDEX_H
#define PKGLIB_METAINDEX_H #define PKGLIB_METAINDEX_H
#include <string> #include <string>
#include <apt-pkg/pkgcache.h> #include <apt-pkg/pkgcache.h>
#include <apt-pkg/indexfile.h>
#ifndef APT_8_CLEANER_HEADERS
#include <apt-pkg/srcrecords.h> #include <apt-pkg/srcrecords.h>
#include <apt-pkg/pkgrecords.h> #include <apt-pkg/pkgrecords.h>
#include <apt-pkg/indexfile.h>
#include <apt-pkg/vendor.h> #include <apt-pkg/vendor.h>
using std::string; using std::string;
#endif
class pkgAcquire; class pkgAcquire;
class pkgCacheGenerator; class pkgCacheGenerator;
class OpProgress; class OpProgress;
class metaIndex class metaIndex
{ {
protected: protected:
vector <pkgIndexFile *> *Indexes; std::vector <pkgIndexFile *> *Indexes;
const char *Type; const char *Type;
string URI; std::string URI;
string Dist; std::string Dist;
bool Trusted; bool Trusted;
public: public:
// Various accessors // Various accessors
virtual string GetURI() const {return URI;} virtual std::string GetURI() const {return URI;}
virtual string GetDist() const {return Dist;} virtual std::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 const& /*File*/) const = 0; virtual std::string ArchiveURI(std::string const& /*File*/) const = 0;
virtual bool GetIndexes(pkgAcquire *Owner, bool const &GetAll=false) con st = 0; virtual bool GetIndexes(pkgAcquire *Owner, bool const &GetAll=false) con st = 0;
virtual vector<pkgIndexFile *> *GetIndexFiles() = 0; virtual std::vector<pkgIndexFile *> *GetIndexFiles() = 0;
virtual bool IsTrusted() const = 0; virtual bool IsTrusted() const = 0;
metaIndex(std::string const &URI, std::string const &Dist, char const *
const Type) :
Indexes(NULL), Type(Type), URI(URI), Dist(Dist) {
}
virtual ~metaIndex() { virtual ~metaIndex() {
if (Indexes == 0) if (Indexes == 0)
return; return;
for (vector<pkgIndexFile *>::iterator I = (*Indexes).begin(); I != (* Indexes).end(); ++I) for (std::vector<pkgIndexFile *>::iterator I = (*Indexes).begin(); I != (*Indexes).end(); ++I)
delete *I; delete *I;
delete Indexes; delete Indexes;
} }
}; };
#endif #endif
 End of changes. 11 change blocks. 
10 lines changed or deleted 17 lines changed or added


 mmap.h   mmap.h 
skipping to change at line 29 skipping to change at line 29
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_MMAP_H #ifndef PKGLIB_MMAP_H
#define PKGLIB_MMAP_H #define PKGLIB_MMAP_H
#include <string> #include <string>
#include <apt-pkg/fileutl.h>
#ifndef APT_8_CLEANER_HEADERS
#include <apt-pkg/fileutl.h>
using std::string; using std::string;
#endif
class FileFd;
/* This should be a 32 bit type, larger tyes use too much ram and smaller /* This should be a 32 bit type, larger tyes use too much ram and smaller
types are too small. Where ever possible 'unsigned long' should be used types are too small. Where ever possible 'unsigned long' should be used
instead of this internal type */ instead of this internal type */
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 long iSize;
void *Base; void *Base;
// In case mmap can not be used, we keep a dup of the file // 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 // descriptor that should have been mmaped so that we can write to
// the file in Sync(). // the file in Sync().
FileFd *SyncToFd; 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), Moveable = (1<<4), Fallback = (1 << 5 )}; 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 long Size() {return iSize;};
inline void AddSize(unsigned long const size) {iSize += size;}; inline void AddSize(unsigned long long const size) {iSize += size;};
inline bool validData() const { return Base != (void *)-1 && Base != 0; }; inline bool validData() const { return Base != (void *)-1 && Base != 0; };
// File manipulators // File manipulators
bool Sync(); bool Sync();
bool Sync(unsigned long Start,unsigned long Stop); bool Sync(unsigned long Start,unsigned long Stop);
MMap(FileFd &F,unsigned long Flags); MMap(FileFd &F,unsigned long Flags);
MMap(unsigned long Flags); MMap(unsigned long Flags);
virtual ~MMap(); virtual ~MMap();
}; };
skipping to change at line 101 skipping to change at line 105
unsigned long const GrowFactor; unsigned long const GrowFactor;
unsigned long const Limit; 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 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 std::string &S) {return WriteStri ng(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 const &WorkSpace = 2*1024*1024, DynamicMMap(FileFd &F,unsigned long Flags,unsigned long const &WorkSpace = 2*1024*1024,
unsigned long const &Grow = 1024*1024, unsigned long const &L imit = 0); unsigned long const &Grow = 1024*1024, unsigned long const &L imit = 0);
DynamicMMap(unsigned long Flags,unsigned long const &WorkSpace = 2*1024* 1024, DynamicMMap(unsigned long Flags,unsigned long const &WorkSpace = 2*1024* 1024,
unsigned long const &Grow = 1024*1024, unsigned long const &L imit = 0); unsigned long const &Grow = 1024*1024, unsigned long const &L imit = 0);
virtual ~DynamicMMap(); virtual ~DynamicMMap();
}; };
#endif #endif
 End of changes. 7 change blocks. 
6 lines changed or deleted 10 lines changed or added


 netrc.h   netrc.h 
skipping to change at line 17 skipping to change at line 17
a specified netrc-type file a specified netrc-type file
Originally written by Daniel Stenberg, <daniel@haxx.se>, et al. and Originally written by Daniel Stenberg, <daniel@haxx.se>, et al. and
placed into the Public Domain, do with it what you will. placed into the Public Domain, do with it what you will.
##################################################################### */ ##################################################################### */
/*}} }*/ /*}} }*/
#ifndef NETRC_H #ifndef NETRC_H
#define NETRC_H #define NETRC_H
#include <string>
#ifndef APT_8_CLEANER_HEADERS
#include <apt-pkg/strutl.h> #include <apt-pkg/strutl.h>
#endif
#define DOT_CHAR "." #define DOT_CHAR "."
#define DIR_CHAR "/" #define DIR_CHAR "/"
class URI;
// Assume: password[0]=0, host[0] != 0. // Assume: password[0]=0, host[0] != 0.
// If login[0] = 0, search for login and password within a machine section // If login[0] = 0, search for login and password within a machine section
// in the netrc. // in the netrc.
// If login[0] != 0, search for password within machine and login. // If login[0] != 0, search for password within machine and login.
int parsenetrc (char *host, char *login, char *password, char *filename); int parsenetrc (char *host, char *login, char *password, char *filename);
void maybe_add_auth (URI &Uri, string NetRCFile); void maybe_add_auth (URI &Uri, std::string NetRCFile);
#endif #endif
 End of changes. 4 change blocks. 
1 lines changed or deleted 7 lines changed or added


 orderlist.h   orderlist.h 
skipping to change at line 40 skipping to change at line 40
// These are the currently selected ordering functions // These are the currently selected ordering functions
DepFunc Primary; DepFunc Primary;
DepFunc Secondary; DepFunc Secondary;
DepFunc RevDepends; DepFunc RevDepends;
DepFunc Remove; DepFunc Remove;
// State // State
Package **End; Package **End;
Package **List; Package **List;
Package **AfterEnd; Package **AfterEnd;
string *FileList; std::string *FileList;
DepIterator Loops[20]; DepIterator Loops[20];
int LoopCount; int LoopCount;
int Depth; int Depth;
unsigned short *Flags; unsigned short *Flags;
bool Debug; bool Debug;
// Main visit function // Main visit function
__deprecated bool VisitNode(PkgIterator Pkg) { return VisitNode(Pkg, "UN KNOWN"); }; __deprecated bool VisitNode(PkgIterator Pkg) { return VisitNode(Pkg, "UN KNOWN"); };
bool VisitNode(PkgIterator Pkg, char const* from); bool VisitNode(PkgIterator Pkg, char const* from);
bool VisitDeps(DepFunc F,PkgIterator Pkg); bool VisitDeps(DepFunc F,PkgIterator Pkg);
skipping to change at line 78 skipping to change at line 78
// For pre sorting // For pre sorting
static pkgOrderList *Me; static pkgOrderList *Me;
static int OrderCompareA(const void *a, const void *b); static int OrderCompareA(const void *a, const void *b);
static int OrderCompareB(const void *a, const void *b); static int OrderCompareB(const void *a, const void *b);
int FileCmp(PkgIterator A,PkgIterator B); int FileCmp(PkgIterator A,PkgIterator B);
public: public:
typedef Package **iterator; typedef Package **iterator;
// State flags /* State flags
The Loop flag can be set on a package that is currently being process
ed by either SmartConfigure or
SmartUnPack. This allows the package manager to tell when a loop has
been formed as it will try to
SmartUnPack or SmartConfigure a package with the Loop flag set. It wi
ll then either stop (as it knows
that the operation is unnecessary as its already in process), or in t
he case of the conflicts resolution
in SmartUnPack, use EarlyRemove to resolve the situation. */
enum Flags {Added = (1 << 0), AddPending = (1 << 1), enum Flags {Added = (1 << 0), AddPending = (1 << 1),
Immediate = (1 << 2), Loop = (1 << 3), Immediate = (1 << 2), Loop = (1 << 3),
UnPacked = (1 << 4), Configured = (1 << 5), UnPacked = (1 << 4), Configured = (1 << 5),
Removed = (1 << 6), // Early Remove Removed = (1 << 6), // Early Remove
InList = (1 << 7), InList = (1 << 7),
After = (1 << 8), After = (1 << 8),
States = (UnPacked | Configured | Removed)}; States = (UnPacked | Configured | Removed)};
// Flag manipulators // Flag manipulators
inline bool IsFlag(PkgIterator Pkg,unsigned long F) {return (Flags[Pkg-> ID] & F) == F;}; inline bool IsFlag(PkgIterator Pkg,unsigned long F) {return (Flags[Pkg-> ID] & F) == F;};
inline bool IsFlag(Package *Pkg,unsigned long F) {return (Flags[Pkg->ID] & F) == F;}; inline bool IsFlag(Package *Pkg,unsigned long F) {return (Flags[Pkg->ID] & F) == F;};
void Flag(PkgIterator Pkg,unsigned long State, unsigned long F) {Flags[P kg->ID] = (Flags[Pkg->ID] & (~F)) | State;}; void Flag(PkgIterator Pkg,unsigned long State, unsigned long F) {Flags[P kg->ID] = (Flags[Pkg->ID] & (~F)) | State;};
inline void Flag(PkgIterator Pkg,unsigned long F) {Flags[Pkg->ID] |= F;} ; inline void Flag(PkgIterator Pkg,unsigned long F) {Flags[Pkg->ID] |= F;} ;
inline void Flag(Package *Pkg,unsigned long F) {Flags[Pkg->ID] |= F;}; inline void Flag(Package *Pkg,unsigned long F) {Flags[Pkg->ID] |= F;};
// RmFlag removes a flag from a package
inline void RmFlag(Package *Pkg,unsigned long F) {Flags[Pkg->ID] &= ~F;}
;
// IsNow will return true if the Pkg has been not been either configured
or unpacked
inline bool IsNow(PkgIterator Pkg) {return (Flags[Pkg->ID] & (States & ( ~Removed))) == 0;}; inline bool IsNow(PkgIterator Pkg) {return (Flags[Pkg->ID] & (States & ( ~Removed))) == 0;};
bool IsMissing(PkgIterator Pkg); bool IsMissing(PkgIterator Pkg);
void WipeFlags(unsigned long F); void WipeFlags(unsigned long F);
void SetFileList(string *FileList) {this->FileList = FileList;}; void SetFileList(std::string *FileList) {this->FileList = FileList;};
// Accessors // Accessors
inline iterator begin() {return List;}; inline iterator begin() {return List;};
inline iterator end() {return End;}; inline iterator end() {return End;};
inline void push_back(Package *Pkg) {*(End++) = Pkg;}; inline void push_back(Package *Pkg) {*(End++) = Pkg;};
inline void push_back(PkgIterator Pkg) {*(End++) = Pkg;}; inline void push_back(PkgIterator Pkg) {*(End++) = Pkg;};
inline void pop_back() {End--;}; inline void pop_back() {End--;};
inline bool empty() {return End == List;}; inline bool empty() {return End == List;};
inline unsigned int size() {return End - List;}; inline unsigned int size() {return End - List;};
// Ordering modes // Ordering modes
bool OrderCritical(); bool OrderCritical();
bool OrderUnpack(string *FileList = 0); bool OrderUnpack(std::string *FileList = 0);
bool OrderConfigure(); bool OrderConfigure();
int Score(PkgIterator Pkg); int Score(PkgIterator Pkg);
pkgOrderList(pkgDepCache *Cache); pkgOrderList(pkgDepCache *Cache);
~pkgOrderList(); ~pkgOrderList();
}; };
#endif #endif
 End of changes. 5 change blocks. 
4 lines changed or deleted 18 lines changed or added


 packagemanager.h   packagemanager.h 
skipping to change at line 26 skipping to change at line 26
In the final scheme of things this may serve as a director class to In the final scheme of things this may serve as a director class to
access the actual install methods based on the file type being access the actual install methods based on the file type being
installed. installed.
##################################################################### */ ##################################################################### */
/*}} }*/ /*}} }*/
#ifndef PKGLIB_PACKAGEMANAGER_H #ifndef PKGLIB_PACKAGEMANAGER_H
#define PKGLIB_PACKAGEMANAGER_H #define PKGLIB_PACKAGEMANAGER_H
#include <apt-pkg/pkgcache.h>
#include <string> #include <string>
#include <iostream> #include <iostream>
#include <apt-pkg/pkgcache.h>
#include <apt-pkg/depcache.h>
#include <set> #include <set>
#ifndef APT_8_CLEANER_HEADERS
#include <apt-pkg/depcache.h>
using std::string; using std::string;
#endif
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};
static bool SigINTStop;
protected: protected:
string *FileNames; std::string *FileNames;
pkgDepCache &Cache; pkgDepCache &Cache;
pkgOrderList *List; pkgOrderList *List;
bool Debug; bool Debug;
bool NoImmConfigure;
bool ImmConfigureAll;
/** \brief saves packages dpkg let disappear /** \brief saves packages dpkg let disappear
This way APT can retreat from trying to configure these This way APT can retreat from trying to configure these
packages later on and a frontend can choose to display a packages later on and a frontend can choose to display a
notice to inform the user about these disappears. notice to inform the user about these disappears.
*/ */
std::set<std::string> disappearedPkgs; std::set<std::string> disappearedPkgs;
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
bool ConfigureAll(); bool ConfigureAll();
bool SmartConfigure(PkgIterator Pkg); bool SmartConfigure(PkgIterator Pkg, int const Depth);
//FIXME: merge on abi break //FIXME: merge on abi break
bool SmartUnPack(PkgIterator Pkg); bool SmartUnPack(PkgIterator Pkg);
bool SmartUnPack(PkgIterator Pkg, bool const Immediate); bool SmartUnPack(PkgIterator Pkg, bool const Immediate, int const Depth) ;
bool SmartRemove(PkgIterator Pkg); bool SmartRemove(PkgIterator Pkg);
bool EarlyRemove(PkgIterator Pkg); bool EarlyRemove(PkgIterator Pkg);
// The Actual installation implementation // The Actual installation implementation
virtual bool Install(PkgIterator /*Pkg*/,string /*File*/) {return false; }; virtual bool Install(PkgIterator /*Pkg*/,std::string /*File*/) {return f alse;};
virtual bool Configure(PkgIterator /*Pkg*/) {return false;}; virtual bool Configure(PkgIterator /*Pkg*/) {return false;};
virtual bool Remove(PkgIterator /*Pkg*/,bool /*Purge*/=false) {return fa lse;}; virtual bool Remove(PkgIterator /*Pkg*/,bool /*Purge*/=false) {return fa lse;};
virtual bool Go(int statusFd=-1) {return true;}; virtual bool Go(int statusFd=-1) {return true;};
virtual void Reset() {}; virtual void Reset() {};
// the result of the operation // the result of the operation
OrderResult Res; OrderResult Res;
public: public:
 End of changes. 11 change blocks. 
7 lines changed or deleted 12 lines changed or added


 pkgcache.h   pkgcache.h 
skipping to change at line 81 skipping to change at line 81
See \ref pkgcachegen.h for more information about generating cache struc tures. */ 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>
#ifndef APT_8_CLEANER_HEADERS
using std::string; using std::string;
#endif
class pkgVersioningSystem; class pkgVersioningSystem;
class pkgCache /*{{ {*/ class pkgCache /*{{ {*/
{ {
public: public:
// Cache element predeclarations // Cache element predeclarations
struct Header; struct Header;
struct Group; struct Group;
struct Package; struct Package;
struct PackageFile; struct PackageFile;
skipping to change at line 154 skipping to change at line 156
struct Flag struct Flag
{ {
enum PkgFlags {Auto=(1<<0),Essential=(1<<3),Important=(1<<4)}; enum PkgFlags {Auto=(1<<0),Essential=(1<<3),Important=(1<<4)};
enum PkgFFlags {NotSource=(1<<0),NotAutomatic=(1<<1),ButAutomaticUpgr ades=(1<<2)}; enum PkgFFlags {NotSource=(1<<0),NotAutomatic=(1<<1),ButAutomaticUpgr ades=(1<<2)};
}; };
protected: protected:
// Memory mapped cache file // Memory mapped cache file
string CacheFile; std::string CacheFile;
MMap &Map; MMap &Map;
unsigned long sHash(const string &S) const; unsigned long sHash(const std::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; Group *GrpP;
Package *PkgP; Package *PkgP;
VerFile *VerFileP; VerFile *VerFileP;
DescFile *DescFileP; DescFile *DescFileP;
skipping to change at line 182 skipping to change at line 184
Dependency *DepP; Dependency *DepP;
StringItem *StringItemP; StringItem *StringItemP;
char *StrP; char *StrP;
virtual bool ReMap(bool const &Errorchecks = true); 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 std::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);};
// Useful transformation things // Useful transformation things
const char *Priority(unsigned char Priority); const char *Priority(unsigned char Priority);
// Accessors // Accessors
GrpIterator FindGrp(const string &Name); GrpIterator FindGrp(const std::string &Name);
PkgIterator FindPkg(const string &Name); PkgIterator FindPkg(const std::string &Name);
PkgIterator FindPkg(const string &Name, const string &Arch); PkgIterator FindPkg(const std::string &Name, const std::string &Arch);
Header &Head() {return *HeaderP;}; Header &Head() {return *HeaderP;};
inline GrpIterator GrpBegin(); inline GrpIterator GrpBegin();
inline GrpIterator GrpEnd(); 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; }; inline bool MultiArchCache() const { return MultiArchEnabled; };
inline char const * const NativeArch() const;
// 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: private:
bool MultiArchEnabled; bool MultiArchEnabled;
PkgIterator SingleArchFindPkg(const string &Name); PkgIterator SingleArchFindPkg(const std::string &Name);
inline char const * const NativeArch() const;
}; };
/*}} }*/ /*}} }*/
// Header structure /*{{ {*/ // Header structure /*{{ {*/
struct pkgCache::Header struct pkgCache::Header
{ {
/** \brief Signature information /** \brief Signature information
This must contain the hex value 0x98FE76DC which is designed to This must contain the hex value 0x98FE76DC which is designed to
verify that the system loading the image has the same byte order verify that the system loading the image has the same byte order
and byte size as the system saving the image */ and byte size as the system saving the image */
skipping to change at line 316 skipping to change at line 318
the entire list of packages. Hash Collisions are handled with a sing ly linked 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 list of packages based at the hash item. The linked list contains on ly
packages that match the hashing function. packages that match the hashing function.
In the PkgHashTable is it possible that multiple packages have the s ame name - In the PkgHashTable is it possible that multiple packages have the s ame name -
these packages are stored as a sequence in the list. these packages are stored as a sequence in the list.
Beware: The Hashmethod assumes that the hash table sizes are equal * / Beware: The Hashmethod assumes that the hash table sizes are equal * /
map_ptrloc PkgHashTable[2*1048]; map_ptrloc PkgHashTable[2*1048];
map_ptrloc GrpHashTable[2*1048]; map_ptrloc GrpHashTable[2*1048];
/** \brief Size of the complete cache file */
unsigned long CacheFileSize;
bool CheckSizes(Header &Against) const; bool CheckSizes(Header &Against) const;
Header(); Header();
}; };
/*}} }*/ /*}} }*/
// Group structure /*{{ {*/ // Group structure /*{{ {*/
/** \brief groups architecture depending packages together /** \brief groups architecture depending packages together
On or more packages with the same name form a group, so we have 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 a simple way to access a package built for different architectures
Group exists in a singly linked list of group records starting at Group exists in a singly linked list of group records starting at
skipping to change at line 502 skipping to change at line 507
The version list is always sorted from highest version to lowest The version list is always sorted from highest version to lowest
version by the generator. Equal version numbers are either merged version by the generator. Equal version numbers are either merged
or handled as separate versions based on the Hash value. */ or handled as separate versions based on the Hash value. */
struct pkgCache::Version struct pkgCache::Version
{ {
/** \brief complete version string */ /** \brief complete version string */
map_ptrloc VerStr; // StringItem map_ptrloc VerStr; // StringItem
/** \brief section this version is filled in */ /** \brief section this version is filled in */
map_ptrloc Section; // StringItem map_ptrloc Section; // StringItem
/** \brief Multi-Arch capabilities of a package version */
enum VerMultiArch { None = 0, /*!< is the default and doesn't trigger sp
ecial behaviour */
All = (1<<0), /*!< will cause that Ver.Arch() will re
port "all" */
Foreign = (1<<1), /*!< can satisfy dependencies in an
other architecture */
Same = (1<<2), /*!< can be co-installed with itself f
rom other architectures */
Allowed = (1<<3), /*!< other packages are allowed to
depend on thispkg:any */
AllForeign = All | Foreign,
AllAllowed = All | Allowed };
/** \brief stores the MultiArch capabilities of this version /** \brief stores the MultiArch capabilities of this version
None is the default and doesn't trigger special behaviour, Flags used are defined in pkgCache::Version::VerMultiArch
Foreign means that this version can fulfill dependencies even */
if it is built for another architecture as the requester. unsigned char MultiArch;
Same indicates that builds for different architectures can
be co-installed on the system */
/* FIXME: A bitflag would be better with the next abibreak… */
enum {None, All, Foreign, Same, Allowed, AllForeign, AllAllowed} MultiAr
ch;
/** \brief references all the PackageFile's that this version came from /** \brief references all the PackageFile's that this version came from
FileList can be used to determine what distribution(s) the Version FileList can be used to determine what distribution(s) the Version
applies to. If FileList is 0 then this is a blank 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 The structure should also have a 0 in all other fields excluding
pkgCache::Version::VerStr and Possibly pkgCache::Version::NextVer. * / 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 */ /** \brief next (lower or equal) version in the linked list */
map_ptrloc NextVer; // Version map_ptrloc NextVer; // Version
 End of changes. 11 change blocks. 
16 lines changed or deleted 30 lines changed or added


 pkgcachegen.h   pkgcachegen.h 
skipping to change at line 24 skipping to change at line 24
for creating version, depends and provides structures, and some of for creating version, depends and provides structures, and some of
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 <apt-pkg/macros.h>
#include <vector> #include <vector>
class pkgSourceList; class pkgSourceList;
class OpProgress; class OpProgress;
class MMap; class MMap;
class pkgIndexFile; class pkgIndexFile;
class pkgCacheGenerator /*{{{*/ class pkgCacheGenerator /*{{{*/
{ {
skipping to change at line 65 skipping to change at line 66
toReMap.pop_back(); toReMap.pop_back();
} }
}; };
protected: protected:
DynamicMMap &Map; DynamicMMap &Map;
pkgCache Cache; pkgCache Cache;
OpProgress *Progress; OpProgress *Progress;
string PkgFileName; std::string PkgFileName;
pkgCache::PackageFile *CurrentFile; pkgCache::PackageFile *CurrentFile;
// Flag file dependencies // Flag file dependencies
bool FoundFileDeps; bool FoundFileDeps;
bool NewGroup(pkgCache::GrpIterator &Grp,const string &Name); bool NewGroup(pkgCache::GrpIterator &Grp,const std::string &Name);
bool NewPackage(pkgCache::PkgIterator &Pkg,const string &Name, const str bool NewPackage(pkgCache::PkgIterator &Pkg,const std::string &Name, cons
ing &Arch); t std::string &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, bool NewDepends(pkgCache::PkgIterator &Pkg, pkgCache::VerIterator &Ver,
string const &Version, unsigned int const &Op, std::string const &Version, unsigned int const &Op,
unsigned int const &Type, map_ptrloc* &OldDepLast); unsigned int const &Type, map_ptrloc* &OldDepLast);
unsigned long NewVersion(pkgCache::VerIterator &Ver,const string &VerStr unsigned long NewVersion(pkgCache::VerIterator &Ver,const std::string &V
,unsigned long Next); erStr,unsigned long Next);
map_ptrloc NewDescription(pkgCache::DescIterator &Desc,const string &Lan map_ptrloc NewDescription(pkgCache::DescIterator &Desc,const std::string
g,const MD5SumValue &md5sum,map_ptrloc Next); &Lang,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 std::string &S) {return Write UniqString(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 std::string &File,const std::string &Site,pkgIndex File 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); __deprecated bool FinishCache(OpProgress *Progress);
static bool MakeStatusCache(pkgSourceList &List,OpProgress *Progress, static bool MakeStatusCache(pkgSourceList &List,OpProgress *Progress,
MMap **OutMap = 0,bool AllowMem = false); MMap **OutMap = 0,bool AllowMem = false);
static bool MakeOnlyStatusCache(OpProgress *Progress,DynamicMMap **OutMa p); static bool MakeOnlyStatusCache(OpProgress *Progress,DynamicMMap **OutMa p);
static DynamicMMap* CreateDynamicMMap(FileFd *CacheF, unsigned long Flag s = 0); static DynamicMMap* CreateDynamicMMap(FileFd *CacheF, unsigned long Flag s = 0);
void ReMap(void const * const oldMap, void const * const newMap); void ReMap(void const * const oldMap, void const * const newMap);
pkgCacheGenerator(DynamicMMap *Map,OpProgress *Progress); pkgCacheGenerator(DynamicMMap *Map,OpProgress *Progress);
~pkgCacheGenerator(); ~pkgCacheGenerator();
private:
bool MergeListGroup(ListParser &List, std::string const &GrpName);
bool MergeListPackage(ListParser &List, pkgCache::PkgIterator &Pkg);
bool MergeListVersion(ListParser &List, pkgCache::PkgIterator &Pkg,
std::string const &Version, pkgCache::VerIterator*
&OutVer);
bool AddImplicitDepends(pkgCache::GrpIterator &G, pkgCache::PkgIterator
&P,
pkgCache::VerIterator &V);
bool AddImplicitDepends(pkgCache::VerIterator &V, pkgCache::PkgIterator
&D);
}; };
/*}} }*/ /*}} }*/
// 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;
// Some cache items // Some cache items
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(std::string S) {return Owner->Write UniqString(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->WriteSt ringInMap(S);}; inline unsigned long WriteString(const std::string &S) {return Owner->Wr iteStringInMap(S);};
inline unsigned long WriteString(const char *S,unsigned int Size) {retur n Owner->WriteStringInMap(S,Size);}; inline unsigned long WriteString(const char *S,unsigned int Size) {retur n Owner->WriteStringInMap(S,Size);};
bool NewDepends(pkgCache::VerIterator &Ver,const string &Package, const bool NewDepends(pkgCache::VerIterator &Ver,const std::string &Package, c
string &Arch, onst std::string &Arch,
const string &Version,unsigned int Op, const std::string &Version,unsigned int Op,
unsigned int Type); unsigned int Type);
bool NewProvides(pkgCache::VerIterator &Ver,const string &PkgName, bool NewProvides(pkgCache::VerIterator &Ver,const std::string &PkgName,
const string &PkgArch, const string &Version); const std::string &PkgArch, const std::string &Version);
public: public:
// These all operate against the current section // These all operate against the current section
virtual string Package() = 0; virtual std::string Package() = 0;
virtual string Architecture() = 0; virtual std::string Architecture() = 0;
virtual bool ArchitectureAll() = 0; virtual bool ArchitectureAll() = 0;
virtual string Version() = 0; virtual std::string Version() = 0;
virtual bool NewVersion(pkgCache::VerIterator &Ver) = 0; virtual bool NewVersion(pkgCache::VerIterator &Ver) = 0;
virtual string Description() = 0; virtual std::string Description() = 0;
virtual string DescriptionLanguage() = 0; virtual std::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;};
skipping to change at line 166 skipping to change at line 177
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
#if APT_COMPATIBILITY != 986
#warning "Using APT_COMPATIBILITY"
#endif
MMap *pkgMakeStatusCacheMem(pkgSourceList &List,OpProgress &Progress)
{
MMap *Map = 0;
if (pkgCacheGenerator::MakeStatusCache(List,&Progress,&Map,true) == fals
e)
return 0;
return Map;
}
#endif
#endif #endif
 End of changes. 17 change blocks. 
38 lines changed or deleted 38 lines changed or added


 pkgrecords.h   pkgrecords.h 
skipping to change at line 21 skipping to change at line 21
it is used to access information not generate information. No it is used to access information not generate information. No
information touched by the generator should be parable from here as information touched by the generator should be parable from here as
it can always be retreived directly from the cache. it can always be retreived directly from the cache.
##################################################################### */ ##################################################################### */
/*}} }*/ /*}} }*/
#ifndef PKGLIB_PKGRECORDS_H #ifndef PKGLIB_PKGRECORDS_H
#define PKGLIB_PKGRECORDS_H #define PKGLIB_PKGRECORDS_H
#include <apt-pkg/pkgcache.h> #include <apt-pkg/pkgcache.h>
#include <apt-pkg/fileutl.h>
#include <vector> #include <vector>
class pkgRecords /*{{ {*/ class pkgRecords /*{{ {*/
{ {
public: public:
class Parser; class Parser;
private: private:
/** \brief dpointer placeholder (for later in case we need it) */
void *d;
pkgCache &Cache; pkgCache &Cache;
std::vector<Parser *>Files; std::vector<Parser *>Files;
public: public:
// Lookup function // Lookup function
Parser &Lookup(pkgCache::VerFileIterator const &Ver); Parser &Lookup(pkgCache::VerFileIterator const &Ver);
Parser &Lookup(pkgCache::DescFileIterator const &Desc); Parser &Lookup(pkgCache::DescFileIterator const &Desc);
// Construct destruct // Construct destruct
pkgRecords(pkgCache &Cache); pkgRecords(pkgCache &Cache);
~pkgRecords(); ~pkgRecords();
}; };
/*}} }*/ /*}} }*/
class pkgRecords::Parser /*{{ {*/ class pkgRecords::Parser /*{{ {*/
{ {
protected: protected:
virtual bool Jump(pkgCache::VerFileIterator const &Ver) = 0; virtual bool Jump(pkgCache::VerFileIterator const &Ver) = 0;
virtual bool Jump(pkgCache::DescFileIterator const &Desc) = 0; virtual bool Jump(pkgCache::DescFileIterator const &Desc) = 0;
public: public:
friend class pkgRecords; friend class pkgRecords;
// These refer to the archive file for the Version // These refer to the archive file for the Version
virtual string FileName() {return string();}; virtual std::string FileName() {return std::string();};
virtual string MD5Hash() {return string();}; virtual std::string MD5Hash() {return std::string();};
virtual string SHA1Hash() {return string();}; virtual std::string SHA1Hash() {return std::string();};
virtual string SHA256Hash() {return string();}; virtual std::string SHA256Hash() {return std::string();};
virtual string SourcePkg() {return string();}; virtual std::string SHA512Hash() {return std::string();};
virtual string SourceVer() {return string();}; virtual std::string SourcePkg() {return std::string();};
virtual std::string SourceVer() {return std::string();};
// These are some general stats about the package // These are some general stats about the package
virtual string Maintainer() {return string();}; virtual std::string Maintainer() {return std::string();};
virtual string ShortDesc() {return string();}; virtual std::string ShortDesc() {return std::string();};
virtual string LongDesc() {return string();}; virtual std::string LongDesc() {return std::string();};
virtual string Name() {return string();}; virtual std::string Name() {return std::string();};
virtual string Homepage() {return string();} virtual std::string Homepage() {return std::string();}
// An arbitrary custom field
virtual std::string RecordField(const char *fieldName) { return std::str
ing();};
// The record in binary form // The record in binary form
virtual void GetRec(const char *&Start,const char *&Stop) {Start = Stop = 0;}; virtual void GetRec(const char *&Start,const char *&Stop) {Start = Stop = 0;};
virtual ~Parser() {}; virtual ~Parser() {};
}; };
/*}} }*/ /*}} }*/
#endif #endif
 End of changes. 5 change blocks. 
14 lines changed or deleted 19 lines changed or added


 pkgsystem.h   pkgsystem.h 
skipping to change at line 40 skipping to change at line 40
Upon startup each supported system instantiates an instance of the Upon startup each supported system instantiates an instance of the
pkgSystem class (using a global constructor) which will make itself pkgSystem class (using a global constructor) which will make itself
available to the main APT init routine. That routine will select the available to the main APT init routine. That routine will select the
proper system and make it the global default. proper system and make it the global default.
##################################################################### */ ##################################################################### */
/*}} }*/ /*}} }*/
#ifndef PKGLIB_PKGSYSTEM_H #ifndef PKGLIB_PKGSYSTEM_H
#define PKGLIB_PKGSYSTEM_H #define PKGLIB_PKGSYSTEM_H
#include <apt-pkg/depcache.h> #include <apt-pkg/pkgcache.h>
#include <vector> #include <vector>
#ifndef APT_8_CLEANER_HEADERS
#include <apt-pkg/depcache.h>
#endif
class pkgDepCache;
class pkgPackageManager; class pkgPackageManager;
class pkgVersioningSystem; class pkgVersioningSystem;
class Configuration; class Configuration;
class pkgIndexFile; class pkgIndexFile;
class PkgFileIterator;
class pkgSystem class pkgSystem
{ {
public: public:
// Global list of supported systems // Global list of supported systems
static pkgSystem **GlobalList; static pkgSystem **GlobalList;
static unsigned long GlobalListLen; static unsigned long GlobalListLen;
static pkgSystem *GetSystem(const char *Label); static pkgSystem *GetSystem(const char *Label);
 End of changes. 3 change blocks. 
1 lines changed or deleted 8 lines changed or added


 policy.h   policy.h 
skipping to change at line 40 skipping to change at line 40
##################################################################### */ ##################################################################### */
/*}} }*/ /*}} }*/
#ifndef PKGLIB_POLICY_H #ifndef PKGLIB_POLICY_H
#define PKGLIB_POLICY_H #define PKGLIB_POLICY_H
#include <apt-pkg/depcache.h> #include <apt-pkg/depcache.h>
#include <apt-pkg/versionmatch.h> #include <apt-pkg/versionmatch.h>
#include <vector> #include <vector>
#ifndef APT_8_CLEANER_HEADERS
using std::vector; using std::vector;
#endif
class pkgPolicy : public pkgDepCache::Policy class pkgPolicy : public pkgDepCache::Policy
{ {
protected: protected:
struct Pin struct Pin
{ {
pkgVersionMatch::MatchType Type; pkgVersionMatch::MatchType Type;
string Data; std::string Data;
signed short Priority; signed short Priority;
Pin() : Type(pkgVersionMatch::None), Priority(0) {}; Pin() : Type(pkgVersionMatch::None), Priority(0) {};
}; };
struct PkgPin : Pin struct PkgPin : Pin
{ {
string Pkg; std::string Pkg;
PkgPin(string const &Pkg) : Pin(), Pkg(Pkg) {}; PkgPin(std::string const &Pkg) : Pin(), Pkg(Pkg) {};
}; };
Pin *Pins; Pin *Pins;
signed short *PFPriority; signed short *PFPriority;
vector<Pin> Defaults; std::vector<Pin> Defaults;
vector<PkgPin> Unmatched; std::vector<PkgPin> Unmatched;
pkgCache *Cache; pkgCache *Cache;
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,std::string Pkg,
string Data,signed short Priority); std::string Data,signed short Priority);
inline signed short GetPriority(pkgCache::PkgFileIterator const &File)
{return PFPriority[File->ID];};
signed short GetPriority(pkgCache::PkgIterator const &Pkg);
pkgCache::VerIterator GetMatch(pkgCache::PkgIterator const &Pkg); pkgCache::VerIterator GetMatch(pkgCache::PkgIterator const &Pkg);
// Things for the cache interface. // Things for the cache interface.
virtual pkgCache::VerIterator GetCandidateVer(pkgCache::PkgIterator cons t &Pkg); virtual pkgCache::VerIterator GetCandidateVer(pkgCache::PkgIterator cons t &Pkg);
virtual bool IsImportantDep(pkgCache::DepIterator const &Dep) {return pk virtual signed short GetPriority(pkgCache::PkgIterator const &Pkg);
gDepCache::Policy::IsImportantDep(Dep);}; virtual signed short GetPriority(pkgCache::PkgFileIterator const &File);
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, std::string File = "");
bool ReadPinDir(pkgPolicy &Plcy,string Dir = ""); bool ReadPinDir(pkgPolicy &Plcy, std::string Dir = "");
#endif #endif
 End of changes. 8 change blocks. 
14 lines changed or deleted 14 lines changed or added


 progress.h   progress.h 
skipping to change at line 27 skipping to change at line 27
The UI is expected to subclass this to provide the visuals to the user. The UI is expected to subclass this to provide the visuals to the user.
##################################################################### */ ##################################################################### */
/*}} }*/ /*}} }*/
#ifndef PKGLIB_PROGRESS_H #ifndef PKGLIB_PROGRESS_H
#define PKGLIB_PROGRESS_H #define PKGLIB_PROGRESS_H
#include <string> #include <string>
#include <sys/time.h> #include <sys/time.h>
#ifndef APT_8_CLEANER_HEADERS
using std::string; using std::string;
#endif
class Configuration; class Configuration;
class OpProgress class OpProgress
{ {
unsigned long Current; unsigned long long Current;
unsigned long Total; unsigned long long Total;
unsigned long Size; unsigned long long Size;
unsigned long SubTotal; unsigned long long SubTotal;
float LastPercent; float LastPercent;
// Change reduction code // Change reduction code
struct timeval LastTime; struct timeval LastTime;
string LastOp; std::string LastOp;
string LastSubOp; std::string LastSubOp;
protected: protected:
string Op; std::string Op;
string SubOp; std::string SubOp;
float Percent; float Percent;
bool MajorChange; bool MajorChange;
bool CheckChange(float Interval = 0.7); bool CheckChange(float Interval = 0.7);
virtual void Update() {}; virtual void Update() {};
public: public:
void Progress(unsigned long Current); void Progress(unsigned long long Current);
void SubProgress(unsigned long SubTotal); void SubProgress(unsigned long long SubTotal, const std::string &Op = ""
void SubProgress(unsigned long SubTotal,const string &Op); , float const Percent = -1);
void OverallProgress(unsigned long Current,unsigned long Total, void OverallProgress(unsigned long long Current,unsigned long long Total
unsigned long Size,const string &Op); ,
unsigned long long Size,const std::string &Op);
virtual void Done() {}; virtual void Done() {};
OpProgress(); OpProgress();
virtual ~OpProgress() {}; virtual ~OpProgress() {};
}; };
class OpTextProgress : public OpProgress class OpTextProgress : public OpProgress
{ {
protected: protected:
string OldOp; std::string OldOp;
bool NoUpdate; bool NoUpdate;
bool NoDisplay; bool NoDisplay;
unsigned long LastLen; unsigned long LastLen;
virtual void Update(); virtual void Update();
void Write(const char *S); void Write(const char *S);
public: public:
virtual void Done(); virtual void Done();
 End of changes. 7 change blocks. 
14 lines changed or deleted 17 lines changed or added


 sha1.h   sha1.h 
skipping to change at line 21 skipping to change at line 21
##################################################################### */ ##################################################################### */
/*}} }*/ /*}} }*/
#ifndef APTPKG_SHA1_H #ifndef APTPKG_SHA1_H
#define APTPKG_SHA1_H #define APTPKG_SHA1_H
#include <string> #include <string>
#include <cstring> #include <cstring>
#include <algorithm> #include <algorithm>
#include "hashsum_template.h"
#ifndef APT_8_CLEANER_HEADERS
using std::string; using std::string;
using std::min; using std::min;
#endif
class SHA1Summation; typedef HashSumValue<160> SHA1SumValue;
class SHA1SumValue
{
friend class SHA1Summation;
unsigned char Sum[20];
public:
// Accessors
bool operator ==(const SHA1SumValue &rhs) const;
string Value() const;
inline void Value(unsigned char S[20])
{for (int I = 0; I != sizeof(Sum); I++) S[I] = Sum[I];};
inline operator string() const {return Value();};
bool Set(string Str);
inline void Set(unsigned char S[20])
{for (int I = 0; I != sizeof(Sum); I++) Sum[I] = S[I];};
SHA1SumValue(string Str);
SHA1SumValue();
};
class SHA1Summation class SHA1Summation : public SummationImplementation
{ {
/* assumes 64-bit alignment just in case */ /* assumes 64-bit alignment just in case */
unsigned char Buffer[64] __attribute__((aligned(8))); unsigned char Buffer[64] __attribute__((aligned(8)));
unsigned char State[5*4] __attribute__((aligned(8))); unsigned char State[5*4] __attribute__((aligned(8)));
unsigned char Count[2*4] __attribute__((aligned(8))); unsigned char Count[2*4] __attribute__((aligned(8)));
bool Done; bool Done;
public: public:
bool Add(const unsigned char *inbuf, unsigned long long inlen);
using SummationImplementation::Add;
bool Add(const unsigned char *inbuf,unsigned long inlen);
inline bool Add(const char *Data) {return Add((unsigned char *)Data,strl
en(Data));};
bool AddFD(int Fd,unsigned long Size);
inline bool Add(const unsigned char *Beg,const unsigned char *End)
{return Add(Beg,End-Beg);};
SHA1SumValue Result(); SHA1SumValue Result();
SHA1Summation(); SHA1Summation();
}; };
#endif #endif
 End of changes. 6 change blocks. 
29 lines changed or deleted 8 lines changed or added


 sha256.h   sha256.h 
// -*- mode: cpp; mode: fold -*-
// Description /*{
{{*/
// $Id: sha1.h,v 1.3 2001/05/07 05:05:47 jgg Exp $
/* ######################################################################
SHA256SumValue - Storage for a SHA-256 hash.
SHA256Summation - SHA-256 Secure Hash Algorithm.
This is a C++ interface to a set of SHA256Sum functions, that mirrors
the equivalent MD5 & SHA1 classes.
##################################################################### */
/*}
}}*/
#ifndef APTPKG_SHA256_H #ifndef APTPKG_SHA256_H
#define APTPKG_SHA256_H #define APTPKG_SHA256_H
#include <string> #include "sha2.h"
#include <cstring>
#include <algorithm>
#include <stdint.h>
using std::string;
using std::min;
class SHA256Summation;
class SHA256SumValue
{
friend class SHA256Summation;
unsigned char Sum[32];
public:
// Accessors
bool operator ==(const SHA256SumValue &rhs) const;
string Value() const;
inline void Value(unsigned char S[32])
{for (int I = 0; I != sizeof(Sum); I++) S[I] = Sum[I];};
inline operator string() const {return Value();};
bool Set(string Str);
inline void Set(unsigned char S[32])
{for (int I = 0; I != sizeof(Sum); I++) Sum[I] = S[I];};
SHA256SumValue(string Str);
SHA256SumValue();
};
struct sha256_ctx {
uint32_t count[2];
uint32_t state[8];
uint8_t buf[128];
};
class SHA256Summation
{
struct sha256_ctx Sum;
bool Done;
public:
bool Add(const unsigned char *inbuf,unsigned long inlen);
inline bool Add(const char *Data) {return Add((unsigned char *)Data,strl
en(Data));};
bool AddFD(int Fd,unsigned long Size);
inline bool Add(const unsigned char *Beg,const unsigned char *End)
{return Add(Beg,End-Beg);};
SHA256SumValue Result();
SHA256Summation(); #warning "This header is deprecated, please include sha2.h instead"
};
#endif #endif
 End of changes. 3 change blocks. 
69 lines changed or deleted 2 lines changed or added


 sourcelist.h   sourcelist.h 
skipping to change at line 34 skipping to change at line 34
##################################################################### */ ##################################################################### */
/*}} }*/ /*}} }*/
#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 <map>
#include <apt-pkg/pkgcache.h> #include <apt-pkg/pkgcache.h>
#include <apt-pkg/metaindex.h>
#ifndef APT_8_CLEANER_HEADERS
#include <apt-pkg/metaindex.h>
using std::string; using std::string;
using std::vector; using std::vector;
#endif
class pkgAcquire;
class pkgIndexFile;
class metaIndex;
class pkgAquire;
class pkgSourceList class pkgSourceList
{ {
public: public:
// List of supported source list types // List of supported source list types
class Type class Type
{ {
public: public:
// Global list of Items supported // Global list of Items supported
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(std::string &URI) const;
virtual bool ParseLine(vector<metaIndex *> &List, virtual bool ParseLine(std::vector<metaIndex *> &List,
const char *Buffer, const char *Buffer,
unsigned long const &CurLine,string const &File unsigned long const &CurLine,std::string const
) const; &File) const;
virtual bool CreateItem(vector<metaIndex *> &List,string const &URI, virtual bool CreateItem(std::vector<metaIndex *> &List,std::string co
string const &Dist,string const &Section, nst &URI,
std::map<string, string> const &Options) const std::string const &Dist,std::string const &Sec
= 0; tion,
std::map<std::string, std::string> const &Opti
ons) const = 0;
Type(); Type();
virtual ~Type() {}; virtual ~Type() {};
}; };
typedef vector<metaIndex *>::const_iterator const_iterator; typedef std::vector<metaIndex *>::const_iterator const_iterator;
protected: protected:
vector<metaIndex *> SrcList; std::vector<metaIndex *> SrcList;
public: public:
bool ReadMainList(); bool ReadMainList();
bool Read(string File); bool Read(std::string File);
// CNC:2003-03-03 // CNC:2003-03-03
void Reset(); void Reset();
bool ReadAppend(string File); bool ReadAppend(std::string File);
bool ReadSourceDir(string Dir); bool ReadSourceDir(std::string Dir);
// List accessors // List accessors
inline const_iterator begin() const {return SrcList.begin();}; inline const_iterator begin() const {return SrcList.begin();};
inline const_iterator end() const {return SrcList.end();}; inline const_iterator end() const {return SrcList.end();};
inline unsigned int size() const {return SrcList.size();}; inline unsigned int size() const {return SrcList.size();};
inline bool empty() const {return SrcList.empty();}; inline bool empty() const {return SrcList.empty();};
bool FindIndex(pkgCache::PkgFileIterator File, bool FindIndex(pkgCache::PkgFileIterator File,
pkgIndexFile *&Found) const; pkgIndexFile *&Found) const;
bool GetIndexes(pkgAcquire *Owner, bool GetAll=false) const; bool GetIndexes(pkgAcquire *Owner, bool GetAll=false) const;
// query last-modified time // query last-modified time
time_t GetLastModifiedTime(); time_t GetLastModifiedTime();
pkgSourceList(); pkgSourceList();
pkgSourceList(string File); pkgSourceList(std::string File);
~pkgSourceList(); ~pkgSourceList();
}; };
#endif #endif
 End of changes. 11 change blocks. 
16 lines changed or deleted 23 lines changed or added


 srcrecords.h   srcrecords.h 
skipping to change at line 19 skipping to change at line 19
source name on that list. source name on that list.
##################################################################### */ ##################################################################### */
/*}} }*/ /*}} }*/
#ifndef PKGLIB_SRCRECORDS_H #ifndef PKGLIB_SRCRECORDS_H
#define PKGLIB_SRCRECORDS_H #define PKGLIB_SRCRECORDS_H
#include <string> #include <string>
#include <vector> #include <vector>
#ifndef APT_8_CLEANER_HEADERS
using std::string; using std::string;
using std::vector; using std::vector;
#endif
class pkgSourceList; class pkgSourceList;
class pkgIndexFile; class pkgIndexFile;
class pkgSrcRecords class pkgSrcRecords
{ {
public: public:
// Describes a single file // Describes a single file
struct File struct File
{ {
string MD5Hash; std::string MD5Hash;
unsigned long Size; unsigned long Size;
string Path; std::string Path;
string Type; std::string Type;
}; };
// Abstract parser for each source record // Abstract parser for each source record
class Parser class Parser
{ {
protected: protected:
const pkgIndexFile *iIndex; const pkgIndexFile *iIndex;
public: public:
enum BuildDep {BuildDepend=0x0,BuildDependIndep=0x1, enum BuildDep {BuildDepend=0x0,BuildDependIndep=0x1,
BuildConflict=0x2,BuildConflictIndep=0x3}; BuildConflict=0x2,BuildConflictIndep=0x3};
struct BuildDepRec struct BuildDepRec
{ {
string Package; std::string Package;
string Version; std::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 const &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 std::string AsStr() = 0;
virtual string Package() const = 0; virtual std::string Package() const = 0;
virtual string Version() const = 0; virtual std::string Version() const = 0;
virtual string Maintainer() const = 0; virtual std::string Maintainer() const = 0;
virtual string Section() const = 0; virtual std::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 const &ArchOnly, bool const &StripMultiArch = true) = 0; virtual bool BuildDepends(std::vector<BuildDepRec> &BuildDeps, bool c onst &ArchOnly, bool const &StripMultiArch = true) = 0;
static const char *BuildDepType(unsigned char const &Type); static const char *BuildDepType(unsigned char const &Type);
virtual bool Files(vector<pkgSrcRecords::File> &F) = 0; virtual bool Files(std::vector<pkgSrcRecords::File> &F) = 0;
Parser(const pkgIndexFile *Index) : iIndex(Index) {}; Parser(const pkgIndexFile *Index) : iIndex(Index) {};
virtual ~Parser() {}; virtual ~Parser() {};
}; };
private: private:
/** \brief dpointer placeholder (for later in case we need it) */
void *d;
// The list of files and the current parser pointer // The list of files and the current parser pointer
vector<Parser*> Files; std::vector<Parser*> Files;
vector<Parser *>::iterator Current; std::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 const &SrcOnly = false); Parser *Find(const char *Package,bool const &SrcOnly = false);
pkgSrcRecords(pkgSourceList &List); pkgSrcRecords(pkgSourceList &List);
~pkgSrcRecords(); virtual ~pkgSrcRecords();
}; };
#endif #endif
 End of changes. 12 change blocks. 
15 lines changed or deleted 19 lines changed or added


 strutl.h   strutl.h 
skipping to change at line 28 skipping to change at line 28
#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" #include "macros.h"
#ifndef APT_8_CLEANER_HEADERS
using std::string; using std::string;
using std::vector; using std::vector;
using std::ostream; using std::ostream;
#endif
bool UTF8ToCodeset(const char *codeset, const string &orig, string *dest); bool UTF8ToCodeset(const char *codeset, const std::string &orig, std::strin g *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,std::string &Res);
bool ParseCWord(const char *&String,string &Res); bool ParseCWord(const char *&String,std::string &Res);
string QuoteString(const string &Str,const char *Bad); std::string QuoteString(const std::string &Str,const char *Bad);
string DeQuoteString(const string &Str); std::string DeQuoteString(const std::string &Str);
string DeQuoteString(string::const_iterator const &begin, string::const_ite std::string DeQuoteString(std::string::const_iterator const &begin, std::st
rator const &end); ring::const_iterator const &end);
// unescape (\0XX and \xXX) from a string // unescape (\0XX and \xXX) from a string
string DeEscapeString(const string &input); std::string DeEscapeString(const std::string &input);
string SizeToStr(double Bytes); std::string SizeToStr(double Bytes);
string TimeToStr(unsigned long Sec); std::string TimeToStr(unsigned long Sec);
string Base64Encode(const string &Str); std::string Base64Encode(const std::string &Str);
string OutputInDepth(const unsigned long Depth, const char* Separator=" ") std::string OutputInDepth(const unsigned long Depth, const char* Separator=
; " ");
string URItoFileName(const string &URI); std::string URItoFileName(const std::string &URI);
string TimeRFC1123(time_t Date); std::string TimeRFC1123(time_t Date);
bool RFC1123StrToTime(const char* const str,time_t &time) __must_check; bool RFC1123StrToTime(const char* const str,time_t &time) __must_check;
bool FTPMDTMStrToTime(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); __deprecated bool StrToTime(const std::string &Val,time_t &Result);
string LookupTag(const string &Message,const char *Tag,const char *Default std::string LookupTag(const std::string &Message,const char *Tag,const char
= 0); *Default = 0);
int StringToBool(const string &Text,int Default = -1); int StringToBool(const std::string &Text,int Default = -1);
bool ReadMessages(int Fd, vector<string> &List); bool ReadMessages(int Fd, std::vector<std::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 StrToNum(const char *Str,unsigned long long &Res,unsigned Len,unsigned Base = 0);
bool Base256ToNum(const char *Str,unsigned long &Res,unsigned int Len); bool Base256ToNum(const char *Str,unsigned long &Res,unsigned int Len);
bool Hex2Num(const string &Str,unsigned char *Num,unsigned int Length); bool Hex2Num(const std::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);
vector<string> VectorizeString(string const &haystack, char const &split) _ std::vector<std::string> VectorizeString(std::string const &haystack, char
_attrib_const; const &split) __attrib_const;
void ioprintf(ostream &out,const char *format,...) __like_printf(2); void ioprintf(std::ostream &out,const char *format,...) __like_printf(2);
void strprintf(string &out,const char *format,...) __like_printf(2); void strprintf(std::string &out,const char *format,...) __like_printf(2);
char *safe_snprintf(char *Buffer,char *End,const char *Format,...) __like_p rintf(3); 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 std::string &Host, const std::string &List);
int tolower_ascii(int const c) __attrib_const __hot; int tolower_ascii(int const c) __attrib_const __hot;
string StripEpoch(const string &VerStr); std::string StripEpoch(const std::string &VerStr);
#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 inline int name(const std::string& A,const char *B) {return func(A.c_str(),
tr()+A.length(),B,B+strlen(B));}; \ A.c_str()+A.length(),B,B+strlen(B));}; \
inline int name(const string& A,const string& B) {return func(A.c_str(),A.c inline int name(const std::string& A,const std::string& B) {return func(A.c
_str()+A.length(),B.c_str(),B.c_str()+B.length());}; \ _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 inline int name(const std::string& A,const char *B,const char *BEnd) {retur
c(A.c_str(),A.c_str()+A.length(),B,BEnd);}; n func(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));}; \
inline int name(const string& A,const char *B) {return func(A.begin(),A.end inline int name(const std::string& A,const char *B) {return func(A.begin(),
(),B,B+strlen(B));}; \ A.end(),B,B+strlen(B));}; \
inline int name(const string& A,const string& B) {return func(A.begin(),A.e inline int name(const std::string& A,const std::string& B) {return func(A.b
nd(),B.begin(),B.end());}; \ egin(),A.end(),B.begin(),B.end());}; \
inline int name(const string& A,const char *B,const char *BEnd) {return fun inline int name(const std::string& A,const char *B,const char *BEnd) {retur
c(A.begin(),A.end(),B,BEnd);}; n func(A.begin(),A.end(),B,BEnd);};
int stringcmp(const char *A,const char *AEnd,const char *B,const char *BEnd ); int stringcmp(const char *A,const char *AEnd,const char *B,const char *BEnd );
int stringcasecmp(const char *A,const char *AEnd,const char *B,const char * BEnd); int stringcasecmp(const char *A,const char *AEnd,const char *B,const char * BEnd);
/* We assume that GCC 3 indicates that libstdc++3 is in use too. In that /* We assume that GCC 3 indicates that libstdc++3 is in use too. In that
case the definition of string::const_iterator is not the same as case the definition of string::const_iterator is not the same as
const char * and we need these extra functions */ const char * and we need these extra functions */
#if __GNUC__ >= 3 #if __GNUC__ >= 3
int stringcmp(string::const_iterator A,string::const_iterator AEnd, int stringcmp(std::string::const_iterator A,std::string::const_iterator AEn d,
const char *B,const char *BEnd); const char *B,const char *BEnd);
int stringcmp(string::const_iterator A,string::const_iterator AEnd, int stringcmp(std::string::const_iterator A,std::string::const_iterator AEn
string::const_iterator B,string::const_iterator BEnd); d,
int stringcasecmp(string::const_iterator A,string::const_iterator AEnd, std::string::const_iterator B,std::string::const_iterator BEnd
);
int stringcasecmp(std::string::const_iterator A,std::string::const_iterator
AEnd,
const char *B,const char *BEnd); const char *B,const char *BEnd);
int stringcasecmp(string::const_iterator A,string::const_iterator AEnd, int stringcasecmp(std::string::const_iterator A,std::string::const_iterator
string::const_iterator B,string::const_iterator BEnd); AEnd,
std::string::const_iterator B,std::string::const_iterator
BEnd);
inline int stringcmp(string::const_iterator A,string::const_iterator Aend,c inline int stringcmp(std::string::const_iterator A,std::string::const_itera
onst char *B) {return stringcmp(A,Aend,B,B+strlen(B));}; tor Aend,const char *B) {return stringcmp(A,Aend,B,B+strlen(B));};
inline int stringcasecmp(string::const_iterator A,string::const_iterator Ae inline int stringcasecmp(std::string::const_iterator A,std::string::const_i
nd,const char *B) {return stringcasecmp(A,Aend,B,B+strlen(B));}; terator Aend,const char *B) {return stringcasecmp(A,Aend,B,B+strlen(B));};
#endif #endif
APT_MKSTRCMP2(stringcmp,stringcmp); APT_MKSTRCMP2(stringcmp,stringcmp);
APT_MKSTRCMP2(stringcasecmp,stringcasecmp); APT_MKSTRCMP2(stringcasecmp,stringcasecmp);
inline const char *DeNull(const char *s) {return (s == 0?"(null)":s);}; inline const char *DeNull(const char *s) {return (s == 0?"(null)":s);};
class URI class URI
{ {
void CopyFrom(const string &From); void CopyFrom(const std::string &From);
public: public:
string Access; std::string Access;
string User; std::string User;
string Password; std::string Password;
string Host; std::string Host;
string Path; std::string Path;
unsigned int Port; unsigned int Port;
operator string(); operator std::string();
inline void operator =(const string &From) {CopyFrom(From);}; inline void operator =(const std::string &From) {CopyFrom(From);};
inline bool empty() {return Access.empty();}; inline bool empty() {return Access.empty();};
static string SiteOnly(const string &URI); static std::string SiteOnly(const std::string &URI);
static string NoUserPassword(const string &URI); static std::string NoUserPassword(const std::string &URI);
URI(string Path) {CopyFrom(Path);}; URI(std::string Path) {CopyFrom(Path);};
URI() : Port(0) {}; URI() : Port(0) {};
}; };
struct SubstVar struct SubstVar
{ {
const char *Subst; const char *Subst;
const string *Contents; const std::string *Contents;
}; };
string SubstVar(string Str,const struct SubstVar *Vars); std::string SubstVar(std::string Str,const struct SubstVar *Vars);
string SubstVar(const string &Str,const string &Subst,const string &Content std::string SubstVar(const std::string &Str,const std::string &Subst,const
s); std::string &Contents);
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);
 End of changes. 25 change blocks. 
64 lines changed or deleted 72 lines changed or added


 tagfile.h   tagfile.h 
skipping to change at line 23 skipping to change at line 23
A second class is used to perform pre-parsing of the record. It works A second class is used to perform pre-parsing of the record. It works
by indexing the start of each header field and providing lookup by indexing the start of each header field and providing lookup
functions for header fields. functions for header fields.
##################################################################### */ ##################################################################### */
/*}} }*/ /*}} }*/
#ifndef PKGLIB_TAGFILE_H #ifndef PKGLIB_TAGFILE_H
#define PKGLIB_TAGFILE_H #define PKGLIB_TAGFILE_H
#include <apt-pkg/fileutl.h>
#include <stdio.h> #include <stdio.h>
#include <string>
#ifndef APT_8_CLEANER_HEADERS
#include <apt-pkg/fileutl.h>
#endif
class FileFd;
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;
// dpointer placeholder (for later in case we need it)
void *d;
/* This very simple hash function for the last 8 letters gives /* This very simple hash function for the last 8 letters gives
very good performance on the debian package files */ very good performance on the debian package files */
inline static unsigned long AlphaHash(const char *Text, const char *End = 0) inline static unsigned long AlphaHash(const char *Text, const char *End = 0)
{ {
unsigned long Res = 0; unsigned long Res = 0;
for (; Text != End && *Text != ':' && *Text != 0; Text++) for (; Text != End && *Text != ':' && *Text != 0; Text++)
Res = ((unsigned long)(*Text) & 0xDF) ^ (Res << 1); Res = ((unsigned long)(*Text) & 0xDF) ^ (Res << 1);
return Res & 0xFF; return Res & 0xFF;
} }
skipping to change at line 56 skipping to change at line 63
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; std::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; 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 static const FindFlag(unsigned long &Flags, unsigned long Flag, bool static const FindFlag(unsigned long &Flags, unsigned long Flag,
const char* Start, const char* Stop); const char* Start, const char* Stop);
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);
skipping to change at line 81 skipping to change at line 88
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), TagCount(0), Stop(0) {}; pkgTagSection() : Section(0), TagCount(0), Stop(0) {};
virtual ~pkgTagSection() {};
}; };
class pkgTagFilePrivate;
class pkgTagFile class pkgTagFile
{ {
FileFd &Fd; pkgTagFilePrivate *d;
char *Buffer;
char *Start;
char *End;
bool Done;
unsigned long iOffset;
unsigned long Size;
bool Fill(); bool Fill();
bool Resize(); bool Resize();
public: public:
bool Step(pkgTagSection &Section); bool Step(pkgTagSection &Section);
inline unsigned long Offset() {return iOffset;}; unsigned long Offset();
bool Jump(pkgTagSection &Tag,unsigned long Offset); bool Jump(pkgTagSection &Tag,unsigned long long Offset);
pkgTagFile(FileFd *F,unsigned long Size = 32*1024); pkgTagFile(FileFd *F,unsigned long long Size = 32*1024);
~pkgTagFile(); virtual ~pkgTagFile();
}; };
/* This is the list of things to rewrite. The rewriter /* This is the list of things to rewrite. The rewriter
goes through and changes or adds each of these headers goes through and changes or adds each of these headers
to suit. A zero forces the header to be erased, an empty string to suit. A zero forces the header to be erased, an empty string
causes the old value to be used. (rewrite rule ignored) */ causes the old value to be used. (rewrite rule ignored) */
struct TFRewriteData struct TFRewriteData
{ {
const char *Tag; const char *Tag;
const char *Rewrite; const char *Rewrite;
 End of changes. 11 change blocks. 
15 lines changed or deleted 18 lines changed or added


 vendor.h   vendor.h 
#ifndef PKGLIB_VENDOR_H #ifndef PKGLIB_VENDOR_H
#define PKGLIB_VENDOR_H #define PKGLIB_VENDOR_H
#include <string> #include <string>
#include <vector> #include <vector>
#include <map> #include <map>
#include <apt-pkg/macros.h> #include <apt-pkg/macros.h>
#ifndef APT_8_CLEANER_HEADERS
using std::string; using std::string;
#endif
// A class representing a particular software provider. // A class representing a particular software provider.
class __deprecated Vendor class __deprecated Vendor
{ {
public: public:
struct Fingerprint struct Fingerprint
{ {
string Print; std::string Print;
string Description; std::string Description;
}; };
protected: protected:
string VendorID; std::string VendorID;
string Origin; std::string Origin;
std::map<string, string> Fingerprints; std::map<std::string, std::string> Fingerprints;
public: public:
Vendor(string VendorID, string Origin, Vendor(std::string VendorID, std::string Origin,
std::vector<struct Fingerprint *> *FingerprintList); std::vector<struct Fingerprint *> *FingerprintList);
virtual const string& GetVendorID() const { return VendorID; }; virtual const std::string& GetVendorID() const { return VendorID; };
virtual const string LookupFingerprint(string Print) const; virtual const std::string LookupFingerprint(std::string Print) const;
virtual bool CheckDist(string Dist); virtual bool CheckDist(std::string Dist);
virtual ~Vendor(){}; virtual ~Vendor(){};
}; };
#endif #endif
 End of changes. 6 change blocks. 
9 lines changed or deleted 11 lines changed or added


 vendorlist.h   vendorlist.h 
skipping to change at line 18 skipping to change at line 18
The Vendor List class provides access to a list of vendors and The Vendor List class provides access to a list of vendors and
attributes associated with them, read from a configuration file. attributes associated with them, read from a configuration file.
##################################################################### */ ##################################################################### */
/*}} }*/ /*}} }*/
#ifndef PKGLIB_VENDORLIST_H #ifndef PKGLIB_VENDORLIST_H
#define PKGLIB_VENDORLIST_H #define PKGLIB_VENDORLIST_H
#include <string> #include <string>
#include <vector> #include <vector>
#include <apt-pkg/vendor.h>
#include <apt-pkg/configuration.h>
#include <apt-pkg/macros.h> #include <apt-pkg/macros.h>
#ifndef APT_8_CLEANER_HEADERS
#include <apt-pkg/vendor.h>
#include <apt-pkg/configuration.h>
using std::string; using std::string;
using std::vector; using std::vector;
#endif
class Vendor;
class Configuration;
class __deprecated pkgVendorList class __deprecated pkgVendorList
{ {
protected: protected:
vector<Vendor const *> VendorList; std::vector<Vendor const *> VendorList;
bool CreateList(Configuration& Cnf); bool CreateList(Configuration& Cnf);
const Vendor* LookupFingerprint(string Fingerprint); const Vendor* LookupFingerprint(std::string Fingerprint);
public: public:
typedef vector<Vendor const *>::const_iterator const_iterator; typedef std::vector<Vendor const *>::const_iterator const_iterator;
bool ReadMainList(); bool ReadMainList();
bool Read(string File); bool Read(std::string File);
// List accessors // List accessors
inline const_iterator begin() const {return VendorList.begin();}; inline const_iterator begin() const {return VendorList.begin();};
inline const_iterator end() const {return VendorList.end();}; inline const_iterator end() const {return VendorList.end();};
inline unsigned int size() const {return VendorList.size();}; inline unsigned int size() const {return VendorList.size();};
inline bool empty() const {return VendorList.empty();}; inline bool empty() const {return VendorList.empty();};
const Vendor* FindVendor(const vector<string> GPGVOutput); const Vendor* FindVendor(const std::vector<std::string> GPGVOutput);
~pkgVendorList(); ~pkgVendorList();
}; };
#endif #endif
 End of changes. 8 change blocks. 
7 lines changed or deleted 12 lines changed or added


 version.h   version.h 
skipping to change at line 26 skipping to change at line 26
system. system.
##################################################################### */ ##################################################################### */
/*}} }*/ /*}} }*/
#ifndef PKGLIB_VERSION_H #ifndef PKGLIB_VERSION_H
#define PKGLIB_VERSION_H #define PKGLIB_VERSION_H
#include <apt-pkg/strutl.h> #include <apt-pkg/strutl.h>
#include <string> #include <string>
#ifndef APT_8_CLEANER_HEADERS
using std::string; using std::string;
#endif
class pkgVersioningSystem class pkgVersioningSystem
{ {
public: public:
// Global list of VS's // Global list of VS's
static pkgVersioningSystem **GlobalList; static pkgVersioningSystem **GlobalList;
static unsigned long GlobalListLen; static unsigned long GlobalListLen;
static pkgVersioningSystem *GetVS(const char *Label); static pkgVersioningSystem *GetVS(const char *Label);
const char *Label; const char *Label;
// Compare versions.. // Compare versions..
virtual int DoCmpVersion(const char *A,const char *Aend, virtual int DoCmpVersion(const char *A,const char *Aend,
const char *B,const char *Bend) = 0; const char *B,const char *Bend) = 0;
virtual bool CheckDep(const char *PkgVer,int Op,const char *DepVer) = 0; virtual bool CheckDep(const char *PkgVer,int Op,const char *DepVer) = 0;
virtual int DoCmpReleaseVer(const char *A,const char *Aend, virtual int DoCmpReleaseVer(const char *A,const char *Aend,
const char *B,const char *Bend) = 0; const char *B,const char *Bend) = 0;
virtual string UpstreamVersion(const char *A) = 0; virtual std::string UpstreamVersion(const char *A) = 0;
// See if the given VS is compatible with this one.. // See if the given VS is compatible with this one..
virtual bool TestCompatibility(pkgVersioningSystem const &Against) virtual bool TestCompatibility(pkgVersioningSystem const &Against)
{return this == &Against;}; {return this == &Against;};
// Shortcuts // Shortcuts
APT_MKSTRCMP(CmpVersion,DoCmpVersion); APT_MKSTRCMP(CmpVersion,DoCmpVersion);
APT_MKSTRCMP(CmpReleaseVer,DoCmpReleaseVer); APT_MKSTRCMP(CmpReleaseVer,DoCmpReleaseVer);
pkgVersioningSystem(); pkgVersioningSystem();
virtual ~pkgVersioningSystem() {}; virtual ~pkgVersioningSystem() {};
}; };
#ifdef APT_COMPATIBILITY
#include <apt-pkg/debversion.h>
#endif
#endif #endif
 End of changes. 4 change blocks. 
5 lines changed or deleted 3 lines changed or added


 versionmatch.h   versionmatch.h 
skipping to change at line 41 skipping to change at line 41
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
#include <string> #include <string>
#include <apt-pkg/pkgcache.h> #include <apt-pkg/pkgcache.h>
#ifndef APT_8_CLEANER_HEADERS
using std::string; using std::string;
#endif
class pkgVersionMatch class pkgVersionMatch
{ {
// Version Matching // Version Matching
string VerStr; std::string VerStr;
bool VerPrefixMatch; bool VerPrefixMatch;
// Release Matching // Release Matching
string RelVerStr; std::string RelVerStr;
bool RelVerPrefixMatch; bool RelVerPrefixMatch;
string RelOrigin; std::string RelOrigin;
string RelRelease; std::string RelRelease;
string RelCodename; std::string RelCodename;
string RelArchive; std::string RelArchive;
string RelLabel; std::string RelLabel;
string RelComponent; std::string RelComponent;
string RelArchitecture; std::string RelArchitecture;
bool MatchAll; bool MatchAll;
// Origin Matching // Origin Matching
string OrSite; std::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,std::string B,bool Prefix);
bool ExpressionMatches(const char *pattern, const char *string); bool ExpressionMatches(const char *pattern, const char *string);
bool ExpressionMatches(const std::string& 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(std::string Data,MatchType Type);
}; };
#endif #endif
 End of changes. 8 change blocks. 
12 lines changed or deleted 14 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/