diff options
author | Michael Vogt <mvo@debian.org> | 2014-04-25 09:47:50 +0200 |
---|---|---|
committer | Michael Vogt <mvo@debian.org> | 2014-04-25 10:01:01 +0200 |
commit | 77da39b95870498431fc21df65900acc5ce2f7ea (patch) | |
tree | ad4136dfeeb75eb82d1309244a21cfd244a4f045 | |
parent | a49e7948029d8219d7cb182fbc1b0adb587691b8 (diff) |
add support for apt-get build-dep unpacked-source-dir
-rw-r--r-- | apt-pkg/deb/debindexfile.cc | 14 | ||||
-rw-r--r-- | apt-pkg/deb/debindexfile.h | 5 | ||||
-rw-r--r-- | cmdline/apt-get.cc | 11 | ||||
-rwxr-xr-x | test/integration/test-apt-get-build-dep | 41 |
4 files changed, 70 insertions, 1 deletions
diff --git a/apt-pkg/deb/debindexfile.cc b/apt-pkg/deb/debindexfile.cc index e7e764dd4..bb6884123 100644 --- a/apt-pkg/deb/debindexfile.cc +++ b/apt-pkg/deb/debindexfile.cc @@ -744,6 +744,15 @@ class debIFTypeDscFile : public pkgIndexFile::Type }; 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; @@ -751,6 +760,7 @@ static debIFTypeTrans _apt_Trans; static debIFTypeStatus _apt_Status; // file based pseudo indexes static debIFTypeDscFile _apt_DscFile; +static debIFTypeDebianSourceDir _apt_DebianSourceDir; const pkgIndexFile::Type *debSourcesIndex::GetType() const { @@ -772,5 +782,9 @@ 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 88abfdd9d..64ca558d2 100644 --- a/apt-pkg/deb/debindexfile.h +++ b/apt-pkg/deb/debindexfile.h @@ -182,4 +182,9 @@ class debDscFileIndex : public pkgIndexFile virtual ~debDscFileIndex() {}; }; +class debDebianSourceDirIndex : public debDscFileIndex +{ + virtual const Type *GetType() const APT_CONST; +}; + #endif diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 5418c351b..6d6ba5ff9 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -1055,8 +1055,17 @@ static bool DoBuildDep(CommandLine &CmdL) string Src; pkgSrcRecords::Parser *Last = 0; + // a unpacked debian source tree + if (DirectoryExists(*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()); + if(Type != NULL) + Last = Type->CreateSrcPkgParser(*I); + } // if its a local file (e.g. .dsc) use this - if (FileExists(*I)) + else if (FileExists(*I)) { // see if we can get a parser for this pkgIndexFile type string TypeName = flExtension(*I) + " File Source Index"; diff --git a/test/integration/test-apt-get-build-dep b/test/integration/test-apt-get-build-dep index 6516aa705..f71beae9c 100755 --- a/test/integration/test-apt-get-build-dep +++ b/test/integration/test-apt-get-build-dep @@ -83,3 +83,44 @@ Inst build-essential (1 stable [i386]) Inst debhelper (7 stable [i386]) Conf build-essential (1 stable [i386]) Conf debhelper (7 stable [i386])" aptget build-dep --simulate 2vcard_0.5-3.dsc + + +# unpacked source dir +mkdir -p foo-1.0/debian +cat > foo-1.0/debian/control <<'EOF' +Source: apturl +Section: admin +Priority: optional +Maintainer: Michael Vogt <mvo@ubuntu.com> +Build-Depends: debhelper (>= 7) +X-Python3-Version: >= 3.2 +Standards-Version: 3.9.3 + +Package: apturl-common +Architecture: any +Depends: ${python3:Depends}, + ${shlibs:Depends}, + ${misc:Depends}, + python3-apt, + python3-update-manager +Replaces: apturl (<< 0.3.6ubuntu2) +Description: install packages using the apt protocol - common data + AptUrl is a simple graphical application that takes an URL (which follows the + apt-protocol) as a command line option, parses it and carries out the + operations that the URL describes (that is, it asks the user if he wants the + indicated packages to be installed and if the answer is positive does so for + him). + . + This package contains the common data shared between the frontends. + +EOF + +testequal "Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + build-essential debhelper +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst build-essential (1 stable [i386]) +Inst debhelper (7 stable [i386]) +Conf build-essential (1 stable [i386]) +Conf debhelper (7 stable [i386])" aptget build-dep --simulate ./foo-1.0 |