home *** CD-ROM | disk | FTP | other *** search
/ Chip 2003 July / Chip_2003-07_cd2.bin / misc / mkcd < prev    next >
Text File  |  2003-03-17  |  20KB  |  508 lines

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