From 0d29b9d4368284782862c7b507c47002b79ddb27 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Sat, 26 Apr 2014 00:00:51 +0200 Subject: WIP local deb install --- apt-private/private-install.cc | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'apt-private/private-install.cc') diff --git a/apt-private/private-install.cc b/apt-private/private-install.cc index 107ed398e..40165af31 100644 --- a/apt-private/private-install.cc +++ b/apt-private/private-install.cc @@ -19,6 +19,10 @@ #include #include #include +#include + +// FIXME: include of deb specific header +#include #include #include @@ -669,10 +673,23 @@ bool DoCacheManipulationFromCommandLine(CommandLine &CmdL, CacheFile &Cache, bool DoInstall(CommandLine &CmdL) { CacheFile Cache; + // first check for local pkgs and add them to the cache + for (const char **I = CmdL.FileList; *I != 0; I++) + { + if(FileExists(*I)) + { + // FIMXE: direct usage of .deb specific stuff + metaIndex *mi = new debDebFileMetaIndex(*I); + pkgSourceList *sources = Cache.GetSourceList(); + sources->Add(mi); + } + } + + // then open the cache if (Cache.OpenForInstall() == false || Cache.CheckDeps(CmdL.FileSize() != 1) == false) return false; - + std::map verset; if(!DoCacheManipulationFromCommandLine(CmdL, Cache, verset)) -- cgit v1.2.3 From eafc5435878d4013262131e5506c52d77b8a4bd4 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 28 Apr 2014 14:50:11 +0200 Subject: avoid deb specific code in private-install --- apt-private/private-install.cc | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'apt-private/private-install.cc') 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]); + } + } } } -- cgit v1.2.3 From 94f6611592b4b77ac257ec37445776ac2845f682 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 7 May 2014 16:23:37 +0200 Subject: rename pkgSourceList::Add() to pkgSourceList::AddMetaIndex() --- apt-private/private-install.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apt-private/private-install.cc') diff --git a/apt-private/private-install.cc b/apt-private/private-install.cc index 4a68bb9d1..e7606a1d1 100644 --- a/apt-private/private-install.cc +++ b/apt-private/private-install.cc @@ -686,7 +686,7 @@ bool DoInstall(CommandLine &CmdL) if(Type->CreateItem(List, *I, "", "", Options)) { pkgSourceList *sources = Cache.GetSourceList(); - sources->Add(List[0]); + sources->AddMetaIndex(List[0]); } } } -- cgit v1.2.3 From aaf677da5b62d3d0fdeb26f9b4c63fed544b63cd Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 7 May 2014 16:41:25 +0200 Subject: move pkgSourceList::AddMetaIndex() into a private subclass until we decide about a good API --- apt-private/private-install.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'apt-private/private-install.cc') diff --git a/apt-private/private-install.cc b/apt-private/private-install.cc index e7606a1d1..35649fcdb 100644 --- a/apt-private/private-install.cc +++ b/apt-private/private-install.cc @@ -685,7 +685,9 @@ bool DoInstall(CommandLine &CmdL) std::map Options; if(Type->CreateItem(List, *I, "", "", Options)) { - pkgSourceList *sources = Cache.GetSourceList(); + // we have our own CacheFile that gives us a SourceList + // with superpowerz + SourceList *sources = (SourceList*)Cache.GetSourceList(); sources->AddMetaIndex(List[0]); } } -- cgit v1.2.3