diff options
author | Arch Librarian <arch@canonical.com> | 2004-09-20 16:55:52 +0000 |
---|---|---|
committer | Arch Librarian <arch@canonical.com> | 2004-09-20 16:55:52 +0000 |
commit | 0f770a0ce8d5367cd1f026f651a9173ad065cf00 (patch) | |
tree | 2d12a43cfffb35a776da8002d5394015df438b45 | |
parent | b024fa2565b194e9848a1714342a81d9744e20ec (diff) | |
download | apt-0f770a0ce8d5367cd1f026f651a9173ad065cf00.tar.gz |
Updates to apt-cdrom to support integrated non-us nicel...
Author: jgg
Date: 2000-05-10 06:02:26 GMT
Updates to apt-cdrom to support integrated non-us nicely, thanks to Paul Wade.
-rw-r--r-- | cmdline/indexcopy.cc | 48 |
1 files changed, 32 insertions, 16 deletions
diff --git a/cmdline/indexcopy.cc b/cmdline/indexcopy.cc index 483aef8b1..a8243c085 100644 --- a/cmdline/indexcopy.cc +++ b/cmdline/indexcopy.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: indexcopy.cc,v 1.4 2000/01/16 05:36:17 jgg Exp $ +// $Id: indexcopy.cc,v 1.5 2000/05/10 06:02:26 jgg Exp $ /* ###################################################################### Index Copying - Aid for copying and verifying the index files @@ -368,7 +368,18 @@ bool IndexCopy::ReconstructChop(unsigned long &Chop,string Dir,string File) // --------------------------------------------------------------------- /* We look for things in dists/ notation and convert them to <dist> <component> form otherwise it is left alone. This also strips - the CD path. */ + the CD path. + + This implements a regex sort of like: + (.*)/dists/([^/]*)/(.*)/binary-* + ^ ^ ^- Component + | |-------- Distribution + |------------------- Path + + It was deciced to use only a single word for dist (rather than say + unstable/non-us) to increase the chance that each CD gets a single + line in sources.list. + */ void IndexCopy::ConvertToSourceList(string CD,string &Path) { char S[300]; @@ -395,21 +406,26 @@ void IndexCopy::ConvertToSourceList(string CD,string &Path) string Dist = string(Path,Slash,Slash2 - Slash); // Isolate the component - Slash = Path.find('/',Slash2+1); - if (Slash == string::npos || Slash + 2 >= Path.length()) - return; - string Comp = string(Path,Slash2+1,Slash - Slash2-1); - - // Verify the trailing binar - bit - Slash2 = Path.find('/',Slash + 1); - if (Slash == string::npos) - return; - string Binary = string(Path,Slash+1,Slash2 - Slash-1); - - if (Binary != S && Binary != "source") + Slash = Slash2; + for (unsigned I = 0; I != 10; I++) + { + Slash = Path.find('/',Slash+1); + if (Slash == string::npos || Slash + 2 >= Path.length()) + return; + string Comp = string(Path,Slash2+1,Slash - Slash2-1); + + // Verify the trailing binary- bit + string::size_type BinSlash = Path.find('/',Slash + 1); + if (Slash == string::npos) + return; + string Binary = string(Path,Slash+1,BinSlash - Slash-1); + + if (Binary != S && Binary != "source") + continue; + + Path = Dist + ' ' + Comp; return; - - Path = Dist + ' ' + Comp; + } } /*}}}*/ // IndexCopy::GrabFirst - Return the first Depth path components /*{{{*/ |