summaryrefslogtreecommitdiff
path: root/apt-pkg/deb
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg/deb')
-rw-r--r--apt-pkg/deb/debmetaindex.cc2
-rw-r--r--apt-pkg/deb/debrecords.cc8
-rw-r--r--apt-pkg/deb/debrecords.h1
-rw-r--r--apt-pkg/deb/dpkgpm.cc42
-rw-r--r--apt-pkg/deb/dpkgpm.h2
5 files changed, 47 insertions, 8 deletions
diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc
index c700f8d58..9ac659f78 100644
--- a/apt-pkg/deb/debmetaindex.cc
+++ b/apt-pkg/deb/debmetaindex.cc
@@ -224,7 +224,7 @@ class debSLTypeDebian : public pkgSourceList::Type
// This check insures that there will be only one Release file
// queued for all the Packages files and Sources files it
// corresponds to.
- if (strcmp((*I)->GetType(), "deb") == 0)
+ if (strcmp((*I)->GetType(), "deb") == 0)
{
debReleaseIndex *Deb = (debReleaseIndex *) (*I);
// This check insures that there will be only one Release file
diff --git a/apt-pkg/deb/debrecords.cc b/apt-pkg/deb/debrecords.cc
index 3d3d7de0a..8ed0bb7eb 100644
--- a/apt-pkg/deb/debrecords.cc
+++ b/apt-pkg/deb/debrecords.cc
@@ -51,6 +51,14 @@ string debRecordParser::Name()
return Section.FindS("Package");
}
/*}}}*/
+// RecordParser::Homepage - Return the package homepage /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+string debRecordParser::Homepage()
+{
+ return Section.FindS("Homepage");
+}
+ /*}}}*/
// RecordParser::MD5Hash - Return the archive hash /*{{{*/
// ---------------------------------------------------------------------
/* */
diff --git a/apt-pkg/deb/debrecords.h b/apt-pkg/deb/debrecords.h
index ab244b6dd..6f358abfa 100644
--- a/apt-pkg/deb/debrecords.h
+++ b/apt-pkg/deb/debrecords.h
@@ -44,6 +44,7 @@ class debRecordParser : public pkgRecords::Parser
virtual string ShortDesc();
virtual string LongDesc();
virtual string Name();
+ virtual string Homepage();
virtual void GetRec(const char *&Start,const char *&Stop);
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc
index 7a6b222f6..2753936b2 100644
--- a/apt-pkg/deb/dpkgpm.cc
+++ b/apt-pkg/deb/dpkgpm.cc
@@ -45,8 +45,8 @@ using namespace std;
// ---------------------------------------------------------------------
/* */
pkgDPkgPM::pkgDPkgPM(pkgDepCache *Cache)
- : pkgPackageManager(Cache), dpkgbuf_pos(0), PackagesDone(0),
- PackagesTotal(0), term_out(NULL)
+ : pkgPackageManager(Cache), dpkgbuf_pos(0),
+ term_out(NULL), PackagesDone(0), PackagesTotal(0)
{
}
/*}}}*/
@@ -335,7 +335,6 @@ bool pkgDPkgPM::RunScriptsWithPkgs(const char *Cnf)
return true;
}
-
/*}}}*/
// DPkgPM::DoStdin - Read stdin and pass to slave pty /*{{{*/
// ---------------------------------------------------------------------
@@ -345,7 +344,10 @@ void pkgDPkgPM::DoStdin(int master)
{
char input_buf[256] = {0,};
int len = read(0, input_buf, sizeof(input_buf));
- write(master, input_buf, len);
+ if (len)
+ write(master, input_buf, len);
+ else
+ stdin_is_dev_null = true;
}
/*}}}*/
// DPkgPM::DoTerminalPty - Read the terminal pty and write log /*{{{*/
@@ -546,6 +548,27 @@ bool pkgDPkgPM::CloseLog()
return true;
}
+/*{{{*/
+// This implements a racy version of pselect for those architectures
+// that don't have a working implementation.
+// FIXME: Probably can be removed on Lenny+1
+static int racy_pselect(int nfds, fd_set *readfds, fd_set *writefds,
+ fd_set *exceptfds, const struct timespec *timeout,
+ const sigset_t *sigmask)
+{
+ sigset_t origmask;
+ struct timeval tv;
+ int retval;
+
+ tv.tv_sec = timeout->tv_sec;
+ tv.tv_usec = timeout->tv_nsec/1000;
+
+ sigprocmask(SIG_SETMASK, sigmask, &origmask);
+ retval = select(nfds, readfds, writefds, exceptfds, &tv);
+ sigprocmask(SIG_SETMASK, &origmask, 0);
+ return retval;
+}
+/*}}}*/
// DPkgPM::Go - Run the sequence /*{{{*/
// ---------------------------------------------------------------------
@@ -621,6 +644,8 @@ bool pkgDPkgPM::Go(int OutStatusFd)
}
}
+ stdin_is_dev_null = false;
+
// create log
OpenLog();
@@ -804,7 +829,7 @@ bool pkgDPkgPM::Go(int OutStatusFd)
/* No Job Control Stop Env is a magic dpkg var that prevents it
from using sigstop */
- putenv("DPKG_NO_TSTP=yes");
+ putenv((char *)"DPKG_NO_TSTP=yes");
execvp(Args[0],(char **)Args);
cerr << "Could not exec dpkg!" << endl;
_exit(100);
@@ -847,10 +872,10 @@ bool pkgDPkgPM::Go(int OutStatusFd)
signal(SIGINT,old_SIGINT);
return _error->Errno("waitpid","Couldn't wait for subprocess");
}
-
// wait for input or output here
FD_ZERO(&rfds);
- FD_SET(0, &rfds);
+ if (!stdin_is_dev_null)
+ FD_SET(0, &rfds);
FD_SET(_dpkgin, &rfds);
if(master >= 0)
FD_SET(master, &rfds);
@@ -858,6 +883,9 @@ bool pkgDPkgPM::Go(int OutStatusFd)
tv.tv_nsec = 0;
select_ret = pselect(max(master, _dpkgin)+1, &rfds, NULL, NULL,
&tv, &original_sigmask);
+ if (select_ret < 0 && (errno == EINVAL || errno == ENOSYS))
+ select_ret = racy_pselect(max(master, _dpkgin)+1, &rfds, NULL,
+ NULL, &tv, &original_sigmask);
if (select_ret == 0)
continue;
else if (select_ret < 0 && errno == EINTR)
diff --git a/apt-pkg/deb/dpkgpm.h b/apt-pkg/deb/dpkgpm.h
index e5f197405..83b3f95fc 100644
--- a/apt-pkg/deb/dpkgpm.h
+++ b/apt-pkg/deb/dpkgpm.h
@@ -23,6 +23,8 @@ class pkgDPkgPM : public pkgPackageManager
{
private:
+ bool stdin_is_dev_null;
+
// the buffer we use for the dpkg status-fd reading
char dpkgbuf[1024];
int dpkgbuf_pos;