Changeset 471 in ProjectBuilder
- Timestamp:
- Jun 3, 2008, 2:49:42 AM (17 years ago)
- Location:
- devel
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/pb-modules/lib/ProjectBuilder/Base.pm
r423 r471 136 136 my $cmd=shift; 137 137 my $cmt=shift || $cmd; 138 my $verbose=shift || undef; 138 139 139 140 pb_log(0,"$cmt... "); 140 141 pb_log(1,"Executing $cmd\n"); 141 system( $cmd);142 system("$cmd 2>&1 > $ENV{'PBTMP'}/system.log"); 142 143 my $res = $?; 143 144 if ($res == -1) { 144 pb_log(0,"failed to execute ($cmd) 145 pb_log(0,"failed to execute ($cmd): $!\n"); 145 146 pb_display_file("$ENV{'PBTMP'}/system.log"); 146 147 } elsif ($res & 127) { … … 149 150 } elsif ($res == 0) { 150 151 pb_log(0,"OK\n"); 152 pb_display_file("$ENV{'PBTMP'}/system.log") if (defined $verbose); 151 153 } else { 152 154 pb_log(0, "child ($cmd) exited with value ".($? >> 8)."\n"); -
devel/pb/bin/pb
r465 r471 220 220 Create a new project and a template set of 221 221 configuration files under pbconf 222 223 =item B<announce> 224 225 Announce the availability of the project through various means 222 226 223 227 =back … … 431 435 # Nothing to do - already done in pb_env_init 432 436 } elsif ($action =~ /^clean$/) { 437 # TBC 438 } elsif ($action =~ /^announce$/) { 439 pb_announce(); 433 440 } else { 434 441 pb_log(0,"\'$action\' is not available\n"); … … 679 686 $made="$made RPMS/*/$pbpkg-$pbver-$pbtag$pbsuf.*.rpm SRPMS/$pbpkg-$pbver-$pbtag$pbsuf.src.rpm"; 680 687 if (-f "/usr/bin/rpmlint") { 681 pb_system("rpmlint $made","Checking validity of rpms with rpmlint" );688 pb_system("rpmlint $made","Checking validity of rpms with rpmlint","verbose"); 682 689 } 683 690 } elsif ($dtype eq "deb") { … … 814 821 } 815 822 my $cmd = ""; 816 817 my $ptr = pb_get_pkg(); 818 @pkgs = @$ptr; 819 820 # Get the running distro to consider 823 my $src = ""; 821 824 my ($odir,$over,$oarch) = (undef, undef, undef); 822 if (defined $v) { 823 ($odir,$over,$oarch) = split(/-/,$v); 824 } 825 my ($ddir, $dver, $dfam, $dtype, $pbsuf) = pb_distro_init($odir,$over); 826 pb_log(2,"DEBUG: distro tuple: ".join(',',($ddir, $dver, $dfam, $dtype, $pbsuf))."\n"); 827 828 # Get list of packages to build 829 # Get content saved in cms2build 830 my ($pkg) = pb_conf_read("$ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.pb","pbpkg"); 831 $pkg = { } if (not defined $pkg); 832 833 my $src = ""; 834 chdir "$ENV{'PBBUILDDIR'}"; 835 foreach my $pbpkg (@pkgs) { 836 my $vertag = $pkg->{$pbpkg}; 837 # get the version of the current package - maybe different 838 ($pbver,$pbtag) = split(/-/,$vertag); 839 840 if (($cmt eq "Sources") || ($cmt eq "vm") || ($cmt eq "ve")) { 841 $src = "$src $ENV{'PBDESTDIR'}/$pbpkg-$pbver.tar.gz"; 842 if ($cmd eq "") { 843 $cmd = "ln -sf $pbpkg-$pbver.tar.gz $pbpkg-latest.tar.gz"; 844 } else { 845 $cmd = "$cmd ; ln -sf $pbpkg-$pbver.tar.gz $pbpkg-latest.tar.gz"; 846 } 847 } 848 } 849 # Adds conf file for availability of conf elements 850 pb_conf_add("$ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb"); 825 my ($ddir, $dver, $dfam, $dtype, $pbsuf); 826 827 if ($cmt ne "Announce") { 828 my $ptr = pb_get_pkg(); 829 @pkgs = @$ptr; 830 831 # Get the running distro to consider 832 if (defined $v) { 833 ($odir,$over,$oarch) = split(/-/,$v); 834 } 835 ($ddir, $dver, $dfam, $dtype, $pbsuf) = pb_distro_init($odir,$over); 836 pb_log(2,"DEBUG: distro tuple: ".join(',',($ddir, $dver, $dfam, $dtype, $pbsuf))."\n"); 837 838 # Get list of packages to build 839 # Get content saved in cms2build 840 my ($pkg) = pb_conf_read("$ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.pb","pbpkg"); 841 $pkg = { } if (not defined $pkg); 842 843 chdir "$ENV{'PBBUILDDIR'}"; 844 foreach my $pbpkg (@pkgs) { 845 my $vertag = $pkg->{$pbpkg}; 846 # get the version of the current package - maybe different 847 ($pbver,$pbtag) = split(/-/,$vertag); 848 849 if (($cmt eq "Sources") || ($cmt eq "vm") || ($cmt eq "ve")) { 850 $src = "$src $ENV{'PBDESTDIR'}/$pbpkg-$pbver.tar.gz"; 851 if ($cmd eq "") { 852 $cmd = "ln -sf $pbpkg-$pbver.tar.gz $pbpkg-latest.tar.gz"; 853 } else { 854 $cmd = "$cmd ; ln -sf $pbpkg-$pbver.tar.gz $pbpkg-latest.tar.gz"; 855 } 856 } 857 } 858 # Adds conf file for availability of conf elements 859 pb_conf_add("$ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb"); 860 } 851 861 852 862 if (($cmt eq "vm") || ($cmt eq "ve")) { 853 863 $src="$src $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb $ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.pb $ENV{'PBETC'} $ENV{'PBDESTDIR'}/pbrc $ENV{'PBDESTDIR'}/pbscript"; 854 } elsif ( $cmt eq "Script") {855 $src="$src $ENV{'PB DESTDIR'}/pbscript";864 } elsif (($cmt eq "Script") || ($cmt eq "Announce")) { 865 $src="$src $ENV{'PBTMP'}/pbscript"; 856 866 } elsif ($cmt eq "Packages") { 857 867 # Get package list from file made during build2pkg … … 889 899 my $bdir; 890 900 if (($cmt eq "Sources") || ($cmt eq "Script")) { 891 $tdir = "$sshdir->{$ENV{'PBPROJ'}}/src";901 $tdir = $sshdir->{$ENV{'PBPROJ'}}."/src"; 892 902 if ((defined $testver) && (defined $testver->{$ENV{'PBPROJ'}}) && ($testver->{$ENV{'PBPROJ'}} =~ /true/i)) { 893 903 # This is a test pkg => target dir is under test 894 $tdir = "$sshdir->{$ENV{'PBPROJ'}}/test/src";904 $tdir = $sshdir->{$ENV{'PBPROJ'}}."/test/src"; 895 905 } 896 906 } elsif (($cmt eq "vm") || ($cmt eq "ve")) { … … 899 909 # Remove a potential $ENV{'HOME'} as bdir should be relative to pb's home 900 910 $bdir =~ s|\$ENV.+\}/||; 901 } elsif ($cmt eq "Packages") { 902 $tdir = "$sshdir->{$ENV{'PBPROJ'}}/$ddir/$dver"; 903 911 } elsif ($cmt eq "Announce") { 912 $tdir = "$sshdir->{$ENV{'PBPROJ'}}"; 904 913 if ((defined $testver) && (defined $testver->{$ENV{'PBPROJ'}}) && ($testver->{$ENV{'PBPROJ'}} =~ /true/i)) { 905 914 # This is a test pkg => target dir is under test 906 $tdir = "$sshdir->{$ENV{'PBPROJ'}}/test/$ddir/$dver"; 915 $tdir = $sshdir->{$ENV{'PBPROJ'}}."/test"; 916 } 917 } elsif ($cmt eq "Packages") { 918 $tdir = $sshdir->{$ENV{'PBPROJ'}}."/$ddir/$dver"; 919 920 if ((defined $testver) && (defined $testver->{$ENV{'PBPROJ'}}) && ($testver->{$ENV{'PBPROJ'}} =~ /true/i)) { 921 # This is a test pkg => target dir is under test 922 $tdir = $sshdir->{$ENV{'PBPROJ'}}."/test/$ddir/$dver"; 907 923 } 908 924 … … 1005 1021 } 1006 1022 1007 pb_system("$shcmd \"mkdir -p $tdir ; cd $tdir ; echo \'for i in $basesrc; do if [ -f \$i ]; then rm -f \$i; fi; done\ ; $cmd' | bash\"","Preparing $tdir on $cptarget"); 1023 my $logres = ""; 1024 # Do not touch when just announcing 1025 if ($cmt ne "Announce") { 1026 pb_system("$shcmd \"mkdir -p $tdir ; cd $tdir ; echo \'for i in $basesrc; do if [ -f \$i ]; then rm -f \$i; fi; done\ ; $cmd' | bash\"","Preparing $tdir on $cptarget"); 1027 } else { 1028 $logres = "> "; 1029 } 1008 1030 pb_system("cd $ENV{'PBBUILDDIR'} ; $cpcmd $src $cptarget 2> /dev/null","$cmt delivery in $cptarget"); 1009 1031 … … 1688 1710 } 1689 1711 1712 sub pb_announce { 1713 1714 die "-V Version parameter needed" if ((not defined $newver) || ($newver eq "")); 1715 1716 my ($pbrepo) = pb_conf_get("pbrepo"); 1717 my ($pkgv, $pkgt, $testver) = pb_conf_get_if("pkgver","pkgtag","testver"); 1718 my $pkg = pb_cms_get_pkg($defpkgdir,$extpkgdir); 1719 my @pkgs = @$pkg; 1720 my %pkgs; 1721 my $first = 0; 1722 1723 my $findstr = "find . "; 1724 1725 foreach my $pbpkg (@pkgs) { 1726 if ($first != 0) { 1727 $findstr .= "-o "; 1728 } 1729 $first++; 1730 if ((defined $pkgv) && (defined $pkgv->{$pbpkg})) { 1731 $pbver = $pkgv->{$pbpkg}; 1732 } else { 1733 $pbver = $ENV{'PBPROJVER'}; 1734 } 1735 if ((defined $pkgt) && (defined $pkgt->{$pbpkg})) { 1736 $pbtag = $pkgt->{$pbpkg}; 1737 } else { 1738 $pbtag = $ENV{'PBPROJTAG'}; 1739 } 1740 1741 $findstr .= "-name \'$pbpkg-$pbver-$pbtag\.*.rpm\' -o -name \'$pbpkg"."_$pbver*\.deb\' -o -name \'$pbpkg-$pbver\.ebuild\' "; 1742 } 1743 $findstr .= " | grep -Ev \'src.rpm\'"; 1744 if ((not defined $testver) || (not defined $testver->{$ENV{'PBPROJ'}}) || ($testver->{$ENV{'PBPROJ'}} !~ /true/i)) { 1745 $findstr .= " | grep -v ./test/"; 1746 } 1747 1748 # Prepare the command to run and execute it 1749 open(PBS,"> $ENV{'PBTMP'}/pbscript") || die "Unable to create $ENV{'PBTMP'}/pbscript"; 1750 print PBS "$findstr\n"; 1751 close(PBS); 1752 chmod 0755,"$ENV{'PBTMP'}/pbscript"; 1753 pb_send2target("Announce"); 1754 1755 # Prepare a template of announce 1756 open(ANN,"> $ENV{'PBTMP'}/pbannounce") || die "Unable to create $ENV{'PBTMP'}/pbannounce: $!"; 1757 print ANN << "EOF"; 1758 Project $ENV{'PBPROJ'} version $newver is now available</p> 1759 1760 <p>The project team is happy to announce the availability of a newest version of $ENV{'PBPROJ'} $newver. Enjoy it as usual!</p> 1761 <p> 1762 Now available at <a href="$pbrepo->{$ENV{'PBPROJ'}}">$pbrepo->{$ENV{'PBPROJ'}}</a> 1763 </p> 1764 <p> 1765 EOF 1766 open(LOG,"$ENV{'PBTMP'}/system.log") || die "Unable to read $ENV{'PBTMP'}/system.log: $!"; 1767 while (<LOG>) { 1768 print ANN $_; 1769 } 1770 close(LOG); 1771 1772 close(ANN); 1773 pb_display_file("$ENV{'PBTMP'}/pbannounce"); 1774 } 1775 1690 1776 # Return the SSH key file to use 1691 1777 # Potentially create it if needed -
devel/pb/lib/ProjectBuilder/Env.pm
r456 r471 221 221 # return values in that case are useless 222 222 # 223 if (($action =~ /^cms2/) || ($action =~ /^newver$/) || ($action =~ /pbinit/) || ($action =~ /^newproj$/) ) {223 if (($action =~ /^cms2/) || ($action =~ /^newver$/) || ($action =~ /pbinit/) || ($action =~ /^newproj$/) || ($action =~ /^announce/)) { 224 224 225 225 #
Note:
See TracChangeset
for help on using the changeset viewer.