summaryrefslogtreecommitdiff
path: root/methods
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2015-06-15 13:36:11 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2015-06-15 23:35:54 +0200
commitff86d7df6a53ff6283de4b9a858c1dad98ed887f (patch)
treea9161396f07dfc4020967f2e51447872584db22f /methods
parent08ea7806458de0995414eaae852e0a5985875642 (diff)
call URIStart in cdrom and file method
All other methods call it, so they should follow along even if the work they do afterwards is hardly breathtaking and usually results in a URIDone pretty soon, but the acquire system tells the individual item about this via a virtual method call, so even through none of our existing items contains any critical code in these, maybe one day they might. Consistency at least onceā€¦ Which is also why this has a good sideeffect: file: and cdrom: requests appear now in the 'apt-get update' output. Finally - it never made sense to hide them for me. Okay, I guess it made before the new hit behavior, but now that you can actually see the difference in an update it makes sense to see if a file: repository changed or not as well.
Diffstat (limited to 'methods')
-rw-r--r--methods/cdrom.cc3
-rw-r--r--methods/file.cc18
2 files changed, 12 insertions, 9 deletions
diff --git a/methods/cdrom.cc b/methods/cdrom.cc
index 10cb29f66..67265cfa3 100644
--- a/methods/cdrom.cc
+++ b/methods/cdrom.cc
@@ -260,7 +260,8 @@ bool CDROMMethod::Fetch(FetchItem *Itm)
struct stat Buf;
if (stat(Res.Filename.c_str(),&Buf) != 0)
return _error->Error(_("File not found"));
-
+
+ URIStart(Res);
if (NewID.empty() == false)
CurrentID = NewID;
Res.LastModified = Buf.st_mtime;
diff --git a/methods/file.cc b/methods/file.cc
index 5d5fffa67..5c76ec122 100644
--- a/methods/file.cc
+++ b/methods/file.cc
@@ -58,7 +58,10 @@ bool FileMethod::Fetch(FetchItem *Itm)
{
HashStringList const hsl = Itm->ExpectedHashes;
if (Itm->ExpectedHashes.VerifyFile(File))
+ {
+ Res.Filename = Itm->DestFile;
Res.IMSHit = true;
+ }
}
}
}
@@ -78,7 +81,14 @@ bool FileMethod::Fetch(FetchItem *Itm)
if (filesize != 0 && filesize == Res.Size)
Res.IMSHit = true;
}
+
+ Hashes Hash(Itm->ExpectedHashes);
+ FileFd Fd(File, FileFd::ReadOnly);
+ Hash.AddFD(Fd);
+ Res.TakeHashes(Hash);
}
+ if (Res.IMSHit == false)
+ URIStart(Res);
// See if the uncompressed file exists and reuse it
FetchResult AltRes;
@@ -103,14 +113,6 @@ bool FileMethod::Fetch(FetchItem *Itm)
}
}
- if (Res.Filename.empty() == false)
- {
- Hashes Hash(Itm->ExpectedHashes);
- FileFd Fd(Res.Filename, FileFd::ReadOnly);
- Hash.AddFD(Fd);
- Res.TakeHashes(Hash);
- }
-
if (AltRes.Filename.empty() == false)
URIDone(Res,&AltRes);
else if (Res.Filename.empty() == false)