From e42eb508e01f4de6def088fe941344d3ca733fa5 Mon Sep 17 00:00:00 2001 From: Arch Librarian Date: Mon, 20 Sep 2004 16:53:46 +0000 Subject: Fixed cd stuff and some minor bugs Author: jgg Date: 1999-05-23 05:45:12 GMT Fixed cd stuff and some minor bugs --- cmdline/apt-config.cc | 15 +++++++-- cmdline/apt-get.cc | 6 +++- debian/changelog | 5 ++- doc/apt-config.8.yo | 3 ++ dselect/install | 9 +++++- methods/cdrom.cc | 86 ++++++++++++++++++++++----------------------------- 6 files changed, 70 insertions(+), 54 deletions(-) diff --git a/cmdline/apt-config.cc b/cmdline/apt-config.cc index 3a2a4d9ca..c626a1ee0 100644 --- a/cmdline/apt-config.cc +++ b/cmdline/apt-config.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: apt-config.cc,v 1.4 1999/03/29 19:28:52 jgg Exp $ +// $Id: apt-config.cc,v 1.5 1999/05/23 05:45:12 jgg Exp $ /* ###################################################################### APT Config - Program to manipulate APT configuration files @@ -31,8 +31,19 @@ bool DoShell(CommandLine &CmdL) { for (const char **I = CmdL.FileList + 1; *I != 0; I += 2) { - if (I[1] == 0) + if (I[1] == 0 || strlen(I[1]) == 0) return _error->Error("Arguments not in pairs"); + + // Check if the caller has requested a directory path + if (I[1][strlen(I[1])-1] == '/') + { + char S[300]; + strcpy(S,I[1]); + S[strlen(S)-1] = 0; + if (_config->Exists(S) == true) + cout << *I << "=\"" << _config->FindDir(S) << '"' << endl; + } + if (_config->Exists(I[1]) == true) cout << *I << "=\"" << _config->Find(I[1]) << '"' << endl; } diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index ea56e4c22..043cc35bc 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: apt-get.cc,v 1.59 1999/05/20 05:53:38 jgg Exp $ +// $Id: apt-get.cc,v 1.60 1999/05/23 05:45:12 jgg Exp $ /* ###################################################################### apt-get - Cover for dpkg @@ -614,7 +614,11 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true,bool Saftey = } if (_config->FindB("APT::Get::Download-Only",false) == true) + { + if (Failed == false && _config->FindB("APT::Get::Fix-Missing",false) == false) + return _error->Error("Some files failed to download"); return true; + } if (Failed == true && _config->FindB("APT::Get::Fix-Missing",false) == false) { diff --git a/debian/changelog b/debian/changelog index ffdb1a2a7..4bfe44249 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,7 +7,10 @@ apt (0.3.6.1) unstable; urgency=low Closes: #37499 * Man page typo Closes: #37762 * Fixed parsing of the Source: line. Closes: #37679 - * Dpkg/dpkg-hurd source bug. Closes: #38004 + * Dpkg/dpkg-hurd source bug. Closes: #38004, #38032 + * Added a check for an empty cache directory. Closes: #37963 + * Return a failure code if -d is given and packages fail to download. + Closes: #38127 -- Jason Gunthorpe Wed, 12 May 1999 09:18:49 -0700 diff --git a/doc/apt-config.8.yo b/doc/apt-config.8.yo index f15d669ee..93da32905 100644 --- a/doc/apt-config.8.yo +++ b/doc/apt-config.8.yo @@ -38,6 +38,9 @@ eval $RES This will set the shell environment variable $OPTS to the value of MyApp::Options with a default of -f. +If the configuration item to retrieve is prefixed with a / then it will +be retrieved using filename mode which prepends base paths. + enddit() manpageoptions() diff --git a/dselect/install b/dselect/install index 572e8d1c3..6cf5dcf1a 100755 --- a/dselect/install +++ b/dselect/install @@ -7,7 +7,8 @@ APTGET="/usr/bin/apt-get" DPKG="/usr/bin/dpkg" set -e RES=`apt-config shell CLEAN DSelect::Clean OPTS DSelect::Options \ - DPKG Dir::Bin::dpkg APTGET Dir::Bin::apt-get` + DPKG Dir::Bin::dpkg/ APTGET Dir::Bin::apt-get/ \ + ARCHIVES Dir::Cache::Archives/` eval $RES set +e @@ -47,6 +48,12 @@ fi # Finished OK if [ $RES -eq 0 ]; then + + if [ `ls $ARCHIVES $ARCHIVES/partial | egrep -v "^lock$|^partial$" | wc -l` \ + -eq 0 ]; then + exit 0 + fi + # Check the cleaning mode case `echo $CLEAN | tr '[:upper:]' '[:lower:]'` in auto) diff --git a/methods/cdrom.cc b/methods/cdrom.cc index 778cc63b1..a44465766 100644 --- a/methods/cdrom.cc +++ b/methods/cdrom.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: cdrom.cc,v 1.8 1999/03/28 01:37:26 jgg Exp $ +// $Id: cdrom.cc,v 1.9 1999/05/23 05:45:13 jgg Exp $ /* ###################################################################### CDROM URI method for APT @@ -40,40 +40,23 @@ CDROMMethod::CDROMMethod() : pkgAcqMethod("1.0",SingleInstance | LocalOnly | { }; /*}}}*/ -// CDROMMethod::GetID - Get the ID hash for /*{{{*/ +// CDROMMethod::GetID - Search the database for a matching string /*{{{*/ // --------------------------------------------------------------------- -/* We search the configuration space for the name and then return the ID - tag associated with it. */ +/* */ string CDROMMethod::GetID(string Name) { - if (DatabaseLoaded == false) - { - // Read the database - string DFile = _config->FindFile("Dir::State::cdroms"); - if (FileExists(DFile) == true) - { - if (ReadConfigFile(Database,DFile) == false) - { - _error->Error("Unable to read the cdrom database %s", - DFile.c_str()); - return string(); - } - } - DatabaseLoaded = true; - } - + // Search for an ID const Configuration::Item *Top = Database.Tree("CD"); if (Top != 0) Top = Top->Child; - + for (; Top != 0;) - { + { if (Top->Value == Name) return Top->Tag; - + Top = Top->Next; - } - + } return string(); } /*}}}*/ @@ -95,13 +78,23 @@ bool CDROMMethod::Fetch(FetchItem *Itm) URIDone(Res); return true; } - - string ID = GetID(Get.Host); - if (_error->PendingError() == true) - return false; - + + // Load the database + if (DatabaseLoaded == false) + { + // Read the database + string DFile = _config->FindFile("Dir::State::cdroms"); + if (FileExists(DFile) == true) + { + if (ReadConfigFile(Database,DFile) == false) + return _error->Error("Unable to read the cdrom database %s", + DFile.c_str()); + } + DatabaseLoaded = true; + } + // All non IMS queries for package files fail. - if (Itm->IndexFile == true || ID.empty() == true) + if (Itm->IndexFile == true || GetID(Get.Host).empty() == true) { Fail("Please use apt-cdrom to make this CD recognized by APT." " apt-get update cannot be used to add new CDs"); @@ -109,7 +102,7 @@ bool CDROMMethod::Fetch(FetchItem *Itm) } // We already have a CD inserted, but it is the wrong one - if (CurrentID.empty() == false && ID != CurrentID) + if (CurrentID.empty() == false && Database.Find("CD::" + CurrentID) != Get.Host) { Fail("Wrong CD",true); return true; @@ -125,7 +118,7 @@ bool CDROMMethod::Fetch(FetchItem *Itm) return false; // A hit - if (NewID == ID) + if (Database.Find("CD::" + NewID) == Get.Host) break; // I suppose this should prompt somehow? @@ -142,23 +135,18 @@ bool CDROMMethod::Fetch(FetchItem *Itm) MountCdrom(CDROM); } - // ID matches - if (NewID == ID) - { - Res.Filename = CDROM + File; - struct stat Buf; - if (stat(Res.Filename.c_str(),&Buf) != 0) - return _error->Error("File not found"); - - CurrentID = ID; - Res.LastModified = Buf.st_mtime; - Res.IMSHit = true; - Res.Size = Buf.st_size; - URIDone(Res); - return true; - } + // Found a CD + Res.Filename = CDROM + File; + struct stat Buf; + if (stat(Res.Filename.c_str(),&Buf) != 0) + return _error->Error("File not found"); - return _error->Error("CDROM not found"); + CurrentID = NewID; + Res.LastModified = Buf.st_mtime; + Res.IMSHit = true; + Res.Size = Buf.st_size; + URIDone(Res); + return true; } /*}}}*/ -- cgit v1.2.3