summaryrefslogtreecommitdiff
path: root/cmdline
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2015-09-12 10:15:52 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2015-09-14 15:22:18 +0200
commit7c4f1ca5fe315a8223570b05994d6d7ca7c55c4f (patch)
tree1815d1cbf49770f228b6ea72275c17ddc8527e57 /cmdline
parent4b8f2236b40599e191814fcd74e6a48eeafd757f (diff)
implement apt-get source msg 'Please use: $vcs' for git
A bit unfair that only Bzr had this message. Lets at least print it for git as well with the option of adding more later without string changes.
Diffstat (limited to 'cmdline')
-rw-r--r--cmdline/apt-get.cc34
1 files changed, 13 insertions, 21 deletions
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc
index ebc8c94c2..cef7d8c14 100644
--- a/cmdline/apt-get.cc
+++ b/cmdline/apt-get.cc
@@ -78,7 +78,6 @@
#include <string.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
-#include <sys/wait.h>
#include <unistd.h>
#include <pwd.h>
#include <grp.h>
@@ -738,17 +737,22 @@ static bool DoSource(CommandLine &CmdL)
}
pos += vcs.length()+2;
string::size_type epos = srec.find("\n", pos);
- string uri = srec.substr(pos,epos-pos).c_str();
+ string const uri = srec.substr(pos,epos-pos);
ioprintf(c1out, _("NOTICE: '%s' packaging is maintained in "
"the '%s' version control system at:\n"
"%s\n"),
Src.c_str(), vcs.c_str(), uri.c_str());
- if(vcs == "Bzr")
- ioprintf(c1out,_("Please use:\n"
- "bzr branch %s\n"
- "to retrieve the latest (possibly unreleased) "
- "updates to the package.\n"),
- uri.c_str());
+ std::string vcscmd;
+ if (vcs == "Bzr")
+ vcscmd = "bzr branch " + uri;
+ else if (vcs == "Git")
+ vcscmd = "git clone " + uri;
+
+ if (vcscmd.empty() == false)
+ ioprintf(c1out,_("Please use:\n%s\n"
+ "to retrieve the latest (possibly unreleased) "
+ "updates to the package.\n"),
+ vcscmd.c_str());
break;
}
@@ -936,19 +940,7 @@ static bool DoSource(CommandLine &CmdL)
_exit(0);
}
- // Wait for the subprocess
- int Status = 0;
- while (waitpid(Process,&Status,0) != Process)
- {
- if (errno == EINTR)
- continue;
- return _error->Errno("waitpid","Couldn't wait for subprocess");
- }
-
- if (WIFEXITED(Status) == 0 || WEXITSTATUS(Status) != 0)
- return _error->Error(_("Child process failed"));
-
- return true;
+ return ExecWait(Process, "dpkg-source");
}
/*}}}*/
// DoBuildDep - Install/removes packages to satisfy build dependencies /*{{{*/