summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apt-pkg/deb/dpkgpm.cc10
-rw-r--r--apt-pkg/install-progress.cc2
-rwxr-xr-xtest/integration/test-apt-progress-fd-conffile43
3 files changed, 51 insertions, 4 deletions
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc
index b4bfd1400..0d73733d5 100644
--- a/apt-pkg/deb/dpkgpm.cc
+++ b/apt-pkg/deb/dpkgpm.cc
@@ -44,6 +44,7 @@
#include <unistd.h>
#include <sys/ioctl.h>
#include <pty.h>
+#include <stdio.h>
#include <apti18n.h>
/*}}}*/
@@ -596,7 +597,7 @@ void pkgDPkgPM::ProcessDpkgStatusLine(char *line)
errors look like this:
'status: /var/cache/apt/archives/krecipes_0.8.1-0ubuntu1_i386.deb : error : trying to overwrite `/usr/share/doc/kde/HTML/en/krecipes/krectip.png', which is also in package krecipes-data
and conffile-prompt like this
- 'status: conffile-prompt: conffile : 'current-conffile' 'new-conffile' useredited distedited
+ 'status:/etc/compiz.conf/compiz.conf : conffile-prompt: 'current-conffile' 'new-conffile' useredited distedited
*/
if (prefix == "status")
{
@@ -608,7 +609,7 @@ void pkgDPkgPM::ProcessDpkgStatusLine(char *line)
WriteApportReport(list[1].c_str(), list[3].c_str());
return;
}
- else if(action == "conffile")
+ else if(action == "conffile-prompt")
{
d->progress->ConffilePrompt(list[1], PackagesDone, PackagesTotal,
list[3]);
@@ -1036,7 +1037,10 @@ void pkgDPkgPM::StartPtyMagic()
if (tcgetattr(STDOUT_FILENO, &d->tt) == 0)
{
ioctl(1, TIOCGWINSZ, (char *)&win);
- if (openpty(&d->master, &d->slave, NULL, &d->tt, &win) < 0)
+ if (_config->FindB("Dpkg::Use-Pty", true) == false)
+ {
+ d->master = d->slave = -1;
+ } else if (openpty(&d->master, &d->slave, NULL, &d->tt, &win) < 0)
{
_error->Errno("openpty", _("Can not write log (%s)"), _("Is /dev/pts mounted?"));
d->master = d->slave = -1;
diff --git a/apt-pkg/install-progress.cc b/apt-pkg/install-progress.cc
index b82b7efde..0caf62b61 100644
--- a/apt-pkg/install-progress.cc
+++ b/apt-pkg/install-progress.cc
@@ -9,7 +9,7 @@
#include <sys/ioctl.h>
#include <sstream>
#include <fcntl.h>
-
+#include <stdio.h>
namespace APT {
namespace Progress {
diff --git a/test/integration/test-apt-progress-fd-conffile b/test/integration/test-apt-progress-fd-conffile
new file mode 100755
index 000000000..0b42b1b2f
--- /dev/null
+++ b/test/integration/test-apt-progress-fd-conffile
@@ -0,0 +1,43 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+
+setupenvironment
+configarchitecture 'native'
+
+# old conffile
+setupsimplenativepackage 'compiz-core' 'native' '1.0' 'unstable'
+BUILDDIR='incoming/compiz-core-1.0'
+mkdir -p ${BUILDDIR}/debian/compiz-core/etc
+echo 'foo=bar;' > ${BUILDDIR}/compiz.conf
+echo 'compiz.conf /etc/compiz.conf' >> ${BUILDDIR}/debian/install
+buildpackage "$BUILDDIR" 'unstable' 'main' 'native'
+rm -rf "$BUILDDIR"
+
+# new conffile
+setupsimplenativepackage 'compiz-core' 'native' '2.0' 'unstable'
+BUILDDIR='incoming/compiz-core-2.0'
+mkdir -p ${BUILDDIR}/debian/compiz-core/etc
+echo 'foo2=bar2;' > ${BUILDDIR}/compiz.conf
+echo 'compiz.conf /etc/compiz.conf' >> ${BUILDDIR}/debian/install
+buildpackage "$BUILDDIR" 'unstable' 'main' 'native'
+rm -rf "$BUILDDIR"
+
+setupaptarchive
+
+testsuccess aptget install compiz-core=1.0
+
+# fake conffile change
+echo "meep" >> rootdir/etc/compiz.conf/compiz.conf
+
+# install
+exec 3> apt-progress.log
+echo n | aptget install compiz-core=2.0 -o APT::Status-Fd=3 -o Dpkg::Use-Pty=false
+
+# and ensure there is a conffile message in the file
+msgtest "Conffile prompt in apt-progress.log"
+grep -q "pmconffile:/etc/compiz.conf/compiz.conf" apt-progress.log && msgpass || (cat apt-progress.log && msgfail)
+
+cat apt-progress.log \ No newline at end of file