summaryrefslogtreecommitdiff
path: root/cmdline
diff options
context:
space:
mode:
authorMichael Vogt <mvo@ubuntu.com>2014-07-08 15:11:14 +0200
committerMichael Vogt <mvo@ubuntu.com>2014-07-08 15:11:14 +0200
commita5bb5e1e747ceb7b5a9defb6b1a8d9282a6e0957 (patch)
tree4650dafd968a216b8ccdcd04d9a663fc9a312932 /cmdline
parent2830b8436ac8a6f2f3dac4ce2cd030c24eebce04 (diff)
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.
Diffstat (limited to 'cmdline')
-rw-r--r--cmdline/apt-get.cc9
1 files changed, 7 insertions, 2 deletions
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());