/*}}}*/
class pkgProblemResolver /*{{{*/
{
+ /** \brief dpointer placeholder (for later in case we need it) */
+ void *d;
+
pkgDepCache &Cache;
typedef pkgCache::PkgIterator PkgIterator;
typedef pkgCache::VerIterator VerIterator;
void MakeScores();
bool DoUpgrade(pkgCache::PkgIterator Pkg);
+
+ bool ResolveInternal(bool const BrokenFix = false);
+ bool ResolveByKeepInternal();
public:
- inline void Protect(pkgCache::PkgIterator Pkg) {Flags[Pkg->ID] |= Protected;};
+ inline void Protect(pkgCache::PkgIterator Pkg) {Flags[Pkg->ID] |= Protected; Cache.MarkProtected(Pkg);};
inline void Remove(pkgCache::PkgIterator Pkg) {Flags[Pkg->ID] |= ToRemove;};
inline void Clear(pkgCache::PkgIterator Pkg) {Flags[Pkg->ID] &= ~(Protected | ToRemove);};
class debStatusIndex : public pkgIndexFile
{
+ /** \brief dpointer placeholder (for later in case we need it) */
+ void *d;
++
+ protected:
string File;
-
+
public:
virtual const Type *GetType() const;
virtual bool HasPackages() const {return true;};
virtual unsigned long Size() 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;
debStatusIndex(string File);
+ virtual ~debStatusIndex() {};
};
class debPackagesIndex : public pkgIndexFile
{
+ /** \brief dpointer placeholder (for later in case we need it) */
+ void *d;
+
string URI;
string Dist;
string Section;
debPackagesIndex(string const &URI, string const &Dist, string const &Section,
bool const &Trusted, string const &Arch = "native");
+ virtual ~debPackagesIndex() {};
};
class debTranslationsIndex : public pkgIndexFile
{
+ /** \brief dpointer placeholder (for later in case we need it) */
+ void *d;
+
string URI;
string Dist;
string Section;
virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
debTranslationsIndex(string URI,string Dist,string Section, char const * const Language);
+ virtual ~debTranslationsIndex() {};
};
class debSourcesIndex : public pkgIndexFile
{
+ /** \brief dpointer placeholder (for later in case we need it) */
+ void *d;
+
string URI;
string Dist;
string Section;
virtual unsigned long Size() const;
debSourcesIndex(string URI,string Dist,string Section,bool Trusted);
+ virtual ~debSourcesIndex() {};
};
#endif
const char *Str;
unsigned char Val;
};
-
+
- protected:
+ private:
+ /** \brief dpointer placeholder (for later in case we need it) */
+ void *d;
-
+
++ protected:
pkgTagFile Tags;
pkgTagSection Section;
unsigned long iOffset;
bool MultiArchEnabled;
unsigned long UniqFindTagWrite(const char *Tag);
- bool ParseStatus(pkgCache::PkgIterator &Pkg,pkgCache::VerIterator &Ver);
+ virtual bool ParseStatus(pkgCache::PkgIterator &Pkg,pkgCache::VerIterator &Ver);
bool ParseDepends(pkgCache::VerIterator &Ver,const char *Tag,
unsigned int Type);
bool ParseProvides(pkgCache::VerIterator &Ver);
+ bool NewProvidesAllArch(pkgCache::VerIterator &Ver, string const &Package, string const &Version);
static bool GrabWord(string Word,WordList *List,unsigned char &Out);
public:
static const char *ParseDepends(const char *Start,const char *Stop,
string &Package,string &Ver,unsigned int &Op,
bool const &ParseArchFlags = false,
- bool const &StripMultiArch = false);
+ bool const &StripMultiArch = true);
static const char *ConvertRelation(const char *I,unsigned int &Op);
debListParser(FileFd *File, string const &Arch = "");
+ virtual ~debListParser() {};
};
#endif
};
private:
+ /** \brief dpointer placeholder (for later in case we need it) */
+ void *d;
std::map<string, vector<debSectionEntry const*> > ArchEntries;
public:
debReleaseIndex(string const &URI, string const &Dist);
- ~debReleaseIndex();
+ virtual ~debReleaseIndex();
virtual string ArchiveURI(string const &File) const {return URI + File;};
virtual bool GetIndexes(pkgAcquire *Owner, bool const &GetAll=false) const;
string IndexURISuffix(const char *Type, string const &Section, string const &Arch="native") const;
string SourceIndexURI(const char *Type, const string &Section) const;
string SourceIndexURISuffix(const char *Type, const string &Section) const;
+ string TranslationIndexURI(const char *Type, const string &Section) const;
+ string TranslationIndexURISuffix(const char *Type, const string &Section) const;
virtual vector <pkgIndexFile *> *GetIndexFiles();
virtual bool IsTrusted() const;
class debRecordParser : public pkgRecords::Parser
{
+ /** \brief dpointer placeholder (for later in case we need it) */
+ void *d;
+
FileFd File;
pkgTagFile Tags;
pkgTagSection Section;
virtual string MD5Hash();
virtual string SHA1Hash();
virtual string SHA256Hash();
+ virtual string SHA512Hash();
virtual string SourcePkg();
virtual string SourceVer();
virtual void GetRec(const char *&Start,const char *&Stop);
debRecordParser(string FileName,pkgCache &Cache);
+ virtual ~debRecordParser() {};
};
#endif
using namespace std;
+ class pkgDPkgPMPrivate
+ {
+ public:
+ pkgDPkgPMPrivate() : dpkgbuf_pos(0), term_out(NULL), history_out(NULL)
+ {
+ }
+ 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;
+ };
+
namespace
{
// Maps the dpkg "processing" info to human readable names. Entry 0
// ---------------------------------------------------------------------
/* */
pkgDPkgPM::pkgDPkgPM(pkgDepCache *Cache)
- : pkgPackageManager(Cache), dpkgbuf_pos(0),
- term_out(NULL), history_out(NULL), PackagesDone(0), PackagesTotal(0)
+ : pkgPackageManager(Cache), PackagesDone(0), PackagesTotal(0)
{
+ d = new pkgDPkgPMPrivate();
}
/*}}}*/
// DPkgPM::pkgDPkgPM - Destructor /*{{{*/
/* */
pkgDPkgPM::~pkgDPkgPM()
{
+ delete d;
}
/*}}}*/
// DPkgPM::Install - Install a package /*{{{*/
SetCloseExec(STDIN_FILENO,false);
SetCloseExec(STDERR_FILENO,false);
+ if (_config->FindDir("DPkg::Chroot-Directory","/") != "/")
+ {
+ std::cerr << "Chrooting into "
+ << _config->FindDir("DPkg::Chroot-Directory")
+ << std::endl;
+ if (chroot(_config->FindDir("DPkg::Chroot-Directory","/").c_str()) != 0)
+ _exit(100);
+ }
+
const char *Args[4];
Args[0] = "/bin/sh";
Args[1] = "-c";
return _error->Errno("fdopen","Faild to open new FD");
// Feed it the filenames.
- bool Die = false;
if (Version <= 1)
{
for (vector<Item>::iterator I = List.begin(); I != List.end(); I++)
into the pipe. */
fprintf(F,"%s\n",I->File.c_str());
if (ferror(F) != 0)
- {
- Die = true;
break;
- }
}
}
else
- Die = !SendV2Pkgs(F);
+ SendV2Pkgs(F);
fclose(F);
if (len)
write(master, input_buf, len);
else
- stdin_is_dev_null = true;
+ d->stdin_is_dev_null = true;
}
/*}}}*/
// DPkgPM::DoTerminalPty - Read the terminal pty and write log /*{{{*/
{
// this happens when the child is about to exit, we
// give it time to actually exit, otherwise we run
- // into a race
- usleep(500000);
+ // into a race so we sleep for half a second.
+ struct timespec sleepfor = { 0, 500000000 };
+ nanosleep(&sleepfor, NULL);
return;
}
if(len <= 0)
return;
write(1, term_buf, len);
- if(term_out)
- fwrite(term_buf, len, sizeof(char), term_out);
+ if(d->term_out)
+ fwrite(term_buf, len, sizeof(char), d->term_out);
}
/*}}}*/
// DPkgPM::ProcessDpkgStatusBuf /*{{{*/
char *p, *q;
int len;
- len=read(statusfd, &dpkgbuf[dpkgbuf_pos], sizeof(dpkgbuf)-dpkgbuf_pos);
- dpkgbuf_pos += len;
+ len=read(statusfd, &d->dpkgbuf[d->dpkgbuf_pos], sizeof(d->dpkgbuf)-d->dpkgbuf_pos);
+ d->dpkgbuf_pos += len;
if(len <= 0)
return;
// process line by line if we have a buffer
- p = q = dpkgbuf;
- while((q=(char*)memchr(p, '\n', dpkgbuf+dpkgbuf_pos-p)) != NULL)
+ p = q = d->dpkgbuf;
+ while((q=(char*)memchr(p, '\n', d->dpkgbuf+d->dpkgbuf_pos-p)) != NULL)
{
*q = 0;
ProcessDpkgStatusLine(OutStatusFd, p);
}
// now move the unprocessed bits (after the final \n that is now a 0x0)
- // to the start and update dpkgbuf_pos
- p = (char*)memrchr(dpkgbuf, 0, dpkgbuf_pos);
+ // to the start and update d->dpkgbuf_pos
+ p = (char*)memrchr(d->dpkgbuf, 0, d->dpkgbuf_pos);
if(p == NULL)
return;
p++;
// move the unprocessed tail to the start and update pos
- memmove(dpkgbuf, p, p-dpkgbuf);
- dpkgbuf_pos = dpkgbuf+dpkgbuf_pos-p;
+ memmove(d->dpkgbuf, p, p-d->dpkgbuf);
+ d->dpkgbuf_pos = d->dpkgbuf+d->dpkgbuf_pos-p;
}
/*}}}*/
// DPkgPM::WriteHistoryTag /*{{{*/
// poor mans rstrip(", ")
if (value[length-2] == ',' && value[length-1] == ' ')
value.erase(length - 2, 2);
- fprintf(history_out, "%s: %s\n", tag.c_str(), value.c_str());
+ fprintf(d->history_out, "%s: %s\n", tag.c_str(), value.c_str());
} /*}}}*/
// DPkgPM::OpenLog /*{{{*/
bool pkgDPkgPM::OpenLog()
_config->Find("Dir::Log::Terminal"));
if (!logfile_name.empty())
{
- term_out = fopen(logfile_name.c_str(),"a");
- if (term_out == NULL)
+ d->term_out = fopen(logfile_name.c_str(),"a");
+ if (d->term_out == NULL)
return _error->WarningE("OpenLog", _("Could not open file '%s'"), logfile_name.c_str());
- setvbuf(term_out, NULL, _IONBF, 0);
- SetCloseExec(fileno(term_out), true);
+ setvbuf(d->term_out, NULL, _IONBF, 0);
+ SetCloseExec(fileno(d->term_out), true);
chmod(logfile_name.c_str(), 0600);
- fprintf(term_out, "\nLog started: %s\n", timestr);
+ fprintf(d->term_out, "\nLog started: %s\n", timestr);
}
// write your history
_config->Find("Dir::Log::History"));
if (!history_name.empty())
{
- history_out = fopen(history_name.c_str(),"a");
- if (history_out == NULL)
+ d->history_out = fopen(history_name.c_str(),"a");
+ if (d->history_out == NULL)
return _error->WarningE("OpenLog", _("Could not open file '%s'"), history_name.c_str());
chmod(history_name.c_str(), 0644);
- fprintf(history_out, "\nStart-Date: %s\n", timestr);
+ fprintf(d->history_out, "\nStart-Date: %s\n", timestr);
string remove, purge, install, upgrade, downgrade;
for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
{
WriteHistoryTag("Downgrade",downgrade);
WriteHistoryTag("Remove",remove);
WriteHistoryTag("Purge",purge);
- fflush(history_out);
+ fflush(d->history_out);
}
return true;
struct tm *tmp = localtime(&t);
strftime(timestr, sizeof(timestr), "%F %T", tmp);
- if(term_out)
+ if(d->term_out)
{
- fprintf(term_out, "Log ended: ");
- fprintf(term_out, "%s", timestr);
- fprintf(term_out, "\n");
- fclose(term_out);
+ fprintf(d->term_out, "Log ended: ");
+ fprintf(d->term_out, "%s", timestr);
+ fprintf(d->term_out, "\n");
+ fclose(d->term_out);
}
- term_out = NULL;
+ d->term_out = NULL;
- if(history_out)
+ if(d->history_out)
{
if (disappearedPkgs.empty() == false)
{
}
WriteHistoryTag("Disappeared", disappear);
}
- if (dpkg_error.empty() == false)
- fprintf(history_out, "Error: %s\n", dpkg_error.c_str());
- fprintf(history_out, "End-Date: %s\n", timestr);
- fclose(history_out);
+ if (d->dpkg_error.empty() == false)
+ fprintf(d->history_out, "Error: %s\n", d->dpkg_error.c_str());
+ fprintf(d->history_out, "End-Date: %s\n", timestr);
+ fclose(d->history_out);
}
- history_out = NULL;
+ d->history_out = NULL;
return true;
}
}
}
- stdin_is_dev_null = false;
+ d->stdin_is_dev_null = false;
// create log
OpenLog();
// Generate the argument list
const char *Args[MaxArgs + 50];
-
+ // keep track of allocated strings for multiarch package names
+ char *Packages[MaxArgs + 50];
+ unsigned int pkgcount = 0;
+
// Now check if we are within the MaxArgs limit
//
// this code below is problematic, because it may happen that
}
else
{
+ string const nativeArch = _config->Find("APT::Architecture");
+ unsigned long const oldSize = I->Op == Item::Configure ? Size : 0;
for (;I != J && Size < MaxArgBytes; I++)
{
if((*I).Pkg.end() == true)
continue;
if (I->Op == Item::Configure && disappearedPkgs.find(I->Pkg.Name()) != disappearedPkgs.end())
continue;
- Args[n++] = I->Pkg.Name();
+ if (I->Pkg.Arch() == nativeArch || !strcmp(I->Pkg.Arch(), "all"))
+ Args[n++] = I->Pkg.Name();
+ else
+ {
+ Packages[pkgcount] = strdup(I->Pkg.FullName(false).c_str());
+ Args[n++] = Packages[pkgcount++];
+ }
Size += strlen(Args[n-1]);
- }
- }
+ }
+ // skip configure action if all sheduled packages disappeared
+ if (oldSize == Size)
+ continue;
+ }
Args[n] = 0;
J = I;
const char *s = _("Can not write log, openpty() "
"failed (/dev/pts not mounted?)\n");
fprintf(stderr, "%s",s);
- if(term_out)
- fprintf(term_out, "%s",s);
+ if(d->term_out)
+ fprintf(d->term_out, "%s",s);
master = slave = -1;
} else {
struct termios rtt;
sigemptyset(&sigmask);
sigprocmask(SIG_BLOCK,&sigmask,&original_sigmask);
+ /* clean up the temporary allocation for multiarch package names in
+ the parent, so we don't leak memory when we return. */
+ for (unsigned int i = 0; i < pkgcount; i++)
+ free(Packages[i]);
+
// the result of the waitpid call
int res;
int select_ret;
// wait for input or output here
FD_ZERO(&rfds);
- if (master >= 0 && !stdin_is_dev_null)
+ if (master >= 0 && !d->stdin_is_dev_null)
FD_SET(0, &rfds);
FD_SET(_dpkgin, &rfds);
if(master >= 0)
RunScripts("DPkg::Post-Invoke");
if (WIFSIGNALED(Status) != 0 && WTERMSIG(Status) == SIGSEGV)
- strprintf(dpkg_error, "Sub-process %s received a segmentation fault.",Args[0]);
+ strprintf(d->dpkg_error, "Sub-process %s received a segmentation fault.",Args[0]);
else if (WIFEXITED(Status) != 0)
- strprintf(dpkg_error, "Sub-process %s returned an error code (%u)",Args[0],WEXITSTATUS(Status));
+ strprintf(d->dpkg_error, "Sub-process %s returned an error code (%u)",Args[0],WEXITSTATUS(Status));
else
- strprintf(dpkg_error, "Sub-process %s exited unexpectedly",Args[0]);
+ strprintf(d->dpkg_error, "Sub-process %s exited unexpectedly",Args[0]);
- if(dpkg_error.size() > 0)
- _error->Error("%s", dpkg_error.c_str());
+ if(d->dpkg_error.size() > 0)
- _error->Error(d->dpkg_error.c_str());
++ _error->Error("%s", d->dpkg_error.c_str());
if(stopOnError)
{
fprintf(report, "ErrorMessage:\n %s\n", errormsg);
// ensure that the log is flushed
- if(term_out)
- fflush(term_out);
+ if(d->term_out)
+ fflush(d->term_out);
// attach terminal log it if we have it
string logfile_name = _config->FindFile("Dir::Log::Terminal");
{
while( fgets(buf, sizeof(buf), log) != NULL)
fprintf(report, " %s", buf);
- fclose(log);
+ pclose(log);
}
}
{
while( fgets(buf, sizeof(buf), log) != NULL)
fprintf(report, " %s", buf);
- fclose(log);
+ pclose(log);
}
}
class Parser;
private:
+ /** \brief dpointer placeholder (for later in case we need it) */
+ void *d;
pkgCache &Cache;
std::vector<Parser *>Files;
- public:
-
+ public:
// Lookup function
Parser &Lookup(pkgCache::VerFileIterator const &Ver);
Parser &Lookup(pkgCache::DescFileIterator const &Desc);
virtual string MD5Hash() {return string();};
virtual string SHA1Hash() {return string();};
virtual string SHA256Hash() {return string();};
+ virtual string SHA512Hash() {return string();};
virtual string SourcePkg() {return string();};
virtual string SourceVer() {return string();};
using std::string;
+ class pkgTagFilePrivate
+ {
+ public:
+ pkgTagFilePrivate(FileFd *pFd, unsigned long Size) : Fd(*pFd), Size(Size)
+ {
+ }
+ FileFd &Fd;
+ char *Buffer;
+ char *Start;
+ char *End;
+ bool Done;
+ unsigned long iOffset;
+ unsigned long Size;
+ };
+
// TagFile::pkgTagFile - Constructor /*{{{*/
// ---------------------------------------------------------------------
/* */
- pkgTagFile::pkgTagFile(FileFd *pFd,unsigned long Size) :
- Fd(*pFd),
- Size(Size)
+ pkgTagFile::pkgTagFile(FileFd *pFd,unsigned long Size)
{
- if (Fd.IsOpen() == false)
+ d = new pkgTagFilePrivate(pFd, Size);
+
+ if (d->Fd.IsOpen() == false)
{
- Buffer = 0;
- Start = End = Buffer = 0;
- Done = true;
- iOffset = 0;
+ d->Start = d->End = d->Buffer = 0;
+ d->Done = true;
+ d->iOffset = 0;
return;
}
- Buffer = new char[Size];
- Start = End = Buffer;
- Done = false;
- iOffset = 0;
+ d->Buffer = new char[Size];
+ d->Start = d->End = d->Buffer;
+ d->Done = false;
+ d->iOffset = 0;
Fill();
}
/*}}}*/
/* */
pkgTagFile::~pkgTagFile()
{
- delete [] Buffer;
+ delete [] d->Buffer;
+ delete d;
+ }
+ /*}}}*/
+ // TagFile::Offset - Return the current offset in the buffer /*{{{*/
+ unsigned long pkgTagFile::Offset()
+ {
+ return d->iOffset;
}
/*}}}*/
// TagFile::Resize - Resize the internal buffer /*{{{*/
bool pkgTagFile::Resize()
{
char *tmp;
- unsigned long EndSize = End - Start;
+ unsigned long EndSize = d->End - d->Start;
// fail is the buffer grows too big
- if(Size > 1024*1024+1)
+ if(d->Size > 1024*1024+1)
return false;
// get new buffer and use it
- tmp = new char[2*Size];
- memcpy(tmp, Buffer, Size);
- Size = Size*2;
- delete [] Buffer;
- Buffer = tmp;
+ tmp = new char[2*d->Size];
+ memcpy(tmp, d->Buffer, d->Size);
+ d->Size = d->Size*2;
+ delete [] d->Buffer;
+ d->Buffer = tmp;
// update the start/end pointers to the new buffer
- Start = Buffer;
- End = Start + EndSize;
+ d->Start = d->Buffer;
+ d->End = d->Start + EndSize;
return true;
}
/*}}}*/
*/
bool pkgTagFile::Step(pkgTagSection &Tag)
{
- while (Tag.Scan(Start,End - Start) == false)
+ while (Tag.Scan(d->Start,d->End - d->Start) == false)
{
if (Fill() == false)
return false;
- if(Tag.Scan(Start,End - Start))
+ if(Tag.Scan(d->Start,d->End - d->Start))
break;
if (Resize() == false)
return _error->Error(_("Unable to parse package file %s (1)"),
- Fd.Name().c_str());
+ d->Fd.Name().c_str());
}
- Start += Tag.size();
- iOffset += Tag.size();
+ d->Start += Tag.size();
+ d->iOffset += Tag.size();
Tag.Trim();
return true;
then fills the rest from the file */
bool pkgTagFile::Fill()
{
- unsigned long EndSize = End - Start;
+ unsigned long EndSize = d->End - d->Start;
unsigned long Actual = 0;
- memmove(Buffer,Start,EndSize);
- Start = Buffer;
- End = Buffer + EndSize;
+ memmove(d->Buffer,d->Start,EndSize);
+ d->Start = d->Buffer;
+ d->End = d->Buffer + EndSize;
- if (Done == false)
+ if (d->Done == false)
{
// See if only a bit of the file is left
- if (Fd.Read(End,Size - (End - Buffer),&Actual) == false)
+ if (d->Fd.Read(d->End, d->Size - (d->End - d->Buffer),&Actual) == false)
return false;
- if (Actual != Size - (End - Buffer))
- Done = true;
- End += Actual;
+ if (Actual != d->Size - (d->End - d->Buffer))
+ d->Done = true;
+ d->End += Actual;
}
- if (Done == true)
+ if (d->Done == true)
{
if (EndSize <= 3 && Actual == 0)
return false;
- if (Size - (End - Buffer) < 4)
+ if (d->Size - (d->End - d->Buffer) < 4)
return true;
// Append a double new line if one does not exist
unsigned int LineCount = 0;
- for (const char *E = End - 1; E - End < 6 && (*E == '\n' || *E == '\r'); E--)
+ for (const char *E = d->End - 1; E - d->End < 6 && (*E == '\n' || *E == '\r'); E--)
if (*E == '\n')
LineCount++;
for (; LineCount < 2; LineCount++)
- *End++ = '\n';
+ *d->End++ = '\n';
return true;
}
bool pkgTagFile::Jump(pkgTagSection &Tag,unsigned long Offset)
{
// We are within a buffer space of the next hit..
- if (Offset >= iOffset && iOffset + (End - Start) > Offset)
+ if (Offset >= d->iOffset && d->iOffset + (d->End - d->Start) > Offset)
{
- unsigned long Dist = Offset - iOffset;
- Start += Dist;
- iOffset += Dist;
+ unsigned long Dist = Offset - d->iOffset;
+ d->Start += Dist;
+ d->iOffset += Dist;
return Step(Tag);
}
// Reposition and reload..
- iOffset = Offset;
- Done = false;
- if (Fd.Seek(Offset) == false)
+ d->iOffset = Offset;
+ d->Done = false;
+ if (d->Fd.Seek(Offset) == false)
return false;
- End = Start = Buffer;
+ d->End = d->Start = d->Buffer;
if (Fill() == false)
return false;
- if (Tag.Scan(Start,End - Start) == true)
+ if (Tag.Scan(d->Start, d->End - d->Start) == true)
return true;
// This appends a double new line (for the real eof handling)
if (Fill() == false)
return false;
- if (Tag.Scan(Start,End - Start) == false)
- return _error->Error(_("Unable to parse package file %s (2)"),Fd.Name().c_str());
+ if (Tag.Scan(d->Start, d->End - d->Start) == false)
+ return _error->Error(_("Unable to parse package file %s (2)"),d->Fd.Name().c_str());
return true;
}
const char *Stop;
if (Find(Tag,Start,Stop) == false)
return true;
-
- switch (StringToBool(string(Start,Stop)))
- {
+ return FindFlag(Flags, Flag, Start, Stop);
+}
+bool const pkgTagSection::FindFlag(unsigned long &Flags, unsigned long Flag,
+ char const* Start, char const* Stop)
+{
+ switch (StringToBool(string(Start, Stop)))
+ {
case 0:
Flags &= ~Flag;
return true;
"MD5Sum",
"SHA1",
"SHA256",
+ "SHA512",
"MSDOS-Filename", // Obsolete
"Description",
0};
#include <apt-pkg/fileutl.h>
#include <stdio.h>
-
+
class pkgTagSection
{
const char *Section;
-
// We have a limit of 256 tags per section.
unsigned int Indexes[256];
unsigned int AlphaIndexes[0x100];
-
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
very good performance on the debian package files */
return Res & 0xFF;
}
-
protected:
const char *Stop;
unsigned long long FindULL(const char *Tag, unsigned long long const &Default = 0) const;
bool FindFlag(const char *Tag,unsigned long &Flags,
unsigned long Flag) const;
+ bool static const FindFlag(unsigned long &Flags, unsigned long Flag,
+ const char* Start, const char* Stop);
bool Scan(const char *Start,unsigned long MaxLength);
inline unsigned long size() const {return Stop - Section;};
void Trim();
};
pkgTagSection() : Section(0), Stop(0) {};
+ virtual ~pkgTagSection() {};
};
+ class pkgTagFilePrivate;
class pkgTagFile
{
- FileFd &Fd;
- char *Buffer;
- char *Start;
- char *End;
- bool Done;
- unsigned long iOffset;
- unsigned long Size;
+ pkgTagFilePrivate *d;
bool Fill();
bool Resize();
public:
bool Step(pkgTagSection &Section);
- inline unsigned long Offset() {return iOffset;};
+ unsigned long Offset();
bool Jump(pkgTagSection &Tag,unsigned long Offset);
pkgTagFile(FileFd *F,unsigned long Size = 32*1024);
- ~pkgTagFile();
+ virtual ~pkgTagFile();
};
/* This is the list of things to rewrite. The rewriter
- * Implement EDSP in libapt-pkg so that all front-ends which
+apt (0.8.15) UNRELEASED; urgency=low
+
+ [ David Kalnischkies ]
- * merge lp:~mvo/apt/sha512-template to add support for sha512
++ * [ABI-Break] Implement EDSP in libapt-pkg so that all front-ends which
+ use the internal resolver can now be used also with external
+ ones as the usage is hidden in between the old API
+ * provide two edsp solvers in apt-utils:
+ - 'dump' to quickly output a complete scenario and
+ - 'apt' to use the internal as an external resolver
+ * apt-pkg/pkgcache.h:
+ - clean up mess with the "all" handling in MultiArch to
+ fix LP: #733741 cleanly for everyone now
+ * apt-pkg/depcache.cc:
+ - use a boolean instead of an int for Add/Remove in AddStates
+ similar to how it works with AddSizes
+ - let the Mark methods return if their marking was successful
+ - if a Breaks can't be upgraded, remove it. If it or a Conflict
+ can't be removed the installation of the breaker fails.
+ * cmdline/apt-get.cc:
+ - do not discard the error messages from the resolver and instead
+ only show the general 'Broken packages' message if nothing else
+
+ [ Stefano Zacchiroli ]
+ * doc/external-dependency-solver-protocol.txt:
+ - describe EDSP and the configuration interface around it
+
+ [ Michael Vogt ]
++ * [ABI-Break] merge lp:~mvo/apt/sha512-template to add support for sha512
++ * [ABI-Break] merge lp:~mvo/apt/dpointer to support easier extending
++ without breaking the ABI
+
+ -- David Kalnischkies <kalnischkies@gmail.com> Tue, 17 May 2011 18:43:21 +0200
+
+apt (0.8.14.2) UNRELEASED; urgency=low
+
+ [ Julian Andres Klode ]
+ * apt-pkg/depcache.cc:
+ - Really release action groups only once (Closes: #622744)
+ - Make purge work again for config-files (LP: #244598) (Closes: #150831)
+ * debian/apt.cron.daily:
+ - Check power after wait, patch by manuel-soto (LP: #705269)
+ * debian/control:
+ - Move ${shlibs:Depends} to Pre-Depends, as we do not want APT
+ unpacked if a library is too old and thus break upgrades
+ * doc/apt-key.8.xml:
+ - Document apt-key net-update (LP: #192810)
+
+ [ Christian Perrier ]
+ * Galician translation update (Miguel Anxo Bouzada). Closes: #626505
+
+ [ David Kalnischkies ]
+ * fix a bunch of cppcheck warnings/errors based on a patch by
+ Niels Thykier, thanks! (Closes: #622805)
+ * apt-pkg/depcache.cc:
+ - really include 'rc' packages in the delete count by fixing a
+ typo which exists since 1999 in the source… (LP: #761175)
+ - if critical or-group can't be satisfied, exit directly.
+ * apt-pkg/acquire-method.cc:
+ - write directly to stdout instead of creating the message in
+ memory first before writing to avoid hitting limits
+ - fix order of CurrentURI and UsedMirror in Status() and Log()
+ * apt-pkg/orderlist.cc:
+ - let VisitRProvides report if the calls were successful
+ * apt-pkg/deb/dpkgpm.cc:
+ - replace obsolete usleep with nanosleep
+ * debian/apt{,-utils}.symbols:
+ - update both experimental symbol-files to reflect 0.8.14 state
+ * debian/rules:
+ - remove unused embedded jquery by doxygen from libapt-pkg-doc
+ * cmdline/apt-mark.cc:
+ - reimplement apt-mark in c++
+ - provide a 'showmanual' command (Closes: #582791)
+ - provide a 'dpkg --set-selections' wrapper to set/release holds
+ * cmdline/apt-get.cc:
+ - deprecate mostly undocumented 'markauto' in favor of 'apt-mark'
+ * cmdline/apt-cache.cc:
+ - deprecate mostly undocumented 'showauto' in favor of 'apt-mark'
+ * apt-pkg/pkgcache.cc:
+ - really ignore :arch in FindPkg() in non-multiarch environment
+ * doc/po/de.po:
+ - undo the translation of the command 'dump' in manpage of apt-config
+ as report by Burghard Grossmann on debian-l10n-german, thanks!
+ * apt-pkg/deb/debmetaindex.cc:
+ - do not download TranslationIndex if no Translation-* will be
+ downloaded later on anyway (Closes: #624218)
+ * test/versions.lst:
+ - disable obscure version number tests with versions dpkg doesn't
+ allow any more as they don't start with a number
+ * apt-pkg/acquire-worker.cc:
+ - print filename in the unmatching size warning (Closes: #623137)
+ * apt-pkg/acquire-item.cc:
+ - apply fix for poorly worded 'locate file' error message from
+ Ben Finney, thanks! (Closes: #623171)
+ * methods/http.cc:
+ - add config option to ignore a closed stdin to be able to easily
+ use the method as a simple standalone downloader
+ - Location header in redirects should be absolute URI, but some
+ servers just send an absolute path so still deal with it properly
+ - dequote URL taken from Location in redirects as we will otherwise
+ quote an already quoted string in the request later (Closes: #602412)
+ * apt-pkg/contrib/netrc.cc:
+ - replace non-posix gnu-extension strdupa with strdup
+ * apt-pkg/packagemanager.cc:
+ - ensure for Multi-Arch:same packages that they are unpacked in
+ lock step even in immediate configuration (Closes: #618288)
+
+ -- Michael Vogt <mvo@debian.org> Mon, 16 May 2011 14:57:52 +0200
+
+apt (0.8.14.1) unstable; urgency=low
+
+ * apt-pkg/acquire-item.cc:
+ - Only try to rename existing Release files (Closes: #622912)
+
+ -- Julian Andres Klode <jak@debian.org> Sat, 16 Apr 2011 14:36:10 +0200
+
+apt (0.8.14) unstable; urgency=low
+
+ [ Julian Andres Klode ]
+ * apt-pkg/indexcopy.cc:
+ - Use RealFileExists() instead of FileExists(), allows amongst other
+ things a directory named Sources to exist on a CD-ROM (LP: #750694).
+ * apt-pkg/acquire-item.cc:
+ - Use Release files even if they cannot be verified (LP: #704595)
+ * cmdline/apt-get.cc:
+ - Do not install recommends for build-dep (Closes: #454479) (LP: #245273)
+ * apt-pkg/deb/deblistparser.cc:
+ - Handle no space before "[" in build-dependencies (LP: #72344)
+ * apt-pkg/policy.cc:
+ - Allow pinning by glob() expressions, and regular expressions
+ surrounded by slashes (the "/" character) (LP: #399474)
+ (Closes: #121132)
+ * debian/control:
+ - Set Standards-Version to 3.9.2
+
+ [ Michael Vogt ]
+ * mirror method:
+ - do not crash if the mirror file fails to download
+ * apt-pkg/aptconfiguration.cc:
+ - fix comparing for a empty string
+ * debian/apt.cron.daily:
+ - run unattended-upgrades even if there was a error during
+ the apt-get update (LP: #676295)
+
+ [ David Kalnischkies ]
+ * apt-pkg/pkgcache.cc:
+ - use the native Architecture stored in the cache header instead of
+ loading it from configuration as suggested by Julian Andres Klode
+
+ -- Julian Andres Klode <jak@debian.org> Fri, 15 Apr 2011 14:28:15 +0200
+
+apt (0.8.13.2) unstable; urgency=low
+
+ [ David Kalnischkies ]
+ * apt-pkg/deb/dpkgpm.cc:
+ - skip --configure if all packages disappeared
+ * apt-pkg/vendor.cc, apt-pkg/vendorlist.cc:
+ - mark them as deprecated as they are unused
+ * apt-pkg/deb/deblistparser.h:
+ - enable StripMultiArch by default for ParseDepends
+ * debian/apt.conf.autoremove:
+ - adapt to new gnumach kernel package naming (Closes: #619337)
+ * doc/apt_preferences.5.xml:
+ - correct typo spotted by Charles Plessy (Closes: #619088)
+ - document ButAutomaticUpgrades together with NotAutomatic
+ as suggested by Charles Plessy (Closes: #619083)
+ * apt-pkg/depcache.cc:
+ - remove pseudo handling leftover from SetReInstall
+ - do not change protected packages in autoinstall (Closes: #618848)
+ * apt-pkg/pkgcachegen.cc:
+ - make "all"->"native" an implementation detail of NewPackage
+ rather than rewrite it in higher methods
+ * apt-pkg/cacheiterator.h:
+ - return "all" instead of native architecture without breaking the abi
+ (too much) by extending enum instead of using bitflags (LP: #733741)
+ * apt-pkg/aptconfiguration.cc:
+ - use dpkg --print-foreign-architectures to get multiarch configuration
+ if non is specified with APT::Architectures (Closes: #612958)
+ * cmdline/apt-get.cc:
+ - do not show simulation notice for non-root commands (Closes: #619072)
+ - be able to disable resolver with APT::Get::CallResolver and disable
+ auto installation with APT::Get::AutoSolving
+ * apt-pkg/deb/deblistparser.cc:
+ - create foo:any provides for all architectures for an allowed package
+
+ -- Michael Vogt <mvo@debian.org> Tue, 05 Apr 2011 09:40:28 +0200
+
+apt (0.8.13.1) unstable; urgency=low
+
+ * apt-pkg/acquire-item.cc: Use stat buffer if stat was
+ successful, not if it failed (Closes: #620546)
+
+ -- Julian Andres Klode <jak@debian.org> Sat, 02 Apr 2011 20:55:35 +0200
+
+apt (0.8.13) unstable; urgency=low
+
+ [ Thorsten Spindler ]
+ * methods/rsh.cc
+ - fix rsh/ssh option parsing (LP: #678080), thanks to
+ Ville Mattila
+
+ [ Michael Vogt ]
+ * apt-pkg/acquire-item.cc:
+ - mark pkgAcqIndexTrans as Index-File to avoid asking the
+ user to insert the CD on each apt-get update
+ * po/sl.po:
+ - updated, thanks to Andrej Znidarsic
+ * mirror method:
+ - when downloading data, show the mirror being used
+ - randomize mirror list after download in a host specific way
+ to ensure that the load is evenly spreaded accross the mirrors
+ - fix some missing "Fail-Ignore"
+
+ -- Michael Vogt <mvo@debian.org> Wed, 16 Mar 2011 08:04:42 +0100
+
+apt (0.8.12) unstable; urgency=low
+
+ [ Michael Vogt ]
+ * apt-pkg/deb/debindexfile.cc:
+ - ignore missing deb-src files in /var/lib/apt/lists, thanks
+ to Thorsten Spindler (LP: #85590)
+ * apt-pkg/contrib/fileutl.cc, apt-pkg/deb/dpkgpm.cc:
+ - honor Dpkg::Chroot-Directory in the RunScripts*() methods
+ * apt-pkg/contrib/cdromutl.{cc,h}, apt-pkg/cdrom.{cc,h}:
+ - deal with missing FSTAB_DIR when using libudev to discover cdrom
+ - add experimental APT::cdrom::CdromOnly option (on by default).
+ When this is set to false apt-cdrom will handle any removable
+ deivce (like a usb-stick) as a "cdrom/dvd" source
+
+ [ Christian Perrier ]
+ * Fix error in French translation of manpages (apt_preferences(5)).
+ Merci, Rémi Vanicat. Closes: #613689
+ * Complete French manpage translation
+ * Italian translation update (Milo Casagrande). Closes: #614395
+
+ [ David Kalnischkies ]
+ * ftparchive/multicompress.cc, apt-inst/deb/debfile.cc:
+ - support xz compressor to create xz-compressed Indexes and be able
+ to open data.tar.xz files
+ - load the supported compressors from configuration
+ * ftparchive/writer.cc:
+ - ensure that Date and Valid-Until time strings are not localised
+ - add options to disable specific checksums for Indexes
+ - include xz-compressed Packages and Sources files in Release file
+ * apt-pkg/aptconfiguration.cc:
+ - support download of xz-compressed indexes files
+ - support adding new compressors by configuration
+ * apt-pkg/deb/debsrcrecords.cc:
+ - support xz-compressed source v3 debian.tar files
+ - support every compression we have a compressor configured
+ * ftparchive/contents.cc:
+ - remove ExtractArchive codecopy from apt-inst/deb/debfile.cc
+ * apt-inst/deb/debfile.cc:
+ - support data.tar's compressed with any configured compressor
+ * cmdline/apt-get.cc:
+ - reinstall dependencies of reinstalled "garbage" (Closes: #617257)
+
+ [ Steve Langasek ]
+ * apt-pkg/deb/dpkgpm.cc:
+ - make sure that for multiarch packages, we are passing the full
+ qualified package name to dpkg for removals. (Closes: #614298)
+ * Remove the "pseudopackage" handling of Architecture: all packages for
+ Multi-Arch; instead, Arch: all packages only satisfy dependencies for
+ the native arch, except where the Arch: all package is declared
+ Multi-Arch: foreign. (Closes: #613584)
+
+ -- Michael Vogt <mvo@debian.org> Thu, 10 Mar 2011 14:46:48 +0100
+
+apt (0.8.11.5) unstable; urgency=low
+
+ [ Christian Perrier ]
+ * Add missing dot in French translation of manpages. Merci, Olivier
+ Humbert.
+ * French translation update
+ * French manpages translation update
+
+ [ David Kalnischkies ]
+ * apt-pkg/depcache.cc:
+ - party revert fix in 0.8.11.2 which marked all packages as manual
+ installed if the FromUser bit is set in the MarkInstall call.
+ The default for this bit is true and aptitude depends on the old
+ behavior so the package is only marked as manual if its not marked
+ ("old" behavior) or if automatic installation is enabled - which
+ aptitude disables always (see also #613775)
+
+ -- David Kalnischkies <kalnischkies@gmail.com> Thu, 17 Feb 2011 15:16:31 +0100
+
+apt (0.8.11.4) unstable; urgency=low
+
+ [ David Kalnischkies ]
+ * apt-pkg/contrib/error.cc:
+ - ensure that va_list is not invalid in second try
+ * cmdline/apt-get.cc:
+ - don't remove new dependencies of garbage packages (Closes: #613420)
+
+ [ Michael Vogt ]
+ * test/integration/*
+ - fix dashish in the integration tests
+
+ -- Michael Vogt <mvo@debian.org> Wed, 16 Feb 2011 14:36:03 +0100
+
+apt (0.8.11.3) unstable; urgency=low
+
+ * apt-pkg/contrib/fileutl.cc:
+ - really detect bigendian machines by including config.h,
+ so we can really (Closes: #612986)
+ * apt-pkg/contrib/mmap.cc:
+ - Base has as 'valid' failure states 0 and -1 so add a simple
+ validData method to check for failure states
+
+ -- David Kalnischkies <kalnischkies@gmail.com> Mon, 14 Feb 2011 16:58:03 +0100
+
+apt (0.8.11.2) unstable; urgency=low
+
+ [ Michael Vogt ]
+ * merged lp:~evfool/apt/fix641673:
+ - String-fix in the source and the translations for the grammatical
+ mistake reported in bug LP: #641673, thanks to Robert Roth
+ * merged lp:~evfool/apt/fix418552:
+ - Grammar fix for bug LP: #418552, thanks to Robert Roth
+
+ [ David Kalnischkies ]
+ * cmdline/apt-get.cc:
+ - add --install-suggests option (Closes: #473089)
+ * apt-pkg/depcache.cc:
+ - mark a package which was requested to be installed on commandline
+ always as manual regardless if it is already marked or not as the
+ marker could be lost later by the removal of rdepends (Closes: #612557)
+ * methods/rred.cc:
+ - read patch into MMap only if we work on uncompressed patches
+ - update size of dynamic MMap as we write in from the outside
+ * apt-pkg/contrib/mmap.cc:
+ - do not try to free the mapping if its is unset
+ * apt-pkg/contrib/fileutl.cc:
+ - reorder the loaded filesize bytes for big endian (Closes: #612986)
+ Thanks to Jörg Sommer for the detailed analyse!
+
+ -- Michael Vogt <mvo@debian.org> Mon, 14 Feb 2011 12:07:18 +0100
+
+apt (0.8.11.1) unstable; urgency=low
+
+ [ Stefan Lippers-Hollmann ]
+ * cmdline/apt-key:
+ - fix root test which prevented setting of trustdb-name
+ which lets gpg fail if it adds/remove keys from trusted.gpg
+ as it tries to open the (maybe) not existent /root/.gnupg
+
+ [ David Kalnischkies ]
+ * debian/apt.symbols:
+ - add more arch dependent symbols
+
+ -- Michael Vogt <mvo@debian.org> Wed, 09 Feb 2011 17:49:59 +0100
+
+apt (0.8.11) unstable; urgency=low
+
+ [ David Kalnischkies ]
+ * apt-pkg/depcache.cc:
+ - add SetCandidateRelease() to set a candidate version and
+ the candidates of dependencies if needed to a specified
+ release (Closes: #572709)
+ - allow conflicts in the same group again (Closes: #612099)
+ * cmdline/apt-get.cc:
+ - if --print-uris is used don't setup downloader as we don't need
+ progress, lock nor the directories it would create otherwise
+ - show dependencies of essential packages which are going to remove
+ only if they cause the remove of this essential (Closes: #601961)
+ - keep not installed garbage packages uninstalled instead of showing
+ in the autoremove section and installing those (Closes: #604222)
+ - change pkg/release behavior to use the new SetCandidateRelease
+ so installing packages from experimental or backports is easier
+ - really do not show packages in the extra section if they were
+ requested on the commandline, e.g. with a modifier (Closes: #184730)
+ - always do removes first and set not installed remove packages
+ on hold to prevent temporary installation later (Closes: #549968)
+ * debian/control:
+ - add Vcs-Browser now that loggerhead works again (Closes: #511168)
+ - depend on debhelper 7 to raise compat level
+ - depend on dpkg-dev (>= 1.15.8) to have c++ symbol mangling
+ * apt-pkg/contrib/fileutl.cc:
+ - add a RealFileExists method and check that your configuration files
+ are real files to avoid endless loops if not (Closes: #604401)
+ - ignore non-regular files in GetListOfFilesInDir (Closes: #594694)
+ * apt-pkg/contrib/weakptr.h:
+ - include stddefs.h to fix compile error (undefined NULL) with gcc-4.6
+ * methods/https.cc:
+ - fix CURLOPT_SSL_VERIFYHOST by really passing 2 to it if enabled
+ * deb/dpkgpm.cc:
+ - fix popen/fclose mismatch reported by cppcheck. Thanks to Petter
+ Reinholdtsen for report and patch! (Closes: #607803)
+ * doc/apt.conf.5.xml:
+ - fix multipl{y,e} spelling error reported by Jakub Wilk (Closes: #607636)
+ * apt-inst/contrib/extracttar.cc:
+ - let apt-utils work with encoded tar headers if uid/gid are large.
+ Thanks to Nobuhiro Hayashi for the patch! (Closes: #330162)
+ * apt-pkg/cacheiterator.h:
+ - do not segfault if cache is not build (Closes: #254770)
+ * doc/apt-get.8.xml:
+ - remove duplicated mentioning of --install-recommends
+ * doc/sources.list.5.xml:
+ - remove obsolete references to non-us (Closes: #594495)
+ - a notice is printed for ignored files (Closes: #597615)
+ * debian/rules:
+ - use -- instead of deprecated -u for dh_gencontrol
+ - remove shlibs.local creation and usage
+ - show differences in the symbol files, but never fail
+ * pre-build.sh:
+ - remove as it is not needed for a working 'bzr bd'
+ * debian/{apt,apt-utils}.symbols:
+ - ship experimental unmangled c++ symbol files
+ * methods/rred.cc:
+ - operate optional on gzip compressed pdiffs
+ * apt-pkg/acquire-item.cc:
+ - don't uncompress downloaded pdiff files before feeding it to rred
+ - try downloading clearsigned InRelease before trying Release.gpg
+ - change the internal handling of Extensions in pkgAcqIndex
+ - add a special uncompressed compression type to prefer those files
+ - download and use i18n/Index to choose which Translations to download
+ * cmdline/apt-key:
+ - don't set trustdb-name as non-root so 'list' and 'finger'
+ can be used without being root (Closes: #393005, #592107)
+ * apt-pkg/deb/deblistparser.cc:
+ - rewrite LoadReleaseInfo to cope with clearsigned Releasefiles
+ * ftparchive/writer.cc:
+ - add config option to search for more patterns in release command
+ - include Index files by default in the Release file
+ * methods/{gzip,bzip}.cc:
+ - print a good error message if FileSize() is zero
+ * apt-pkg/aptconfiguration.cc:
+ - remove the inbuilt Translation files whitelist
+ * cmdline/apt-cache.cc:
+ - remove not implemented 'apt-cache add' command
+ * doc/apt-cache.8.xml:
+ - describe reality as apt-cache just queries and doesn't manipulate
+ the caches. Thanks to Enrico Zini for spotting it! (Closes: #612009)
+ * apt-pkg/algorithms.cc:
+ - mark pseudo packages of installed all packages as configured
+ in the simulation as we don't call configure for these packages
+ * apt-pkg/pkgcachegen.cc:
+ - in multiarch, let :all packages conflict with :any packages
+ with a different version to be sure
+ * apt-pkg/contrib/error.cc:
+ - remove 400 char size limit of error messages (LP: #365611)
+
+ [ Michael Vogt ]
+ * methods/http.cc:
+ - do not hang if Acquire::http::ProxyAutoDetect can not be
+ executed or returns no data (LP: #654393)
+ * debian/apt.conf.autoremove:
+ - never autoremove the GNU/Hurd kernel (closes: #588423), thanks
+ to Guillem Jover
+ * apt-pkg/cdrom.cc, apt-pkg/init.cc, methods/cdrom.cc:
+ - use /media/cdrom as default mountoint (closes: #611569)
+ * cmdline/apt-get.cc:
+ - add apt-get changelog (closes: #526990)
+ - add apt-get download (closes: #82738)
+
+ [ Martin Pitt ]
+ * test/integration/test-compressed-indexes, test/test-indexes.sh:
+ - Explicitly disable compressed indexes at the start. This ensures that we
+ will actually test uncompressed indexes regardless of the internal
+ default value of Acquire::GzipIndexes.
+
+ -- Michael Vogt <mvo@debian.org> Tue, 08 Feb 2011 12:58:12 +0100
+
apt (0.8.10.3) unstable; urgency=low
[ Programs translations ]