summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2007-11-28 16:46:46 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2007-11-28 16:46:46 +0100
commitac3dee0e5091f19b77de96eec5241cb57c13f2a1 (patch)
tree2a82dd1c7a487f830bc4ec569c9f4e3775ddf4e8 /apt-pkg
parent318dd26ac9bdbb30bcd22201393dc73d8566b3cf (diff)
parent757f20941a19d5e1e9ebd74ecd5a4d5b0012644f (diff)
merge with the debian tree
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/acquire-item.cc2
-rw-r--r--apt-pkg/acquire.cc2
-rw-r--r--apt-pkg/cdrom.cc15
-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
-rw-r--r--apt-pkg/indexfile.cc4
-rw-r--r--apt-pkg/init.cc9
-rw-r--r--apt-pkg/init.h2
-rw-r--r--apt-pkg/makefile2
-rw-r--r--apt-pkg/pkgrecords.h1
13 files changed, 70 insertions, 22 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc
index 15577363e..8d647cdf2 100644
--- a/apt-pkg/acquire-item.cc
+++ b/apt-pkg/acquire-item.cc
@@ -751,7 +751,7 @@ void pkgAcqIndex::Done(string Message,unsigned long Size,string Hash,
Local = true;
string compExt = Desc.URI.substr(Desc.URI.size()-3);
- char *decompProg;
+ const char *decompProg;
if(compExt == "bz2")
decompProg = "bzip2";
else if(compExt == ".gz")
diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc
index cbd67055d..6840ae120 100644
--- a/apt-pkg/acquire.cc
+++ b/apt-pkg/acquire.cc
@@ -619,7 +619,7 @@ bool pkgAcquire::Queue::Startup()
added other source retry to have cycle maintain a pipeline depth
on its own. */
if (Cnf->Pipeline == true)
- MaxPipeDepth = 10;
+ MaxPipeDepth = 1000;
else
MaxPipeDepth = 1;
}
diff --git a/apt-pkg/cdrom.cc b/apt-pkg/cdrom.cc
index 96106c7a9..0cbdc178f 100644
--- a/apt-pkg/cdrom.cc
+++ b/apt-pkg/cdrom.cc
@@ -560,10 +560,17 @@ bool pkgCdrom::Ident(string &ident, pkgCdromStatus *log)
}
if(log) {
msg.str("");
- ioprintf(msg, _("Stored label: %s \n"),
- Database.Find("CD::"+ident).c_str());
+ ioprintf(msg, _("Stored label: %s\n"),
+ Database.Find("CD::"+ident).c_str());
log->Update(msg.str());
}
+
+ // Unmount and finish
+ if (_config->FindB("APT::CDROM::NoMount",false) == false) {
+ log->Update(_("Unmounting CD-ROM...\n"), STEP_LAST);
+ UnmountCdrom(CDROM);
+ }
+
return true;
}
@@ -668,8 +675,8 @@ bool pkgCdrom::Add(pkgCdromStatus *log)
DropRepeats(TransList,"");
if(log) {
msg.str("");
- ioprintf(msg, _("Found %lu package indexes, %lu source indexes, "
- "%lu translation indexes and %lu signatures\n"),
+ ioprintf(msg, _("Found %u package indexes, %u source indexes, "
+ "%u translation indexes and %u signatures\n"),
List.size(), SourceList.size(), TransList.size(),
SigList.size());
log->Update(msg.str(), STEP_SCAN);
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;
diff --git a/apt-pkg/indexfile.cc b/apt-pkg/indexfile.cc
index cf238eb4a..b38596143 100644
--- a/apt-pkg/indexfile.cc
+++ b/apt-pkg/indexfile.cc
@@ -113,8 +113,8 @@ string pkgIndexFile::LanguageCode()
// we have a mapping of the language codes that contains all the language
// codes that need the country code as well
// (like pt_BR, pt_PT, sv_SE, zh_*, en_*)
- char *need_full_langcode[] = { "pt","sv","zh","en", NULL };
- for(char **s = need_full_langcode;*s != NULL; s++)
+ const char *need_full_langcode[] = { "pt","sv","zh","en", NULL };
+ for(const char **s = need_full_langcode;*s != NULL; s++)
if(lang.find(*s) == 0)
return lang.substr(0,5);
diff --git a/apt-pkg/init.cc b/apt-pkg/init.cc
index 73b3c83de..c0384cd45 100644
--- a/apt-pkg/init.cc
+++ b/apt-pkg/init.cc
@@ -35,7 +35,7 @@ bool pkgInitConfig(Configuration &Cnf)
// General APT things
Cnf.Set("APT::Architecture", COMMON_ARCH);
Cnf.Set("APT::Build-Essential::", "build-essential");
- Cnf.Set("APT::Install-Recommends", false);
+ Cnf.Set("APT::Install-Recommends", true);
Cnf.Set("APT::Install-Suggests", false);
Cnf.Set("Dir","/");
@@ -74,6 +74,9 @@ bool pkgInitConfig(Configuration &Cnf)
Cnf.Set("Dir::Log","var/log/apt");
Cnf.Set("Dir::Log::Terminal","term.log");
+ // Translation
+ Cnf.Set("APT::Acquire::Translation", "environment");
+
bool Res = true;
// Read an alternate config file
@@ -104,9 +107,7 @@ bool pkgInitConfig(Configuration &Cnf)
bindtextdomain(textdomain(0),Cnf.FindDir("Dir::Locale").c_str());
}
#endif
- // Translation
- Cnf.Set("APT::Acquire::Translation", "environment");
-
+
return true;
}
/*}}}*/
diff --git a/apt-pkg/init.h b/apt-pkg/init.h
index 23e951eff..6d8693be9 100644
--- a/apt-pkg/init.h
+++ b/apt-pkg/init.h
@@ -18,7 +18,7 @@
// See the makefile
#define APT_PKG_MAJOR 4
-#define APT_PKG_MINOR 5
+#define APT_PKG_MINOR 6
#define APT_PKG_RELEASE 0
extern const char *pkgVersion;
diff --git a/apt-pkg/makefile b/apt-pkg/makefile
index b327dbf64..1b78c94f6 100644
--- a/apt-pkg/makefile
+++ b/apt-pkg/makefile
@@ -13,7 +13,7 @@ include ../buildlib/defaults.mak
# methods/makefile - FIXME
LIBRARY=apt-pkg
LIBEXT=$(GLIBC_VER)$(LIBSTDCPP_VER)
-MAJOR=4.5
+MAJOR=4.6
MINOR=0
SLIBS=$(PTHREADLIB) $(INTLLIBS) -lutil
APT_DOMAIN:=libapt-pkg$(MAJOR)
diff --git a/apt-pkg/pkgrecords.h b/apt-pkg/pkgrecords.h
index f3bf7b6a1..17f3b1569 100644
--- a/apt-pkg/pkgrecords.h
+++ b/apt-pkg/pkgrecords.h
@@ -66,6 +66,7 @@ class pkgRecords::Parser
virtual string ShortDesc() {return string();};
virtual string LongDesc() {return string();};
virtual string Name() {return string();};
+ virtual string Homepage() {return string();}
// The record in binary form
virtual void GetRec(const char *&Start,const char *&Stop) {Start = Stop = 0;};