diff options
author | Michael Vogt <mvo@debian.org> | 2014-05-08 14:29:30 +0200 |
---|---|---|
committer | Michael Vogt <mvo@debian.org> | 2014-05-08 14:29:30 +0200 |
commit | 070536e61cb203a9c74013be2a26322b582a9674 (patch) | |
tree | 9126356edcc1e239c6d87e3cb2921318238d501b /apt-pkg | |
parent | 1816266852b25faec4f2ed1a67171eddb39b2102 (diff) | |
parent | 77da39b95870498431fc21df65900acc5ce2f7ea (diff) |
Merge remote-tracking branch 'mvo/feature/build-dep-dsc2' into debian/experimental
Conflicts:
apt-pkg/deb/debindexfile.cc
apt-pkg/deb/debindexfile.h
apt-pkg/deb/debsrcrecords.cc
Diffstat (limited to 'apt-pkg')
-rw-r--r-- | apt-pkg/deb/debindexfile.cc | 65 | ||||
-rw-r--r-- | apt-pkg/deb/debindexfile.h | 24 | ||||
-rw-r--r-- | apt-pkg/deb/debmetaindex.cc | 4 | ||||
-rw-r--r-- | apt-pkg/deb/debsrcrecords.cc | 19 | ||||
-rw-r--r-- | apt-pkg/deb/debsrcrecords.h | 7 | ||||
-rw-r--r-- | apt-pkg/indexfile.h | 1 | ||||
-rw-r--r-- | apt-pkg/pkgsystem.h | 6 | ||||
-rw-r--r-- | apt-pkg/sourcelist.h | 2 | ||||
-rw-r--r-- | apt-pkg/tagfile.cc | 11 | ||||
-rw-r--r-- | apt-pkg/tagfile.h | 2 |
10 files changed, 135 insertions, 6 deletions
diff --git a/apt-pkg/deb/debindexfile.cc b/apt-pkg/deb/debindexfile.cc index 86ef92bfb..37efa05b0 100644 --- a/apt-pkg/deb/debindexfile.cc +++ b/apt-pkg/deb/debindexfile.cc @@ -759,6 +759,41 @@ unsigned long debDebPkgFileIndex::Size() const } /*}}}*/ +// debDscFileIndex stuff +debDscFileIndex::debDscFileIndex(std::string &DscFile) + : pkgIndexFile(true), DscFile(DscFile) +{ +} + +bool debDscFileIndex::Exists() const +{ + return FileExists(DscFile); +} + +unsigned long debDscFileIndex::Size() const +{ + struct stat buf; + if(stat(DscFile.c_str(), &buf) == 0) + return buf.st_size; + return 0; +} + +// DscFileIndex::CreateSrcParser - Get a parser for the .dsc file /*{{{*/ +// --------------------------------------------------------------------- +/* */ +pkgSrcRecords::Parser *debDscFileIndex::CreateSrcParser() const +{ + if (!FileExists(DscFile)) + return NULL; + + return new debDscRecordParser(DscFile,this); +} + /*}}}*/ + + + + +// --------------------------------------------------------------------- // Index File types for Debian /*{{{*/ class debIFTypeSrc : public pkgIndexFile::Type { @@ -800,11 +835,33 @@ class debIFTypeDebPkgFile : public pkgIndexFile::Type }; debIFTypeDebPkgFile() {Label = "deb Package file";}; }; +class debIFTypeDscFile : public pkgIndexFile::Type +{ + public: + virtual pkgSrcRecords::Parser *CreateSrcPkgParser(std::string DscFile) const + { + return new debDscRecordParser(DscFile, NULL); + }; + debIFTypeDscFile() {Label = "dsc File Source Index";}; +}; +class debIFTypeDebianSourceDir : public pkgIndexFile::Type +{ + public: + virtual pkgSrcRecords::Parser *CreateSrcPkgParser(std::string SourceDir) const + { + return new debDscRecordParser(SourceDir + string("/debian/control"), NULL); + }; + debIFTypeDebianSourceDir() {Label = "debian/control File Source Index";}; +}; + static debIFTypeSrc _apt_Src; static debIFTypePkg _apt_Pkg; static debIFTypeTrans _apt_Trans; static debIFTypeStatus _apt_Status; static debIFTypeDebPkgFile _apt_DebPkgFile; +// file based pseudo indexes +static debIFTypeDscFile _apt_DscFile; +static debIFTypeDebianSourceDir _apt_DebianSourceDir; const pkgIndexFile::Type *debSourcesIndex::GetType() const { @@ -826,4 +883,12 @@ const pkgIndexFile::Type *debDebPkgFileIndex::GetType() const { return &_apt_DebPkgFile; } +const pkgIndexFile::Type *debDscFileIndex::GetType() const +{ + return &_apt_DscFile; +} +const pkgIndexFile::Type *debDebianSourceDirIndex::GetType() const +{ + return &_apt_DebianSourceDir; +} /*}}}*/ diff --git a/apt-pkg/deb/debindexfile.h b/apt-pkg/deb/debindexfile.h index 69754e79d..18322dc1b 100644 --- a/apt-pkg/deb/debindexfile.h +++ b/apt-pkg/deb/debindexfile.h @@ -192,7 +192,29 @@ class debDebPkgFileIndex : public pkgIndexFile debDebPkgFileIndex(std::string DebFile); virtual ~debDebPkgFileIndex() {}; - +}; + +class debDscFileIndex : public pkgIndexFile +{ + private: + std::string DscFile; + public: + virtual const Type *GetType() const APT_CONST; + virtual pkgSrcRecords::Parser *CreateSrcParser() const; + virtual bool Exists() const; + virtual bool HasPackages() const {return false;}; + virtual unsigned long Size() const; + virtual std::string Describe(bool /*Short*/) const { + return DscFile; + }; + + debDscFileIndex(std::string &DscFile); + virtual ~debDscFileIndex() {}; +}; + +class debDebianSourceDirIndex : public debDscFileIndex +{ + virtual const Type *GetType() const APT_CONST; }; #endif diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc index 56eecdca1..b4839ada4 100644 --- a/apt-pkg/deb/debmetaindex.cc +++ b/apt-pkg/deb/debmetaindex.cc @@ -521,8 +521,8 @@ class debSLTypeDebFile : public pkgSourceList::Type public: bool CreateItem(vector<metaIndex *> &List, string const &URI, - string const &Dist, string const &Section, - std::map<string, string> const &Options) const + string const &/*Dist*/, string const &/*Section*/, + std::map<string, string> const &/*Options*/) const { metaIndex *mi = new debDebFileMetaIndex(URI); List.push_back(mi); diff --git a/apt-pkg/deb/debsrcrecords.cc b/apt-pkg/deb/debsrcrecords.cc index 615f0f57d..7b9a828d3 100644 --- a/apt-pkg/deb/debsrcrecords.cc +++ b/apt-pkg/deb/debsrcrecords.cc @@ -19,6 +19,7 @@ #include <apt-pkg/srcrecords.h> #include <apt-pkg/tagfile.h> #include <apt-pkg/hashes.h> +#include <apt-pkg/gpgv.h> #include <ctype.h> #include <stdlib.h> @@ -212,3 +213,21 @@ debSrcRecordParser::~debSrcRecordParser() delete[] Buffer; } /*}}}*/ + + +debDscRecordParser::debDscRecordParser(std::string const &DscFile, pkgIndexFile const *Index) + : debSrcRecordParser(DscFile, Index) +{ + // support clear signed files + if (OpenMaybeClearSignedFile(DscFile, Fd) == false) + { + _error->Error("Failed to open %s", DscFile.c_str()); + return; + } + + // re-init to ensure the updated Fd is used + Tags.Init(&Fd); + // read the first (and only) record + Step(); + +} diff --git a/apt-pkg/deb/debsrcrecords.h b/apt-pkg/deb/debsrcrecords.h index b65d1480b..a0a151875 100644 --- a/apt-pkg/deb/debsrcrecords.h +++ b/apt-pkg/deb/debsrcrecords.h @@ -26,6 +26,7 @@ class debSrcRecordParser : public pkgSrcRecords::Parser /** \brief dpointer placeholder (for later in case we need it) */ void *d; + protected: FileFd Fd; pkgTagFile Tags; pkgTagSection Sect; @@ -60,4 +61,10 @@ class debSrcRecordParser : public pkgSrcRecords::Parser virtual ~debSrcRecordParser(); }; +class debDscRecordParser : public debSrcRecordParser +{ + public: + debDscRecordParser(std::string const &DscFile, pkgIndexFile const *Index); +}; + #endif diff --git a/apt-pkg/indexfile.h b/apt-pkg/indexfile.h index b5c9ac77e..817165f08 100644 --- a/apt-pkg/indexfile.h +++ b/apt-pkg/indexfile.h @@ -59,6 +59,7 @@ class pkgIndexFile const char *Label; virtual pkgRecords::Parser *CreatePkgParser(pkgCache::PkgFileIterator /*File*/) const {return 0;}; + virtual pkgSrcRecords::Parser *CreateSrcPkgParser(std::string /*File*/) const {return 0;}; Type(); virtual ~Type() {}; }; diff --git a/apt-pkg/pkgsystem.h b/apt-pkg/pkgsystem.h index 6e33c67ed..f88ffa7c8 100644 --- a/apt-pkg/pkgsystem.h +++ b/apt-pkg/pkgsystem.h @@ -85,10 +85,12 @@ class pkgSystem virtual bool AddStatusFiles(std::vector<pkgIndexFile *> &List) = 0; virtual bool FindIndex(pkgCache::PkgFileIterator File, pkgIndexFile *&Found) const = 0; - + /* Evauluate how 'right' we are for this system based on the filesystem etc.. */ - virtual signed Score(Configuration const &/*Cnf*/) {return 0;}; + virtual signed Score(Configuration const &/*Cnf*/) { + return 0; + }; pkgSystem(); virtual ~pkgSystem() {}; diff --git a/apt-pkg/sourcelist.h b/apt-pkg/sourcelist.h index 99e83f454..261dd8161 100644 --- a/apt-pkg/sourcelist.h +++ b/apt-pkg/sourcelist.h @@ -94,7 +94,7 @@ class pkgSourceList : public pkgSource typedef std::vector<metaIndex *>::const_iterator const_iterator; - protected: + public: std::vector<metaIndex *> SrcList; diff --git a/apt-pkg/tagfile.cc b/apt-pkg/tagfile.cc index 91d176e3c..009ed7d74 100644 --- a/apt-pkg/tagfile.cc +++ b/apt-pkg/tagfile.cc @@ -51,12 +51,23 @@ public: // --------------------------------------------------------------------- /* */ pkgTagFile::pkgTagFile(FileFd *pFd,unsigned long long Size) + : d(NULL) +{ + Init(pFd, Size); +} + +void pkgTagFile::Init(FileFd *pFd,unsigned long long Size) { /* The size is increased by 4 because if we start with the Size of the filename we need to try to read 1 char more to see an EOF faster, 1 char the end-pointer can be on and maybe 2 newlines need to be added to the end of the file -> 4 extra chars */ Size += 4; + if(d != NULL) + { + free(d->Buffer); + delete d; + } d = new pkgTagFilePrivate(pFd, Size); if (d->Fd.IsOpen() == false) diff --git a/apt-pkg/tagfile.h b/apt-pkg/tagfile.h index d5b62e76d..d1a24ba45 100644 --- a/apt-pkg/tagfile.h +++ b/apt-pkg/tagfile.h @@ -105,6 +105,8 @@ class pkgTagFile unsigned long Offset(); bool Jump(pkgTagSection &Tag,unsigned long long Offset); + void Init(FileFd *F,unsigned long long Size = 32*1024); + pkgTagFile(FileFd *F,unsigned long long Size = 32*1024); virtual ~pkgTagFile(); }; |