diff options
author | Arch Librarian <arch@canonical.com> | 2004-09-20 16:55:42 +0000 |
---|---|---|
committer | Arch Librarian <arch@canonical.com> | 2004-09-20 16:55:42 +0000 |
commit | 459681d3b8093c20a39400c00bcee43d26e964c6 (patch) | |
tree | f7266e70c8ec70da188689e7838880801e06d3b1 | |
parent | 63d3141a1f9875ad970ad7850e56a9bf97256895 (diff) |
More CD fixes
Author: jgg
Date: 2000-01-17 07:11:49 GMT
More CD fixes
-rw-r--r-- | apt-pkg/acquire-item.cc | 28 | ||||
-rw-r--r-- | apt-pkg/acquire-item.h | 17 | ||||
-rw-r--r-- | apt-pkg/acquire-method.cc | 5 | ||||
-rw-r--r-- | apt-pkg/acquire-method.h | 7 | ||||
-rw-r--r-- | apt-pkg/acquire-worker.cc | 16 | ||||
-rw-r--r-- | apt-pkg/acquire.cc | 7 | ||||
-rw-r--r-- | apt-pkg/acquire.h | 3 | ||||
-rw-r--r-- | apt-pkg/contrib/fileutl.cc | 4 | ||||
-rw-r--r-- | cmdline/apt-cdrom.cc | 6 | ||||
-rw-r--r-- | methods/cdrom.cc | 8 |
10 files changed, 61 insertions, 40 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index ddaf260ea..0de5eef7c 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: acquire-item.cc,v 1.40 1999/10/31 06:32:27 jgg Exp $ +// $Id: acquire-item.cc,v 1.41 2000/01/17 07:11:49 jgg Exp $ /* ###################################################################### Acquire Item - Item to acquire @@ -88,7 +88,8 @@ void pkgAcquire::Item::Start(string /*Message*/,unsigned long Size) // Acquire::Item::Done - Item downloaded OK /*{{{*/ // --------------------------------------------------------------------- /* */ -void pkgAcquire::Item::Done(string Message,unsigned long Size,string) +void pkgAcquire::Item::Done(string Message,unsigned long Size,string, + pkgAcquire::MethodConfig *Cnf) { // We just downloaded something.. string FileName = LookupTag(Message,"Filename"); @@ -175,9 +176,10 @@ string pkgAcqIndex::Custom600Headers() to the uncompressed version of the file. If this is so the file is copied into the partial directory. In all other cases the file is decompressed with a gzip uri. */ -void pkgAcqIndex::Done(string Message,unsigned long Size,string MD5) +void pkgAcqIndex::Done(string Message,unsigned long Size,string MD5, + pkgAcquire::MethodConfig *Cfg) { - Item::Done(Message,Size,MD5); + Item::Done(Message,Size,MD5,Cfg); if (Decompression == true) { @@ -285,9 +287,10 @@ string pkgAcqIndexRel::Custom600Headers() /* The release file was not placed into the download directory then a copy URI is generated and it is copied there otherwise the file in the partial directory is moved into .. and the URI is finished. */ -void pkgAcqIndexRel::Done(string Message,unsigned long Size,string MD5) +void pkgAcqIndexRel::Done(string Message,unsigned long Size,string MD5, + pkgAcquire::MethodConfig *Cfg) { - Item::Done(Message,Size,MD5); + Item::Done(Message,Size,MD5,Cfg); string FileName = LookupTag(Message,"Filename"); if (FileName.empty() == true) @@ -472,9 +475,10 @@ bool pkgAcqArchive::QueueNext() // AcqArchive::Done - Finished fetching /*{{{*/ // --------------------------------------------------------------------- /* */ -void pkgAcqArchive::Done(string Message,unsigned long Size,string Md5Hash) +void pkgAcqArchive::Done(string Message,unsigned long Size,string Md5Hash, + pkgAcquire::MethodConfig *Cfg) { - Item::Done(Message,Size,Md5Hash); + Item::Done(Message,Size,Md5Hash,Cfg); // Check the size if (Size != Version->Size) @@ -597,7 +601,8 @@ pkgAcqFile::pkgAcqFile(pkgAcquire *Owner,string URI,string MD5, // AcqFile::Done - Item downloaded OK /*{{{*/ // --------------------------------------------------------------------- /* */ -void pkgAcqFile::Done(string Message,unsigned long Size,string MD5) +void pkgAcqFile::Done(string Message,unsigned long Size,string MD5, + pkgAcquire::MethodConfig *Cnf) { // Check the md5 if (Md5Hash.empty() == false && MD5.empty() == false) @@ -611,7 +616,7 @@ void pkgAcqFile::Done(string Message,unsigned long Size,string MD5) } } - Item::Done(Message,Size,MD5); + Item::Done(Message,Size,MD5,Cnf); string FileName = LookupTag(Message,"Filename"); if (FileName.empty() == true) @@ -631,7 +636,8 @@ void pkgAcqFile::Done(string Message,unsigned long Size,string MD5) if (FileName != DestFile) { Local = true; - if (_config->FindB("Acquire::Source-Symlinks",true) == false) + if (_config->FindB("Acquire::Source-Symlinks",true) == false || + Cnf->Removable == true) { Desc.URI = "copy:" + FileName; QueueURI(Desc); diff --git a/apt-pkg/acquire-item.h b/apt-pkg/acquire-item.h index fd74280b8..459d7d26d 100644 --- a/apt-pkg/acquire-item.h +++ b/apt-pkg/acquire-item.h @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: acquire-item.h,v 1.22 1999/10/17 20:58:36 jgg Exp $ +// $Id: acquire-item.h,v 1.23 2000/01/17 07:11:49 jgg Exp $ /* ###################################################################### Acquire Item - Item to acquire @@ -62,7 +62,8 @@ class pkgAcquire::Item // Action members invoked by the worker virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf); - virtual void Done(string Message,unsigned long Size,string Md5Hash); + virtual void Done(string Message,unsigned long Size,string Md5Hash, + pkgAcquire::MethodConfig *Cnf); virtual void Start(string Message,unsigned long Size); virtual string Custom600Headers() {return string();}; virtual string DescURI() = 0; @@ -88,7 +89,8 @@ class pkgAcqIndex : public pkgAcquire::Item public: // Specialized action members - virtual void Done(string Message,unsigned long Size,string Md5Hash); + virtual void Done(string Message,unsigned long Size,string Md5Hash, + pkgAcquire::MethodConfig *Cnf); virtual string Custom600Headers(); virtual string DescURI() {return Location->PackagesURI();}; @@ -107,7 +109,8 @@ class pkgAcqIndexRel : public pkgAcquire::Item // Specialized action members virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf); - virtual void Done(string Message,unsigned long Size,string Md5Hash); + virtual void Done(string Message,unsigned long Size,string Md5Hash, + pkgAcquire::MethodConfig *Cnf); virtual string Custom600Headers(); virtual string DescURI() {return Location->ReleaseURI();}; @@ -136,7 +139,8 @@ class pkgAcqArchive : public pkgAcquire::Item // Specialized action members virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf); - virtual void Done(string Message,unsigned long Size,string Md5Hash); + virtual void Done(string Message,unsigned long Size,string Md5Hash, + pkgAcquire::MethodConfig *Cnf); virtual string MD5Sum() {return MD5;}; virtual string DescURI() {return Desc.URI;}; virtual void Finished(); @@ -157,7 +161,8 @@ class pkgAcqFile : public pkgAcquire::Item // Specialized action members virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf); - virtual void Done(string Message,unsigned long Size,string Md5Hash); + virtual void Done(string Message,unsigned long Size,string Md5Hash, + pkgAcquire::MethodConfig *Cnf); virtual string MD5Sum() {return Md5Hash;}; virtual string DescURI() {return Desc.URI;}; diff --git a/apt-pkg/acquire-method.cc b/apt-pkg/acquire-method.cc index 60b8161e8..770c68a90 100644 --- a/apt-pkg/acquire-method.cc +++ b/apt-pkg/acquire-method.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: acquire-method.cc,v 1.23 1999/12/09 21:18:01 jgg Exp $ +// $Id: acquire-method.cc,v 1.24 2000/01/17 07:11:49 jgg Exp $ /* ###################################################################### Acquire Method @@ -53,6 +53,9 @@ pkgAcqMethod::pkgAcqMethod(const char *Ver,unsigned long Flags) if ((Flags & NeedsCleanup) == NeedsCleanup) strcat(End,"Needs-Cleanup: true\n"); + + if ((Flags & Removable) == Removable) + strcat(End,"Removable: true\n"); strcat(End,"\n"); if (write(STDOUT_FILENO,S,strlen(S)) != (signed)strlen(S)) diff --git a/apt-pkg/acquire-method.h b/apt-pkg/acquire-method.h index ca03dd1d1..64cff7331 100644 --- a/apt-pkg/acquire-method.h +++ b/apt-pkg/acquire-method.h @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: acquire-method.h,v 1.12 1999/10/18 00:37:35 jgg Exp $ +// $Id: acquire-method.h,v 1.13 2000/01/17 07:11:49 jgg Exp $ /* ###################################################################### Acquire Method - Method helper class + functions @@ -61,13 +61,14 @@ class pkgAcqMethod void URIStart(FetchResult &Res); void URIDone(FetchResult &Res,FetchResult *Alt = 0); bool MediaFail(string Required,string Drive); - void Exit() {}; + virtual void Exit() {}; public: enum CnfFlags {SingleInstance = (1<<0), Pipeline = (1<<1), SendConfig = (1<<2), - LocalOnly = (1<<3), NeedsCleanup = (1<<4)}; + LocalOnly = (1<<3), NeedsCleanup = (1<<4), + Removable = (1<<5)}; void Log(const char *Format,...); void Status(const char *Format,...); diff --git a/apt-pkg/acquire-worker.cc b/apt-pkg/acquire-worker.cc index f6b14da3c..40092d5d6 100644 --- a/apt-pkg/acquire-worker.cc +++ b/apt-pkg/acquire-worker.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: acquire-worker.cc,v 1.28 1999/10/18 00:37:35 jgg Exp $ +// $Id: acquire-worker.cc,v 1.29 2000/01/17 07:11:49 jgg Exp $ /* ###################################################################### Acquire Worker @@ -257,7 +257,7 @@ bool pkgAcquire::Worker::RunMessages() LookupTag(Message,"Size","0").c_str(),TotalSize); Owner->Done(Message,atoi(LookupTag(Message,"Size","0").c_str()), - LookupTag(Message,"MD5-Hash")); + LookupTag(Message,"MD5-Hash"),Config); ItemDone(); // Log that we are done @@ -327,15 +327,19 @@ bool pkgAcquire::Worker::Capabilities(string Message) Config->SendConfig = StringToBool(LookupTag(Message,"Send-Config"),false); Config->LocalOnly = StringToBool(LookupTag(Message,"Local-Only"),false); Config->NeedsCleanup = StringToBool(LookupTag(Message,"Needs-Cleanup"),false); + Config->Removable = StringToBool(LookupTag(Message,"Removable"),false); // Some debug text if (Debug == true) { clog << "Configured access method " << Config->Access << endl; - clog << "Version:" << Config->Version << " SingleInstance:" << - Config->SingleInstance << - " Pipeline:" << Config->Pipeline << " SendConfig:" << - Config->SendConfig << endl; + clog << "Version:" << Config->Version << + " SingleInstance:" << Config->SingleInstance << + " Pipeline:" << Config->Pipeline << + " SendConfig:" << Config->SendConfig << + " LocalOnly: " << Config->LocalOnly << + " NeedsCleanup: " << Config->NeedsCleanup << + " Removable: " << Config->Removable << endl; } return true; diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc index a9a8b3396..da3160cae 100644 --- a/apt-pkg/acquire.cc +++ b/apt-pkg/acquire.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: acquire.cc,v 1.44 1999/12/09 05:22:33 jgg Exp $ +// $Id: acquire.cc,v 1.45 2000/01/17 07:11:49 jgg Exp $ /* ###################################################################### Acquire - File Acquiration @@ -65,14 +65,14 @@ pkgAcquire::pkgAcquire(pkgAcquireStatus *Log) : Log(Log) /* Free our memory, clean up the queues (destroy the workers) */ pkgAcquire::~pkgAcquire() { + Shutdown(); + while (Configs != 0) { MethodConfig *Jnk = Configs; Configs = Configs->Next; delete Jnk; } - - Shutdown(); } /*}}}*/ // Acquire::Shutdown - Clean out the acquire object /*{{{*/ @@ -493,6 +493,7 @@ pkgAcquire::MethodConfig::MethodConfig() Pipeline = false; SendConfig = false; LocalOnly = false; + Removable = false; Next = 0; } /*}}}*/ diff --git a/apt-pkg/acquire.h b/apt-pkg/acquire.h index e05ab3adc..5565ad3ac 100644 --- a/apt-pkg/acquire.h +++ b/apt-pkg/acquire.h @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: acquire.h,v 1.25 1999/10/18 00:37:35 jgg Exp $ +// $Id: acquire.h,v 1.26 2000/01/17 07:11:49 jgg Exp $ /* ###################################################################### Acquire - File Acquiration @@ -230,6 +230,7 @@ struct pkgAcquire::MethodConfig bool SendConfig; bool LocalOnly; bool NeedsCleanup; + bool Removable; MethodConfig(); }; diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index 7cd948265..65c19ea92 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: fileutl.cc,v 1.33 1999/12/10 23:40:29 jgg Exp $ +// $Id: fileutl.cc,v 1.34 2000/01/17 07:11:49 jgg Exp $ /* ###################################################################### File Utilities @@ -347,7 +347,7 @@ bool FileFd::Open(string FileName,OpenMode Mode, unsigned long Perms) case WriteEmpty: { struct stat Buf; - if (stat(FileName.c_str(),&Buf) == 0 && S_ISLNK(Buf.st_mode)) + if (lstat(FileName.c_str(),&Buf) == 0 && S_ISLNK(Buf.st_mode)) unlink(FileName.c_str()); iFd = open(FileName.c_str(),O_RDWR | O_CREAT | O_TRUNC,Perms); break; diff --git a/cmdline/apt-cdrom.cc b/cmdline/apt-cdrom.cc index 35a024a10..1d742d725 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.33 2000/01/16 05:36:17 jgg Exp $ +// $Id: apt-cdrom.cc,v 1.34 2000/01/17 07:11:49 jgg Exp $ /* ###################################################################### APT CDROM - Tool for handling APT's CDROM database. @@ -589,8 +589,8 @@ bool DoAdd(CommandLine &) Name = PromptLine(""); if (Name.empty() == false && Name.find('"') == string::npos && - Name.find(':') == string::npos && - Name.find('/') == string::npos) + Name.find('[') == string::npos && + Name.find(']') == string::npos) break; cout << "That is not a valid name, try again " << endl; } diff --git a/methods/cdrom.cc b/methods/cdrom.cc index e2eddf19e..c367c99a1 100644 --- a/methods/cdrom.cc +++ b/methods/cdrom.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: cdrom.cc,v 1.16 1999/10/18 00:37:36 jgg Exp $ +// $Id: cdrom.cc,v 1.17 2000/01/17 07:11:49 jgg Exp $ /* ###################################################################### CDROM URI method for APT @@ -38,8 +38,9 @@ class CDROMMethod : public pkgAcqMethod // CDROMMethod::CDROMethod - Constructor /*{{{*/ // --------------------------------------------------------------------- /* */ -CDROMMethod::CDROMMethod() : pkgAcqMethod("1.0",SingleInstance | LocalOnly | - SendConfig | NeedsCleanup), +CDROMMethod::CDROMMethod() : pkgAcqMethod("1.0",SingleInstance | LocalOnly | + SendConfig | NeedsCleanup | + Removable), DatabaseLoaded(false), Mounted(false) { @@ -175,7 +176,6 @@ bool CDROMMethod::Fetch(FetchItem *Itm) if (NewID.empty() == false) CurrentID = NewID; Res.LastModified = Buf.st_mtime; - Res.IMSHit = true; Res.Size = Buf.st_size; URIDone(Res); return true; |