From a5bb5e1e747ceb7b5a9defb6b1a8d9282a6e0957 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 8 Jul 2014 15:11:14 +0200 Subject: Only allow "apt-get build-dep path" when path starts with ./ or / This avoid the subtle problem that someone might have a directory with the same package name as the build-depends he/she is trying to fetch. Also print a note that the specific file/dir is used. --- cmdline/apt-get.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'cmdline') diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index bd866bc8c..cdbfa4708 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -1065,9 +1065,12 @@ static bool DoBuildDep(CommandLine &CmdL) string Src; pkgSrcRecords::Parser *Last = 0; - // a unpacked debian source tree - if (DirectoryExists(*I)) + // an unpacked debian source tree + using APT::String::Startswith; + if ((Startswith(*I, "./") || Startswith(*I, "/")) && + DirectoryExists(*I)) { + ioprintf(c1out, _("Note, using directory '%s' to get the build dependencies\n"), *I); // FIXME: how can we make this more elegant? std::string TypeName = "debian/control File Source Index"; pkgIndexFile::Type *Type = pkgIndexFile::Type::GetType(TypeName.c_str()); @@ -1077,6 +1080,8 @@ static bool DoBuildDep(CommandLine &CmdL) // if its a local file (e.g. .dsc) use this else if (FileExists(*I)) { + ioprintf(c1out, _("Note, using file '%s' to get the build dependencies\n"), *I); + // see if we can get a parser for this pkgIndexFile type string TypeName = flExtension(*I) + " File Source Index"; pkgIndexFile::Type *Type = pkgIndexFile::Type::GetType(TypeName.c_str()); -- cgit v1.2.3