summaryrefslogtreecommitdiff
path: root/solenv
diff options
context:
space:
mode:
authorAndras Timar <atimar@suse.com>2012-05-15 20:59:18 +0200
committerAndras Timar <atimar@suse.com>2012-05-16 09:12:17 +0200
commit7e90e00f1499eaf4139ed53c2b896f4b4fc73fe5 (patch)
tree7534c456ebc01b7eb62aee07143e450b91ae2682 /solenv
parentbef8e358b6940fd4a976cb346dfd829643e581b8 (diff)
fdo#48914 uninstall process should remove .pyc files from install directory
When install location is writable to user (typical on Windows XP), Python generates .pyc files. We can remove them using the RemoveFile table in MSI. We generate an entry for each .py file in the install set. Change-Id: I314582d52162c6f3ae3acc72de9d620680fb23e0
Diffstat (limited to 'solenv')
-rw-r--r--solenv/bin/make_installer.pl6
-rw-r--r--solenv/bin/modules/installer/globals.pm1
-rw-r--r--solenv/bin/modules/installer/windows/file.pm21
-rw-r--r--solenv/bin/modules/installer/windows/removefile.pm8
4 files changed, 26 insertions, 10 deletions
diff --git a/solenv/bin/make_installer.pl b/solenv/bin/make_installer.pl
index 1413b5fb02ba..06ff6b9d71a4 100644
--- a/solenv/bin/make_installer.pl
+++ b/solenv/bin/make_installer.pl
@@ -1594,12 +1594,12 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ )
# Collection all available directory trees
installer::windows::directory::collectdirectorytrees($directoriesforepmarrayref);
- $filesinproductlanguageresolvedarrayref = installer::windows::file::create_files_table($filesinproductlanguageresolvedarrayref, \@allfilecomponents, $newidtdir, $allvariableshashref, $uniquefilename, $allupdatesequences, $allupdatecomponents, $allupdatefileorder);
- if ( $installer::globals::updatedatabase ) { installer::windows::file::check_file_sequences($allupdatefileorder, $allupdatecomponentorder); }
-
# Attention: The table "Director.idt" contains language specific strings -> parameter: $languagesarrayref !
installer::windows::directory::create_directory_table($directoriesforepmarrayref, $languagesarrayref, $newidtdir, $allvariableshashref, $shortdirname, $loggingdir);
+ $filesinproductlanguageresolvedarrayref = installer::windows::file::create_files_table($filesinproductlanguageresolvedarrayref, $directoriesforepmarrayref, \@allfilecomponents, $newidtdir, $allvariableshashref, $uniquefilename, $allupdatesequences, $allupdatecomponents, $allupdatefileorder);
+ if ( $installer::globals::updatedatabase ) { installer::windows::file::check_file_sequences($allupdatefileorder, $allupdatecomponentorder); }
+
# Attention: The table "Registry.idt" contains language specific strings -> parameter: $languagesarrayref !
installer::windows::registry::create_registry_table($registryitemsinproductlanguageresolvedarrayref, \@allregistrycomponents, $newidtdir, $languagesarrayref, $allvariableshashref);
diff --git a/solenv/bin/modules/installer/globals.pm b/solenv/bin/modules/installer/globals.pm
index fed1453db402..ddc2e2176939 100644
--- a/solenv/bin/modules/installer/globals.pm
+++ b/solenv/bin/modules/installer/globals.pm
@@ -446,6 +446,7 @@ BEGIN
@forced_properties = ("SERVICETAG_PRODUCTNAME", "SERVICETAG_PRODUCTVERSION", "SERVICETAG_PARENTNAME", "SERVICETAG_SOURCE", "SERVICETAG_URN");
@removedirs = ();
+ @removefiletable = ();
@emptypackages = ();
%fontpackageexists = ();
diff --git a/solenv/bin/modules/installer/windows/file.pm b/solenv/bin/modules/installer/windows/file.pm
index 910887669c37..f694fbeff13e 100644
--- a/solenv/bin/modules/installer/windows/file.pm
+++ b/solenv/bin/modules/installer/windows/file.pm
@@ -37,6 +37,7 @@ use installer::worker;
use installer::windows::font;
use installer::windows::idtglobal;
use installer::windows::language;
+use installer::windows::component;
##########################################################################
# Assigning one cabinet file to each file. This is requrired,
@@ -848,7 +849,7 @@ sub collect_shortnames_from_old_database
sub create_files_table
{
- my ($filesref, $allfilecomponentsref, $basedir, $allvariables, $uniquefilenamehashref, $allupdatesequenceshashref, $allupdatecomponentshashref, $allupdatefileorderhashref) = @_;
+ my ($filesref, $dirref, $allfilecomponentsref, $basedir, $allvariables, $uniquefilenamehashref, $allupdatesequenceshashref, $allupdatecomponentshashref, $allupdatefileorderhashref) = @_;
installer::logger::include_timestamp_into_logfile("Performance Info: File Table start");
@@ -876,6 +877,7 @@ sub create_files_table
installer::windows::idtglobal::write_idt_header(\@filetable, "file");
installer::windows::idtglobal::write_idt_header(\@filehashtable, "filehash");
+ installer::windows::idtglobal::write_idt_header(\@installer::globals::removefiletable, "removefile");
for ( my $i = 0; $i <= $#{$filesref}; $i++ )
{
@@ -922,6 +924,23 @@ sub create_files_table
push(@filetable, $oneline);
+ if ( $file{'File'} =~ /\.py$/ )
+ {
+ my %removefile = ();
+
+ $removefile{'FileKey'} = "remove_" . $file{'File'} . "c";
+ $removefile{'Component_'} = $file{'Component_'};
+ $removefile{'FileName'} = $file{'FileName'};
+ $removefile{'FileName'} =~ s/\.py$/.pyc/;
+ $removefile{'FileName'} =~ s/\.PY\|/.PYC|/;
+ $removefile{'DirProperty'} = installer::windows::component::get_file_component_directory($file{'Component_'}, $filesref, $dirref);
+ $removefile{'InstallMode'} = 2; # msiInstallStateAbsent
+ $oneline = $removefile{'FileKey'} . "\t" . $removefile{'Component_'} . "\t" . $removefile{'FileName'} . "\t"
+ . $removefile{'DirProperty'} . "\t" . $removefile{'InstallMode'} . "\n";
+
+ push(@installer::globals::removefiletable, $oneline);
+ }
+
if ( ! $installer::globals::insert_file_at_end ) { push(@allfiles, $onefile); }
# Collecting all component conditions
diff --git a/solenv/bin/modules/installer/windows/removefile.pm b/solenv/bin/modules/installer/windows/removefile.pm
index ec12636ed224..7b302ac1e0e9 100644
--- a/solenv/bin/modules/installer/windows/removefile.pm
+++ b/solenv/bin/modules/installer/windows/removefile.pm
@@ -107,10 +107,6 @@ sub create_removefile_table
{
my ($folderitemsref, $basedir) = @_;
- my @removefiletable = ();
-
- installer::windows::idtglobal::write_idt_header(\@removefiletable, "removefile");
-
# Only the directories created for the FolderItems have to be deleted
# with the information in the table RemoveFile
@@ -137,13 +133,13 @@ sub create_removefile_table
my $oneline = $removefile{'FileKey'} . "\t" . $removefile{'Component_'} . "\t" . $removefile{'FileName'} . "\t"
. $removefile{'DirProperty'} . "\t" . $removefile{'InstallMode'} . "\n";
- push(@removefiletable, $oneline);
+ push(@installer::globals::removefiletable, $oneline);
}
# Saving the file
my $removefiletablename = $basedir . $installer::globals::separator . "RemoveFi.idt";
- installer::files::save_file($removefiletablename ,\@removefiletable);
+ installer::files::save_file($removefiletablename ,\@installer::globals::removefiletable);
my $infoline = "Created idt file: $removefiletablename\n";
push(@installer::globals::logfileinfo, $infoline);