[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [GSoC] Rewriting tasks.py to exclusively use UDD


I had rewritten GetTasksDependencies() such that:

# Get the package_name, license, dependency of the official dependencies of the task
query 1 = "SELECT DISTINCT b.package, b.license, b.dependency \
             FROM blends_dependencies b JOIN packages p ON p.package=b.package \
             WHERE b.blend='%s' AND b.task='%s'" % (self.blendname, self.task)

# Get the package_name, license, dependency of the prospective dependencies of the task
query 2 = "SELECT DISTINCT bp.package, bp.license, b.dependency \
               FROM blends_prospectivepackages bp JOIN blends_dependencies b ON b.blend=bp.blend \
               WHERE bp.blend='%s' and b.task='%s'" % (self.blendname, self.task)

The above queries were executed and a list 'alldepends' stored only the names of the dependencies from 'packages' table and 'blends_propspectivepackages' table. An object for both the above queries was created:

dep = DependantPackage(self.blendname, self.task)

and this object was appended to a list 'dependencies' which was used later. 'alldepends' was later sent to the query below:

query 3 = "EXECUTE query_pkgs ('%s', '%s')" % (List2PgArray(alldepends), List2PgSimilarArray(alldepends))

This query in turn uses the blends_query_packages function[1] from UDD. I had assumed that this query gets all the required information for all the dependencies in 'packages' and 'blends_prospectivepackages' table. But, it turns out that the query only gets information for dependencies that are in packages table. So, how do we proceed now ? Should we modify this query to include dependencies from blends_propspectivepackages also ? Or should we write a separate query for packages and blends_propspectivepackages ?

The code following query 3 basically uses RowDictionaries function ( which returns a list of dictionaries which specify the values by their column names) and parses this dictionary to add information to the 'dep' object. This code will mostly be same for dependencies from packages, blends_propspectivepackages and new_packages table. Keeping in mind the DRY principle, what do you suggest will be the best design choice ?


[1] https://udd.debian.org/schema/udd.html#public.function.blends-query-packages-textARRAY-textARRAY

Reply to: