summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apt-pkg/acquire.cc21
-rw-r--r--apt-pkg/acquire.h8
-rw-r--r--apt-pkg/contrib/fileutl.cc21
-rw-r--r--apt-pkg/contrib/fileutl.h9
-rw-r--r--apt-pkg/deb/dpkgpm.cc3
-rw-r--r--apt-pkg/versionmatch.cc2
-rw-r--r--debian/changelog12
-rw-r--r--test/integration/framework23
8 files changed, 60 insertions, 39 deletions
diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc
index 63825da93..6ec557397 100644
--- a/apt-pkg/acquire.cc
+++ b/apt-pkg/acquire.cc
@@ -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) */
diff --git a/apt-pkg/acquire.h b/apt-pkg/acquire.h
index 82be8b843..e3a4435b8 100644
--- a/apt-pkg/acquire.h
+++ b/apt-pkg/acquire.h
@@ -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
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc
index 2b73d1424..94d994e8b 100644
--- a/apt-pkg/contrib/fileutl.cc
+++ b/apt-pkg/contrib/fileutl.cc
@@ -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
diff --git a/apt-pkg/contrib/fileutl.h b/apt-pkg/contrib/fileutl.h
index cb4655798..f79c9032f 100644
--- a/apt-pkg/contrib/fileutl.h
+++ b/apt-pkg/contrib/fileutl.h
@@ -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,
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc
index 5530ef129..d3c432ce1 100644
--- a/apt-pkg/deb/dpkgpm.cc
+++ b/apt-pkg/deb/dpkgpm.cc
@@ -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
diff --git a/apt-pkg/versionmatch.cc b/apt-pkg/versionmatch.cc
index 17a54bc4c..c40b1fdbc 100644
--- a/apt-pkg/versionmatch.cc
+++ b/apt-pkg/versionmatch.cc
@@ -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;
diff --git a/debian/changelog b/debian/changelog
index 229a85d72..bed6a55c7 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,15 @@
+apt (0.8.2) UNRELEASED; urgency=low
+
+ [ David Kalnischkies ]
+ * apt-pkg/versionmatch.cc:
+ - do not accept 'Pin: origin "' (missing closing ") as a valid
+ way to pin a local archive: either "" or none…
+ * 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)
+
+ -- David Kalnischkies <kalnischkies@gmail.com> Fri, 03 Sep 2010 19:29:01 +0200
+
apt (0.8.1) unstable; urgency=low
[ Programs translations ]
diff --git a/test/integration/framework b/test/integration/framework
index 8efe47330..d832bedbe 100644
--- a/test/integration/framework
+++ b/test/integration/framework
@@ -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
}