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 --- apt-pkg/contrib/configuration.cc | 11 ++++++++--- apt-pkg/contrib/strutl.cc | 25 +++++++++++++++++++------ apt-pkg/orderlist.cc | 8 ++++---- cmdline/apt-cdrom.cc | 35 ++++++++++++++++++++++------------- cmdline/indexcopy.cc | 8 ++++---- debian/changelog | 10 ++++++++++ doc/makefile | 2 +- dselect/install | 10 +++++----- 8 files changed, 73 insertions(+), 36 deletions(-) diff --git a/apt-pkg/contrib/configuration.cc b/apt-pkg/contrib/configuration.cc index 1c58b9881..302feee6e 100644 --- a/apt-pkg/contrib/configuration.cc +++ b/apt-pkg/contrib/configuration.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: configuration.cc,v 1.13 1999/07/02 23:17:00 jgg Exp $ +// $Id: configuration.cc,v 1.14 2000/01/16 05:36:17 jgg Exp $ /* ###################################################################### Configuration Class @@ -322,8 +322,9 @@ bool ReadConfigFile(Configuration &Conf,string FName) break; } } - + // Look for multi line comments + InQuote = false; for (char *I = Buffer; *I != 0; I++) { if (*I == '"') @@ -357,9 +358,13 @@ bool ReadConfigFile(Configuration &Conf,string FName) continue; // We now have a valid line fragment + InQuote = false; for (char *I = Buffer; *I != 0;) { - if (*I == '{' || *I == ';' || *I == '}') + if (*I == '"') + InQuote = !InQuote; + + if (InQuote == false && (*I == '{' || *I == ';' || *I == '}')) { // Put the last fragement into the buffer char *Start = Buffer; diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc index 9899694c6..f8a3f8e2b 100644 --- a/apt-pkg/contrib/strutl.cc +++ b/apt-pkg/contrib/strutl.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: strutl.cc,v 1.33 2000/01/14 06:26:37 jgg Exp $ +// $Id: strutl.cc,v 1.34 2000/01/16 05:36:17 jgg Exp $ /* ###################################################################### String Util - Some usefull string functions. @@ -87,7 +87,8 @@ char *_strtabexpand(char *String,size_t Len) // --------------------------------------------------------------------- /* This grabs a single word, converts any % escaped characters to their proper values and advances the pointer. Double quotes are understood - and striped out as well. This is for URI/URL parsing. */ + and striped out as well. This is for URI/URL parsing. It also can + understand [] brackets.*/ bool ParseQuoteWord(const char *&String,string &Res) { // Skip leading whitespace @@ -101,7 +102,13 @@ bool ParseQuoteWord(const char *&String,string &Res) { if (*C == '"') { - for (C++;*C != 0 && *C != '"'; C++); + for (C++; *C != 0 && *C != '"'; C++); + if (*C == 0) + return false; + } + if (*C == '[') + { + for (C++; *C != 0 && *C != ']'; C++); if (*C == 0) return false; } @@ -867,10 +874,10 @@ URI::operator string() Res = Access + ':'; if (Host.empty() == false) - { + { if (Access.empty() == false) Res += "//"; - + if (User.empty() == false) { Res += User; @@ -879,7 +886,13 @@ URI::operator string() Res += "@"; } - Res += Host; + // Add RFC 2732 escaping characters + if (Access.empty() == false && + (Host.find('/') != string::npos || Host.find(':') != string::npos)) + Res += '[' + Host + ']'; + else + Res += Host; + if (Port != 0) { char S[30]; diff --git a/apt-pkg/orderlist.cc b/apt-pkg/orderlist.cc index bfe91507e..fbd21d400 100644 --- a/apt-pkg/orderlist.cc +++ b/apt-pkg/orderlist.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: orderlist.cc,v 1.9 1999/11/04 06:05:02 jgg Exp $ +// $Id: orderlist.cc,v 1.10 2000/01/16 05:36:17 jgg Exp $ /* ###################################################################### Order List - Represents and Manipulates an ordered list of packages. @@ -209,7 +209,7 @@ bool pkgOrderList::OrderUnpack(string *FileList) for (iterator I = List; I != End; I++) { PkgIterator P(Cache,*I); - cout << P.Name() << endl; + cout << P.Name() << ' ' << IsMissing(P) << endl; }*/ return true; @@ -312,14 +312,14 @@ int pkgOrderList::OrderCompareA(const void *a, const void *b) // We order packages with a set state toward the front int Res; - if ((Res = BoolCompare(Me->IsNow(A),Me->IsNow(B))) == 0) + if ((Res = BoolCompare(Me->IsNow(A),Me->IsNow(B))) != 0) return -1*Res; // We order missing files to toward the end if (Me->FileList != 0) { if ((Res = BoolCompare(Me->IsMissing(A), - Me->IsMissing(B))) == 0) + Me->IsMissing(B))) != 0) return Res; } 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); diff --git a/debian/changelog b/debian/changelog index 1757efe4b..60fa2f7db 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,13 @@ +apt (0.3.16.1) unstable; urgency=low + + * RFC 2732 usage for CDROM URIs and fixes to apt-cdrom + * Fixed the configuration parser to not blow up if ; is in the config + string + * Applied visual patch to dselect install script . Closes #55214 + * Included the configure-index example + + -- Ben Gertzfield Fri, 14 Jan 2000 08:04:15 -0800 + apt (0.3.16) unstable; urgency=low * Made --no-download work. Closes: #52993 diff --git a/doc/makefile b/doc/makefile index 190d0622d..a8f95b70e 100644 --- a/doc/makefile +++ b/doc/makefile @@ -15,6 +15,6 @@ SOURCE = apt-cache.8 apt-get.8 apt-cdrom.8 apt.conf.5 sources.list.5 apt-config. include $(YODL_MANPAGE_H) # Examples -SOURCE = examples/apt.conf examples/sources.list +SOURCE = examples/apt.conf examples/sources.list examples/configure-index TO = $(DOC) include $(COPY_H) diff --git a/dselect/install b/dselect/install index 0806f7b35..93a0f1e44 100755 --- a/dselect/install +++ b/dselect/install @@ -20,15 +20,15 @@ yesno() { local ans def defp if [ "$2" ];then case $2 in - Y|y) defp="(Y/n)" def=y;; - N|n) defp="(y/N)" def=n;; + Y|y) defp="[Y/n]" def=y;; + N|n) defp="[y/N]" def=n;; *) echo "Bad default setting!" 1>&2; exit 1;; esac else - defp="(y/N)" def=n + defp="[y/N]" def=n fi while :;do - echo -n "$1$defp" 1>&3 + echo -n "$1 $defp" 1>&3 read ans case $ans in Y|y|N|n) break;; @@ -72,7 +72,7 @@ if [ $RES -eq 0 ]; then ;; prompt) exec 3>&1 - if [ `yesno "Do you want to erase the downloaded .deb files " y` = y ]; then + if [ `yesno "Do you want to erase the downloaded .deb files?" y` = y ]; then $APTGET clean && echo "Press enter to continue." && read RES && exit 0; fi ;; -- cgit v1.2.3