#include <stdio.h>
#include <iostream>
#include <string>
+#include <sstream>
#include <sys/stat.h>
/*}}}*/
{
return pkgCache::Flag::NotSource;
}
+
+pkgCacheListParser * debStatusIndex::CreateListParser(FileFd &Pkg)
+{
+ if (Pkg.IsOpen() == false)
+ return NULL;
+ _error->PushToStack();
+ pkgCacheListParser * const Parser = new debStatusListParser(&Pkg);
+ bool const newError = _error->PendingError();
+ _error->MergeWithStack();
+ return newError ? NULL : Parser;
+}
/*}}}*/
// DebPkgFile Index - a single .deb file as an index /*{{{*/
debDebPkgFileIndex::debDebPkgFileIndex(std::string const &DebFile)
if(Popen((const char**)&Args[0], PipeFd, Child, FileFd::ReadOnly) == false)
return _error->Error("Popen failed");
+ content << "Filename: " << debfile << "\n";
+ content << "Size: " << Buf.st_size << "\n";
+ bool first_line_seen = false;
char buffer[1024];
do {
unsigned long long actual = 0;
if (actual == 0)
break;
buffer[actual] = '\0';
- content << buffer;
+ char const * b = buffer;
+ if (first_line_seen == false)
+ {
+ for (; *b != '\0' && (*b == '\n' || *b == '\r'); ++b)
+ /* skip over leading newlines */;
+ if (*b == '\0')
+ continue;
+ first_line_seen = true;
+ }
+ content << b;
} while(true);
ExecWait(Child, "Popen");
- content << "Filename: " << debfile << "\n";
- content << "Size: " << Buf.st_size << "\n";
-
return true;
}
bool debDebPkgFileIndex::OpenListFile(FileFd &Pkg, std::string const &FileName)
return File;
}
-
+std::string debDebPkgFileIndex::ArchiveInfo_impl(pkgCache::VerIterator const &Ver) const
+{
+ std::string Res = IndexFileName() + " ";
+ Res.append(Ver.ParentPkg().Name()).append(" ");
+ Res.append(Ver.Arch()).append(" ");
+ Res.append(Ver.VerStr());
+ return Res;
+}
/*}}}*/
// DscFile Index - a single .dsc file as an index /*{{{*/
debDscFileIndex::debDscFileIndex(std::string const &DscFile)