Changeset 331 in ProjectBuilder
- Timestamp:
- Mar 2, 2008, 12:25:28 AM (17 years ago)
- Location:
- devel/pb
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/pb/bin/pb
r329 r331 11 11 12 12 use strict 'vars'; 13 use Getopt::Std; 13 use Getopt::Long qw(:config auto_abbrev no_ignore_case); 14 use Pod::Usage; 14 15 use Data::Dumper; 15 16 use English; … … 40 41 my $pbport; # Port to use to connect to the VM 41 42 my $newver; # New version to create 42 my $iso; # ISO i age for the VM to create43 my $iso; # ISO image for the VM to create 43 44 44 45 my @date = pb_get_date(); 45 46 my $pbdate = strftime("%Y-%m-%d", @date); 46 47 47 getopts('a:fhi:l:m:P:p:qr:s:tvV:',\%opts); 48 # --------------------------------------------------------------------------- 49 50 =pod 51 52 =head1 NAME 53 54 pb, aka project-builder.org - builds packages for your projects 55 56 =head1 DESCRIPTION 57 58 pb helps you build various packages directly from your project sources. 59 Those sources could be handled by a CMS (Configuration Management System) 60 such as Subversion, CVS, ... or being a simple reference to a compressed tar file. 61 It's based on a set of configuration files, a set of provided macros to help 62 you keeping build files as generic as possible. For example, a single .spec 63 file should be required to generate for all rpm based distributions, even 64 if you could also have multiple .spec files if required. 65 66 =head1 SYNOPSIS 67 68 pb [-vhq][-r pbroot][-p project][[-s script -a account -P port] -m \"mach-1[,...]\"][-i iso] <action> [<pkg1> ...] 69 70 pb [--verbose][--help][--man][--quiet][--revision pbroot][--project project][[--script script --account account --port port] --machine \"mach-1[,...]\"][--iso iso] <action> [<pkg1> ...] 71 72 =head1 OPTIONS 73 74 =over 4 75 76 =item B<-v|--verbose> 77 78 Print a brief help message and exits. 79 80 =item B<-q|--quiet> 81 82 Do not print any output. 83 84 =item B<-h|--help> 85 86 Print a brief help message and exits. 87 88 =item B<--man> 89 90 Prints the manual page and exits. 91 92 =item B<-m|--machine machine1[,machine2,...]> 93 94 Name of the Virtual Machines (VM) or Virtual Environments (VE) you want to build on (coma separated). 95 All if none precised (or use the env variable PBV). 96 97 =item B<-s|--script script> 98 99 Name of the script you want to execute on the related VMs or VEs. 100 101 =item B<-i|--iso iso_image> 102 103 Name of the ISO image of the distribution you want to install on the related VMs. 104 105 =item B<-a|--account account> 106 107 Name of the account to use to connect on the related VMs. 108 109 =item B<-P|--port port_number> 110 111 Port number to use to connect on the related VMs.\n"; 112 113 =item B<-p|--project project_name> 114 115 Name of the project you're working on (or use the env variable PBPROJ) 116 117 =item B<-r|--revision revision> 118 119 Path Name of the project revision under the CMS (or use the env variable PBROOT) 120 121 =item B<-V|--version new_version> 122 123 New version of the project to create based on the current one. 124 125 =back 126 127 =head1 ARGUMENTS 128 129 <action> can be: 130 131 =over 4 132 133 =item B<cms2build> 134 135 Create tar files for the project under your CMS. 136 CMS supported are SVN and CVS 137 parameters are packages to build 138 if not using default list 139 140 =item B<build2pkg> 141 142 Create packages for your running distribution 143 144 =item B<cms2pkg> 145 146 cms2build + build2pkg 147 148 =item B<build2ssh> 149 150 Send the tar files to a SSH host 151 152 =item B<cms2ssh> 153 154 cms2build + build2ssh 155 156 =item B<pkg2ssh> 157 158 Send the packages built to a SSH host 159 160 =item B<build2vm> 161 162 Create packages in VMs, launching them if needed 163 and send those packages to a SSH host once built 164 VM type supported are QEMU 165 166 =item B<build2ve> 167 168 Create packages in VEs, creating it if needed 169 and send those packages to a SSH host once built 170 171 =item B<cms2vm> 172 173 cms2build + build2vm 174 175 =item B<cms2ve> 176 177 cms2build + build2ve 178 179 =item B<launchvm> 180 181 Launch one virtual machine 182 183 =item B<launchve> 184 185 Launch one virtual environment 186 187 =item B<script2vm> 188 189 Launch one virtual machine if needed 190 and executes a script on it 191 192 =item B<script2ve> 193 194 Execute a script in a virtual environment 195 196 =item B<newvm> 197 198 Create a new virtual machine 199 200 =item B<newve> 201 202 Create a new virtual environment 203 204 =item B<newver> 205 206 Create a new version of the project derived 207 from the current one 208 209 =item B<newproj> 210 211 Create a new project and a template set of 212 configuration files under pbconf 213 214 =back 215 216 <pkgs> can be a list of packages, the keyword 'all' or nothing, in which case the default list of packages is taken (corresponding to the defpkgdir list of arguments in the configuration file). 217 218 =head1 WEB SITES 219 220 The main Web site of the project is available at L<http://www.project-builder.org/>. Bug reports should be filled using the trac instance of the project at L<http://trac.project-builder.org/>. 221 222 =head1 USER MAILING LIST 223 224 None exists for the moment. 225 226 =head1 CONFIGURATION FILES 227 228 Each pb user may have a configuration in F<$HOME/.pbrc>. The values in this file may overwrite any other configuration file value. 229 230 Here is an example of such a configuration file: 231 232 # 233 # Define for each project the URL of its pbconf repository 234 # No default option allowed here as they need to be all different 235 # 236 # URL of the pbconf content 237 # This is the format of a classical URL with the extension of additional schema such as 238 # svn+ssh, cvs+ssh, ... 239 # 240 pbconfurl linuxcoe = cvs+ssh://:ext:bcornec@linuxcoe.cvs.sourceforge.net:/cvsroot/linuxcoe/pbconf 241 242 # This is normaly defined in the project's configuration file 243 # Url of the project 244 # 245 pburl linuxcoe = cvs+ssh://:ext:bcornec@linuxcoe.cvs.sourceforge.net:/cvsroot/linuxcoe 246 247 # All these URLs needs to be defined here as the are the entry point 248 # for how to build packages for the project 249 # 250 pbconfurl pb = svn+ssh://svn.project-builder.org/mondo/svn/pb/pbconf 251 pbconfurl mondorescue = svn+ssh://svn.project-builder.org/mondo/svn/project-builder/mondorescue/pbconf 252 pbconfurl collectl = svn+ssh://bruno@svn.mondorescue.org/mondo/svn/project-builder/collectl/pbconf 253 pbconfurl netperf = svn+ssh://svn.mondorescue.org/mondo/svn/project-builder/netperf/pbconf 254 255 # Under that dir will take place everything related to pb 256 # If you want to use VMs/chroot/..., then use $ENV{'HOME'} to make it portable 257 # to your VMs/chroot/... 258 # if not defined then /var/cache 259 pbdefdir default = $ENV{'HOME'}/project-builder 260 pbdefdir pb = $ENV{'HOME'} 261 pbdefdir linuxcoe = $ENV{'HOME'}/LinuxCOE/cvs 262 pbdefdir mondorescue = $ENV{'HOME'}/mondo/svn 263 264 # pbconfdir points to the directory where the CMS content of the pbconfurl is checked out 265 # If not defined, pbconfdir is under pbdefdir/pbproj/pbconf 266 pbconfdir linuxcoe = $ENV{'HOME'}/LinuxCOE/cvs/pbconf 267 pbconfdir mondorescue = $ENV{'HOME'}/mondo/svn/pbconf 268 269 # pbdir points to the directory where the CMS content of the pburl is checked out 270 # If not defined, pbdir is under pbdefdir/pbproj 271 # Only defined if we have access to the dev of the project 272 pbdir linuxcoe = $ENV{'HOME'}/LinuxCOE/cvs 273 pbdir mondorescue = $ENV{'HOME'}/mondo/svn 274 275 # -daemonize doesn't work with qemu 0.8.2 276 vmopt default = -m 384 277 278 =head1 AUTHORS 279 280 The Project-Builder.org team L<http://trac.project-builder.org/> lead by Bruno Cornec L<mailto:bruno@project-builder.org>. 281 282 =head1 COPYRIGHT 283 284 Project-Builder.org is distributed under the GPL v2.0 license 285 described in the file C<COPYING> included with the distribution. 286 287 =cut 288 289 # --------------------------------------------------------------------------- 290 291 # Old syntax 292 #getopts('a:fhi:l:m:P:p:qr:s:vV:',\%opts); 48 293 49 294 my ($projectbuilderver,$projectbuilderrev) = pb_version_init(); 295 296 GetOptions("help|?|h" => \$opts{'h'}, 297 "man" => \$opts{'man'}, 298 "verbose|v+" => \$opts{'v'}, 299 "quiet|q" => \$opts{'q'}, 300 "log-files|l=s" => \$opts{'l'}, 301 "force|f" => \$opts{'f'}, 302 "account|a=s" => \$opts{'a'}, 303 "revision|r=s" => \$opts{'r'}, 304 "script|s=s" => \$opts{'s'}, 305 "machines|mock|m=s" => \$opts{'m'}, 306 "port|P=i" => \$opts{'P'}, 307 "project|p=s" => \$opts{'p'}, 308 "iso|i=s" => \$opts{'i'}, 309 "version|V=s" => \$opts{'V'}, 310 ) || pb_syntax(-1,0); 311 50 312 if (defined $opts{'h'}) { 51 pb_syntax(); 52 exit(0); 313 pb_syntax(0,1); 314 } 315 if (defined $opts{'man'}) { 316 pb_syntax(0,2); 53 317 } 54 318 if (defined $opts{'v'}) { 55 $debug = 2; 56 #$debug = $opts{'v'}; 319 $debug = $opts{'v'}; 57 320 pb_log(0,"Debug value: $debug\n"); 58 321 } … … 70 333 pb_log_init($debug, $LOG); 71 334 72 # Handles test option73 if (defined $opts{'t'}) {74 $test = "TRUE";75 # Works only for SVN76 $option = "-r BASE";77 }78 79 335 # Handle root of the project if defined 80 336 if (defined $opts{'r'}) { … … 103 359 # Get Action 104 360 $action = shift @ARGV; 105 die pb_syntax( ) if (not defined $action);361 die pb_syntax(-1,1) if (not defined $action); 106 362 107 363 my ($filteredfiles, $supfiles, $defpkgdir, $extpkgdir); … … 170 426 } else { 171 427 pb_log(0,"\'$action\' is not available\n"); 172 pb_syntax( );428 pb_syntax(-2,1); 173 429 } 174 430 … … 177 433 my $ptr = pb_get_pkg($defpkgdir,$extpkgdir); 178 434 @pkgs = @$ptr; 179 my ($scheme,$uri)=pb_cms_init($ENV{'PBPROJ'}); 435 my ($uri) = pb_conf_get("pburl"); 436 my ($scheme, $account, $host, $port, $path) = pb_get_uri($uri->{$ENV{'PBPROJ'}}); 180 437 181 438 # 182 439 # Check project cms compliance 183 440 # 184 pb_cms_compliant("pbdir",'PBDIR',"$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}",$uri,$pbinit); 441 pb_cms_compliant("pbdir",'PBDIR',"$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}",$uri->{$ENV{'PBPROJ'}},$pbinit); 442 443 # Some variable initialization depending on CMS type 444 pb_cms_init($scheme); 185 445 186 446 my ($pkgv, $pkgt) = pb_conf_get_if("pkgver","pkgtag"); … … 225 485 226 486 # If it isn't a flat CMS, then we have the choice to export subdir 227 #$dir = "$uri/$dir" if ($ENV{'PBREVISION'} ne "flat"); 228 pb_cms_export($uri,"$ENV{'PBDIR'}/$pbprojver/$dir",$dest); 487 pb_cms_export($uri->{$ENV{'PBPROJ'}},"$ENV{'PBDIR'}/$pbprojver/$dir",$dest); 229 488 230 489 # Get project info on authors and log file … … 905 1164 my $res = pb_cms_isdiff($scheme); 906 1165 die "You need to have no differences before creating a new version" if ($res != 0); 907 my $cmsurl = pb_cms_get info($scheme,$ENV{'PBROOT'},"URL:");1166 my $cmsurl = pb_cms_get_uri($scheme,$ENV{'PBROOT'}); 908 1167 my $newurl = dirname($cmsurl)."/$newver"; 909 1168 pb_cms_copy($scheme,$cmsurl,$newurl); … … 1141 1400 } 1142 1401 1402 1143 1403 sub pb_syntax { 1144 1404 1145 print "pb (aka project-builder) Version $projectbuilderver-$projectbuilderrev\n"; 1146 print "\n"; 1147 print "Syntax: pb [-vhqt][-r pbroot][-p project][[-s script -a account -P port] -m \"mach-1[,...]\"][-i iso] <action> [<pkg1> ...]\n"; 1148 print "\n"; 1149 print "-h: This help file\n"; 1150 print "-q: Quiet mode\n"; 1151 print "-t: Test mode (not done yet)\n"; 1152 print "-v: Verbose mode\n"; 1153 print "\n"; 1154 print "-m machine: Name of the Virtual Machines (VM) you want\n"; 1155 print " to build on (coma separated). All if none precised\n"; 1156 print " (or use the env variable PBV) \n"; 1157 print "\n"; 1158 print "-s script: Name of the script you want\n"; 1159 print " to execute on the related VMs.\n"; 1160 print "\n"; 1161 print "-i iso: Name of the ISO image of the distribution you want\n"; 1162 print " to install on the related VMs.\n"; 1163 print "\n"; 1164 print "-a account: Name of the account to use\n"; 1165 print " to connect on the related VMs.\n"; 1166 print "\n"; 1167 print "-P port: Port number to use\n"; 1168 print " to connect on the related VMs.\n"; 1169 print "\n"; 1170 print "-p project: Name of the project you're working on\n"; 1171 print " (or use the env variable PBPROJ) \n"; 1172 print "\n"; 1173 print "-r pbroot: Path Name of project under the CMS \n"; 1174 print " (or use the env variable PBROOT) \n"; 1175 print "\n"; 1176 print "-V newver: New version of the project to create\n"; 1177 print " from the current one. \n"; 1178 print "\n"; 1179 print "<action> can be:\n"; 1180 print "\n"; 1181 print "\tcms2build: Create tar files for the project under your CMS\n"; 1182 print "\t CMS supported are SVN and CVS\n"; 1183 print "\t parameters are packages to build\n"; 1184 print "\t if not using default list\n"; 1185 print "\n"; 1186 print "\tbuild2pkg: Create packages for your running distribution \n"; 1187 print "\n"; 1188 print "\tcms2pkg: cms2build + build2pkg\n"; 1189 print "\n"; 1190 print "\tbuild2ssh: Send the tar files to a SSH host \n"; 1191 print "\n"; 1192 print "\tcms2ssh: cms2build + build2ssh\n"; 1193 print "\n"; 1194 print "\tpkg2ssh: Send the packages built to a SSH host \n"; 1195 print "\n"; 1196 print "\tbuild2vm: Create packages in VMs, launching them if needed\n"; 1197 print "\t and send those packages to a SSH host once built\n"; 1198 print "\t VM type supported are QEMU \n"; 1199 print "\n"; 1200 print "\tbuild2ve: Create packages in VEs, creating it if needed\n"; 1201 print "\t and send those packages to a SSH host once built\n"; 1202 print "\n"; 1203 print "\tcms2vm: cms2build + build2vm\n"; 1204 print "\n"; 1205 print "\tcms2ve: cms2build + build2ve\n"; 1206 print "\n"; 1207 print "\tlaunchvm: Launch one virtual machine\n"; 1208 print "\n"; 1209 print "\tlaunchve: Launch one virtual environment\n"; 1210 print "\n"; 1211 print "\tscript2vm: Launch one virtual machine if needed \n"; 1212 print "\t and executes a script on it \n"; 1213 print "\n"; 1214 print "\tscript2ve: Execute a script in a virtual environment \n"; 1215 print "\n"; 1216 print "\tnewvm: Create a new virtual machine\n"; 1217 print "\n"; 1218 print "\tnewve: Create a new virtual environment\n"; 1219 print "\n"; 1220 print "\tnewver: Create a new version of the project derived \n"; 1221 print "\t from the current one \n"; 1222 print "\n"; 1223 print "\tnewproj: Create a new project and a template set of \n"; 1224 print "\t configuration files under pbconf \n"; 1225 print "\n"; 1226 } 1405 my $exit_status = shift || -1; 1406 my $verbose_level = shift || 0; 1407 1408 my $filehandle = \*STDERR; 1409 1410 $filehandle = \*STDOUT if ($exit_status == 0); 1411 1412 pod2usage( { -message => "pb (aka project-builder.org) Version $projectbuilderver-$projectbuilderrev\n", 1413 -exitval => $exit_status , 1414 -verbose => $verbose_level, 1415 -output => $filehandle } ); 1416 } 1417 1418 -
devel/pb/lib/ProjectBuilder/Base.pm
r328 r331 32 32 33 33 our @ISA = qw(Exporter); 34 our @EXPORT = qw(pb_env_init pb_conf_read pb_conf_read_if pb_conf_get pb_conf_get_if pb_cms_init pb_mkdir_p pb_system pb_rm_rf pb_get_filters pb_filter_file pb_filter_file_pb pb_filter_file_inplace pb_cms_export pb_cms_log pb_cms_isdiff pb_cms_copy pb_cms_checkout pb_get_date pb_log pb_log_init pb_get_pkg pb_cms_compliant $debug $LOG);34 our @EXPORT = qw(pb_env_init pb_conf_read pb_conf_read_if pb_conf_get pb_conf_get_if pb_cms_init pb_mkdir_p pb_system pb_rm_rf pb_get_filters pb_filter_file pb_filter_file_pb pb_filter_file_inplace pb_cms_export pb_cms_log pb_cms_isdiff pb_cms_copy pb_cms_checkout pb_get_date pb_log pb_log_init pb_get_pkg pb_cms_compliant pb_get_uri pb_cms_get_uri $debug $LOG); 35 35 36 36 $ENV{'PBETC'} = "$ENV{'HOME'}/.pbrc"; … … 87 87 # Tree will look like this: 88 88 # 89 # maint pbdefdir PBDEFDIR dev dir (optional) PBDEVDIR89 # maint pbdefdir PBDEFDIR dev dir (optional) 90 90 # | | 91 91 # ------------------------ -------------------- 92 92 # | | | | 93 # pbproj1 pbproj2 PBPROJ pbproj1 pbproj2 PBDEVPROJ93 # pbproj1 pbproj2 PBPROJ pbproj1 pbproj2 94 94 # | | 95 95 # --------------------------------------------- ---------- 96 96 # * * * | | | * * 97 # tag dev pbconf ... build delivery PBCONF dev tag PBDEVROOT97 # tag dev pbconf ... build delivery PBCONF dev tag 98 98 # | | | PBDESTDIR | 99 99 # --- ------ pbrc PBBUILDDIR ------- 100 100 # | | | | | 101 # 1.1 dev tag PBROOT 1.0 1.1 101 # 1.1 dev tag PBROOT 1.0 1.1 PBDIR 102 102 # | 103 103 # ------- … … 989 989 sub pb_cms_init { 990 990 991 my $proj = shift || undef; 992 993 # Use the project URI 994 my ($uri) = pb_conf_get("pburl"); 995 996 # Extract values from that URI 997 my ($scheme, $account, $host, $port, $path) = pb_get_uri($uri->{$ENV{'PBPROJ'}}); 991 my $scheme = shift || undef; 998 992 999 993 if ($scheme =~ /^svn/) { 1000 $ENV{'PBREVISION'}= pb_cms_getinfo($scheme,$uri->{$ENV{'PBPROJ'}},"Revision:"); 1001 #$ENV{'PBREVISION'}=`(cd "$ENV{'PBDEVDIR'}" ; svnversion .)`; 994 # svnversion more precise than svn info 995 my $tmp = `(cd "$ENV{'PBDIR'}" ; svnversion .)`; 996 chomp($tmp); 997 $ENV{'PBREVISION'}=$tmp; 1002 998 $ENV{'PBCMSLOGFILE'}="svn.log"; 1003 999 } elsif (($scheme eq "file") || ($scheme eq "ftp") || ($scheme eq "http")) { 1004 1000 $ENV{'PBREVISION'}="flat"; 1005 1001 $ENV{'PBCMSLOGFILE'}="flat.log"; 1006 } elsif ($scheme eq "cvs") {1002 } elsif ($scheme =~ /^cvs/) { 1007 1003 # Way too slow 1008 1004 #$ENV{'PBREVISION'}=`(cd "$ENV{'PBROOT'}" ; cvs rannotate -f . 2>&1 | awk '{print \$1}' | grep -E '^[0-9]' | cut -d. -f2 |sort -nu | tail -1)`; 1009 1005 #chomp($ENV{'PBREVISION'}); 1010 $ENV{'PBREVISION'}=" CVS";1006 $ENV{'PBREVISION'}="cvs"; 1011 1007 $ENV{'PBCMSLOGFILE'}="cvs.log"; 1012 # 1013 # Export content if needed 1014 # 1015 my ($cvsrsh) = pb_conf_get_if("cvsrsh"); 1016 $ENV{'CVS_RSH'} = $cvsrsh->{$proj} if (defined $cvsrsh->{$proj}); 1008 $ENV{'CVS_RSH'} = "ssh" if ($scheme =~ /ssh/); 1017 1009 } else { 1018 1010 die "cms $scheme unknown"; 1019 1011 } 1020 1021 return($scheme,$uri->{$ENV{'PBPROJ'}});1022 1012 } 1023 1013 … … 1099 1089 pb_rm_rf("$destdir/$d0"); 1100 1090 } 1101 } elsif ($scheme eq "cvs") { 1091 } elsif ($scheme =~ /^cvs/) { 1092 # CVS needs a relative path ! 1102 1093 my $dir=dirname($destdir); 1103 1094 my $base=basename($destdir); 1095 # CVS also needs a modules name not a dir 1104 1096 if (-d $source) { 1105 1097 $tmp1 = $source; 1106 1098 $tmp1 =~ s|$ENV{'PBROOT'}/||; 1099 $tmp1 =~ s|$ENV{'PBDIR'}/||; 1107 1100 } else { 1108 1101 $tmp1 = dirname($source); 1109 1102 $tmp1 =~ s|$ENV{'PBROOT'}/||; 1103 $tmp1 =~ s|$ENV{'PBDIR'}/||; 1110 1104 $tmp1 = $tmp1."/".basename($source); 1111 1105 } 1112 # CVS needs a relative path !1113 my ($cvsroot) = pb_conf_get("cvsroot");1114 1106 my $pbdate = strftime("%Y-%m-%d %H:%M:%S", @date); 1115 pb_system("cd $dir ; cvs -d $ cvsroot->{$ENV{'PBPROJ'}}export -D \"$pbdate\" -d $base $tmp1","Exporting $source from CVS to $destdir");1107 pb_system("cd $dir ; cvs -d $account\@$host:$path export -D \"$pbdate\" -d $base $tmp1","Exporting $source from CVS to $destdir"); 1116 1108 } else { 1117 1109 die "cms $scheme unknown"; … … 1168 1160 if (! -f "$dest/ChangeLog") { 1169 1161 if (-x "/usr/bin/svn2cl") { 1162 # In case we have no network, just create an empty one before to allow correct build 1163 open(CL,"> $dest/ChangeLog") || die "Unable to create $dest/ChangeLog"; 1164 close(CL); 1170 1165 pb_system("/usr/bin/svn2cl --group-by-day --authors=$authors -i -o $dest/ChangeLog $pkgdir","Generating ChangeLog from SVN with svn2cl"); 1171 1166 } else { … … 1178 1173 pb_system("echo ChangeLog for $pkgdir > $dest/ChangeLog","Empty ChangeLog file created"); 1179 1174 } 1180 } elsif ($scheme eq "cvs") {1175 } elsif ($scheme =~ /^cvs/) { 1181 1176 my $tmp=basename($pkgdir); 1182 1177 # CVS needs a relative path ! 1183 1178 if (! -f "$dest/ChangeLog") { 1184 1179 if (-x "/usr/bin/cvs2cl") { 1180 # In case we have no network, just create an empty one before to allow correct build 1181 open(CL,"> $dest/ChangeLog") || die "Unable to create $dest/ChangeLog"; 1182 close(CL); 1185 1183 pb_system("/usr/bin/cvs2cl --group-by-day -U $authors -f $dest/ChangeLog $pkgdir","Generating ChangeLog from CVS with cvs2cl"); 1186 1184 } else { … … 1194 1192 } 1195 1193 1196 sub pb_cms_get info{1194 sub pb_cms_get_uri { 1197 1195 1198 1196 my $scheme = shift; 1199 1197 my $dir = shift; 1200 my $info = shift || "URL:";1201 1198 1202 1199 my $res = ""; … … 1206 1203 open(PIPE,"LANGUAGE=C svn info $dir |") || return(""); 1207 1204 while (<PIPE>) { 1208 ($void,$res) = split(/^ $info/) if (/^$info/);1205 ($void,$res) = split(/^URL:/) if (/^URL:/); 1209 1206 } 1210 1207 $res =~ s/^\s*//; … … 1212 1209 chomp($res); 1213 1210 } elsif ($scheme eq "flat") { 1214 } elsif ($scheme eq "cvs") { 1211 $res = "flat"; 1212 } elsif ($scheme =~ /^cvs/) { 1213 # This path is always the root path of CVS, but we may be below 1214 open(FILE,"$dir/CVS/Root") || die "$dir isn't CVS controlled"; 1215 $res = <FILE>; 1216 chomp($res); 1217 close(FILE); 1218 # Find where we are in the tree 1219 my $rdir = $dir; 1220 while ((! -d "$rdir/CVSROOT") && ($rdir ne "/")) { 1221 $rdir = dirname($rdir); 1222 } 1223 die "Unable to find a CVSROOT dir in the parents of $dir" if (! -d "$rdir/CVSROOT"); 1224 #compute our place under that root dir - should be a relative path 1225 $dir =~ s|^$rdir||; 1226 my $suffix = ""; 1227 $suffix = "$dir" if ($dir ne ""); 1228 1229 my $prefix = ""; 1230 if ($scheme =~ /ssh/) { 1231 $prefix = "cvs+ssh://"; 1232 } else { 1233 $prefix = "cvs://"; 1234 } 1235 $res = $prefix.$res.$suffix; 1215 1236 } else { 1216 1237 die "cms $scheme unknown"; … … 1225 1246 my $newurl = shift; 1226 1247 1227 if ($scheme eq "svn") {1248 if ($scheme =~ /^svn/) { 1228 1249 pb_system("svn copy -m \"Creation of $newurl from $oldurl\" $oldurl $newurl","Copying $oldurl to $newurl "); 1229 1250 } elsif ($scheme eq "flat") { 1230 } elsif ($scheme eq "cvs") {1251 } elsif ($scheme =~ /^cvs/) { 1231 1252 } else { 1232 1253 die "cms $scheme unknown"; … … 1242 1263 pb_system("svn co $url $destination","Checking out $url to $destination "); 1243 1264 } elsif ($scheme eq "flat") { 1244 } elsif ($scheme eq "cvs") {1265 } elsif ($scheme =~ /^cvs/) { 1245 1266 } else { 1246 1267 die "cms $scheme unknown"; … … 1253 1274 1254 1275 my $ver = basename($dir); 1255 if ($scheme eq "svn") {1276 if ($scheme =~ /^svn/) { 1256 1277 pb_system("svn ci -m \"Updated to $ver\" $dir","Checking in $dir"); 1257 1278 pb_system("svn up $dir","Updating $dir"); 1258 1279 } elsif ($scheme eq "flat") { 1259 } elsif ($scheme eq "cvs") {1280 } elsif ($scheme =~ /^cvs/) { 1260 1281 } else { 1261 1282 die "cms $scheme unknown"; … … 1266 1287 my $scheme = shift; 1267 1288 1268 if ($scheme eq "svn") {1289 if ($scheme =~ /^svn/) { 1269 1290 open(PIPE,"svn diff $ENV{'PBROOT'} |") || die "Unable to get svn diff from $ENV{'PBROOT'}"; 1270 1291 my $l = 0; … … 1274 1295 return($l); 1275 1296 } elsif ($scheme eq "flat") { 1276 } elsif ($scheme eq "cvs") {1297 } elsif ($scheme =~ /^cvs/) { 1277 1298 } else { 1278 1299 die "cms $scheme unknown"; … … 1529 1550 } else { 1530 1551 pb_log(1,"$uri found locally, checking content\n"); 1531 my $cmsurl = pb_cms_get info($scheme,$ENV{$envar},"URL:");1552 my $cmsurl = pb_cms_get_uri($scheme,$ENV{$envar}); 1532 1553 my ($scheme2, $account2, $host2, $port2, $path2) = pb_get_uri($cmsurl); 1533 1554 if ($cmsurl ne $uri) {
Note:
See TracChangeset
for help on using the changeset viewer.