[Blends-commit] [Git][blends-team/blends][experimental] Restrict UDD query to "main" component

Ole Streicher gitlab at salsa.debian.org
Tue Apr 10 19:33:58 UTC 2018


Ole Streicher pushed to branch experimental at Debian Blends Team / blends


Commits:
b2bd2dff by Ole Streicher at 2018-04-10T21:33:51+02:00
Restrict UDD query to "main" component

- - - - -


2 changed files:

- blends.py
- devtools/blend-gen-control


Changes:

=====================================
blends.py
=====================================
--- a/blends.py
+++ b/blends.py
@@ -747,7 +747,7 @@ def aptcache(release=None, srcdirs=['/etc/blends']):
     return cache
 
 
-def uddcache(release, packages, **db_args):
+def uddcache(packages, release, components=['main'], **db_args):
     '''Create a ``dict`` from UDD that is roughly modelled after ``apt.Cache``.
 
     The ``dict`` just resolves the version number and archs for the packages.
@@ -764,6 +764,8 @@ def uddcache(release, packages, **db_args):
 
     pkgtuple = tuple(set(p.name for p in packages))
 
+    componenttuple = tuple(components)
+
     Package = collections.namedtuple('Package',
                                      ('name', 'versions',))
     Version = collections.namedtuple('Version',
@@ -776,11 +778,13 @@ def uddcache(release, packages, **db_args):
               FROM packages, releases
               WHERE packages.release=releases.release
                     AND (releases.release=%s  OR releases.role=%s)
-                    AND (packages.package IN %s OR packages.provides in %s);'''
+                    AND (packages.package IN %s OR packages.provides in %s)
+                    AND packages.component IN %s;'''
 
     with psycopg2.connect(**db_args) as conn:
         cursor = conn.cursor()
-        cursor.execute(stmt, (release, release, pkgtuple, pkgtuple))
+        cursor.execute(stmt, (release, release, pkgtuple, pkgtuple,
+                              componenttuple))
 
         cache = dict()
         for package, provides, arch, version in cursor:


=====================================
devtools/blend-gen-control
=====================================
--- a/devtools/blend-gen-control
+++ b/devtools/blend-gen-control
@@ -86,7 +86,7 @@ for task in blend.tasks[:]:
         blend.tasks.remove(task)
 
 if args.udd:
-    blend += uddcache(args.release, blend.all, host=args.udd_host,
+    blend += uddcache(blend.all, args.release, host=args.udd_host,
                       user=args.udd_user, password=args.udd_password,
                       database=args.udd_database)
 else:



View it on GitLab: https://salsa.debian.org/blends-team/blends/commit/b2bd2dff3896bb9940f8aa2c88addbfbbf459b9c

---
View it on GitLab: https://salsa.debian.org/blends-team/blends/commit/b2bd2dff3896bb9940f8aa2c88addbfbbf459b9c
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/blends-commit/attachments/20180410/30d4394b/attachment-0001.html>


More information about the Blends-commit mailing list