I implemented your idea about handling the alternatives. The "second" blend-gen-control is under the name sec-blend-gen-control. This script uses only the blends_dependencies_alternatives table to gather the data needed to generate the control/task-description files. Both ideas (yours and mine) generate the identical results(except some cases, see later below). Your idea sounded more complex in the beginning but I have to admit that at last it provides a more solid handling of the alternatives than mine(also it uses only one table ;-) ).
The alternatives seem to be handled correctly(in both implemented ways), for example in debian-edu blend we have:
From here we have the alternatives : Depends :gecko-mediaplayer | mozilla-mplayer | kaffeine-mozilla | mozilla-plugin-vlc | totem-mozilla
Available packages: gecko-mediaplayer, mozilla-plugin-vlc, totem-mozilla are (debian,main,amd64)
Missing packages: mozilla-mplayer(ubuntu,multiverse), kaffeine-mozilla(debian, main but only available in "oldstable" release)
So the initial relation "gecko-mediaplayer | mozilla-mplayer | kaffeine-mozilla | mozilla-plugin-vlc | totem-mozilla" is correctly split as following into the control file:
For example in debian-med blend the generated control/task-description files are identical. I also tested with debian-edu(which has a lot of alternatives packages comparing to debian-med) where the task-description files are identical BUT the control files are not. In the beginning I thought it was a mistake in one of the two implementations of the code so I made an investigation. The differences in the control files are not coming from the code itself but from data differences between the blends_dependencies and the blends_dependencies_alternatives tables.
Here I have a summary of these differences using as reference the diff of debian-edu blend control files:
*note: the blend-gen-control uses the blend_dependencies table for taking of all the packages and just uses the blend_dependencies_alternatives for combining the existing single packages
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1)
#exists
select blend, task, alternatives, component, distribution, dependency from blends_dependencies_alternatives where alternatives like '%nfs-server%';
#does not exist
select blend, task, package, component, distribution, dependency from blends_dependencies where package='nfs-server';
blend-gen-contro: does not include nfs-server package in control file at all
sec-blend-gen-control: includes nfs-server in control file
2)
#exists
select blend, task, alternatives, component, distribution, dependency from blends_dependencies_alternatives where alternatives like '%dpt-raidutil%';
#does not exist
select blend, task, package, component, distribution, dependency from blends_dependencies where package='dpt-raidutil';
#suggest packages
blend-gen-control: dpt-i2o-raidutils | raidutils
sec-blend-gen-control: dpt-i2o-raidutils | raidutils | dpt-raidutil
3)
#exists
select blend, task, alternatives, component, distribution, dependency from blends_dependencies_alternatives where alternatives like '%cupsomatic-ppd%';
#does not exist
select blend, task, package, component, distribution, dependency from blends_dependencies where package='cupsomatic-ppd';
#both go from depends go to suggests because they do not exist in debian, main etc
blend-gen-control: foomatic-filters-ppds
sec-blend-gen-control : foomatic-filters-ppds | cupsomatic-ppd
4)
#exists
select blend, task, alternatives, component, distribution, dependency from blends_dependencies_alternatives where alternatives like '%flashplugin-nonfree-pulse%';
#does not exist
select blend, task, package, component, distribution, dependency from blends_dependencies where package='flashplugin-nonfree-pulse';
blend-gen-control : libflashsupport
sec-blend-gen-control : flashplugin-nonfree-pulse | libflashsupport
5)
#exists:
select blend, task, alternatives, component, distribution, dependency from blends_dependencies_alternatives where alternatives like '%keuklid | kgeo%';
#does not exist
select blend, task, package, component, distribution, dependency from blends_dependencies where package='keuklid';
select blend, task, package, component, distribution, dependency from blends_dependencies where package='kgeo';
blend-gen-control : kig
sec-blend-gen-control: kig | keuklid | kgeo
6)
#exist
select blend, task, alternatives, component, distribution, dependency from blends_dependencies_alternatives where alternatives like '%sodipodi%';
#does not exist
select blend, task, package, component, distribution, dependency from blends_dependencies where package='sodipodi';
blend-gen-control : does not include sodipodi package in control file
sec-blend-gen-control : includes sodipodi package in control file
7)
#exist
select blend, task, alternatives, component, distribution, dependency from blends_dependencies_alternatives where alternatives like '%gpsim-lded%';
#does not exist
select blend, task, package, component, distribution, dependency from blends_dependencies where package='gpsim-lded';
blend-gen-control : gpsim-led
sec-blend-gen-control : gpsim-led | gpsim-lded
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
So except from the data differences of the two tables, both implementations generated same results. Tomorrow I will make more final tests to make sure that the alternatives are handled properly. By writing the code for both ideas and see them in action I also vote for your idea (sec-blend-gen-control).