Changeset 353 in ProjectBuilder for devel/pb/bin/pb


Ignore:
Timestamp:
Apr 5, 2008, 2:36:14 AM (16 years ago)
Author:
Bruno Cornec
Message:
  • pb_env_init does just setup env variables now. It does CMS checks and conf only if called on a CMS opration
  • systematic use of ENV VAR for PBPROJVER, PBPROJTAG, PBPACKAGER
  • new function to get package list for cms only context and the old one is simplified
  • setup2vm works also with fedora-6-i386
  • build2vm nearly works now
  • $DESTDIR/pbrc contains now aal the keys needed to be independant when building (pbroot, pbprojver, pbprojtag, pbpackager)
  • remove ntp calls for the moment (not ready)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/pb/bin/pb

    r352 r353  
    377377# Handles project name if any
    378378# And get global params
    379 if (defined $opts{'p'}) {
    380     ($filteredfiles, $supfiles, $defpkgdir, $extpkgdir)
    381     = pb_env_init($opts{'p'},$pbinit);
    382 } else {
    383     ($filteredfiles, $supfiles, $defpkgdir, $extpkgdir)
    384     = pb_env_init(undef,$pbinit);
    385 }
     379($filteredfiles, $supfiles, $defpkgdir, $extpkgdir) = pb_env_init($opts{'p'},$pbinit,$action);
    386380
    387381pb_log(0,"Project: $ENV{'PBPROJ'}\n");
    388382pb_log(0,"Action: $action\n");
    389 
    390 # Keep those project values to store them at the end each time
    391 my $pbprojtag = $ENV{'PBTAG'};
    392 my $pbprojver = $ENV{'PBVER'};
    393383
    394384# Act depending on action
     
    432422    pb_launchv("vm",$ENV{'PBV'},1);
    433423} elsif ($action =~ /^setupve$/) {
    434     my $pbscript = pb_setup_v("ve");
    435     # That buil script needs to be run as root
    436     $pbaccount = "root";
    437     pb_script2v($pbscript,"ve");
     424    pb_setup_v("ve");
    438425} elsif ($action =~ /^setupvm$/) {
    439     my $pbscript = pb_setup_v("vm");
    440     # That buil script needs to be run as root
    441     $pbaccount = "root";
    442     pb_script2v($pbscript,"vm");
     426    pb_setup_v("vm");
    443427} elsif ($action =~ /^newproj$/) {
    444428    # Nothing to do - already done in pb_env_init
     
    451435sub pb_cms2build {
    452436
    453     my $ptr = pb_get_pkg($defpkgdir,$extpkgdir);
     437    my $ptr = pb_cms_get_pkg($defpkgdir,$extpkgdir);
    454438    @pkgs = @$ptr;
    455439
     
    460444    # declare packager for filtering
    461445    my ($tmp) = pb_conf_get("pbpackager");
    462     my $pbpackager = $tmp->{$ENV{'PBPROJ'}};
     446    $ENV{'PBPACKAGER'} = $tmp->{$ENV{'PBPROJ'}};
    463447
    464448    foreach my $pbpkg (@pkgs) {
    465449        $ENV{'PBPKG'} = $pbpkg;
    466         $ENV{'PBVER'} = $pbprojver;
    467         $ENV{'PBTAG'} = $pbprojtag;
    468450        if ((defined $pkgv) && (defined $pkgv->{$pbpkg})) {
    469451            $pbver = $pkgv->{$pbpkg};
    470             $ENV{'PBVER'} = $pbver;
    471452        } else {
    472             $pbver = $ENV{'PBVER'};
     453            $pbver = $ENV{'PBPROJVER'};
    473454        }
    474455        if ((defined $pkgt) && (defined $pkgt->{$pbpkg})) {
    475456            $pbtag = $pkgt->{$pbpkg};
    476             $ENV{'PBTAG'} = $pbtag;
    477457        } else {
    478             $pbtag = $ENV{'PBTAG'};
     458            $pbtag = $ENV{'PBPROJTAG'};
    479459        }
    480460
     
    567547            if (defined $ptr) {
    568548                foreach my $f (values %bfiles,values %pkgfiles) {
    569                     pb_filter_file_pb("$ENV{'PBROOTDIR'}/$f",$ptr,"$dest/pbconf/$ddir-$dver/".basename($f),$dtype,$pbsuf,$ENV{'PBPROJ'},$pbpkg,$pbver,$pbtag,$pbrev,$pbdate,$defpkgdir,$extpkgdir,$pbpackager,$chglog);
     549                    pb_filter_file_pb("$ENV{'PBROOTDIR'}/$f",$ptr,"$dest/pbconf/$ddir-$dver/".basename($f),$dtype,$pbsuf,$ENV{'PBPROJ'},$pbpkg,$pbver,$pbtag,$pbrev,$pbdate,$defpkgdir,$extpkgdir,$ENV{'PBPACKAGER'},$chglog);
    570550                }
    571551            }
     
    589569        if (defined $filteredfiles->{$pbpkg}) {
    590570            foreach my $f (split(/,/,$filteredfiles->{$pbpkg})) {
    591                 pb_filter_file_inplace($ptr,"$dest/$f",$ENV{'PBPROJ'},$pbpkg,$pbver,$pbtag,$pbrev,$pbdate,$pbpackager);
     571                pb_filter_file_inplace($ptr,"$dest/$f",$ENV{'PBPROJ'},$pbpkg,$pbver,$pbtag,$pbrev,$pbdate,$ENV{'PBPACKAGER'});
    592572                $liste = "$f $liste";
    593573            }
     
    597577        # Prepare the dest directory for archive
    598578        if (-x "$ENV{'PBROOTDIR'}/$pbpkg/pbinit") {
    599             pb_filter_file("$ENV{'PBROOTDIR'}/$pbpkg/pbinit",$ptr,"$ENV{'PBTMP'}/pbinit",$ENV{'PBPROJ'},$pbpkg,$pbver,$pbtag,$pbrev,$pbdate,$pbpackager);
     579            pb_filter_file("$ENV{'PBROOTDIR'}/$pbpkg/pbinit",$ptr,"$ENV{'PBTMP'}/pbinit",$ENV{'PBPROJ'},$pbpkg,$pbver,$pbtag,$pbrev,$pbdate,$ENV{'PBPACKAGER'});
    600580            chmod 0755,"$ENV{'PBTMP'}/pbinit";
    601581            pb_system("cd $dest ; $ENV{'PBTMP'}/pbinit","Executing init script from $ENV{'PBROOTDIR'}/$pbpkg/pbinit");
     
    609589
    610590        # Keep track of what is generated by default
    611         open(LAST,"> $ENV{'PBDESTDIR'}/pbrc") || die "Unable to create $ENV{'PBDESTDIR'}/pbrc";
    612         #print LAST "pbroot $pbprojver-$pbprojtag = $ENV{'PBROOTDIR'}\n";
    613         # Why not use pbproj ?
     591        # We need to store the dir and info on version-tag
     592        # Base our content on the existing .pb file
     593        copy("$ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb","$ENV{'PBDESTDIR'}/pbrc");
     594        open(LAST,">> $ENV{'PBDESTDIR'}/pbrc") || die "Unable to create $ENV{'PBDESTDIR'}/pbrc";
    614595        print LAST "pbroot $ENV{'PBPROJ'} = $ENV{'PBROOTDIR'}\n";
     596        print LAST "pbprojver $ENV{'PBPROJ'} = $ENV{'PBPROJVER'}\n";
     597        print LAST "pbprojtag $ENV{'PBPROJ'} = $ENV{'PBPROJTAG'}\n";
     598        print LAST "pbpackager $ENV{'PBPROJ'} = $ENV{'PBPACKAGER'}\n";
    615599        close(LAST);
    616600
    617601        # Keep track of per package version
    618         my ($pkg) = pb_conf_read_if("$ENV{'PBDESTDIR'}/$pbprojver-$pbprojtag.pb","pbpkg");
     602        my ($pkg) = pb_conf_read_if("$ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.pb","pbpkg");
    619603        $pkg = { } if (not defined $pkg);
    620604        if ((not defined $pkg->{$pbpkg}) || ($pkg->{$pbpkg} ne "$pbver-$pbtag")) {
     
    623607
    624608        pb_log(2,"DEBUG pkg: ".Dumper($pkg)."\n");
    625         open(PKG,"> $ENV{'PBDESTDIR'}/$pbprojver-$pbprojtag.pb") || die "Unable to create $ENV{'PBDESTDIR'}/$pbprojver-$pbprojtag.pb";
     609        open(PKG,"> $ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.pb") || die "Unable to create $ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.pb";
    626610        foreach my $p (keys %$pkg) {
    627611            print PKG "pbpkg $p = $pkg->{$p}\n";
     
    635619
    636620sub pb_build2pkg {
    637 
    638     # Get list of packages to build
    639     my $ptr = pb_get_pkg($defpkgdir,$extpkgdir);
    640     @pkgs = @$ptr;
    641621
    642622    # Get the running distro to build on
     
    644624    pb_log(2,"DEBUG: distro tuple: ".join(',',($ddir, $dver, $dfam, $dtype, $pbsuf))."\n");
    645625
     626    # Get list of packages to build
    646627    # Get content saved in cms2build
    647     my ($pkg) = pb_conf_read("$ENV{'PBDESTDIR'}/$pbprojver-$pbprojtag.pb","pbpkg");
     628    my $ptr = pb_get_pkg();
     629    @pkgs = @$ptr;
     630
     631    my ($pkg) = pb_conf_read("$ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.pb","pbpkg");
    648632    $pkg = { } if (not defined $pkg);
    649 
    650     # declare packager (via env var in VM/VE
    651     my $pbpackager;
    652     if (not defined $ENV{'PBPACKAGER'}) {
    653         my ($tmp) = pb_conf_get("pbpackager");
    654         $pbpackager = $tmp->{$ENV{'PBPROJ'}};
    655     } else {
    656         $pbpackager = $ENV{'PBPACKAGER'};
    657     }
    658633
    659634    chdir "$ENV{'PBBUILDDIR'}";
     
    687662            foreach my $f (@specfile) {
    688663                if ($f =~ /\.spec$/) {
    689                     pb_system("rpmbuild --define \'packager $pbpackager\' --define \"_topdir $ENV{'PBBUILDDIR'}\" -ba $f","Building package with $f under $ENV{'PBBUILDDIR'}");
     664                    pb_system("rpmbuild --define \'packager $ENV{'PBPACKAGER'}\' --define \"_topdir $ENV{'PBBUILDDIR'}\" -ba $f","Building package with $f under $ENV{'PBBUILDDIR'}");
    690665                    last;
    691666                }
     
    766741    }
    767742    # Keep track of what is generated so that we can get them back from VMs
    768     open(KEEP,"> $ENV{'PBBUILDDIR'}/pbgen-$pbprojver-$pbprojtag") || die "Unable to create $ENV{'PBBUILDDIR'}/pbgen-$pbprojver-$pbprojtag";
     743    open(KEEP,"> $ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}") || die "Unable to create $ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}";
    769744    print KEEP "$made\n";
    770745    close(KEEP);
     
    815790    my $cmd = "";
    816791
    817     # Get list of packages to build
    818     my $ptr = pb_get_pkg($defpkgdir,$extpkgdir);
     792    my $ptr = pb_get_pkg();
    819793    @pkgs = @$ptr;
    820794
     
    827801    pb_log(2,"DEBUG: distro tuple: ".join(',',($ddir, $dver, $dfam, $dtype, $pbsuf))."\n");
    828802
     803    # Get list of packages to build
    829804    # Get content saved in cms2build
    830     my ($pkg) = pb_conf_read("$ENV{'PBDESTDIR'}/$pbprojver-$pbprojtag.pb","pbpkg");
     805    my ($pkg) = pb_conf_read("$ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.pb","pbpkg");
    831806    $pkg = { } if (not defined $pkg);
    832807
     
    848823    }
    849824    if (($cmt eq "vm") || ($cmt eq "ve")) {
    850         $src="$src $ENV{'PBDESTDIR'}/pbscript $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb $ENV{'PBDESTDIR'}/$pbprojver-$pbprojtag.pb $ENV{'PBETC'}";
     825        $src="$src $ENV{'PBDESTDIR'}/pbscript $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb $ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.pb $ENV{'PBETC'} $ENV{'PBDESTDIR'}/pbrc";
    851826    } elsif ($cmt eq "Script") {
    852827        $src="$src $ENV{'PBDESTDIR'}/pbscript";
    853828    } elsif ($cmt eq "Packages") {
    854829        # Get package list from file made during build2pkg
    855         open(KEEP,"$ENV{'PBBUILDDIR'}/pbgen-$pbprojver-$pbprojtag") || die "Unable to read $ENV{'PBBUILDDIR'}/pbgen-$pbprojver-$pbprojtag";
     830        open(KEEP,"$ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}") || die "Unable to read $ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}";
    856831        $src = <KEEP>;
    857832        chomp($src);
     
    945920    if (($cmt eq "vm") || ($cmt eq "ve")) {
    946921        # Get back info on pkg produced, compute their name and get them from the VM
    947         pb_system("$cpcmd $cp2target/pbgen-$pbprojver-$pbprojtag $ENV{'PBBUILDDIR'} 2> /dev/null","Get package names in $cp2target");
    948         open(KEEP,"$ENV{'PBBUILDDIR'}/pbgen-$pbprojver-$pbprojtag") || die "Unable to read $ENV{'PBBUILDDIR'}/pbgen-$pbprojver-$pbprojtag";
     922        pb_system("$cpcmd $cp2target/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'} $ENV{'PBBUILDDIR'} 2> /dev/null","Get package names in $cp2target");
     923        open(KEEP,"$ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}") || die "Unable to read $ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}";
    949924        my $src = <KEEP>;
    950925        chomp($src);
     
    954929        # Change pgben to make the next send2target happy
    955930        my $made = "";
    956         open(KEEP,"> $ENV{'PBBUILDDIR'}/pbgen-$pbprojver-$pbprojtag") || die "Unable to write $ENV{'PBBUILDDIR'}/pbgen-$pbprojver-$pbprojtag";
     931        open(KEEP,"> $ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}") || die "Unable to write $ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}";
    957932        foreach my $p (split(/ +/,$src)) {
    958933            my $j = basename($p);
     
    11261101# Prepare the script to be executed on the VM/VE
    11271102# in $ENV{'PBDESTDIR'}/pbscript
    1128 my ($ntp) = pb_conf_get($vtype."ntp");
    1129 my $vntp = $ntp->{$ENV{'PBPROJ'}};
     1103#my ($ntp) = pb_conf_get($vtype."ntp");
     1104#my $vntp = $ntp->{$ENV{'PBPROJ'}};
    11301105
    11311106open(SCRIPT,"> $ENV{'PBDESTDIR'}/pbscript") || die "Unable to create $ENV{'PBDESTDIR'}/pbscript";
     
    11421117$date[1]++;
    11431118my $upddate = strftime("%m%d%H%M%Y", @date);
    1144 print SCRIPT "echo Setting up date on $vntp...\n";
     1119#print SCRIPT "echo Setting up date on $vntp...\n";
    11451120# Or use ntpdate if available TBC
    11461121print SCRIPT "sudo date $upddate\n";
    1147 # This exports avoids pb_env_init to deal with PBCONF stuff
    1148 print SCRIPT "export PBCONF=/tmp\n";
    1149 print SCRIPT "export PBVER=$ENV{'PBVER'}\n";
    1150 print SCRIPT "export PBTAG=$ENV{'PBTAG'}\n";
     1122# Get list of packages to build and get some ENV vars as well
     1123my $ptr = pb_get_pkg();
     1124@pkgs = @$ptr;
     1125my $p = join(' ',@pkgs) if (@pkgs);
     1126print SCRIPT "export PBPROJVER=$ENV{'PBPROJVER'}\n";
     1127print SCRIPT "export PBPROJTAG=$ENV{'PBPROJTAG'}\n";
    11511128print SCRIPT "export PBPACKAGER=\"$ENV{'PBPACKAGER'}\"\n";
    11521129print SCRIPT "# Build\n";
    1153 # Get list of packages to build
    1154 my $ptr = pb_get_pkg($defpkgdir,$extpkgdir);
    1155 @pkgs = @$ptr;
    1156 my $p = join(' ',@pkgs) if (@pkgs);
    11571130print SCRIPT "echo Building packages on $vtype...\n";
    11581131print SCRIPT "pb -p $ENV{'PBPROJ'} build2pkg $p\n";
     
    12471220my $vtype = shift;
    12481221
     1222my ($vm,$all) = pb_get_v($vtype);
     1223
    12491224# Script generated
    12501225my $pbscript = "$ENV{'PBDESTDIR'}/setupv";
    12511226
    1252 # Name of the account to deal with for VM/VE
    1253 # Do not use the one passed potentially with -a
    1254 my ($pbaccount) = pb_conf_get($vtype."login");
    1255 
    1256 if ($vtype eq "vm") {
    1257     # Prepare the key to be used and transfered remotely
    1258     my $keyfile = pb_ssh_get(1);
     1227foreach my $v (@$vm) {
     1228    # Name of the account to deal with for VM/VE
     1229    # Do not use the one passed potentially with -a
     1230    my ($pbac) = pb_conf_get($vtype."login");
     1231
     1232    if ($vtype eq "vm") {
     1233        # Prepare the key to be used and transfered remotely
     1234        my $keyfile = pb_ssh_get(1);
     1235       
     1236        my ($vmhost,$vmport) = pb_conf_get("vmhost","vmport");
     1237        my $nport = $vmport->{$ENV{'PBPROJ'}};
     1238        $nport = "$pbport" if (defined $pbport);
    12591239   
    1260     my ($vmhost,$vmport) = pb_conf_get("vmhost","vmport");
    1261     my $nport = $vmport->{$ENV{'PBPROJ'}};
    1262     $nport = "$pbport" if (defined $pbport);
    1263 
    1264     pb_system("cat $keyfile.pub | ssh -q -p $nport -i $keyfile root\@$vmhost->{$ENV{'PBPROJ'}} \"mkdir .ssh ; chmod 700 .ssh ; cat > .ssh/authorized_keys ; chmod 600 .ssh/authorized_keys\"","Copying local keys to $vtype. This will require the root password");
    1265     # once this is done, we can do what we want on the VM remotely
    1266 }
    1267 
    1268 # Prepare the script to be executed on the VM/VE
    1269 # in $ENV{'PBDESTDIR'}/setupv
    1270 
    1271 open(SCRIPT,"> $pbscript") || die "Unable to create $pbscript";
    1272 print SCRIPT << 'EOF';
     1240        # Launch the VM
     1241        my ($vmexist,$vmpid) = pb_launchv($vtype,$v,0);
     1242
     1243        # Skip that VM if something went wrong
     1244        return if (($vmpid == 0) && ($vmexist == 0));
     1245   
     1246        pb_system("cat $keyfile.pub | ssh -q -p $nport -i $keyfile root\@$vmhost->{$ENV{'PBPROJ'}} \"mkdir -p .ssh ; chmod 700 .ssh ; cat >> .ssh/authorized_keys ; chmod 600 .ssh/authorized_keys\"","Copying local keys to $vtype. This will require the root password");
     1247        # once this is done, we can do what we want on the VM remotely
     1248    }
     1249   
     1250    # Prepare the script to be executed on the VM/VE
     1251    # in $ENV{'PBDESTDIR'}/setupv
     1252   
     1253    open(SCRIPT,"> $pbscript") || die "Unable to create $pbscript";
     1254    print SCRIPT << 'EOF';
    12731255#!/usr/bin/perl -w
    12741256
     
    12811263while (<PBFILE>) {
    12821264EOF
    1283 print SCRIPT << "EOF";
    1284     \$found = 1 if (/^$pbaccount->{$ENV{'PBPROJ'}}:/);
     1265    print SCRIPT << "EOF";
     1266    \$found = 1 if (/^$pbac->{$ENV{'PBPROJ'}}:/);
    12851267EOF
    1286 print SCRIPT << 'EOF';
     1268    print SCRIPT << 'EOF';
    12871269}
    12881270close(PBFILE);
     
    12931275    }
    12941276EOF
    1295 print SCRIPT << "EOF";
    1296 system "groupadd $pbaccount->{$ENV{'PBPROJ'}}";
    1297 system "useradd $pbaccount->{$ENV{'PBPROJ'}} -g $pbaccount->{$ENV{'PBPROJ'}} -m -d /home/$pbaccount->{$ENV{'PBPROJ'}}";
     1277    print SCRIPT << "EOF";
     1278system "groupadd $pbac->{$ENV{'PBPROJ'}}";
     1279system "useradd $pbac->{$ENV{'PBPROJ'}} -g $pbac->{$ENV{'PBPROJ'}} -m -d /home/$pbac->{$ENV{'PBPROJ'}}";
    12981280
    12991281# For pb
    1300 chdir "/home/$pbaccount->{$ENV{'PBPROJ'}}";
     1282chdir "/home/$pbac->{$ENV{'PBPROJ'}}";
    13011283mkdir ".ssh",0700;
    13021284# Allow those accessing root to access the build account
    13031285copy("\$ENV{'HOME'}/.ssh/authorized_keys",".ssh/authorized_keys");
    13041286chmod 0600,".ssh/authorized_keys";
    1305 system 'chown -R $pbaccount->{$ENV{'PBPROJ'}}:$pbaccount->{$ENV{'PBPROJ'}} .ssh';
     1287system 'chown -R $pbac->{$ENV{'PBPROJ'}}:$pbac->{$ENV{'PBPROJ'}} .ssh';
    13061288
    13071289EOF
    1308 print SCRIPT << 'EOF';
     1290    print SCRIPT << 'EOF';
    13091291}
    13101292
     
    13151297while (<PBFILE>) {
    13161298EOF
    1317 print SCRIPT << "EOF";
    1318     s/^$pbaccount->{$ENV{'PBPROJ'}}:\!\!:/$pbaccount->{$ENV{'PBPROJ'}}:*:/;
    1319     s/^$pbaccount->{$ENV{'PBPROJ'}}:\!:/$pbaccount->{$ENV{'PBPROJ'}}:*:/;   #SLES 9 e.g.
     1299    print SCRIPT << "EOF";
     1300    s/^$pbac->{$ENV{'PBPROJ'}}:\!\!:/$pbac->{$ENV{'PBPROJ'}}:*:/;
     1301    s/^$pbac->{$ENV{'PBPROJ'}}:\!:/$pbac->{$ENV{'PBPROJ'}}:*:/; #SLES 9 e.g.
    13201302EOF
    1321 print SCRIPT << 'EOF';
     1303    print SCRIPT << 'EOF';
    13221304    print PBOUT $_;
    13231305}
     
    13351317while (<PBFILE>) {
    13361318EOF
    1337 print SCRIPT << "EOF";
    1338     next if (/^$pbaccount->{$ENV{'PBPROJ'}}   /);
     1319    print SCRIPT << "EOF";
     1320    next if (/^$pbac->{$ENV{'PBPROJ'}}   /);
    13391321EOF
    1340 print SCRIPT << 'EOF';
     1322    print SCRIPT << 'EOF';
    13411323    s/Defaults[ \t]+requiretty//;
    13421324    print PBOUT $_;
     
    13441326close(PBFILE);
    13451327EOF
    1346 print SCRIPT << "EOF";
    1347 # This is needed in order to be able to halt the machine from the $pbaccount->{$ENV{'PBPROJ'}} account at least
    1348 print PBOUT "$pbaccount->{$ENV{'PBPROJ'}}   ALL=(ALL) NOPASSWD:ALL\n";
     1328    print SCRIPT << "EOF";
     1329# This is needed in order to be able to halt the machine from the $pbac->{$ENV{'PBPROJ'}} account at least
     1330print PBOUT "$pbac->{$ENV{'PBPROJ'}}   ALL=(ALL) NOPASSWD:ALL\n";
    13491331EOF
    1350 print SCRIPT << 'EOF';
     1332    print SCRIPT << 'EOF';
    13511333close(PBOUT);
    13521334rename("$file.new",$file);
     
    13541336
    13551337EOF
    1356 
    1357 my $SCRIPT = \*SCRIPT;
    1358 
    1359 pb_install_deps($SCRIPT);
    1360 
    1361 print SCRIPT << 'EOF';
     1338       
     1339    my $SCRIPT = \*SCRIPT;
     1340   
     1341    pb_install_deps($SCRIPT);
     1342   
     1343    print SCRIPT << 'EOF';
    13621344# Suse wants sudoers as 640
    13631345if (($ddir eq "sles") || (($ddir eq "suse")) && ($dver ne "10.3")) {
     
    13661348
    13671349# Sync date
    1368 system "/usr/sbin/ntpdate ntp.pool.org";
     1350#system "/usr/sbin/ntpdate ntp.pool.org";
    13691351
    13701352system "rm -rf project-builder-* ; wget --passive-ftp ftp://ftp.mondorescue.org/src/project-builder-latest.tar.gz ; tar xvfz project-builder-latest.tar.gz ; cd project-builder-* ; perl Makefile.PL ; make ; make install ; cd .. ; rm -rf project-builder-*";
    13711353EOF
    1372 
    1373 # Adds pb_distro_init from ProjectBuilder::Distribution
    1374 foreach my $d (@INC) {
    1375     my $f = "$d/ProjectBuilder/Distribution.pm";
    1376     if (-f "$f") {
    1377         open(PBD,"$f") || die "Unable to open $f";
    1378         while (<PBD>) {
    1379             next if (/^package/);
    1380             next if (/^use Exporter/);
    1381             next if (/^\@our /);
    1382             print SCRIPT $_;
    1383         }
    1384         close(PBD);
    1385         last;
    1386     }
    1387 }
    1388 close(SCRIPT);
    1389 chmod 0755,"$pbscript";
    1390 return($pbscript);
     1354   
     1355    # Adds pb_distro_init from ProjectBuilder::Distribution
     1356    foreach my $d (@INC) {
     1357        my $f = "$d/ProjectBuilder/Distribution.pm";
     1358        if (-f "$f") {
     1359            open(PBD,"$f") || die "Unable to open $f";
     1360            while (<PBD>) {
     1361                next if (/^package/);
     1362                next if (/^use Exporter/);
     1363                next if (/^\@our /);
     1364                print SCRIPT $_;
     1365            }
     1366            close(PBD);
     1367            last;
     1368        }
     1369    }
     1370    close(SCRIPT);
     1371    chmod 0755,"$pbscript";
     1372
     1373    # That build script needs to be run as root
     1374    $pbaccount = "root";
     1375    pb_script2v($pbscript,$vtype);
     1376}
     1377return;
    13911378}
    13921379
     
    14121399    }
    14131400
    1414     system "yum -y $opt install rpm-build wget patch ntp sudo perl-DateManip perl-ExtUtils-MakeMaker";
     1401    system "yum -y $opt install rpm-build wget patch ntp sudo perl-DateManip perl-File-MimeInfo perl-ExtUtils-MakeMaker";
    14151402} elsif (( $dfam eq "rh" ) || ($ddir eq "sles") || (($ddir eq "suse") && (($dver eq "10.1") || ($dver eq "10.0"))) || (($ddir eq "mandrake") && ($dver eq "10.1")) || ($ddir eq "slackware")) {
    14161403    # Suppose pkg are installed already
     
    14261413    system "export TERM=linux ; liste=\"\" ; for i in make wget patch sudo perl-DateManip perl-File-HomeDir xntp; do rpm -q \$i 1> /dev/null 2> /dev/null ; if [ \$\? != 0 ]; then liste=\"\$liste \$i\"; fi; done; echo \"Liste: \$liste\" ; if [ \"\$liste\" != \"\" ]; then yast2 -i \$liste ; fi";
    14271414} elsif ( $dfam eq "md" ) {
    1428         system "urpmi.update -a ; urpmi --auto rpm-build wget sudo patch ntp-client perl-DateManip";
     1415        system "urpmi.update -a ; urpmi --auto rpm-build wget sudo patch ntp-client perl-File-MimeInfo perl-DateManip";
    14291416} elsif ( $dfam eq "du" ) {
    14301417    if (( $dver eq "3.1" ) && ($ddir eq "debian")) {
    14311418        #system "apt-get update";
    1432         system "apt-get -y install wget patch ssh sudo debian-builder dh-make fakeroot ntpdate libdate-manip-perl";
     1419        system "apt-get -y install wget patch ssh sudo debian-builder dh-make fakeroot ntpdate libfile-mimeinfo-perl libdate-manip-perl";
    14331420    } else  {
    1434         system "apt-get update; apt-get -y install wget patch openssh-server dpkg-dev sudo debian-builder dh-make fakeroot ntpdate rses5-dev libdate-manip-perl";
     1421        system "apt-get update; apt-get -y install wget patch openssh-server dpkg-dev sudo debian-builder dh-make fakeroot ntpdate rses5-dev libfile-mimeinfo-perl libdate-manip-perl";
    14351422    }
    14361423} elsif ( $dfam eq "gen" ) {
Note: See TracChangeset for help on using the changeset viewer.