From 5f6b130d6342965bfa49beb9413bdf742440b8ab Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 29 Nov 2006 21:24:29 +0100 Subject: * prototype of mirror method added --- methods/makefile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'methods/makefile') diff --git a/methods/makefile b/methods/makefile index 1e3b1ef85..12e446a55 100644 --- a/methods/makefile +++ b/methods/makefile @@ -49,7 +49,7 @@ include $(PROGRAM_H) PROGRAM=http SLIBS = -lapt-pkg $(SOCKETLIBS) LIB_MAKES = apt-pkg/makefile -SOURCE = http.cc rfc2553emu.cc connect.cc +SOURCE = http.cc http_main.cc rfc2553emu.cc connect.cc include $(PROGRAM_H) # The ftp method @@ -66,6 +66,13 @@ LIB_MAKES = apt-pkg/makefile SOURCE = rsh.cc include $(PROGRAM_H) +# The mirror method +PROGRAM=mirror +SLIBS = -lapt-pkg $(SOCKETLIBS) +LIB_MAKES = apt-pkg/makefile +SOURCE = mirror.cc http.cc rfc2553emu.cc connect.cc +include $(PROGRAM_H) + # SSH and vzip2 method symlink binary: $(BIN)/ssh $(BIN)/bzip2 veryclean: clean-$(BIN)/ssh clean-$(BIN)/bzip2 -- cgit v1.2.3-70-g09d2 From 68acfb437f0c6c2e026be6fd3b7da3fc8d64c523 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 6 Feb 2007 16:37:20 +0100 Subject: * ABI version bumped --- apt-pkg/init.h | 2 +- apt-pkg/makefile | 2 +- debian/changelog | 1 + methods/makefile | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) (limited to 'methods/makefile') diff --git a/apt-pkg/init.h b/apt-pkg/init.h index b036b8609..0e91f164d 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 51 +#define APT_PKG_MINOR 52 #define APT_PKG_RELEASE 0 extern const char *pkgVersion; diff --git a/apt-pkg/makefile b/apt-pkg/makefile index 6cc1414b2..10b012774 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.51 +MAJOR=3.52 MINOR=0 SLIBS=$(PTHREADLIB) $(INTLLIBS) APT_DOMAIN:=libapt-pkg$(MAJOR) diff --git a/debian/changelog b/debian/changelog index 6fdf646f0..caed5e531 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,6 +7,7 @@ apt (0.6.46.4ubuntu7) feisty; urgency=low It also supports error reporting to a configurable url for mirror problems/failures. + * Bump ABI version -- Michael Vogt Tue, 6 Feb 2007 11:38:06 +0100 diff --git a/methods/makefile b/methods/makefile index f971e56e8..d66ba11e3 100644 --- a/methods/makefile +++ b/methods/makefile @@ -7,7 +7,7 @@ include ../buildlib/defaults.mak BIN := $(BIN)/methods # FIXME.. -LIB_APT_PKG_MAJOR = 3.51 +LIB_APT_PKG_MAJOR = 3.52 APT_DOMAIN := libapt-pkg$(LIB_APT_PKG_MAJOR) # The file method -- cgit v1.2.3-70-g09d2 From d715b9c969264eec96913b577f63a3e9e498b2e6 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 21 Feb 2007 09:59:53 +0100 Subject: * fix in the pkgRecords destructor * Bump ABI version --- apt-pkg/init.h | 2 +- apt-pkg/makefile | 2 +- apt-pkg/pkgrecords.cc | 16 +++++++++------- apt-pkg/pkgrecords.h | 5 +++-- configure.in | 2 +- debian/changelog | 7 +++++++ methods/makefile | 2 +- po/apt-all.pot | 48 ++++++++++++++++++++++++------------------------ 8 files changed, 47 insertions(+), 37 deletions(-) (limited to 'methods/makefile') diff --git a/apt-pkg/init.h b/apt-pkg/init.h index 0e91f164d..905173a7a 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 52 +#define APT_PKG_MINOR 53 #define APT_PKG_RELEASE 0 extern const char *pkgVersion; diff --git a/apt-pkg/makefile b/apt-pkg/makefile index 10b012774..d36747d85 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.52 +MAJOR=3.53 MINOR=0 SLIBS=$(PTHREADLIB) $(INTLLIBS) APT_DOMAIN:=libapt-pkg$(MAJOR) diff --git a/apt-pkg/pkgrecords.cc b/apt-pkg/pkgrecords.cc index b22f3e73f..456b5aef4 100644 --- a/apt-pkg/pkgrecords.cc +++ b/apt-pkg/pkgrecords.cc @@ -23,11 +23,9 @@ // Records::pkgRecords - Constructor /*{{{*/ // --------------------------------------------------------------------- /* This will create the necessary structures to access the status files */ -pkgRecords::pkgRecords(pkgCache &Cache) : Cache(Cache), Files(0) +pkgRecords::pkgRecords(pkgCache &Cache) : Cache(Cache), + Files(Cache.HeaderP->PackageFileCount) { - Files = new Parser *[Cache.HeaderP->PackageFileCount]; - memset(Files,0,sizeof(*Files)*Cache.HeaderP->PackageFileCount); - for (pkgCache::PkgFileIterator I = Cache.FileBegin(); I.end() == false; I++) { @@ -49,9 +47,13 @@ pkgRecords::pkgRecords(pkgCache &Cache) : Cache(Cache), Files(0) /* */ pkgRecords::~pkgRecords() { - for (unsigned I = 0; I != Cache.HeaderP->PackageFileCount; I++) - delete Files[I]; - delete [] Files; + for ( vector::iterator it = Files.begin(); + it != Files.end(); + ++it) + { + delete *it; + } + } /*}}}*/ // Records::Lookup - Get a parser for the package version file /*{{{*/ diff --git a/apt-pkg/pkgrecords.h b/apt-pkg/pkgrecords.h index 31c444dbf..ad3946c1b 100644 --- a/apt-pkg/pkgrecords.h +++ b/apt-pkg/pkgrecords.h @@ -23,6 +23,7 @@ #include #include +#include class pkgRecords { @@ -32,8 +33,8 @@ class pkgRecords private: pkgCache &Cache; - Parser **Files; - + std::vectorFiles; + public: // Lookup function diff --git a/configure.in b/configure.in index ce166b31e..7d93de955 100644 --- a/configure.in +++ b/configure.in @@ -18,7 +18,7 @@ AC_CONFIG_AUX_DIR(buildlib) AC_CONFIG_HEADER(include/config.h:buildlib/config.h.in include/apti18n.h:buildlib/apti18n.h.in) dnl -- SET THIS TO THE RELEASE VERSION -- -AC_DEFINE_UNQUOTED(VERSION,"0.6.46.4ubuntu7") +AC_DEFINE_UNQUOTED(VERSION,"0.6.46.4ubuntu8") PACKAGE="apt" AC_DEFINE_UNQUOTED(PACKAGE,"$PACKAGE") AC_SUBST(PACKAGE) diff --git a/debian/changelog b/debian/changelog index caed5e531..b926a495f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +apt (0.6.46.4ubuntu8) feisty; urgency=low + + * fix in the pkgRecords destructor + * Bump ABI version + + -- + apt (0.6.46.4ubuntu7) feisty; urgency=low * Merged the apt--mirror branch. This means that a new 'mirror' diff --git a/methods/makefile b/methods/makefile index d66ba11e3..610bd5b49 100644 --- a/methods/makefile +++ b/methods/makefile @@ -7,7 +7,7 @@ include ../buildlib/defaults.mak BIN := $(BIN)/methods # FIXME.. -LIB_APT_PKG_MAJOR = 3.52 +LIB_APT_PKG_MAJOR = 3.53 APT_DOMAIN := libapt-pkg$(LIB_APT_PKG_MAJOR) # The file method diff --git a/po/apt-all.pot b/po/apt-all.pot index f2f151dd3..7233cd617 100644 --- a/po/apt-all.pot +++ b/po/apt-all.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2007-02-06 11:14+0100\n" +"POT-Creation-Date: 2007-02-09 16:54+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -251,7 +251,7 @@ msgid "" " -o=? Set an arbitrary configuration option, eg -o dir::cache=/tmp\n" msgstr "" -#: cmdline/apt-extracttemplates.cc:267 apt-pkg/pkgcachegen.cc:819 +#: cmdline/apt-extracttemplates.cc:267 apt-pkg/pkgcachegen.cc:820 #, c-format msgid "Unable to write to %s" msgstr "" @@ -1397,9 +1397,9 @@ msgid "The info and temp directories need to be on the same filesystem" msgstr "" #. Build the status cache -#: apt-inst/deb/dpkgdb.cc:139 apt-pkg/pkgcachegen.cc:752 -#: apt-pkg/pkgcachegen.cc:821 apt-pkg/pkgcachegen.cc:826 -#: apt-pkg/pkgcachegen.cc:949 +#: apt-inst/deb/dpkgdb.cc:139 apt-pkg/pkgcachegen.cc:753 +#: apt-pkg/pkgcachegen.cc:822 apt-pkg/pkgcachegen.cc:827 +#: apt-pkg/pkgcachegen.cc:950 msgid "Reading package lists" msgstr "" @@ -2337,92 +2337,92 @@ msgstr "" msgid "Cache has an incompatible versioning system" msgstr "" -#: apt-pkg/pkgcachegen.cc:119 +#: apt-pkg/pkgcachegen.cc:120 #, c-format msgid "Error occurred while processing %s (NewPackage)" msgstr "" -#: apt-pkg/pkgcachegen.cc:134 +#: apt-pkg/pkgcachegen.cc:135 #, c-format msgid "Error occurred while processing %s (UsePackage1)" msgstr "" -#: apt-pkg/pkgcachegen.cc:157 +#: apt-pkg/pkgcachegen.cc:158 #, c-format msgid "Error occured while processing %s (NewFileDesc1)" msgstr "" -#: apt-pkg/pkgcachegen.cc:182 +#: apt-pkg/pkgcachegen.cc:183 #, c-format msgid "Error occurred while processing %s (UsePackage2)" msgstr "" -#: apt-pkg/pkgcachegen.cc:186 +#: apt-pkg/pkgcachegen.cc:187 #, c-format msgid "Error occurred while processing %s (NewFileVer1)" msgstr "" -#: apt-pkg/pkgcachegen.cc:217 +#: apt-pkg/pkgcachegen.cc:218 #, c-format msgid "Error occurred while processing %s (NewVersion1)" msgstr "" -#: apt-pkg/pkgcachegen.cc:221 +#: apt-pkg/pkgcachegen.cc:222 #, c-format msgid "Error occurred while processing %s (UsePackage3)" msgstr "" -#: apt-pkg/pkgcachegen.cc:225 +#: apt-pkg/pkgcachegen.cc:226 #, c-format msgid "Error occurred while processing %s (NewVersion2)" msgstr "" -#: apt-pkg/pkgcachegen.cc:249 +#: apt-pkg/pkgcachegen.cc:250 #, c-format msgid "Error occured while processing %s (NewFileDesc2)" msgstr "" -#: apt-pkg/pkgcachegen.cc:255 +#: apt-pkg/pkgcachegen.cc:256 msgid "Wow, you exceeded the number of package names this APT is capable of." msgstr "" -#: apt-pkg/pkgcachegen.cc:258 +#: apt-pkg/pkgcachegen.cc:259 msgid "Wow, you exceeded the number of versions this APT is capable of." msgstr "" -#: apt-pkg/pkgcachegen.cc:261 +#: apt-pkg/pkgcachegen.cc:262 msgid "Wow, you exceeded the number of descriptions this APT is capable of." msgstr "" -#: apt-pkg/pkgcachegen.cc:264 +#: apt-pkg/pkgcachegen.cc:265 msgid "Wow, you exceeded the number of dependencies this APT is capable of." msgstr "" -#: apt-pkg/pkgcachegen.cc:292 +#: apt-pkg/pkgcachegen.cc:293 #, c-format msgid "Error occurred while processing %s (FindPkg)" msgstr "" -#: apt-pkg/pkgcachegen.cc:305 +#: apt-pkg/pkgcachegen.cc:306 #, c-format msgid "Error occurred while processing %s (CollectFileProvides)" msgstr "" -#: apt-pkg/pkgcachegen.cc:311 +#: apt-pkg/pkgcachegen.cc:312 #, c-format msgid "Package %s %s was not found while processing file dependencies" msgstr "" -#: apt-pkg/pkgcachegen.cc:682 +#: apt-pkg/pkgcachegen.cc:683 #, c-format msgid "Couldn't stat source package list %s" msgstr "" -#: apt-pkg/pkgcachegen.cc:767 +#: apt-pkg/pkgcachegen.cc:768 msgid "Collecting File Provides" msgstr "" -#: apt-pkg/pkgcachegen.cc:894 apt-pkg/pkgcachegen.cc:901 +#: apt-pkg/pkgcachegen.cc:895 apt-pkg/pkgcachegen.cc:902 msgid "IO Error saving source cache" msgstr "" -- cgit v1.2.3-70-g09d2 From 0df1d3ac4312a2051b10478cf1c8b242864cb3b1 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 6 Dec 2007 19:47:36 +0100 Subject: we do not break the abi --- apt-pkg/init.h | 2 +- apt-pkg/makefile | 2 +- methods/makefile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'methods/makefile') diff --git a/apt-pkg/init.h b/apt-pkg/init.h index 6d8693be9..23e951eff 100644 --- a/apt-pkg/init.h +++ b/apt-pkg/init.h @@ -18,7 +18,7 @@ // See the makefile #define APT_PKG_MAJOR 4 -#define APT_PKG_MINOR 6 +#define APT_PKG_MINOR 5 #define APT_PKG_RELEASE 0 extern const char *pkgVersion; diff --git a/apt-pkg/makefile b/apt-pkg/makefile index 1b78c94f6..b327dbf64 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=4.6 +MAJOR=4.5 MINOR=0 SLIBS=$(PTHREADLIB) $(INTLLIBS) -lutil APT_DOMAIN:=libapt-pkg$(MAJOR) diff --git a/methods/makefile b/methods/makefile index 085b357b8..3c12bb974 100644 --- a/methods/makefile +++ b/methods/makefile @@ -7,7 +7,7 @@ include ../buildlib/defaults.mak BIN := $(BIN)/methods # FIXME.. -LIB_APT_PKG_MAJOR = 4.6 +LIB_APT_PKG_MAJOR = 4.5 APT_DOMAIN := libapt-pkg$(LIB_APT_PKG_MAJOR) # The file method -- cgit v1.2.3-70-g09d2 From 5148def81fb20b22fc9ec54bc212e34260fbfebb Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 7 Dec 2007 22:54:41 +0100 Subject: update ABI, the homepage change broke it --- apt-pkg/init.h | 2 +- apt-pkg/makefile | 2 +- methods/makefile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'methods/makefile') diff --git a/apt-pkg/init.h b/apt-pkg/init.h index 23e951eff..6d8693be9 100644 --- a/apt-pkg/init.h +++ b/apt-pkg/init.h @@ -18,7 +18,7 @@ // See the makefile #define APT_PKG_MAJOR 4 -#define APT_PKG_MINOR 5 +#define APT_PKG_MINOR 6 #define APT_PKG_RELEASE 0 extern const char *pkgVersion; diff --git a/apt-pkg/makefile b/apt-pkg/makefile index b327dbf64..1b78c94f6 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=4.5 +MAJOR=4.6 MINOR=0 SLIBS=$(PTHREADLIB) $(INTLLIBS) -lutil APT_DOMAIN:=libapt-pkg$(MAJOR) diff --git a/methods/makefile b/methods/makefile index 3c12bb974..085b357b8 100644 --- a/methods/makefile +++ b/methods/makefile @@ -7,7 +7,7 @@ include ../buildlib/defaults.mak BIN := $(BIN)/methods # FIXME.. -LIB_APT_PKG_MAJOR = 4.5 +LIB_APT_PKG_MAJOR = 4.6 APT_DOMAIN := libapt-pkg$(LIB_APT_PKG_MAJOR) # The file method -- cgit v1.2.3-70-g09d2 From d7bab8f1142e474ac4bafd139e93439aeddfd546 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 3 Jan 2008 15:22:44 +0100 Subject: methods/makefile: remove duplicated entry for https --- methods/makefile | 7 ------- 1 file changed, 7 deletions(-) (limited to 'methods/makefile') diff --git a/methods/makefile b/methods/makefile index 085b357b8..f765a4d37 100644 --- a/methods/makefile +++ b/methods/makefile @@ -59,13 +59,6 @@ LIB_MAKES = apt-pkg/makefile SOURCE = https.cc include $(PROGRAM_H) -# The https method -PROGRAM=https -SLIBS = -lapt-pkg -lcurl -LIB_MAKES = apt-pkg/makefile -SOURCE = https.cc -include $(PROGRAM_H) - # The ftp method PROGRAM=ftp SLIBS = -lapt-pkg $(SOCKETLIBS) -- cgit v1.2.3-70-g09d2 From ebb461fdf02ee3e038d4b3a4ab1a0a60188edf9a Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 2 Feb 2009 12:14:36 +0100 Subject: * [ABI break] merge support for http redirects, thanks to Jeff Licquia and Anthony Towns * [ABI break] use int for the package IDs (thanks to Steve Cotton) - Galician updated. Closes: #509151 - Catalan updated. Closes: #509375 - Vietnamese updated. Closes: #509422 - Traditional Chinese added. Closes: #510664 * COPYING: - Actualized. Removed obsolete Qt section, added GPLv2 clause. (Closes: #440049, #509337) * Clarify the --help for 'purge' (LP: #243948) --- apt-pkg/acquire-method.cc | 32 +++++++++++++++++++ apt-pkg/acquire-method.h | 2 ++ apt-pkg/acquire-worker.cc | 14 +++++++++ apt-pkg/makefile | 2 +- apt-pkg/pkgcache.h | 8 ++--- debian/changelog | 44 ++++++++++++-------------- methods/http.cc | 78 ++++++++++++++++++++++++++++++++++++++++++++++- methods/http.h | 3 ++ methods/makefile | 2 +- 9 files changed, 153 insertions(+), 32 deletions(-) (limited to 'methods/makefile') diff --git a/apt-pkg/acquire-method.cc b/apt-pkg/acquire-method.cc index 26f992bcf..150fbb77b 100644 --- a/apt-pkg/acquire-method.cc +++ b/apt-pkg/acquire-method.cc @@ -452,6 +452,38 @@ void pkgAcqMethod::Status(const char *Format,...) } /*}}}*/ +// AcqMethod::Redirect - Send a redirect message /*{{{*/ +// --------------------------------------------------------------------- +/* This method sends the redirect message and also manipulates the queue + to keep the pipeline synchronized. */ +void pkgAcqMethod::Redirect(const string &NewURI) +{ + string CurrentURI = ""; + if (Queue != 0) + CurrentURI = Queue->Uri; + + char S[1024]; + snprintf(S, sizeof(S)-50, "103 Redirect\nURI: %s\nNew-URI: %s\n\n", + CurrentURI.c_str(), NewURI.c_str()); + + if (write(STDOUT_FILENO,S,strlen(S)) != (ssize_t)strlen(S)) + exit(100); + + // Change the URI for the request. + Queue->Uri = NewURI; + + /* To keep the pipeline synchronized, move the current request to + the end of the queue, past the end of the current pipeline. */ + FetchItem *I; + for (I = Queue; I->Next != 0; I = I->Next) ; + I->Next = Queue; + Queue = Queue->Next; + I->Next->Next = 0; + if (QueueBack == 0) + QueueBack = I->Next; +} + /*}}}*/ + // AcqMethod::FetchResult::FetchResult - Constructor /*{{{*/ // --------------------------------------------------------------------- /* */ diff --git a/apt-pkg/acquire-method.h b/apt-pkg/acquire-method.h index 18c2cf009..99a4605b1 100644 --- a/apt-pkg/acquire-method.h +++ b/apt-pkg/acquire-method.h @@ -86,6 +86,8 @@ class pkgAcqMethod void Log(const char *Format,...); void Status(const char *Format,...); + void Redirect(const string &NewURI); + int Run(bool Single = false); inline void SetFailReason(string Msg) {FailReason = Msg;}; inline void SetIP(string aIP) {IP = aIP;}; diff --git a/apt-pkg/acquire-worker.cc b/apt-pkg/acquire-worker.cc index 1a754dae9..78c68737c 100644 --- a/apt-pkg/acquire-worker.cc +++ b/apt-pkg/acquire-worker.cc @@ -220,6 +220,20 @@ bool pkgAcquire::Worker::RunMessages() Status = LookupTag(Message,"Message"); break; + // 103 Redirect + case 103: + { + if (Itm == 0) + { + _error->Error("Method gave invalid 103 Redirect message"); + break; + } + + string NewURI = LookupTag(Message,"New-URI",URI.c_str()); + Itm->URI = NewURI; + break; + } + // 200 URI Start case 200: { diff --git a/apt-pkg/makefile b/apt-pkg/makefile index 1b78c94f6..087f17740 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=4.6 +MAJOR=4.7 MINOR=0 SLIBS=$(PTHREADLIB) $(INTLLIBS) -lutil APT_DOMAIN:=libapt-pkg$(MAJOR) diff --git a/apt-pkg/pkgcache.h b/apt-pkg/pkgcache.h index 59d5003bb..759e9a225 100644 --- a/apt-pkg/pkgcache.h +++ b/apt-pkg/pkgcache.h @@ -214,7 +214,7 @@ struct pkgCache::Package unsigned char InstState; // Flags unsigned char CurrentState; // State - unsigned short ID; + unsigned int ID; unsigned long Flags; }; @@ -235,7 +235,7 @@ struct pkgCache::PackageFile // Linked list map_ptrloc NextFile; // PackageFile - unsigned short ID; + unsigned int ID; time_t mtime; // Modification time for the file }; @@ -272,7 +272,7 @@ struct pkgCache::Version map_ptrloc Size; // These are the .deb size map_ptrloc InstalledSize; unsigned short Hash; - unsigned short ID; + unsigned int ID; unsigned char Priority; }; @@ -289,7 +289,7 @@ struct pkgCache::Description map_ptrloc NextDesc; // Description map_ptrloc ParentPkg; // Package - unsigned short ID; + unsigned int ID; }; struct pkgCache::Dependency diff --git a/debian/changelog b/debian/changelog index 478638a63..bfbe6be5c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,29 +6,11 @@ apt (0.7.19ubuntu3) jaunty; urgency=low * apt-inst/contrib/arfile.cc: - support members ending with '/' as well (thanks to Michal Cihr, closes: #500988) - * debian/apt.conf.autoremove: - - readd "linux-image" (and friends) to the auto-remove + * debian/apt.conf.autoremove: + - readd "linux-image" (and friends) to the auto-remove blacklist - * fix some i18n issues (thanks to Gabor Kelemen) - LP: #263089 - - [ Christian Perrier ] - * Translations: - - Galician updated. Closes: #509151 - - Catalan updated. Closes: #509375 - - Vietnamese updated. Closes: #509422 - - Traditional Chinese added. Closes: #510664 - - [ Eugene V. Lyubimkin ] - * COPYING: - - Actualized. Removed obsolete Qt section, added GPLv2 clause. - (Closes: #440049, #509337) - - -- Michael Vogt Mon, 05 Jan 2009 08:59:20 +0100 - -apt (0.7.19ubuntu2) jaunty; urgency=low - - [ Michael Vogt ] + * fix some i18n issues (thanks to Gabor Kelemen) + LP: #263089 * apt-pkg/deb/dpkgpm.cc: - filter "ENOMEM" errors when creating apport reports * cmdline/apt-get.cc: @@ -40,15 +22,27 @@ apt (0.7.19ubuntu2) jaunty; urgency=low - add new strprintf() function to make i18n strings easier * apt-pkg/dev/debsystem.cc: - add missing apti18n.h header - - [ Dereck Wonnacott ] - * Clarify the --help for 'purge' (LP: #243948) + * [ABI break] merge support for http redirects, thanks to + Jeff Licquia and Anthony Towns + * [ABI break] use int for the package IDs (thanks to Steve Cotton) [ Christian Perrier ] * Translations: + - Galician updated. Closes: #509151 + - Catalan updated. Closes: #509375 + - Vietnamese updated. Closes: #509422 + - Traditional Chinese added. Closes: #510664 - French corrected (remove awful use of first person) - Finnish updated. Closes: #508449 + [ Eugene V. Lyubimkin ] + * COPYING: + - Actualized. Removed obsolete Qt section, added GPLv2 clause. + (Closes: #440049, #509337) + + [ Dereck Wonnacott ] + * Clarify the --help for 'purge' (LP: #243948) + [ Eugene V. Lyubimkin ] * doc/examples/sources.list: - Removed obsolete commented non-us deb-src entry, replaced it with diff --git a/methods/http.cc b/methods/http.cc index b0fb89fda..44274bd78 100644 --- a/methods/http.cc +++ b/methods/http.cc @@ -38,6 +38,7 @@ #include #include #include +#include #include // Internet stuff @@ -56,6 +57,7 @@ int HttpMethod::FailFd = -1; time_t HttpMethod::FailTime = 0; unsigned long PipelineDepth = 10; unsigned long TimeOut = 120; +bool AllowRedirect = false; bool Debug = false; URI Proxy; @@ -627,6 +629,12 @@ bool ServerState::HeaderLine(string Line) return true; } + if (stringcasecmp(Tag,"Location:") == 0) + { + Location = Val; + return true; + } + return true; } /*}}}*/ @@ -899,7 +907,9 @@ bool HttpMethod::ServerDie(ServerState *Srv) 1 - IMS hit 3 - Unrecoverable error 4 - Error with error content page - 5 - Unrecoverable non-server error (close the connection) */ + 5 - Unrecoverable non-server error (close the connection) + 6 - Try again with a new or changed URI + */ int HttpMethod::DealWithHeaders(FetchResult &Res,ServerState *Srv) { // Not Modified @@ -911,6 +921,27 @@ int HttpMethod::DealWithHeaders(FetchResult &Res,ServerState *Srv) return 1; } + /* Redirect + * + * Note that it is only OK for us to treat all redirection the same + * because we *always* use GET, not other HTTP methods. There are + * three redirection codes for which it is not appropriate that we + * redirect. Pass on those codes so the error handling kicks in. + */ + if (AllowRedirect + && (Srv->Result > 300 && Srv->Result < 400) + && (Srv->Result != 300 // Multiple Choices + && Srv->Result != 304 // Not Modified + && Srv->Result != 306)) // (Not part of HTTP/1.1, reserved) + { + if (!Srv->Location.empty()) + { + NextURI = Srv->Location; + return 6; + } + /* else pass through for error message */ + } + /* We have a reply we dont handle. This should indicate a perm server failure */ if (Srv->Result < 200 || Srv->Result >= 300) @@ -1028,6 +1059,7 @@ bool HttpMethod::Configuration(string Message) if (pkgAcqMethod::Configuration(Message) == false) return false; + AllowRedirect = _config->FindB("Acquire::http::AllowRedirect",true); TimeOut = _config->FindI("Acquire::http::Timeout",TimeOut); PipelineDepth = _config->FindI("Acquire::http::Pipeline-Depth", PipelineDepth); @@ -1041,6 +1073,10 @@ bool HttpMethod::Configuration(string Message) /* */ int HttpMethod::Loop() { + typedef vector StringVector; + typedef vector::iterator StringVectorIterator; + map Redirected; + signal(SIGTERM,SigTerm); signal(SIGINT,SigTerm); @@ -1227,6 +1263,46 @@ int HttpMethod::Loop() break; } + // Try again with a new URL + case 6: + { + // Clear rest of response if there is content + if (Server->HaveContent) + { + File = new FileFd("/dev/null",FileFd::WriteExists); + Server->RunData(); + delete File; + File = 0; + } + + /* Detect redirect loops. No more redirects are allowed + after the same URI is seen twice in a queue item. */ + StringVector &R = Redirected[Queue->DestFile]; + bool StopRedirects = false; + if (R.size() == 0) + R.push_back(Queue->Uri); + else if (R[0] == "STOP" || R.size() > 10) + StopRedirects = true; + else + { + for (StringVectorIterator I = R.begin(); I != R.end(); I++) + if (Queue->Uri == *I) + { + R[0] = "STOP"; + break; + } + + R.push_back(Queue->Uri); + } + + if (StopRedirects == false) + Redirect(NextURI); + else + Fail(); + + break; + } + default: Fail(_("Internal error")); break; diff --git a/methods/http.h b/methods/http.h index dec5cd80f..bc076e1f8 100644 --- a/methods/http.h +++ b/methods/http.h @@ -99,6 +99,7 @@ struct ServerState enum {Chunked,Stream,Closes} Encoding; enum {Header, Data} State; bool Persistent; + string Location; // This is a Persistent attribute of the server itself. bool Pipeline; @@ -145,6 +146,8 @@ class HttpMethod : public pkgAcqMethod protected: virtual bool Fetch(FetchItem *); + string NextURI; + public: friend class ServerState; diff --git a/methods/makefile b/methods/makefile index 5c4fa82bf..1d022be90 100644 --- a/methods/makefile +++ b/methods/makefile @@ -7,7 +7,7 @@ include ../buildlib/defaults.mak BIN := $(BIN)/methods # FIXME.. -LIB_APT_PKG_MAJOR = 4.6 +LIB_APT_PKG_MAJOR = 4.7 APT_DOMAIN := libapt-pkg$(LIB_APT_PKG_MAJOR) # The file method -- cgit v1.2.3-70-g09d2