Author: jgg
Date: 1999-05-23 05:45:12 GMT
Fixed cd stuff and some minor bugs
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// -*- 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
/* ######################################################################
APT Config - Program to manipulate APT configuration files
{
for (const char **I = CmdL.FileList + 1; *I != 0; I += 2)
{
{
for (const char **I = CmdL.FileList + 1; *I != 0; I += 2)
{
+ if (I[1] == 0 || strlen(I[1]) == 0)
return _error->Error("Arguments not in pairs");
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;
}
if (_config->Exists(I[1]) == true)
cout << *I << "=\"" << _config->Find(I[1]) << '"' << endl;
}
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// -*- 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
/* ######################################################################
apt-get - Cover for dpkg
}
if (_config->FindB("APT::Get::Download-Only",false) == true)
}
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");
if (Failed == true && _config->FindB("APT::Get::Fix-Missing",false) == false)
{
if (Failed == true && _config->FindB("APT::Get::Fix-Missing",false) == false)
{
Closes: #37499
* Man page typo Closes: #37762
* Fixed parsing of the Source: line. Closes: #37679
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 <jgg@debian.org> Wed, 12 May 1999 09:18:49 -0700
-- Jason Gunthorpe <jgg@debian.org> Wed, 12 May 1999 09:18:49 -0700
This will set the shell environment variable $OPTS to the value of
MyApp::Options with a default of -f.
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()
enddit()
manpageoptions()
DPKG="/usr/bin/dpkg"
set -e
RES=`apt-config shell CLEAN DSelect::Clean OPTS DSelect::Options \
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/`
# Finished OK
if [ $RES -eq 0 ]; then
# 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)
# Check the cleaning mode
case `echo $CLEAN | tr '[:upper:]' '[:lower:]'` in
auto)
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// -*- 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
/* ######################################################################
CDROM URI method for APT
-// 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)
{
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;
- }
-
const Configuration::Item *Top = Database.Tree("CD");
if (Top != 0)
Top = Top->Child;
const Configuration::Item *Top = Database.Tree("CD");
if (Top != 0)
Top = Top->Child;
if (Top->Value == Name)
return Top->Tag;
if (Top->Value == Name)
return Top->Tag;
return string();
}
/*}}}*/
return string();
}
/*}}}*/
URIDone(Res);
return true;
}
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.
// 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");
{
Fail("Please use apt-cdrom to make this CD recognized by APT."
" apt-get update cannot be used to add new CDs");
}
// We already have a CD inserted, but it is the wrong one
}
// 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;
{
Fail("Wrong CD",true);
return true;
+ if (Database.Find("CD::" + NewID) == Get.Host)
break;
// I suppose this should prompt somehow?
break;
// I suppose this should prompt somehow?
- // 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;