[Blends-commit] [SCM] blends-gsoc branch, master, updated. 1ea5a2c943a6c4f3a7cd79293192e1c6145a2f23
Emmanouil Kiagias
e.kiagias at gmail.com
Thu Jul 25 09:10:17 UTC 2013
The following commit has been merged in the master branch:
commit 1ea5a2c943a6c4f3a7cd79293192e1c6145a2f23
Author: Emmanouil Kiagias <e.kiagias at gmail.com>
Date: Thu Jul 25 11:08:50 2013 +0200
fixed bug mentioned in previous commit and also made slight changes to both of the scripts. added a tester into single/, new single/ scripts now generate the same output as the existing scripts.
diff --git a/single/blend-gen-control b/single/blend-gen-control
index 143155a..d2796ee 100755
--- a/single/blend-gen-control
+++ b/single/blend-gen-control
@@ -346,12 +346,12 @@ class UDD_connector:
LEFT OUTER JOIN (
SELECT p.package, p.architecture
FROM packages p JOIN releases r ON p.release = r.release
- WHERE r.role='{0}' and architecture='{1}') pkg_{1} ON b.package = pkg_{1}.package
- """.format(release, arch.replace('-',''))
+ WHERE r.role='{0}' and architecture='{1}') pkg_{2} ON b.package = pkg_{2}.package
+ """.format(release, arch, arch.replace('-',''))
return select_clause + from_clause + where_clause
- def __get_available_virtuals(virtual_packages, release, architectures):
+ def __get_available_virtuals(self, virtual_packages, release, architectures):
formatted_architectures = [ "'{0}'".format(arch) for arch in architectures ]
available_virtual = {}
@@ -360,7 +360,7 @@ class UDD_connector:
SELECT distinct p.provides, p.architecture FROM packages p JOIN releases r ON p.release = r.release
WHERE r.role='{0}' AND p.distribution='debian' AND component='main' AND p.architecture in ( {1} )
AND provides ~ ('((\s|,)'||'({2})'||'(\s+|,|$)|^'||'({2})'||'$)')
- """.format(release, ','.join(architectures), '|'.join(virtual_packages))
+ """.format(release, ','.join(formatted_architectures), '|'.join(virtual_packages))
self.__execute_query(query)
row = self.cursor.fetchone()
diff --git a/single/sec-blend-gen-control b/single/sec-blend-gen-control
index 654b712..5d323a8 100755
--- a/single/sec-blend-gen-control
+++ b/single/sec-blend-gen-control
@@ -201,8 +201,8 @@ class UDD_connector:
LEFT OUTER JOIN (
SELECT p.package, p.architecture
FROM packages p JOIN releases r ON p.release = r.release
- WHERE r.role='{0}' and architecture='{1}') pkg_{1} ON b.alternatives = pkg_{1}.package
- """.format(release, arch.replace('-',''))
+ WHERE r.role='{0}' and architecture='{1}') pkg_{2} ON b.alternatives = pkg_{2}.package
+ """.format(release, arch, arch.replace('-',''))
return select_clause + from_clause + where_clause
@@ -210,12 +210,18 @@ class UDD_connector:
formatted_alternatives = [ "'{0}'".format(pkg) for pkg in set(alternatives) ]
formatted_architectures = [ "'{0}'".format(arch) for arch in architectures ]
+ #this query is done this way, because we want first to get the packages for debian/main and then check if they
+ #exist in a specific set of architectures and a specific release. if they are debian/main and they do not exist for
+ #any architecture then do not include them into the Suggests
query = """
- SELECT distinct p.package, p.architecture FROM packages p JOIN releases r ON p.release = r.release
- WHERE p.package in ( {0} ) AND p.architecture in ( {1} ) AND p.distribution='debian'
- AND p.component='main' AND r.role='{2}'
+ SELECT distinct p.package, pkg.architecture FROM packages p
+ LEFT OUTER JOIN
+ ( SELECT distinct mp.package, mp.architecture FROM packages mp JOIN releases r ON mp.release = r.release
+ WHERE mp.package in ( {0} ) AND mp.architecture in ( {1} ) AND mp.distribution='debian'
+ AND mp.component='main' AND r.role='{2}' ) pkg on p.package = pkg.package
+ WHERE p.package in ( {0} ) AND p.distribution='debian' AND p.component='main'
""".format(','.join(formatted_alternatives), ','.join(formatted_architectures), release)
-
+
return query
def __get_available_alternatives(self, alternatives, release, architectures):
@@ -234,13 +240,11 @@ class UDD_connector:
if not pkg_temp in available_packages:
available_packages[pkg_temp] = []
- available_packages[pkg_temp].append(arch_temp)
+ if arch_temp:
+ available_packages[pkg_temp].append(arch_temp)
row = self.cursor.fetchone()
- for key , values in available_packages.items():
- print key, values
-
return available_packages
def __build_virtuals_query(self, virtual_packages, release, architectures):
@@ -265,12 +269,12 @@ class UDD_connector:
row = self.cursor.fetchone()
while not row is None:
pkg_temp_list = [ p.strip() for p in row[0].split(',') ]
-
+ myarch = row[1]
for p in pkg_temp_list:
if not p in available_provides:
available_provides[p] = []
- available_provides[p].append(p)
+ available_provides[p].append(myarch)
row = self.cursor.fetchone()
@@ -420,10 +424,6 @@ class UDD_connector:
if virtual_packages:
available_provides = self.__get_available_virtuals(virtual_packages, release, architectures + ["all"])
- allpackages = {}
- allpackages.update(available_provides)
- allpackages.update(available_packages)
-
for task in blend_alternatives_virtuals:
alternatives_list = blend_alternatives_virtuals[task]
for alternative in alternatives_list:
@@ -434,7 +434,16 @@ class UDD_connector:
single_alt_exist = []
for tmp in single_alt_exist_temp:
- single_alt_exist.append(tmp + self.__resolve_architectures(allpackages[tmp], architectures))
+ if tmp in available_packages:
+ archs_exist = available_packages[tmp]
+ #if exists into debian/main but its not available for
+ #any architecture just skip it, do not include it in Suggests
+ if not archs_exist:
+ continue
+ elif tmp in available_provides:
+ archs_exist = available_provides[tmp]
+
+ single_alt_exist.append(tmp + self.__resolve_architectures(archs_exist, architectures))
if nodepends or taskdescription:
if single_alt_exist:
diff --git a/single/tester b/single/tester
new file mode 100755
index 0000000..979d17c
--- /dev/null
+++ b/single/tester
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+# simple script that generates control files
+# with both different single/{sec-}blend-gen-control scripts for all existing Blends'
+# and compares the generated files
+
+for blend in `psql -t udd -c 'SELECT blend FROM blends_metadata ORDER BY blend;'`
+do
+ echo "Generating control files for $blend."
+ ./blend-gen-control -S -D -c -b $blend
+ ./sec-blend-gen-control -S -D -c -b $blend
+
+ diff control control-sec
+done
--
Git repository for blends-gsoc code
More information about the Blends-commit
mailing list