From b2ea1a47531266377abe4f12c6f21417ea96eea0 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 9 Jun 2013 18:58:34 +0200 Subject: [PATCH] ensure state-dir exists before coyping cdrom files MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit We do the same in the acquire system which handles the 'normal' downloads, so do it here as well even though its unlikely anyone will ever notice (beside testcases of course …) --- apt-pkg/cdrom.cc | 8 ++++++++ debian/changelog | 1 + test/integration/framework | 8 +++++--- test/integration/test-apt-cdrom | 2 +- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/apt-pkg/cdrom.cc b/apt-pkg/cdrom.cc index 9a9a854b..a5668a50 100644 --- a/apt-pkg/cdrom.cc +++ b/apt-pkg/cdrom.cc @@ -829,6 +829,14 @@ bool pkgCdrom::Add(pkgCdromStatus *log) /*{{{*/ log->Update(msg.str()); log->Update(_("Copying package lists..."), STEP_COPY); } + + // check for existence and possibly create state directory for copying + string const listDir = _config->FindDir("Dir::State::lists"); + string const partialListDir = listDir + "partial/"; + if (CreateAPTDirectoryIfNeeded(_config->FindDir("Dir::State"), partialListDir) == false && + CreateAPTDirectoryIfNeeded(listDir, partialListDir) == false) + return _error->Errno("cdrom", _("List directory %spartial is missing."), listDir.c_str()); + // take care of the signatures and copy them if they are ok // (we do this before PackageCopy as it modifies "List" and "SourceList") SigVerify SignVerify; diff --git a/debian/changelog b/debian/changelog index cde0aba2..7582b4f3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -14,6 +14,7 @@ apt (0.9.8.3) UNRELEASED; urgency=low * don't explicitly init ExtractTar InFd with invalid fd * OpenDescriptor should autoclose fd always on error (Closes: #704608) * fail in CopyFile if the FileFds have error flag set + * ensure state-dir exists before coyping cdrom files -- David Kalnischkies Sun, 09 Jun 2013 15:06:24 +0200 diff --git a/test/integration/framework b/test/integration/framework index 7c2aed59..5c50498a 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -692,9 +692,11 @@ setupaptarchive() { setupflataptarchive fi signreleasefiles - msgninfo "\tSync APT's cache with the archive… " - aptget update -qq - msgdone "info" + if [ "$1" != '--no-update' ]; then + msgninfo "\tSync APT's cache with the archive… " + aptget update -qq + msgdone "info" + fi } signreleasefiles() { diff --git a/test/integration/test-apt-cdrom b/test/integration/test-apt-cdrom index 3394aa50..6e353315 100755 --- a/test/integration/test-apt-cdrom +++ b/test/integration/test-apt-cdrom @@ -7,7 +7,7 @@ setupenvironment configarchitecture 'amd64' 'i386' buildsimplenativepackage 'testing' 'amd64,i386' '0.8.15' 'stable' -setupaptarchive +setupaptarchive --no-update changetocdrom 'Debian APT Testdisk 0.8.15' -- 2.20.1