]> git.saurik.com Git - apt.git/commitdiff
add dpkg::source-options for dpkg-source invocation
authorDavid Kalnischkies <david@kalnischkies.de>
Sat, 16 Aug 2014 11:29:10 +0000 (13:29 +0200)
committerDavid Kalnischkies <david@kalnischkies.de>
Tue, 26 Aug 2014 18:49:48 +0000 (20:49 +0200)
dpkg-source can be told to enforce signature checks with
--require-valid-signature, but while this isn't feasible as default for
Debian itself at the moment, a local admin should be able to use it.

This commit also fixes the size limit on the construction of the command
being called for dpkg-source and dpkg-buildpackage.

Closes: 757534
cmdline/apt-get.cc

index a58386eb0a15ee03eebf4f16896ba35a38d9b38e..845d67d2b3fe2790a9f8f5480aac96dd99c3710b 100644 (file)
@@ -953,18 +953,19 @@ static bool DoSource(CommandLine &CmdL)
         else
         {
            // Call dpkg-source
-           char S[500];
-           snprintf(S,sizeof(S),"%s -x %s",
+           std::string const sourceopts = _config->Find("DPkg::Source-Options", "-x");
+           std::string S;
+           strprintf(S, "%s %s %s",
                     _config->Find("Dir::Bin::dpkg-source","dpkg-source").c_str(),
-                    Dsc[I].Dsc.c_str());
-           if (system(S) != 0)
+                    sourceopts.c_str(), Dsc[I].Dsc.c_str());
+           if (system(S.c_str()) != 0)
            {
-              fprintf(stderr,_("Unpack command '%s' failed.\n"),S);
-              fprintf(stderr,_("Check if the 'dpkg-dev' package is installed.\n"));
+              fprintf(stderr, _("Unpack command '%s' failed.\n"), S.c_str());
+              fprintf(stderr, _("Check if the 'dpkg-dev' package is installed.\n"));
               _exit(1);
-           }       
+           }
         }
-        
+
         // Try to compile it with dpkg-buildpackage
         if (_config->FindB("APT::Get::Compile",false) == true)
         {
@@ -980,20 +981,20 @@ static bool DoSource(CommandLine &CmdL)
            buildopts.append(_config->Find("DPkg::Build-Options","-b -uc"));
 
            // Call dpkg-buildpackage
-           char S[500];
-           snprintf(S,sizeof(S),"cd %s && %s %s",
+           std::string S;
+           strprintf(S, "cd %s && %s %s",
                     Dir.c_str(),
                     _config->Find("Dir::Bin::dpkg-buildpackage","dpkg-buildpackage").c_str(),
                     buildopts.c_str());
-           
-           if (system(S) != 0)
+
+           if (system(S.c_str()) != 0)
            {
-              fprintf(stderr,_("Build command '%s' failed.\n"),S);
+              fprintf(stderr, _("Build command '%s' failed.\n"), S.c_str());
               _exit(1);
-           }       
-        }      
+           }
+        }
       }
-      
+
       _exit(0);
    }