Просмотр исходного кода

add support for apt-get build-dep unpacked-source-dir

Michael Vogt лет назад: 12
Родитель
Сommit
77da39b958
4 измененных файлов с 70 добавлено и 1 удалено
  1. 14 0
      apt-pkg/deb/debindexfile.cc
  2. 5 0
      apt-pkg/deb/debindexfile.h
  3. 10 1
      cmdline/apt-get.cc
  4. 41 0
      test/integration/test-apt-get-build-dep

+ 14 - 0
apt-pkg/deb/debindexfile.cc

@@ -744,6 +744,15 @@ class debIFTypeDscFile : public pkgIndexFile::Type
    };
    };
    debIFTypeDscFile() {Label = "dsc File Source Index";};
    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 debIFTypeSrc _apt_Src;
 static debIFTypePkg _apt_Pkg;
 static debIFTypePkg _apt_Pkg;
@@ -751,6 +760,7 @@ static debIFTypeTrans _apt_Trans;
 static debIFTypeStatus _apt_Status;
 static debIFTypeStatus _apt_Status;
 // file based pseudo indexes
 // file based pseudo indexes
 static debIFTypeDscFile _apt_DscFile;
 static debIFTypeDscFile _apt_DscFile;
+static debIFTypeDebianSourceDir _apt_DebianSourceDir;
 
 
 const pkgIndexFile::Type *debSourcesIndex::GetType() const
 const pkgIndexFile::Type *debSourcesIndex::GetType() const
 {
 {
@@ -772,5 +782,9 @@ const pkgIndexFile::Type *debDscFileIndex::GetType() const
 {
 {
    return &_apt_DscFile;
    return &_apt_DscFile;
 }
 }
+const pkgIndexFile::Type *debDebianSourceDirIndex::GetType() const
+{
+   return &_apt_DebianSourceDir;
+}
 
 
 									/*}}}*/
 									/*}}}*/

+ 5 - 0
apt-pkg/deb/debindexfile.h

@@ -182,4 +182,9 @@ class debDscFileIndex : public pkgIndexFile
    virtual ~debDscFileIndex() {};
    virtual ~debDscFileIndex() {};
 };
 };
 
 
+class debDebianSourceDirIndex : public debDscFileIndex
+{
+   virtual const Type *GetType() const APT_CONST;
+};
+
 #endif
 #endif

+ 10 - 1
cmdline/apt-get.cc

@@ -1055,8 +1055,17 @@ static bool DoBuildDep(CommandLine &CmdL)
       string Src;
       string Src;
       pkgSrcRecords::Parser *Last = 0;
       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 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
          // see if we can get a parser for this pkgIndexFile type
          string TypeName = flExtension(*I) + " File Source Index";
          string TypeName = flExtension(*I) + " File Source Index";

+ 41 - 0
test/integration/test-apt-get-build-dep

@@ -83,3 +83,44 @@ Inst build-essential (1 stable [i386])
 Inst debhelper (7 stable [i386])
 Inst debhelper (7 stable [i386])
 Conf build-essential (1 stable [i386])
 Conf build-essential (1 stable [i386])
 Conf debhelper (7 stable [i386])" aptget build-dep --simulate 2vcard_0.5-3.dsc
 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