apt/apt-0.5.15cnc6-alt-vendor.patch
Dmitry V. Levin e97a90dec9 0.5.15lorg2-alt3
- Resolved a few issues introduced after cnc6.
2006-04-02 12:15:03 +00:00

176 lines
5.5 KiB
Diff

diff -ur apt-0.5.15lorg2.orig/apt-pkg/acquire-item.cc apt-0.5.15lorg2.vendor/apt-pkg/acquire-item.cc
--- apt-0.5.15lorg2.orig/apt-pkg/acquire-item.cc 2006-03-20 20:30:36 +0300
+++ apt-0.5.15lorg2.vendor/apt-pkg/acquire-item.cc 2006-03-20 20:31:00 +0300
@@ -476,14 +476,29 @@
return;
}
- // Match fingerprint of Release file
- if (Repository->FingerPrint != FingerPrint)
- {
- Status = StatError;
- ErrorText = _("Signature fingerprint of Release file does not match (expected ")
- +Repository->FingerPrint+_(", got ")+FingerPrint+")";
- return;
- }
+ bool found = false;
+ for (vector<string>::const_iterator I = Repository->FingerPrint.begin();
+ I != Repository->FingerPrint.end(); I++)
+ {
+ // Match fingerprint of Release file
+ if ((*I) == FingerPrint)
+ {
+ found = true;
+ break;
+ }
+ }
+
+ if (!found)
+ {
+ Status = StatError;
+ ErrorText = _("Signature fingerprint of Release file does not match (expected ");
+ for (vector<string>::const_iterator I = Repository->FingerPrint.begin();
+ I != Repository->FingerPrint.end(); I++)
+ ErrorText += "\n"+(*I);
+ ErrorText += _(", got ")+FingerPrint+")";
+ return;
+ }
+
}
// Done, move it into position
diff -ur apt-0.5.15lorg2.orig/apt-pkg/repository.h apt-0.5.15lorg2.vendor/apt-pkg/repository.h
--- apt-0.5.15lorg2.orig/apt-pkg/repository.h 2006-01-17 02:10:47 +0300
+++ apt-0.5.15lorg2.vendor/apt-pkg/repository.h 2006-03-20 20:32:17 +0300
@@ -33,7 +33,7 @@
string URI;
string Dist;
- string FingerPrint;
+ vector<string> FingerPrint;
string RootURI;
bool Acquire;
diff -ur apt-0.5.15lorg2.orig/apt-pkg/sourcelist.cc apt-0.5.15lorg2.vendor/apt-pkg/sourcelist.cc
--- apt-0.5.15lorg2.orig/apt-pkg/sourcelist.cc 2006-02-06 22:11:06 +0300
+++ apt-0.5.15lorg2.vendor/apt-pkg/sourcelist.cc 2006-03-20 20:31:00 +0300
@@ -150,7 +150,7 @@
{
for (const_iterator I = SrcList.begin(); I != SrcList.end(); I++)
delete *I;
- for (vector<Vendor const *>::const_iterator I = VendorList.begin();
+ for (vector<Vendor *>::iterator I = VendorList.begin();
I != VendorList.end(); I++)
delete *I;
}
@@ -174,38 +174,54 @@
if (ReadConfigFile(Cnf,CnfFile,true) == false)
return false;
- for (vector<Vendor const *>::const_iterator I = VendorList.begin();
+ for (vector<Vendor *>::iterator I = VendorList.begin();
I != VendorList.end(); I++)
delete *I;
VendorList.erase(VendorList.begin(),VendorList.end());
-
+
// Process 'simple-key' type sections
const Configuration::Item *Top = Cnf.Tree("simple-key");
for (Top = (Top == 0?0:Top->Child); Top != 0; Top = Top->Next)
{
Configuration Block(Top);
- Vendor *Vendor;
+ Vendor *Vendor = 0;
+ string Group = Block.Find("Group");
+ bool New = true;
- Vendor = new pkgSourceList::Vendor;
-
- Vendor->VendorID = Top->Tag;
- Vendor->FingerPrint = Block.Find("Fingerprint");
- Vendor->Description = Block.Find("Name");
+ for (vector<pkgSourceList::Vendor *>::iterator I = VendorList.begin();
+ I != VendorList.end(); I++)
+ {
+ if ((*I)->VendorID == Group)
+ {
+ Vendor = *I;
+ New = false;
+ break;
+ }
+ }
+
+ if (!Vendor)
+ {
+ Vendor = new pkgSourceList::Vendor;
+
+ Vendor->Description = Block.Find("Name");
+ Vendor->VendorID = Top->Tag;
+ }
+ string FingerPrint = Block.Find("Fingerprint");
// CNC:2002-08-15
- char *buffer = new char[Vendor->FingerPrint.length()+1];
+ char *buffer = new char[FingerPrint.length()+1];
char *p = buffer;;
- for (string::const_iterator I = Vendor->FingerPrint.begin();
- I != Vendor->FingerPrint.end(); I++)
+ for (string::const_iterator I = FingerPrint.begin();
+ I != FingerPrint.end(); I++)
{
if (*I != ' ' && *I != '\t')
*p++ = *I;
}
*p = 0;
- Vendor->FingerPrint = buffer;
+ Vendor->FingerPrint.push_back(string(buffer));
delete [] buffer;
- if (Vendor->FingerPrint.empty() == true ||
+ if (Vendor->FingerPrint.size() == 0 ||
Vendor->Description.empty() == true)
{
_error->Error(_("Vendor block %s is invalid"), Vendor->VendorID.c_str());
@@ -213,7 +229,8 @@
continue;
}
- VendorList.push_back(Vendor);
+ if (New)
+ VendorList.push_back(Vendor);
}
/* XXX Process 'group-key' type sections
@@ -355,7 +372,7 @@
return _error->Error(_("Malformed line %u in source list %s (vendor id)"),CurLine,File.c_str());
VendorID = string(VendorID,1,VendorID.size()-2);
- for (vector<Vendor const *>::const_iterator iter = VendorList.begin();
+ for (vector<Vendor *>::iterator iter = VendorList.begin();
iter != VendorList.end(); iter++)
{
if ((*iter)->VendorID == VendorID)
diff -ur apt-0.5.15lorg2.orig/apt-pkg/sourcelist.h apt-0.5.15lorg2.vendor/apt-pkg/sourcelist.h
--- apt-0.5.15lorg2.orig/apt-pkg/sourcelist.h 2006-01-17 02:10:47 +0300
+++ apt-0.5.15lorg2.vendor/apt-pkg/sourcelist.h 2006-03-20 20:31:00 +0300
@@ -48,7 +48,7 @@
struct Vendor
{
string VendorID;
- string FingerPrint;
+ vector<string> FingerPrint;
string Description;
/* Lets revisit these..
@@ -87,8 +87,8 @@
protected:
vector<pkgIndexFile *> SrcList;
- vector<Vendor const *> VendorList;
-
+ vector<Vendor *> VendorList;
+
public:
bool ReadMainList();