537 714 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use strict;
use libdb;
use OSinfo;

sub DoUpdate($$$)
{
    my ($dbhandle, $dbname, $version) = @_;

    # Fix up special OSids
    my $query_result =
	DBQueryFatal("select osid,nextosid from os_info_versions ".
		     "where nextosid is not null and def_parentosid is null");
    while (my ($osid,$nextosid) = $query_result->fetchrow_array()) {
	next
	    if ($nextosid == 0);
	my $osinfo     = OSinfo->Lookup($osid);
	my $nextosinfo = OSinfo->Lookup($nextosid);
	if (!defined($nextosinfo)) {
	    print STDERR "Could not lookup nextosid $nextosid for $osid\n";
	    next;
	}
	$osinfo->SetParentOS($nextosinfo);
	$osinfo->SetRunsOnParent($nextosinfo);
    }
    return 0;
}

# Local Variables:
# mode:perl
# End: