Changeset 1156


Ignore:
Timestamp:
Jan 13, 2011, 1:18:37 PM (9 years ago)
Author:
Bruno Cornec
Message:
  • Adds a global variable REVISION for version management
  • Do not return in pb_send2target if pb file not available in order to shutdown VM in all cases
  • Code and test sbx2setupvm
  • setup_v now needs a fake pb_version_init fct added at the end of the script
  • Fix pbdistrocheck install comand printing
  • Fix mandralinux old distro build in pb.conf (Note only non symlink release files are important)
Location:
devel
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • devel/pb-modules/bin/pbdistrocheck

    r1111 r1156  
    144144        $pbsuf = "Suffix:\t$pbsuf";
    145145        $pbupd = "Update:\t$pbupd";
    146         $pbins = "Install:\t$pbupd";
     146        $pbins = "Install:\t$pbins";
    147147        $arch = "Arch:\t$arch";
    148148        print "Project-Builder tuple:\n";
  • devel/pb-modules/etc/pb.conf

    r1155 r1156  
    3333osrelfile mandriva = /etc/mandriva-release
    3434
    35 # Mandrake = 10.1,10.2
    36 osrelfile mandrake = /etc/mandrakelinux-release
     35# Mageia TBC
     36osrelfile mageia = /etc/mageia-release
    3737
    3838# Fedora >= 4
     
    8383# Here are the ambiguous file association
    8484# E.g. the file /etc/redhat-release is found on multiple distro such as redhat, rhel, centos, mandrake, vmware
    85 #
    86 
    87 # Mandrake <= 10.1
    88 osrelambfile mandrake = /etc/mandrake-release
     85# These files should no be links
     86#
     87
     88# Mandrake >= 10.1
     89osrelambfile mandrake = /etc/mandrakelinux-release
    8990
    9091# Debian >= 3.1
     
    117118osrelexpr slackware = S[^ ]* (.+)$
    118119osrelexpr mandriva = Mandr[^ ]* [^ ]* release (.+) \(
    119 osrelexpr mandrake = Mandrakelinux release (.+) \(
     120osrelexpr mandrake = Mandr[^ ]* release (.+) \(
    120121osrelexpr fedora = Fedora .*release (\d+) \(
    121122osrelexpr vmware = VMware ESX Server (\d+) \(
     
    394395osperldep mandrake-10.1 = Date-Manip
    395396ospkgdep mandrake-10.1 = rpm-build,wget,patch,make,ntp-client,perl-File-MimeInfo,diffutils
     397ospkgdep mandrake-10.2 = rpm-build,wget,patch,make,ntp-client,perl-File-MimeInfo,diffutils,perl-DateManip
    396398osperldep md =
    397399ospkgdep md = rpm-build,wget,patch,make,ntp-client,perl-File-MimeInfo,perl-File-BaseDir,perl-Date-Manip,diffutils
  • devel/pb-modules/lib/ProjectBuilder/Base.pm

    r1148 r1156  
    2525# Inherit from the "Exporter" module which handles exporting functions.
    2626 
    27 use vars qw($VERSION @ISA @EXPORT);
     27use vars qw($VERSION $REVISION @ISA @EXPORT);
    2828use Exporter;
    2929 
     
    4040our @ISA = qw(Exporter);
    4141our @EXPORT = qw(pb_mkdir_p pb_system pb_rm_rf pb_get_date pb_log pb_log_init pb_get_uri pb_get_content pb_set_content pb_display_file pb_syntax_init pb_syntax pb_temp_init pb_get_arch pb_check_requirements pb_check_req $pbdebug $pbLOG $pbdisplaytype $pblocale);
    42 $VERSION = "$ProjectBuilder::Version::VERSION";
     42($VERSION,$REVISION) = pb_version_init();
    4343
    4444=pod
  • devel/pb-modules/lib/ProjectBuilder/Conf.pm

    r1148 r1156  
    1717# Inherit from the "Exporter" module which handles exporting functions.
    1818 
    19 use vars qw($VERSION @ISA @EXPORT);
     19use vars qw($VERSION $REVISION @ISA @EXPORT);
    2020use Exporter;
    2121 
     
    2525our @ISA = qw(Exporter);
    2626our @EXPORT = qw(pb_conf_init pb_conf_add pb_conf_read pb_conf_read_if pb_conf_get pb_conf_get_if);
    27 $VERSION = "$ProjectBuilder::Version::VERSION";
     27($VERSION,$REVISION) = pb_version_init();
    2828
    2929# Global hash of conf files
  • devel/pb-modules/lib/ProjectBuilder/Display.pm

    r1148 r1156  
    2323# Inherit from the "Exporter" module which handles exporting functions.
    2424 
    25 use vars qw($VERSION @ISA @EXPORT);
     25use vars qw($VERSION $REVISION @ISA @EXPORT);
    2626use Exporter;
    2727 
     
    3535our @ISA = qw(Exporter);
    3636our @EXPORT = qw(pb_display pb_display_init $pbdisplaytype $pblocale);
    37 $VERSION = "$ProjectBuilder::Version::VERSION";
     37($VERSION,$REVISION) = pb_version_init();
    3838
    3939=pod
  • devel/pb-modules/lib/ProjectBuilder/Distribution.pm

    r1148 r1156  
    1919# Inherit from the "Exporter" module which handles exporting functions.
    2020 
    21 use vars qw($VERSION @ISA @EXPORT);
     21use vars qw($VERSION $REVISION @ISA @EXPORT);
    2222use Exporter;
    2323 
     
    2727our @ISA = qw(Exporter);
    2828our @EXPORT = qw(pb_distro_conffile pb_distro_init pb_distro_get pb_distro_getlsb pb_distro_installdeps pb_distro_getdeps pb_distro_only_deps_needed pb_distro_setuprepo pb_distro_setuposrepo pb_distro_get_param);
    29 $VERSION = "$ProjectBuilder::Version::VERSION";
     29($VERSION,$REVISION) = pb_version_init();
    3030
    3131=pod
     
    156156This function returns a list of 2 parameters indicating the distribution name and version of the underlying Linux distribution. The value of those 2 fields may be "unknown" in case the function was unable to recognize on which distribution it is running.
    157157
    158 On my home machine it would currently report ("mandriva","2009.0").
     158On my home machine it would currently report ("mandriva","2010.2").
    159159
    160160=cut
  • devel/pb-modules/lib/ProjectBuilder/Version.pm

    r1148 r1156  
    1111# Inherit from the "Exporter" module which handles exporting functions.
    1212 
    13 use vars qw($VERSION @ISA @EXPORT);
     13use vars qw($VERSION $REVISION @ISA @EXPORT);
    1414use Exporter;
    1515 
     
    1919our @EXPORT = qw(pb_version_init);
    2020
    21 $VERSION = 'PBVER';
     21$VERSION = "PBVER";
     22$REVISION = "PBREV";
    2223
    2324sub pb_version_init {
    2425
    25 my $projectbuilderver = "PBVER";
    26 my $projectbuilderrev = "PBREV";
     26my $projectbuilderver = $VERSION;
     27my $projectbuilderrev = $REVISION;
    2728
    2829return($projectbuilderver,$projectbuilderrev);
  • devel/pb/bin/pb

    r1155 r1156  
    17511751            pb_system("sudo chown $UID $ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.$$","Adapt owner in $tdir to $UID");
    17521752        }
    1753         # return here to avoid breaking the load on VMs/VEs in case of a bad one
    17541753        if (not -f "$ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.$$") {
    17551754            pb_log(0,"Problem with VM $v on $ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.$$");
    1756             return;
    1757         }
    1758         open(KEEP,"$ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.$$") || die "Unable to read $ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.$$";
    1759         my $src = <KEEP>;
    1760         chomp($src);
    1761         close(KEEP);
    1762         unlink("$ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.$$");
    1763 
    1764         $src =~ s/^ *//;
    1765         pb_mkdir_p("$ENV{'PBBUILDDIR'}/$odir/$over/$oarch");
    1766         # Change pgben to make the next send2target happy
    1767         my $made = "";
    1768 
    1769         # For VM we don't want shell expansion to hapen locally but remotely
    1770         my $delim = '\'';
    1771         if ($cmt =~ /^VEbuild/) {
    1772             # For VE we need to support shell expansion locally
    1773             $delim = "";
    1774         }   
    1775 
    1776         open(KEEP,"> $ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}") || die "Unable to write $ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}";
    1777         foreach my $p (split(/ +/,$src)) {
    1778             my $j = basename($p);
    1779             pb_system("$cpcmd $cp2target/$delim$p$delim $ENV{'PBBUILDDIR'}/$odir/$over/$oarch 2> /dev/null","Recovery of package $j in $ENV{'PBBUILDDIR'}/$odir/$over/$oarch");
    1780             $made="$made $odir/$over/$oarch/$j"; # if (($dtype ne "rpm") || ($j !~ /.src.rpm$/));
    1781         }
    1782         print KEEP "$made\n";
    1783         close(KEEP);
    1784         pb_system("$shcmd \"rm -rf $tdir $bdir\"","$cmt cleanup");
    1785 
    1786         # Sign packages locally
    1787         if ($dtype eq "rpm") {
     1755        } else {
     1756            open(KEEP,"$ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.$$") || die "Unable to read $ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.$$";
     1757            my $src = <KEEP>;
     1758            chomp($src);
     1759            close(KEEP);
     1760            unlink("$ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.$$");
     1761
     1762            $src =~ s/^ *//;
     1763            pb_mkdir_p("$ENV{'PBBUILDDIR'}/$odir/$over/$oarch");
     1764            # Change pgben to make the next send2target happy
     1765            my $made = "";
     1766   
     1767            # For VM we don't want shell expansion to hapen locally but remotely
     1768            my $delim = '\'';
     1769            if ($cmt =~ /^VEbuild/) {
     1770                # For VE we need to support shell expansion locally
     1771                $delim = "";
     1772            }   
     1773
     1774            open(KEEP,"> $ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}") || die "Unable to write $ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}";
     1775            foreach my $p (split(/ +/,$src)) {
     1776                my $j = basename($p);
     1777                pb_system("$cpcmd $cp2target/$delim$p$delim $ENV{'PBBUILDDIR'}/$odir/$over/$oarch 2> /dev/null","Recovery of package $j in $ENV{'PBBUILDDIR'}/$odir/$over/$oarch");
     1778                $made="$made $odir/$over/$oarch/$j"; # if (($dtype ne "rpm") || ($j !~ /.src.rpm$/));
     1779            }
     1780            print KEEP "$made\n";
     1781            close(KEEP);
     1782            pb_system("$shcmd \"rm -rf $tdir $bdir\"","$cmt cleanup");
     1783
     1784            # Sign packages locally
     1785            if ($dtype eq "rpm") {
    17881786                #pb_system("rpm --addsign --define \"_signature gpg\" --define \"_gpg_name $ENV{'PBPACKAGER'}\" --define \"__gpg_sign_cmd /usr/bin/gpg --batch --no-verbose --no-armor --no-tty --no-secmem-warning -sbo %{__signature_filename} %{__plaintext_filename} --use-agent\" $made","Signing RPM packages packages");
    1789         } elsif ($dtype eq "deb") {
     1787            } elsif ($dtype eq "deb") {
    17901788                #pb_system("debsign $made","Signing DEB packages");
    1791         } else {
    1792             pb_log(0,"I don't know yet how to sign packages for type $dtype.\nPlease give feedback to dev team\n");
    1793         }
    1794 
    1795         # We want to send them to the ssh account so overwrite what has been done before
    1796         undef $pbaccount;
    1797         pb_log(2,"Before sending pkgs, vmexist: $vmexist, vmpid: $vmpid\n");
    1798         pb_send2target("Packages",$odir."-".$over."-".$oarch,$vmexist,$vmpid);
    1799         pb_rm_rf("$ENV{'PBBUILDDIR'}/$odir/$over/$oarch");
     1789            } else {
     1790                pb_log(0,"I don't know yet how to sign packages for type $dtype.\nPlease give feedback to dev team\n");
     1791            }
     1792
     1793            # We want to send them to the ssh account so overwrite what has been done before
     1794            undef $pbaccount;
     1795            pb_log(2,"Before sending pkgs, vmexist: $vmexist, vmpid: $vmpid\n");
     1796            pb_send2target("Packages",$odir."-".$over."-".$oarch,$vmexist,$vmpid);
     1797            pb_rm_rf("$ENV{'PBBUILDDIR'}/$odir/$over/$oarch");
     1798        }
    18001799    }
    18011800    unlink("$ENV{'PBDESTDIR'}/pbscript.$$") if ($cmt =~ /^V[ME]/);
     
    25842583# They are appended at the end.
    25852584
     2585# Define mandatory global vars
    25862586our $pbdebug;
    25872587our $pbLOG;
     
    25972597    ($vmexist,$vmpid) = pb_launchv($vtype,$v,0,0,0);
    25982598
     2599    my $keyfile;
     2600    my $nport;
     2601    my $vmhost;
     2602
    25992603    if ($vtype eq "vm") {
    26002604        # Prepare the key to be used and transfered remotely
    2601         my $keyfile = pb_ssh_get(1);
     2605        $keyfile = pb_ssh_get(1);
    26022606       
    2603         my ($vmhost,$vmport,$vmntp) = pb_conf_get("vmhost","vmport","vmntp");
    2604         my $nport = pb_get_port($vmport->{$ENV{'PBPROJ'}});
     2607        my ($vmport,$vmntp);
     2608        ($vmhost,$vmport,$vmntp) = pb_conf_get("vmhost","vmport","vmntp");
     2609        $nport = pb_get_port($vmport->{$ENV{'PBPROJ'}});
    26052610   
    26062611        # Skip that VM if something went wrong
     
    28372842            my ($pkg) = pb_conf_read("$ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.pb","pbpkg");
    28382843            die "Unable to get package list" if (not defined $pkg);
    2839             my ($vepath) = pb_conf_get("vepath");
    28402844
    28412845            # We consider 2 specific packages
     
    28452849            my ($pbver1,$tmp1) = split(/-/,$vertag1);
    28462850            my ($pbver2,$tmp2) = split(/-/,$vertag2);
    2847             # Copy inside the VM
    2848             copy("$ENV{'PBDESTDIR'}/ProjectBuilder-$pbver1.tar.gz","$vepath->{$ENV{'PBPROJ'}}/$ddir/$dver/$darch/tmp");
    2849             copy("$ENV{'PBDESTDIR'}/project-builder-$pbver2.tar.gz","$vepath->{$ENV{'PBPROJ'}}/$ddir/$dver/$darch/tmp");
     2851            # Copy inside the VE
     2852            if ($vtype eq "ve") {
     2853                my ($vepath) = pb_conf_get("vepath");
     2854                copy("$ENV{'PBDESTDIR'}/ProjectBuilder-$pbver1.tar.gz","$vepath->{$ENV{'PBPROJ'}}/$ddir/$dver/$darch/tmp");
     2855                copy("$ENV{'PBDESTDIR'}/project-builder-$pbver2.tar.gz","$vepath->{$ENV{'PBPROJ'}}/$ddir/$dver/$darch/tmp");
     2856            } else {
     2857                pb_system("scp -i $keyfile -p -o UserKnownHostsFile=/dev/null -P $nport $ENV{'PBDESTDIR'}/ProjectBuilder-$pbver1.tar.gz $ENV{'PBDESTDIR'}/project-builder-$pbver2.tar.gz root\@$vmhost->{$ENV{'PBPROJ'}}:/tmp","Copying local project files to $vtype.");
     2858            }
    28502859            $cmdget = "mv /tmp/ProjectBuilder-$pbver1.tar.gz ProjectBuilder-latest.tar.gz ; mv /tmp/project-builder-$pbver2.tar.gz project-builder-latest.tar.gz";
    28512860        } else {
     
    29042913    }
    29052914
    2906     # Adds pb_distro_init and all functions needed from ProjectBuilder::Distribution and Base
     2915    # Adds pb_distro_init and all functions needed from ProjectBuilder::Distribution, Conf and Base
    29072916    foreach my $d (@INC) {
    29082917        my @f = ("$d/ProjectBuilder/Base.pm","$d/ProjectBuilder/Distribution.pm","$d/ProjectBuilder/Conf.pm");
     
    29212930        }
    29222931    }
     2932    # Use a fake pb_version_init version here
     2933    print SCRIPT << "EOF";
     2934sub pb_version_init {
     2935
     2936return("$projectbuilderver","$projectbuilderrev");
     2937}
     29381;
     2939EOF
    29232940    close(SCRIPT);
    29242941    chmod 0755,"$pbscript";
  • devel/pb/lib/ProjectBuilder/CMS.pm

    r1153 r1156  
    2525# Inherit from the "Exporter" module which handles exporting functions.
    2626 
    27 use vars qw($VERSION @ISA @EXPORT);
     27use vars qw($VERSION $REVISION @ISA @EXPORT);
    2828use Exporter;
    2929 
     
    3333our @ISA = qw(Exporter);
    3434our @EXPORT = qw(pb_cms_init pb_cms_export pb_cms_get_uri pb_cms_copy pb_cms_checkout pb_cms_up pb_cms_checkin pb_cms_isdiff pb_cms_get_pkg pb_cms_get_real_pkg pb_cms_compliant pb_cms_log pb_cms_add);
    35 $VERSION = "$ProjectBuilder::Version::VERSION";
     35($VERSION,$REVISION) = pb_version_init();
    3636
    3737=pod
  • devel/pb/lib/ProjectBuilder/Changelog.pm

    r1148 r1156  
    2323# Inherit from the "Exporter" module which handles exporting functions.
    2424 
    25 use vars qw($VERSION @ISA @EXPORT);
     25use vars qw($VERSION $REVISION @ISA @EXPORT);
    2626use Exporter;
    2727 
     
    3131our @ISA = qw(Exporter);
    3232our @EXPORT = qw(pb_changelog);
    33 $VERSION = "$ProjectBuilder::Version::VERSION";
     33($VERSION,$REVISION) = pb_version_init();
    3434
    3535=pod
  • devel/pb/lib/ProjectBuilder/Env.pm

    r1148 r1156  
    2626# Inherit from the "Exporter" module which handles exporting functions.
    2727 
    28 use vars qw($VERSION @ISA @EXPORT);
     28use vars qw($VERSION $REVISION @ISA @EXPORT);
    2929use Exporter;
    3030 
     
    3434our @ISA = qw(Exporter);
    3535our @EXPORT = qw(pb_env_init pb_env_init_pbrc);
    36 $VERSION = "$ProjectBuilder::Version::VERSION";
     36($VERSION,$REVISION) = pb_version_init();
    3737
    3838=pod
  • devel/pb/lib/ProjectBuilder/Filter.pm

    r1148 r1156  
    2424# Inherit from the "Exporter" module which handles exporting functions.
    2525 
    26 use vars qw($VERSION @ISA @EXPORT);
     26use vars qw($VERSION $REVISION @ISA @EXPORT);
    2727use Exporter;
    2828 
     
    3232our @ISA = qw(Exporter);
    3333our @EXPORT = qw(pb_get_filters pb_filter_file_pb pb_filter_file_inplace pb_filter_file);
    34 $VERSION = "$ProjectBuilder::Version::VERSION";
     34($VERSION,$REVISION) = pb_version_init();
    3535
    3636=pod
Note: See TracChangeset for help on using the changeset viewer.