]> git.saurik.com Git - apt.git/commitdiff
* apt-pkg/indexcopy.cc:
authorMichael Vogt <michael.vogt@ubuntu.com>
Fri, 3 Sep 2010 18:22:15 +0000 (20:22 +0200)
committerMichael Vogt <michael.vogt@ubuntu.com>
Fri, 3 Sep 2010 18:22:15 +0000 (20:22 +0200)
  - only use trusted.gpg.d directory if it exists

12 files changed:
apt-pkg/acquire.cc
apt-pkg/acquire.h
apt-pkg/algorithms.cc
apt-pkg/contrib/fileutl.cc
apt-pkg/contrib/fileutl.h
apt-pkg/deb/dpkgpm.cc
apt-pkg/indexcopy.cc
apt-pkg/versionmatch.cc
configure.in
debian/changelog
doc/po/fr.po
test/integration/framework

index 63825da93937707527d62251fef07bc407664bee..6ec5573977f700943045bf9ce46af14a0b1256a5 100644 (file)
@@ -93,27 +93,6 @@ bool pkgAcquire::Setup(pkgAcquireStatus *Progress, string const &Lock)
    return true;
 }
                                                                        /*}}}*/
-// Acquire::CheckDirectory - ensure that the given directory exists    /*{{{*/
-// ---------------------------------------------------------------------
-/* a small wrapper around CreateDirectory to check if it exists and to
-   remove the trailing "/apt/" from the parent directory if needed */
-bool pkgAcquire::CheckDirectory(string const &Parent, string const &Path) const
-{
-   if (DirectoryExists(Path) == true)
-      return true;
-
-   size_t const len = Parent.size();
-   if (len > 5 && Parent.find("/apt/", len - 6, 5) == len - 5)
-   {
-      if (CreateDirectory(Parent.substr(0,len-5), Path) == true)
-        return true;
-   }
-   else if (CreateDirectory(Parent, Path) == true)
-      return true;
-
-   return false;
-}
-                                                                       /*}}}*/
 // Acquire::~pkgAcquire        - Destructor                                    /*{{{*/
 // ---------------------------------------------------------------------
 /* Free our memory, clean up the queues (destroy the workers) */
index 82be8b84333a1eda013255263038c42d7d5ac69e..e3a4435b8d7d913d7a37706d1ebf5dd9d387989e 100644 (file)
@@ -362,14 +362,6 @@ class pkgAcquire
    private:
    /** \brief FD of the Lock file we acquire in Setup (if any) */
    int LockFD;
-
-   /** \brief Ensure the existence of the given Path
-    *
-    *  \param Parent directory of the Path directory - a trailing
-    *  /apt/ will be removed before CreateDirectory call.
-    *  \param Path which should exist after (successful) call
-    */
-   bool CheckDirectory(string const &Parent, string const &Path) const;
 };
 
 /** \brief Represents a single download source from which an item
index bd9a9df622147b8e46aecb17a237491ba03e42fb..3c8711b7443bdaa497f00e9bafe83815db50c3a6 100644 (file)
@@ -987,24 +987,6 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
               pkgCache::VerIterator Ver(Cache,*V);
               pkgCache::PkgIterator Pkg = Ver.ParentPkg();
 
-               /* Ignore a target that is not a candidate
-                  This can happen if:
-                    installed package provides video-6
-                    candidate provides video-8
-                  now if a package Start breaks/conflicts video-6
-                  Start.AllTargets() will return the now-installed
-                  versions even though these are not candidates
-                  we can ignore them
-               */
-               if (Cache[Pkg].CandidateVerIter(Cache) != Ver)
-               {
-                  if (Debug)
-                     clog << "  Version " << Ver.VerStr() << " for "
-                          << Pkg.Name() << " is not a candidate, ignoring"
-                          << endl;
-                 continue;
-               }
-
               if (Debug == true)
                  clog << "  Considering " << Pkg.FullName(false) << ' ' << (int)Scores[Pkg->ID] <<
                  " as a solution to " << I.FullName(false) << ' ' << (int)Scores[I->ID] << endl;
@@ -1098,7 +1080,7 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
 
                  if (Start->Type == pkgCache::Dep::DpkgBreaks)
                  {
-                    // first, try upgrading the package, if that
+                    // first, try upgradring the package, if that
                     // does not help, the breaks goes onto the
                     // kill list
                     // FIXME: use DoUpgrade(Pkg) instead?
@@ -1123,7 +1105,6 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
                  LEnd++;
                  
                  if (Start->Type != pkgCache::Dep::Conflicts &&
-                      Start->Type != pkgCache::Dep::DpkgBreaks &&
                      Start->Type != pkgCache::Dep::Obsoletes)
                     break;
               }
index 2b73d142488de5cbcc647705273d2a51e102e4a2..94d994e8ba6dd73e4a969b127998dce6f6ba5882 100644 (file)
@@ -251,6 +251,27 @@ bool CreateDirectory(string const &Parent, string const &Path)
    return true;
 }
                                                                        /*}}}*/
+// CheckDirectory - ensure that the given directory exists             /*{{{*/
+// ---------------------------------------------------------------------
+/* a small wrapper around CreateDirectory to check if it exists and to
+   remove the trailing "/apt/" from the parent directory if needed */
+bool CheckDirectory(string const &Parent, string const &Path)
+{
+   if (DirectoryExists(Path) == true)
+      return true;
+
+   size_t const len = Parent.size();
+   if (len > 5 && Parent.find("/apt/", len - 6, 5) == len - 5)
+   {
+      if (CreateDirectory(Parent.substr(0,len-5), Path) == true)
+        return true;
+   }
+   else if (CreateDirectory(Parent, Path) == true)
+      return true;
+
+   return false;
+}
+                                                                       /*}}}*/
 // GetListOfFilesInDir - returns a vector of files in the given dir    /*{{{*/
 // ---------------------------------------------------------------------
 /* If an extension is given only files with this extension are included
index cb465579803683bda742cb89cfc2d6a013da529a..f79c9032f84ff5da7c92f456642eb7ebdccb9ff8 100644 (file)
@@ -94,6 +94,15 @@ int GetLock(string File,bool Errors = true);
 bool FileExists(string File);
 bool DirectoryExists(string const &Path) __attrib_const;
 bool CreateDirectory(string const &Parent, string const &Path);
+
+/** \brief Ensure the existence of the given Path
+ *
+ *  \param Parent directory of the Path directory - a trailing
+ *  /apt/ will be removed before CreateDirectory call.
+ *  \param Path which should exist after (successful) call
+ */
+bool CheckDirectory(string const &Parent, string const &Path);
+
 std::vector<string> GetListOfFilesInDir(string const &Dir, string const &Ext,
                                        bool const &SortList, bool const &AllowNoExt=false);
 std::vector<string> GetListOfFilesInDir(string const &Dir, std::vector<string> const &Ext,
index 5530ef12975862f9b24e0aa5d06e7b588689c671..d3c432ce10da049a941982cfa574f58cfc4ee27f 100644 (file)
@@ -641,7 +641,8 @@ void pkgDPkgPM::WriteHistoryTag(string const &tag, string value)
 bool pkgDPkgPM::OpenLog()
 {
    string const logdir = _config->FindDir("Dir::Log");
-   if(not FileExists(logdir))
+   if(CheckDirectory(logdir, logdir) == false)
+      // FIXME: use a better string after freeze
       return _error->Error(_("Directory '%s' missing"), logdir.c_str());
 
    // get current time
index a2a1d59347ecbbda5bb9a5f5a4d85eaac63dfbf8..fb33ed46141c914e84be687e7b532e8e2b795c27 100644 (file)
@@ -673,9 +673,13 @@ bool SigVerify::RunGPGV(std::string const &File, std::string const &FileGPG,
       std::clog << "Keyring path: " << trustedPath << std::endl;
    }
 
-   std::vector<string> keyrings = GetListOfFilesInDir(trustedPath, "gpg", false);
-   if (FileExists(trustedFile) == true)
-      keyrings.push_back(trustedFile);
+   std::vector<string> keyrings;
+   if (DirectoryExists(trustedPath))
+   {
+       keyrings = GetListOfFilesInDir(trustedPath, "gpg", false, true);
+       if (FileExists(trustedFile) == true)
+          keyrings.push_back(trustedFile);
+   }
 
    std::vector<const char *> Args;
    Args.reserve(30);
index 17a54bc4c5a3dd9582cafe28c2d64fde8d161860..c40b1fdbc859b0875192ac79ca55a3d461fc6e43 100644 (file)
@@ -118,7 +118,7 @@ pkgVersionMatch::pkgVersionMatch(string Data,MatchType Type) : Type(Type)
    
    if (Type == Origin)
    {
-      if (Data[0] == '"' && Data.end()[-1] == '"')
+      if (Data[0] == '"' && Data.length() >= 2 && Data.end()[-1] == '"')
         OrSite = Data.substr(1, Data.length() - 2);
       else
         OrSite = Data;
index 8b212c1bc002f7271574072f95767b3c4093ca19..151885d66e64b27e524cc66700c124be7a158684 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.26~exp6")
+AC_DEFINE_UNQUOTED(VERSION,"0.8.1")
 PACKAGE="apt"
 AC_DEFINE_UNQUOTED(PACKAGE,"$PACKAGE")
 AC_SUBST(PACKAGE)
index e37a5504fd3649030eced151b11064f86c00e9cc..c810260412b5f910c4d92f17f041ebcaea108140 100644 (file)
@@ -1,3 +1,10 @@
+apt (0.8.2) unstable; urgency=low
+
+  * apt-pkg/indexcopy.cc:
+    - only use trusted.gpg.d directory if it exists
+
+ -- Michael Vogt <michael.vogt@ubuntu.com>  Fri, 03 Sep 2010 20:21:43 +0200
+
 apt (0.8.1) UNRELEASED; urgency=low
 
   [ Programs translations ]
@@ -40,8 +47,11 @@ apt (0.8.1) UNRELEASED; urgency=low
     - let the pin origin actually work as advertised in the manpage
       which means "" are optional and pinning a local archive does
       work - even if it is a non-flat archive (Closes: #594435)
+  * apt-pkg/deb/dpkgpm.cc:
+    - create Dir::Log if needed to support /var/log as tmpfs or similar,
+      inspired by Thomas Bechtold, thanks! (Closes: #523919, LP: #220239)
 
- -- Michael Vogt <mvo@debian.org>  Mon, 30 Aug 2010 11:53:30 +0200
+ -- David Kalnischkies <kalnischkies@gmail.com>  Thu, 02 Sep 2010 12:41:32 +0200
 
 apt (0.8.0) unstable; urgency=low
 
index de55bed1d5f8c0cacd182f4eb5d68dbb1a4bc6f8..43f8b87ee9ce0911abc1064fafef9e4b99edb8f8 100644 (file)
@@ -1095,7 +1095,6 @@ msgstr ""
 "     <listitem><para>Liste d'état des paquets installés automatiquement.\n"
 "     Élément de configuration : <literal>Dir::State::extended_states</literal>.</para></listitem>\n"
 "     </varlistentry>\n"
-"\">\n"
 
 #. type: Plain text
 #: apt.ent:377
@@ -3885,24 +3884,21 @@ msgstr ""
 "<command>apt-get</command> <arg><option>-sqdyfmubV</option></arg> <arg> "
 "<option>-o= <replaceable>option_de_configuration</replaceable> </option> </"
 "arg> <arg> <option>-c= <replaceable>fichier_de_configuration</replaceable> </"
-"option> </arg> <arg> <option>-t=</option> <arg "
-"choice='plain'> <replaceable>nom_version_cible</replaceable> </arg> </arg> <group "
+"option> </arg> <arg> <option>-t=</option> <group choice='req'> <arg "
+"choice='plain'> <replaceable>nom_version_cible</replaceable> </arg> <group "
 "choice=\"req\"> <arg choice='plain'>update</arg> <arg "
 "choice='plain'>upgrade</arg> <arg choice='plain'>dselect-upgrade</arg> <arg "
 "choice='plain'>dist-upgrade</arg> <arg choice='plain'>install <arg choice="
 "\"plain\" rep=\"repeat\"><replaceable>pkg</replaceable> <arg> <group "
 "choice='req'> <arg choice='plain'> =<replaceable>numero_version_paquet</"
 "replaceable> </arg> <arg choice='plain'> /<replaceable>nom_version_cible</"
-"replaceable> </arg> </group> </arg> </arg> </arg>"
-"<arg choice='plain'>remove <arg choice=\"plain\" rep="
+"replaceable> </arg> <arg choice='plain'>remove <arg choice=\"plain\" rep="
 "\"repeat\"><replaceable>pkg</replaceable></arg></arg> <arg "
 "choice='plain'>purge <arg choice=\"plain\" rep=\"repeat\"><replaceable>pkg</"
 "replaceable></arg></arg> <arg choice='plain'>source <arg choice=\"plain\" "
-"rep=\"repeat\"><replaceable>paquet</replaceable> <arg> <group choice='req'> "
-"<arg choice='plain'> =<replaceable>numéro_version_paquet</replaceable> </arg> "
-"<arg choice='plain'> /<replaceable>nom_version_cible</replaceable> </arg> </"
-"group> </arg> </arg> </arg> <arg choice='plain'>build-dep <arg choice=\"plain\""
-" rep=\"repeat"
+"rep=\"repeat\"><replaceable>paquet</replaceable> <arg> "
+"=<replaceable>numéro_version_paquet</replaceable> </arg> </arg> </arg> <arg "
+"choice='plain'>build-dep <arg choice=\"plain\" rep=\"repeat"
 "\"><replaceable>paquet</replaceable></arg></arg> <arg choice='plain'>check</"
 "arg> <arg choice='plain'>clean</arg> <arg choice='plain'>autoclean</arg> "
 "<arg choice='plain'>autoremove</arg> <arg choice='plain'> <group "
@@ -7154,7 +7150,7 @@ msgstr ""
 "La liste <literal>Ignore-Files-Silently</literal> permet d'indiquer quels "
 "sont les fichiers qu'APT peut ignorer sans avertissement dans les "
 "répertoires contenant des fragments de configuration. Par défaut, les "
-"fichiers qui se terminent par <literal>.disabled</literal>, <literal>~</"
+"fichiers qui se terminent par literal>.disabled</literal>, <literal>~</"
 "literal>, <literal>.bak</literal> ou <literal>.dpkg-[a-z]+</literal> sont "
 "ignorés. Comme cela est visible dans le dernier élément de cette liste, il "
 "est possible d'utiliser la syntaxe des expressions rationnelles."
index 8efe473307b0b0a70dcd9af2201c6df065040421..d832bedbef5010bfdd3b3f23879a8a0d69a573da 100644 (file)
@@ -72,11 +72,14 @@ aptconfig() { runapt apt-config $*; }
 aptcache() { runapt apt-cache $*; }
 aptget() { runapt apt-get $*; }
 aptftparchive() { runapt apt-ftparchive $*; }
+dpkg() {
+       $(which dpkg) --root=${TMPWORKINGDIRECTORY}/rootdir --force-not-root --force-bad-path --log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log $*
+}
 
 setupenvironment() {
        TMPWORKINGDIRECTORY=$(mktemp -d)
        local TESTDIR=$(readlink -f $(dirname $0))
-       msgninfo "Preparing environment for ${CCMD}$0${CINFO} in ${TMPWORKINGDIRECTORY}… "
+       msgninfo "Preparing environment for ${CCMD}$(basename $0)${CINFO} in ${TMPWORKINGDIRECTORY}… "
        BUILDDIRECTORY="${TESTDIR}/../../build/bin"
        test -x "${BUILDDIRECTORY}/apt-get" || msgdie "You need to build tree first"
        local OLDWORKINGDIRECTORY=$(pwd)
@@ -85,10 +88,10 @@ setupenvironment() {
        cd $TMPWORKINGDIRECTORY
        mkdir rootdir aptarchive keys
        cd rootdir
-       mkdir -p etc/apt/apt.conf.d etc/apt/sources.list.d etc/apt/trusted.gpg.d etc/apt/preferences.d var/cache
-       mkdir -p var/log/apt var/lib/apt
+       mkdir -p etc/apt/apt.conf.d etc/apt/sources.list.d etc/apt/trusted.gpg.d etc/apt/preferences.d
+       mkdir -p var/cache var/lib var/log
        mkdir -p var/lib/dpkg/info var/lib/dpkg/updates var/lib/dpkg/triggers
-       local STATUSFILE=$(echo "$(basename $0)" | sed 's/^test-/status-/')
+       local STATUSFILE=$(echo "$(basename $0)" | sed -e 's/^test-/status-/' -e 's/^skip-/status-/')
        if [ -f "${TESTDIR}/${STATUSFILE}" ]; then
                cp "${TESTDIR}/${STATUSFILE}" var/lib/dpkg/status
        else
@@ -98,7 +101,7 @@ setupenvironment() {
        mkdir -p usr/lib/apt
        ln -s ${BUILDDIRECTORY}/methods usr/lib/apt/methods
        cd ..
-       local PACKAGESFILE=$(echo "$(basename $0)" | sed 's/^test-/Packages-/')
+       local PACKAGESFILE=$(echo "$(basename $0)" | sed -e 's/^test-/Packages-/' -e 's/^skip-/Packages-/')
        if [ -f "${TESTDIR}/${PACKAGESFILE}" ]; then
                cp "${TESTDIR}/${PACKAGESFILE}" aptarchive/Packages
        else
@@ -228,6 +231,10 @@ buildaptarchive() {
 
 createaptftparchiveconfig() {
        local ARCHS="$(find pool/ -name '*.deb' | grep -oE '_[a-z0-9-]+\.deb$' | sort | uniq | sed -e '/^_all.deb$/ d' -e 's#^_\([a-z0-9-]*\)\.deb$#\1#' | tr '\n' ' ')"
+       if [ -z "$ARCHS" ]; then
+               # the pool is empty, so we will operate on faked packages - let us use the configured archs
+               ARCHS="$(aptconfig dump | grep APT::Architecture | cut -d'"' -f 2 | sed '/^$/ d' | sort | uniq | tr '\n' ' ')"
+       fi
        echo -n 'Dir {
        ArchiveDir "' >> ftparchive.conf
        echo -n $(readlink -f .) >> ftparchive.conf
@@ -297,7 +304,7 @@ buildaptftparchivedirectorystructure() {
 }
 
 buildaptarchivefromincoming() {
-       msginfo "Build APT archive for ${CCMD}$0${CINFO} based on incoming packages…"
+       msginfo "Build APT archive for ${CCMD}$(basename $0)${CINFO} based on incoming packages…"
        cd aptarchive
        [ -e pool ] || ln -s ../incoming pool
        [ -e ftparchive.conf ] || createaptftparchiveconfig
@@ -314,7 +321,7 @@ buildaptarchivefromincoming() {
 }
 
 buildaptarchivefromfiles() {
-       msginfo "Build APT archive for ${CCMD}$0${CINFO} based on prebuild files…"
+       msginfo "Build APT archive for ${CCMD}$(basename $0)${CINFO} based on prebuild files…"
        cd aptarchive
        if [ -f Packages ]; then
                msgninfo "\tPackages file… "
@@ -476,7 +483,7 @@ N: No packages found"
        local ARCH=$(dpkg-architecture -qDEB_HOST_ARCH_CPU)
        eval `apt-config shell ARCH APT::Architecture`
        echo "$VIRTUAL" | sed -e "s/:$ARCH//" -e 's/:all//' > $COMPAREFILE
-       aptcache show $PACKAGE 2>&1 | checkdiff $COMPAREFILE - && msgpass || msgfail
+       aptcache show -q=0 $PACKAGE 2>&1 | checkdiff $COMPAREFILE - && msgpass || msgfail
        rm $COMPAREFILE
 }