/*
*/
-#ifdef __GNUG__
-#pragma implementation "apt-pkg/cdrom.h"
-#endif
#include<apt-pkg/init.h>
#include<apt-pkg/error.h>
#include<apt-pkg/cdromutl.h>
#include <dirent.h>
#include <unistd.h>
#include <stdio.h>
+#include <algorithm>
#include "indexcopy.h"
return !_error->PendingError();
}
-
+ /*}}}*/
// Score - We compute a 'score' for a path /*{{{*/
// ---------------------------------------------------------------------
/* Paths are scored based on how close they come to what I consider
return Res;
}
-
/*}}}*/
// DropBinaryArch - Dump dirs with a string like /binary-<foo>/ /*{{{*/
// ---------------------------------------------------------------------
return true;
}
-
-
+ /*}}}*/
// DropRepeats - Drop repeated files resulting from symlinks /*{{{*/
// ---------------------------------------------------------------------
/* Here we go and stat every file that we found and strip dup inodes. */
return true;
}
/*}}}*/
-
// ReduceSourceList - Takes the path list and reduces it /*{{{*/
// ---------------------------------------------------------------------
/* This takes the list of source list expressed entires and collects
return true;
}
-
-
-bool pkgCdrom::Ident(string &ident, pkgCdromStatus *log)
+ /*}}}*/
+bool pkgCdrom::Ident(string &ident, pkgCdromStatus *log) /*{{{*/
{
stringstream msg;
}
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());
}
- return true;
-}
+ // Unmount and finish
+ if (_config->FindB("APT::CDROM::NoMount",false) == false) {
+ log->Update(_("Unmounting CD-ROM...\n"), STEP_LAST);
+ UnmountCdrom(CDROM);
+ }
-bool pkgCdrom::Add(pkgCdromStatus *log)
+ return true;
+}
+ /*}}}*/
+bool pkgCdrom::Add(pkgCdromStatus *log) /*{{{*/
{
stringstream msg;
DropRepeats(TransList,"");
if(log) {
msg.str("");
- ioprintf(msg, _("Found %i package indexes, %i source indexes, "
- "%i translation indexes and %i signatures\n"),
+ ioprintf(msg, _("Found %zu package indexes, %zu source indexes, "
+ "%zu translation indexes and %zu signatures\n"),
List.size(), SourceList.size(), TransList.size(),
SigList.size());
log->Update(msg.str(), STEP_SCAN);
if (List.size() == 0 && SourceList.size() == 0)
{
- UnmountCdrom(CDROM);
+ if (_config->FindB("APT::CDROM::NoMount",false) == false)
+ UnmountCdrom(CDROM);
return _error->Error("Unable to locate any package files, perhaps this is not a Debian Disc");
}
if(log) {
msg.str("");
- ioprintf(msg, "Found label '%s'\n", Name.c_str());
+ ioprintf(msg, _("Found label '%s'\n"), Name.c_str());
log->Update(msg.str());
}
Database.Set("CD::" + ID + "::Label",Name);
{
if(!log)
{
- UnmountCdrom(CDROM);
+ if (_config->FindB("APT::CDROM::NoMount",false) == false)
+ UnmountCdrom(CDROM);
return _error->Error("No disc name found and no way to ask for it");
}
string::size_type Space = (*I).find(' ');
if (Space == string::npos)
{
- UnmountCdrom(CDROM);
+ if (_config->FindB("APT::CDROM::NoMount",false) == false)
+ UnmountCdrom(CDROM);
return _error->Error("Internal error");
}
string::size_type Space = (*I).find(' ');
if (Space == string::npos)
{
- UnmountCdrom(CDROM);
+ if (_config->FindB("APT::CDROM::NoMount",false) == false)
+ UnmountCdrom(CDROM);
return _error->Error("Internal error");
}
// Unmount and finish
if (_config->FindB("APT::CDROM::NoMount",false) == false) {
- log->Update(_("Unmounting CD-ROM..."), STEP_LAST);
+ log->Update(_("Unmounting CD-ROM...\n"), STEP_LAST);
UnmountCdrom(CDROM);
}
return true;
}
+ /*}}}*/