diff options
-rw-r--r-- | apt-pkg/contrib/cdromutl.cc | 51 | ||||
-rw-r--r-- | cmdline/apt-get.cc | 24 | ||||
-rw-r--r-- | debian/changelog | 14 | ||||
-rw-r--r-- | doc/examples/configure-index | 4 | ||||
-rw-r--r-- | methods/cdrom.cc | 23 |
5 files changed, 76 insertions, 40 deletions
diff --git a/apt-pkg/contrib/cdromutl.cc b/apt-pkg/contrib/cdromutl.cc index 0cf9697ac..6dce82fe1 100644 --- a/apt-pkg/contrib/cdromutl.cc +++ b/apt-pkg/contrib/cdromutl.cc @@ -64,35 +64,44 @@ bool UnmountCdrom(string Path) { if (IsMounted(Path) == false) return true; - - int Child = ExecFork(); - // The child - if (Child == 0) + for (int i=0;i<3;i++) { - // Make all the fds /dev/null - for (int I = 0; I != 3; I++) - dup2(open("/dev/null",O_RDWR),I); + + int Child = ExecFork(); - if (_config->Exists("Acquire::cdrom::"+Path+"::UMount") == true) + // The child + if (Child == 0) { - if (system(_config->Find("Acquire::cdrom::"+Path+"::UMount").c_str()) != 0) + // Make all the fds /dev/null + for (int I = 0; I != 3; I++) + dup2(open("/dev/null",O_RDWR),I); + + if (_config->Exists("Acquire::cdrom::"+Path+"::UMount") == true) + { + if (system(_config->Find("Acquire::cdrom::"+Path+"::UMount").c_str()) != 0) + _exit(100); + _exit(0); + } + else + { + const char *Args[10]; + Args[0] = "umount"; + Args[1] = Path.c_str(); + Args[2] = 0; + execvp(Args[0],(char **)Args); _exit(100); - _exit(0); + } } - else - { - const char *Args[10]; - Args[0] = "umount"; - Args[1] = Path.c_str(); - Args[2] = 0; - execvp(Args[0],(char **)Args); - _exit(100); - } + + // if it can not be umounted, give it a bit more time + // this can happen when auto-mount magic or fs/cdrom prober attack + if (ExecWait(Child,"umount",true) == true) + return true; + sleep(1); } - // Wait for mount - return ExecWait(Child,"umount",true); + return false; } /*}}}*/ // MountCdrom - Mount a cdrom /*{{{*/ diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index a5a48cf2f..fc15bbaa2 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -1299,31 +1299,41 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs, { pkgRecords::Parser &Parse = Recs.Lookup(VF); Src = Parse.SourcePkg(); + // no SourcePkg name, so it is the "binary" name + if (Src.empty() == true) + Src = TmpSrc; + // no Version, so we try the Version of the SourcePkg - + // and after that the version of the binary package if (VerTag.empty() == true) VerTag = Parse.SourceVer(); + if (VerTag.empty() == true) + VerTag = Ver.VerStr(); break; } } + if (Src.empty() == false) + break; } if (Src.empty() == true) { - if (VerTag.empty() == false) - _error->Warning(_("Ignore unavailable version '%s' of package '%s'"), VerTag.c_str(), TmpSrc.c_str()); - else + // Sources files have no codename information + if (VerTag.empty() == true && DefRel.empty() == false) _error->Warning(_("Ignore unavailable target release '%s' of package '%s'"), DefRel.c_str(), TmpSrc.c_str()); - VerTag.clear(); DefRel.clear(); } } - if (VerTag.empty() == true && DefRel.empty() == true) + if (Src.empty() == true) { - // if we don't have a version or default release, use the CandidateVer to find the Source + // if we don't have found a fitting package yet so we will + // choose a good candidate and proceed with that. + // Maybe we will find a source later on with the right VerTag pkgCache::VerIterator Ver = Cache.GetCandidateVer(Pkg); if (Ver.end() == false) { pkgRecords::Parser &Parse = Recs.Lookup(Ver.FileList()); Src = Parse.SourcePkg(); - VerTag = Parse.SourceVer(); + if (VerTag.empty() == true) + VerTag = Parse.SourceVer(); } } } diff --git a/debian/changelog b/debian/changelog index 9615201b2..13fd4471d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,17 @@ +apt (0.7.25ubuntu3) UNRELEASED; urgency=low + + * cmdline/apt-get.cc: + - fix apt-get source pkg=version regression (closes: #561971) + * apt-pkg/contrib/cdromutl.cc: + - fix UnmountCdrom() fails, give it a bit more time and try + the umount again + * methods/cdrom.cc: + - fixes in multi cdrom setup code + - add new "Acquire::cdrom::AutoDetect" variable that enables/disables + the dlopen of libudev for automatic cdrom detection + + -- Michael Vogt <michael.vogt@ubuntu.com> Fri, 18 Dec 2009 16:54:18 +0100 + apt (0.7.25ubuntu2) lucid; urgency=low * Change history branch so that it does not break the diff --git a/doc/examples/configure-index b/doc/examples/configure-index index 89ab3ed8a..51ca96959 100644 --- a/doc/examples/configure-index +++ b/doc/examples/configure-index @@ -253,6 +253,10 @@ Acquire cdrom { + // do auto detection of the cdrom mountpoint + AutoDetect "true"; + + // cdrom mountpoint (needs to be defined in fstab if AutoDetect is not used) mount "/cdrom"; // You need the trailing slash! diff --git a/methods/cdrom.cc b/methods/cdrom.cc index 9802eb46c..87794b052 100644 --- a/methods/cdrom.cc +++ b/methods/cdrom.cc @@ -37,8 +37,8 @@ class CDROMMethod : public pkgAcqMethod bool MountedByApt; pkgUdevCdromDevices UdevCdroms; - bool IsCorrectCD(URI want, string MountPath); - bool AutoDetectAndMount(URI); + bool IsCorrectCD(URI want, string MountPath, string& NewID); + bool AutoDetectAndMount(URI, string &NewID); virtual bool Fetch(FetchItem *Itm); string GetID(string Name); virtual void Exit(); @@ -92,7 +92,7 @@ string CDROMMethod::GetID(string Name) // CDROMMethod::AutoDetectAndMount /*{{{*/ // --------------------------------------------------------------------- /* Modifies class varaiable CDROM to the mountpoint */ -bool CDROMMethod::AutoDetectAndMount(URI Get) +bool CDROMMethod::AutoDetectAndMount(URI Get, string NewID) { vector<struct CdromDevice> v = UdevCdroms.Scan(); @@ -103,7 +103,7 @@ bool CDROMMethod::AutoDetectAndMount(URI Get) { if (Debug) clog << "Checking mounted cdrom device " << v[i].DeviceName << endl; - if (IsCorrectCD(Get, v[i].MountPath)) + if (IsCorrectCD(Get, v[i].MountPath, NewID)) { CDROM = v[i].MountPath; return true; @@ -126,7 +126,7 @@ bool CDROMMethod::AutoDetectAndMount(URI Get) { if(MountCdrom("/media/apt", v[i].DeviceName)) { - if (IsCorrectCD(Get, "/media/apt")) + if (IsCorrectCD(Get, "/media/apt", NewID)) { MountedByApt = true; CDROM = "/media/apt"; @@ -144,10 +144,8 @@ bool CDROMMethod::AutoDetectAndMount(URI Get) // CDROMMethod::IsCorrectCD /*{{{*/ // --------------------------------------------------------------------- /* */ -bool CDROMMethod::IsCorrectCD(URI want, string MountPath) +bool CDROMMethod::IsCorrectCD(URI want, string MountPath, string& NewID) { - string NewID; - for (unsigned int Version = 2; Version != 0; Version--) { if (IdentCdrom(MountPath,NewID,Version) == false) @@ -220,23 +218,24 @@ bool CDROMMethod::Fetch(FetchItem *Itm) return true; } + bool AutoDetect = _config->FindB("Acquire::cdrom::AutoDetect", true); CDROM = _config->FindDir("Acquire::cdrom::mount","/cdrom/"); if (Debug) clog << "Looking for CDROM at " << CDROM << endl; if (CDROM[0] == '.') CDROM= SafeGetCWD() + '/' + CDROM; - string NewID; + string NewID; while (CurrentID.empty() == true) { - if (CDROM == "apt-udev-auto/") - AutoDetectAndMount(Get); + if (AutoDetect) + AutoDetectAndMount(Get, NewID); if(!IsMounted(CDROM)) MountedByApt = MountCdrom(CDROM); - if (IsCorrectCD(Get, CDROM)) + if (IsCorrectCD(Get, CDROM, NewID)) break; // I suppose this should prompt somehow? |