summaryrefslogtreecommitdiff
path: root/cmdline
diff options
context:
space:
mode:
Diffstat (limited to 'cmdline')
-rw-r--r--cmdline/acqprogress.cc2
-rw-r--r--cmdline/apt-cache.cc103
-rw-r--r--cmdline/apt-cdrom.cc205
-rw-r--r--cmdline/apt-config.cc17
-rw-r--r--cmdline/apt-dump-solver.cc8
-rw-r--r--cmdline/apt-extracttemplates.cc37
-rw-r--r--cmdline/apt-extracttemplates.h3
-rw-r--r--cmdline/apt-get.cc167
-rw-r--r--cmdline/apt-helper.cc125
-rw-r--r--cmdline/apt-internal-solver.cc18
-rw-r--r--cmdline/apt-key.in29
-rw-r--r--cmdline/apt-mark.cc46
-rw-r--r--cmdline/apt-sortpkgs.cc10
-rw-r--r--cmdline/apt.cc89
-rw-r--r--cmdline/makefile40
15 files changed, 527 insertions, 372 deletions
diff --git a/cmdline/acqprogress.cc b/cmdline/acqprogress.cc
index 3ac350aca..c362c1edf 100644
--- a/cmdline/acqprogress.cc
+++ b/cmdline/acqprogress.cc
@@ -10,12 +10,14 @@
// Include files /*{{{*/
#include<config.h>
+#include <apt-pkg/acquire.h>
#include <apt-pkg/acquire-item.h>
#include <apt-pkg/acquire-worker.h>
#include <apt-pkg/configuration.h>
#include <apt-pkg/strutl.h>
#include <apt-pkg/error.h>
+#include <string.h>
#include <stdio.h>
#include <signal.h>
#include <iostream>
diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc
index b8892d23d..84b775390 100644
--- a/cmdline/apt-cache.cc
+++ b/cmdline/apt-cache.cc
@@ -15,40 +15,49 @@
// Include Files /*{{{*/
#include<config.h>
-#include <apt-pkg/error.h>
+#include <apt-pkg/algorithms.h>
#include <apt-pkg/cachefile.h>
#include <apt-pkg/cacheset.h>
-#include <apt-pkg/init.h>
-#include <apt-pkg/progress.h>
-#include <apt-pkg/sourcelist.h>
#include <apt-pkg/cmndline.h>
-#include <apt-pkg/strutl.h>
+#include <apt-pkg/error.h>
#include <apt-pkg/fileutl.h>
+#include <apt-pkg/indexfile.h>
+#include <apt-pkg/init.h>
+#include <apt-pkg/metaindex.h>
#include <apt-pkg/pkgrecords.h>
-#include <apt-pkg/srcrecords.h>
-#include <apt-pkg/version.h>
+#include <apt-pkg/pkgsystem.h>
#include <apt-pkg/policy.h>
-#include <apt-pkg/tagfile.h>
-#include <apt-pkg/algorithms.h>
+#include <apt-pkg/progress.h>
+#include <apt-pkg/sourcelist.h>
#include <apt-pkg/sptr.h>
-#include <apt-pkg/pkgsystem.h>
-#include <apt-pkg/indexfile.h>
-#include <apt-pkg/metaindex.h>
+#include <apt-pkg/srcrecords.h>
+#include <apt-pkg/strutl.h>
+#include <apt-pkg/tagfile.h>
+#include <apt-pkg/version.h>
+#include <apt-pkg/cacheiterators.h>
+#include <apt-pkg/configuration.h>
+#include <apt-pkg/depcache.h>
+#include <apt-pkg/macros.h>
+#include <apt-pkg/mmap.h>
+#include <apt-pkg/pkgcache.h>
-#include <apt-private/private-list.h>
-#include <apt-private/private-cmndline.h>
-#include <apt-private/private-show.h>
#include <apt-private/private-cacheset.h>
+#include <apt-private/private-cmndline.h>
-#include <cassert>
-#include <locale.h>
-#include <iostream>
-#include <unistd.h>
-#include <errno.h>
#include <regex.h>
+#include <stddef.h>
#include <stdio.h>
-#include <iomanip>
+#include <stdlib.h>
+#include <unistd.h>
#include <algorithm>
+#include <cstring>
+#include <iomanip>
+#include <iostream>
+#include <list>
+#include <map>
+#include <set>
+#include <string>
+#include <vector>
#include <apti18n.h>
/*}}}*/
@@ -58,7 +67,7 @@ using namespace std;
// LocalitySort - Sort a version list by package file locality /*{{{*/
// ---------------------------------------------------------------------
/* */
-int LocalityCompare(const void *a, const void *b)
+static int LocalityCompare(const void *a, const void *b)
{
pkgCache::VerFile *A = *(pkgCache::VerFile **)a;
pkgCache::VerFile *B = *(pkgCache::VerFile **)b;
@@ -75,13 +84,13 @@ int LocalityCompare(const void *a, const void *b)
return A->File - B->File;
}
-void LocalitySort(pkgCache::VerFile **begin,
+static void LocalitySort(pkgCache::VerFile **begin,
unsigned long Count,size_t Size)
{
qsort(begin,Count,Size,LocalityCompare);
}
-void LocalitySort(pkgCache::DescFile **begin,
+static void LocalitySort(pkgCache::DescFile **begin,
unsigned long Count,size_t Size)
{
qsort(begin,Count,Size,LocalityCompare);
@@ -90,7 +99,7 @@ void LocalitySort(pkgCache::DescFile **begin,
// UnMet - Show unmet dependencies /*{{{*/
// ---------------------------------------------------------------------
/* */
-bool ShowUnMet(pkgCache::VerIterator const &V, bool const Important)
+static bool ShowUnMet(pkgCache::VerIterator const &V, bool const Important)
{
bool Header = false;
for (pkgCache::DepIterator D = V.DependsList(); D.end() == false;)
@@ -163,7 +172,7 @@ bool ShowUnMet(pkgCache::VerIterator const &V, bool const Important)
}
return true;
}
-bool UnMet(CommandLine &CmdL)
+static bool UnMet(CommandLine &CmdL)
{
bool const Important = _config->FindB("APT::Cache::Important",false);
@@ -193,7 +202,7 @@ bool UnMet(CommandLine &CmdL)
// DumpPackage - Show a dump of a package record /*{{{*/
// ---------------------------------------------------------------------
/* */
-bool DumpPackage(CommandLine &CmdL)
+static bool DumpPackage(CommandLine &CmdL)
{
pkgCacheFile CacheFile;
APT::CacheSetHelper helper(true, GlobalError::NOTICE);
@@ -258,7 +267,7 @@ bool DumpPackage(CommandLine &CmdL)
// Stats - Dump some nice statistics /*{{{*/
// ---------------------------------------------------------------------
/* */
-bool Stats(CommandLine &Cmd)
+static bool Stats(CommandLine &)
{
pkgCacheFile CacheFile;
pkgCache *Cache = CacheFile.GetPkgCache();
@@ -371,7 +380,7 @@ bool Stats(CommandLine &Cmd)
// Dump - show everything /*{{{*/
// ---------------------------------------------------------------------
/* This is worthless except fer debugging things */
-bool Dump(CommandLine &Cmd)
+static bool Dump(CommandLine &)
{
pkgCacheFile CacheFile;
pkgCache *Cache = CacheFile.GetPkgCache();
@@ -423,7 +432,7 @@ bool Dump(CommandLine &Cmd)
// ---------------------------------------------------------------------
/* This is needed to make dpkg --merge happy.. I spent a bit of time to
make this run really fast, perhaps I went a little overboard.. */
-bool DumpAvail(CommandLine &Cmd)
+static bool DumpAvail(CommandLine &)
{
pkgCacheFile CacheFile;
pkgCache *Cache = CacheFile.GetPkgCache();
@@ -532,7 +541,7 @@ bool DumpAvail(CommandLine &Cmd)
if ((File->Flags & pkgCache::Flag::NotSource) == pkgCache::Flag::NotSource)
{
pkgTagSection Tags;
- TFRewriteData RW[] = {{"Status",0},{"Config-Version",0},{}};
+ TFRewriteData RW[] = {{"Status", NULL, NULL},{"Config-Version", NULL, NULL},{NULL, NULL, NULL}};
const char *Zero = 0;
if (Tags.Scan(Buffer+Jitter,VF.Size+1) == false ||
TFRewrite(stdout,Tags,&Zero,RW) == false)
@@ -562,7 +571,7 @@ bool DumpAvail(CommandLine &Cmd)
}
/*}}}*/
// ShowDepends - Helper for printing out a dependency tree /*{{{*/
-bool ShowDepends(CommandLine &CmdL, bool const RevDepends)
+static bool ShowDepends(CommandLine &CmdL, bool const RevDepends)
{
pkgCacheFile CacheFile;
pkgCache *Cache = CacheFile.GetPkgCache();
@@ -676,7 +685,7 @@ bool ShowDepends(CommandLine &CmdL, bool const RevDepends)
// Depends - Print out a dependency tree /*{{{*/
// ---------------------------------------------------------------------
/* */
-bool Depends(CommandLine &CmdL)
+static bool Depends(CommandLine &CmdL)
{
return ShowDepends(CmdL, false);
}
@@ -684,7 +693,7 @@ bool Depends(CommandLine &CmdL)
// RDepends - Print out a reverse dependency tree /*{{{*/
// ---------------------------------------------------------------------
/* */
-bool RDepends(CommandLine &CmdL)
+static bool RDepends(CommandLine &CmdL)
{
return ShowDepends(CmdL, true);
}
@@ -693,7 +702,7 @@ bool RDepends(CommandLine &CmdL)
// ---------------------------------------------------------------------
// Code contributed from Junichi Uekawa <dancer@debian.org> on 20 June 2002.
-bool XVcg(CommandLine &CmdL)
+static bool XVcg(CommandLine &CmdL)
{
pkgCacheFile CacheFile;
pkgCache *Cache = CacheFile.GetPkgCache();
@@ -905,7 +914,7 @@ bool XVcg(CommandLine &CmdL)
/* Dotty is the graphvis program for generating graphs. It is a fairly
simple queuing algorithm that just writes dependencies and nodes.
http://www.research.att.com/sw/tools/graphviz/ */
-bool Dotty(CommandLine &CmdL)
+static bool Dotty(CommandLine &CmdL)
{
pkgCacheFile CacheFile;
pkgCache *Cache = CacheFile.GetPkgCache();
@@ -1109,7 +1118,7 @@ bool Dotty(CommandLine &CmdL)
/* This displays the package record from the proper package index file.
It is not used by DumpAvail for performance reasons. */
-static unsigned char const* skipDescriptionFields(unsigned char const * DescP)
+static APT_PURE unsigned char const* skipDescriptionFields(unsigned char const * DescP)
{
char const * const TagName = "\nDescription";
size_t const TagLen = strlen(TagName);
@@ -1126,7 +1135,7 @@ static unsigned char const* skipDescriptionFields(unsigned char const * DescP)
++DescP;
return DescP;
}
-bool DisplayRecord(pkgCacheFile &CacheFile, pkgCache::VerIterator V)
+static bool DisplayRecord(pkgCacheFile &CacheFile, pkgCache::VerIterator V)
{
pkgCache *Cache = CacheFile.GetPkgCache();
if (unlikely(Cache == NULL))
@@ -1228,7 +1237,7 @@ struct ExDescFile
// Search - Perform a search /*{{{*/
// ---------------------------------------------------------------------
/* This searches the package names and package descriptions for a pattern */
-bool Search(CommandLine &CmdL)
+static bool Search(CommandLine &CmdL)
{
bool const ShowFull = _config->FindB("APT::Cache::ShowFull",false);
bool const NamesOnly = _config->FindB("APT::Cache::NamesOnly",false);
@@ -1388,7 +1397,7 @@ bool Search(CommandLine &CmdL)
}
/*}}}*/
/* ShowAuto - show automatically installed packages (sorted) {{{*/
-bool ShowAuto(CommandLine &CmdL)
+static bool ShowAuto(CommandLine &)
{
pkgCacheFile CacheFile;
pkgCache *Cache = CacheFile.GetPkgCache();
@@ -1415,7 +1424,7 @@ bool ShowAuto(CommandLine &CmdL)
// ShowPackage - Dump the package record to the screen /*{{{*/
// ---------------------------------------------------------------------
/* */
-bool ShowPackage(CommandLine &CmdL)
+static bool ShowPackage(CommandLine &CmdL)
{
pkgCacheFile CacheFile;
CacheSetHelperVirtuals helper(true, GlobalError::NOTICE);
@@ -1439,7 +1448,7 @@ bool ShowPackage(CommandLine &CmdL)
// ShowPkgNames - Show package names /*{{{*/
// ---------------------------------------------------------------------
/* This does a prefix match on the first argument */
-bool ShowPkgNames(CommandLine &CmdL)
+static bool ShowPkgNames(CommandLine &CmdL)
{
pkgCacheFile CacheFile;
if (unlikely(CacheFile.BuildCaches(NULL, false) == false))
@@ -1478,7 +1487,7 @@ bool ShowPkgNames(CommandLine &CmdL)
// ShowSrcPackage - Show source package records /*{{{*/
// ---------------------------------------------------------------------
/* */
-bool ShowSrcPackage(CommandLine &CmdL)
+static bool ShowSrcPackage(CommandLine &CmdL)
{
pkgCacheFile CacheFile;
pkgSourceList *List = CacheFile.GetSourceList();
@@ -1515,7 +1524,7 @@ bool ShowSrcPackage(CommandLine &CmdL)
// Policy - Show the results of the preferences file /*{{{*/
// ---------------------------------------------------------------------
/* */
-bool Policy(CommandLine &CmdL)
+static bool Policy(CommandLine &CmdL)
{
pkgCacheFile CacheFile;
pkgCache *Cache = CacheFile.GetPkgCache();
@@ -1644,7 +1653,7 @@ bool Policy(CommandLine &CmdL)
// Madison - Look a bit like katie's madison /*{{{*/
// ---------------------------------------------------------------------
/* */
-bool Madison(CommandLine &CmdL)
+static bool Madison(CommandLine &CmdL)
{
pkgCacheFile CacheFile;
pkgSourceList *SrcList = CacheFile.GetSourceList();
@@ -1717,7 +1726,7 @@ bool Madison(CommandLine &CmdL)
// GenCaches - Call the main cache generator /*{{{*/
// ---------------------------------------------------------------------
/* */
-bool GenCaches(CommandLine &Cmd)
+static bool GenCaches(CommandLine &)
{
OpTextProgress Progress(*_config);
@@ -1728,7 +1737,7 @@ bool GenCaches(CommandLine &Cmd)
// ShowHelp - Show a help screen /*{{{*/
// ---------------------------------------------------------------------
/* */
-bool ShowHelp(CommandLine &Cmd)
+static bool ShowHelp(CommandLine &)
{
ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION,
COMMON_ARCH,__DATE__,__TIME__);
diff --git a/cmdline/apt-cdrom.cc b/cmdline/apt-cdrom.cc
index 17a60ddcb..53efe65b8 100644
--- a/cmdline/apt-cdrom.cc
+++ b/cmdline/apt-cdrom.cc
@@ -20,33 +20,20 @@
#include <apt-pkg/progress.h>
#include <apt-pkg/cdromutl.h>
#include <apt-pkg/strutl.h>
-#include <apt-pkg/acquire.h>
-#include <apt-pkg/acquire-item.h>
#include <apt-pkg/cdrom.h>
#include <apt-pkg/configuration.h>
#include <apt-pkg/pkgsystem.h>
-#include <locale.h>
#include <iostream>
-#include <fstream>
#include <vector>
-#include <algorithm>
+#include <string>
#include <sys/stat.h>
-#include <fcntl.h>
-#include <dirent.h>
#include <unistd.h>
-#include <stdio.h>
#include <apt-private/private-cmndline.h>
#include <apti18n.h>
/*}}}*/
-static const char *W_NO_CDROM_FOUND = \
- N_("No CD-ROM could be auto-detected or found using "
- "the default mount point.\n"
- "You may try the --cdrom option to set the CD-ROM mount point. "
- "See 'man apt-cdrom' for more "
- "information about the CD-ROM auto-detection and mount point.");
using namespace std;
@@ -54,7 +41,7 @@ class pkgCdromTextStatus : public pkgCdromStatus /*{{{*/
{
protected:
OpTextProgress Progress;
- void Prompt(const char *Text);
+ void Prompt(const char *Text);
string PromptLine(const char *Text);
bool AskCdromName(string &name);
@@ -64,12 +51,12 @@ public:
virtual OpProgress* GetOpProgress();
};
-void pkgCdromTextStatus::Prompt(const char *Text)
+void pkgCdromTextStatus::Prompt(const char *Text)
{
char C;
cout << Text << ' ' << flush;
if (read(STDIN_FILENO,&C,1) < 0)
- _error->Errno("pkgCdromTextStatus::Prompt",
+ _error->Errno("pkgCdromTextStatus::Prompt",
"Failed to read from standard input (not a terminal?)");
if (C != '\n')
cout << endl;
@@ -78,134 +65,144 @@ void pkgCdromTextStatus::Prompt(const char *Text)
string pkgCdromTextStatus::PromptLine(const char *Text)
{
cout << Text << ':' << endl;
-
+
string Res;
getline(cin,Res);
return Res;
}
-bool pkgCdromTextStatus::AskCdromName(string &name)
+bool pkgCdromTextStatus::AskCdromName(string &name)
{
cout << _("Please provide a name for this Disc, such as 'Debian 5.0.3 Disk 1'") << flush;
name = PromptLine("");
-
+
return true;
}
-
-void pkgCdromTextStatus::Update(string text, int current)
+
+void pkgCdromTextStatus::Update(string text, int /*current*/)
{
if(text.size() > 0)
cout << text << flush;
}
-bool pkgCdromTextStatus::ChangeCdrom()
+bool pkgCdromTextStatus::ChangeCdrom()
{
Prompt(_("Please insert a Disc in the drive and press enter"));
return true;
}
-OpProgress* pkgCdromTextStatus::GetOpProgress()
-{
- return &Progress;
-};
+APT_CONST OpProgress* pkgCdromTextStatus::GetOpProgress()
+{
+ return &Progress;
+}
/*}}}*/
-// SetupAutoDetect /*{{{*/
-bool AutoDetectCdrom(pkgUdevCdromDevices &UdevCdroms, unsigned int &i)
+// AddOrIdent - Add or Ident a CDROM /*{{{*/
+static bool AddOrIdent(bool const Add)
{
- bool Debug = _config->FindB("Debug::Acquire::cdrom", false);
+ pkgUdevCdromDevices UdevCdroms;
+ pkgCdromTextStatus log;
+ pkgCdrom cdrom;
- vector<struct CdromDevice> v = UdevCdroms.Scan();
- if (i >= v.size())
- return false;
+ bool oneSuccessful = false;
+ bool AutoDetect = _config->FindB("Acquire::cdrom::AutoDetect", true);
+ if (AutoDetect == true && UdevCdroms.Dlopen() == true)
+ {
+ bool const Debug = _config->FindB("Debug::Acquire::cdrom", false);
+ std::string const CDMount = _config->Find("Acquire::cdrom::mount");
+ bool const NoMount = _config->FindB("APT::CDROM::NoMount", false);
+ if (NoMount == false)
+ _config->Set("APT::CDROM::NoMount", true);
+
+ vector<struct CdromDevice> const v = UdevCdroms.Scan();
+ for (std::vector<struct CdromDevice>::const_iterator cd = v.begin(); cd != v.end(); ++cd)
+ {
+ if (Debug)
+ clog << "Looking at device:"
+ << "\tDeviveName: '" << cd->DeviceName << "'"
+ << "\tIsMounted: '" << cd->Mounted << "'"
+ << "\tMountPoint: '" << cd->MountPath << "'"
+ << endl;
+
+ std::string AptMountPoint;
+ if (cd->Mounted)
+ _config->Set("Acquire::cdrom::mount", cd->MountPath);
+ else if (NoMount == true)
+ continue;
+ else
+ {
+ AptMountPoint = _config->FindDir("Dir::Media::MountPath");
+ if (FileExists(AptMountPoint) == false)
+ mkdir(AptMountPoint.c_str(), 0750);
+ if(MountCdrom(AptMountPoint, cd->DeviceName) == false)
+ {
+ _error->Warning(_("Failed to mount '%s' to '%s'"), cd->DeviceName.c_str(), AptMountPoint.c_str());
+ continue;
+ }
+ _config->Set("Acquire::cdrom::mount", AptMountPoint);
+ }
+
+ _error->PushToStack();
+ if (Add == true)
+ oneSuccessful = cdrom.Add(&log);
+ else
+ {
+ std::string id;
+ oneSuccessful = cdrom.Ident(id, &log);
+ }
+ _error->MergeWithStack();
- if (Debug)
- clog << "Looking at devce " << i
- << " DeviveName: " << v[i].DeviceName
- << " IsMounted: '" << v[i].Mounted << "'"
- << " MountPoint: '" << v[i].MountPath << "'"
- << endl;
+ if (AptMountPoint.empty() == false)
+ UnmountCdrom(AptMountPoint);
+ }
+ if (NoMount == false)
+ _config->Set("APT::CDROM::NoMount", NoMount);
+ _config->Set("Acquire::cdrom::mount", CDMount);
+ }
- if (v[i].Mounted)
+ // fallback if auto-detect didn't work
+ if (oneSuccessful == false)
{
- // set the right options
- _config->Set("Acquire::cdrom::mount", v[i].MountPath);
- _config->Set("APT::CDROM::NoMount", true);
- } else {
- string AptMountPoint = _config->FindDir("Dir::Media::MountPath");
- if (!FileExists(AptMountPoint))
- mkdir(AptMountPoint.c_str(), 0750);
- if(MountCdrom(AptMountPoint, v[i].DeviceName) == false)
- _error->Warning(_("Failed to mount '%s' to '%s'"), v[i].DeviceName.c_str(), AptMountPoint.c_str());
- _config->Set("Acquire::cdrom::mount", AptMountPoint);
- _config->Set("APT::CDROM::NoMount", true);
+ _error->PushToStack();
+ if (Add == true)
+ oneSuccessful = cdrom.Add(&log);
+ else
+ {
+ std::string id;
+ oneSuccessful = cdrom.Ident(id, &log);
+ }
+ _error->MergeWithStack();
}
- i++;
- return true;
+ if (oneSuccessful == false)
+ _error->Error("%s", _("No CD-ROM could be auto-detected or found using the default mount point.\n"
+ "You may try the --cdrom option to set the CD-ROM mount point.\n"
+ "See 'man apt-cdrom' for more information about the CD-ROM auto-detection and mount point."));
+ else if (Add == true)
+ cout << _("Repeat this process for the rest of the CDs in your set.") << endl;
+
+ return oneSuccessful;
}
/*}}}*/
// DoAdd - Add a new CDROM /*{{{*/
// ---------------------------------------------------------------------
/* This does the main add bit.. We show some status and things. The
- sequence is to mount/umount the CD, Ident it then scan it for package
+ sequence is to mount/umount the CD, Ident it then scan it for package
files and reduce that list. Then we copy over the package files and
verify them. Then rewrite the database files */
-bool DoAdd(CommandLine &)
+static bool DoAdd(CommandLine &)
{
- pkgUdevCdromDevices UdevCdroms;
- pkgCdromTextStatus log;
- pkgCdrom cdrom;
- bool res = true;
-
- bool AutoDetect = _config->FindB("Acquire::cdrom::AutoDetect", true);
- unsigned int count = 0;
- if (AutoDetect && UdevCdroms.Dlopen())
- while (AutoDetectCdrom(UdevCdroms, count))
- res &= cdrom.Add(&log);
- if (count == 0) {
- res = cdrom.Add(&log);
- if (res == false) {
- _error->Error("%s", _(W_NO_CDROM_FOUND));
- }
- }
-
- if(res)
- cout << _("Repeat this process for the rest of the CDs in your set.") << endl;
-
- return res;
+ return AddOrIdent(true);
}
/*}}}*/
// DoIdent - Ident a CDROM /*{{{*/
-// ---------------------------------------------------------------------
-/* */
-bool DoIdent(CommandLine &)
+static bool DoIdent(CommandLine &)
{
- pkgUdevCdromDevices UdevCdroms;
- string ident;
- pkgCdromTextStatus log;
- pkgCdrom cdrom;
- bool res = true;
-
- bool AutoDetect = _config->FindB("Acquire::cdrom::AutoDetect");
-
- unsigned int count = 0;
- if (AutoDetect && UdevCdroms.Dlopen())
- while (AutoDetectCdrom(UdevCdroms, count))
- res &= cdrom.Ident(ident, &log);
- if (count == 0) {
- res = cdrom.Ident(ident, &log);
- if (res == false) {
- _error->Error("%s", _(W_NO_CDROM_FOUND));
- }
- }
- return res;
+ return AddOrIdent(false);
}
/*}}}*/
// ShowHelp - Show the help screen /*{{{*/
-// ---------------------------------------------------------------------
-/* */
-bool ShowHelp(CommandLine &)
+static bool ShowHelp(CommandLine &)
{
ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION,
COMMON_ARCH,__DATE__,__TIME__);
@@ -271,14 +268,12 @@ int main(int argc,const char *argv[]) /*{{{*/
_config->Set("quiet","1");
// Match the operation
- CmdL.DispatchArg(Cmds);
+ bool returned = CmdL.DispatchArg(Cmds);
- // Print any errors or warnings found during parsing
- bool const Errors = _error->PendingError();
if (_config->FindI("quiet",0) > 0)
_error->DumpErrors();
else
_error->DumpErrors(GlobalError::DEBUG);
- return Errors == true ? 100 : 0;
+ return returned == true ? 0 : 100;
}
/*}}}*/
diff --git a/cmdline/apt-config.cc b/cmdline/apt-config.cc
index 3481eaf5f..40ba468eb 100644
--- a/cmdline/apt-config.cc
+++ b/cmdline/apt-config.cc
@@ -8,7 +8,7 @@
This program will parse a config file and then do something with it.
Commands:
- shell - Shell mode. After this a series of word pairs should occure.
+ shell - Shell mode. After this a series of word pairs should occur.
The first is the environment var to set and the second is
the key to set it from. Use like:
eval `apt-config shell QMode apt::QMode`
@@ -26,10 +26,10 @@
#include <apt-pkg/aptconfiguration.h>
#include <apt-pkg/pkgsystem.h>
-#include <locale.h>
#include <iostream>
#include <string>
#include <vector>
+#include <string.h>
#include <apt-private/private-cmndline.h>
@@ -40,7 +40,7 @@ using namespace std;
// DoShell - Handle the shell command /*{{{*/
// ---------------------------------------------------------------------
/* */
-bool DoShell(CommandLine &CmdL)
+static bool DoShell(CommandLine &CmdL)
{
for (const char **I = CmdL.FileList + 1; *I != 0; I += 2)
{
@@ -63,7 +63,7 @@ bool DoShell(CommandLine &CmdL)
// DoDump - Dump the configuration space /*{{{*/
// ---------------------------------------------------------------------
/* */
-bool DoDump(CommandLine &CmdL)
+static bool DoDump(CommandLine &CmdL)
{
bool const empty = _config->FindB("APT::Config::Dump::EmptyValue", true);
std::string const format = _config->Find("APT::Config::Dump::Format", "%f \"%v\";\n");
@@ -78,7 +78,7 @@ bool DoDump(CommandLine &CmdL)
// ShowHelp - Show the help screen /*{{{*/
// ---------------------------------------------------------------------
/* */
-bool ShowHelp(CommandLine &CmdL)
+static bool ShowHelp(CommandLine &)
{
ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION,
COMMON_ARCH,__DATE__,__TIME__);
@@ -108,7 +108,7 @@ int main(int argc,const char *argv[]) /*{{{*/
{"help",&ShowHelp},
{0,0}};
- std::vector<CommandLine::Args> Args = getCommandArgs("apt-cdrom", CommandLine::GetCommand(Cmds, argc, argv));
+ std::vector<CommandLine::Args> Args = getCommandArgs("apt-config", CommandLine::GetCommand(Cmds, argc, argv));
// Set up gettext support
setlocale(LC_ALL,"");
@@ -155,6 +155,11 @@ int main(int argc,const char *argv[]) /*{{{*/
_config->Set(comp + "UncompressArg::", *a);
}
+ std::vector<std::string> const profiles = APT::Configuration::getBuildProfiles();
+ _config->Clear("APT::Build-Profiles");
+ for (std::vector<std::string>::const_iterator p = profiles.begin(); p != profiles.end(); ++p)
+ _config->Set("APT::Build-Profiles::", *p);
+
// Match the operation
CmdL.DispatchArg(Cmds);
diff --git a/cmdline/apt-dump-solver.cc b/cmdline/apt-dump-solver.cc
index aa16b1271..04e13bde9 100644
--- a/cmdline/apt-dump-solver.cc
+++ b/cmdline/apt-dump-solver.cc
@@ -9,16 +9,18 @@
// Include Files /*{{{*/
#include <apt-pkg/edsp.h>
-#include <config.h>
-
+#include <string.h>
+#include <unistd.h>
#include <cstdio>
#include <iostream>
+
+#include <config.h>
/*}}}*/
// ShowHelp - Show a help screen /*{{{*/
// ---------------------------------------------------------------------
/* */
-bool ShowHelp() {
+static bool ShowHelp() {
std::cout <<
PACKAGE " " PACKAGE_VERSION " for " COMMON_ARCH " compiled on " __DATE__ " " __TIME__ << std::endl <<
diff --git a/cmdline/apt-extracttemplates.cc b/cmdline/apt-extracttemplates.cc
index 8e1937113..a82623444 100644
--- a/cmdline/apt-extracttemplates.cc
+++ b/cmdline/apt-extracttemplates.cc
@@ -18,27 +18,25 @@
#include <apt-pkg/init.h>
#include <apt-pkg/cmndline.h>
#include <apt-pkg/pkgcache.h>
+#include <apt-pkg/cacheiterators.h>
#include <apt-pkg/configuration.h>
-#include <apt-pkg/progress.h>
#include <apt-pkg/sourcelist.h>
#include <apt-pkg/pkgcachegen.h>
#include <apt-pkg/version.h>
#include <apt-pkg/tagfile.h>
-#include <apt-pkg/extracttar.h>
-#include <apt-pkg/arfile.h>
+#include <apt-pkg/debfile.h>
#include <apt-pkg/deblistparser.h>
#include <apt-pkg/error.h>
#include <apt-pkg/strutl.h>
#include <apt-pkg/fileutl.h>
#include <apt-pkg/pkgsystem.h>
+#include <apt-pkg/dirstream.h>
+#include <apt-pkg/mmap.h>
+#include <iostream>
#include <stdio.h>
#include <string.h>
-#include <stdlib.h>
#include <unistd.h>
-#include <locale.h>
-
-#include <fstream>
#include "apt-extracttemplates.h"
@@ -91,18 +89,9 @@ string DebFile::GetInstalledVer(const string &package)
/* */
bool DebFile::Go()
{
- ARArchive AR(File);
- if (_error->PendingError() == true)
- return false;
-
- const ARArchive::Member *Member = AR.FindMember("control.tar.gz");
- if (Member == 0)
- return _error->Error(_("%s not a valid DEB package."),File.Name().c_str());
-
- if (File.Seek(Member->Start) == false)
- return false;
- ExtractTar Tar(File, Member->Size,"gzip");
- return Tar.Go(*this);
+ debDebFile Deb(File);
+
+ return Deb.ExtractTarMember(*this, "control.tar");
}
/*}}}*/
// DebFile::DoItem examine element in package and mark /*{{{*/
@@ -147,7 +136,7 @@ bool DebFile::DoItem(Item &I, int &Fd)
// DebFile::Process examine element in package and copy /*{{{*/
// ---------------------------------------------------------------------
/* */
-bool DebFile::Process(Item &I, const unsigned char *data,
+bool DebFile::Process(Item &/*I*/, const unsigned char *data,
unsigned long size, unsigned long pos)
{
switch (Which)
@@ -222,7 +211,7 @@ bool DebFile::ParseInfo()
// ShowHelp - show a short help text /*{{{*/
// ---------------------------------------------------------------------
/* */
-int ShowHelp(void)
+static int ShowHelp(void)
{
ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION,
COMMON_ARCH,__DATE__,__TIME__);
@@ -247,7 +236,7 @@ int ShowHelp(void)
// WriteFile - write the contents of the passed string to a file /*{{{*/
// ---------------------------------------------------------------------
/* */
-string WriteFile(const char *package, const char *prefix, const char *data)
+static string WriteFile(const char *package, const char *prefix, const char *data)
{
char fn[512];
static int i;
@@ -275,7 +264,7 @@ string WriteFile(const char *package, const char *prefix, const char *data)
// WriteConfig - write out the config data from a debian package file /*{{{*/
// ---------------------------------------------------------------------
/* */
-void WriteConfig(const DebFile &file)
+static void WriteConfig(const DebFile &file)
{
string templatefile = WriteFile(file.Package.c_str(), "template", file.Template);
string configscript = WriteFile(file.Package.c_str(), "config", file.Config);
@@ -289,7 +278,7 @@ void WriteConfig(const DebFile &file)
// InitCache - initialize the package cache /*{{{*/
// ---------------------------------------------------------------------
/* */
-bool Go(CommandLine &CmdL)
+static bool Go(CommandLine &CmdL)
{
// Initialize the apt cache
MMap *Map = 0;
diff --git a/cmdline/apt-extracttemplates.h b/cmdline/apt-extracttemplates.h
index 6d07a09c2..9cc3f5f25 100644
--- a/cmdline/apt-extracttemplates.h
+++ b/cmdline/apt-extracttemplates.h
@@ -11,11 +11,12 @@
#define _APTEXTRACTTEMPLATE_H_
#include <apt-pkg/fileutl.h>
-#include <apt-pkg/pkgcache.h>
#include <apt-pkg/dirstream.h>
#include <string>
+class pkgCache;
+
class DebFile : public pkgDirStream
{
FileFd File;
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc
index 8a0772ce2..caf69da2a 100644
--- a/cmdline/apt-get.cc
+++ b/cmdline/apt-get.cc
@@ -15,7 +15,7 @@
upgrade - Smart-Download the newest versions of all packages
dselect-upgrade - Follows dselect's changes to the Status: field
and installes new and removes old packages
- dist-upgrade - Powerfull upgrader designed to handle the issues with
+ dist-upgrade - Powerful upgrader designed to handle the issues with
a new distribution.
install - Download and install a given package (by name, not by .deb)
check - Update the package cache and check for broken packages
@@ -27,66 +27,67 @@
// Include Files /*{{{*/
#include <config.h>
+#include <apt-pkg/acquire-item.h>
+#include <apt-pkg/algorithms.h>
#include <apt-pkg/aptconfiguration.h>
-#include <apt-pkg/error.h>
+#include <apt-pkg/cachefile.h>
+#include <apt-pkg/cacheset.h>
+#include <apt-pkg/clean.h>
#include <apt-pkg/cmndline.h>
-#include <apt-pkg/init.h>
+#include <apt-pkg/debmetaindex.h>
#include <apt-pkg/depcache.h>
-#include <apt-pkg/sourcelist.h>
-#include <apt-pkg/algorithms.h>
-#include <apt-pkg/acquire-item.h>
-#include <apt-pkg/strutl.h>
+#include <apt-pkg/error.h>
#include <apt-pkg/fileutl.h>
-#include <apt-pkg/clean.h>
-#include <apt-pkg/srcrecords.h>
-#include <apt-pkg/version.h>
-#include <apt-pkg/cachefile.h>
-#include <apt-pkg/cacheset.h>
-#include <apt-pkg/sptr.h>
+#include <apt-pkg/indexfile.h>
+#include <apt-pkg/indexrecords.h>
+#include <apt-pkg/init.h>
#include <apt-pkg/md5.h>
-#include <apt-pkg/versionmatch.h>
-#include <apt-pkg/progress.h>
-#include <apt-pkg/pkgsystem.h>
+#include <apt-pkg/metaindex.h>
#include <apt-pkg/pkgrecords.h>
-#include <apt-pkg/indexfile.h>
+#include <apt-pkg/pkgsystem.h>
+#include <apt-pkg/progress.h>
+#include <apt-pkg/sourcelist.h>
+#include <apt-pkg/srcrecords.h>
+#include <apt-pkg/strutl.h>
+#include <apt-pkg/version.h>
+#include <apt-pkg/acquire.h>
+#include <apt-pkg/configuration.h>
+#include <apt-pkg/macros.h>
+#include <apt-pkg/pkgcache.h>
+#include <apt-pkg/cacheiterators.h>
#include <apt-pkg/upgrade.h>
-#include <apt-pkg/metaindex.h>
-#include <apt-pkg/indexrecords.h>
+#include <apt-private/acqprogress.h>
+#include <apt-private/private-cacheset.h>
+#include <apt-private/private-cachefile.h>
+#include <apt-private/private-cmndline.h>
#include <apt-private/private-download.h>
#include <apt-private/private-install.h>
-#include <apt-private/private-upgrade.h>
+#include <apt-private/private-main.h>
+#include <apt-private/private-moo.h>
#include <apt-private/private-output.h>
-#include <apt-private/private-cacheset.h>
#include <apt-private/private-update.h>
-#include <apt-private/private-cmndline.h>
-#include <apt-private/private-moo.h>
+#include <apt-private/private-upgrade.h>
#include <apt-private/private-utils.h>
-#include <apt-pkg/debmetaindex.h>
-
-#include <apt-private/acqprogress.h>
-
-#include <set>
-#include <fstream>
-#include <sstream>
-
-#include <locale.h>
-#include <langinfo.h>
-#include <termios.h>
+#include <errno.h>
+#include <signal.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <sys/statfs.h>
#include <sys/statvfs.h>
-#include <signal.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <errno.h>
-#include <regex.h>
#include <sys/wait.h>
-
-#include <apt-private/private-output.h>
-#include <apt-private/private-main.h>
+#include <unistd.h>
+#include <algorithm>
+#include <fstream>
+#include <iostream>
+#include <set>
+#include <string>
+#include <vector>
#include <apti18n.h>
/*}}}*/
@@ -97,7 +98,7 @@ using namespace std;
// ---------------------------------------------------------------------
/* This used to be inlined in DoInstall, but with the advent of regex package
name matching it was split out.. */
-bool TryToInstallBuildDep(pkgCache::PkgIterator Pkg,pkgCacheFile &Cache,
+static bool TryToInstallBuildDep(pkgCache::PkgIterator Pkg,pkgCacheFile &Cache,
pkgProblemResolver &Fix,bool Remove,bool BrokenFix,
bool AllowFail = true)
{
@@ -138,7 +139,7 @@ bool TryToInstallBuildDep(pkgCache::PkgIterator Pkg,pkgCacheFile &Cache,
// helper that can go wit hthe next ABI break
#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR < 13)
-std::string MetaIndexFileNameOnDisk(metaIndex *metaindex)
+static std::string MetaIndexFileNameOnDisk(metaIndex *metaindex)
{
// FIXME: this cast is the horror, the horror
debReleaseIndex *r = (debReleaseIndex*)metaindex;
@@ -159,7 +160,7 @@ std::string MetaIndexFileNameOnDisk(metaIndex *metaindex)
// GetReleaseForSourceRecord - Return Suite for the given srcrecord /*{{{*/
// ---------------------------------------------------------------------
/* */
-std::string GetReleaseForSourceRecord(pkgSourceList *SrcList,
+static std::string GetReleaseForSourceRecord(pkgSourceList *SrcList,
pkgSrcRecords::Parser *Parse)
{
// try to find release
@@ -194,7 +195,7 @@ std::string GetReleaseForSourceRecord(pkgSourceList *SrcList,
// FindSrc - Find a source record /*{{{*/
// ---------------------------------------------------------------------
/* */
-pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs,
+static pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs,
pkgSrcRecords &SrcRecs,string &Src,
CacheFile &CacheFile)
{
@@ -430,7 +431,7 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs,
}
/*}}}*/
/* mark packages as automatically/manually installed. {{{*/
-bool DoMarkAuto(CommandLine &CmdL)
+static bool DoMarkAuto(CommandLine &CmdL)
{
bool Action = true;
int AutoMarkChanged = 0;
@@ -475,7 +476,7 @@ bool DoMarkAuto(CommandLine &CmdL)
// DoDSelectUpgrade - Do an upgrade by following dselects selections /*{{{*/
// ---------------------------------------------------------------------
/* Follows dselect's selections */
-bool DoDSelectUpgrade(CommandLine &CmdL)
+static bool DoDSelectUpgrade(CommandLine &)
{
CacheFile Cache;
if (Cache.OpenForInstall() == false || Cache.CheckDeps() == false)
@@ -513,7 +514,7 @@ bool DoDSelectUpgrade(CommandLine &CmdL)
}
/* Resolve any problems that dselect created, allupgrade cannot handle
- such things. We do so quite agressively too.. */
+ such things. We do so quite aggressively too.. */
if (Cache->BrokenCount() != 0)
{
pkgProblemResolver Fix(Cache);
@@ -551,7 +552,7 @@ bool DoDSelectUpgrade(CommandLine &CmdL)
// DoClean - Remove download archives /*{{{*/
// ---------------------------------------------------------------------
/* */
-bool DoClean(CommandLine &CmdL)
+static bool DoClean(CommandLine &)
{
std::string const archivedir = _config->FindDir("Dir::Cache::archives");
std::string const pkgcache = _config->FindFile("Dir::cache::pkgcache");
@@ -599,7 +600,7 @@ class LogCleaner : public pkgArchiveCleaner
};
};
-bool DoAutoClean(CommandLine &CmdL)
+static bool DoAutoClean(CommandLine &)
{
// Lock the archive directory
FileFd Lock;
@@ -623,15 +624,15 @@ bool DoAutoClean(CommandLine &CmdL)
/*}}}*/
// DoDownload - download a binary /*{{{*/
// ---------------------------------------------------------------------
-bool DoDownload(CommandLine &CmdL)
+static bool DoDownload(CommandLine &CmdL)
{
CacheFile Cache;
if (Cache.ReadOnlyOpen() == false)
return false;
APT::CacheSetHelper helper(c0out);
- APT::VersionList verset = APT::VersionList::FromCommandLine(Cache,
- CmdL.FileList + 1, APT::VersionList::CANDIDATE, helper);
+ APT::VersionSet verset = APT::VersionSet::FromCommandLine(Cache,
+ CmdL.FileList + 1, APT::VersionSet::CANDIDATE, helper);
if (verset.empty() == true)
return false;
@@ -650,7 +651,7 @@ bool DoDownload(CommandLine &CmdL)
std::string const cwd = SafeGetCWD();
_config->Set("Dir::Cache::Archives", cwd);
int i = 0;
- for (APT::VersionList::const_iterator Ver = verset.begin();
+ for (APT::VersionSet::const_iterator Ver = verset.begin();
Ver != verset.end(); ++Ver, ++i)
{
pkgAcquire::Item *I = new pkgAcqArchive(&Fetcher, SrcList, &Recs, *Ver, storefile[i]);
@@ -678,14 +679,17 @@ bool DoDownload(CommandLine &CmdL)
// copy files in local sources to the current directory
for (pkgAcquire::ItemIterator I = Fetcher.ItemsBegin(); I != Fetcher.ItemsEnd(); ++I)
- if ((*I)->Local == true && (*I)->Status == pkgAcquire::Item::StatDone)
+ {
+ std::string const filename = cwd + flNotDir((*I)->DestFile);
+ if ((*I)->Local == true &&
+ filename != (*I)->DestFile &&
+ (*I)->Status == pkgAcquire::Item::StatDone)
{
- std::string const filename = cwd + flNotDir((*I)->DestFile);
std::ifstream src((*I)->DestFile.c_str(), std::ios::binary);
std::ofstream dst(filename.c_str(), std::ios::binary);
dst << src.rdbuf();
}
-
+ }
return Failed == false;
}
/*}}}*/
@@ -693,7 +697,7 @@ bool DoDownload(CommandLine &CmdL)
// ---------------------------------------------------------------------
/* Opening automatically checks the system, this command is mostly used
for debugging */
-bool DoCheck(CommandLine &CmdL)
+static bool DoCheck(CommandLine &)
{
CacheFile Cache;
Cache.Open();
@@ -712,7 +716,7 @@ struct DscFile
string Dsc;
};
-bool DoSource(CommandLine &CmdL)
+static bool DoSource(CommandLine &CmdL)
{
CacheFile Cache;
if (Cache.Open(false) == false)
@@ -737,7 +741,7 @@ bool DoSource(CommandLine &CmdL)
pkgAcquire Fetcher;
Fetcher.SetLog(&Stat);
- DscFile *Dsc = new DscFile[CmdL.FileSize()];
+ SPtrArray<DscFile> Dsc = new DscFile[CmdL.FileSize()];
// insert all downloaded uris into this set to avoid downloading them
// twice
@@ -758,7 +762,6 @@ bool DoSource(CommandLine &CmdL)
pkgSrcRecords::Parser *Last = FindSrc(*I,Recs,SrcRecs,Src,Cache);
if (Last == 0) {
- delete[] Dsc;
return _error->Error(_("Unable to find a source package for %s"),Src.c_str());
}
@@ -792,7 +795,6 @@ bool DoSource(CommandLine &CmdL)
// Back track
vector<pkgSrcRecords::File> Lst;
if (Last->Files(Lst) == false) {
- delete[] Dsc;
return false;
}
@@ -855,7 +857,6 @@ bool DoSource(CommandLine &CmdL)
struct statvfs Buf;
string OutputDir = ".";
if (statvfs(OutputDir.c_str(),&Buf) != 0) {
- delete[] Dsc;
if (errno == EOVERFLOW)
return _error->WarningE("statvfs",_("Couldn't determine free space in %s"),
OutputDir.c_str());
@@ -870,7 +871,6 @@ bool DoSource(CommandLine &CmdL)
|| unsigned(Stat.f_type) != RAMFS_MAGIC
#endif
) {
- delete[] Dsc;
return _error->Error(_("You don't have enough free space in %s"),
OutputDir.c_str());
}
@@ -892,7 +892,6 @@ bool DoSource(CommandLine &CmdL)
{
for (unsigned I = 0; I != J; I++)
ioprintf(cout,_("Fetch source %s\n"),Dsc[I].Package.c_str());
- delete[] Dsc;
return true;
}
@@ -903,7 +902,6 @@ bool DoSource(CommandLine &CmdL)
for (; I != Fetcher.UriEnd(); ++I)
cout << '\'' << I->URI << "' " << flNotDir(I->Owner->DestFile) << ' ' <<
I->Owner->FileSize << ' ' << I->Owner->HashSum() << endl;
- delete[] Dsc;
return true;
}
@@ -911,14 +909,12 @@ bool DoSource(CommandLine &CmdL)
bool Failed = false;
if (AcquireRun(Fetcher, 0, &Failed, NULL) == false || Failed == true)
{
- delete[] Dsc;
return _error->Error(_("Failed to fetch some archives."));
}
if (_config->FindB("APT::Get::Download-only",false) == true)
{
c1out << _("Download complete and in download only mode") << endl;
- delete[] Dsc;
return true;
}
@@ -967,6 +963,12 @@ bool DoSource(CommandLine &CmdL)
string buildopts = _config->Find("APT::Get::Host-Architecture");
if (buildopts.empty() == false)
buildopts = "-a" + buildopts + " ";
+
+ // get all active build profiles
+ std::string const profiles = APT::Configuration::getBuildProfilesString();
+ if (profiles.empty() == false)
+ buildopts.append(" -P").append(profiles).append(" ");
+
buildopts.append(_config->Find("DPkg::Build-Options","-b -uc"));
// Call dpkg-buildpackage
@@ -986,7 +988,6 @@ bool DoSource(CommandLine &CmdL)
_exit(0);
}
- delete[] Dsc;
// Wait for the subprocess
int Status = 0;
@@ -1007,7 +1008,7 @@ bool DoSource(CommandLine &CmdL)
// ---------------------------------------------------------------------
/* This function will look at the build depends list of the given source
package and install the necessary packages to make it true, or fail. */
-bool DoBuildDep(CommandLine &CmdL)
+static bool DoBuildDep(CommandLine &CmdL)
{
CacheFile Cache;
@@ -1401,7 +1402,7 @@ bool DoBuildDep(CommandLine &CmdL)
* pool/ next to the deb itself)
* Example return: "pool/main/a/apt/apt_0.8.8ubuntu3"
*/
-string GetChangelogPath(CacheFile &Cache,
+static string GetChangelogPath(CacheFile &Cache,
pkgCache::PkgIterator Pkg,
pkgCache::VerIterator Ver)
{
@@ -1428,7 +1429,7 @@ string GetChangelogPath(CacheFile &Cache,
* apt-get changelog mplayer-doc:
* http://packages.medibuntu.org/pool/non-free/m/mplayer/mplayer_1.0~rc4~try1.dsfg1-1ubuntu1+medibuntu1.changelog
*/
-bool GuessThirdPartyChangelogUri(CacheFile &Cache,
+static bool GuessThirdPartyChangelogUri(CacheFile &Cache,
pkgCache::PkgIterator Pkg,
pkgCache::VerIterator Ver,
string &out_uri)
@@ -1453,7 +1454,7 @@ bool GuessThirdPartyChangelogUri(CacheFile &Cache,
/*}}}*/
// DownloadChangelog - Download the changelog /*{{{*/
// ---------------------------------------------------------------------
-bool DownloadChangelog(CacheFile &CacheFile, pkgAcquire &Fetcher,
+static bool DownloadChangelog(CacheFile &CacheFile, pkgAcquire &Fetcher,
pkgCache::VerIterator Ver, string targetfile)
/* Download a changelog file for the given package version to
* targetfile. This will first try the server from Apt::Changelogs::Server
@@ -1508,7 +1509,7 @@ bool DownloadChangelog(CacheFile &CacheFile, pkgAcquire &Fetcher,
/*}}}*/
// DoChangelog - Get changelog from the command line /*{{{*/
// ---------------------------------------------------------------------
-bool DoChangelog(CommandLine &CmdL)
+static bool DoChangelog(CommandLine &CmdL)
{
CacheFile Cache;
if (Cache.ReadOnlyOpen() == false)
@@ -1572,7 +1573,7 @@ bool DoChangelog(CommandLine &CmdL)
// ShowHelp - Show a help screen /*{{{*/
// ---------------------------------------------------------------------
/* */
-bool ShowHelp(CommandLine &CmdL)
+static bool ShowHelp(CommandLine &)
{
ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION,
COMMON_ARCH,__DATE__,__TIME__);
@@ -1668,7 +1669,7 @@ bool ShowHelp(CommandLine &CmdL)
// SigWinch - Window size change signal handler /*{{{*/
// ---------------------------------------------------------------------
/* */
-void SigWinch(int)
+static void SigWinch(int)
{
// Riped from GNU ls
#ifdef TIOCGWINSZ
@@ -1679,14 +1680,6 @@ void SigWinch(int)
#endif
}
/*}}}*/
-bool DoUpgrade(CommandLine &CmdL) /*{{{*/
-{
- if (_config->FindB("APT::Get::Upgrade-Allow-New", false) == true)
- return DoUpgradeWithAllowNewPackages(CmdL);
- else
- return DoUpgradeNoNewPackages(CmdL);
-}
- /*}}}*/
int main(int argc,const char *argv[]) /*{{{*/
{
CommandLine::Dispatch Cmds[] = {{"update",&DoUpdate},
@@ -1741,10 +1734,6 @@ int main(int argc,const char *argv[]) /*{{{*/
// see if we are in simulate mode
CheckSimulateMode(CmdL);
- // Deal with stdout not being a tty
- if (!isatty(STDOUT_FILENO) && _config->FindI("quiet", -1) == -1)
- _config->Set("quiet","1");
-
// Setup the output streams
InitOutput();
diff --git a/cmdline/apt-helper.cc b/cmdline/apt-helper.cc
new file mode 100644
index 000000000..2c1107d90
--- /dev/null
+++ b/cmdline/apt-helper.cc
@@ -0,0 +1,125 @@
+// -*- mode: cpp; mode: fold -*-
+// Description /*{{{*/
+/* #####################################################################
+ apt-helper - cmdline helpers
+ ##################################################################### */
+ /*}}}*/
+// Include Files /*{{{*/
+#include <config.h>
+
+#include <apt-pkg/configuration.h>
+#include <apt-pkg/cmndline.h>
+#include <apt-pkg/error.h>
+#include <apt-pkg/init.h>
+#include <apt-pkg/strutl.h>
+#include <apt-pkg/pkgsystem.h>
+#include <apt-pkg/fileutl.h>
+#include <apt-pkg/acquire.h>
+#include <apt-pkg/acquire-item.h>
+
+#include <apt-private/acqprogress.h>
+#include <apt-private/private-output.h>
+#include <apt-private/private-download.h>
+#include <apt-private/private-cmndline.h>
+
+#include <iostream>
+#include <string>
+#include <vector>
+
+#include <apti18n.h>
+ /*}}}*/
+
+static bool DoDownloadFile(CommandLine &CmdL)
+{
+ if (CmdL.FileSize() <= 2)
+ return _error->Error(_("Must specify at least one pair url/filename"));
+
+
+ pkgAcquire Fetcher;
+ AcqTextStatus Stat(ScreenWidth, _config->FindI("quiet",0));
+ Fetcher.Setup(&Stat);
+ std::string download_uri = CmdL.FileList[1];
+ std::string targetfile = CmdL.FileList[2];
+ std::string hash;
+ if (CmdL.FileSize() > 3)
+ hash = CmdL.FileList[3];
+ new pkgAcqFile(&Fetcher, download_uri, hash, 0, "desc", "short-desc",
+ "dest-dir-ignored", targetfile);
+ Fetcher.Run();
+ bool Failed = false;
+ if (AcquireRun(Fetcher, 0, &Failed, NULL) == false || Failed == true ||
+ FileExists(targetfile) == false)
+ return _error->Error(_("Download Failed"));
+ return true;
+}
+
+static bool ShowHelp(CommandLine &)
+{
+ ioprintf(std::cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION,
+ COMMON_ARCH,__DATE__,__TIME__);
+
+ if (_config->FindB("version") == true)
+ return true;
+
+ std::cout <<
+ _("Usage: apt-helper [options] command\n"
+ " apt-helper [options] download-file uri target-path\n"
+ "\n"
+ "apt-helper is a internal helper for apt\n"
+ "\n"
+ "Commands:\n"
+ " download-file - download the given uri to the target-path\n"
+ "\n"
+ " This APT helper has Super Meep Powers.\n");
+ return true;
+}
+
+
+int main(int argc,const char *argv[]) /*{{{*/
+{
+ CommandLine::Dispatch Cmds[] = {{"help",&ShowHelp},
+ {"download-file", &DoDownloadFile},
+ {0,0}};
+
+ std::vector<CommandLine::Args> Args = getCommandArgs(
+ "apt-download", CommandLine::GetCommand(Cmds, argc, argv));
+
+ // Set up gettext support
+ setlocale(LC_ALL,"");
+ textdomain(PACKAGE);
+
+ // Parse the command line and initialize the package library
+ CommandLine CmdL(Args.data(),_config);
+ if (pkgInitConfig(*_config) == false ||
+ CmdL.Parse(argc,argv) == false ||
+ pkgInitSystem(*_config,_system) == false)
+ {
+ if (_config->FindB("version") == true)
+ ShowHelp(CmdL);
+ _error->DumpErrors();
+ return 100;
+ }
+
+ // See if the help should be shown
+ if (_config->FindB("help") == true ||
+ _config->FindB("version") == true ||
+ CmdL.FileSize() == 0)
+ {
+ ShowHelp(CmdL);
+ return 0;
+ }
+
+ InitOutput();
+
+ // Match the operation
+ CmdL.DispatchArg(Cmds);
+
+ // Print any errors or warnings found during parsing
+ bool const Errors = _error->PendingError();
+ if (_config->FindI("quiet",0) > 0)
+ _error->DumpErrors();
+ else
+ _error->DumpErrors(GlobalError::DEBUG);
+ return Errors == true ? 100 : 0;
+}
+ /*}}}*/
diff --git a/cmdline/apt-internal-solver.cc b/cmdline/apt-internal-solver.cc
index 53b38ea43..b85c07c33 100644
--- a/cmdline/apt-internal-solver.cc
+++ b/cmdline/apt-internal-solver.cc
@@ -20,7 +20,15 @@
#include <apt-pkg/fileutl.h>
#include <apt-pkg/pkgsystem.h>
#include <apt-pkg/upgrade.h>
-
+#include <apt-pkg/configuration.h>
+#include <apt-pkg/depcache.h>
+#include <apt-pkg/pkgcache.h>
+#include <apt-pkg/cacheiterators.h>
+
+#include <string.h>
+#include <iostream>
+#include <list>
+#include <string>
#include <unistd.h>
#include <cstdio>
@@ -30,7 +38,7 @@
// ShowHelp - Show a help screen /*{{{*/
// ---------------------------------------------------------------------
/* */
-bool ShowHelp(CommandLine &CmdL) {
+static bool ShowHelp(CommandLine &) {
ioprintf(std::cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION,
COMMON_ARCH,__DATE__,__TIME__);
@@ -160,16 +168,16 @@ int main(int argc,const char *argv[]) /*{{{*/
if (upgrade == true) {
if (pkgAllUpgrade(CacheFile) == false) {
- EDSP::WriteError("ERR_UNSOLVABLE_UPGRADE", "An upgrade error occured", output);
+ EDSP::WriteError("ERR_UNSOLVABLE_UPGRADE", "An upgrade error occurred", output);
return 0;
}
} else if (distUpgrade == true) {
if (pkgDistUpgrade(CacheFile) == false) {
- EDSP::WriteError("ERR_UNSOLVABLE_DIST_UPGRADE", "An dist-upgrade error occured", output);
+ EDSP::WriteError("ERR_UNSOLVABLE_DIST_UPGRADE", "An dist-upgrade error occurred", output);
return 0;
}
} else if (Fix.Resolve() == false) {
- EDSP::WriteError("ERR_UNSOLVABLE", "An error occured", output);
+ EDSP::WriteError("ERR_UNSOLVABLE", "An error occurred", output);
return 0;
}
diff --git a/cmdline/apt-key.in b/cmdline/apt-key.in
index 463e4b4b4..0774cf4b7 100644
--- a/cmdline/apt-key.in
+++ b/cmdline/apt-key.in
@@ -5,22 +5,23 @@ unset GREP_OPTIONS
GPG_CMD="gpg --ignore-time-conflict --no-options --no-default-keyring"
-# gpg needs a trustdb to function, but it can't be invalid (not even empty)
-# so we create a temporary directory to store our fresh readable trustdb in
-TRUSTDBDIR="$(mktemp -d)"
-CURRENTTRAP="${CURRENTTRAP} rm -rf '${TRUSTDBDIR}';"
+# gpg needs (in different versions more or less) files to function correctly,
+# so we give it its own homedir and generate some valid content for it
+GPGHOMEDIR="$(mktemp -d)"
+CURRENTTRAP="${CURRENTTRAP} rm -rf '${GPGHOMEDIR}';"
trap "${CURRENTTRAP}" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM
-chmod 700 "$TRUSTDBDIR"
-# We also don't use a secret keyring, of course, but gpg panics and
+chmod 700 "$GPGHOMEDIR"
+# We don't use a secret keyring, of course, but gpg panics and
# implodes if there isn't one available - and writeable for imports
-SECRETKEYRING="${TRUSTDBDIR}/secring.gpg"
+SECRETKEYRING="${GPGHOMEDIR}/secring.gpg"
touch $SECRETKEYRING
-GPG_CMD="$GPG_CMD --secret-keyring $SECRETKEYRING"
-GPG_CMD="$GPG_CMD --trustdb-name ${TRUSTDBDIR}/trustdb.gpg"
-
-# now create the trustdb with an (empty) dummy keyring
-$GPG_CMD --quiet --check-trustdb --keyring $SECRETKEYRING
-# and make sure that gpg isn't trying to update the file
+GPG_CMD="$GPG_CMD --homedir $GPGHOMEDIR"
+# create the trustdb with an (empty) dummy keyring
+# older gpgs required it, newer gpgs even warn that it isn't needed,
+# but require it nonetheless for some commands, so we just play safe
+# here for the foreseeable future and create a dummy one
+$GPG_CMD --quiet --check-trustdb --keyring $SECRETKEYRING >/dev/null 2>&1
+# tell gpg that it shouldn't try to maintain a trustdb file
GPG_CMD="$GPG_CMD --no-auto-check-trustdb --trust-model always"
GPG="$GPG_CMD"
@@ -186,7 +187,7 @@ remove_key_from_keyring() {
echo >&2 "Key ${2} is in keyring ${1}, but can't be removed as it is read only."
return
fi
- # check if it is the only key in the keyring and if so remove the keyring alltogether
+ # check if it is the only key in the keyring and if so remove the keyring altogether
if [ '1' = "$($GPG --with-colons --list-keys | grep "^pub:[^:]*:[^:]*:[^:]*:[0-9A-F]\+:" | wc -l)" ]; then
mv -f "$1" "${1}~" # behave like gpg
return
diff --git a/cmdline/apt-mark.cc b/cmdline/apt-mark.cc
index ebb1f9892..ed348358a 100644
--- a/cmdline/apt-mark.cc
+++ b/cmdline/apt-mark.cc
@@ -11,20 +11,31 @@
#include <apt-pkg/cacheset.h>
#include <apt-pkg/cmndline.h>
#include <apt-pkg/error.h>
+#include <apt-pkg/fileutl.h>
#include <apt-pkg/init.h>
-#include <apt-pkg/strutl.h>
#include <apt-pkg/pkgsystem.h>
-#include <apt-pkg/fileutl.h>
+#include <apt-pkg/strutl.h>
+#include <apt-pkg/cacheiterators.h>
+#include <apt-pkg/configuration.h>
+#include <apt-pkg/depcache.h>
+#include <apt-pkg/macros.h>
+#include <apt-pkg/pkgcache.h>
+
+#include <apt-private/private-cmndline.h>
-#include <algorithm>
#include <errno.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/wait.h>
#include <fcntl.h>
-
-#include <apt-private/private-cmndline.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/wait.h>
+#include <unistd.h>
+#include <algorithm>
+#include <fstream>
+#include <iostream>
+#include <string>
+#include <vector>
#include <apti18n.h>
/*}}}*/
@@ -35,7 +46,7 @@ ostream c1out(0);
ostream c2out(0);
ofstream devnull("/dev/null");
/* DoAuto - mark packages as automatically/manually installed {{{*/
-bool DoAuto(CommandLine &CmdL)
+static bool DoAuto(CommandLine &CmdL)
{
pkgCacheFile CacheFile;
pkgCache *Cache = CacheFile.GetPkgCache();
@@ -82,7 +93,7 @@ bool DoAuto(CommandLine &CmdL)
/* DoMarkAuto - mark packages as automatically/manually installed {{{*/
/* Does the same as DoAuto but tries to do it exactly the same why as
the python implementation did it so it can be a drop-in replacement */
-bool DoMarkAuto(CommandLine &CmdL)
+static bool DoMarkAuto(CommandLine &CmdL)
{
pkgCacheFile CacheFile;
pkgCache *Cache = CacheFile.GetPkgCache();
@@ -119,7 +130,7 @@ bool DoMarkAuto(CommandLine &CmdL)
}
/*}}}*/
/* ShowAuto - show automatically installed packages (sorted) {{{*/
-bool ShowAuto(CommandLine &CmdL)
+static bool ShowAuto(CommandLine &CmdL)
{
pkgCacheFile CacheFile;
pkgCache *Cache = CacheFile.GetPkgCache();
@@ -159,7 +170,7 @@ bool ShowAuto(CommandLine &CmdL)
}
/*}}}*/
/* DoHold - mark packages as hold by dpkg {{{*/
-bool DoHold(CommandLine &CmdL)
+static bool DoHold(CommandLine &CmdL)
{
pkgCacheFile CacheFile;
pkgCache *Cache = CacheFile.GetPkgCache();
@@ -335,7 +346,7 @@ bool DoHold(CommandLine &CmdL)
}
/*}}}*/
/* ShowHold - show packages set on hold in dpkg status {{{*/
-bool ShowHold(CommandLine &CmdL)
+static bool ShowHold(CommandLine &CmdL)
{
pkgCacheFile CacheFile;
pkgCache *Cache = CacheFile.GetPkgCache();
@@ -372,7 +383,7 @@ bool ShowHold(CommandLine &CmdL)
// ShowHelp - Show a help screen /*{{{*/
// ---------------------------------------------------------------------
/* */
-bool ShowHelp(CommandLine &CmdL)
+static bool ShowHelp(CommandLine &)
{
ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION,
COMMON_ARCH,__DATE__,__TIME__);
@@ -386,6 +397,11 @@ bool ShowHelp(CommandLine &CmdL)
"Commands:\n"
" auto - Mark the given packages as automatically installed\n"
" manual - Mark the given packages as manually installed\n"
+ " hold - Mark a package as held back\n"
+ " unhold - Unset a package set as held back\n"
+ " showauto - Print the list of automatically installed packages\n"
+ " showmanual - Print the list of manually installed packages\n"
+ " showhold - Print the list of package on hold\n"
"\n"
"Options:\n"
" -h This help text.\n"
diff --git a/cmdline/apt-sortpkgs.cc b/cmdline/apt-sortpkgs.cc
index 46989044e..c2b11890a 100644
--- a/cmdline/apt-sortpkgs.cc
+++ b/cmdline/apt-sortpkgs.cc
@@ -25,9 +25,9 @@
#include <vector>
#include <algorithm>
-
-#include <locale.h>
-#include <unistd.h>
+#include <stdio.h>
+#include <iostream>
+#include <string>
#include <apti18n.h>
/*}}}*/
@@ -62,7 +62,7 @@ struct PkgName /*{{{*/
// DoIt - Sort a single file /*{{{*/
// ---------------------------------------------------------------------
/* */
-bool DoIt(string InFile)
+static bool DoIt(string InFile)
{
FileFd Fd(InFile,FileFd::ReadOnly);
pkgTagFile Tags(&Fd);
@@ -142,7 +142,7 @@ bool DoIt(string InFile)
// ShowHelp - Show the help text /*{{{*/
// ---------------------------------------------------------------------
/* */
-int ShowHelp()
+static int ShowHelp()
{
ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION,
COMMON_ARCH,__DATE__,__TIME__);
diff --git a/cmdline/apt.cc b/cmdline/apt.cc
index 60a83c7ce..b69aeef2d 100644
--- a/cmdline/apt.cc
+++ b/cmdline/apt.cc
@@ -11,39 +11,12 @@
// Include Files /*{{{*/
#include<config.h>
-#include <cassert>
-#include <locale.h>
-#include <iostream>
-#include <unistd.h>
-#include <errno.h>
-#include <regex.h>
-#include <stdio.h>
-#include <iomanip>
-#include <algorithm>
-
-
+#include <apt-pkg/cmndline.h>
#include <apt-pkg/error.h>
-#include <apt-pkg/cachefile.h>
-#include <apt-pkg/cacheset.h>
#include <apt-pkg/init.h>
-#include <apt-pkg/progress.h>
-#include <apt-pkg/sourcelist.h>
-#include <apt-pkg/cmndline.h>
-#include <apt-pkg/strutl.h>
-#include <apt-pkg/fileutl.h>
-#include <apt-pkg/pkgrecords.h>
-#include <apt-pkg/srcrecords.h>
-#include <apt-pkg/version.h>
-#include <apt-pkg/policy.h>
-#include <apt-pkg/tagfile.h>
-#include <apt-pkg/algorithms.h>
-#include <apt-pkg/sptr.h>
#include <apt-pkg/pkgsystem.h>
-#include <apt-pkg/indexfile.h>
-#include <apt-pkg/metaindex.h>
-#include <apt-pkg/hashes.h>
-
-#include <apti18n.h>
+#include <apt-pkg/strutl.h>
+#include <apt-pkg/configuration.h>
#include <apt-private/private-list.h>
#include <apt-private/private-search.h>
@@ -55,13 +28,16 @@
#include <apt-private/private-upgrade.h>
#include <apt-private/private-show.h>
#include <apt-private/private-main.h>
-#include <apt-private/private-utils.h>
#include <apt-private/private-sources.h>
- /*}}}*/
+#include <unistd.h>
+#include <iostream>
+#include <vector>
+#include <apti18n.h>
+ /*}}}*/
-bool ShowHelp(CommandLine &CmdL)
+static bool ShowHelp(CommandLine &)
{
ioprintf(c1out,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION,
COMMON_ARCH,__DATE__,__TIME__);
@@ -71,18 +47,20 @@ bool ShowHelp(CommandLine &CmdL)
_("Usage: apt [options] command\n"
"\n"
"CLI for apt.\n"
- "Commands: \n"
+ "Basic commands: \n"
" list - list packages based on package names\n"
" search - search in package descriptions\n"
" show - show package details\n"
"\n"
+ " update - update list of available packages\n"
+ "\n"
" install - install packages\n"
- " remove - remove packages\n"
+ " remove - remove packages\n"
"\n"
- " edit-sources - edit the source information file\n"
+ " upgrade - upgrade the system by installing/upgrading packages\n"
+ " full-upgrade - upgrade the system by removing/installing/upgrading packages\n"
"\n"
- " update - update list of available packages\n"
- " upgrade - upgrade the systems packages\n"
+ " edit-sources - edit the source information file\n"
);
return true;
@@ -90,16 +68,27 @@ bool ShowHelp(CommandLine &CmdL)
int main(int argc, const char *argv[]) /*{{{*/
{
- CommandLine::Dispatch Cmds[] = {{"list",&List},
+ CommandLine::Dispatch Cmds[] = {
+ // query
+ {"list",&List},
{"search", &FullTextSearch},
{"show", &APT::Cmd::ShowPackage},
- // needs root
+
+ // package stuff
{"install",&DoInstall},
{"remove", &DoInstall},
+ {"purge", &DoInstall},
+
+ // system wide stuff
{"update",&DoUpdate},
- {"upgrade",&DoUpgradeWithAllowNewPackages},
+ {"upgrade",&DoUpgrade},
+ {"full-upgrade",&DoDistUpgrade},
+ // for compat with muscle memory
+ {"dist-upgrade",&DoDistUpgrade},
+
// misc
{"edit-sources",&EditSources},
+
// helper
{"moo",&DoMoo},
{"help",&ShowHelp},
@@ -119,9 +108,10 @@ int main(int argc, const char *argv[]) /*{{{*/
return 100;
}
- // FIXME: move into a new libprivate/private-install.cc:Install()
- _config->Set("DPkgPM::Progress-Fancy", "1");
- _config->Set("Apt::Color", "1");
+ // some different defaults
+ _config->CndSet("DPkgPM::Progress-Fancy", "1");
+ _config->CndSet("Apt::Color", "1");
+ _config->CndSet("APT::Get::Upgrade-Allow-New", true);
// Parse the command line and initialize the package library
CommandLine CmdL(Args.data(), _config);
@@ -132,6 +122,17 @@ int main(int argc, const char *argv[]) /*{{{*/
return 100;
}
+ if(!isatty(STDOUT_FILENO) &&
+ _config->FindB("Apt::Cmd::Disable-Script-Warning", false) == false)
+ {
+ std::cerr << std::endl
+ << "WARNING: " << argv[0] << " "
+ << "does not have a stable CLI interface yet. "
+ << "Use with caution in scripts."
+ << std::endl
+ << std::endl;
+ }
+
// See if the help should be shown
if (_config->FindB("help") == true ||
_config->FindB("version") == true ||
diff --git a/cmdline/makefile b/cmdline/makefile
index 06f170b6a..c4a249cd6 100644
--- a/cmdline/makefile
+++ b/cmdline/makefile
@@ -40,20 +40,6 @@ LIB_MAKES = apt-pkg/makefile
SOURCE = apt-cdrom.cc
include $(PROGRAM_H)
-# The apt-key program
-apt-key: apt-key.in
- sed -e "s#&keyring-filename;#$(shell ../vendor/getinfo keyring-filename)#" \
- -e "s#&keyring-removed-filename;#$(shell ../vendor/getinfo keyring-removed-filename)#" \
- -e "s#&keyring-master-filename;#$(shell ../vendor/getinfo keyring-master-filename)#" \
- -e "s#&keyring-uri;#$(shell ../vendor/getinfo keyring-uri)#" \
- -e "s#&keyring-package;#$(shell ../vendor/getinfo keyring-package)#" $< > $@
- chmod 755 $@
-
-SOURCE=apt-key
-TO=$(BIN)
-TARGET=program
-include $(COPY_H)
-
# The apt-mark program
PROGRAM=apt-mark
SLIBS = -lapt-pkg -lapt-private $(INTLLIBS)
@@ -61,6 +47,13 @@ LIB_MAKES = apt-pkg/makefile
SOURCE = apt-mark.cc
include $(PROGRAM_H)
+# The apt-helper
+PROGRAM=apt-helper
+SLIBS = -lapt-pkg -lapt-private $(INTLLIBS)
+LIB_MAKES = apt-pkg/makefile
+SOURCE = apt-helper.cc
+include $(PROGRAM_H)
+
# The apt-report-mirror-failure program
#SOURCE=apt-report-mirror-failure
#TO=$(BIN)
@@ -99,3 +92,22 @@ SLIBS = -lapt-pkg $(INTLLIBS)
LIB_MAKES = apt-pkg/makefile
SOURCE = apt-dump-solver.cc
include $(PROGRAM_H)
+
+# The apt-key program
+apt-key: apt-key.in
+ sed -e "s#&keyring-filename;#$(shell ../vendor/getinfo keyring-filename)#" \
+ -e "s#&keyring-removed-filename;#$(shell ../vendor/getinfo keyring-removed-filename)#" \
+ -e "s#&keyring-master-filename;#$(shell ../vendor/getinfo keyring-master-filename)#" \
+ -e "s#&keyring-uri;#$(shell ../vendor/getinfo keyring-uri)#" \
+ -e "s#&keyring-package;#$(shell ../vendor/getinfo keyring-package)#" $< > $@
+ chmod 755 $@
+
+SOURCE=apt-key
+TO=$(BIN)
+TARGET=program
+include $(COPY_H)
+
+clean: clean/apt-key
+
+clean/apt-key:
+ rm -f apt-key