diff -r c8ecf89eb77f -r d879835cfeed build/tools/targets_from_mmp.pl --- a/build/tools/targets_from_mmp.pl Sat Feb 20 00:39:01 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,183 +0,0 @@ -# -# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: -# -#!/usr/bin/perl - -# -# ============================================================================== -# Name : targets_from_mmp.pl -# Description : This script provides search functionality for target components -# from mmp-files found from the environment. -# Version : 1 -# ============================================================================== -# - -use strict; -use Cwd; -use File::Find; - -use Getopt::Std; -use vars qw($opt_o $opt_i $opt_p $opt_s ); - -# ----------------------------------------------------------- -# Check the arguments and if not any or too many print guide. -# ----------------------------------------------------------- -if (( $#ARGV < 0) || ($#ARGV > 5)) -{ - print <$outputfile"); - print "\nWriting targets of mmp-files into \"$outputfile\".\n"; - - find(\&doFind, cwd); -} - -# ---------------------------------------------------- -# If special input file is defined. -# ---------------------------------------------------- -if ($opt_i) -{ - $inputfile = $opt_i; -} -else -{ - $inputfile = "targets_from_mmps.txt"; -} - -# ---------------------------------------------------- -# If component to search is defined in arguments print -# indication of that on screen. -# ---------------------------------------------------- -if ($opt_p) -{ - open (INPUT, $inputfile) or die "\nInputfile \"$inputfile\" not found, please check the filename or scan the environment first!\n"; - #print "\nSearching mmp-file for target \"$opt_p\" from \"$inputfile\"...\n\n"; - - my $found_indicator=0; - - foreach my $line () - { - if ($line =~ m/(.*) : $opt_p/i) - { - print "\n $opt_p -->\n" if ($found_indicator == 0); - $found_indicator++; - print " $1"; - } - } - - print "\nCould not find target \"$opt_p\" from any mmp-file (from \"$inputfile\")!\n" if ($found_indicator == 0); - - print "\n"; - close INPUT; -} - -# -------------------------------------------- -# Function to find the targets from mmp-files. -# -------------------------------------------- -sub doFind -{ - my $file = $File::Find::name; - - $file =~ s,/,\\,g; - return unless -f $file; - - return unless $file =~ /(?i)\.mmp$/; - - open F, $file or return; - #print $file . "\n"; - - if ($file =~ m/^\S:(.*)/i) - { - $file = $1; - } - - my ($line, $foundSomething); - - $foundSomething = "false"; - - while ($line=) - { - if ($line=~ m/^[\s|\t]*(?i)TARGET[\s|\t]+(\S*).*$/) - { - # If output-file is defined print all findings to that. - if ($outputfile) - { - - - print OUTPUT "$file : $1\n"; - } - - # If component to search is defined and found - # print corresponding mmp-file on screen. - - $foundSomething = "true"; - } - } - - if ($foundSomething eq "false") - { - #print "no TARGET found from $file\n"; - } - - close F; -} - -if ($outputfile) -{ - close OUTPUT; -}