]> git.saurik.com Git - apt.git/commitdiff
add --indep-only for build-dep command
authorDavid Kalnischkies <david@kalnischkies.de>
Thu, 29 Dec 2016 11:12:01 +0000 (12:12 +0100)
committerDavid Kalnischkies <david@kalnischkies.de>
Sat, 31 Dec 2016 01:29:20 +0000 (02:29 +0100)
The implementation is quite different compared to --arch-only due to ABI
reasons but functionality wise they are similar and usually both
available for symmetry at least.

Closes: #845775
apt-private/private-cmndline.cc
apt-private/private-source.cc
doc/apt-get.8.xml
test/integration/test-apt-get-build-dep

index d0cda08a6df0a6a4798ecc59821f7d2816430f58..dcd7e1baea1b8e7e3ddc7e146676382933ab91f5 100644 (file)
@@ -220,6 +220,8 @@ static bool addArgumentsAPTGet(std::vector<CommandLine::Args> &Args, char const
       addArg('P', "build-profiles", "APT::Build-Profiles", CommandLine::HasArg);
       addArg(0, "purge", "APT::Get::Purge", 0);
       addArg(0, "solver", "APT::Solver", CommandLine::HasArg);
+      addArg(0,"arch-only","APT::Get::Arch-Only",0);
+      addArg(0,"indep-only","APT::Get::Indep-Only",0);
       // this has no effect *but* sbuild is using it (see LP: #1255806)
       // once sbuild is fixed, this option can be removed
       addArg('f', "fix-broken", "APT::Get::Fix-Broken", 0);
@@ -270,7 +272,6 @@ static bool addArgumentsAPTGet(std::vector<CommandLine::Args> &Args, char const
    addArg(0,"trivial-only","APT::Get::Trivial-Only",0);
    addArg(0,"remove","APT::Get::Remove",0);
    addArg(0,"only-source","APT::Get::Only-Source",0);
-   addArg(0,"arch-only","APT::Get::Arch-Only",0);
    addArg(0,"allow-unauthenticated","APT::Get::AllowUnauthenticated",0);
    addArg(0,"allow-insecure-repositories","Acquire::AllowInsecureRepositories",0);
    addArg(0,"allow-weak-repositories","Acquire::AllowWeakRepositories",0);
index 68935d97dc4a85e051d7bd6b71d16bd4552e6c95..5cd0a6628ec07965b61d59012c0ddcf7f057c1cd 100644 (file)
@@ -608,9 +608,14 @@ static void WriteBuildDependencyPackage(std::ostringstream &buildDepsPkgFile,
       << "Architecture: " << Arch << "\n"
       << "Version: 1\n";
 
+   bool const IndepOnly = _config->FindB("APT::Get::Indep-Only", false);
    std::string depends, conflicts;
    for (auto const &dep: Dependencies)
    {
+      // ArchOnly is handled while parsing the dependencies on input
+      if (IndepOnly && (dep.Type == pkgSrcRecords::Parser::BuildDependArch ||
+              dep.Type == pkgSrcRecords::Parser::BuildConflictArch))
+        continue;
       std::string * type;
       if (dep.Type == pkgSrcRecords::Parser::BuildConflict ||
                  dep.Type == pkgSrcRecords::Parser::BuildConflictIndep ||
index ff7b38e97eeaca2f557c5edb686092dbbd1b8534..10366f561845ef3d915e8f604bdacb4c2b2f08ff 100644 (file)
      Configuration Item: <literal>APT::Get::Diff-Only</literal>, <literal>APT::Get::Dsc-Only</literal>, and 
      <literal>APT::Get::Tar-Only</literal>.</para></listitem>
      </varlistentry>
-     
+
      <varlistentry><term><option>--arch-only</option></term>
      <listitem><para>Only process architecture-dependent build-dependencies.
      Configuration Item: <literal>APT::Get::Arch-Only</literal>.</para></listitem>
      </varlistentry>
 
+     <varlistentry><term><option>--indep-only</option></term>
+     <listitem><para>Only process architecture-independent build-dependencies.
+     Configuration Item: <literal>APT::Get::Indep-Only</literal>.</para></listitem>
+     </varlistentry>
+
      <varlistentry><term><option>--allow-unauthenticated</option></term>
      <listitem><para>Ignore if packages can't be authenticated and don't prompt
           about it.  This can be useful while working with local repositories,
index 6a3a2b6c2849ae26facc0354a24142a844d56d5a..4fa77961bb9afd5f86f81bdcd44b22e5294b95fd 100755 (executable)
@@ -68,3 +68,20 @@ Inst build-essential (1 stable [i386])
 Conf build-depends (1 stable [i386])
 Conf build-depends-arch (1 stable [i386])
 Conf build-essential (1 stable [i386])" aptget build-dep --simulate ./foobar.dsc --arch-only
+
+testsuccessequal "Note, using file './foobar.dsc' to get the build dependencies
+Reading package lists...
+Building dependency tree...
+The following packages will be REMOVED:
+  build-conflicts build-conflicts-indep
+The following NEW packages will be installed:
+  build-depends build-depends-indep build-essential
+0 upgraded, 3 newly installed, 2 to remove and 0 not upgraded.
+Remv build-conflicts [1]
+Remv build-conflicts-indep [1]
+Inst build-depends (1 stable [i386])
+Inst build-depends-indep (1 stable [i386])
+Inst build-essential (1 stable [i386])
+Conf build-depends (1 stable [i386])
+Conf build-depends-indep (1 stable [i386])
+Conf build-essential (1 stable [i386])" aptget build-dep --simulate ./foobar.dsc --indep-only