From 7834cb579fe88a11bd3850363bbd4c77797581bb Mon Sep 17 00:00:00 2001 From: Arch Librarian Date: Mon, 20 Sep 2004 16:55:40 +0000 Subject: More fixes Author: jgg Date: 2000-01-16 05:36:17 GMT More fixes --- cmdline/apt-cdrom.cc | 35 ++++++++++++++++++++++------------- cmdline/indexcopy.cc | 8 ++++---- 2 files changed, 26 insertions(+), 17 deletions(-) (limited to 'cmdline') diff --git a/cmdline/apt-cdrom.cc b/cmdline/apt-cdrom.cc index 9b826a566..35a024a10 100644 --- a/cmdline/apt-cdrom.cc +++ b/cmdline/apt-cdrom.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: apt-cdrom.cc,v 1.32 1999/09/03 05:46:48 jgg Exp $ +// $Id: apt-cdrom.cc,v 1.33 2000/01/16 05:36:17 jgg Exp $ /* ###################################################################### APT CDROM - Tool for handling APT's CDROM database. @@ -189,6 +189,8 @@ int Score(string Path) Res += 2; if (Path.find("/source/") != string::npos) Res += 1; + if (Path.find("/debian/") != string::npos) + Res -= 1; return Res; } /*}}}*/ @@ -366,7 +368,8 @@ bool WriteSourceList(string Name,vector &List,bool Source) "Failed to open %s.new",File.c_str()); // Create a short uri without the path - string ShortURI = "cdrom:" + Name + "/"; + string ShortURI = "cdrom:[" + Name + "]/"; + string ShortURI2 = "cdrom:" + Name + "/"; // For Compatibility const char *Type; if (Source == true) @@ -398,8 +401,8 @@ bool WriteSourceList(string Name,vector &List,bool Source) string::size_type Space = (*I).find(' '); if (Space == string::npos) return _error->Error("Internal error"); - Out << Type << " \"cdrom:" << Name << "/" << string(*I,0,Space) << - "\" " << string(*I,Space+1) << endl; + Out << Type << " cdrom:[" << Name << "]/" << string(*I,0,Space) << + " " << string(*I,Space+1) << endl; } } First = false; @@ -416,7 +419,8 @@ bool WriteSourceList(string Name,vector &List,bool Source) } // Emit lines like this one - if (cType != Type || string(URI,0,ShortURI.length()) != ShortURI) + if (cType != Type || (string(URI,0,ShortURI.length()) != ShortURI && + string(URI,0,ShortURI.length()) != ShortURI2)) { Out << Buffer << endl; continue; @@ -432,8 +436,8 @@ bool WriteSourceList(string Name,vector &List,bool Source) if (Space == string::npos) return _error->Error("Internal error"); - Out << "deb \"cdrom:" << Name << "/" << string(*I,0,Space) << - "\" " << string(*I,Space+1) << endl; + Out << "deb cdrom:[" << Name << "]/" << string(*I,0,Space) << + " " << string(*I,Space+1) << endl; } } @@ -597,11 +601,11 @@ bool DoAdd(CommandLine &) string::iterator J = Name.begin(); for (; J != Name.end(); J++) - if (*J == '/' || *J == '"' || *J == ':') + if (*J == '"' || *J == ']' || *J == '[') *J = '_'; Database.Set("CD::" + ID,Name); - cout << "This Disc is called '" << Name << "'" << endl; + cout << "This Disc is called:" << endl << " '" << Name << "'" << endl; // Copy the package files to the state directory PackageCopy Copy; @@ -633,8 +637,8 @@ bool DoAdd(CommandLine &) if (Space == string::npos) return _error->Error("Internal error"); - cout << "deb \"cdrom:" << Name << "/" << string(*I,0,Space) << - "\" " << string(*I,Space+1) << endl; + cout << "deb cdrom:[" << Name << "]/" << string(*I,0,Space) << + " " << string(*I,Space+1) << endl; } for (vector::iterator I = sList.begin(); I != sList.end(); I++) @@ -643,11 +647,16 @@ bool DoAdd(CommandLine &) if (Space == string::npos) return _error->Error("Internal error"); - cout << "deb-src \"cdrom:" << Name << "/" << string(*I,0,Space) << - "\" " << string(*I,Space+1) << endl; + cout << "deb-src cdrom:[" << Name << "]/" << string(*I,0,Space) << + " " << string(*I,Space+1) << endl; } cout << "Repeat this process for the rest of the CDs in your set." << endl; + + // Unmount and finish + if (_config->FindB("APT::CDROM::NoMount",false) == false) + UnmountCdrom(CDROM); + return true; } /*}}}*/ diff --git a/cmdline/indexcopy.cc b/cmdline/indexcopy.cc index c8bbd754d..483aef8b1 100644 --- a/cmdline/indexcopy.cc +++ b/cmdline/indexcopy.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: indexcopy.cc,v 1.3 1999/12/10 23:40:29 jgg Exp $ +// $Id: indexcopy.cc,v 1.4 2000/01/16 05:36:17 jgg Exp $ /* ###################################################################### Index Copying - Aid for copying and verifying the index files @@ -113,7 +113,7 @@ bool IndexCopy::CopyPackages(string CDROM,string Name,vector &List) // Open the output file char S[400]; - sprintf(S,"cdrom:%s/%s%s",Name.c_str(),(*I).c_str() + CDROM.length(), + sprintf(S,"cdrom:[%s]/%s%s",Name.c_str(),(*I).c_str() + CDROM.length(), GetFileName()); string TargetF = _config->FindDir("Dir::State::lists") + "partial/"; TargetF += URItoFileName(S); @@ -231,7 +231,7 @@ bool IndexCopy::CopyPackages(string CDROM,string Name,vector &List) return _error->Errno("rename","Failed to rename"); // Copy the release file - sprintf(S,"cdrom:%s/%sRelease",Name.c_str(),(*I).c_str() + CDROM.length()); + sprintf(S,"cdrom:[%s]/%sRelease",Name.c_str(),(*I).c_str() + CDROM.length()); string TargetF = _config->FindDir("Dir::State::lists") + "partial/"; TargetF += URItoFileName(S); if (FileExists(*I + "Release") == true) @@ -386,7 +386,7 @@ void IndexCopy::ConvertToSourceList(string CD,string &Path) // Not a dists type. if (stringcmp(Path.begin(),Path.begin()+strlen("dists/"),"dists/") != 0) return; - + // Isolate the dist string::size_type Slash = strlen("dists/"); string::size_type Slash2 = Path.find('/',Slash + 1); -- cgit v1.2.3