summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/algorithms.cc2
-rw-r--r--apt-pkg/cacheiterators.h10
-rw-r--r--apt-pkg/deb/debsrcrecords.cc38
-rw-r--r--apt-pkg/deb/debsrcrecords.h1
-rw-r--r--apt-pkg/deb/dpkgpm.cc16
-rw-r--r--apt-pkg/pkgcache.cc6
-rw-r--r--apt-pkg/srcrecords.cc31
-rw-r--r--apt-pkg/srcrecords.h9
8 files changed, 89 insertions, 24 deletions
diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc
index c8696b8ad..adbec82f7 100644
--- a/apt-pkg/algorithms.cc
+++ b/apt-pkg/algorithms.cc
@@ -468,7 +468,7 @@ void pkgProblemResolver::MakeScores()
if (D->Version != 0)
{
pkgCache::VerIterator const IV = Cache[T].InstVerIter(Cache);
- if (IV.end() == true || D.IsSatisfied(IV) != D.IsNegative())
+ if (IV.end() == true || D.IsSatisfied(IV) == false)
continue;
}
Scores[T->ID] += DepMap[D->Type];
diff --git a/apt-pkg/cacheiterators.h b/apt-pkg/cacheiterators.h
index f8f4c05ce..fe798799c 100644
--- a/apt-pkg/cacheiterators.h
+++ b/apt-pkg/cacheiterators.h
@@ -161,10 +161,12 @@ class pkgCache::PkgIterator: public Iterator<Package, PkgIterator> {
// Accessors
inline const char *Name() const { return Group().Name(); }
// Versions have sections - and packages can have different versions with different sections
- // so this interface is broken by design. It used to return the section of the "first parsed
- // package stanza", but as this can potentially be anything it now returns the section of the
- // newest version instead (if any). aka: Run as fast as you can to Version.Section().
- APT_DEPRECATED const char *Section() const;
+ // so this interface is broken by design. Run as fast as you can to Version.Section().
+ APT_DEPRECATED inline const char *Section() const {
+ APT_IGNORE_DEPRECATED_PUSH
+ return S->Section == 0?0:Owner->StrP + S->Section;
+ APT_IGNORE_DEPRECATED_POP
+ }
inline bool Purge() const {return S->CurrentState == pkgCache::State::Purge ||
(S->CurrentVer == 0 && S->CurrentState == pkgCache::State::NotInstalled);}
inline const char *Arch() const {return S->Arch == 0?0:Owner->StrP + S->Arch;}
diff --git a/apt-pkg/deb/debsrcrecords.cc b/apt-pkg/deb/debsrcrecords.cc
index d3c137bb9..ca6d09896 100644
--- a/apt-pkg/deb/debsrcrecords.cc
+++ b/apt-pkg/deb/debsrcrecords.cc
@@ -121,9 +121,32 @@ bool debSrcRecordParser::BuildDepends(std::vector<pkgSrcRecords::Parser::BuildDe
// ---------------------------------------------------------------------
/* This parses the list of files and returns it, each file is required to have
a complete source package */
-bool debSrcRecordParser::Files(std::vector<pkgSrcRecords::File> &List)
+bool debSrcRecordParser::Files(std::vector<pkgSrcRecords::File> &F)
{
- List.erase(List.begin(),List.end());
+ std::vector<pkgSrcRecords::File2> F2;
+ if (Files2(F2) == false)
+ return false;
+ for (std::vector<pkgSrcRecords::File2>::const_iterator f2 = F2.begin(); f2 != F2.end(); ++f2)
+ {
+ pkgSrcRecords::File2 f;
+#if __GNUC__ >= 4
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
+ f.MD5Hash = f2->MD5Hash;
+ f.Size = f2->Size;
+#if __GNUC__ >= 4
+ #pragma GCC diagnostic pop
+#endif
+ f.Path = f2->Path;
+ f.Type = f2->Type;
+ F.push_back(f);
+ }
+ return true;
+}
+bool debSrcRecordParser::Files2(std::vector<pkgSrcRecords::File2> &List)
+{
+ List.clear();
// Stash the / terminated directory prefix
string Base = Sect.FindS("Directory");
@@ -162,7 +185,7 @@ bool debSrcRecordParser::Files(std::vector<pkgSrcRecords::File> &List)
path = Base + path;
// look if we have a record for this file already
- std::vector<pkgSrcRecords::File>::iterator file = List.begin();
+ std::vector<pkgSrcRecords::File2>::iterator file = List.begin();
for (; file != List.end(); ++file)
if (file->Path == path)
break;
@@ -179,13 +202,16 @@ bool debSrcRecordParser::Files(std::vector<pkgSrcRecords::File> &List)
}
// we haven't seen this file yet
- pkgSrcRecords::File F;
+ pkgSrcRecords::File2 F;
F.Path = path;
- F.Size = strtoull(size.c_str(), NULL, 10);
+ F.FileSize = strtoull(size.c_str(), NULL, 10);
F.Hashes.push_back(hashString);
+ APT_IGNORE_DEPRECATED_PUSH
+ F.Size = F.FileSize;
if (checksumField == "Files")
- APT_IGNORE_DEPRECATED(F.MD5Hash = hash;)
+ F.MD5Hash = hash;
+ APT_IGNORE_DEPRECATED_POP
// Try to guess what sort of file it is we are getting.
string::size_type Pos = F.Path.length()-1;
diff --git a/apt-pkg/deb/debsrcrecords.h b/apt-pkg/deb/debsrcrecords.h
index 1a09f6546..cd246d624 100644
--- a/apt-pkg/deb/debsrcrecords.h
+++ b/apt-pkg/deb/debsrcrecords.h
@@ -54,6 +54,7 @@ class APT_HIDDEN debSrcRecordParser : public pkgSrcRecords::Parser
return std::string(Start,Stop);
};
virtual bool Files(std::vector<pkgSrcRecords::File> &F);
+ bool Files2(std::vector<pkgSrcRecords::File2> &F);
debSrcRecordParser(std::string const &File,pkgIndexFile const *Index)
: Parser(Index), Fd(File,FileFd::ReadOnly, FileFd::Extension), Tags(&Fd,102400),
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc
index 8a8214c19..09bd9149f 100644
--- a/apt-pkg/deb/dpkgpm.cc
+++ b/apt-pkg/deb/dpkgpm.cc
@@ -73,7 +73,8 @@ public:
pkgDPkgPMPrivate() : stdin_is_dev_null(false), dpkgbuf_pos(0),
term_out(NULL), history_out(NULL),
progress(NULL), tt_is_valid(false), master(-1),
- slave(NULL), protect_slave_from_dying(-1)
+ slave(NULL), protect_slave_from_dying(-1),
+ direct_stdin(false)
{
dpkgbuf[0] = '\0';
}
@@ -100,6 +101,7 @@ public:
sigset_t sigmask;
sigset_t original_sigmask;
+ bool direct_stdin;
};
namespace
@@ -1069,6 +1071,9 @@ void pkgDPkgPM::StartPtyMagic()
return;
}
+ if (isatty(STDIN_FILENO) == 0)
+ d->direct_stdin = true;
+
_error->PushToStack();
d->master = posix_openpt(O_RDWR | O_NOCTTY);
@@ -1166,7 +1171,10 @@ void pkgDPkgPM::SetupSlavePtyMagic()
_error->FatalE("ioctl", "Setting TIOCSCTTY for slave fd %d failed!", slaveFd);
else
{
- for (unsigned short i = 0; i < 3; ++i)
+ unsigned short i = 0;
+ if (d->direct_stdin == true)
+ ++i;
+ for (; i < 3; ++i)
if (dup2(slaveFd, i) == -1)
_error->FatalE("dup2", "Dupping %d to %d in child failed!", slaveFd, i);
@@ -1582,8 +1590,8 @@ bool pkgDPkgPM::Go(APT::Progress::PackageManager *progress)
// wait for input or output here
FD_ZERO(&rfds);
- if (d->master >= 0 && !d->stdin_is_dev_null)
- FD_SET(0, &rfds);
+ if (d->master >= 0 && d->direct_stdin == false && d->stdin_is_dev_null == false)
+ FD_SET(STDIN_FILENO, &rfds);
FD_SET(_dpkgin, &rfds);
if(d->master >= 0)
FD_SET(d->master, &rfds);
diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc
index 8d6e242b1..b42f7e228 100644
--- a/apt-pkg/pkgcache.cc
+++ b/apt-pkg/pkgcache.cc
@@ -1036,9 +1036,3 @@ bool pkgCache::PrvIterator::IsMultiArchImplicit() const
return false;
}
/*}}}*/
-APT_DEPRECATED APT_PURE const char * pkgCache::PkgIterator::Section() const {/*{{{*/
- if (S->VersionList == 0)
- return 0;
- return VersionList().Section();
-}
- /*}}}*/
diff --git a/apt-pkg/srcrecords.cc b/apt-pkg/srcrecords.cc
index 81b1c545d..3175ee75f 100644
--- a/apt-pkg/srcrecords.cc
+++ b/apt-pkg/srcrecords.cc
@@ -14,6 +14,7 @@
#include<config.h>
#include <apt-pkg/srcrecords.h>
+#include <apt-pkg/debsrcrecords.h>
#include <apt-pkg/error.h>
#include <apt-pkg/sourcelist.h>
#include <apt-pkg/metaindex.h>
@@ -147,5 +148,33 @@ const char *pkgSrcRecords::Parser::BuildDepType(unsigned char const &Type)
return fields[Type];
}
/*}}}*/
+bool pkgSrcRecords::Parser::Files2(std::vector<pkgSrcRecords::File2> &F2)/*{{{*/
+{
+ debSrcRecordParser * const deb = dynamic_cast<debSrcRecordParser*>(this);
+ if (deb != NULL)
+ return deb->Files2(F2);
-
+ std::vector<pkgSrcRecords::File> F;
+ if (Files(F) == false)
+ return false;
+ for (std::vector<pkgSrcRecords::File>::const_iterator f = F.begin(); f != F.end(); ++f)
+ {
+ pkgSrcRecords::File2 f2;
+#if __GNUC__ >= 4
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
+ f2.MD5Hash = f->MD5Hash;
+ f2.Size = f->Size;
+ f2.Hashes.push_back(HashString("MD5Sum", f->MD5Hash));
+ f2.FileSize = f->Size;
+#if __GNUC__ >= 4
+ #pragma GCC diagnostic pop
+#endif
+ f2.Path = f->Path;
+ f2.Type = f->Type;
+ F2.push_back(f2);
+ }
+ return true;
+}
+ /*}}}*/
diff --git a/apt-pkg/srcrecords.h b/apt-pkg/srcrecords.h
index de2b6ff64..c931e17b7 100644
--- a/apt-pkg/srcrecords.h
+++ b/apt-pkg/srcrecords.h
@@ -34,11 +34,15 @@ APT_IGNORE_DEPRECATED_PUSH
// Describes a single file
struct File
{
+ APT_DEPRECATED std::string MD5Hash;
+ APT_DEPRECATED unsigned long Size;
std::string Path;
std::string Type;
- unsigned long long Size;
+ };
+ struct File2 : public File
+ {
+ unsigned long long FileSize;
HashStringList Hashes;
- APT_DEPRECATED std::string MD5Hash;
};
APT_IGNORE_DEPRECATED_POP
@@ -81,6 +85,7 @@ APT_IGNORE_DEPRECATED_POP
static const char *BuildDepType(unsigned char const &Type) APT_PURE;
virtual bool Files(std::vector<pkgSrcRecords::File> &F) = 0;
+ bool Files2(std::vector<pkgSrcRecords::File2> &F);
Parser(const pkgIndexFile *Index) : iIndex(Index) {};
virtual ~Parser() {};