uh_parser/releaseables.pm
changeset 201 2c2dbe93b84b
parent 176 6d3c3db11e72
child 204 604012c39141
equal deleted inserted replaced
200:161402049aa3 201:2c2dbe93b84b
   226 			
   226 			
   227 			$normalized =~ m,^/sf/([^/]+)/([^/]+)/,;
   227 			$normalized =~ m,^/sf/([^/]+)/([^/]+)/,;
   228 			my $layer = $1;
   228 			my $layer = $1;
   229 			my $package = $2;
   229 			my $package = $2;
   230 			
   230 			
   231 			mkdir("$::basedir/releaseables/$layer");
   231 			mkdir("$::releaseablesdir/$layer");
   232 			mkdir("$::basedir/releaseables/$layer/$package");
   232 			mkdir("$::releaseablesdir/$layer/$package");
   233 			
   233 			
   234 			my $filename = "$::basedir/releaseables/$layer/$package/info.tsv";
   234 			my $filename = "$::releaseablesdir/$layer/$package/info.tsv";
       
   235 			my $filenamemissing = "$::raptorbitsdir/$layer\_$package\_missing.txt" if ($::missing);
   235 			
   236 			
   236 			print "Writing info file $filename\n" if (!-f$filename);
   237 			print "Writing info file $filename\n" if (!-f$filename);
   237 			open(FILE, ">>$filename");
   238 			open(FILE, ">>$filename");
       
   239 			open(MISSING, ">>$filenamemissing");
   238 			
   240 			
   239 			for my $filetype (keys %{$whatlog_info->{$bldinf}->{$config}})
   241 			for my $filetype (keys %{$whatlog_info->{$bldinf}->{$config}})
   240 			{
   242 			{
   241 				for (sort(@{$whatlog_info->{$bldinf}->{$config}->{$filetype}}))
   243 				for (sort(@{$whatlog_info->{$bldinf}->{$config}->{$filetype}}))
   242 				{
   244 				{
   243 					print FILE "$_\t$filetype\t$config\n";
   245 					print FILE "$_\t$filetype\t$config\n";
       
   246 					my $file = $_;
       
   247 					
       
   248 					if($::missing && !-f $file)
       
   249 					{
       
   250 					   print MISSING $file."\n";
       
   251                     }
   244 				}
   252 				}
   245 			}
   253 			}
   246 			
   254 			close(FILE);						
   247 			close(FILE);
   255 			close(MISSING) if ($::missing);
       
   256 			
   248 		}
   257 		}
       
   258 	}
       
   259 }
       
   260 sub remove_missing_duplicates
       
   261 {
       
   262 	opendir(DIR, $::raptorbitsdir);
       
   263     my @files = grep((-f "$::raptorbitsdir/$_" && $_ !~ /^\.\.?$/ && $_ =~ /_missing\.txt$/), readdir(DIR));
       
   264     close(DIR);
       
   265 
       
   266 	for my $file (@files)
       
   267 	{
       
   268 		open(FILE, "+<$::raptorbitsdir/$file");	
       
   269 		print "working on $file\n";	
       
   270 	
       
   271 		# Read it
       
   272 		my @content = <FILE>;
       
   273 
       
   274 		# Sort it, and grep to remove duplicates
       
   275 		my $previous = "\n\n";
       
   276 		@content = grep {$_ ne $previous && ($previous = $_, 1) } sort @content;
       
   277 
       
   278 		# Write it
       
   279 		seek(FILE, 0, 0);
       
   280 		print FILE @content;
       
   281 		truncate(FILE,tell(FILE));
       
   282 	
       
   283 		close(FILE);
   249 	}
   284 	}
   250 }
   285 }
   251 
   286 
   252 sub normalize_filepath
   287 sub normalize_filepath
   253 {
   288 {