From 59b46c414d5a5cebd26bdafac6b08fa4d1ba0963 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 19 Dec 2006 11:44:52 +0100 Subject: * apt-pkg/deb/debrecords.cc: - return the correct SHA1Hash() * methods/http.cc: - send VERSION of apt in the User-Agent string --- methods/http.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'methods') diff --git a/methods/http.cc b/methods/http.cc index c6623c46f..06b91686c 100644 --- a/methods/http.cc +++ b/methods/http.cc @@ -44,6 +44,7 @@ // Internet stuff #include +#include "config.h" #include "connect.h" #include "rfc2553emu.h" #include "http.h" @@ -714,7 +715,7 @@ void HttpMethod::SendReq(FetchItem *Itm,CircleBuf &Out) Req += string("Authorization: Basic ") + Base64Encode(Uri.User + ":" + Uri.Password) + "\r\n"; - Req += "User-Agent: Debian APT-HTTP/1.3\r\n\r\n"; + Req += "User-Agent: Debian APT-HTTP/1.3 ("VERSION")\r\n\r\n"; if (Debug == true) cerr << Req << endl; -- cgit v1.2.3-70-g09d2 From 509598772f0df89ea5e783a636fb941b1fc6675c Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 7 Mar 2007 10:04:31 +0100 Subject: * apt-pkg/cdrom.cc, methods/cdrom.cc: - only unmount if APT::CDROM::NoMount is false --- apt-pkg/cdrom.cc | 12 ++++++++---- debian/changelog | 2 ++ methods/cdrom.cc | 5 +++-- po/apt-all.pot | 18 +++++++++--------- 4 files changed, 22 insertions(+), 15 deletions(-) (limited to 'methods') diff --git a/apt-pkg/cdrom.cc b/apt-pkg/cdrom.cc index ce1beb39b..4d45d38a2 100644 --- a/apt-pkg/cdrom.cc +++ b/apt-pkg/cdrom.cc @@ -652,7 +652,8 @@ bool pkgCdrom::Add(pkgCdromStatus *log) if (List.size() == 0 && SourceList.size() == 0) { - UnmountCdrom(CDROM); + if (_config->FindB("APT::CDROM::NoMount",false) == false) + UnmountCdrom(CDROM); return _error->Error("Unable to locate any package files, perhaps this is not a Debian Disc"); } @@ -691,7 +692,8 @@ bool pkgCdrom::Add(pkgCdromStatus *log) { if(!log) { - UnmountCdrom(CDROM); + if (_config->FindB("APT::CDROM::NoMount",false) == false) + UnmountCdrom(CDROM); return _error->Error("No disc name found and no way to ask for it"); } @@ -767,7 +769,8 @@ bool pkgCdrom::Add(pkgCdromStatus *log) string::size_type Space = (*I).find(' '); if (Space == string::npos) { - UnmountCdrom(CDROM); + if (_config->FindB("APT::CDROM::NoMount",false) == false) + UnmountCdrom(CDROM); return _error->Error("Internal error"); } @@ -784,7 +787,8 @@ bool pkgCdrom::Add(pkgCdromStatus *log) string::size_type Space = (*I).find(' '); if (Space == string::npos) { - UnmountCdrom(CDROM); + if (_config->FindB("APT::CDROM::NoMount",false) == false) + UnmountCdrom(CDROM); return _error->Error("Internal error"); } diff --git a/debian/changelog b/debian/changelog index 7893f2599..2280c9fae 100644 --- a/debian/changelog +++ b/debian/changelog @@ -10,6 +10,8 @@ apt (0.6.46.5) UNRELEASED; urgency=low - send apt version in User-Agent * apt-pkg/deb/debrecords.cc: - fix SHA1Hash() return value + * apt-pkg/cdrom.cc, methods/cdrom.cc: + - only unmount if APT::CDROM::NoMount is false -- Michael Vogt Mon, 18 Dec 2006 19:39:05 +0100 diff --git a/methods/cdrom.cc b/methods/cdrom.cc index d6b8eae75..d662b7129 100644 --- a/methods/cdrom.cc +++ b/methods/cdrom.cc @@ -57,7 +57,7 @@ CDROMMethod::CDROMMethod() : pkgAcqMethod("1.0",SingleInstance | LocalOnly | /* */ void CDROMMethod::Exit() { - if (Mounted == true) + if (Mounted == true && _config->FindB("APT::CDROM::NoMount",false) == false) UnmountCdrom(CDROM); } /*}}}*/ @@ -160,7 +160,8 @@ bool CDROMMethod::Fetch(FetchItem *Itm) break; // I suppose this should prompt somehow? - if (UnmountCdrom(CDROM) == false) + if (_config->FindB("APT::CDROM::NoMount",false) == false && + UnmountCdrom(CDROM) == false) return _error->Error(_("Unable to unmount the CD-ROM in %s, it may still be in use."), CDROM.c_str()); if (MediaFail(Get.Host,CDROM) == false) diff --git a/po/apt-all.pot b/po/apt-all.pot index d2dbcb7a0..963f58a30 100644 --- a/po/apt-all.pot +++ b/po/apt-all.pot @@ -1477,16 +1477,16 @@ msgstr "" msgid "Wrong CD-ROM" msgstr "" -#: methods/cdrom.cc:164 +#: methods/cdrom.cc:165 #, c-format msgid "Unable to unmount the CD-ROM in %s, it may still be in use." msgstr "" -#: methods/cdrom.cc:169 +#: methods/cdrom.cc:170 msgid "Disk not found." msgstr "" -#: methods/cdrom.cc:177 methods/file.cc:79 methods/rsh.cc:264 +#: methods/cdrom.cc:178 methods/file.cc:79 methods/rsh.cc:264 msgid "File not found" msgstr "" @@ -2441,30 +2441,30 @@ msgstr "" msgid "Found %i package indexes, %i source indexes and %i signatures\n" msgstr "" -#: apt-pkg/cdrom.cc:710 +#: apt-pkg/cdrom.cc:712 msgid "That is not a valid name, try again.\n" msgstr "" -#: apt-pkg/cdrom.cc:726 +#: apt-pkg/cdrom.cc:728 #, c-format msgid "" "This disc is called: \n" "'%s'\n" msgstr "" -#: apt-pkg/cdrom.cc:730 +#: apt-pkg/cdrom.cc:732 msgid "Copying package lists..." msgstr "" -#: apt-pkg/cdrom.cc:754 +#: apt-pkg/cdrom.cc:756 msgid "Writing new source list\n" msgstr "" -#: apt-pkg/cdrom.cc:763 +#: apt-pkg/cdrom.cc:765 msgid "Source list entries for this disc are:\n" msgstr "" -#: apt-pkg/cdrom.cc:803 +#: apt-pkg/cdrom.cc:807 msgid "Unmounting CD-ROM..." msgstr "" -- cgit v1.2.3-70-g09d2 From 25a04630d6eef123a62f50703b82cc62acf1fbfb Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 7 Mar 2007 12:06:08 +0100 Subject: - added APT::CDROM::UnMountOnFinish to have more control over the umount/mount process --- apt-pkg/cdrom.cc | 9 ++++++--- debian/changelog | 5 +++-- methods/cdrom.cc | 3 ++- po/apt-all.pot | 40 ++++++++++++++++++++-------------------- 4 files changed, 31 insertions(+), 26 deletions(-) (limited to 'methods') diff --git a/apt-pkg/cdrom.cc b/apt-pkg/cdrom.cc index 4d45d38a2..241688785 100644 --- a/apt-pkg/cdrom.cc +++ b/apt-pkg/cdrom.cc @@ -508,8 +508,10 @@ bool pkgCdrom::Ident(string &ident, pkgCdromStatus *log) CDROM.c_str()); log->Update(msg.str()); } - if (MountCdrom(CDROM) == false) - return _error->Error("Failed to mount the cdrom."); + + if (_config->FindB("APT::CDROM::NoMount",false) == false) + if (MountCdrom(CDROM) == false) + return _error->Error("Failed to mount the cdrom."); // Hash the CD to get an ID if(log) @@ -803,7 +805,8 @@ bool pkgCdrom::Add(pkgCdromStatus *log) // Unmount and finish - if (_config->FindB("APT::CDROM::NoMount",false) == false) { + if (_config->FindB("APT::CDROM::NoMount",false) == false && + _config->FindB("APT::CDROM::UnMountOnFinish",true) == true) { log->Update(_("Unmounting CD-ROM..."), STEP_LAST); UnmountCdrom(CDROM); } diff --git a/debian/changelog b/debian/changelog index 2280c9fae..49c324545 100644 --- a/debian/changelog +++ b/debian/changelog @@ -11,9 +11,10 @@ apt (0.6.46.5) UNRELEASED; urgency=low * apt-pkg/deb/debrecords.cc: - fix SHA1Hash() return value * apt-pkg/cdrom.cc, methods/cdrom.cc: - - only unmount if APT::CDROM::NoMount is false + - added APT::CDROM::UnMountOnFinish to have more control over + the umount/mount process - -- Michael Vogt Mon, 18 Dec 2006 19:39:05 +0100 + -- Michael Vogt Wed, 7 Mar 2007 12:03:50 +0100 apt (0.6.46.4) unstable; urgency=high diff --git a/methods/cdrom.cc b/methods/cdrom.cc index d662b7129..556d2c1a6 100644 --- a/methods/cdrom.cc +++ b/methods/cdrom.cc @@ -57,7 +57,8 @@ CDROMMethod::CDROMMethod() : pkgAcqMethod("1.0",SingleInstance | LocalOnly | /* */ void CDROMMethod::Exit() { - if (Mounted == true && _config->FindB("APT::CDROM::NoMount",false) == false) + if (Mounted == true && + _config->FindB("APT::CDROM::UnMountOnFinish",true) == true) UnmountCdrom(CDROM); } /*}}}*/ diff --git a/po/apt-all.pot b/po/apt-all.pot index 963f58a30..981b0465a 100644 --- a/po/apt-all.pot +++ b/po/apt-all.pot @@ -1462,31 +1462,31 @@ msgstr "" msgid "Unparsable control file" msgstr "" -#: methods/cdrom.cc:114 +#: methods/cdrom.cc:115 #, c-format msgid "Unable to read the cdrom database %s" msgstr "" -#: methods/cdrom.cc:123 +#: methods/cdrom.cc:124 msgid "" "Please use apt-cdrom to make this CD-ROM recognized by APT. apt-get update " "cannot be used to add new CD-ROMs" msgstr "" -#: methods/cdrom.cc:131 +#: methods/cdrom.cc:132 msgid "Wrong CD-ROM" msgstr "" -#: methods/cdrom.cc:165 +#: methods/cdrom.cc:166 #, c-format msgid "Unable to unmount the CD-ROM in %s, it may still be in use." msgstr "" -#: methods/cdrom.cc:170 +#: methods/cdrom.cc:171 msgid "Disk not found." msgstr "" -#: methods/cdrom.cc:178 methods/file.cc:79 methods/rsh.cc:264 +#: methods/cdrom.cc:179 methods/file.cc:79 methods/rsh.cc:264 msgid "File not found" msgstr "" @@ -2405,66 +2405,66 @@ msgid "" "Mounting CD-ROM\n" msgstr "" -#: apt-pkg/cdrom.cc:516 apt-pkg/cdrom.cc:598 +#: apt-pkg/cdrom.cc:518 apt-pkg/cdrom.cc:600 msgid "Identifying.. " msgstr "" -#: apt-pkg/cdrom.cc:541 +#: apt-pkg/cdrom.cc:543 #, c-format msgid "Stored label: %s \n" msgstr "" -#: apt-pkg/cdrom.cc:561 +#: apt-pkg/cdrom.cc:563 #, c-format msgid "Using CD-ROM mount point %s\n" msgstr "" -#: apt-pkg/cdrom.cc:579 +#: apt-pkg/cdrom.cc:581 msgid "Unmounting CD-ROM\n" msgstr "" -#: apt-pkg/cdrom.cc:583 +#: apt-pkg/cdrom.cc:585 msgid "Waiting for disc...\n" msgstr "" #. Mount the new CDROM -#: apt-pkg/cdrom.cc:591 +#: apt-pkg/cdrom.cc:593 msgid "Mounting CD-ROM...\n" msgstr "" -#: apt-pkg/cdrom.cc:609 +#: apt-pkg/cdrom.cc:611 msgid "Scanning disc for index files..\n" msgstr "" -#: apt-pkg/cdrom.cc:647 +#: apt-pkg/cdrom.cc:649 #, c-format msgid "Found %i package indexes, %i source indexes and %i signatures\n" msgstr "" -#: apt-pkg/cdrom.cc:712 +#: apt-pkg/cdrom.cc:714 msgid "That is not a valid name, try again.\n" msgstr "" -#: apt-pkg/cdrom.cc:728 +#: apt-pkg/cdrom.cc:730 #, c-format msgid "" "This disc is called: \n" "'%s'\n" msgstr "" -#: apt-pkg/cdrom.cc:732 +#: apt-pkg/cdrom.cc:734 msgid "Copying package lists..." msgstr "" -#: apt-pkg/cdrom.cc:756 +#: apt-pkg/cdrom.cc:758 msgid "Writing new source list\n" msgstr "" -#: apt-pkg/cdrom.cc:765 +#: apt-pkg/cdrom.cc:767 msgid "Source list entries for this disc are:\n" msgstr "" -#: apt-pkg/cdrom.cc:807 +#: apt-pkg/cdrom.cc:810 msgid "Unmounting CD-ROM..." msgstr "" -- cgit v1.2.3-70-g09d2 From 70dbf5f8f3e6e3526c82c72ed1795d9f2dad0338 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 7 Mar 2007 12:49:33 +0100 Subject: * apt-pkg/cdrom.cc: - only unmount if APT::CDROM::NoMount is false * methods/cdrom.cc: - only umount if it was mounted by the method before --- apt-pkg/cdrom.cc | 9 +++------ apt-pkg/contrib/cdromutl.h | 3 ++- debian/changelog | 9 +++++---- methods/cdrom.cc | 10 +++++----- 4 files changed, 15 insertions(+), 16 deletions(-) (limited to 'methods') diff --git a/apt-pkg/cdrom.cc b/apt-pkg/cdrom.cc index 241688785..4d45d38a2 100644 --- a/apt-pkg/cdrom.cc +++ b/apt-pkg/cdrom.cc @@ -508,10 +508,8 @@ bool pkgCdrom::Ident(string &ident, pkgCdromStatus *log) CDROM.c_str()); log->Update(msg.str()); } - - if (_config->FindB("APT::CDROM::NoMount",false) == false) - if (MountCdrom(CDROM) == false) - return _error->Error("Failed to mount the cdrom."); + if (MountCdrom(CDROM) == false) + return _error->Error("Failed to mount the cdrom."); // Hash the CD to get an ID if(log) @@ -805,8 +803,7 @@ bool pkgCdrom::Add(pkgCdromStatus *log) // Unmount and finish - if (_config->FindB("APT::CDROM::NoMount",false) == false && - _config->FindB("APT::CDROM::UnMountOnFinish",true) == true) { + if (_config->FindB("APT::CDROM::NoMount",false) == false) { log->Update(_("Unmounting CD-ROM..."), STEP_LAST); UnmountCdrom(CDROM); } diff --git a/apt-pkg/contrib/cdromutl.h b/apt-pkg/contrib/cdromutl.h index 3180a03c7..db140ec02 100644 --- a/apt-pkg/contrib/cdromutl.h +++ b/apt-pkg/contrib/cdromutl.h @@ -8,7 +8,7 @@ ##################################################################### */ /*}}}*/ #ifndef PKGLIB_CDROMUTL_H -#define PKGLIB_ACQUIRE_METHOD_H +#define PKGLIB_CDROMUTL_H #include @@ -21,5 +21,6 @@ using std::string; bool MountCdrom(string Path); bool UnmountCdrom(string Path); bool IdentCdrom(string CD,string &Res,unsigned int Version = 2); +bool IsMounted(string &Path); #endif diff --git a/debian/changelog b/debian/changelog index 49c324545..a2daa2d3a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -10,11 +10,12 @@ apt (0.6.46.5) UNRELEASED; urgency=low - send apt version in User-Agent * apt-pkg/deb/debrecords.cc: - fix SHA1Hash() return value - * apt-pkg/cdrom.cc, methods/cdrom.cc: - - added APT::CDROM::UnMountOnFinish to have more control over - the umount/mount process + * apt-pkg/cdrom.cc: + - only unmount if APT::CDROM::NoMount is false + * methods/cdrom.cc: + - only umount if it was mounted by the method before - -- Michael Vogt Wed, 7 Mar 2007 12:03:50 +0100 + -- Michael Vogt Mon, 18 Dec 2006 19:39:05 +0100 apt (0.6.46.4) unstable; urgency=high diff --git a/methods/cdrom.cc b/methods/cdrom.cc index 556d2c1a6..601bc11c9 100644 --- a/methods/cdrom.cc +++ b/methods/cdrom.cc @@ -30,7 +30,7 @@ class CDROMMethod : public pkgAcqMethod ::Configuration Database; string CurrentID; string CDROM; - bool Mounted; + bool MountedByApt; virtual bool Fetch(FetchItem *Itm); string GetID(string Name); @@ -48,7 +48,7 @@ CDROMMethod::CDROMMethod() : pkgAcqMethod("1.0",SingleInstance | LocalOnly | SendConfig | NeedsCleanup | Removable), DatabaseLoaded(false), - Mounted(false) + MountedByApt(false) { }; /*}}}*/ @@ -57,8 +57,7 @@ CDROMMethod::CDROMMethod() : pkgAcqMethod("1.0",SingleInstance | LocalOnly | /* */ void CDROMMethod::Exit() { - if (Mounted == true && - _config->FindB("APT::CDROM::UnMountOnFinish",true) == true) + if (MountedByApt == true) UnmountCdrom(CDROM); } /*}}}*/ @@ -140,7 +139,8 @@ bool CDROMMethod::Fetch(FetchItem *Itm) while (CurrentID.empty() == true) { bool Hit = false; - Mounted = MountCdrom(CDROM); + if(!IsMounted(CDROM)) + MountedByApt = MountCdrom(CDROM); for (unsigned int Version = 2; Version != 0; Version--) { if (IdentCdrom(CDROM,NewID,Version) == false) -- cgit v1.2.3-70-g09d2 From c03462c6fed27e26b2bab4b3b34589fa8bf464f8 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 17 Apr 2007 15:33:19 +0200 Subject: * [ABI] apt-pkg/acquire.{cc,h}: - deal better with duplicated sources.list entries (avoid double queuing of URLs) - this fixes hangs in bzip/gzip --- apt-pkg/acquire.cc | 19 +++++++++++++------ apt-pkg/acquire.h | 2 +- apt-pkg/init.h | 2 +- apt-pkg/makefile | 2 +- debian/changelog | 3 +++ methods/makefile | 2 +- 6 files changed, 20 insertions(+), 10 deletions(-) (limited to 'methods') diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc index fff1b2b6a..e1dccf25a 100644 --- a/apt-pkg/acquire.cc +++ b/apt-pkg/acquire.cc @@ -193,9 +193,9 @@ void pkgAcquire::Enqueue(ItemDesc &Item) Item.Owner->Status = Item::StatIdle; // Queue it into the named queue - I->Enqueue(Item); - ToFetch++; - + if(I->Enqueue(Item)) + ToFetch++; + // Some trace stuff if (Debug == true) { @@ -549,11 +549,17 @@ pkgAcquire::Queue::~Queue() // Queue::Enqueue - Queue an item to the queue /*{{{*/ // --------------------------------------------------------------------- /* */ -void pkgAcquire::Queue::Enqueue(ItemDesc &Item) +bool pkgAcquire::Queue::Enqueue(ItemDesc &Item) { QItem **I = &Items; - for (; *I != 0; I = &(*I)->Next); - + // move to the end of the queue and check for duplicates here + for (; *I != 0; I = &(*I)->Next) + if (Item.URI == (*I)->URI) + { + Item.Owner->Status = Item::StatDone; + return false; + } + // Create a new item QItem *Itm = new QItem; *Itm = Item; @@ -563,6 +569,7 @@ void pkgAcquire::Queue::Enqueue(ItemDesc &Item) Item.Owner->QueueCounter++; if (Items->Next == 0) Cycle(); + return true; } /*}}}*/ // Queue::Dequeue - Remove an item from the queue /*{{{*/ diff --git a/apt-pkg/acquire.h b/apt-pkg/acquire.h index 27bb3d363..1d5daf12e 100644 --- a/apt-pkg/acquire.h +++ b/apt-pkg/acquire.h @@ -173,7 +173,7 @@ class pkgAcquire::Queue public: // Put an item into this queue - void Enqueue(ItemDesc &Item); + bool Enqueue(ItemDesc &Item); bool Dequeue(Item *Owner); // Find a Queued item diff --git a/apt-pkg/init.h b/apt-pkg/init.h index 8255b406a..b584b2cce 100644 --- a/apt-pkg/init.h +++ b/apt-pkg/init.h @@ -18,7 +18,7 @@ // See the makefile #define APT_PKG_MAJOR 3 -#define APT_PKG_MINOR 11 +#define APT_PKG_MINOR 12 #define APT_PKG_RELEASE 0 extern const char *pkgVersion; diff --git a/apt-pkg/makefile b/apt-pkg/makefile index 7e5feae53..c493d3dd9 100644 --- a/apt-pkg/makefile +++ b/apt-pkg/makefile @@ -13,7 +13,7 @@ include ../buildlib/defaults.mak # methods/makefile - FIXME LIBRARY=apt-pkg LIBEXT=$(GLIBC_VER)$(LIBSTDCPP_VER) -MAJOR=3.11 +MAJOR=3.12 MINOR=0 SLIBS=$(PTHREADLIB) $(INTLLIBS) APT_DOMAIN:=libapt-pkg$(MAJOR) diff --git a/debian/changelog b/debian/changelog index 1786bdfb7..8b566e5c4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -18,6 +18,9 @@ apt (0.6.47) UNRELEASED; urgency=low - fix error translation that causes trouble to lsb_release * apt-pkg/acquire-item.cc: - if decompression of a index fails, delete the index + * [ABI] apt-pkg/acquire.{cc,h}: + - deal better with duplicated sources.list entries (avoid + double queuing of URLs) - this fixes hangs in bzip/gzip -- Michael Vogt Mon, 18 Dec 2006 19:39:05 +0100 diff --git a/methods/makefile b/methods/makefile index 1e3b1ef85..3f561a2c3 100644 --- a/methods/makefile +++ b/methods/makefile @@ -7,7 +7,7 @@ include ../buildlib/defaults.mak BIN := $(BIN)/methods # FIXME.. -LIB_APT_PKG_MAJOR = 3.11 +LIB_APT_PKG_MAJOR = 3.12 APT_DOMAIN := libapt-pkg$(LIB_APT_PKG_MAJOR) # The file method -- cgit v1.2.3-70-g09d2