After the Mid-Term Evaluations I started working on dependency calculation module. I added a procedure mportinstall in macports.tcl file which in turn calls dep_calc procedure in macports_libsolv.tcl.

There was already a mportexec procedure which was called by port.tcl and the dependency calculation and conflict resolution was handled by mportexec. So we modified port.tcl to call mportinstall when -l (libsolv) option is passed.

The problem that we faced was port.tcl passes the portnames one by one and executes mportexec for each portname passed to ‘port install’. We didn’t want this as libsolv requires the complete list of ports to be installed. So we tweaked port.tcl where the portnames were passed one by one by iterating over the portlist (list of ports to be installed) and passed the complete list instead to mportinstall.

These portnames passed to dep_calc as associative array were then iterated over and appended to a list variable named portlist. After this, we need to use the Selection to select the appropriate solv from the pool and create list of jobs. This jobs list is then solved by the libsolv and if a conflict occurs, create a solution after conflict resolution and ask for user confirmation or create another solution.

The final stage is the transaction part which classifies the list of packages as ‘Installed’, ‘Upgraded’, ‘Erased’, ‘Downgraded’ and ‘Reinstalled’. This list was returned to mportinstall to continue with installing the ports. But this list was alphabetically sorted and we had to manually use dlist to topologically sort it so that dependencies were installed first. We achieved the desired results and it was much more efficient than the built-in engine and the conflict resolution was quite smooth. Currently we support only installation at the moment and more options to uninstall, etc. will be added soon.

There was a procedure for transaction to order the list topologically i.e., list the dependencies first that we missed out initially while working on the swig interface but that seems to be fixed by the upstream developers :).

Let the Windows be open, and feel the Freedom.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s