From: Michael Vogt Date: Mon, 28 Apr 2014 12:50:11 +0000 (+0200) Subject: avoid deb specific code in private-install X-Git-Tag: 1.1.exp1~35^2~7 X-Git-Url: https://git.saurik.com/apt.git/commitdiff_plain/eafc5435878d4013262131e5506c52d77b8a4bd4 avoid deb specific code in private-install --- diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc index 67da592d6..56eecdca1 100644 --- a/apt-pkg/deb/debmetaindex.cc +++ b/apt-pkg/deb/debmetaindex.cc @@ -516,5 +516,25 @@ class debSLTypeDebSrc : public debSLTypeDebian } }; +class debSLTypeDebFile : public pkgSourceList::Type +{ + public: + + bool CreateItem(vector &List, string const &URI, + string const &Dist, string const &Section, + std::map const &Options) const + { + metaIndex *mi = new debDebFileMetaIndex(URI); + List.push_back(mi); + return true; + } + + debSLTypeDebFile() + { + Name = "deb-file"; + Label = "Debian Deb File"; + } +}; debSLTypeDeb _apt_DebType; debSLTypeDebSrc _apt_DebSrcType; +debSLTypeDebFile _apt_DebFileType; diff --git a/apt-private/private-install.cc b/apt-private/private-install.cc index 40165af31..4a68bb9d1 100644 --- a/apt-private/private-install.cc +++ b/apt-private/private-install.cc @@ -21,9 +21,6 @@ #include #include -// FIXME: include of deb specific header -#include - #include #include #include @@ -33,6 +30,7 @@ #include #include #include +#include #include #include @@ -678,10 +676,19 @@ bool DoInstall(CommandLine &CmdL) { if(FileExists(*I)) { - // FIMXE: direct usage of .deb specific stuff - metaIndex *mi = new debDebFileMetaIndex(*I); - pkgSourceList *sources = Cache.GetSourceList(); - sources->Add(mi); + // FIXME: make this more elegant + std::string TypeStr = flExtension(*I) + "-file"; + pkgSourceList::Type *Type = pkgSourceList::Type::GetType(TypeStr.c_str()); + if(Type != 0) + { + std::vector List; + std::map Options; + if(Type->CreateItem(List, *I, "", "", Options)) + { + pkgSourceList *sources = Cache.GetSourceList(); + sources->Add(List[0]); + } + } } }