changeOwnerAndPermissionOfFile->ChangeOwnerAndPermissionOfFile
preparePartialFile->GetPartialFileName
preparePartialFileFromURI->GetPartialFileNameFromURI
Git-Dch: ignore
std::cerr << "\t- " << hs->toStr() << std::endl;
}
/*}}}*/
std::cerr << "\t- " << hs->toStr() << std::endl;
}
/*}}}*/
-static void changeOwnerAndPermissionOfFile(char const * const requester, char const * const file, char const * const user, char const * const group, mode_t const mode)
+static void ChangeOwnerAndPermissionOfFile(char const * const requester, char const * const file, char const * const user, char const * const group, mode_t const mode)
{
// ensure the file is owned by root and has good permissions
struct passwd const * const pw = getpwnam(user);
{
// ensure the file is owned by root and has good permissions
struct passwd const * const pw = getpwnam(user);
if (chmod(file, mode) != 0)
_error->WarningE(requester, "chmod 0%o of file %s failed", mode, file);
}
if (chmod(file, mode) != 0)
_error->WarningE(requester, "chmod 0%o of file %s failed", mode, file);
}
-static std::string preparePartialFile(std::string const &file)
+static std::string GetPartialFileName(std::string const &file)
{
std::string DestFile = _config->FindDir("Dir::State::lists") + "partial/";
DestFile += file;
return DestFile;
}
{
std::string DestFile = _config->FindDir("Dir::State::lists") + "partial/";
DestFile += file;
return DestFile;
}
-static std::string preparePartialFileFromURI(std::string const &uri)
+static std::string GetPartialFileNameFromURI(std::string const &uri)
- return preparePartialFile(URItoFileName(uri));
+ return GetPartialFileName(URItoFileName(uri));
void pkgAcquire::Item::QueueURI(ItemDesc &Item)
{
if (RealFileExists(DestFile))
void pkgAcquire::Item::QueueURI(ItemDesc &Item)
{
if (RealFileExists(DestFile))
- changeOwnerAndPermissionOfFile("preparePartialFile", DestFile.c_str(), "_apt", "root", 0600);
+ ChangeOwnerAndPermissionOfFile("GetPartialFileName", DestFile.c_str(), "_apt", "root", 0600);
Owner->Enqueue(Item);
}
void pkgAcquire::Item::Dequeue()
Owner->Enqueue(Item);
}
void pkgAcquire::Item::Dequeue()
Desc.ShortDesc = Target->ShortDesc;
Desc.URI = Target->URI + ".diff/Index";
Desc.ShortDesc = Target->ShortDesc;
Desc.URI = Target->URI + ".diff/Index";
- DestFile = preparePartialFileFromURI(Desc.URI);
+ DestFile = GetPartialFileNameFromURI(Desc.URI);
if(Debug)
std::clog << "pkgAcqDiffIndex: " << Desc.URI << std::endl;
if(Debug)
std::clog << "pkgAcqDiffIndex: " << Desc.URI << std::endl;
{
// FIXME: make this use the method
PackagesFileReadyInPartial = true;
{
// FIXME: make this use the method
PackagesFileReadyInPartial = true;
- std::string const Partial = preparePartialFileFromURI(RealURI);
+ std::string const Partial = GetPartialFileNameFromURI(RealURI);
FileFd From(CurrentPackagesFile, FileFd::ReadOnly);
FileFd To(Partial, FileFd::WriteEmpty);
FileFd From(CurrentPackagesFile, FileFd::ReadOnly);
FileFd To(Partial, FileFd::WriteEmpty);
: pkgAcqBaseIndex(Owner, TransactionManager, Target, ExpectedHashes, MetaIndexParser),
available_patches(diffs), ServerSha1(ServerSha1)
{
: pkgAcqBaseIndex(Owner, TransactionManager, Target, ExpectedHashes, MetaIndexParser),
available_patches(diffs), ServerSha1(ServerSha1)
{
- DestFile = preparePartialFileFromURI(Target->URI);
+ DestFile = GetPartialFileNameFromURI(Target->URI);
Debug = _config->FindB("Debug::pkgAcquire::Diffs",false);
Debug = _config->FindB("Debug::pkgAcquire::Diffs",false);
- PartialFile = preparePartialFileFromURI(RealURI);
+ PartialFile = GetPartialFileNameFromURI(RealURI);
DestFile = _config->FindDir("Dir::State::lists");
DestFile += URItoFileName(RealURI);
DestFile = _config->FindDir("Dir::State::lists");
DestFile += URItoFileName(RealURI);
bool pkgAcqIndexDiffs::QueueNextDiff() /*{{{*/
{
// calc sha1 of the just patched file
bool pkgAcqIndexDiffs::QueueNextDiff() /*{{{*/
{
// calc sha1 of the just patched file
- std::string const FinalFile = preparePartialFileFromURI(RealURI);
+ std::string const FinalFile = GetPartialFileNameFromURI(RealURI);
if(!FileExists(FinalFile))
{
if(!FileExists(FinalFile))
{
// queue the right diff
Desc.URI = RealURI + ".diff/" + available_patches[0].file + ".gz";
Desc.Description = Description + " " + available_patches[0].file + string(".pdiff");
// queue the right diff
Desc.URI = RealURI + ".diff/" + available_patches[0].file + ".gz";
Desc.Description = Description + " " + available_patches[0].file + string(".pdiff");
- DestFile = preparePartialFileFromURI(RealURI + ".diff/" + available_patches[0].file);
+ DestFile = GetPartialFileNameFromURI(RealURI + ".diff/" + available_patches[0].file);
if(Debug)
std::clog << "pkgAcqIndexDiffs::QueueNextDiff(): " << Desc.URI << std::endl;
if(Debug)
std::clog << "pkgAcqIndexDiffs::QueueNextDiff(): " << Desc.URI << std::endl;
Item::Done(Message, Size, Hashes, Cnf);
// FIXME: verify this download too before feeding it to rred
Item::Done(Message, Size, Hashes, Cnf);
// FIXME: verify this download too before feeding it to rred
- std::string const FinalFile = preparePartialFileFromURI(RealURI);
+ std::string const FinalFile = GetPartialFileNameFromURI(RealURI);
// success in downloading a diff, enter ApplyDiff state
if(State == StateFetchDiff)
// success in downloading a diff, enter ApplyDiff state
if(State == StateFetchDiff)
Desc.URI = RealURI + ".diff/" + patch.file + ".gz";
Desc.Description = Description + " " + patch.file + string(".pdiff");
Desc.URI = RealURI + ".diff/" + patch.file + ".gz";
Desc.Description = Description + " " + patch.file + string(".pdiff");
- DestFile = preparePartialFileFromURI(RealURI + ".diff/" + patch.file);
+ DestFile = GetPartialFileNameFromURI(RealURI + ".diff/" + patch.file);
if(Debug)
std::clog << "pkgAcqIndexMergeDiffs: " << Desc.URI << std::endl;
if(Debug)
std::clog << "pkgAcqIndexMergeDiffs: " << Desc.URI << std::endl;
Item::Done(Message,Size,Hashes,Cnf);
// FIXME: verify download before feeding it to rred
Item::Done(Message,Size,Hashes,Cnf);
// FIXME: verify download before feeding it to rred
- string const FinalFile = preparePartialFileFromURI(RealURI);
+ string const FinalFile = GetPartialFileNameFromURI(RealURI);
if (State == StateFetchDiff)
{
if (State == StateFetchDiff)
{
for (std::vector<pkgAcqIndexMergeDiffs *>::const_iterator I = allPatches->begin();
I != allPatches->end(); ++I)
{
for (std::vector<pkgAcqIndexMergeDiffs *>::const_iterator I = allPatches->begin();
I != allPatches->end(); ++I)
{
- std::string const PartialFile = preparePartialFileFromURI(RealURI);
+ std::string const PartialFile = GetPartialFileNameFromURI(RealURI);
std::string patch = PartialFile + ".ed." + (*I)->patch.file + ".gz";
std::cerr << patch << std::endl;
unlink(patch.c_str());
std::string patch = PartialFile + ".ed." + (*I)->patch.file + ".gz";
std::cerr << patch << std::endl;
unlink(patch.c_str());
{
Stage = STAGE_DOWNLOAD;
{
Stage = STAGE_DOWNLOAD;
- DestFile = preparePartialFileFromURI(URI);
+ DestFile = GetPartialFileNameFromURI(URI);
CurrentCompressionExtension = CompressionExtensions.substr(0, CompressionExtensions.find(' '));
if (CurrentCompressionExtension == "uncompressed")
CurrentCompressionExtension = CompressionExtensions.substr(0, CompressionExtensions.find(' '));
if (CurrentCompressionExtension == "uncompressed")
{
// update destfile to *not* include the compression extension when doing
// a reverify (as its uncompressed on disk already)
{
// update destfile to *not* include the compression extension when doing
// a reverify (as its uncompressed on disk already)
- DestFile = preparePartialFileFromURI(RealURI);
+ DestFile = GetPartialFileNameFromURI(RealURI);
// adjust DestFile if its compressed on disk
if (_config->FindB("Acquire::GzipIndexes",false) == true)
// adjust DestFile if its compressed on disk
if (_config->FindB("Acquire::GzipIndexes",false) == true)
// If we have compressed indexes enabled, queue for hash verification
if (_config->FindB("Acquire::GzipIndexes",false))
{
// If we have compressed indexes enabled, queue for hash verification
if (_config->FindB("Acquire::GzipIndexes",false))
{
- DestFile = preparePartialFileFromURI(RealURI + '.' + CurrentCompressionExtension);
+ DestFile = GetPartialFileNameFromURI(RealURI + '.' + CurrentCompressionExtension);
EraseFileName = "";
Stage = STAGE_DECOMPRESS_AND_VERIFY;
Desc.URI = "copy:" + FileName;
EraseFileName = "";
Stage = STAGE_DECOMPRESS_AND_VERIFY;
Desc.URI = "copy:" + FileName;
(*I)->Status = pkgAcquire::Item::StatDone;
// kill files in partial
(*I)->Status = pkgAcquire::Item::StatDone;
// kill files in partial
- std::string const PartialFile = preparePartialFile(flNotDir((*I)->DestFile));
+ std::string const PartialFile = GetPartialFileName(flNotDir((*I)->DestFile));
if(FileExists(PartialFile))
Rename(PartialFile, PartialFile + ".FAILED");
}
if(FileExists(PartialFile))
Rename(PartialFile, PartialFile + ".FAILED");
}
<< (*I)->DescURI() << std::endl;
Rename((*I)->PartialFile, (*I)->DestFile);
<< (*I)->DescURI() << std::endl;
Rename((*I)->PartialFile, (*I)->DestFile);
- changeOwnerAndPermissionOfFile("CommitTransaction", (*I)->DestFile.c_str(), "root", "root", 0644);
+ ChangeOwnerAndPermissionOfFile("CommitTransaction", (*I)->DestFile.c_str(), "root", "root", 0644);
} else {
if(_config->FindB("Debug::Acquire::Transaction", false) == true)
} else {
if(_config->FindB("Debug::Acquire::Transaction", false) == true)
// this ensures that any file in the lists/ dir is removed by the
// transaction
// this ensures that any file in the lists/ dir is removed by the
// transaction
- DestFile = preparePartialFileFromURI(RealURI);
+ DestFile = GetPartialFileNameFromURI(RealURI);
TransactionManager->TransactionStageRemoval(this, DestFile);
// only allow going further if the users explicitely wants it
TransactionManager->TransactionStageRemoval(this, DestFile);
// only allow going further if the users explicitely wants it
// pkgAcqMetaIndex::Init - Delayed constructor /*{{{*/
void pkgAcqMetaIndex::Init(std::string URIDesc, std::string ShortDesc)
{
// pkgAcqMetaIndex::Init - Delayed constructor /*{{{*/
void pkgAcqMetaIndex::Init(std::string URIDesc, std::string ShortDesc)
{
- DestFile = preparePartialFileFromURI(RealURI);
+ DestFile = GetPartialFileNameFromURI(RealURI);
// Create the item
Desc.Description = URIDesc;
// Create the item
Desc.Description = URIDesc;
else
{
PartialSize = Buf.st_size;
else
{
PartialSize = Buf.st_size;
- changeOwnerAndPermissionOfFile("pkgAcqArchive::QueueNext", FinalFile.c_str(), "_apt", "root", 0600);
+ ChangeOwnerAndPermissionOfFile("pkgAcqArchive::QueueNext", FinalFile.c_str(), "_apt", "root", 0600);
string FinalFile = _config->FindDir("Dir::Cache::Archives");
FinalFile += flNotDir(StoreFilename);
Rename(DestFile,FinalFile);
string FinalFile = _config->FindDir("Dir::Cache::Archives");
FinalFile += flNotDir(StoreFilename);
Rename(DestFile,FinalFile);
- changeOwnerAndPermissionOfFile("pkgAcqArchive::Done", FinalFile.c_str(), "root", "root", 0644);
+ ChangeOwnerAndPermissionOfFile("pkgAcqArchive::Done", FinalFile.c_str(), "root", "root", 0644);
StoreFilename = DestFile = FinalFile;
Complete = true;
}
StoreFilename = DestFile = FinalFile;
Complete = true;
}
else
{
PartialSize = Buf.st_size;
else
{
PartialSize = Buf.st_size;
- changeOwnerAndPermissionOfFile("pkgAcqFile", DestFile.c_str(), "_apt", "root", 0600);
+ ChangeOwnerAndPermissionOfFile("pkgAcqFile", DestFile.c_str(), "_apt", "root", 0600);