Kaydet (Commit) 7e90e00f authored tarafından Andras Timar's avatar Andras Timar

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
üst bef8e358
...@@ -1594,12 +1594,12 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) ...@@ -1594,12 +1594,12 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ )
# Collection all available directory trees # Collection all available directory trees
installer::windows::directory::collectdirectorytrees($directoriesforepmarrayref); 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 ! # Attention: The table "Director.idt" contains language specific strings -> parameter: $languagesarrayref !
installer::windows::directory::create_directory_table($directoriesforepmarrayref, $languagesarrayref, $newidtdir, $allvariableshashref, $shortdirname, $loggingdir); 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 ! # Attention: The table "Registry.idt" contains language specific strings -> parameter: $languagesarrayref !
installer::windows::registry::create_registry_table($registryitemsinproductlanguageresolvedarrayref, \@allregistrycomponents, $newidtdir, $languagesarrayref, $allvariableshashref); installer::windows::registry::create_registry_table($registryitemsinproductlanguageresolvedarrayref, \@allregistrycomponents, $newidtdir, $languagesarrayref, $allvariableshashref);
......
...@@ -446,6 +446,7 @@ BEGIN ...@@ -446,6 +446,7 @@ BEGIN
@forced_properties = ("SERVICETAG_PRODUCTNAME", "SERVICETAG_PRODUCTVERSION", "SERVICETAG_PARENTNAME", "SERVICETAG_SOURCE", "SERVICETAG_URN"); @forced_properties = ("SERVICETAG_PRODUCTNAME", "SERVICETAG_PRODUCTVERSION", "SERVICETAG_PARENTNAME", "SERVICETAG_SOURCE", "SERVICETAG_URN");
@removedirs = (); @removedirs = ();
@removefiletable = ();
@emptypackages = (); @emptypackages = ();
%fontpackageexists = (); %fontpackageexists = ();
......
...@@ -37,6 +37,7 @@ use installer::worker; ...@@ -37,6 +37,7 @@ use installer::worker;
use installer::windows::font; use installer::windows::font;
use installer::windows::idtglobal; use installer::windows::idtglobal;
use installer::windows::language; use installer::windows::language;
use installer::windows::component;
########################################################################## ##########################################################################
# Assigning one cabinet file to each file. This is requrired, # Assigning one cabinet file to each file. This is requrired,
...@@ -848,7 +849,7 @@ sub collect_shortnames_from_old_database ...@@ -848,7 +849,7 @@ sub collect_shortnames_from_old_database
sub create_files_table 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"); installer::logger::include_timestamp_into_logfile("Performance Info: File Table start");
...@@ -876,6 +877,7 @@ sub create_files_table ...@@ -876,6 +877,7 @@ sub create_files_table
installer::windows::idtglobal::write_idt_header(\@filetable, "file"); installer::windows::idtglobal::write_idt_header(\@filetable, "file");
installer::windows::idtglobal::write_idt_header(\@filehashtable, "filehash"); 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++ ) for ( my $i = 0; $i <= $#{$filesref}; $i++ )
{ {
...@@ -922,6 +924,23 @@ sub create_files_table ...@@ -922,6 +924,23 @@ sub create_files_table
push(@filetable, $oneline); 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); } if ( ! $installer::globals::insert_file_at_end ) { push(@allfiles, $onefile); }
# Collecting all component conditions # Collecting all component conditions
......
...@@ -107,10 +107,6 @@ sub create_removefile_table ...@@ -107,10 +107,6 @@ sub create_removefile_table
{ {
my ($folderitemsref, $basedir) = @_; my ($folderitemsref, $basedir) = @_;
my @removefiletable = ();
installer::windows::idtglobal::write_idt_header(\@removefiletable, "removefile");
# Only the directories created for the FolderItems have to be deleted # Only the directories created for the FolderItems have to be deleted
# with the information in the table RemoveFile # with the information in the table RemoveFile
...@@ -137,13 +133,13 @@ sub create_removefile_table ...@@ -137,13 +133,13 @@ sub create_removefile_table
my $oneline = $removefile{'FileKey'} . "\t" . $removefile{'Component_'} . "\t" . $removefile{'FileName'} . "\t" my $oneline = $removefile{'FileKey'} . "\t" . $removefile{'Component_'} . "\t" . $removefile{'FileName'} . "\t"
. $removefile{'DirProperty'} . "\t" . $removefile{'InstallMode'} . "\n"; . $removefile{'DirProperty'} . "\t" . $removefile{'InstallMode'} . "\n";
push(@removefiletable, $oneline); push(@installer::globals::removefiletable, $oneline);
} }
# Saving the file # Saving the file
my $removefiletablename = $basedir . $installer::globals::separator . "RemoveFi.idt"; 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"; my $infoline = "Created idt file: $removefiletablename\n";
push(@installer::globals::logfileinfo, $infoline); push(@installer::globals::logfileinfo, $infoline);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment