Changeset 320 in ProjectBuilder for devel/pb/lib
- Timestamp:
- Feb 13, 2008, 6:26:07 PM (16 years ago)
- Location:
- devel/pb/lib/ProjectBuilder
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/pb/lib/ProjectBuilder/Base.pm
r319 r320 12 12 use File::Basename; 13 13 use File::Path; 14 use File::stat; 14 15 use File::Copy; 15 16 use File::Temp qw(tempdir); … … 31 32 32 33 our @ISA = qw(Exporter); 33 our @EXPORT = qw(pb_env_init pb_conf_read 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 $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 $debug $LOG); 34 35 35 36 $ENV{'PBETC'} = "$ENV{'HOME'}/.pbrc"; … … 180 181 181 182 # 183 # The following part is only useful when in cms2build 184 # In VMs/VEs we want to skip that by providing a good PBCONF env var. 185 # return values in that case are useless 186 # 187 return if (defined $ENV{'PBCONF'}); 188 189 # 182 190 # Check pbconf compliance 183 191 # … … 216 224 my $maxmtime = 0; 217 225 foreach my $d (readdir(DIR)) { 226 pb_log(3,"Looking at \'$d\'..."); 218 227 next if ($d =~ /^\./); 219 next if (! -d $d); 220 my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) 221 = stat($d); 228 next if (! -d "$ENV{'PBCONF'}/$d"); 229 my $s = stat("$ENV{'PBCONF'}/$d"); 230 next if (not defined $s); 231 pb_log(3,"KEEP\n"); 222 232 # Keep the most recent 223 pb_log(2," Looking at $d: $mtime\n");224 if ($ mtime > $maxmtime) {233 pb_log(2," $s->mtime\n"); 234 if ($s->mtime > $maxmtime) { 225 235 $ENV{'PBROOT'} = "$ENV{'PBCONF'}/$d"; 226 $maxmtime = $ mtime;236 $maxmtime = $s->mtime; 227 237 } 228 238 } … … 251 261 if ((-f "$ENV{'PBROOT'}/$ENV{'PBPROJ'}.pb") and (not defined $pbinit)) { 252 262 # List of pkg to build by default (mandatory) 253 my ($defpkgdir ) = pb_conf_get("defpkgdir");263 my ($defpkgdir,$pbpackager) = pb_conf_get("defpkgdir","pbpackager"); 254 264 # List of additional pkg to build when all is called (optional) 255 265 # Valid version names (optional) … … 288 298 } 289 299 die "Invalid tag name $ENV{'PBTAG'} in $ENV{'PBROOT'}/$ENV{'PBPROJ'}.pb" if ($ENV{'PBTAG'} !~ /[0-9.]+/); 300 301 302 if (not defined $ENV{'PBPACKAGER'}) { 303 if ((defined $pbpackager) && (defined $pbpackager->{$ENV{'PBPROJ'}})) { 304 $ENV{'PBPACKAGER'}=$pbpackager->{$ENV{'PBPROJ'}}; 305 } else { 306 die "No pbpackager found in $ENV{'PBROOT'}/$ENV{'PBPROJ'}.pb"; 307 } 308 } 290 309 } else { 291 310 if (defined $pbinit) { … … 317 336 # Packager label 318 337 # 319 #p ackager $ENV{'PBPROJ'} = "William Porte <bill\@$ENV{'PBPROJ'}.org>"338 #pbpackager $ENV{'PBPROJ'} = "William Porte <bill\@$ENV{'PBPROJ'}.org>" 320 339 # 321 340 … … 960 979 push @ptr,$h{$param}; 961 980 } 962 pb_log(2,"DEBUG: h:".Dumper(%h)." param:".Dumper(@param)." ptr:".Dumper(@ptr)."\n");963 981 return(@ptr); 964 982 } … … 1055 1073 } else { 1056 1074 $tmp = $destdir."/".basename($source); 1075 pb_mkdir_p($destdir); 1057 1076 } 1058 1077 pb_system("svn export $source $tmp","Exporting $source from SVN to $tmp"); 1059 1078 } elsif ($scheme eq "dir") { 1060 if (-d $source) { 1061 $tmp = $destdir; 1062 } else { 1063 $tmp = $destdir."/".basename($source); 1064 } 1065 pb_system("cp -a $source $tmp","Exporting $source from DIR to $tmp"); 1079 pb_system("cp -a $path $destdir","Copying $uri from DIR to $destdir"); 1066 1080 } elsif (($scheme eq "http") || ($scheme eq "ftp")) { 1067 1081 my $f = basename($path); 1068 1082 unlink "$ENV{'PBTMP'}/$f"; 1069 1083 if (-x "/usr/bin/wget") { 1070 pb_system("/usr/bin/wget -nv -O $ENV{'PBTMP'}/$f $uri"," Downloading $uri with wget to $ENV{'PBTMP'}/$f\n");1084 pb_system("/usr/bin/wget -nv -O $ENV{'PBTMP'}/$f $uri"," "); 1071 1085 } elsif (-x "/usr/bin/curl") { 1072 1086 pb_system("/usr/bin/curl $uri -o $ENV{'PBTMP'}/$f","Downloading $uri with curl to $ENV{'PBTMP'}/$f\n"); … … 1079 1093 my $mm = mimetype($path); 1080 1094 pb_log(2,"mimetype: $mm\n"); 1095 pb_mkdir_p($destdir); 1081 1096 1082 1097 if ($mm =~ /\/x-bzip-compressed-tar$/) { 1083 1098 # tar+bzip2 1099 pb_system("cd $destdir ; tar xfj $path","Extracting $path in $destdir"); 1084 1100 } elsif ($mm =~ /\/x-lzma-compressed-tar$/) { 1085 1101 # tar+lzma 1102 pb_system("cd $destdir ; tar xfY $path","Extracting $path in $destdir"); 1086 1103 } elsif ($mm =~ /\/x-compressed-tar$/) { 1087 1104 # tar+gzip 1105 pb_system("cd $destdir ; tar xfz $path","Extracting $path in $destdir"); 1088 1106 } elsif ($mm =~ /\/x-tar$/) { 1089 1107 # tar 1108 pb_system("cd $destdir ; tar xf $path","Extracting $path in $destdir"); 1090 1109 } elsif ($mm =~ /\/zip$/) { 1091 1110 # zip 1092 } 1093 pb_log(0,"scheme file not implemented yet\n"); 1111 pb_system("cd $destdir ; unzip $path","Extracting $path in $destdir"); 1112 } 1113 # Maybe we created an extra level of dir under destdir 1114 opendir(DIR,$destdir) || die "Unable to open $destdir"; 1115 my $cnt = 0; 1116 my $d0; 1117 foreach my $d (readdir(DIR)) { 1118 pb_log(3,"Looking at \'$d\'..."); 1119 next if ($d =~ /^\./); 1120 $cnt++; 1121 $d0 = $d; 1122 } 1123 closedir(DIR); 1124 # Fix that by moving everything below that extra dir under destdir 1125 # and remove the extra dir 1126 if ($cnt == 1) { 1127 pb_system("cd $destdir/$d0 ; mv * .??* .. 2>/dev/null"); 1128 pb_rm_rf("$destdir/$d0"); 1129 } 1094 1130 } elsif ($scheme eq "cvs") { 1095 1131 my $dir=dirname($destdir); … … 1121 1157 return if ($authors eq "/dev/null"); 1122 1158 open(SAUTH,$authors) || die "Unable to open $authors"; 1123 open(DAUTH,"> $dest/AUTHORS") || die "Unable to create $dest/AUTHORS"; 1159 # Save a potentially existing AUTHORS file and write instead toi AUTHORS.pb 1160 my $ext = ""; 1161 if (-f "$dest/AUTHORS") { 1162 $ext = ".pb"; 1163 } 1164 open(DAUTH,"> $dest/AUTHORS$ext") || die "Unable to create $dest/AUTHORS$ext"; 1124 1165 print DAUTH "Authors of the project are:\n"; 1125 1166 print DAUTH "===========================\n"; … … 1129 1170 print DAUTH "$gcos"; 1130 1171 if (defined $scheme) { 1131 print DAUTH " ($nick under $scheme)\n"; 1172 # Do not give a scheme for flat types 1173 my $endstr=""; 1174 if ("$ENV{'PBREVISION'}" ne "flat") { 1175 $endstr = " under $scheme"; 1176 } 1177 print DAUTH " ($nick$endstr)\n"; 1132 1178 } else { 1133 1179 print DAUTH "\n"; … … 1139 1185 1140 1186 sub pb_cms_log { 1187 1141 1188 my $scheme = shift; 1142 1189 my $pkgdir = shift; … … 1147 1194 pb_create_authors($authors,$dest,$scheme); 1148 1195 1149 if ($scheme eq "svn") {1196 if ($scheme =~ /^svn/) { 1150 1197 if (! -f "$dest/ChangeLog") { 1151 1198 if (-x "/usr/bin/svn2cl") { … … 1156 1203 } 1157 1204 } 1158 } elsif ( $scheme eq "flat") {1205 } elsif (($scheme eq "file") || ($scheme eq "dir") || ($scheme eq "http") || ($scheme eq "ftp")) { 1159 1206 if (! -f "$dest/ChangeLog") { 1160 1207 pb_system("echo ChangeLog for $pkgdir > $dest/ChangeLog","Empty ChangeLog file created"); … … 1222 1269 1223 1270 if ($scheme =~ /^svn/) { 1224 pb_system("svn co $url $destination","Checking $url to $destination ");1271 pb_system("svn co $url $destination","Checking out $url to $destination "); 1225 1272 } elsif ($scheme eq "flat") { 1226 1273 } elsif ($scheme eq "cvs") { -
devel/pb/lib/ProjectBuilder/Changelog.pm
r315 r320 52 52 my $ver; 53 53 my $ver2; 54 my ($packager) = pb_conf_get("p ackager");54 my ($packager) = pb_conf_get("pbpackager"); 55 55 56 56 # If we don't need to do it, or don't have it fake something
Note:
See TracChangeset
for help on using the changeset viewer.