summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2005-09-06 09:51:40 +0000
committerMichael Vogt <michael.vogt@ubuntu.com>2005-09-06 09:51:40 +0000
commit09af1a917c739e50e4e8590cc8402525b3f1f64d (patch)
treeaae9b5e6b75920dd1c43afab0da590e4de11976e /apt-pkg
parentf8ad6f9b0dbcef95d3bbbe6481d3e10e9ed684d0 (diff)
parentb8b1131a7d349db52a34a8cd6dd1872aebd50885 (diff)
* merged with michael.vogt@ubuntu.com--2005/apt--mvo--0 to be in sync with debian
Patches applied: * michael.vogt@ubuntu.com--2005/apt--bts225947--0--base-0 tag of apt@packages.debian.org/apt--main--0--patch-79 * michael.vogt@ubuntu.com--2005/apt--bts225947--0--patch-1 * merged with mainline and apt--fixes--0 * michael.vogt@ubuntu.com--2005/apt--bts225947--0--patch-2 * patch from aj (slighly modified to use auto_ptr<>) applied * michael.vogt@ubuntu.com--2005/apt--bts225947--0--patch-3 * changelog updated * michael.vogt@ubuntu.com--2005/apt--bts225947--0--patch-4 * work for arch=all packages too now * michael.vogt@ubuntu.com--2005/apt--bts225947--0--patch-5 * merged with apt--main--0 * michael.vogt@ubuntu.com--2005/apt--bts225947--0--patch-6 * fixed a incorrect po/he.po merge * michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-7 * fixed incorrect man-page example * michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-8 * changelog udpate * michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-9 * we only need to check once for xmlto * michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-10 * fix a bug in a man-page, fix a problem with overly long lines in apt-cdrom * michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-11 * merged with apt--main--0 * michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-12 * fix a incorrect error message (it always added .gz regardless what was downloaded) * michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-13 * merged with main * michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-14 * added Hashsum support for file and cdrom * michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-15 * added README.arch * michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-16 * merged with main * michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-17 * move the changelog to the right place * michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-18 * Change pkgPolicy::Pin from private to protected * michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-19 * added a default constructor for PrvIterator * michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-20 * applied otavios patch to reread the statusFile on debSystem::Initialize * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-33 * merged with matt's tree * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-34 * merged with matts tree * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-35 * build debian and ubuntu package from the same source * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-36 * added debian/patches dir * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-37 * fix the breakage from my last commit (note to self: always, _always_ run baz diff before a commit) * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-38 * removed the lsb_release build patch (nobody except me seems to like it) * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-39 * merged from main * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-40 * merged the apt--sane-handle-timeout--0 branch * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-41 * merged apt--bts225947--0 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-42 * merged with apt--main * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-43 * added patch that adds a apt-secure man-page (thanks to jfs@computer.org) * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-44 * added author credits * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-45 * added apt-ftparchive.conf example * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-46 * corrected the utf8 of javier fernandes pena * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-47 * improve the timeout handling (again) * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-48 * merged with apt--fixes--0 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-49 * README.arch updates, comment in apt-pkg/algorithm.h added, apt-pkg/cacheiterators.h order in initlist changed to remove warning * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-50 * meda-change message is send over status-fd now * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-51 * include a human readable string for the MediaChange status-fd message as well * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-52 * finalizing changelog * michael.vogt@ubuntu.com--2005/apt--sane-handle-timeout--0--base-0 tag of apt@packages.debian.org/apt--main--0--patch-87 * michael.vogt@ubuntu.com--2005/apt--sane-handle-timeout--0--patch-1 * report timeouts (from Connect) and fail if they happen in pkgAcqMetaSig * michael.vogt@ubuntu.com--2005/apt--sane-handle-timeout--0--patch-2 * merged with the fixes branch to make it build again * michael.vogt@ubuntu.com--2005/apt--sane-handle-timeout--0--patch-3 * merged with main * otavio@debian.org--2005/apt--fixes--0--patch-28 Reread status configuration, needed for clients using independent apt ...
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/acquire-item.cc25
-rw-r--r--apt-pkg/acquire-item.h3
-rw-r--r--apt-pkg/acquire-worker.cc19
-rw-r--r--apt-pkg/algorithms.h3
-rw-r--r--apt-pkg/cacheiterators.h4
-rw-r--r--apt-pkg/cdrom.cc3
-rw-r--r--apt-pkg/deb/debsystem.cc7
-rw-r--r--apt-pkg/policy.h4
8 files changed, 54 insertions, 14 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc
index 5265ef3a6..c4c0b73a9 100644
--- a/apt-pkg/acquire-item.cc
+++ b/apt-pkg/acquire-item.cc
@@ -524,20 +524,21 @@ pkgAcqIndex::pkgAcqIndex(pkgAcquire *Owner,
{
Decompression = false;
Erase = false;
-
+
DestFile = _config->FindDir("Dir::State::lists") + "partial/";
DestFile += URItoFileName(URI);
if(comprExt.empty())
{
- // autoselect
- if(FileExists("/usr/bin/bzip2"))
- Desc.URI = URI + ".bz2";
- else
- Desc.URI = URI + ".gz";
+ // autoselect the compression method
+ if(FileExists("/usr/bin/bzip2"))
+ CompressionExtension = ".bz2";
+ else
+ CompressionExtension = ".gz";
} else {
- Desc.URI = URI + comprExt;
+ CompressionExtension = comprExt;
}
+ Desc.URI = URI + CompressionExtension;
Desc.Description = URIDesc;
Desc.Owner = this;
@@ -782,6 +783,13 @@ void pkgAcqMetaSig::Failed(string Message,pkgAcquire::MethodConfig *Cnf)
string Final = _config->FindDir("Dir::State::lists") + URItoFileName(RealURI);
unlink(Final.c_str());
+ // if we get a timeout if fail
+ if(LookupTag(Message,"FailReason") == "Timeout" ||
+ LookupTag(Message,"FailReason") == "TmpResolveFailure") {
+ Item::Failed(Message,Cnf);
+ return;
+ }
+
// queue a pkgAcqMetaIndex with no sigfile
new pkgAcqMetaIndex(Owner, MetaIndexURI, MetaIndexURIDesc, MetaIndexShortDesc,
"", IndexTargets, MetaIndexParser);
@@ -1280,7 +1288,8 @@ void pkgAcqArchive::Done(string Message,unsigned long Size,string Md5Hash,
{
Status = StatError;
ErrorText = _("MD5Sum mismatch");
- Rename(DestFile,DestFile + ".FAILED");
+ if(FileExists(DestFile))
+ Rename(DestFile,DestFile + ".FAILED");
return;
}
}
diff --git a/apt-pkg/acquire-item.h b/apt-pkg/acquire-item.h
index b55ac526b..3a6e93b1a 100644
--- a/apt-pkg/acquire-item.h
+++ b/apt-pkg/acquire-item.h
@@ -156,6 +156,7 @@ class pkgAcqIndex : public pkgAcquire::Item
pkgAcquire::ItemDesc Desc;
string RealURI;
string ExpectedMD5;
+ string CompressionExtension;
public:
@@ -164,7 +165,7 @@ class pkgAcqIndex : public pkgAcquire::Item
virtual void Done(string Message,unsigned long Size,string Md5Hash,
pkgAcquire::MethodConfig *Cnf);
virtual string Custom600Headers();
- virtual string DescURI() {return RealURI + ".gz";};
+ virtual string DescURI() {return RealURI + CompressionExtension;};
pkgAcqIndex(pkgAcquire *Owner,string URI,string URIDesc,
string ShortDesct, string ExpectedMD5, string compressExt="");
diff --git a/apt-pkg/acquire-worker.cc b/apt-pkg/acquire-worker.cc
index 5cd7d6f1e..d06024178 100644
--- a/apt-pkg/acquire-worker.cc
+++ b/apt-pkg/acquire-worker.cc
@@ -25,6 +25,7 @@
#include <apti18n.h>
#include <iostream>
+#include <sstream>
#include <fstream>
#include <sys/stat.h>
@@ -367,6 +368,24 @@ bool pkgAcquire::Worker::Capabilities(string Message)
/* */
bool pkgAcquire::Worker::MediaChange(string Message)
{
+ int status_fd = _config->FindI("APT::Status-Fd",-1);
+ if(status_fd > 0)
+ {
+ string Media = LookupTag(Message,"Media");
+ string Drive = LookupTag(Message,"Drive");
+ ostringstream msg,status;
+ ioprintf(msg,_("Please insert the disc labeled: "
+ "'%s' "
+ "in the drive '%s' and press enter."),
+ Media.c_str(),Drive.c_str());
+ status << "media-change: " // message
+ << Media << ":" // media
+ << Drive << ":" // drive
+ << msg.str() // l10n message
+ << endl;
+ write(status_fd, status.str().c_str(), status.str().size());
+ }
+
if (Log == 0 || Log->MediaChange(LookupTag(Message,"Media"),
LookupTag(Message,"Drive")) == false)
{
diff --git a/apt-pkg/algorithms.h b/apt-pkg/algorithms.h
index 174a7f58d..b95218061 100644
--- a/apt-pkg/algorithms.h
+++ b/apt-pkg/algorithms.h
@@ -118,7 +118,8 @@ class pkgProblemResolver
// Try to resolve problems only by using keep
bool ResolveByKeep();
-
+
+ // Install all protected packages
void InstallProtect();
pkgProblemResolver(pkgDepCache *Cache);
diff --git a/apt-pkg/cacheiterators.h b/apt-pkg/cacheiterators.h
index 62d2695dd..c3a0d0a5a 100644
--- a/apt-pkg/cacheiterators.h
+++ b/apt-pkg/cacheiterators.h
@@ -222,7 +222,7 @@ class pkgCache::PrvIterator
void operator ++(int) {if (Prv != Owner->ProvideP) Prv = Owner->ProvideP +
(Type == PrvVer?Prv->NextPkgProv:Prv->NextProvides);};
inline void operator ++() {operator ++(0);};
- inline bool end() const {return Prv == Owner->ProvideP?true:false;};
+ inline bool end() const {return Owner == 0 || Prv == Owner->ProvideP?true:false;};
// Comparison
inline bool operator ==(const PrvIterator &B) const {return Prv == B.Prv;};
@@ -244,6 +244,8 @@ class pkgCache::PrvIterator
inline PkgIterator OwnerPkg() {return PkgIterator(*Owner,Owner->PkgP + Owner->VerP[Prv->Version].ParentPkg);};
inline unsigned long Index() const {return Prv - Owner->ProvideP;};
+ inline PrvIterator() : Prv(0), Type(PrvVer), Owner(0) {};
+
inline PrvIterator(pkgCache &Owner,Provides *Trg,Version *) :
Prv(Trg), Type(PrvVer), Owner(&Owner)
{
diff --git a/apt-pkg/cdrom.cc b/apt-pkg/cdrom.cc
index ca74aa685..c067cf1ee 100644
--- a/apt-pkg/cdrom.cc
+++ b/apt-pkg/cdrom.cc
@@ -422,6 +422,9 @@ bool pkgCdrom::WriteSourceList(string Name,vector<string> &List,bool Source)
{
F.getline(Buffer,sizeof(Buffer));
CurLine++;
+ if (F.fail() && !F.eof())
+ return _error->Error(_("Line %u too long in source list %s."),
+ CurLine,File.c_str());
_strtabexpand(Buffer,sizeof(Buffer));
_strstrip(Buffer);
diff --git a/apt-pkg/deb/debsystem.cc b/apt-pkg/deb/debsystem.cc
index 0b3a4f742..2d805ea6f 100644
--- a/apt-pkg/deb/debsystem.cc
+++ b/apt-pkg/deb/debsystem.cc
@@ -164,7 +164,12 @@ bool debSystem::Initialize(Configuration &Cnf)
Cnf.CndSet("Dir::State::userstatus","status.user"); // Defunct
Cnf.CndSet("Dir::State::status","/var/lib/dpkg/status");
Cnf.CndSet("Dir::Bin::dpkg","/usr/bin/dpkg");
-
+
+ if (StatusFile) {
+ delete StatusFile;
+ StatusFile = 0;
+ }
+
return true;
}
/*}}}*/
diff --git a/apt-pkg/policy.h b/apt-pkg/policy.h
index 15f204798..40ebd3f70 100644
--- a/apt-pkg/policy.h
+++ b/apt-pkg/policy.h
@@ -45,6 +45,8 @@ using std::vector;
class pkgPolicy : public pkgDepCache::Policy
{
+ protected:
+
struct Pin
{
pkgVersionMatch::MatchType Type;
@@ -58,8 +60,6 @@ class pkgPolicy : public pkgDepCache::Policy
string Pkg;
};
- protected:
-
Pin *Pins;
signed short *PFPriority;
vector<Pin> Defaults;