Commits

Anonymous committed 3b13597

CWS-TOOLING: integrate CWS native201_DEV300

Comments (0)

Files changed (16)

instsetoo_native/inc_ooolangpack/windows/msi_templates/CustomAc.idt

 SetOfficeInstallLocation	51	OFFICEINSTALLLOCATION	[OFFICEDIRECTORYGID]
 SetBasisInstallLocation	51	BASISINSTALLLOCATION	[BASISDIRECTORYGID]
 SetUreInstallLocation	51	UREINSTALLLOCATION	[UREDIRECTORYGID]
+NewProductFound	19		OOO_CUSTOMACTION_1
+SameProductFound	19		OOO_CUSTOMACTION_2

instsetoo_native/inc_ooolangpack/windows/msi_templates/InstallE.idt

 MoveFiles		1900
 MsiPublishAssemblies		3025
 MsiUnpublishAssemblies		875
+NewProductFound	NEWPRODUCTS	110
 PatchFiles		2000
 ProcessComponents		800
 PublishComponents		3000
 RemoveRegistryValues		1300
 RemoveShortcuts		1600
 RMCCPSearch	Not CCP_SUCCESS And CCP_TEST	250
+SameProductFound	SAMEPRODUCTS	120
 ScheduleReboot	ISSCHEDULEREBOOT	3125
 SelfRegModules		2850
 SelfUnregModules		1100

instsetoo_native/inc_ooolangpack/windows/msi_templates/InstallU.idt

 LaunchConditions		50
 MaintenanceWelcome	Installed And Not RESUME And Not Preselected And Not PATCH	750
 MigrateFeatureStates		600
+NewProductFound	NEWPRODUCTS	160
 PatchWelcome	Installed And PATCH And Not IS_MAJOR_UPGRADE	625
 ResolveSource	Not Installed And Not PATCH	525
 RMCCPSearch	Not CCP_SUCCESS And CCP_TEST	300
+SameProductFound	SAMEPRODUCTS	170
 setAllUsersProfile2K	VersionNT >= 500	512
 SetAllUsersProfileNT	VersionNT = 400	511
 SetupCompleteError		-3

instsetoo_native/inc_ooolangpack/windows/msi_templates/Property.idt

 _IsSetupTypeMin	Typical
 AgreeToLicense	No
 ApplicationUsers	AllUsers
+ALLUSERS	1
 ARPCOMMENTS	ARPCOMMENTSTEMPLATE
 ARPCONTACT	OOO_ARPCONTACTTEMPLATE
 ARPHELPLINK	OOO_ARPHELPLINKTEMPLATE
 ProgressType3	installs
 RebootYesNo	Yes
 ReinstallModeText	omus
+SecureCustomProperties	NEWPRODUCTS;SAMEPRODUCTS;OLDPRODUCTS;OLDPRODUCTSSAMEMAJOR
 SetupType	Typical
 STR_NEW_DISPLAY_NAME	OOO_STR_NEW_DISPLAY_NAME
 STR_EDIT	OOO_STR_EDIT

scp2/source/gnome/file_gnome.scp

 #ifdef ENABLE_GIO
 File gid_File_Lib_GIO
     TXT_FILE_BODY;
-    Styles = (PACKED,PATCH);
+    Styles = (PACKED);
     Dir = gid_Dir_Program;
     Name = STRING(CONCAT2(ucpgio1.uno,UNXSUFFIX));
     RegistryID = gid_Starregistry_Services_Rdb;

scp2/source/ooo/file_library_ooo.scp

 
 File gid_File_Lib_Mingwm10
     BIN_FILE_BODY;
-    Styles = (PACKED, PATCH);
+    Styles = (PACKED);
     Dir = gid_Dir_Program;
     Name = "mingwm10.dll";
 End

scp2/source/ooo/file_ooo.scp

 
 File gid_File_Xsl_Common_Measure_Conversion
     TXT_FILE_BODY;
-    Styles = (PACKED, PATCH);
+    Styles = (PACKED);
     Dir = gid_Dir_Share_Xslt_Common;
     Name = "/xslt/common/measure_conversion.xsl";
 End
 
 File gid_File_Xsl_Common_Math_Functions
     TXT_FILE_BODY;
-    Styles = (PACKED, PATCH);
+    Styles = (PACKED);
     Dir = gid_Dir_Share_Xslt_Common;
     Name = "/xslt/common/math.xsl";
 End
 
 File gid_File_Xsl_Export_Common_Body
     TXT_FILE_BODY;
-    Styles = (PACKED, PATCH);
+    Styles = (PACKED);
     Dir = gid_Dir_Share_Xslt_Export_Common;
     Name = "/xslt/export/common/body.xsl";
 End
 
 File gid_File_Xsl_Export_Common_Table_Of_Content
     TXT_FILE_BODY;
-    Styles = (PACKED, PATCH);
+    Styles = (PACKED);
     Dir = gid_Dir_Share_Xslt_Export_Common;
     Name = "/xslt/export/common/table_of_content.xsl";
 End
 
 File gid_File_Xsl_Export_Common_Ooo2ms_Docpr
     TXT_FILE_BODY;
-    Styles = (PACKED, PATCH);
+    Styles = (PACKED);
     Dir = gid_Dir_Share_Xslt_Export_Common;
     Name = "/xslt/export/common/ooo2ms_docpr.xsl";
 End
 
 File gid_File_Xsl_Export_Common_Table_Table
     TXT_FILE_BODY;
-    Styles = (PACKED, PATCH);
+    Styles = (PACKED);
     Dir = gid_Dir_Share_Xslt_Export_Common_Table;
     Name = "/xslt/export/common/table/table.xsl";
 End
 
 File gid_File_Xsl_Export_Common_Table_Table_Columns
     TXT_FILE_BODY;
-    Styles = (PACKED, PATCH);
+    Styles = (PACKED);
     Dir = gid_Dir_Share_Xslt_Export_Common_Table;
     Name = "/xslt/export/common/table/table_columns.xsl";
 End
 
 File gid_File_Xsl_Export_Common_Table_Table_Rows
     TXT_FILE_BODY;
-    Styles = (PACKED, PATCH);
+    Styles = (PACKED);
     Dir = gid_Dir_Share_Xslt_Export_Common_Table;
     Name = "/xslt/export/common/table/table_rows.xsl";
 End

scp2/source/ooo/profile_ooo.scp

     ModuleID = gid_Module_Root;
     Name = PROFILENAME(version);
     Dir = gid_Dir_Program;
+    Styles = (PATCH);
 End
 
 Profile gid_Profile_Fundamentalbasis_Ini

scp2/source/ooo/ure.scp

     ModuleID = gid_Module_Root_Ure_Hidden;
     Name = PROFILENAME(version);
     Dir = gid_Dir_Ure_Bin;
+    Styles = (PATCH);
 End
 
 ProfileItem gid_Ure_Profileitem_Version_Buildid

scp2/source/xsltfilter/file_xsltfilter.scp

 
 File gid_File_Xsl_Export_Xhtml_Body
     TXT_FILE_BODY;
-    Styles = (PACKED, PATCH);
+    Styles = (PACKED);
     Dir = gid_Dir_Share_Xslt_Export_Xhtml;
     Name = "/xslt/export/xhtml/body.xsl";
 End
 
 File gid_File_Xsl_Export_Xhtml_Header
     TXT_FILE_BODY;
-    Styles = (PACKED, PATCH);
+    Styles = (PACKED);
     Dir = gid_Dir_Share_Xslt_Export_Xhtml;
     Name = "/xslt/export/xhtml/header.xsl";
 End
 
 File gid_File_Xsl_Export_Xhtml_Ooo2xhtml
     TXT_FILE_BODY;
-    Styles = (PACKED, PATCH);
+    Styles = (PACKED);
     Dir = gid_Dir_Share_Xslt_Export_Xhtml;
     Name = "/xslt/export/xhtml/opendoc2xhtml.xsl";
 End

setup_native/scripts/javaloader.sh

     java_runtime=$tempdir/$javahome/bin/java
 
     # Make symbolic links to all TrueType font files installed in the system
-    # to avoid garbles for Japanese
-    language=`printenv LANG | cut -c 1-5`
-    if [ x$language = "xja_JP" ]; then
+    # to avoid garbles for Japanese, Korean or Chinese
+    language=`printenv LANG | cut -c 1-3`
+    if [ x$language = "xja_" -o x$language = "xko_" -o x$language = "xzh_" ]; then
 	    font_fallback_dir=$javahome/lib/fonts/fallback
 	    echo "Making symbolic links to TrueType font files into $font_fallback_dir."
 	    mkdir -p $font_fallback_dir
 	    ttf_files=`locate "*.ttf" | xargs`
+        if [ x$ttf_files = "x" ]; then
+            ttf_files=`find /usr/share/fonts/ -name "*ttf"`
+            if [ x$ttf_files = "x" ]; then
+                ttf_files=`find /usr/X11R6/lib/ -name "*ttf"`
+            fi
+        fi
 	    ln -s $ttf_files $font_fallback_dir
     fi
 

setup_native/scripts/linuxpatchscript.sh

 echo
 echo "Searching for the PRODUCTNAMEPLACEHOLDER installation ..."
 
-RPMNAME=`rpm -qa | grep PRODUCTNAMEPLACEHOLDER-core01`
+RPMNAME=`rpm -qa | grep SEARCHPACKAGENAMEPLACEHOLDER`
 
 if [ "x$RPMNAME" != "x" ]
 then
   PRODUCTINSTALLLOCATION="`rpm --query --queryformat "%{INSTALLPREFIX}" $RPMNAME`"
+  FULLPRODUCTINSTALLLOCATION="${PRODUCTINSTALLLOCATION}/PRODUCTDIRECTORYNAME"
 else
   echo "PRODUCTNAMEPLACEHOLDER is not installed"
   exit 1
 
 # Last chance to exit ..
 echo
-read -p "Patching the installation in ${PRODUCTINSTALLLOCATION}. Continue (y/n) ? " -n 1 reply leftover
+read -p "Patching the installation in ${FULLPRODUCTINSTALLLOCATION}. Continue (y/n) ? " -n 1 reply leftover
 echo
 [ "$reply" == "y" ] || exit 1
 
 done
 
 # Save UserInstallation value
-BOOTSTRAPRC="${PRODUCTINSTALLLOCATION}/program/bootstraprc"
+BOOTSTRAPRC="${FULLPRODUCTINSTALLLOCATION}/program/bootstraprc"
 USERINST=`grep UserInstallation ${BOOTSTRAPRC}`
 
-# Check, if searchtoolbar extension rpm is available
-SEARCHTOOLBARRPM=`ls $BASEDIR/RPMS/*.rpm | grep searchtoolbar`
-
-if [ "x$SEARCHTOOLBARRPM" != "x" ]; then
-  # Check, that $RPMLIST does not contain search toolbar rpm (then it is already installed)
-  SEARCHTOOLBARINSTALLED=`grep searchtoolbar ${RPMLIST}`
-
-  if [ "x$SEARCHTOOLBARINSTALLED" == "x" ]; then
-    # Install the search toolbar rpm
-    RPMLIST="$RPMLIST $SEARCHTOOLBARRPM"
-  fi
-fi
-
 # Check, if kde-integration rpm is available
 KDERPM=`ls $BASEDIR/RPMS/*.rpm | grep kde-integration`
 
 rpm --upgrade -v --hash --prefix $PRODUCTINSTALLLOCATION --notriggers $RPMLIST 
 echo
 
-# Check, if online update rpm is available
-ONLINEUPDATERPM=`ls $BASEDIR/RPMS/*.rpm | grep onlineupdate`
-
-if [ "x$ONLINEUPDATERPM" != "x" ]; then
-  # Check, that $RPMLIST does not contain online update rpm (then it is already installed)
-  ONLINEPDATEINSTALLED=`grep onlineupdate ${RPMLIST}`
-
-  if [ "x$ONLINEPDATEINSTALLED" == "x" ]; then
-    # Ask user, if online update shall be installed
-    echo
-    read -p "Do you want to install the new online update feature (y/n) ? " -n 1 reply leftover
-    echo
-    
-    if [ "$reply" == "y" ]; then
-      # Install the online update rpm
-      rpm --install -v --hash --prefix $PRODUCTINSTALLLOCATION --notriggers $ONLINEUPDATERPM
-    fi
-  fi
-fi
-
 # Some RPM versions have problems with -U and --prefix
 if [ ! -f ${BOOTSTRAPRC} ]; then
   echo Update failed due to a bug in RPM, uninstalling ..

solenv/bin/make_installer.pl

 
 		installer::windows::createfolder::create_createfolder_table($directoriesforepmarrayref, $filesinproductlanguageresolvedarrayref, $newidtdir, $allvariableshashref);
 
+		installer::windows::upgrade::create_upgrade_table($newidtdir, $allvariableshashref);
+
 		if ( ! $installer::globals::languagepack )	 # the following tables not for language packs
 		{
 			installer::windows::removefile::create_removefile_table($folderitemsinproductlanguageresolvedarrayref, $newidtdir);
 
 			installer::windows::selfreg::create_selfreg_table($filesinproductlanguageresolvedarrayref, $newidtdir);
 
-			installer::windows::upgrade::create_upgrade_table($newidtdir, $allvariableshashref);
-
 			# Adding Assemblies into the tables MsiAssembly and MsiAssemblyName dynamically
 			installer::windows::assembly::create_msiassembly_table($filesinproductlanguageresolvedarrayref, $newidtdir);
 			installer::windows::assembly::create_msiassemblyname_table($filesinproductlanguageresolvedarrayref, $newidtdir);

solenv/bin/modules/installer/epmfile.pm

 
 sub set_revision_in_pkginfo
 {
-	my ($file, $filename, $variables) = @_;
+	my ($file, $filename, $variables, $packagename) = @_;
 
 	my $revisionstring = "\,REV\=" . $installer::globals::packagerevision;
 	
 	{
 		if ( $variables->{$pkgversion} ne "FINALVERSION" )
 		{
-			my $versionstring = $variables->{$pkgversion};
+			# In OOo 3.x timeframe, this string is no longer unique for all packages, because of the three layer.
+			# In the string: "3.0.0,REV=9.2008.09.30" only the part "REV=9.2008.09.30" can be unique for all packages
+			# and therefore be set as $pkgversion.
+			# The first part "3.0.0" has to be derived from the 
+			
+			my $version = $installer::globals::packageversion;
+			if ( $version =~ /^\s*(\d+)\.(\d+)\.(\d+)\s*$/ )
+			{
+				my $major = $1;
+				my $minor = $2;
+				my $micro = $3;
+				
+				my $finalmajor = $major;
+				my $finalminor = 0;
+				my $finalmicro = 0;
+				
+				if (( $packagename =~ /-ure\s*$/ ) && ( $finalmajor == 1 )) { $finalminor = 4; }
+
+				$version = "$finalmajor.$finalminor.$finalmicro"; 
+			}
+
+			my $versionstring = "$version,$variables->{$pkgversion}";
 
 			for ( my $i = 0; $i <= $#{$file}; $i++ )
 			{
 				$key =~ s/\s*$//;
 
 				if ( ! $allvariables->{$key} ) { installer::exiter::exit_program("ERROR: No Patch info available in zip list file for $key", "set_patchlist_in_pkginfo"); }
-				$newline = $key . "=" . $allvariables->{$key} . "\n";		
+				my $value = set_timestamp_in_patchinfo($allvariables->{$key});
+				$newline = $key . "=" . $value . "\n";		
+
 				add_one_line_into_file($changefile, $newline, $filename);
 			}
 		}
 }
 
 ########################################################
+# Solaris requires, that the time of patch installation
+# must not be empty.
+# Format: Mon Mar 24 11:20:56 PDT 2008
+# Log file: Tue Apr 29 23:26:19 2008 (04:31 min.)
+# Replace string: ${TIMESTAMP}
+########################################################
+
+sub set_timestamp_in_patchinfo
+{
+	my ($value) = @_;
+	
+	my $currenttime = localtime();
+	
+	if ( $currenttime =~ /^\s*(.+?)(\d\d\d\d)\s*$/ )
+	{
+		my $start = $1;
+		my $year = $2;
+		$currenttime = $start . "CET " . $year;
+	}
+	
+	$value =~ s/\$\{TIMESTAMP\}/$currenttime/;
+
+	return $value;
+}
+
+########################################################
 # Setting MAXINST=1000 into the pkginfo file.
 ########################################################
 
 
 	if ( $installer::globals::issolarispkgbuild )
 	{
-		set_revision_in_pkginfo($changefile, $filename, $variableshashref);
+		set_revision_in_pkginfo($changefile, $filename, $variableshashref, $packagename);
 		set_maxinst_in_pkginfo($changefile, $filename);
 		set_solaris_parameter_in_pkginfo($changefile, $filename, $variableshashref);
 		if ( $installer::globals::issolarisx86build ) { fix_architecture_setting($changefile); }
 	my $infoline = "Found  script file $scriptfilename: $$scriptref \n";
 	push( @installer::globals::logfileinfo, $infoline);
 
-#	# Collecting all RPMs in the patch directory
-#
-#	my $fileextension = "rpm";
-#	my $rpmfiles = installer::systemactions::find_file_with_file_extension($fileextension, $newepmdir);
-#	if ( ! ( $#{$rpmfiles} > -1 )) { installer::exiter::exit_program("ERROR: Could not find rpm in directory $newepmdir!", "finalize_linux_patch"); } 
-#	for ( my $i = 0; $i <= $#{$rpmfiles}; $i++ ) { installer::pathanalyzer::make_absolute_filename_to_relative_filename(\${$rpmfiles}[$i]); }
-#
+	# Collecting all RPMs in the patch directory
+
+	my $fileextension = "rpm";
+	my $rpmfiles = installer::systemactions::find_file_with_file_extension($fileextension, $newepmdir);
+	if ( ! ( $#{$rpmfiles} > -1 )) { installer::exiter::exit_program("ERROR: Could not find rpm in directory $newepmdir!", "finalize_linux_patch"); } 
+	for ( my $i = 0; $i <= $#{$rpmfiles}; $i++ ) { installer::pathanalyzer::make_absolute_filename_to_relative_filename(\${$rpmfiles}[$i]); }
+
 #	my $installline = "";
 #
 #	for ( my $i = 0; $i <= $#{$rpmfiles}; $i++ )
 #		${$scriptfile}[$j] =~ s/INSTALLLINES/$installline/;
 #	}
 
+	# Searching packagename containing -core01
+	my $found_package = 0;
+	my $searchpackagename = "";
+	for ( my $i = 0; $i <= $#{$rpmfiles}; $i++ )
+	{
+		if ( ${$rpmfiles}[$i] =~ /-core01-/ )
+		{
+			$searchpackagename = ${$rpmfiles}[$i];
+			$found_package = 1;
+			if ( $searchpackagename =~ /^\s*(.*?-core01)-.*/ ) { $searchpackagename = $1; }
+			last;	
+		}
+	}
+	
+	if ( ! $found_package ) { installer::exiter::exit_program("ERROR: No package containing \"-core01\" found in directory \"$newepmdir\"", "finalize_linux_patch"); }
+
+	# Replacing the searchpackagename
+	for ( my $j = 0; $j <= $#{$scriptfile}; $j++ ) { ${$scriptfile}[$j] =~ s/SEARCHPACKAGENAMEPLACEHOLDER/$searchpackagename/; }
+
+	# Setting the PRODUCTDIRECTORYNAME to $installer::globals::officedirhostname
+	for ( my $j = 0; $j <= $#{$scriptfile}; $j++ ) { ${$scriptfile}[$j] =~ s/PRODUCTDIRECTORYNAME/$installer::globals::officedirhostname/; }
+
 	# Replacing the productname
-
 	my $productname = $allvariables->{'PRODUCTNAME'};
 	$productname = lc($productname);
 	$productname =~ s/ /_/g;	# abc office -> abc_office

solenv/bin/modules/installer/windows/upgrade.pm

 	# fix for problematic OOo 1.9 versions
 	my $include_ooo_fix = 0;
 	my $ooomaxnew = "";
-	if (($installer::globals::product =~ /OpenOffice/i ) && ( ! ( $installer::globals::product =~ /SDK/i )))
+	if (($installer::globals::product =~ /OpenOffice/i ) && ( ! ( $installer::globals::product =~ /SDK/i )) && ( ! $installer::globals::languagepack ))
 	{
 		$include_ooo_fix = 1;
 		$ooomaxnew = "34.0.0";
 	$newline = $installer::globals::upgradecode . "\t" . $installer::globals::msimajorproductversion . "\t" . $installer::globals::msiproductversion . "\t" . "\t" . "257" . "\t" . "\t" . "OLDPRODUCTSSAMEMAJOR" . "\n";
 	push(@upgradetable, $newline);
 
-	if (( ! $installer::globals::patch ) && ( ! $installer::globals::languagepack ))
+	if ( ! $installer::globals::patch )
 	{
 		# preventing downgrading
 		$newline = $installer::globals::upgradecode . "\t" . $installer::globals::msiproductversion . "\t" . $ooomaxnew . "\t" . "\t" . "2" . "\t" . "\t" . "NEWPRODUCTS" . "\n";
 			push(@upgradetable, $newline);
 		}
 
-		if ( $allvariableshashref->{'PATCHUPGRADECODE'} )
-		{
-			$newline = $allvariableshashref->{'PATCHUPGRADECODE'} . "\t" . "\t" . $installer::globals::msiproductversion . "\t" . "\t" . "1" . "\t" . "\t" . "OLDPRODUCTSPATCH" . "\n";
-			push(@upgradetable, $newline);
-
-			$newline = $allvariableshashref->{'PATCHUPGRADECODE'} . "\t" . $installer::globals::msiproductversion . "\t" . "\t" . "\t" . "2" . "\t" . "\t" . "NEWPRODUCTSPATCH" . "\n";
-			push(@upgradetable, $newline);
-
-			$newline = $allvariableshashref->{'PATCHUPGRADECODE'} . "\t" . $installer::globals::msiproductversion . "\t" . "\t" . "\t" . "258" . "\t" . "\t" . "SAMEPRODUCTSPATCH" . "\n";
-			push(@upgradetable, $newline);	
-		}
+		# if (( $allvariableshashref->{'PATCHUPGRADECODE'} ) && ( ! $installer::globals::languagepack ))
+		# {
+		#	$newline = $allvariableshashref->{'PATCHUPGRADECODE'} . "\t" . "\t" . $installer::globals::msiproductversion . "\t" . "\t" . "1" . "\t" . "\t" . "OLDPRODUCTSPATCH" . "\n";
+		#	push(@upgradetable, $newline);
+		#
+		#	$newline = $allvariableshashref->{'PATCHUPGRADECODE'} . "\t" . $installer::globals::msiproductversion . "\t" . "\t" . "\t" . "2" . "\t" . "\t" . "NEWPRODUCTSPATCH" . "\n";
+		#	push(@upgradetable, $newline);
+		#
+		#	$newline = $allvariableshashref->{'PATCHUPGRADECODE'} . "\t" . $installer::globals::msiproductversion . "\t" . "\t" . "\t" . "258" . "\t" . "\t" . "SAMEPRODUCTSPATCH" . "\n";
+		#	push(@upgradetable, $newline);	
+		# }
 		
 		# also searching for the beta
 		
-		if ( $allvariableshashref->{'BETAUPGRADECODE'} )
+		if (( $allvariableshashref->{'BETAUPGRADECODE'} ) && ( ! $installer::globals::languagepack ))
 		{
 			$newline = $allvariableshashref->{'BETAUPGRADECODE'} . "\t" . "1.0" . "\t" . "\t" . "\t" . "1" . "\t" . "\t" . "BETAPRODUCTS" . "\n";
 			push(@upgradetable, $newline);
 
 		# also searching for the stub
 		
-		if ( $allvariableshashref->{'STUBUPGRADECODE'} )
+		if (( $allvariableshashref->{'STUBUPGRADECODE'} ) && ( ! $installer::globals::languagepack ))
 		{
 			$newline = $allvariableshashref->{'STUBUPGRADECODE'} . "\t" . "1.0" . "\t" . "\t" . "\t" . "1" . "\t" . "\t" . "STUBPRODUCTS" . "\n";
 			push(@upgradetable, $newline);
 		
 		# searching for all older patches and languagepacks (defined in a extra file)
 
-		if ( $allvariableshashref->{'REMOVE_UPGRADE_CODE_FILE'} )
+		if (( $allvariableshashref->{'REMOVE_UPGRADE_CODE_FILE'} ) && ( ! $installer::globals::languagepack ))
 		{
 			my $filename = $allvariableshashref->{'REMOVE_UPGRADE_CODE_FILE'};
 			my $langpackcodefilename = $installer::globals::idttemplatepath  . $installer::globals::separator . $filename;

solenv/bin/modules/installer/worker.pm

 	my @patchfile = ();
 	my @lastsection = ();
 	my $lastsection = "program";
+	my $notlastsection = "Basis\\program";
 	my $record = 0;
 
 	for ( my $i = 0; $i <= $#{$patchfilelist}; $i++ )
 
 		if (( $record ) && ( $line =~ /^\s*\[/ )) { $record = 0; }
 
-		if ( $line =~ /^\s*\[\Q$lastsection\E\\\]\s*$/ ) { $record = 1; }
+		if (( $line =~ /^\s*\[\Q$lastsection\E\\\]\s*$/ ) && ( ! ( $line =~ /\Q$notlastsection\E\\\]\s*$/ ))) { $record = 1; }
 
 		if ( $record ) { push(@lastsection, $line); }
 		else { push(@patchfile, $line); }
 	my $lastfilename = "version.ini";
 	my $lastfileline = "";
 	my $foundfile = 0;
-
+	
+	# Only searching this file in the last section
+	my $lastsectionname = "";
+
+	for ( my $i = 0; $i <= $#{$patchfilelist}; $i++ )
+	{
+		my $line = ${$patchfilelist}[$i];	
+		if ( $line =~ /^\s*\[(.*?)\]\s*$/ ) { $lastsectionname = $1; }
+	}
+
+	my $record = 0;
 	for ( my $i = 0; $i <= $#{$patchfilelist}; $i++ )
 	{
 		my $line = ${$patchfilelist}[$i];
-				
-		if ( $line =~ /^\s*\"\Q$lastfilename\E\"\=/ )
+
+		if ( $line =~ /^\s*\[\Q$lastsectionname\E\]\s*$/ ) { $record = 1; }
+
+		if (( $line =~ /^\s*\"\Q$lastfilename\E\"\=/ ) && ( $record ))
 		{
 			$lastfileline = $line;
 			$foundfile = 1;
+			$record = 0;
 			next;
 		}