source: soft/build_system/build_system/mkcd/tags/V3_8_1_1mdk/mkcd @ 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: 20.8 KB
Line 
1#!/usr/bin/perl -I /home/warly/files/cvs/mdk/soft/mkcd/pm/
2#
3# Copyright (C) 2000-2003 Mandrakesoft
4#
5# Author: Florent Villard <warly@mandraesoft.com>
6#
7# This program is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation; either version 2, or (at your option)
10# any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program; if not, write to the Free Software
19# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20#
21# to prepare, create and burn iso images
22#
23
24my $VERSION = "3.8.1";
25
26use strict;
27use File::NCopy qw(copy);       
28use Mkcd::Commandline qw(parseCommandLine usage);
29use Mkcd::Tools qw(printTable getTracks du cpal checkcds cleanrpmsrate config compute_md5 include_md5 convert_size);
30use Mkcd::Group;
31use Mkcd::Package qw(check_rpmsrate packageOutOfRpmsrate getLeaves list_hdlist mkcd_build_hdlist %ARCH genDeps);
32use MDK::Common qw(all);
33use packdrake;
34
35#
36# FIXME not up to date
37#
38# config structure
39#
40# $config{name} = name for the product
41#
42# $config{list} = list data
43#   $config{list}[list number]{name} = list name
44#                             {filelist} = ( file list location 1, file list location 2, ..., file list location n )
45#
46#   $config{list}[list number]{packages}[location i] = (RPMS location i, SRPMS location i)
47#
48#   $config{list}[list number]{done}
49#                             {empty}
50#                             {auto}
51#                             {cd}
52#                             {sources}
53#
54#   $config{list}[list number]{disc} = { cd => { rep => { options }}  }
55#
56# $config{disc} = disc data
57#   $config{disc}[disc number]{size} = size in bytes
58#   $config{disc}[disc number]{serial} = serial number
59#   $config{disc}[disc number]{name} = disc number irl
60#   $config{disc}[disc number]{longname} = disc long name
61#   $config{disc}[disc number]{fastgeneric} = [ generic data 1, generic data 2, ..., generic data n]
62#
63#   $config{disc}[disc number]{function}{list}[function number] = (function name, { data })
64#
65#   $config{disc}[disc number]{function}{data}{dir}{repository identifier} = $config[2][cd number][1][function number]
66#
67#   $config{disc}[disc number]{function}{data}{'installation'} = $config[2][cd number][1][function number]  it should have only one installation by disc, anyway
68#
69#   $config{disc}[disc number]{function}{data}[2]{'advertising'} = $config[2][cd number][1][function number]
70#
71#   $config{disc}[disc number]{steps} = function to execute to build the disc
72#
73#
74# $config other values:
75#
76#    discMax = higher real disc number
77#    configfile = config file use for this session
78#    lists
79#    fast
80#    nodeps
81#    verbose
82#    print
83#    printscript
84#    nolive
85#    noiso
86#    deps
87#    nosrcfit
88#    product
89#    bugzilla
90#    builddir
91#    topdir
92#    discsize
93#    isodir
94#    filetag
95#    log
96#    mkisoopt
97#    tmp
98#
99
100#
101# Availaible functions
102#
103#   see Functions.pm
104#
105
106# old -> new schema
107#
108# config structure
109#
110# $config[0][0] -> $config{name}
111#
112# $config[1] -> $config{list}
113#   $config[1][list number][0] ->  $config{list}[list number]{filelist}
114#
115#   $config[1][list number][1][location i] -> $config{list}[list number]{packages}[location i]
116#
117#   $config[1][list number][2] -> $config{list}[list number]{done}, $config{list}[list number]{empty} $config{list}[list number]{cd}$config{list}[list number]{auto}
118#
119#   $config[1][list number][3] -> $config{list}[list number]{disc}
120#
121# $config[2] -> $config{disc}
122#   $config[2][cd number][0] -> $config{disc}[disc number]{size}, $config{disc}[disc number]{serial}, $config{disc}[disc number]{name}, $config{disc}[disc number]{longname}, $config{disc}[disc number]{fastgeneric}
123#
124#   $config[2][cd number][1][function number] -> $config{disc}[disc number]{function}{list}[function number]
125#
126#   $config[2][cd number][2]{dir}{repository identifier} -> $config{disc}[disc number]{function}{data}{dir}{repository identifier}
127#
128#   $config[2][cd number][2]{'installation'} -> $config{disc}[disc number]{function}{data}{'installation'}
129#
130#   $config[2][cd number][2]{'advertising'} -> $config{disc}[disc number]{function}{data}[2]{'advertising'}
131#
132#   $config[2][cd number][3] -> $config{disc}[disc number]{steps}
133#
134#
135# $config[3] -> $config{discMax}, $config{configfile}
136#
137#
138
139our %FUNCTIONS;
140our $functions;
141our $optimize;
142our $LOG;
143
144our $topdir = `pwd`;
145chop $topdir;
146our %config = (
147    lists => [],
148    fast => 0,
149    nodeps => 0,
150    verbose => 0,
151    print => 0,
152    printscript => 0,
153    nolive => 0,
154    noiso => 0,
155    deps => 0,
156    nosrcfit => 0,
157    nosrc => 0,
158    product => 0,
159    bugzilla => 0,
160    builddir => 0,
161    topdir => $topdir,
162    discsize => 681000000,
163    isodir => 0,
164    filetag => 0,
165    log => 0,
166    mkisoopt => "-r -J -hide-rr-moved -nobak -cache-inodes",
167    tmp => $ENV{TMPDIR} || "$topdir/tmp",
168    disc_building_tries => 3,
169    rejected_options => { 
170        no_disc => "Could not add more disc for this package",
171        no_space => "Not enough space",
172        deps => "Missing dependencies",
173        old_version => "More recent version found",
174        deps_rejected => "Some needed dependencies rejected",
175        excluded => "Explicitely excluded",
176        order_pb => "Needed dependency could not be put before",
177        sequential => "Could not add interlist dependencies in sequential mode",
178        autodeps => "not selected in rpm lists"
179    },
180    optimize_space => 1,
181    ARCH => \%ARCH
182);
183
184$config{group} = new Mkcd::Group(\%config);
185$functions = $config{group}{disc}{functions}{functions};
186my $arg = @ARGV;
187our @params;
188@params = ( 
189    #    [ "one letter option", "long name option", "number of args (-X means Žat least XŽ)", "help text", "function to call", "log info"]
190    [ "", "mkcd", 0, "<options>", "mkcd Mandrake Linux Disc maker", sub { $arg or usage('mkcd', \@params) }, "" ],
191    [ "a", "auto", [
192        ["", "auto", -1, "<repository> <extra RPMS directory 1> <extra RPMS directory 2> ... <extra RPMS directory n>", "Auto mode configuration", 
193        sub {   
194            my ($tmp, @arg) = @_;
195            $tmp->[0] ||= {};
196            push @$tmp, @arg;
197            1
198        }, "Setting auto mode arguments"],
199        ["c", "cd", 1, "<number of discs>", "Max number of discs", sub { my ($tmp, $cd) = @_; if ($cd =~ /\d+/) { $tmp->[0]{cd} = $cd } else { return 0 }; 1 }, "Setting max number of discs"],
200        ["s", "sources", [
201          [ "", "sources", 0, "<options>", "Sources mode options", 
202            sub {   my ($tmp) = @_;
203                $tmp->[0] ||= {};
204                1
205            }, "Setting source mode options" ],
206          [ "s", "separate", 0, "", "Separate binaries discs from sources discs", sub { my ($tmp) = @_; $tmp->[0]{separate} = 1 }, "Setting source mode separate option" ]
207        ], "", "Create SRPMS discs too", sub { my ($tmp, $opt) = @_; $tmp->[0]{sources} = $opt }, "Setting source mode"],
208        ["", "noisolinux", 0, "", "Do not use a isolinux boot", sub { my ($tmp) = @_; $tmp->[0]{noisolinux} = 1 }, "Setting noisolinux option"]
209], "[options] <repository> <extra RPMS directory 1> <extra RPMS directory 2> ... <extra RPMS directory n>", "Automated mode, build discs from a repository.", \&auto_mode, "Auto mode" ],
210    [ "", "addmd5", 1, "<iso file>", "Add md5sum to iso header.", sub { my $err = include_md5(pop, 1, 1); print $err }, "Adding md5 to ISO header" ],
211    [ "k", "checkmd5", 1, "<iso file>", "Checking md5sum of iso header.", sub { my $err = include_md5(pop, 0, 1); print $err }, "Checking md5 of ISO header" ],
212    [ "", "bugzilla", 0, "", "Use bugzilla as information source.", sub { $config{bugzilla} = 1 }, "Using Bugzilla" ],
213    [ "b", "builddir", 1, "<build dir>", "Where live iso image are created (default current dir).",  sub { $config{builddir} = pop @_ }, "Setting the build directory" ],
214    [ "", "buildhdlist", -1, "<rpms dir 1> <rpms dir 2> ... <rpms dir n>", "Build hdlist.cz files for given directories.", 
215    sub {
216        my $i;
217        mkcd_build_hdlist(int @_, 
218                [ 0, 
219                map { 
220                    $i++;
221                    if (/hdlist.*\.cz$/) { 
222                        { done => 1, hdlist => $_ } 
223                    } else {
224                        { rpms => [ glob "$_/*.rpm" ], hdlist => "./hdlist$i.cz", synthesis => "./synthesis.hdlist$i.cz" } 
225                    }
226                } @_ ], "$config{tmp}/.build_hdlist", 'depslist.ordered', 'provides', 'compss')
227    }, "building hdlist files" ],
228    [ "", "batch", 2, "<discs list> <batch file>", "batch mode to rebuilt discs from a previous session.",  \&batchMode, "Batch mode" ],
229    [ "c", "catto", 1, "<log file>", "Log file.", sub { $config{log} = pop @_; open $LOG, ">$config{log}" or die "unable to open $config{log}\n" }, "Log file" ],
230    [ "", "checkdeps", -1, "<RPMS dir 1> <RPMS dir 2> ... <RPMS dir n>", "Check coherency of a set of directories.", \&check_deps, "Checking dependencies" ],
231    [ "", "listrpmsrate", 1, "<rpmsrate file>", "List the package in the rpmsrate file", \&packageOutOfRpmsrate, "Listing rpmsrate file" ],
232    [ "", "checkrpmsrate", -2, "<rpmsrate file> <rpms dir 1> <rpms dir 2> ... <rpms dir n>", "List the package in the rpmsrate file and not in the given repositories", \&check_rpmsrate, "Checking rpmsrate file" ],
233    [ "d", "depslist-creation", 0 , "", "rebuild the desplist.ordered file before checking the list.", sub { $config{deps}=1 }, "Depslist creation switch" ],
234    [ "", "discsize", 1 , "<disc size in bytes>", "Select a custom disc size (default $config{discsize}).", sub { $config{discsize} = convert_size(pop, $config{discsize}, $config{LOG}) }, "Custom disc size selection" ],
235    [ "f", "fast", 0 , "", "fast mode.", sub { 
236        $config{fast} = 1;
237        $config{disc_building_tries} = 1;
238        $optimize = 0;
239        $config{optimize_space} = 0
240    }, "Fast mode" ],
241    [ "", "getleaves", 1, "<depslist file>", "Getting leaves from a depslist.ordered file", \&getLeaves, "Getting leaves from a depslist.ordered" ],
242# FIXME function help should take 0 or one argument, but this is not possible with this structure
243    [ "h", "help", -1, "<path> <to> <the> <function>", "Display help, eg. mkcd -h installation fixed. Type mkcd -h config for configuration files options.", 
244    sub { 
245        my (@function) = @_; 
246        if (@function) { 
247            my $key = join '/', @function; 
248            if (ref $FUNCTIONS{$key}) {
249                usage($key, $FUNCTIONS{$key})
250            }
251        }
252        usage("mkcd", \@params);
253        }, "" ],
254    [ "", "check", -1, "<dir 1> <dir 2> ... <dir n>", "Check the hdlists, depslist and RPMS consistency.", sub { checkcds(@_) }, "Checking the hdlists, depslist and RPMs consistency" ],
255    [ "K", "checkdisc", 2, "<ISO mount point> <md5 file>", "Check the disc.", sub { check_discs(@_) }, "Checking the disc" ],
256    [ "i", "isodir", 1, "<iso dir>", "Where ISOs are built (default ./iso/product_name/).",  sub { $config{isodir} = pop @_ }, "Setting the iso directory" ],
257    [ "l", "lists", 1 , "", "lists of discs taken into account.", sub { $config{lists} = getTracks(pop @_) }, "Using given disc list" ],
258    [ "m", "make", 1, "<cds number>", "Build the discs.", \&make , "Building the discs" ],
259    [ "", "nodeps", 0, "", "Do not include automatically dependencies of packages", sub { $config{nodeps} = 1 }, "Setting nodeps flag" ],
260    [ "", "nolive", 0, "", "Do not create live image of the discs.", sub { $config{nolive} = 1 }, "Setting nolive option" ],
261    [ "", "noiso", 0, "", "Do not create iso images of the discs.", sub { $config{noiso} = 1 }, "Setting noiso option" ],
262    [ "", "nosrcfit", 0, "", "Do not stop if sources discs are full", sub { $config{nosrcfit} = 1 }, "Setting nosrcfit option" ],
263    [ "", "nosrc", 0, "", "Do not include sources", sub { $config{nosrc} = 1 }, "Setting nosrc option" ],
264    [ "", "oem", -1, "<root of disc 1> <root of disc 2> ... <root of disc n>", "Build a OEM installation CD based on the given disc", \&oem, "Building oem disc" ],
265    [ "p", "printscript", 1, "<script file>", "Print the script that can be use to rebuild the discs", sub { $config{printscript} = shift }, "Printing script" ],
266    [ "", "printdiscsfiles", 1, "<file>", "Print the contains of each disc", sub { $config{print} = shift }, "Printing disc contains" ],
267    [ "", "pl", -1, "<hdlist 1> <hdlist 2> ... <hdlist n>", "Do a packdrake -l on the hdlists", sub { list_hdlist(\@_,1) }, "Printing hdlist contents" ],
268    [ "s", "spec", 1, "<config file>", "Configuration file", sub { config(shift, \%config,$functions) } , "Loading configuration file" ],
269    [ "t", "topdir", 1, "<top dir>", "Where files are created (default current dir).",  sub { $config{topdir} = pop @_; $config{tmp} = $ENV{TMPDIR} || "$config{$topdir}/tmp" }, "Setting the top directory" ],
270    [ "", "update-rpmsrate", -2, "<rpmsrate> <rpms directory 1> <rpms directory 2> ... <rpms directory n>", "Add major to libraries in rpmsrate", 
271        sub { 
272            my %rpm;
273            my $rpmsrate = shift @_;
274            foreach my $d (@_) { $rpm{$d} = [ map { s,$d/?(.*)\.rpm$,$1,; $_ } glob "$d/*.rpm" ] };
275            cleanrpmsrate($rpmsrate, 0, 0, \%rpm)
276        }, "Adding major to libraries in rpmsrate" ],
277    [ "", "verbose", 1 , "<log level>", "Print more messages (the higher the more, 5 is the higher)", sub { $config{verbose} = shift; 1 }, "Setting the verbose flag" ],
278    [ "v", "version", 0, "", "Print program version", 
279        sub {
280            print_fh($config{LOG}, "\nmkcd version $VERSION\n");
281            1 }, "" ],
282    [ "", "disc_building_tries", 1 , "<maximum number of iteration to build correct ISO size>", "Set the number of iterations when trying to adjust ISO size", sub { $config{disc_building_tries} = shift; $optimize = 1 }, "Setting the disc_building_tries value" ],
283    [ "", "use_optimize_space", 1 , "<number of disc building tries>", "Use optimize_space algorythm",
284    sub {
285        my $t = shift;
286        $config{disc_building_tries} = $t;
287        $optimize = 1;
288        $config{optimize_space} = $t
289        }, "Setting the disc_building_tries value" ],
290    [ "P", "Publisher", 1 , "<publisher name>", "Set the publisher name for ISO header publisher_id (128 char max)", sub { $config{Publisher} = substr shift, 0, 128 }, "Setting the publisher ID flag" ],
291#    [ "", "test", 0 , "", "Set the publisher name for ISO header publisher_id (128 char max)", sub { print "ARCH ", keys %{$config{ARCH}} , "\n\n" }, "Setting the publisher ID flag"],
292);
293
294# FIXME this permit to have specific help
295foreach (@params) {
296    $FUNCTIONS{$_->[1]} = ref($_->[2]) ? $_->[2] : [ $_ ]
297}
298
299$FUNCTIONS{mkcd} = \@params;
300foreach my $k (keys %$functions) {
301    $FUNCTIONS{$k} = $functions->{$k};
302    foreach (@{$functions->{$k}}) {
303        $FUNCTIONS{"$k/$_->[1]"} = ref($_->[2]) ? $_->[2] : [ $_ ]
304    }
305    push @{$FUNCTIONS{config}} , $functions->{$k}[0]
306}
307
308open($LOG, ">&STDERR");
309$config{LOG} = $LOG;
310
311my $todo = parseCommandLine("mkcd", \@ARGV, \@params);
312@ARGV and usage("mkcd", \@params, "@ARGV, too many arguments");
313foreach my $t (@$todo)  {
314    print $LOG "mkcd: $t->[2]\n";
315    &{$t->[0]}(@{$t->[1]}) or print $LOG "ERROR: $t->[2]\n";
316}
317
318# FIXME only to make perl_checker happy
319sub print_fh {
320    my ($fh, $text) = @_;
321    print $fh $text
322}
323
324sub batchMode {
325    my ($cds, $file) = @_;
326    config($file, \%config,$functions);
327    my ($discsFiles, $cd) = readBatchFile($file);
328    (my $lists,$cds) = getDiscsList($cds);
329    my @mkisos;
330    my @size;
331    Mkcd::Disc::makeDiscs(0,$lists,$cds, \@size, \@mkisos,$discsFiles);
332    Mkcd::Disc::makeDiscs(1,$lists,$cds, \@size, \@mkisos,$discsFiles,$cd);
333}
334
335sub getDiscsList {
336    my ($cds) = @_;
337    $cds = getTracks($cds);
338    print $LOG "getDiscList: discs @$cds\n";
339    my %list;
340    $cds = [grep { if (ref $config{disc}[$_]) { $list{$_} = 2; push @{$config{lists}}, $_; 1 } else { print $LOG "WARNING: disc $_ not defined\n"; 0 } } @$cds];
341    $config{lists} ||= $cds;
342    $config{lists} = [ grep { $list{$_} or ref $config{disc}[$_] and $list{$_} = 1 or print $LOG "WARNING: disc $_ not defined\n" and 0 } @{$config{lists}}];
343    foreach (@{$config{virtual_disc}}) {
344        $list{$_} = 1;
345        push @{$config{lists}}, $_
346    }
347    return \%list,$cds
348}
349
350sub auto_mode {
351    my ($opt, $repository, @rpms) = @_;
352    $config{nolive} = 1;
353    $config{nosrcfit} = 1;
354    $config{deps} = 1;
355    if (!$optimize) {
356        $config{disc_building_tries} = 1;
357        $config{optimize_space} = 0;
358    }
359    -d "$repository/Mandrake" or print "ERROR: $repository/Mandrake does not exist\n" and return 0;
360    my $dir = "$repository/Mandrake";
361    local *DIR; opendir DIR, $dir;
362    foreach (readdir DIR) {
363        -d "$dir/$_" or next;
364        m/RPMS(\d*)$/ or next;
365        print $LOG "auto_mode: adding $dir/$_\n";
366        unshift @rpms, "$dir/$_"
367    }
368    my ($name, $tag);
369    if (-f "$repository/VERSION") {
370        open my $A, "$repository/VERSION";
371        local $_;
372        <$A> and /^Mandrake Linux (.*) \d{8} \d{2}:\d{2}$/ and ($name,$tag) = split ' ', $1;
373        close $A
374    }
375    $name ||= "Cooker-download";
376    $config{name} = $name;
377    foreach (keys %$opt) { $config{list}[1]{$_} = $opt->{$_} }
378    $config{list}[1]{auto} = 1;
379    if (-d "$repository/Mandrake/base") {
380        opendir my $basedir, "$repository/Mandrake/base";
381        foreach my $file (readdir $basedir) {
382            $file =~ /^pubkey/ or next;
383            push @{$config{list}[1]{keyfiles}}, "$repository/Mandrake/base/$file"
384        }
385        closedir $basedir
386    }
387    foreach (keys %{$config{list}[1]}) { print $LOG "auto_mode: list options $_ -> $config{list}[1]{$_}\n" }
388    foreach (@rpms) {
389        #       $size += du($_);
390        push @{$config{list}[1]{packages}}, { rpm => [ $_ ], srpm => \@rpms }
391    }
392    my %cd = (1 => 2);
393    my @cd = 1;
394    #print $LOG "Total RPMS $size\n";
395    $config{disc}[1]{size} = $config{discsize};
396    $config{disc}[1]{serial} = "${name}-disc1";
397    $config{disc}[1]{name} = 1;
398    $config{disc}[1]{longname} = "MandrakeLinux $name";
399    $config{disc}[1]{appname} = "MandrakeLinux $name disc 1";
400    $config{disc}[1]{label} = substr "MandrakeLinux-$name-1.i586", 0, 32;
401    my $idx = 1;
402    my %idx;
403    &{$functions->{dir}[0][5]}(1,$idx, "rpms", "Mandrake/RPMS");
404    $idx++;
405    &{$functions->{generic}[0][5]}(1,$idx, "rpms",1);
406    &{$functions->{generic}[2][5]}(1,$idx);
407    $idx++;
408    $idx{installation} = $idx;
409    &{$functions->{installation}[0][5]}(1,$idx);
410    &{$functions->{installation}[5][5]}(1,$idx, $repository);
411    &{$functions->{installation}[10][5]}(1,$idx, $tag);
412    &{$functions->{installation}[14][5]}(1,$idx);
413    &{$functions->{installation}[18][5]}(1,$idx, "1/rpms");
414    $idx++;
415    &{$functions->{boot}[0][5]}(1,$idx);
416    if (-w "$repository/isolinux/isolinux.bin" && !$opt->{noisolinux}) {
417        &{$functions->{boot}[1][5]}(1,$idx, { isolinux => 1 }, "isolinux");
418        &{$functions->{boot}[2][5]}(1,$idx, { bootimg => 1 }, "isolinux/isolinux.bin");
419        &{$functions->{boot}[5][5]}(1,$idx, "$repository/isolinux");
420        $idx++;
421        &{$functions->{cp}[0][5]}(1,$idx, "$repository/images", "images/");
422    } else {
423        &{$functions->{boot}[2][5]}(1,$idx, { bootimg => 1, dir => "Boot" }, "images/cdrom.img");
424        &{$functions->{boot}[4][5]}(1,$idx, "$repository/images");
425    }
426    if ($opt->{sources}) {
427        $config{nosrcfit} = 0;
428        if ($opt->{sources}{separate}) {
429            $config{disc}[2]{size} = $config{discsize};
430            $config{disc}[2]{serial} = "${name}-2-src";
431            $config{disc}[2]{name} = 2;
432            $config{disc}[2]{longname} = "MandrakeLinux $name sources";
433            $config{disc}[1]{appname} = "MandrakeLinux $name sources disc 2";
434            push @cd,2;
435            $cd{2} = 2;
436            &{$functions->{dir}[0][5]}(2,1, "srpms", "Mandrake/SRPMS");
437            &{$functions->{generic}[0][5]}(2,2, "srpms",1);
438            &{$functions->{generic}[1][5]}(2,2, { source => 1 });
439            &{$functions->{installation}[17][5]}(1, $idx{installation}, "2/srpms")
440        } else {
441            $idx++;
442            &{$functions->{dir}[0][5]}(1,$idx, "srpms", "Mandrake/SRPMS");
443            $idx++;
444            &{$functions->{generic}[0][5]}(1,$idx, "srpms",1);
445            &{$functions->{generic}[1][5]}(1,$idx, { source => 1 });
446            &{$functions->{installation}[17][5]}(1, $idx{installation}, "1/srpms")
447        }
448    } else {
449        &{$functions->{installation}[6][5]}(1,$idx)
450    }
451    printTable(\%config);
452    $config{group}->makeWithGroups(\%cd, \@cd);
453    1   
454}
455
456sub make {
457    my ($cds) = @_;
458    $config{group}->makeWithGroups(getDiscsList($cds));
459    1
460}               
461
462sub oem {
463    my (@cds) = @_;
464}
465
466sub check_discs {
467    my ($mntpt, $mdfile) = @_;
468    local *A; open A, $mdfile;
469    my %ignore;
470    my $sum;
471    local $_;
472    while (<A>) {
473        chomp;
474        last if ($sum) = /^(.*) - /;
475        my $t = "/$_";
476        $t =~ s,//+,/,g;
477        $ignore{$t} = 1
478    }
479    close A;
480    my $hexdigest = compute_md5([[ "/", $mntpt ]], \%ignore);
481    if ($hexdigest eq $sum) {
482        print "\nOK ($hexdigest)\n"
483    } else {
484        print "\nFAILED (computed $hexdigest <> expected $sum)\n";
485        return 0
486    }
487    1
488}
489
490sub check_deps {
491    my (@rep) = @_;
492    my %group;
493    my $tmpdir = "$config{tmp}/mkcd_check_deps";
494    -d $tmpdir or mkdir $tmpdir or die "FATAL: could not create $tmpdir";
495    foreach (@rep) { push @{$group{rep_pkg}{$_}}, grep { s/\.rpm$// } all $_  }
496    $group{urpm} = genDeps($tmpdir, $group{rep_pkg}, 0, $config{verbose}, $config{tmp});
497    $group{option} = {};
498    $group{rejected} = {};
499    Mkcd::List::reverseDepslist({}, \%group, {});
500    foreach my $rpm (sort keys %{$group{rejected}}) {
501        print "$rpm ", join (' ', map { $_->[1] } @{$group{rejected}{$rpm}}), "\n"
502    }
503}
504
Note: See TracBrowser for help on using the repository browser.