diff options
Diffstat (limited to 'apt-pkg/deb')
-rw-r--r-- | apt-pkg/deb/debsrcrecords.cc | 38 | ||||
-rw-r--r-- | apt-pkg/deb/debsrcrecords.h | 1 | ||||
-rw-r--r-- | apt-pkg/deb/dpkgpm.cc | 16 |
3 files changed, 45 insertions, 10 deletions
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); |