Subversion Repositories DevTools

Rev

Rev 7320 | Rev 7322 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7320 Rev 7321
Line 1576... Line 1576...
1576
#
1576
#
1577
sub writeBuildData
1577
sub writeBuildData
1578
{
1578
{
1579
    my (@cmd_opts ) = @_;
1579
    my (@cmd_opts ) = @_;
1580
    my $opt_outfile;
1580
    my $opt_outfile;
-
 
1581
    my $opt_fullData;
1581
 
1582
 
1582
    Getopt::Long::Configure('pass_through');
1583
    Getopt::Long::Configure('pass_through');
1583
    getOptionsFromArray ( \@cmd_opts,
1584
    getOptionsFromArray ( \@cmd_opts,
1584
                          'outfile=s'   => \$opt_outfile,
1585
                          'outfile=s'   => \$opt_outfile,
-
 
1586
                          'fullData!'   => \$opt_fullData,
1585
                          ) || Error ("Invalid command line" );
1587
                          ) || Error ("Invalid command line" );
1586
    SubCommandHelp( $opt_help, 'Write Build Data') if ($opt_help  );
1588
    SubCommandHelp( $opt_help, 'Write Build Data') if ($opt_help  );
1587
 
1589
 
1588
    #
1590
    #
1589
    #   Calculate sandbox info
1591
    #   Calculate sandbox info
Line 1603... Line 1605...
1603
    my %BuildData;
1605
    my %BuildData;
1604
    my @BuildPlan = ();
1606
    my @BuildPlan = ();
1605
    my @BuildEntry;
1607
    my @BuildEntry;
1606
    my @PkgData;
1608
    my @PkgData;
1607
 
1609
 
-
 
1610
    #
-
 
1611
    #   Generate data on all known package
-
 
1612
    #
1608
    foreach my $fe ( @build_order ) {
1613
    foreach my $fe ( @build_order ) {
1609
        my $data;
1614
        my $data;
1610
        $data->{name} = $fe->{dname};
1615
        $data->{name} = $fe->{dname};
1611
        $data->{signature} = $fe->{signature};
1616
        $data->{signature} = $fe->{signature};
1612
        $data->{error} = $fe->{buildError} ? 1 : 0;
1617
        $data->{error} = $fe->{buildError} ? 1 : 0;
1613
        $data->{excluded} = $fe->{buildExclude} ? 1 : 0;
1618
        $data->{excluded} = $fe->{buildExclude} ? 1 : 0;
1614
        $data->{prebuilt} = $fe->{si} eq 1? 1 : 0;
1619
        $data->{prebuilt} = $fe->{si} eq 1? 1 : 0;
-
 
1620
        if ($opt_fullData)
-
 
1621
        {
-
 
1622
            foreach my $idep ( keys %{$fe->{'ideps'}} ) {
-
 
1623
                push @{$data->{dependencies}}, $fe->{'ideps'}{$idep};
-
 
1624
            }
-
 
1625
        }
1615
        push @PkgData, $data;
1626
        push @PkgData, $data;
1616
    }
1627
    }
1617
 
1628
 
-
 
1629
    #
-
 
1630
    #   Generate the build plan and locate the next package to build
1618
 
1631
    #
1619
    foreach my $fe ( @build_order ) {
1632
    foreach my $fe ( @build_order ) {
1620
        next if $fe->{buildError};
1633
        next if $fe->{buildError};
1621
        next if $fe->{buildExclude};
1634
        next if $fe->{buildExclude};
1622
        next if $fe->{buildSkip};
1635
        next if $fe->{buildSkip};
1623
        next unless $fe->{buildActive};
1636
        next unless $fe->{buildActive};
1624
        next if $fe->{si} eq 1;
1637
        next if $fe->{si} eq 1;
1625
 
1638
 
1626
        push @BuildPlan, $fe->{fname};
1639
        push @BuildPlan, $fe->{dname};
1627
        push @BuildEntry, $fe;
1640
        push @BuildEntry, $fe;
1628
    }
1641
    }
1629
 
1642
 
1630
    push @{$BuildData{BuildPlan}}, @BuildPlan;
1643
    push @{$BuildData{BuildPlan}}, @BuildPlan;
1631
 
1644
 
Line 1650... Line 1663...
1650
            $pkgData->{signature} = "MSG: Cannot create";
1663
            $pkgData->{signature} = "MSG: Cannot create";
1651
            $pkgData->{generic} = 0;
1664
            $pkgData->{generic} = 0;
1652
        }
1665
        }
1653
        else
1666
        else
1654
        {
1667
        {
1655
            $pkgData->{error} = 1;
1668
            $pkgData->{error} = 0;
1656
            $pkgData->{signature} = $BuildPkg->{signature};
1669
            $pkgData->{signature} = $BuildPkg->{signature};
1657
 
1670
 
1658
            #
1671
            #
1659
            #   Determine if the package is 'GENERIC'
1672
            #   Determine if the package is 'GENERIC'
1660
            #   Read in the build.cfg file
1673
            #   Read in the build.cfg file
1661
            #
1674
            #
1662
            my $pkgInterface = getpkgInterface($BuildPkg);
1675
            my $pkgInterface = getpkgInterface($BuildPkg);
1663
            ReadBuildConfig( $pkgInterface, '', '--NoError' );
1676
            ReadBuildConfig( $pkgInterface, '', '--NoError' );
1664
            $pkgData->{generic} = ReadBuildConfig::isGenericBuild();
1677
            $pkgData->{generic} = ReadBuildConfig::isGenericBuild();
1665
        }
1678
        }
-
 
1679
 
-
 
1680
        #
-
 
1681
        #   Add dependency information
-
 
1682
        #
-
 
1683
        foreach my $idep ( keys %{$BuildPkg->{'ideps'}} )
-
 
1684
        {
-
 
1685
            $pkgData->{dependencies}{$BuildPkg->{'ideps'}{$idep}} = $packages{$idep}->{signature};
-
 
1686
        }
1666
    }
1687
    }
1667
 
1688
 
1668
    $BuildData{BuildPkgData} = $pkgData;
1689
    $BuildData{BuildPkgData} = $pkgData;
1669
    $BuildData{PkgData} = \@PkgData;
1690
    $BuildData{PkgData} = \@PkgData;
1670
 
1691
 
1671
#DebugDumpData("data", $BuildPkg);
1692
#DebugDumpData("data", $BuildPkg);
1672
 
1693
 
1673
    if ($opt_outfile) {
1694
    if ($opt_outfile) {
1674
        FileCreate($opt_outfile, to_json( \%BuildData, { ascii => 1, pretty => 1 }));
1695
        FileCreate($opt_outfile, to_json( \%BuildData, { ascii => 1, pretty => 1, canonical => 1 }));
1675
    } else {
1696
    } else {
1676
        print( to_json( \%BuildData, { ascii => 1, pretty => 1 }) . "\n");
1697
        print( to_json( \%BuildData, { ascii => 1, pretty => 1, canonical => 1 }) . "\n");
1677
    }
1698
    }
1678
#    DebugDumpData("BuildData",\%BuildData);
1699
#    DebugDumpData("BuildData",\%BuildData);
-
 
1700
#DebugDumpData("Packages", \%packages);
1679
    #
1701
    #
1680
    #   All done
1702
    #   All done
1681
    #
1703
    #
1682
    exit(0);
1704
    exit(0);
1683
}
1705
}
Line 4448... Line 4470...
4448
 
4470
 
4449
 Command Options
4471
 Command Options
4450
    -help[=n]               - Command specific help, [n=1,2,3]
4472
    -help[=n]               - Command specific help, [n=1,2,3]
4451
    -man                    - Same as -help=3
4473
    -man                    - Same as -help=3
4452
    -outfile=path           - Specify the location of the output file
4474
    -outfile=path           - Specify the location of the output file
-
 
4475
    -[no]fullData           - Provide detailed information on all the package
4453
 
4476
 
4454
=head2 ARGUMENTS
4477
=head2 ARGUMENTS
4455
 
4478
 
4456
This command does not take any arguments
4479
This command does not take any arguments
4457
 
4480
 
Line 4466... Line 4489...
4466
This option will control the location of the generated file. The path includes the name of the output file.
4489
This option will control the location of the generated file. The path includes the name of the output file.
4467
 
4490
 
4468
The directory in which the file is to be created must exist. The file itself will be deleted and 
4491
The directory in which the file is to be created must exist. The file itself will be deleted and 
4469
recreated. Ideally it should not be present at the beginning of the command.
4492
recreated. Ideally it should not be present at the beginning of the command.
4470
 
4493
 
-
 
4494
=item -[no]fullData
-
 
4495
 
-
 
4496
This option controls the level of detail provided in the response. When enabled complete details 
-
 
4497
of all the packages will be provided. This should only be need when a new repository is being 
-
 
4498
processed.
-
 
4499
 
4471
=back
4500
=back
4472
 
4501
 
4473
=head2 DESCRIPTION
4502
=head2 DESCRIPTION
4474
 
4503
 
4475
The writeBuildData command is used by the automated build system to extract information from 
4504
The writeBuildData command is used by the automated build system to extract information from