Quellcode durchsuchen

merged from bzr+ssh://bazaar.launchpad.net/~donkult/apt/experimental/

Michael Vogt vor 14 Jahren
Ursprung
Commit
2c384bb626
10 geänderte Dateien mit 79 neuen und 36 gelöschten Zeilen
  1. 12 7
      apt-pkg/packagemanager.cc
  2. 1 1
      cmdline/apt-get.cc
  3. 24 2
      debian/changelog
  4. 12 12
      debian/control
  5. 3 1
      debian/rules
  6. 10 2
      methods/gpgv.cc
  7. 5 5
      methods/https.cc
  8. 6 1
      methods/rred.cc
  9. 5 2
      test/libapt/globalerror_test.cc
  10. 1 3
      test/libapt/run-tests

+ 12 - 7
apt-pkg/packagemanager.cc

@@ -322,22 +322,22 @@ bool pkgPackageManager::ConfigureAll()
    only shown when debuging*/
 bool pkgPackageManager::SmartConfigure(PkgIterator Pkg, int const Depth)
 {
-   // If this is true, only check and correct and dependancies without the Loop flag
+   // If this is true, only check and correct and dependencies without the Loop flag
    bool PkgLoop = List->IsFlag(Pkg,pkgOrderList::Loop);
 
    if (Debug) {
       VerIterator InstallVer = VerIterator(Cache,Cache[Pkg].InstallVer);
       clog << OutputInDepth(Depth) << "SmartConfigure " << Pkg.Name() << " (" << InstallVer.VerStr() << ")";
       if (PkgLoop)
-        clog << " (Only Correct Dependancies)";
+        clog << " (Only Correct Dependencies)";
       clog << endl;
    }
 
    VerIterator const instVer = Cache[Pkg].InstVerIter(Cache);
       
-   /* Because of the ordered list, most dependancies should be unpacked, 
+   /* Because of the ordered list, most dependencies should be unpacked, 
       however if there is a loop (A depends on B, B depends on A) this will not 
-      be the case, so check for dependancies before configuring. */
+      be the case, so check for dependencies before configuring. */
    bool Bad = false;
    for (DepIterator D = instVer.DependsList();
 	D.end() == false; )
@@ -424,7 +424,7 @@ bool pkgPackageManager::SmartConfigure(PkgIterator Pkg, int const Depth)
 	 
 	 if (Start==End) {
 	    if (Bad && Debug && List->IsFlag(DepPkg,pkgOrderList::Loop) == false)
-		  std::clog << OutputInDepth(Depth) << "Could not satisfy dependancies for " << Pkg.Name() << std::endl;
+		  std::clog << OutputInDepth(Depth) << "Could not satisfy dependencies for " << Pkg.Name() << std::endl;
 	    break;
 	 } else {
             Start++;
@@ -529,7 +529,6 @@ bool pkgPackageManager::SmartRemove(PkgIterator Pkg)
    List->Flag(Pkg,pkgOrderList::Configured,pkgOrderList::States);
 
    return Remove(Pkg,(Cache[Pkg].iFlags & pkgDepCache::Purge) == pkgDepCache::Purge);
-   return true;
 }
 									/*}}}*/
 // PM::SmartUnPack - Install helper					/*{{{*/
@@ -682,7 +681,13 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg, bool const Immediate, int c
 	    VerIterator Ver(Cache,*I);
 	    PkgIterator BrokenPkg = Ver.ParentPkg();
 	    VerIterator InstallVer(Cache,Cache[BrokenPkg].InstallVer);
-	    
+	    if (BrokenPkg.CurrentVer() != Ver)
+	    {
+	       if (Debug)
+		  std::clog << OutputInDepth(Depth) << "  Ignore not-installed version " << Ver.VerStr() << " of " << Pkg.FullName() << " for " << End << std::endl;
+	       continue;
+	    }
+
 	    // Check if it needs to be unpacked
 	    if (List->IsFlag(BrokenPkg,pkgOrderList::InList) && Cache[BrokenPkg].Delete() == false && 
 	        List->IsNow(BrokenPkg)) {

+ 1 - 1
cmdline/apt-get.cc

@@ -1730,7 +1730,7 @@ bool DoAutomaticRemove(CacheFile &Cache)
 	      Pkg != tooMuch.end() && Changed == false; ++Pkg)
 	 {
 	    APT::PackageSet too;
-	    too.insert(Pkg);
+	    too.insert(*Pkg);
 	    for (pkgCache::PrvIterator Prv = Cache[Pkg].CandidateVerIter(Cache).ProvidesList();
 		 Prv.end() == false; ++Prv)
 	       too.insert(Prv.ParentPkg());

+ 24 - 2
debian/changelog

@@ -7,8 +7,30 @@ apt (0.8.16~exp12) experimental; urgency=low
   [ David Kalnischkies ]
   * apt-pkg/cacheiterators.h:
     - return the correct version arch for all+foreign, too
-
- -- David Kalnischkies <kalnischkies@gmail.com>  Thu, 19 Jan 2012 18:38:33 +0100
+  * apt-pkg/packagemanager.cc:
+    - ignore breaks on not-installed versions while searching for
+      breakage loops as we don't have to avoid them
+  * debian/control:
+    - remove APT from the short descriptions as lintian doesn't like it
+      and it doesn't transport any information for a reader anyway
+    - apply typofixes by Pascal De Vuyst, thanks! (Closes: #652834, #652835)
+  * debian/rules:
+    - apply patch to enable usage of hardning CPPFLAGS and LDFLAGS by
+      Moritz Muehlenhoff, thanks! (Closes: #653504)
+  * methods/https.cc:
+    - use curls list append instead of appending Range and If-Range by hand
+      which generates malformed requests, thanks Mel Collins for the hint!
+      (Closes: #646381)
+  * test/libapt/run-tests:
+    - hurd doesn't have dmesg yet and we don't really need it either,
+      so use with $0 a more stable data source for hashsumming
+
+  [ Pino Toscano ]
+  * test/libapt/globalerror_test.cc:
+    - errno 0 has a different strerror on hurd, so generate the expected
+      message dynamically instead of hardcoding 'Success' (Closes: #656530)
+
+ -- David Kalnischkies <kalnischkies@gmail.com>  Fri, 20 Jan 2012 01:43:07 +0100
 
 apt (0.8.16~exp11) experimental; urgency=low
 

+ 12 - 12
debian/control

@@ -7,8 +7,8 @@ Uploaders: Michael Vogt <mvo@debian.org>, Otavio Salvador <otavio@debian.org>,
  Julian Andres Klode <jak@debian.org>
 Standards-Version: 3.9.2
 Build-Depends: dpkg-dev (>= 1.15.8), debhelper (>= 8.1.3~), libdb-dev,
- gettext (>= 0.12), libcurl4-gnutls-dev (>= 7.19.0), 
- zlib1g-dev | libz-dev, debiandoc-sgml, xsltproc, docbook-xsl, docbook-xml, 
+ gettext (>= 0.12), libcurl4-gnutls-dev (>= 7.19.0),
+ zlib1g-dev | libz-dev, debiandoc-sgml, xsltproc, docbook-xsl, docbook-xml,
  po4a (>= 0.34-2), autotools-dev, autoconf, automake, doxygen
 Build-Conflicts: autoconf2.13, automake1.4
 Vcs-Bzr: http://bzr.debian.org/apt/debian-sid/
@@ -20,7 +20,7 @@ Depends: ${shlibs:Depends}, ${misc:Depends}, debian-archive-keyring, gnupg
 Replaces: manpages-pl (<< 20060617-3~)
 Conflicts: python-apt (<< 0.7.93.2~)
 Suggests: aptitude | synaptic | wajig, dpkg-dev, apt-doc, bzip2, lzma, python-apt
-Description: APT's commandline package manager
+Description: commandline package manager
  This package provides commandline tools for searching and
  managing as well as querying information about packages
  as a low-level access to all features of the libapt-pkg library.
@@ -40,7 +40,7 @@ Architecture: any
 Multi-Arch: same
 Pre-Depends: ${misc:Pre-Depends}
 Depends: ${shlibs:Depends}, ${misc:Depends}
-Description: APT's package managment runtime library
+Description: package managment runtime library
  This library provides the common functionality for searching and
  managing packages as well as information about packages.
  Higher-level package managers can depend upon this library.
@@ -61,8 +61,8 @@ Architecture: any
 Multi-Arch: same
 Pre-Depends: ${misc:Pre-Depends}
 Depends: ${shlibs:Depends}, ${misc:Depends}
-Description: APT's deb package format runtime library
- This library provides methods to query and extract information 
+Description: deb package format runtime library
+ This library provides methods to query and extract information
  from deb packages. This includes the control data and the package
  file content.
 
@@ -71,7 +71,7 @@ Architecture: all
 Priority: optional
 Depends: ${misc:Depends}
 Section: doc
-Description: Documentation for APT
+Description: documentation for APT
  This package contains the user guide and offline guide for various
  APT tools which are provided in a html and a text-only version.
 
@@ -82,7 +82,7 @@ Priority: optional
 Pre-Depends: ${misc:Pre-Depends}
 Depends: ${libapt-pkg-name} (= ${binary:Version}), ${libapt-inst-name} (= ${binary:Version}), ${misc:Depends}, zlib1g-dev | zlib-dev
 Section: libdevel
-Description: Development files for APT's libapt-pkg and libapt-inst
+Description: development files for APT's libapt-pkg and libapt-inst
  This package contains the header files and libraries for
  developing with APT's libapt-pkg Debian package manipulation
  library and the libapt-inst deb/tar/ar library.
@@ -92,7 +92,7 @@ Architecture: all
 Priority: optional
 Depends: ${misc:Depends}
 Section: doc
-Description: Documentation for APT development
+Description: documentation for APT development
  This package contains documentation for development of the APT
  Debian package manipulation program and its libraries.
  .
@@ -102,7 +102,7 @@ Description: Documentation for APT development
 Package: apt-utils
 Architecture: any
 Depends: ${shlibs:Depends}, ${misc:Depends}
-Description: APT utility programs
+Description: package managment related utility programs
  This package contains some less used commandline utilities related
  to package managment with APT.
  .
@@ -120,7 +120,7 @@ Description: https download transport for APT
  This package enables the usage of 'deb https://foo distro main' lines
  in the /etc/apt/sources.list so that all package managers using the
  libapt-pkg library can access metadata and packages available in sources
- accessable over https (Hypertext Transfer Protocol Secure).
+ accessible over https (Hypertext Transfer Protocol Secure).
  .
- This transport supports server as well as client authenification
+ This transport supports server as well as client authentication
  with certificates.

+ 3 - 1
debian/rules

@@ -19,6 +19,8 @@ endif
 
 ifneq (,$(shell which dpkg-buildflags))
   export CXXFLAGS = $(shell dpkg-buildflags --get CXXFLAGS)
+  export LDFLAGS = $(shell dpkg-buildflags --get LDFLAGS)
+  export CPPFLAGS = $(shell dpkg-buildflags --get CPPFLAGS)
 else
   ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
     export CXXFLAGS = -O0 -g -Wall
@@ -92,7 +94,7 @@ build/configure-stamp: configure
 	dh_testdir
 	-mkdir build
 	cp COPYING debian/copyright
-	cd build && CXXFLAGS="$(CXXFLAGS)" ../configure $(confflags)
+	cd build && CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" CPPFLAGS="$(CPPFLAGS)" ../configure $(confflags)
 	touch $@
 
 build/build-stamp: build/configure-stamp

+ 10 - 2
methods/gpgv.cc

@@ -98,8 +98,16 @@ string GPGVMethod::VerifyGetSigners(const char *file, const char *outfile,
       // Read a line.  Sigh.
       while ((c = getc(pipein)) != EOF && c != '\n')
       {
-         if (bufferoff == buffersize)
-            buffer = (char *) realloc(buffer, buffersize *= 2);
+	 if (bufferoff == buffersize)
+	 {
+	    char* newBuffer = (char *) realloc(buffer, buffersize *= 2);
+	    if (newBuffer == NULL)
+	    {
+	       free(buffer);
+	       return "Couldn't allocate a buffer big enough for reading";
+	    }
+	    buffer = newBuffer;
+	 }
          *(buffer+bufferoff) = c;
          bufferoff++;
       }

+ 5 - 5
methods/https.cc

@@ -100,7 +100,6 @@ void HttpsMethod::SetupProxy()  					/*{{{*/
    depth. */
 bool HttpsMethod::Fetch(FetchItem *Itm)
 {
-   stringstream ss;
    struct stat SBuf;
    struct curl_slist *headers=NULL;  
    char curl_errorstr[CURL_ERROR_SIZE];
@@ -199,6 +198,7 @@ bool HttpsMethod::Fetch(FetchItem *Itm)
       if (_config->FindB("Acquire::https::No-Store",
 		_config->FindB("Acquire::http::No-Store",false)) == true)
 	 headers = curl_slist_append(headers,"Cache-Control: no-store");
+      stringstream ss;
       ioprintf(ss, "Cache-Control: max-age=%u", _config->FindI("Acquire::https::Max-Age",
 		_config->FindI("Acquire::http::Max-Age",0)));
       headers = curl_slist_append(headers, ss.str().c_str());
@@ -246,11 +246,11 @@ bool HttpsMethod::Fetch(FetchItem *Itm)
    if (stat(Itm->DestFile.c_str(),&SBuf) >= 0 && SBuf.st_size > 0)
    {
       char Buf[1000];
-      sprintf(Buf,"Range: bytes=%li-\r\nIf-Range: %s\r\n",
-	      (long)SBuf.st_size - 1,
-	      TimeRFC1123(SBuf.st_mtime).c_str());
+      sprintf(Buf, "Range: bytes=%li-", (long) SBuf.st_size - 1);
       headers = curl_slist_append(headers, Buf);
-   } 
+      sprintf(Buf, "If-Range: %s", TimeRFC1123(SBuf.st_mtime).c_str());
+      headers = curl_slist_append(headers, Buf);
+   }
    else if(Itm->LastModified > 0)
    {
       curl_easy_setopt(curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_IFMODSINCE);

+ 6 - 1
methods/rred.cc

@@ -333,7 +333,12 @@ RredMethod::State RredMethod::patchMMap(FileFd &Patch, FileFd &From,		/*{{{*/
 		}
 		if(command_count == command_alloc) {
 			command_alloc = (command_alloc + 64) * 3 / 2;
-			commands = (EdCommand*) realloc(commands, command_alloc * sizeof(EdCommand));
+			EdCommand* newCommands = (EdCommand*) realloc(commands, command_alloc * sizeof(EdCommand));
+			if (newCommands == NULL) {
+				free(commands);
+				return MMAP_FAILED;
+			}
+			commands = newCommands;
 		}
 		commands[command_count++] = cmd;
 	}

+ 5 - 2
test/libapt/globalerror_test.cc

@@ -3,9 +3,12 @@
 #include "assert.h"
 #include <string>
 #include <errno.h>
+#include <string.h>
 
 int main(int argc,char *argv[])
 {
+	std::string const textOfErrnoZero(strerror(0));
+
 	equals(_error->empty(), true);
 	equals(_error->PendingError(), false);
 	equals(_error->Notice("%s Notice", "A"), false);
@@ -80,7 +83,7 @@ int main(int argc,char *argv[])
 	equals(_error->PendingError(), true);
 	equals(_error->PopMessage(text), true);
 	equals(_error->PendingError(), false);
-	equals(text, "Something horrible happend 2 times - errno (0: Success)");
+	equals(text, std::string("Something horrible happend 2 times - errno (0: ").append(textOfErrnoZero).append(")"));
 	equals(_error->empty(), true);
 
 	std::string longText;
@@ -92,7 +95,7 @@ int main(int argc,char *argv[])
 
 	equals(_error->Errno("errno", "%s horrible %s %d times", longText.c_str(), "happend", 2), false);
 	equals(_error->PopMessage(text), true);
-	equals(text, std::string(longText).append(" horrible happend 2 times - errno (0: Success)"));
+	equals(text, std::string(longText).append(" horrible happend 2 times - errno (0: ").append(textOfErrnoZero).append(")"));
 
 	equals(_error->Warning("Репозиторий не обновлён и будут %d %s", 4, "test"), false);
 	equals(_error->PopMessage(text), false);

+ 1 - 3
test/libapt/run-tests

@@ -67,11 +67,9 @@ do
 			"${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-st.bak" \
 			"${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-ast_DE"
 	elif [ $name = "HashSums${EXT}" ]; then
-		TMP="$(mktemp)"
-		dmesg > $TMP
+		TMP="$(readlink -f "./${0}")"
 		echo -n "Testing with \033[1;35m${name}\033[0m ... "
 		LD_LIBRARY_PATH=${LDPATH} ${testapp} $TMP $(md5sum $TMP | cut -d' ' -f 1) $(sha1sum $TMP | cut -d' ' -f 1) $(sha256sum $TMP | cut -d' ' -f 1) $(sha512sum $TMP | cut -d' ' -f 1) && echo "\033[1;32mOKAY\033[0m" || echo "\033[1;31mFAILED\033[0m"
-		rm $TMP
 		continue
 	elif [ $name = "CompareVersion${EXT}" ]; then
 		tmppath="${DIR}/versions.lst"