// this happens if we have a up-to-date indexfile
if(!FileExists(PartialFile))
PartialFile = DestFile;
-
+
+ TransactionManager->TransactionStageCopy(this, PartialFile, DestFile);
+
// this is for the "real" finish
Complete = true;
Status = StatDone;
<< DestFile << " -> " << FinalFile << std::endl;
// queue for copy by the transaction manager
- PartialFile = DestFile;
- DestFile = FinalFile;
+ TransactionManager->TransactionStageCopy(this, DestFile, FinalFile);
// ensure the ed's are gone regardless of list-cleanup
for (std::vector<pkgAcqIndexMergeDiffs *>::const_iterator I = allPatches->begin();
unlink(CompressedFile.c_str());
// Done, queue for rename on transaction finished
- PartialFile = DestFile;
- DestFile = GetFinalFilename();
+ TransactionManager->TransactionStageCopy(this, DestFile, GetFinalFilename());
return;
}
}
}
+void pkgAcqMetaBase::TransactionStageCopy(Item *I,
+ const std::string &From,
+ const std::string &To)
+{
+ I->PartialFile = From;
+ I->DestFile = To;
+}
+
+void pkgAcqMetaBase::TransactionStageRemoval(Item *I,
+ const std::string &FinalFile)
+{
+ I->PartialFile = "";
+ I->DestFile = FinalFile;
+}
+
+
/*{{{*/
bool pkgAcqMetaBase::GenerateAuthWarning(const std::string &RealURI,
const std::string &Message)
pkgAcqMetaBase(Owner, IndexTargets, MetaIndexParser,
HashStringList(), TransactionManager),
RealURI(URI), MetaIndexFile(MetaIndexFile), URIDesc(URIDesc),
- ShortDesc(ShortDesc), AuthPass(false), IMSHit(false)
+ ShortDesc(ShortDesc)
{
DestFile = _config->FindDir("Dir::State::lists") + "partial/";
DestFile += URItoFileName(URI);
string FinalFile = _config->FindDir("Dir::State::lists");
FinalFile += URItoFileName(RealURI);
- DestFile = PartialFile = FinalFile;
+ TransactionManager->TransactionStageCopy(this, FinalFile, FinalFile);
}
// queue for verify
PartialFile = _config->FindDir("Dir::State::lists") + "partial/";
PartialFile += URItoFileName(RealURI);
- DestFile = _config->FindDir("Dir::State::lists");
- DestFile += URItoFileName(RealURI);
+ std::string FinalFile = _config->FindDir("Dir::State::lists");
+ FinalFile += URItoFileName(RealURI);
+
+ TransactionManager->TransactionStageCopy(this, PartialFile, FinalFile);
}
// we parse the MetaIndexFile here because at this point we can
// transaction
DestFile = _config->FindDir("Dir::State::lists") + "partial/";
DestFile += URItoFileName(RealURI);
- PartialFile = "";
+ TransactionManager->TransactionStageRemoval(this, DestFile);
// FIXME: duplicated code from pkgAcqMetaIndex
if (AuthPass == true)
pkgAcqMetaBase(Owner, IndexTargets, MetaIndexParser, HashStringList(),
TransactionManager),
RealURI(URI), URIDesc(URIDesc), ShortDesc(ShortDesc),
- AuthPass(false), IMSHit(false),
MetaIndexSigURI(MetaIndexSigURI), MetaIndexSigURIDesc(MetaIndexSigURIDesc),
MetaIndexSigShortDesc(MetaIndexSigShortDesc)
{
FinalFile += URItoFileName(RealURI);
if (SigFile == DestFile)
SigFile = FinalFile;
+
// queue for copy in place
- PartialFile = DestFile;
- DestFile = FinalFile;
+ TransactionManager->TransactionStageCopy(this, DestFile, FinalFile);
}
}
/*}}}*/
}
// Done, queue for rename on transaction finished
- PartialFile = DestFile;
- DestFile = FinalFile;
+ TransactionManager->TransactionStageCopy(this, DestFile, FinalFile);
}
_error->Warning(_("The data from '%s' is not signed. Packages "
// impression (CVE-2012-0214)
string FinalFile = _config->FindDir("Dir::State::lists");
FinalFile.append(URItoFileName(RealURI));
- PartialFile = "";
- DestFile = FinalFile;
+ TransactionManager->TransactionStageRemoval(this, FinalFile);
new pkgAcqMetaIndex(Owner, TransactionManager,
MetaIndexURI, MetaIndexURIDesc, MetaIndexShortDesc,
*/
const std::vector<IndexTarget*>* IndexTargets;
+ /** \brief If \b true, the index's signature is currently being verified.
+ */
+ bool AuthPass;
+
+ // required to deal gracefully with problems caused by incorrect ims hits
+ bool IMSHit;
+
/** \brief Starts downloading the individual index files.
*
* \param verify If \b true, only indices whose expected hashsum
bool TransactionHasError() APT_PURE;
void CommitTransaction();
+ /** \brief Stage (queue) a copy action when the transaction is commited
+ */
+ void TransactionStageCopy(Item *I,
+ const std::string &From,
+ const std::string &To);
+ /** \brief Stage (queue) a removal action when the transaction is commited
+ */
+ void TransactionStageRemoval(Item *I, const std::string &FinalFile);
+
// helper for the signature warning
bool GenerateAuthWarning(const std::string &RealURI,
const std::string &Message);
HashStringList const &ExpectedHashes=HashStringList(),
pkgAcqMetaBase *TransactionManager=NULL)
: Item(Owner, ExpectedHashes, TransactionManager),
- MetaIndexParser(MetaIndexParser), IndexTargets(IndexTargets) {};
+ MetaIndexParser(MetaIndexParser), IndexTargets(IndexTargets),
+ AuthPass(false), IMSHit(false) {};
};
/** \brief An acquire item that downloads the detached signature {{{
*/
std::string RealURI;
- std::string URIDesc;
- std::string ShortDesc;
-
/** \brief The file we need to verify */
std::string MetaIndexFile;
- /** \brief If we are in fetching or download state */
- bool AuthPass;
+ /** \brief Long URI description used in the acquire system */
+ std::string URIDesc;
- /** \brief Was this file already on disk */
- bool IMSHit;
+ /** \brief Short URI description used in the acquire system */
+ std::string ShortDesc;
public:
*/
std::string SigFile;
- /** \brief If \b true, the index's signature is currently being verified.
- */
- bool AuthPass;
- // required to deal gracefully with problems caused by incorrect ims hits
- bool IMSHit;
-
/** \brief Check that the release file is a release file for the
* correct distribution.
*