While updating a SuSE 9.2 Professional system from Release 2.2 to Release
2.3 today I have run into quite a few issues with dependency order
problems.  I've looked at the code for the build.pl program, and am not
ready to dig into it yet to figure out how it's handling this.

I did think of something that might help though going back to the times
when it was important to built library archives in a particular order so
ancient C linkers could link in one pass through the library which involved
using the ``tsort'' program to create an ordered list.  I also have used
this to determine the load order necessary with databases where foreign key
relationships are critical.

First build a hash of relationships where the key is the name of each
package plus the name of a required package.  The value might be a minimum
version number, but that's not relevant at this point.  Assume
for the moment that the key is generated by something like:

        $key = $name . ' ' . $requiredname;

The build order then can be found, assuming no circular relationships,
using something like this:

sub buildorder {
        my $requiredhash = shift;
        my $tmpfile = "/tmp/tsortdata$$";
        open(TMPFILE, "> $tmpfile");
        for my $key (keys %$requiredhash) {
                print TMPFILE $key;
        }
        close(TMPFILE);
        my @returnorder = map { chomp; $_ } qx(tsort $tmpfile);
        unlink($tmpfile)
        return @returnorder;
}

Bill
--
INTERNET:   [EMAIL PROTECTED]  Bill Campbell; Celestial Software LLC
UUCP:               camco!bill  PO Box 820; 6641 E. Mercer Way
FAX:            (206) 232-9186  Mercer Island, WA 98040-0820; (206) 236-1676
URL: http://www.celestial.com/

DOS: n., A small annoying boot virus that causes random spontaneous system
     crashes, usually just before saving a massive project.  Easily cured by
     UNIX.  See also MS-DOS, IBM-DOS, DR-DOS.
______________________________________________________________________
The OpenPKG Project                                    www.openpkg.org
Developer Communication List                   openpkg-dev@openpkg.org

Reply via email to