Author: jgg
Date: 1999-10-18 00:37:35 GMT
CDROMs are unmounted
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: acquire-method.cc,v 1.20 1999/08/04 02:39:13 jgg Exp $
+// $Id: acquire-method.cc,v 1.21 1999/10/18 00:37:35 jgg Exp $
/* ######################################################################
Acquire Method
/* ######################################################################
Acquire Method
if ((Flags & LocalOnly) == LocalOnly)
strcat(End,"Local-Only: true\n");
if ((Flags & LocalOnly) == LocalOnly)
strcat(End,"Local-Only: true\n");
+
+ if ((Flags & NeedsCleanup) == NeedsCleanup)
+ strcat(End,"Needs-Cleanup: true\n");
strcat(End,"\n");
if (write(STDOUT_FILENO,S,strlen(S)) != (signed)strlen(S))
strcat(End,"\n");
if (write(STDOUT_FILENO,S,strlen(S)) != (signed)strlen(S))
{
if (Single == false)
if (WaitFd(STDIN_FILENO) == false)
{
if (Single == false)
if (WaitFd(STDIN_FILENO) == false)
if (ReadMessages(STDIN_FILENO,Messages) == false)
if (ReadMessages(STDIN_FILENO,Messages) == false)
}
// Single mode exits if the message queue is empty
}
// Single mode exits if the message queue is empty
case 601:
if (Configuration(Message) == false)
return 100;
case 601:
if (Configuration(Message) == false)
return 100;
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: acquire-method.h,v 1.11 1999/07/20 05:53:33 jgg Exp $
+// $Id: acquire-method.h,v 1.12 1999/10/18 00:37:35 jgg Exp $
/* ######################################################################
Acquire Method - Method helper class + functions
/* ######################################################################
Acquire Method - Method helper class + functions
void URIStart(FetchResult &Res);
void URIDone(FetchResult &Res,FetchResult *Alt = 0);
bool MediaFail(string Required,string Drive);
void URIStart(FetchResult &Res);
void URIDone(FetchResult &Res,FetchResult *Alt = 0);
bool MediaFail(string Required,string Drive);
public:
enum CnfFlags {SingleInstance = (1<<0),
Pipeline = (1<<1), SendConfig = (1<<2),
public:
enum CnfFlags {SingleInstance = (1<<0),
Pipeline = (1<<1), SendConfig = (1<<2),
+ LocalOnly = (1<<3), NeedsCleanup = (1<<4)};
void Log(const char *Format,...);
void Status(const char *Format,...);
void Log(const char *Format,...);
void Status(const char *Format,...);
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: acquire-worker.cc,v 1.27 1999/08/28 01:49:56 jgg Exp $
+// $Id: acquire-worker.cc,v 1.28 1999/10/18 00:37:35 jgg Exp $
/* ######################################################################
Acquire Worker
/* ######################################################################
Acquire Worker
+ /* Closing of stdin is the signal to exit and die when the process
+ indicates it needs cleanup */
+ if (Config->NeedsCleanup == false)
+ kill(Process,SIGINT);
ExecWait(Process,Access.c_str(),true);
}
}
ExecWait(Process,Access.c_str(),true);
}
}
Config->Pipeline = StringToBool(LookupTag(Message,"Pipeline"),false);
Config->SendConfig = StringToBool(LookupTag(Message,"Send-Config"),false);
Config->LocalOnly = StringToBool(LookupTag(Message,"Local-Only"),false);
Config->Pipeline = StringToBool(LookupTag(Message,"Pipeline"),false);
Config->SendConfig = StringToBool(LookupTag(Message,"Send-Config"),false);
Config->LocalOnly = StringToBool(LookupTag(Message,"Local-Only"),false);
+ Config->NeedsCleanup = StringToBool(LookupTag(Message,"Needs-Cleanup"),false);
// Some debug text
if (Debug == true)
// Some debug text
if (Debug == true)
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: acquire-worker.h,v 1.10 1999/05/23 06:47:43 jgg Exp $
+// $Id: acquire-worker.h,v 1.11 1999/10/18 00:37:35 jgg Exp $
/* ######################################################################
Acquire Worker - Worker process manager
/* ######################################################################
Acquire Worker - Worker process manager
bool QueueItem(pkgAcquire::Queue::QItem *Item);
bool Start();
void Pulse();
bool QueueItem(pkgAcquire::Queue::QItem *Item);
bool Start();
void Pulse();
+ inline const MethodConfig *GetConf() const {return Config;};
Worker(Queue *OwnerQ,MethodConfig *Config,pkgAcquireStatus *Log);
Worker(MethodConfig *Config);
Worker(Queue *OwnerQ,MethodConfig *Config,pkgAcquireStatus *Log);
Worker(MethodConfig *Config);
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: acquire.cc,v 1.39 1999/10/16 19:53:18 jgg Exp $
+// $Id: acquire.cc,v 1.40 1999/10/18 00:37:35 jgg Exp $
/* ######################################################################
Acquire - File Acquiration
/* ######################################################################
Acquire - File Acquiration
-// pkgAcquire::Shutdown - Clean out the acquire object /*{{{*/
+// Acquire::Shutdown - Clean out the acquire object /*{{{*/
// ---------------------------------------------------------------------
/* */
void pkgAcquire::Shutdown()
// ---------------------------------------------------------------------
/* */
void pkgAcquire::Shutdown()
// Shut down the acquire bits
Running = false;
for (Queue *I = Queues; I != 0; I = I->Next)
// Shut down the acquire bits
Running = false;
for (Queue *I = Queues; I != 0; I = I->Next)
// Shut down the items
for (Item **I = Items.begin(); I != Items.end(); I++)
// Shut down the items
for (Item **I = Items.begin(); I != Items.end(); I++)
if (_error->PendingError())
return Failed;
if (_error->PendingError())
return Failed;
-// pkgAcquire::UriBegin - Start iterator for the uri list /*{{{*/
+// Acquire::UriBegin - Start iterator for the uri list /*{{{*/
// ---------------------------------------------------------------------
/* */
pkgAcquire::UriIterator pkgAcquire::UriBegin()
// ---------------------------------------------------------------------
/* */
pkgAcquire::UriIterator pkgAcquire::UriBegin()
return UriIterator(Queues);
}
/*}}}*/
return UriIterator(Queues);
}
/*}}}*/
-// pkgAcquire::UriEnd - End iterator for the uri list /*{{{*/
+// Acquire::UriEnd - End iterator for the uri list /*{{{*/
// ---------------------------------------------------------------------
/* */
pkgAcquire::UriIterator pkgAcquire::UriEnd()
// ---------------------------------------------------------------------
/* */
pkgAcquire::UriIterator pkgAcquire::UriEnd()
/* */
pkgAcquire::Queue::~Queue()
{
/* */
pkgAcquire::Queue::~Queue()
{
/*}}}*/
// Queue::Startup - Start the worker processes /*{{{*/
// ---------------------------------------------------------------------
/*}}}*/
// Queue::Startup - Start the worker processes /*{{{*/
// ---------------------------------------------------------------------
+/* It is possible for this to be called with a pre-existing set of
+ workers. */
bool pkgAcquire::Queue::Startup()
{
bool pkgAcquire::Queue::Startup()
{
- Shutdown();
-
- URI U(Name);
- pkgAcquire::MethodConfig *Cnf = Owner->GetConfig(U.Access);
- if (Cnf == 0)
- return false;
-
- Workers = new Worker(this,Cnf,Owner->Log);
- Owner->Add(Workers);
- if (Workers->Start() == false)
- return false;
-
- /* When pipelining we commit 10 items. This needs to change when we
- added other source retry to have cycle maintain a pipeline depth
- on its own. */
- if (Cnf->Pipeline == true)
- MaxPipeDepth = 10;
- else
- MaxPipeDepth = 1;
+ if (Workers == 0)
+ {
+ URI U(Name);
+ pkgAcquire::MethodConfig *Cnf = Owner->GetConfig(U.Access);
+ if (Cnf == 0)
+ return false;
+
+ Workers = new Worker(this,Cnf,Owner->Log);
+ Owner->Add(Workers);
+ if (Workers->Start() == false)
+ return false;
+
+ /* When pipelining we commit 10 items. This needs to change when we
+ added other source retry to have cycle maintain a pipeline depth
+ on its own. */
+ if (Cnf->Pipeline == true)
+ MaxPipeDepth = 10;
+ else
+ MaxPipeDepth = 1;
+ }
return Cycle();
}
/*}}}*/
// Queue::Shutdown - Shutdown the worker processes /*{{{*/
// ---------------------------------------------------------------------
return Cycle();
}
/*}}}*/
// Queue::Shutdown - Shutdown the worker processes /*{{{*/
// ---------------------------------------------------------------------
-/* */
-bool pkgAcquire::Queue::Shutdown()
+/* If final is true then all workers are eliminated, otherwise only workers
+ that do not need cleanup are removed */
+bool pkgAcquire::Queue::Shutdown(bool Final)
{
// Delete all of the workers
{
// Delete all of the workers
+ pkgAcquire::Worker **Cur = &Workers;
+ while (*Cur != 0)
- pkgAcquire::Worker *Jnk = Workers;
- Workers = Workers->NextQueue;
- Owner->Remove(Jnk);
- delete Jnk;
+ pkgAcquire::Worker *Jnk = *Cur;
+ if (Final == true || Jnk->GetConf()->NeedsCleanup == false)
+ {
+ *Cur = Jnk->NextQueue;
+ Owner->Remove(Jnk);
+ delete Jnk;
+ }
+ else
+ Cur = &(*Cur)->NextQueue;
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: acquire.h,v 1.24 1999/07/20 05:53:33 jgg Exp $
+// $Id: acquire.h,v 1.25 1999/10/18 00:37:35 jgg Exp $
/* ######################################################################
Acquire - File Acquiration
/* ######################################################################
Acquire - File Acquiration
bool ItemDone(QItem *Itm);
bool Startup();
bool ItemDone(QItem *Itm);
bool Startup();
+ bool Shutdown(bool Final);
bool Cycle();
void Bump();
bool Cycle();
void Bump();
bool Pipeline;
bool SendConfig;
bool LocalOnly;
bool Pipeline;
bool SendConfig;
bool LocalOnly;
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: apt-get.cc,v 1.79 1999/10/17 07:49:41 jgg Exp $
+// $Id: apt-get.cc,v 1.80 1999/10/18 00:37:35 jgg Exp $
/* ######################################################################
apt-get - Cover for dpkg
/* ######################################################################
apt-get - Cover for dpkg
while (1)
{
if (_config->FindB("APT::Get::No-Download",false) == false)
while (1)
{
if (_config->FindB("APT::Get::No-Download",false) == false)
- if( Fetcher.Run() == pkgAcquire::Failed)
+ if (Fetcher.Run() == pkgAcquire::Failed)
return false;
// Print out errors
return false;
// Print out errors
(*I)->Complete == true)
continue;
(*I)->Complete == true)
continue;
if ((*I)->Status == pkgAcquire::Item::StatIdle)
{
Transient = true;
if ((*I)->Status == pkgAcquire::Item::StatIdle)
{
Transient = true;
* Fix Perl or group pre-depends thing Closes: #46091, #46096, #46233, #45901
* Fix handling of dpkg's conversions from < -> <= Closes: #46094, #47088
* Fix Perl or group pre-depends thing Closes: #46091, #46096, #46233, #45901
* Fix handling of dpkg's conversions from < -> <= Closes: #46094, #47088
- * Make unparsable priorities non-fatal Closes: #46266, #46267, #46293, #46298
+ * Make unparsable priorities non-fatal Closes: #46266, #46267, #46293, #46298
* Fix handling of '/' for the dist name. Closes: #43830, #45640, #45692
* Fixed 'Method gave a blank filename' error from IMS queries onto CDs.
Closes: #45034, #45695, #46537
* Fix handling of '/' for the dist name. Closes: #43830, #45640, #45692
* Fixed 'Method gave a blank filename' error from IMS queries onto CDs.
Closes: #45034, #45695, #46537
* Tweaked Dselect 'update' script to re-gen the avail file even in the
event of a failure Closes: #47112
* Retries for source archives too Closes: #47529
* Tweaked Dselect 'update' script to re-gen the avail file even in the
event of a failure Closes: #47112
* Retries for source archives too Closes: #47529
+ * Unmounts CDROMs iff it mounted them Closes: #45299
-- Jason Gunthorpe <jgg@debian.org> Fri, 3 Sep 1999 09:04:28 -0700
-- Jason Gunthorpe <jgg@debian.org> Fri, 3 Sep 1999 09:04:28 -0700
<title>APT Method Interface </title>
<author>Jason Gunthorpe <email>jgg@debian.org</email></author>
<title>APT Method Interface </title>
<author>Jason Gunthorpe <email>jgg@debian.org</email></author>
-<version>$Id: method.sgml,v 1.6 1998/12/14 04:00:34 jgg Exp $</version>
+<version>$Id: method.sgml,v 1.7 1999/10/18 00:37:36 jgg Exp $</version>
<abstract>
This document describes the interface that APT uses to the archive
<abstract>
This document describes the interface that APT uses to the archive
<tag>Pipeline<item>The method is capable of pipelining.
<tag>Local<item>The method only returns Filename: feilds.
<tag>Send-Config<item>Send configuration to the method.
<tag>Pipeline<item>The method is capable of pipelining.
<tag>Local<item>The method only returns Filename: feilds.
<tag>Send-Config<item>Send configuration to the method.
+<tag>Needs-Cleanup<item>The process is kept around while the files it returned
+are being used. This is primarily intended for CDROM and File URIs that need
+to unmount filesystems.
<tag>Version<item>Version string for the method
</taglist>
<tag>Version<item>Version string for the method
</taglist>
Displays the capabilities of the method. Methods should set the
pipeline bit if their underlying protocol supports pipeling. The
only known method that does support pipelining is http.
Displays the capabilities of the method. Methods should set the
pipeline bit if their underlying protocol supports pipeling. The
only known method that does support pipelining is http.
-Fields: Version, Single-Instance, Pre-Scan, Pipeline, Send-Config
+Fields: Version, Single-Instance, Pre-Scan, Pipeline, Send-Config,
+Needs-Cleanup
<tag>101 Log<item>
A log message may be printed to the screen if debugging is enabled. This
<tag>101 Log<item>
A log message may be printed to the screen if debugging is enabled. This
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: cdrom.cc,v 1.15 1999/10/02 04:14:54 jgg Exp $
+// $Id: cdrom.cc,v 1.16 1999/10/18 00:37:36 jgg Exp $
/* ######################################################################
CDROM URI method for APT
/* ######################################################################
CDROM URI method for APT
bool DatabaseLoaded;
::Configuration Database;
string CurrentID;
bool DatabaseLoaded;
::Configuration Database;
string CurrentID;
+ string CDROM;
+ bool Mounted;
virtual bool Fetch(FetchItem *Itm);
string GetID(string Name);
virtual bool Fetch(FetchItem *Itm);
string GetID(string Name);
// ---------------------------------------------------------------------
/* */
CDROMMethod::CDROMMethod() : pkgAcqMethod("1.0",SingleInstance | LocalOnly |
// ---------------------------------------------------------------------
/* */
CDROMMethod::CDROMMethod() : pkgAcqMethod("1.0",SingleInstance | LocalOnly |
- SendConfig), DatabaseLoaded(false)
+ SendConfig | NeedsCleanup),
+ DatabaseLoaded(false),
+ Mounted(false)
+// CDROMMethod::Exit - Unmount the disc if necessary /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+void CDROMMethod::Exit()
+{
+ if (Mounted == true)
+ UnmountCdrom(CDROM);
+}
+ /*}}}*/
// CDROMMethod::GetID - Search the database for a matching string /*{{{*/
// ---------------------------------------------------------------------
/* */
// CDROMMethod::GetID - Search the database for a matching string /*{{{*/
// ---------------------------------------------------------------------
/* */
- string CDROM = _config->FindDir("Acquire::cdrom::mount","/cdrom/");
+ CDROM = _config->FindDir("Acquire::cdrom::mount","/cdrom/");
if (CDROM[0] == '.')
CDROM= SafeGetCWD() + '/' + CDROM;
string NewID;
if (CDROM[0] == '.')
CDROM= SafeGetCWD() + '/' + CDROM;
string NewID;