merge with debian-experimental-ma
authorDavid Kalnischkies <kalnischkies@gmail.com>
Thu, 6 May 2010 14:15:53 +0000 (16:15 +0200)
committerDavid Kalnischkies <kalnischkies@gmail.com>
Thu, 6 May 2010 14:15:53 +0000 (16:15 +0200)
13 files changed:
apt-pkg/acquire-item.h
apt-pkg/acquire-worker.h
apt-pkg/acquire.h
apt-pkg/contrib/weakptr.h [new file with mode: 0644]
apt-pkg/deb/debrecords.cc
apt-pkg/makefile
cmdline/apt-cache.cc
cmdline/apt-get.cc
cmdline/apt-mark
configure.in
debian/changelog
debian/control
debian/rules

index bafa826..b338b2a 100644 (file)
@@ -27,6 +27,7 @@
 #include <apt-pkg/pkgrecords.h>
 #include <apt-pkg/indexrecords.h>
 #include <apt-pkg/hashes.h>
+#include <apt-pkg/weakptr.h>
 
 /** \addtogroup acquire
  *  @{
@@ -46,7 +47,7 @@
  *
  *  \see pkgAcquire
  */
-class pkgAcquire::Item
+class pkgAcquire::Item : public WeakPointable
 {  
    protected:
    
index 2942df6..0628392 100644 (file)
@@ -20,6 +20,7 @@
 #define PKGLIB_ACQUIRE_WORKER_H
 
 #include <apt-pkg/acquire.h>
+#include <apt-pkg/weakptr.h>
 
 
 /** \brief A fetch subprocess.
@@ -41,7 +42,7 @@
  *
  *  \sa pkgAcqMethod, pkgAcquire::Item, pkgAcquire
  */
-class pkgAcquire::Worker
+class pkgAcquire::Worker : public WeakPointable
 {
    friend class pkgAcquire;
    
index 9e91a9f..8e2c211 100644 (file)
@@ -67,6 +67,7 @@
 #define PKGLIB_ACQUIRE_H
 
 #include <apt-pkg/macros.h>
+#include <apt-pkg/weakptr.h>
 
 #include <vector>
 #include <string>
@@ -376,7 +377,7 @@ class pkgAcquire
  *
  *  An item may have several assocated ItemDescs over its lifetime.
  */
-struct pkgAcquire::ItemDesc
+struct pkgAcquire::ItemDesc : public WeakPointable
 {
    /** \brief The URI from which to download this item. */
    string URI;
diff --git a/apt-pkg/contrib/weakptr.h b/apt-pkg/contrib/weakptr.h
new file mode 100644 (file)
index 0000000..5158e39
--- /dev/null
@@ -0,0 +1,62 @@
+/* weakptr.h - An object which supports weak pointers.
+ *
+ * Copyright (C) 2010 Julian Andres Klode <jak@debian.org>
+ * 
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+
+#ifndef WEAK_POINTER_H
+#define WEAK_POINTER_H
+
+#include <set>
+/**
+ * Class for objects providing support for weak pointers.
+ *
+ * This class allows for the registration of certain pointers as weak,
+ * which will cause them to be set to NULL when the destructor of the
+ * object is called.
+ */
+class WeakPointable {
+private:
+    std::set<WeakPointable**> pointers;
+
+public:
+
+    /**
+     * Add a new weak pointer.
+     */
+    inline void AddWeakPointer(WeakPointable** weakptr) {
+       pointers.insert(weakptr);
+    }
+
+    /**
+     * Remove the weak pointer from the list of weak pointers.
+     */
+    inline void RemoveWeakPointer(WeakPointable **weakptr) {
+       pointers.erase(weakptr);
+    }
+
+    /**
+     * Deconstruct the object, set all weak pointers to NULL.
+     */
+    ~WeakPointable() {
+        std::set<WeakPointable**>::iterator iter = pointers.begin();
+        while (iter != pointers.end())
+            **(iter++) = NULL;
+    }
+};
+
+#endif // WEAK_POINTER_H
index 5b8538a..34ef0d8 100644 (file)
@@ -20,7 +20,8 @@
 /* */
 debRecordParser::debRecordParser(string FileName,pkgCache &Cache) : 
                   File(FileName,FileFd::ReadOnly), 
-                  Tags(&File,Cache.Head().MaxVerFileSize + 200)
+                  Tags(&File, std::max(Cache.Head().MaxVerFileSize, 
+                                      Cache.Head().MaxDescFileSize) + 200)
 {
 }
                                                                        /*}}}*/
index bdd49c0..148ad58 100644 (file)
@@ -25,7 +25,7 @@ SOURCE = contrib/mmap.cc contrib/error.cc contrib/strutl.cc \
         contrib/fileutl.cc 
 HEADERS = mmap.h error.h configuration.h fileutl.h  cmndline.h netrc.h\
          md5.h crc-16.h cdromutl.h strutl.h sptr.h sha1.h sha256.h hashes.h \
-         macros.h
+         macros.h weakptr.h
 
 # Source code for the core main library
 SOURCE+= pkgcache.cc version.cc depcache.cc \
index b981e2f..10dbf44 100644 (file)
@@ -14,7 +14,9 @@
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
 #include <apt-pkg/error.h>
+#include <cassert>
 #include <apt-pkg/pkgcachegen.h>
+#include <apt-pkg/cachefile.h>
 #include <apt-pkg/init.h>
 #include <apt-pkg/progress.h>
 #include <apt-pkg/sourcelist.h>
@@ -1406,6 +1408,29 @@ bool Search(CommandLine &CmdL)
        return _error->Error("Write to stdout failed");
    return true;
 }
+
+
+/* show automatically installed packages (sorted) */
+bool ShowAuto(CommandLine &CmdL)
+{
+   OpProgress op;
+   pkgDepCache DepCache(GCache);
+   DepCache.Init(&op);
+
+   std::vector<string> packages;
+   packages.reserve(GCache->HeaderP->PackageCount / 3);
+   
+   for (pkgCache::PkgIterator P = GCache->PkgBegin(); P.end() == false; P++)
+      if (DepCache[P].Flags & pkgCache::Flag::Auto)
+         packages.push_back(P.Name());
+
+    std::sort(packages.begin(), packages.end());
+    
+    for (vector<string>::iterator I = packages.begin(); I != packages.end(); I++)
+            cout << *I << "\n";
+
+   return true;
+}
                                                                        /*}}}*/
 // ShowPackage - Dump the package record to the screen                 /*{{{*/
 // ---------------------------------------------------------------------
@@ -1777,6 +1802,7 @@ bool ShowHelp(CommandLine &Cmd)
       "   unmet - Show unmet dependencies\n"
       "   search - Search the package list for a regex pattern\n"
       "   show - Show a readable record for the package\n"
+      "   showauto - Display a list of automatically installed packages\n"
       "   depends - Show raw dependency information for a package\n"
       "   rdepends - Show reverse dependency information for a package\n"
       "   pkgnames - List the names of all packages in the system\n"
@@ -1841,6 +1867,7 @@ int main(int argc,const char *argv[])                                     /*{{{*/
                                     {"xvcg",&XVcg},
                                     {"show",&ShowPackage},
                                     {"pkgnames",&ShowPkgNames},
+                                    {"showauto",&ShowAuto},
                                     {"policy",&Policy},
                                     {"madison",&Madison},
                                     {0,0}};
index de8c7ae..00da085 100644 (file)
@@ -1315,6 +1315,10 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs,
                  break;
               fuzzy = true;
               Ver = Pkg.VersionList();
+              // exit right away from the Pkg.VersionList() loop if we
+              // don't have any versions
+              if (Ver.end() == true)
+                 break;
            }
            // We match against a concrete version (or a part of this version)
            if (VerTag.empty() == false &&
@@ -1934,7 +1938,7 @@ bool DoInstall(CommandLine &CmdL)
               string target = Start.TargetPkg().FullName(true) + " ";
               pkgCache::PkgIterator const TarPkg = Start.TargetPkg();
               if (TarPkg->SelectedState == pkgCache::State::Install ||
-                  TarPkg->SelectedState == pkgCache::State::Hold ||
+                  TarPkg->SelectedState == pkgCache::State::Hold ||
                   Cache[Start.TargetPkg()].Install())
               {
                  foundInstalledInOrGroup=true;
@@ -2010,6 +2014,46 @@ bool DoInstall(CommandLine &CmdL)
 
    return InstallPackages(Cache,false);   
 }
+
+/* mark packages as automatically/manually installed. */
+bool DoMarkAuto(CommandLine &CmdL)
+{
+   bool Action = true;
+   int AutoMarkChanged = 0;
+   OpTextProgress progress;
+   CacheFile Cache;
+   if (Cache.Open() == false)
+      return false;
+
+   if (strcasecmp(CmdL.FileList[0],"markauto") == 0)
+      Action = true;
+   else if (strcasecmp(CmdL.FileList[0],"unmarkauto") == 0)
+      Action = false;
+
+   for (const char **I = CmdL.FileList + 1; *I != 0; I++)
+   {
+      const char *S = *I;
+      // Locate the package
+      pkgCache::PkgIterator Pkg = Cache->FindPkg(S);
+      if (Pkg.end() == true) {
+         return _error->Error(_("Couldn't find package %s"),S);
+      }
+      else
+      {
+         if (!Action)
+            ioprintf(c1out,_("%s set to manually installed.\n"), Pkg.Name());
+         else
+            ioprintf(c1out,_("%s set to automatically installed.\n"),
+                      Pkg.Name());
+
+         Cache->MarkAuto(Pkg,Action);
+         AutoMarkChanged++;
+      }
+   }
+   if (AutoMarkChanged && ! _config->FindB("APT::Get::Simulate",false))
+      return Cache->writeStateFile(NULL);
+   return false;
+}
                                                                        /*}}}*/
 // DoDistUpgrade - Automatic smart upgrader                            /*{{{*/
 // ---------------------------------------------------------------------
@@ -2796,6 +2840,8 @@ bool ShowHelp(CommandLine &CmdL)
       "   clean - Erase downloaded archive files\n"
       "   autoclean - Erase old downloaded archive files\n"
       "   check - Verify that there are no broken dependencies\n"
+      "   markauto - Mark the given packages as automatically installed\n"
+      "   unmarkauto - Mark the given packages as manually installed\n"
       "\n"
       "Options:\n"
       "  -h  This help text.\n"
@@ -2902,6 +2948,8 @@ int main(int argc,const char *argv[])                                     /*{{{*/
                                    {"purge",&DoInstall},
                                   {"autoremove",&DoInstall},
                                   {"purge",&DoInstall},
+                                  {"markauto",&DoMarkAuto},
+                                  {"unmarkauto",&DoMarkAuto},
                                    {"dist-upgrade",&DoDistUpgrade},
                                    {"dselect-upgrade",&DoDSelectUpgrade},
                                   {"build-dep",&DoBuildDep},
index 12768b7..c64d435 100755 (executable)
@@ -8,7 +8,7 @@ import os.path
 try:
     import apt_pkg
 except ImportError:
-    print "Error importing apt_pkg, is python-apt installed?"
+    print >> sys.stderr, "Error importing apt_pkg, is python-apt installed?"
     sys.exit(1)
     
 actions = { "markauto" : 1,
@@ -68,6 +68,7 @@ if __name__ == "__main__":
     # option parsing
     parser = OptionParser()
     parser.usage = "%prog [options] {markauto|unmarkauto} packages..."
+    parser.epilog = "apt-mark is deprecated, use apt-get markauto/unmarkauto."
     parser.add_option("-f", "--file", action="store", type="string",
                       dest="filename",
                       help="read/write a different file")
index 302d88d..5e7122f 100644 (file)
@@ -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.7.25")
+AC_DEFINE_UNQUOTED(VERSION,"0.7.26~exp4")
 PACKAGE="apt"
 AC_DEFINE_UNQUOTED(PACKAGE,"$PACKAGE")
 AC_SUBST(PACKAGE)
index 144d307..43f76a1 100644 (file)
@@ -1,20 +1,31 @@
-apt (0.7.26~exp4) UNRELEASED; urgency=low
+apt (0.7.26~exp5) UNRELEASED; urgency=low
 
-  [ Michael Vogt ]
-  * [ Abi break ] apt-pkg/acquire-item.{cc,h}:
-    - add "IsIndexFile" to constructor of pkgAcqFile so that it sends
-      the right cache control headers
-  * apt-pkg/depcache.cc:
-    - fix incorrect std::cout usage for debug output
-  * test/libapt/getlanguages_test.cc:
-    - Add test for Esperanto that has nocounty associated with them
-      (LP: #560956)
+  [ David Kalnischkies ]
+  * cmdline/apt-get.cc:
+    - rerun dpkg-source in source if --fix-broken is given (Closes: #576752)
+    - don't suggest held packages as they are installed (Closes: #578135)
+  * cmdline/apt-cache.cc:
+    - use GroupCount for package names in stats and add a package struct line
+  * methods/rred.cc:
+    - use the patchfile modification time instead of the one from the
+      "old" file - thanks to Philipp Weis for noticing! (Closes: #571541)
+  * debian/rules:
+    - remove targets refering to CVS or arch as they are useless
+
+  [ Jari Aalto ]
+  * debian/rules:
+    - spell out some less known options to reduce manpage consulation-rate
+    - Use POSIX command substitution: $(<command sequence>)
+    - Remove EOL whitespace (Closes: #577804)
+
+ -- David Kalnischkies <kalnischkies@gmail.com>  Thu, 06 May 2010 16:10:39 +0200
+
+apt (0.7.26~exp4) experimental; urgency=low
 
   [ David Kalnischkies ]
   * apt-pkg/depcache.cc:
     - rewrite the pseudo package reinstaller to be more intelligent
       in his package choices
-    - return in SingleArch a package also for "any"
   * apt-pkg/packagemanager.cc:
     - don't try to "unpack" pseudo packages twice
   * apt-pkg/contrib/fileutl.cc:
@@ -33,8 +44,6 @@ apt (0.7.26~exp4) UNRELEASED; urgency=low
     - regex for package names executed on Grp- not PkgIterator
     - show non-candidates as fallback for virtual packages (Closes: #578385)
     - set also "all" to this version for pseudo packages in TryToChangeVer
-    - rerun dpkg-source in source if --fix-broken is given (Closes: #576752)
-    - don't suggest held packages as they are installed (Closes: #578135)
   * apt-pkg/deb/dpkgpm.cc:
     - remove Chroot-Directory from files passed to install commands.
       Thanks to Kel Modderman for report & patch! (Closes: #577226)
@@ -43,7 +52,6 @@ apt (0.7.26~exp4) UNRELEASED; urgency=low
   * cmdline/apt-cache.cc:
     - align Installed and Candidate Version in policy so they can be compared
       easier, thanks Ralf Gesellensetter for the pointer! (Closes: #578657)
-    - use GroupCount for package names in stats and add a package struct line
   * doc/apt.ent:
     - Add a note about APT_CONFIG in the -c description (Closes: #578267)
   * doc/po/de.po:
@@ -60,11 +68,6 @@ apt (0.7.26~exp4) UNRELEASED; urgency=low
   * apt-pkg/pkgcache.h:
     - enhance the Groups ABI by providing a ID as the other structs does
     - check also the size of the Group struct then checking for the others
-  * methods/rred.cc:
-    - use the patchfile modification time instead of the one from the
-      "old" file - thanks to Philipp Weis for noticing! (Closes: #571541)
-  * debian/rules:
-    - remove targets refering to CVS or arch as they are useless
 
   [ Jari Aalto ]
   * cmdline/apt-get.cc:
@@ -73,12 +76,39 @@ apt (0.7.26~exp4) UNRELEASED; urgency=low
   * dselect/install:
     - modernize if-statements not to use 'x' (Closes: #577117)
     - replace backticks with POSIX $() (Closes: #577116)
+
+  [ Michael Vogt ]
+  * [ Abi break ] apt-pkg/acquire-item.{cc,h}:
+    - add "IsIndexFile" to constructor of pkgAcqFile so that it sends
+      the right cache control headers
+  * cmdline/apt-get.cc:
+    - fix crash when pkg.VersionList() is empty
+  * apt-pkg/depcache.cc:
+    - fix incorrect std::cout usage for debug output
+  * test/libapt/getlanguages_test.cc:
+    - Add test for Esperanto that has nocounty associated with them
+      (LP: #560956)
+  * apt-pkg/deb/debrecords.cc:
+    - fix max tag buffer size (LP: #545336, closes: #578959)
   * debian/rules:
-    - spell out some less known options to reduce manpage consulation-rate
-    - Use POSIX command substitution: $(<command sequence>)
-    - Remove EOL whitespace (Closes: #577804)
+    - install html doxygen in libapt-pkg-doc 
+  * debian/control:
+    - build-depend on doxygen
+
+  [ Julian Andres Klode ]
+  * apt-pkg/contrib/weakptr.h:
+    - add a class WeakPointable which allows one to register weak pointers to
+      an object which will be set to NULL when the object is deallocated.
+  * [ABI break] apt-pkg/acquire{-worker,-item,}.h:
+    - subclass pkgAcquire::{Worker,Item,ItemDesc} from WeakPointable.
+  * apt-pkg/pkgcache.cc:
+    - Merge fix from David to correct handling in single-arch environments.
+  * cmdline/apt-cache.cc:
+    - Add a showauto command to apt-cache.
+  * cmdline/apt-get.cc:
+    - Add apt-get markauto and unmarkauto commands.
 
- -- David Kalnischkies <kalnischkies@gmail.com>  Sat, 03 Apr 2010 14:58:39 +0200
+ -- Michael Vogt <mvo@debian.org>  Thu, 06 May 2010 09:32:54 +0200
 
 apt (0.7.26~exp3) experimental; urgency=low
 
@@ -1584,13 +1614,6 @@ apt (0.7.6) unstable; urgency=low
 
  -- Otavio Salvador <otavio@debian.org>  Wed, 01 Aug 2007 19:49:51 -0300
 
-apt (0.7.6) unstable; urgency=low
-
-  * Applied patch from Aurelien Jarno <aurel32@debian.org> to fix wrong
-    directory downloading on non-linux architectures (closes: #435597)
-
- -- Otavio Salvador <otavio@debian.org>  Wed, 01 Aug 2007 19:49:51 -0300
-
 apt (0.7.5) unstable; urgency=low
 
   [ Otavio Salvador ]
index f0178d5..4f41c13 100644 (file)
@@ -6,7 +6,7 @@ Uploaders: Michael Vogt <mvo@debian.org>, Otavio Salvador <otavio@debian.org>,
  Christian Perrier <bubulle@debian.org>, Daniel Burrows <dburrows@debian.org>,
  Luca Bruno <lethalman88@gmail.com>, Julian Andres Klode <jak@debian.org>
 Standards-Version: 3.8.4
-Build-Depends: debhelper (>= 5.0), libdb-dev, gettext (>= 0.12), libcurl4-gnutls-dev | libcurl3-gnutls-dev (>= 7.15.5), debiandoc-sgml, xsltproc, docbook-xsl, po4a (>= 0.34-2), autotools-dev, autoconf, automake
+Build-Depends: debhelper (>= 5.0), libdb-dev, gettext (>= 0.12), libcurl4-gnutls-dev | libcurl3-gnutls-dev (>= 7.15.5), debiandoc-sgml, xsltproc, docbook-xsl, po4a (>= 0.34-2), autotools-dev, autoconf, automake, doxygen
 Build-Conflicts: autoconf2.13, automake1.4
 
 Package: apt
@@ -51,6 +51,9 @@ Section: doc
 Description: Documentation for APT development
  This package contains documentation for development of the APT
  Debian package manipulation program and its libraries.
+ .
+ This includes the source code documentation generated by doxygen
+ in html format.
 
 Package: apt-utils
 Architecture: any
index bb2cc34..cb46227 100755 (executable)
@@ -145,7 +145,8 @@ libapt-pkg-doc: build-doc debian/shlibs.local
                            $(BLD)/docs/files* \
                            $(BLD)/docs/method* \
                            doc/libapt-pkg2_to_3.txt \
-                           doc/style.txt
+                           doc/style.txt \
+                           $(BLD)/doc/doxygen/html
        dh_installexamples -p$@
 
        dh_installchangelogs -p$@