summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apt-pkg/acquire-item.cc56
-rw-r--r--apt-pkg/acquire-item.h2
-rw-r--r--apt-pkg/indexcopy.cc34
-rw-r--r--configure.in2
-rw-r--r--debian/apt.cron.daily6
-rw-r--r--debian/changelog13
6 files changed, 90 insertions, 23 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc
index 5d741af6f..81636902e 100644
--- a/apt-pkg/acquire-item.cc
+++ b/apt-pkg/acquire-item.cc
@@ -142,7 +142,7 @@ void pkgAcquire::Item::Rename(string From,string To)
pkgAcqIndexDiffs::pkgAcqIndexDiffs(pkgAcquire *Owner,
string URI,string URIDesc,string ShortDesc,
string ExpectedMD5, vector<DiffInfo> diffs)
- : Item(Owner), RealURI(URI), ExpectedMD5(ExpectedMD5), needed_files(diffs)
+ : Item(Owner), RealURI(URI), ExpectedMD5(ExpectedMD5), available_patches(diffs)
{
DestFile = _config->FindDir("Dir::State::lists") + "partial/";
@@ -171,7 +171,7 @@ pkgAcqIndexDiffs::pkgAcqIndexDiffs(pkgAcquire *Owner,
return;
}
- if(needed_files.size() == 0)
+ if(available_patches.size() == 0)
QueueDiffIndex(URI);
else
QueueNextDiff();
@@ -261,7 +261,8 @@ bool pkgAcqIndexDiffs::ApplyDiff(string PatchFile)
if (Process == 0)
{
chdir(_config->FindDir("Dir::State::lists").c_str());
- string cmd = "(zcat " + PatchFile + "; echo \"wq\" ) | red " + FinalFile + " >/dev/null 2>/dev/null";
+ // for some reason "red" fails with the pdiffs from p.d.o/~aba ?!?
+ string cmd = "(zcat " + PatchFile + "; echo \"wq\" ) | /bin/ed " + FinalFile + " >/dev/null 2>/dev/null";
if(Debug)
std::clog << "Runing: " << cmd << std::endl;
res = system(cmd.c_str());
@@ -277,16 +278,35 @@ bool pkgAcqIndexDiffs::ApplyDiff(string PatchFile)
bool pkgAcqIndexDiffs::QueueNextDiff()
{
- // FIXME: don't use the needed_files[0] but check sha1 and search
- // for the right patch in needed_files
- // -> and rename needed_files to "available_patches"
+ // calc sha1 of the just patched file
+ string FinalFile = _config->FindDir("Dir::State::lists");
+ FinalFile += URItoFileName(RealURI);
+
+ FileFd fd(FinalFile, FileFd::ReadOnly);
+ SHA1Summation SHA1;
+ SHA1.AddFD(fd.Fd(), fd.Size());
+ string local_sha1 = string(SHA1.Result());
+
+ // see if we have a patch for it, the patch list must be ordered
+ for(vector<DiffInfo>::iterator I=available_patches.begin();
+ I != available_patches.end(); I++) {
+ // if the patch does not fit, it's not interessting
+ if((*I).sha1 != local_sha1)
+ available_patches.erase(I);
+ }
+
+ // error checking and falling back if no patch was found
+ if(available_patches.size() == 0) {
+ Failed("", NULL);
+ return false;
+ }
- // queue diff
- Desc.URI = string(RealURI) + string(".diff/") + needed_files[0].file + string(".gz");
- Desc.Description = needed_files[0].file + string(".pdiff");
+ // queue the right diff
+ Desc.URI = string(RealURI) + string(".diff/") + available_patches[0].file + string(".gz");
+ Desc.Description = available_patches[0].file + string(".pdiff");
DestFile = _config->FindDir("Dir::State::lists") + "partial/";
- DestFile += URItoFileName(RealURI + string(".diff/") + needed_files[0].file);
+ DestFile += URItoFileName(RealURI + string(".diff/") + available_patches[0].file);
if(Debug)
std::clog << "pkgAcqIndexDiffs::QueueNextDiff(): " << Desc.URI << std::endl;
@@ -341,7 +361,7 @@ bool pkgAcqIndexDiffs::ParseIndexDiff(string IndexDiffFile)
if(found) {
if(Debug)
std::clog << "Need to get diff: " << d.file << std::endl;
- needed_files.push_back(d);
+ available_patches.push_back(d);
}
}
// no information how to get the patches, bail out
@@ -353,7 +373,7 @@ bool pkgAcqIndexDiffs::ParseIndexDiff(string IndexDiffFile)
} else {
// queue the diffs
new pkgAcqIndexDiffs(Owner, RealURI, Description, Desc.ShortDesc,
- ExpectedMD5, needed_files);
+ ExpectedMD5, available_patches);
Finish();
return true;
}
@@ -394,11 +414,11 @@ void pkgAcqIndexDiffs::Done(string Message,unsigned long Size,string Md5Hash,
// sucess in downloading a diff
if(Desc.URI.find(".diff") != string::npos) {
ApplyDiff(DestFile);
- needed_files.erase(needed_files.begin());
+ available_patches.erase(available_patches.begin());
- if(needed_files.size() > 0) {
+ if(available_patches.size() > 0) {
new pkgAcqIndexDiffs(Owner, RealURI, Description, Desc.ShortDesc,
- ExpectedMD5, needed_files);
+ ExpectedMD5, available_patches);
} else {
Finish(true);
return;
@@ -618,6 +638,12 @@ pkgAcqMetaSig::pkgAcqMetaSig(pkgAcquire *Owner,
// File was already in place. It needs to be re-verified
// because Release might have changed, so Move it into partial
Rename(Final,DestFile);
+ // unlink the file and do not try to use I-M-S and Last-Modified
+ // if the users proxy is broken
+ if(_config->FindB("Acquire::BrokenProxy", false) == true) {
+ std::cerr << "forcing re-get of the signature file as requested" << std::endl;
+ unlink(DestFile.c_str());
+ }
}
QueueURI(Desc);
diff --git a/apt-pkg/acquire-item.h b/apt-pkg/acquire-item.h
index 6c78f33ef..8d58a39ba 100644
--- a/apt-pkg/acquire-item.h
+++ b/apt-pkg/acquire-item.h
@@ -99,7 +99,7 @@ class pkgAcqIndexDiffs : public pkgAcquire::Item
string sha1;
unsigned long size;
};
- vector<DiffInfo> needed_files;
+ vector<DiffInfo> available_patches;
public:
diff --git a/apt-pkg/indexcopy.cc b/apt-pkg/indexcopy.cc
index 4b6ac5ce0..1f65062f7 100644
--- a/apt-pkg/indexcopy.cc
+++ b/apt-pkg/indexcopy.cc
@@ -593,17 +593,45 @@ bool SigVerify::CopyAndVerify(string CDROM,string Name,vector<string> &SigList,
// verify the gpg signature of "Release"
// gpg --verify "*I+Release.gpg", "*I+Release"
+ const char *Args[400];
+ unsigned int i = 0;
+
string gpgvpath = _config->Find("Dir::Bin::gpg", "/usr/bin/gpgv");
string pubringpath = _config->Find("Apt::GPGV::TrustedKeyring", "/etc/apt/trusted.gpg");
+ string releasegpg = *I+"Release.gpg";
+ string release = *I+"Release";
+
+ Args[i++] = gpgvpath.c_str();
+ Args[i++] = "--keyring";
+ Args[i++] = pubringpath.c_str();
+ Configuration::Item const *Opts;
+ Opts = _config->Tree("Acquire::gpgv::Options");
+ if (Opts != 0)
+ {
+ Opts = Opts->Child;
+ for (; Opts != 0; Opts = Opts->Next)
+ {
+ if (Opts->Value.empty() == true)
+ continue;
+ Args[i++] = Opts->Value.c_str();
+ if(i >= 390) {
+ _error->Error("Argument list from Acquire::gpgv::Options too long. Exiting.");
+ return false;
+ }
+ }
+ }
+
+ Args[i++] = releasegpg.c_str();
+ Args[i++] = release.c_str();
+ Args[i++] = NULL;
+
pid_t pid = ExecFork();
if(pid < 0) {
_error->Error("Fork failed");
return false;
}
if(pid == 0) {
- execlp(gpgvpath.c_str(), gpgvpath.c_str(), "--keyring",
- pubringpath.c_str(), string(*I+"Release.gpg").c_str(),
- string(*I+"Release").c_str(), NULL);
+ execvp(gpgvpath.c_str(), (char**)Args);
}
if(!ExecWait(pid, "gpgv")) {
_error->Warning("Signature verification failed for: %s",
diff --git a/configure.in b/configure.in
index 3c5d6d69d..12d3ecae7 100644
--- a/configure.in
+++ b/configure.in
@@ -18,7 +18,7 @@ AC_CONFIG_AUX_DIR(buildlib)
AC_CONFIG_HEADER(include/config.h:buildlib/config.h.in include/apti18n.h:buildlib/apti18n.h.in)
dnl -- SET THIS TO THE RELEASE VERSION --
-AC_DEFINE_UNQUOTED(VERSION,"0.6.35")
+AC_DEFINE_UNQUOTED(VERSION,"0.6.36")
PACKAGE="apt"
AC_DEFINE_UNQUOTED(PACKAGE,"$PACKAGE")
AC_SUBST(PACKAGE)
diff --git a/debian/apt.cron.daily b/debian/apt.cron.daily
index 7ee7e46db..2d93a5ba4 100644
--- a/debian/apt.cron.daily
+++ b/debian/apt.cron.daily
@@ -74,7 +74,7 @@ check_size_constraints()
{
# min-age in days
MaxAge=0
- MinAge=1
+ MinAge=2
MaxSize=0
CacheDir="var/cache/apt"
CacheArchive="archives/"
@@ -110,7 +110,7 @@ check_size_constraints()
MinAge=$(($MinAge*24*60*60))
# reverse-sort by mtime
- for file in $(ls -rt $Cache/*.deb); do
+ for file in $(ls -rt $Cache/*.deb 2>/dev/null); do
du=$(du -s $Cache)
size=${du%%/*}
# check if the cache is small enough
@@ -125,7 +125,7 @@ check_size_constraints()
#echo "$file ($delta), $MinAge"
if [ $delta -le $MinAge ]; then
#echo "Skiping $file (delta=$delta)"
- continue
+ break
fi
fi
diff --git a/debian/changelog b/debian/changelog
index 1820b2cbf..87e713d3d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,16 @@
+apt (0.6.36) experimental; urgency=low
+
+ * Merge apt--mvo--0:
+ - apt-pkg/acquire-item.cc:
+ added "Acquire::BrokenProxy" that will force apt to always
+ re-get the Release.gpg file (for broken proxies)
+ - debian/apt.cron.daily:
+ MinAge is defaulting to 2 days now to prevent over-aggresive removal
+ - apt-pkg/cdrom.cc:
+ honor "Acquire::gpgv::Options" when verifying the signature (Ubuntu #8496)
+
+ -- Michael Vogt <michael.vogt@ubuntu.com> Thu, 31 Mar 2005 20:37:11 +0200
+
apt (0.6.35) hoary; urgency=low
* Merge apt--mvo--0 (incorporates 0.6.34ubuntu1):