summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apt-pkg/version.cc23
-rw-r--r--apt-pkg/version.h3
-rw-r--r--cmdline/apt-get.cc66
-rw-r--r--doc/apt-get.8.yo8
-rw-r--r--doc/apt.conf.5.yo7
-rw-r--r--doc/examples/apt.conf8
6 files changed, 108 insertions, 7 deletions
diff --git a/apt-pkg/version.cc b/apt-pkg/version.cc
index f3ebb556e..4aad581f8 100644
--- a/apt-pkg/version.cc
+++ b/apt-pkg/version.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: version.cc,v 1.8 1998/12/05 01:44:57 jgg Exp $
+// $Id: version.cc,v 1.9 1999/04/19 06:03:09 jgg Exp $
/* ######################################################################
Version - Version string
@@ -248,3 +248,24 @@ bool pkgCheckDep(const char *DepVer,const char *PkgVer,int Op)
return false;
}
/*}}}*/
+// BaseVersion - Return the upstream version string /*{{{*/
+// ---------------------------------------------------------------------
+/* This strips all the debian specific information from the version number */
+string pkgBaseVersion(const char *Ver)
+{
+ // Strip off the bit before the first colon
+ const char *I = Ver;
+ for (; *I != 0 && *I != ':'; I++);
+ if (*I == ':')
+ Ver = I + 1;
+
+ // Chop off the trailing -
+ I = Ver;
+ unsigned Last = strlen(Ver);
+ for (; *I != 0; I++)
+ if (*I == '-')
+ Last = I - Ver;
+
+ return string(Ver,Last);
+}
+ /*}}}*/
diff --git a/apt-pkg/version.h b/apt-pkg/version.h
index ba7eb592d..127519583 100644
--- a/apt-pkg/version.h
+++ b/apt-pkg/version.h
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: version.h,v 1.4 1998/07/19 21:24:19 jgg Exp $
+// $Id: version.h,v 1.5 1999/04/19 06:03:09 jgg Exp $
/* ######################################################################
Version - Version comparison routines
@@ -25,5 +25,6 @@ int pkgVersionCompare(const char *A, const char *AEnd, const char *B,
const char *BEnd);
int pkgVersionCompare(string A,string B);
bool pkgCheckDep(const char *DepVer,const char *PkgVer,int Op);
+string pkgBaseVersion(const char *Ver);
#endif
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc
index fb51c74e1..504cde33e 100644
--- a/cmdline/apt-get.cc
+++ b/cmdline/apt-get.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: apt-get.cc,v 1.53 1999/04/18 06:51:09 jgg Exp $
+// $Id: apt-get.cc,v 1.54 1999/04/19 06:03:09 jgg Exp $
/* ######################################################################
apt-get - Cover for dpkg
@@ -1047,6 +1047,13 @@ bool DoCheck(CommandLine &CmdL)
// DoSource - Fetch a source archive /*{{{*/
// ---------------------------------------------------------------------
/* Fetch souce packages */
+struct DscFile
+{
+ string Package;
+ string Version;
+ string Dsc;
+};
+
bool DoSource(CommandLine &CmdL)
{
CacheFile Cache;
@@ -1070,9 +1077,12 @@ bool DoSource(CommandLine &CmdL)
// Create the download object
AcqTextStatus Stat(ScreenWidth,_config->FindI("quiet",0));
pkgAcquire Fetcher(&Stat);
+
+ DscFile *Dsc = new DscFile[CmdL.FileSize()];
// Load the requestd sources into the fetcher
- for (const char **I = CmdL.FileList + 1; *I != 0; I++)
+ unsigned J = 0;
+ for (const char **I = CmdL.FileList + 1; *I != 0; I++, J++)
{
string Src;
@@ -1130,7 +1140,13 @@ bool DoSource(CommandLine &CmdL)
// Try to guess what sort of file it is we are getting.
string Comp;
if (I->Path.find(".dsc") != string::npos)
+ {
Comp = "dsc";
+ Dsc[J].Package = Last->Package();
+ Dsc[J].Version = Last->Version();
+ Dsc[J].Dsc = flNotDir(I->Path);
+ }
+
if (I->Path.find(".tar.gz") != string::npos)
Comp = "tar";
if (I->Path.find(".diff.gz") != string::npos)
@@ -1180,6 +1196,7 @@ bool DoSource(CommandLine &CmdL)
return false;
// Print error messages
+ bool Failed = false;
for (pkgAcquire::Item **I = Fetcher.ItemsBegin(); I != Fetcher.ItemsEnd(); I++)
{
if ((*I)->Status == pkgAcquire::Item::StatDone &&
@@ -1188,8 +1205,51 @@ bool DoSource(CommandLine &CmdL)
cerr << "Failed to fetch " << (*I)->DescURI() << endl;
cerr << " " << (*I)->ErrorText << endl;
+ Failed = true;
}
+ if (Failed == true)
+ return _error->Error("Failed to fetch some archives.");
+
+ if (_config->FindB("APT::Get::Download-only",false) == true)
+ return true;
+ // Unpack the sources
+ for (unsigned I = 0; I != J; I++)
+ {
+ string Dir = Dsc[I].Package + '-' + pkgBaseVersion(Dsc[I].Version.c_str());
+
+ // See if the package is already unpacked
+ struct stat Stat;
+ if (stat(Dir.c_str(),&Stat) == 0 &&
+ S_ISDIR(Stat.st_mode) != 0)
+ {
+ c0out << "Skipping unpack of already unpacked source in " << Dir << endl;
+ }
+ else
+ {
+ // Call dpkg-source
+ char S[500];
+ snprintf(S,sizeof(S),"%s -x %s",
+ _config->Find("Dir::Bin::dpkg-source","dpkg-source").c_str(),
+ Dsc[I].Dsc.c_str());
+ if (system(S) != 0)
+ return _error->Error("Unpack command '%s' failed.",S);
+ }
+
+ // Try to compile it with dpkg-buildpackage
+ if (_config->FindB("APT::Get::Compile",false) == true)
+ {
+ // Call dpkg-buildpackage
+ char S[500];
+ snprintf(S,sizeof(S),"cd %s && %s %s",
+ Dir.c_str(),
+ _config->Find("Dir::Bin::dpkg-buildpackage","dpkg-buildpackage").c_str(),
+ _config->Find("DPkg::Build-Options","-b -uc").c_str());
+
+ if (system(S) != 0)
+ return _error->Error("Build command '%s' failed.",S);
+ }
+ }
return true;
}
/*}}}*/
@@ -1277,6 +1337,8 @@ int main(int argc,const char *argv[])
{'q',"quiet","quiet",CommandLine::IntLevel},
{'q',"silent","quiet",CommandLine::IntLevel},
{'d',"download-only","APT::Get::Download-Only",0},
+ {'b',"compile","APT::Get::Compile",0},
+ {'b',"build","APT::Get::Compile",0},
{'s',"simulate","APT::Get::Simulate",0},
{'s',"just-print","APT::Get::Simulate",0},
{'s',"recon","APT::Get::Simulate",0},
diff --git a/doc/apt-get.8.yo b/doc/apt-get.8.yo
index 3e6e64a49..62f80d754 100644
--- a/doc/apt-get.8.yo
+++ b/doc/apt-get.8.yo
@@ -89,7 +89,10 @@ find and download into the current directory the newest available version of
that source package. Source packages are tracked seperately from binary
packages via df(deb-src) type lines in the bf(/etc/apt/sources.list) file.
This probably will mean that you will not get the same source as the package
-you have installed or as you could install.
+you have installed or as you could install. If the --compile options is
+specified then the package will be compiled to a binary .deb using
+dpkg-buildpackage, if --download-only is specified then the source package
+will not be unpacked.
dit(bf(check))
bf(check) is a diagnostic tool; it updates the package cache and checks for
@@ -173,6 +176,9 @@ dit(bf(-u, --show-upgraded))
Show upgraded packages; Print out a list of all packages that are to be
upgraded. See bf(APT::Get::Show-Upgraded).
+dit(bf(-b, --compile, --build))
+Compile source packages after downloading them.
+
dit(bf(--ignore-hold))
Ignore package Holds; This causes bf(apt-get) to ignore a hold placed on
a package. This may be usefull in conjunction with bf(dist-upgrade) to
diff --git a/doc/apt.conf.5.yo b/doc/apt.conf.5.yo
index b089f9b0a..9e14b861c 100644
--- a/doc/apt.conf.5.yo
+++ b/doc/apt.conf.5.yo
@@ -150,7 +150,8 @@ gives the location of the sourcelist and bf(main) is the default configuration
file (setting has no effect)
Binary programs are pointed to by bf(Dir::Bin). bf(methods) specifies the
-location of the method handlers and bf(gzip), bf(dpkg), bf(apt-get), and
+location of the method handlers and bf(gzip), bf(dpkg), bf(apt-get),
+bf(dpkg-source), bf(dpkg-buildpackage) and
bf(apt-cache) specify the location of the respective programs.
manpagesection(APT in DSelect)
@@ -194,6 +195,10 @@ are invoked in order using /bin/sh, should any fail APT will abort.
dit(bf(Run-Directory))
APT chdirs to this directory before invoking dpkg, the default is /.
+dit(bf(Build-Options))
+These options are passed to dpkg-buildpackage when compiling packages,
+the default is to disable signing and produce all binaries.
+
enddit()
manpagesection(Debug Options)
diff --git a/doc/examples/apt.conf b/doc/examples/apt.conf
index 93426736a..a295e59ea 100644
--- a/doc/examples/apt.conf
+++ b/doc/examples/apt.conf
@@ -1,4 +1,4 @@
-// $Id: apt.conf,v 1.31 1999/04/11 21:23:10 jgg Exp $
+// $Id: apt.conf,v 1.32 1999/04/19 06:03:09 jgg Exp $
/* This file is an index of all APT configuration directives. It should
NOT actually be used as a real config file, though it is a completely
valid file.
@@ -32,6 +32,7 @@ APT
Show-Upgraded "false";
No-Upgrade "false";
Print-URIs "false";
+ Compile "false";
};
Cache
@@ -139,6 +140,8 @@ Dir
methods "/usr/lib/apt/methods/";
gzip "/bin/gzip";
dpkg "/usr/bin/dpkg";
+ dpkg-source "/usr/bin/dpkg-source";
+ dpkg-buildpackage "/usr/bin/dpkg-buildpackage"
apt-get "/usr/bin/apt-get";
apt-cache "/usr/bin/apt-cache";
};
@@ -164,6 +167,9 @@ DPkg
// Prevents daemons from getting cwd as something mountable (default)
Run-Directory "/";
+
+ // Build options for apt-get source --compile
+ Build-Options "-b -uc";
}
/* Options you can set to see some debugging text They corrispond to names