summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/thandy/ClientCLI.py12
-rw-r--r--lib/thandy/repository.py22
2 files changed, 30 insertions, 4 deletions
diff --git a/lib/thandy/ClientCLI.py b/lib/thandy/ClientCLI.py
index bcbdfc7..97951b4 100644
--- a/lib/thandy/ClientCLI.py
+++ b/lib/thandy/ClientCLI.py
@@ -120,6 +120,7 @@ def update(args):
lengths = {}
installable = {}
btMetadata = {}
+ thpTransactions = {}
logging.info("Checking for files to update.")
files, downloadingFiles = repo.getFilesToUpdate(
trackingBundles=args,
@@ -127,13 +128,14 @@ def update(args):
lengthDict=lengths,
usePackageSystem=use_packagesys,
installableDict=installable,
- btMetadataDict=btMetadata)
+ btMetadataDict=btMetadata
+ thpTransactionDict=thpTransactions)
if forceCheck:
files.add("/meta/timestamp.txt")
forceCheck = False
- if installable and not files:
+ if (thpTransactions or installable) and not files:
for p, d in installable.items():
for n, i in d.items():
if i.canInstall():
@@ -151,6 +153,12 @@ def update(args):
i = h.getInstaller()
if i != None:
i.install()
+
+ print "Bundles with all THP packages:"
+ for bundle in thpTransactions:
+ # TODO: ThpTransaction goes here!
+ print bundle
+
return
elif not files:
diff --git a/lib/thandy/repository.py b/lib/thandy/repository.py
index bc4d73b..1bc1ce4 100644
--- a/lib/thandy/repository.py
+++ b/lib/thandy/repository.py
@@ -299,12 +299,13 @@ class LocalRepository:
def getFilesToUpdate(self, now=None, trackingBundles=(), hashDict=None,
lengthDict=None, usePackageSystem=True,
- installableDict=None, btMetadataDict=None):
+ installableDict=None, btMetadataDict=None,
+ thpTransactionDict=None):
"""Return a set of relative paths for all files that we need
to fetch, and True if we're fetching actual files to install
instead of metadata. Assumes that we care about the bundles
'trackingBundles'.
- DOCDOC installableDict, hashDict, usePackageSystem
+ DOCDOC installableDict, hashDict, usePackageSystem, thpTransaction
"""
if now == None:
@@ -323,6 +324,9 @@ class LocalRepository:
if btMetadataDict == None:
btMetadataDict = {}
+ if thpTransactionDict == None:
+ thpTransactionDict = {}
+
pkgItems = None
need = set()
@@ -452,6 +456,7 @@ class LocalRepository:
# Okay. So we have some bundles. See if we have their packages.
packages = {}
+ thpbundle = False
for bfile in bundles.values():
bundle = bfile.get()
for pkginfo in bundle['packages']:
@@ -480,8 +485,20 @@ class LocalRepository:
"did not match")
# Can't use it.
continue
+
+ # We assume that if there is one thp package then all the rest
+ # are thp too. But we continue with the loop to check every
+ # package digest and signature
+ if thpBunle or pfile.get("format") == "thp":
+ thpBundle = True
+ continue
+
packages[rp] = pfile
+ if thpBundle:
+ thpTransactionDict[bundle['name']] = [bundle['packages']]
+ thpBundle = False
+
# We have the packages. If we're downloading via bittorrent, we need
# the .torrent metafiles, as well.
if thandy.bt_compat.BtCompat.shouldUseBt():
@@ -560,6 +577,7 @@ class LocalRepository:
# if that works, we can get rid of the second return
# value and just use installableDict from the caller.
if pkgItems.has_key(rp):
+ if pkgItems[rp]:
installableDict.setdefault(pkg_rp, {})[rp] = pkgItems[rp]