summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2005-08-29 14:57:50 +0000
committerMichael Vogt <michael.vogt@ubuntu.com>2005-08-29 14:57:50 +0000
commit6040f5893a85c0206d3fd234c46a608b87a5e9ac (patch)
tree199c3ffa8bf120803c23709a3b86c8d076ce97eb
parentd84cd8651bce12774b8bc5f471c4a3c59fe992de (diff)
* debug support (Debug::pkgAcquire::RRed) for rred method added
-rw-r--r--apt-pkg/deb/debindexfile.cc15
-rw-r--r--apt-pkg/deb/debindexfile.h2
-rw-r--r--methods/rred.cc16
3 files changed, 32 insertions, 1 deletions
diff --git a/apt-pkg/deb/debindexfile.cc b/apt-pkg/deb/debindexfile.cc
index ff8bce85d..3ceeffdca 100644
--- a/apt-pkg/deb/debindexfile.cc
+++ b/apt-pkg/deb/debindexfile.cc
@@ -158,6 +158,21 @@ debPackagesIndex::debPackagesIndex(string URI,string Dist,string Section,bool Tr
{
}
/*}}}*/
+
+string debPackagesIndex::ArchiveURI(string File) const
+{
+ // FIXME: Remove as soon as pdiff support is offical
+ string remap = _config->Find("APT::Diffs::Remap::"+URI,"");
+ if(!remap.empty())
+ {
+ std::cout << "doing a evil remapping to the URI as requested!\n";
+ std::cout << URI << " -> " << remap << std::endl;
+ return remap+File;
+ }
+
+ return URI + File;
+}
+
// PackagesIndex::ArchiveInfo - Short version of the archive url /*{{{*/
// ---------------------------------------------------------------------
/* This is a shorter version that is designed to be < 60 chars or so */
diff --git a/apt-pkg/deb/debindexfile.h b/apt-pkg/deb/debindexfile.h
index a1b9583a4..48a345adf 100644
--- a/apt-pkg/deb/debindexfile.h
+++ b/apt-pkg/deb/debindexfile.h
@@ -59,7 +59,7 @@ class debPackagesIndex : public pkgIndexFile
// Stuff for accessing files on remote items
virtual string ArchiveInfo(pkgCache::VerIterator Ver) const;
- virtual string ArchiveURI(string File) const {return URI + File;};
+ virtual string ArchiveURI(string File) const;
// Interface for acquire
virtual string Describe(bool Short) const;
diff --git a/methods/rred.cc b/methods/rred.cc
index f4d77c64c..6fa57f3a6 100644
--- a/methods/rred.cc
+++ b/methods/rred.cc
@@ -24,6 +24,7 @@ const char *Prog;
class RredMethod : public pkgAcqMethod
{
+ bool Debug;
// the size of this doesn't really matter (except for performance)
const static int BUF_SIZE = 1024;
// the ed commands
@@ -70,12 +71,23 @@ int RredMethod::ed_rec(FILE *ed_cmds, FILE *in_file, FILE *out_file, int line,
}
if (*idx == 'c') {
mode = MODE_CHANGED;
+ if (Debug == true) {
+ std::clog << "changing from line " << startline
+ << " to " << stopline << std::endl;
+ }
}
else if (*idx == 'a') {
mode = MODE_ADDED;
+ if (Debug == true) {
+ std::clog << "adding after line " << startline << std::endl;
+ }
}
else if (*idx == 'd') {
mode = MODE_DELETED;
+ if (Debug == true) {
+ std::clog << "deleting from line " << startline
+ << " to " << stopline << std::endl;
+ }
}
else {
return ED_PARSER;
@@ -177,6 +189,7 @@ int RredMethod::ed_file(FILE *ed_cmds, FILE *in_file, FILE *out_file,
bool RredMethod::Fetch(FetchItem *Itm)
{
+ Debug = _config->FindB("Debug::pkgAcquire::RRed",false);
URI Get = Itm->Uri;
string Path = Get.Host + Get.Path; // To account for relative paths
// Path contains the filename to patch
@@ -185,6 +198,9 @@ bool RredMethod::Fetch(FetchItem *Itm)
URIStart(Res);
// Res.Filename the destination filename
+ if (Debug == true)
+ std::clog << "Patching " << Path << " with " << Path
+ << ".ed and putting result into " << Itm->DestFile << std::endl;
// Open the source and destination files (the d'tor of FileFd will do
// the cleanup/closing of the fds)
FileFd From(Path,FileFd::ReadOnly);