|
|
@@ -1453,7 +1453,7 @@ void pkgPrioSortList(pkgCache &Cache,pkgCache::Version **List)
|
|
|
qsort(List,Count,sizeof(*List),PrioComp);
|
|
|
}
|
|
|
/*}}}*/
|
|
|
-// ListUpdate - update the cache files /*{{{*/
|
|
|
+// ListUpdate - construct Fetcher and update the cache files /*{{{*/
|
|
|
// ---------------------------------------------------------------------
|
|
|
/* This is a simple wrapper to update the cache. it will fetch stuff
|
|
|
* from the network (or any other sources defined in sources.list)
|
|
|
@@ -1462,7 +1462,6 @@ bool ListUpdate(pkgAcquireStatus &Stat,
|
|
|
pkgSourceList &List,
|
|
|
int PulseInterval)
|
|
|
{
|
|
|
- pkgAcquire::RunResult res;
|
|
|
pkgAcquire Fetcher;
|
|
|
if (Fetcher.Setup(&Stat, _config->FindDir("Dir::State::Lists")) == false)
|
|
|
return false;
|
|
|
@@ -1471,11 +1470,24 @@ bool ListUpdate(pkgAcquireStatus &Stat,
|
|
|
if (List.GetIndexes(&Fetcher) == false)
|
|
|
return false;
|
|
|
|
|
|
+ return AcquireUpdate(Fetcher, PulseInterval, true);
|
|
|
+}
|
|
|
+ /*}}}*/
|
|
|
+// AcquireUpdate - take Fetcher and update the cache files /*{{{*/
|
|
|
+// ---------------------------------------------------------------------
|
|
|
+/* This is a simple wrapper to update the cache with a provided acquire
|
|
|
+ * If you only need control over Status and the used SourcesList use
|
|
|
+ * ListUpdate method instead.
|
|
|
+ */
|
|
|
+bool AcquireUpdate(pkgAcquire &Fetcher, int const PulseInterval,
|
|
|
+ bool const RunUpdateScripts, bool const ListCleanup)
|
|
|
+{
|
|
|
// Run scripts
|
|
|
- RunScripts("APT::Update::Pre-Invoke");
|
|
|
-
|
|
|
- // check arguments
|
|
|
- if(PulseInterval>0)
|
|
|
+ if (RunUpdateScripts == true)
|
|
|
+ RunScripts("APT::Update::Pre-Invoke");
|
|
|
+
|
|
|
+ pkgAcquire::RunResult res;
|
|
|
+ if(PulseInterval > 0)
|
|
|
res = Fetcher.Run(PulseInterval);
|
|
|
else
|
|
|
res = Fetcher.Run();
|
|
|
@@ -1512,7 +1524,7 @@ bool ListUpdate(pkgAcquireStatus &Stat,
|
|
|
// Clean out any old list files
|
|
|
// Keep "APT::Get::List-Cleanup" name for compatibility, but
|
|
|
// this is really a global option for the APT library now
|
|
|
- if (!TransientNetworkFailure && !Failed &&
|
|
|
+ if (!TransientNetworkFailure && !Failed && ListCleanup == true &&
|
|
|
(_config->FindB("APT::Get::List-Cleanup",true) == true &&
|
|
|
_config->FindB("APT::List-Cleanup",true) == true))
|
|
|
{
|
|
|
@@ -1529,11 +1541,14 @@ bool ListUpdate(pkgAcquireStatus &Stat,
|
|
|
|
|
|
|
|
|
// Run the success scripts if all was fine
|
|
|
- if(!TransientNetworkFailure && !Failed)
|
|
|
- RunScripts("APT::Update::Post-Invoke-Success");
|
|
|
+ if (RunUpdateScripts == true)
|
|
|
+ {
|
|
|
+ if(!TransientNetworkFailure && !Failed)
|
|
|
+ RunScripts("APT::Update::Post-Invoke-Success");
|
|
|
|
|
|
- // Run the other scripts
|
|
|
- RunScripts("APT::Update::Post-Invoke");
|
|
|
+ // Run the other scripts
|
|
|
+ RunScripts("APT::Update::Post-Invoke");
|
|
|
+ }
|
|
|
return true;
|
|
|
}
|
|
|
/*}}}*/
|