source: soft/build_system/build_system/mkcd/tags/V3_3_4_1mdk/build-hdlist @ 1

Last change on this file since 1 was 1, checked in by fasma, 12 years ago

Initial Import from Mandriva's soft revision 224062 and package revision 45733

File size: 1.6 KB
Line 
1#!/usr/bin/perl -I /home/warly/files/cvs/mdk/soft/mkcd/pm
2#
3#
4
5use strict;
6use URPM;
7use URPM::Build;
8
9$ARGV[0] or print "\nUsage:
10        build-hdlist <rpms dir 1> <rpms dir 2> ... <rpms dir n>
11
12\n\n" and exit;
13my $topdir = `pwd`;
14chop $topdir;
15my $tmp = $ENV{TMPDIR} || "$topdir/tmp";
16
17my $i;
18mkcd_build_hdlist(int @ARGV, [ 0, map { $i++; { rpms => [ glob "$_/*.rpm" ], hdlist => "$_/hdlist.cz", synthesis => "$_/synthesis.hdlist.cz" } } @ARGV ], "$tmp/.bh-build_hdlist");
19
20exit;
21
22sub mkcd_build_hdlist{
23    my ($num,$hdlist,$headers_dir,$depslist,$provides,$compss) = @_;
24    my $urpm = new URPM;
25    for (1 .. $num){
26        $hdlist->[$_]{headers} = 
27           [ $urpm->parse_rpms_build_headers(
28                dir => $headers_dir, 
29                rpms => $hdlist->[$_]{rpms}) ];
30    }
31
32    $urpm->unresolved_provides_clean;
33    for (1 .. $num){
34        my $e = $hdlist->[$_];
35        my ($start, $end) = $urpm->parse_headers(dir => $headers_dir, headers => $e->{headers}, callback => $hdlist->[$_]{callback});
36        $urpm->compute_deps;
37        if ($start >= $end){
38            print "WARNING mkcd_build_hdlist: $e->{hdlist} and $e->{synthesis} are empty\n";
39            next
40        }
41        if (length $e->{hdlist}){
42            print "mkcd_build_hdlist: write $e->{hdlist}\n";
43            $urpm->build_hdlist(start => $start, end => $end, dir => $headers_dir, hdlist => $e->{hdlist}, ratio => 9);
44        }
45        if (length $e->{synthesis}){
46            print "mkcd_build_hdlist: write $e->{synthesis}\n";
47            $urpm->build_synthesis(start => $start, end => $end, synthesis => $e->{synthesis})
48        }
49    }
50    $urpm->build_base_files(depslist => $depslist, provides => $provides, compss => $compss);
51
52    return $urpm;
53}
Note: See TracBrowser for help on using the repository browser.