Changeset 500 in ProjectBuilder for devel/pb/lib
- Timestamp:
- Aug 3, 2008, 1:20:30 PM (17 years ago)
- Location:
- devel/pb/lib/ProjectBuilder
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/pb/lib/ProjectBuilder/CMS.pm
r452 r500 16 16 use English; 17 17 use File::Basename; 18 use File::Copy; 18 19 use POSIX qw(strftime); 19 20 use lib qw (lib); … … 109 110 This function exports a CMS content to a directory. 110 111 The first parameter is the URL of the CMS content. 111 The second parameter is the directory in which it is locally exposed (result of a checkout). 112 The second parameter is the directory in which it is locally exposed (result of a checkout). If undef, then use the original CMS content. 112 113 The third parameter is the directory where we want to deliver it (result of export). 113 114 … … 127 128 128 129 if ($scheme =~ /^svn/) { 129 if (-d $source) { 130 $tmp = $destdir; 131 } else { 132 $tmp = "$destdir/".basename($source); 133 } 134 pb_system("svn export $source $tmp","Exporting $source from SVN to $tmp"); 130 if (defined $source) { 131 if (-d $source) { 132 $tmp = $destdir; 133 } else { 134 $tmp = "$destdir/".basename($source); 135 } 136 pb_system("svn export $source $tmp","Exporting $source from SVN to $tmp"); 137 } else { 138 pb_system("svn export $uri $destdir","Exporting $uri from SVN to $destdir"); 139 } 135 140 } elsif ($scheme eq "dir") { 136 141 pb_system("cp -a $path $destdir","Copying $uri from DIR to $destdir"); … … 152 157 pb_mkdir_p($destdir); 153 158 154 # Check whether the file is well formed 155 # (containing already a directory with the project-version name) 156 my ($pbwf) = pb_conf_get_if("pbwf"); 157 if ((defined $pbwf) && (defined $pbwf->{$ENV{'PBPROJ'}})) { 158 $destdir = dirname($destdir); 159 if (defined $source) { 160 # Check whether the file is well formed 161 # (containing already a directory with the project-version name) 162 my ($pbwf) = pb_conf_get_if("pbwf"); 163 if ((defined $pbwf) && (defined $pbwf->{$ENV{'PBPROJ'}})) { 164 $destdir = dirname($destdir); 165 } 159 166 } 160 167 … … 174 181 # zip 175 182 pb_system("cd $destdir ; unzip $path","Extracting $path in $destdir"); 183 } else { 184 # simple file: copy it (patch e.g.) 185 copy($path,$destdir); 176 186 } 177 187 } elsif ($scheme =~ /^cvs/) { … … 179 189 my $dir=dirname($destdir); 180 190 my $base=basename($destdir); 181 # CVS also needs a modules name not a dir182 #if (-d $source) {191 if (defined $source) { 192 # CVS also needs a modules name not a dir 183 193 $tmp1 = basename($source); 184 #} else {185 # $tmp1 = dirname($source);186 #$tmp1 = basename($tmp1);187 #}194 } else { 195 # Probably not right, should be checked, but that way I'll notice it :-) 196 $tmp1 = $uri; 197 } 188 198 my $optcvs = ""; 189 199 … … 304 314 } elsif ($scheme =~ /^cvs/) { 305 315 pb_system("cvs co $url $destination","Checking out $url to $destination "); 316 } elsif ($scheme =~ /^file/) { 317 pb_cms_export($url,undef,$destination); 306 318 } else { 307 319 die "cms $scheme unknown"; … … 417 429 } 418 430 419 =item B<pb_cms_ isdiff>431 =item B<pb_cms_getpkg> 420 432 421 433 This function returns the list of packages we are working on in a CMS action. -
devel/pb/lib/ProjectBuilder/Env.pm
r484 r500 477 477 # 478 478 # PBREPO is replaced by the root URL to access the repository 479 filter PBREPO = \$pb repo479 filter PBREPO = \$pb->{'repo'} 480 480 481 481 # PBSRC is replaced by the source package location after the repo 482 482 #filter PBSRC = src/%{name}-%{version}.tar.gz 483 483 484 # PBVER is replaced by the version (\$pb verin code)485 filter PBVER = \$pb ver486 487 # PBDATE is replaced by the date (\$pb datein code)488 filter PBDATE = \$pb date484 # PBVER is replaced by the version (\$pb->{'ver'} in code) 485 filter PBVER = \$pb->{'ver'} 486 487 # PBDATE is replaced by the date (\$pb->{'date'} in code) 488 filter PBDATE = \$pb->{'date'} 489 489 490 490 # PBLOG is replaced by the changelog if value is yes 491 491 #filter PBLOG = yes 492 492 493 # PBTAG is replaced by the tag (\$pbtag in code) 494 filter PBTAG = \$pbtag 495 496 # PBREV is replaced by the revision (\$pbrev in code) 497 filter PBREV = \$pbrev 498 499 # PBPKG is replaced by the package name (\$pbpkg in code) 500 filter PBPKG = \$pbpkg 501 502 # PBPACKAGER is replaced by the packager name (\$pbpackager in code) 503 filter PBPACKAGER = \$pbpackager 493 # PBPATCHSRC is replaced by the patches names if value is yes 494 #filter PBPATCHSRC = yes 495 496 # PBPATCHCMD is replaced by the patches commands if value is yes 497 #filter PBPATCHCMD = yes 498 499 # PBTAG is replaced by the tag (\$pb->{'tag'} in code) 500 filter PBTAG = \$pb->{'tag'} 501 502 # PBREV is replaced by the revision (\$pb->{'rev'} in code) 503 filter PBREV = \$pb->{'rev'} 504 505 # PBPKG is replaced by the package name (\$pb->{'pkg'} in code) 506 filter PBPKG = \$pb->{'pkg'} 507 508 # PBPACKAGER is replaced by the packager name (\$pb->{'packager'} in code) 509 filter PBPACKAGER = \$pb->{'packager'} 504 510 505 511 # PBDESC contains the description of the package … … 527 533 #filter PBDEP = 528 534 529 # PBSUF is replaced by the package suffix (\$pb sufin code)530 filter PBSUF = \$pb suf535 # PBSUF is replaced by the package suffix (\$pb->{'suf'} in code) 536 filter PBSUF = \$pb->{'suf'} 531 537 532 538 # PBOBS is replaced by the Obsolete line … … 554 560 #filter PBDEP = 555 561 556 # PBSUF is replaced by the package suffix (\$pbsuf in code)562 # PBSUF is replaced by the package suffix (\$pbsuf'} in code) 557 563 filter PBSUF = %{dist} 558 564 … … 844 850 Url: PBURL 845 851 Source: PBREPO/PBSRC 852 #PBPATCHSRC 846 853 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(id -u -n) 847 854 #Requires: PBDEP … … 855 862 %prep 856 863 %setup -q 864 #PBPATCHCMD 857 865 858 866 %build -
devel/pb/lib/ProjectBuilder/Filter.pm
r499 r500 139 139 my $destfile=shift; 140 140 my $pb=shift; 141 my %pb = %$pb;142 141 143 142 pb_log(2,"DEBUG: From $f to $destfile\n"); … … 149 148 foreach my $s (keys %filter) { 150 149 # Process single variables 151 pb_log(2,"DEBUG filter{$s}: $filter{$s}\n");152 150 my $tmp = $filter{$s}; 153 151 next if (not defined $tmp); 152 pb_log(3,"DEBUG filter{$s}: $filter{$s}\n"); 154 153 # Expand variables if any single one found 155 pb_log(2,"DEBUG tmp: $tmp\n");156 154 if ($tmp =~ /\$/) { 155 # Order is important as we need to handle hashes refs before simple vars 156 eval { $tmp =~ s/(\$\w+-\>\{\'\w+\'\})/$1/eeg }; 157 157 eval { $tmp =~ s/(\$\w+)/$1/eeg }; 158 158 eval { $tmp =~ s/(\$\/)/$1/eeg }; 159 159 # special case for ChangeLog only for pb 160 160 } elsif (($s =~ /^PBLOG$/) && ($line =~ /^PBLOG$/)) { 161 my $p = $pb{'defpkgdir'}->{$pbpkg}; 162 $p = $pb{'extpkgdir'}->{$pbpkg} if (not defined $p); 163 pb_changelog($pb{'dtype'}, $pb{'pkg'}, $pb{'ver'}, $pb{'tag'}, $pb{'suf'}, $p, \*DEST, $tmp, $pb{'chglog'}); 161 pb_log(3,"DEBUG filtering PBLOG\n"); 162 my $p = $pb->{'defpkgdir'}->{$pb->{'pkg'}}; 163 $p = $pb->{'extpkgdir'}->{$pb->{'pkg'}} if (not defined $p); 164 pb_changelog($pb->{'dtype'}, $pb->{'pkg'}, $pb->{'ver'}, $pb->{'tag'}, $pb->{'suf'}, $p, \*DEST, $tmp, $pb->{'chglog'}); 164 165 $tmp = ""; 165 166 } elsif (($s =~ /^PBPATCHSRC$/) && ($line =~ /^PBPATCHSRC$/)) { 167 pb_log(3,"DEBUG filtering PBPATCHSRC\n"); 166 168 my $i = 0; 167 foreach my $p (sort @$pb{'patches'}) { 168 print DEST "Patch$i: $p\n"; 169 foreach my $p (split(/,/,$pb->{'patches'}->{$pb->{'tuple'}})) { 170 print DEST "Patch$i: ".basename($p).".gz\n"; 171 $i++; 169 172 } 170 173 $tmp = ""; 171 174 } elsif (($s =~ /^PBPATCHCMD$/) && ($line =~ /^PBPATCHCMD$/)) { 175 pb_log(3,"DEBUG filtering PBPATCHCMD\n"); 172 176 my $i = 0; 173 foreach my $p (sort @$pb{'patches'}) { 174 print DEST "%patch$i\n"; 177 foreach my $p (split(/,/,$pb->{'patches'}->{$pb->{'tuple'}})) { 178 print DEST "%patch$i -p1\n"; 179 $i++; 175 180 } 176 181 print DEST "\n"; … … 204 209 my $destfile=shift; 205 210 my $pb=shift; 206 my %pb = %$pb;207 211 208 212 my $cp = "$ENV{'PBTMP'}/".basename($destfile); 209 copy($destfile,$cp) || die "Unable to c reate$cp";213 copy($destfile,$cp) || die "Unable to copy $destfile to $cp"; 210 214 211 215 pb_filter_file($cp,$ptr,$destfile,$pb);
Note:
See TracChangeset
for help on using the changeset viewer.