Kaydet (Commit) e161e35f authored tarafından Thomas Arnhold's avatar Thomas Arnhold

installer: Remove packager.pl

This script seems obsolete since:

1d84e9d1

updatepack:
	$(PERL) -w $(SOLARENV)$/bin$/packager.pl

Found it because it calls dmake.

Change-Id: I9cb1c194ed56d1fc8125ae5848190854dfe4d86e
üst 1737ee04
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# This file incorporates work covered by the following license notice:
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed
# with this work for additional information regarding copyright
# ownership. The ASF licenses this file to you under the Apache
# License, Version 2.0 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.apache.org/licenses/LICENSE-2.0 .
#
package packager::check;
use packager::exiter;
use packager::globals;
##############################################
# Check 1: The package list has to exist
##############################################
sub check_packlist
{
my $projectdir = $ENV{'PRJ'};
$projectdir =~ s/$packager::globals::separator\s*$//;
$packager::globals::packlistname = $projectdir . $packager::globals::separator . "util" . $packager::globals::separator . $packager::globals::packlistname;
if ( ! -f $packager::globals::packlistname )
{
packager::exiter::exit_program("ERROR: Package list not found: $packager::globals::packlistname", "check_packlist");
}
}
#############################################################
# Check 2: The environment variable OUTPATH has to be set
#############################################################
sub check_environment
{
if ( ! $ENV{'OUTPATH'} )
{
packager::exiter::exit_program("ERROR: Environment variable OUTPATH not set!", "check_environment");
}
if ( ! $ENV{'PRJ'} )
{
packager::exiter::exit_program("ERROR: Environment variable PRJ not set!", "check_environment");
}
}
#############################################################
# Check 3: Checking the parameter. Only "-i" is valid
#############################################################
sub check_parameter
{
while ( $#ARGV >= 0 )
{
my $param = shift(@ARGV);
if ($param eq "-i") { $packager::globals::ignoreerrors = 1; }
else
{
print("\n*************************************\n");
print("Sorry, unknown parameter: $param");
print("\n*************************************\n");
usage();
exit(-1);
}
}
}
1;
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# This file incorporates work covered by the following license notice:
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed
# with this work for additional information regarding copyright
# ownership. The ASF licenses this file to you under the Apache
# License, Version 2.0 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.apache.org/licenses/LICENSE-2.0 .
#
package packager::exiter;
use packager::files;
use packager::globals;
############################################
# Exiting the program with an error
# This function is used instead of "die"
############################################
sub exit_program
{
my ($message, $function) = @_;
my $infoline;
$infoline = "\n***************************************************************\n";
push(@packager::globals::logfileinfo, $infoline);
print("$infoline");
$infoline = "$message\n";
push(@packager::globals::logfileinfo, $infoline);
print("$infoline");
$infoline = "in function: $function\n";
push(@packager::globals::logfileinfo, $infoline);
print("$infoline");
$infoline = "***************************************************************\n";
push(@packager::globals::logfileinfo, $infoline);
if ( $packager::globals::logging )
{
packager::files::save_file($packager::globals::logfilename ,\@packager::globals::logfileinfo);
print("Saved logfile: $packager::globals::logfilename\n");
}
print("$infoline");
exit(-1);
}
1;
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# This file incorporates work covered by the following license notice:
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed
# with this work for additional information regarding copyright
# ownership. The ASF licenses this file to you under the Apache
# License, Version 2.0 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.apache.org/licenses/LICENSE-2.0 .
#
package packager::files;
use packager::exiter;
############################################
# File Operations
############################################
sub check_file
{
my ($arg) = @_;
if(!( -f $arg ))
{
packager::exiter::exit_program("ERROR: Cannot find file $arg", "check_file");
}
}
sub read_file
{
my ($localfile) = @_;
if ( ! open( IN, $localfile ) ) {
# try again - sometimes we get errors caused by race conditions in parallel builds
sleep 5;
open( IN, $localfile ) or packager::exiter::exit_program("ERROR: Cannot open file: $localfile", "read_file");
}
my @localfile = <IN>;
close( IN );
return \@localfile;
}
###########################################
# Saving files
###########################################
sub save_file
{
my ($savefile, $savecontent) = @_;
open( OUT, ">$savefile" );
print OUT @{$savecontent};
close( OUT);
if (! -f $savefile) { packager::exiter::exit_program("ERROR: Cannot write file: $savefile", "save_file"); }
}
######################################################
# Creating a new direcotory
######################################################
sub create_directory
{
my ($directory) = @_;
my $returnvalue = 1;
if (!(-d $directory))
{
$returnvalue = mkdir($directory, 0775);
if ($returnvalue)
{
$infoline = "\nCreated directory: $directory\n";
push(@packager::globals::logfileinfo, $infoline);
if ($packager::globals::isunix)
{
my $localcall = "chmod 775 $directory \>\/dev\/null 2\>\&1";
system($localcall);
}
}
else
{
packager::exiter::exit_program("ERROR: Could not create directory: $directory", "create_directory");
}
}
}
######################################################
# Removing a complete directory with subdirectories
######################################################
sub remove_complete_directory
{
my ($directory) = @_;
my @content = ();
$directory =~ s/\Q$packager::globals::separator\E\s*$//;
if ( -d $directory )
{
opendir(DIR, $directory);
@content = readdir(DIR);
closedir(DIR);
my $oneitem;
foreach $oneitem (@content)
{
if ((!($oneitem eq ".")) && (!($oneitem eq "..")))
{
my $item = $directory . $packager::globals::separator . $oneitem;
if ( -f $item ) # deleting files
{
unlink($item);
}
if ( -d $item ) # recursive
{
remove_complete_directory($item, 0);
}
}
}
# try to remove empty directory
rmdir $directory;
}
}
1;
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# This file incorporates work covered by the following license notice:
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed
# with this work for additional information regarding copyright
# ownership. The ASF licenses this file to you under the Apache
# License, Version 2.0 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.apache.org/licenses/LICENSE-2.0 .
#
package packager::globals;
############################################
# Global settings
############################################
BEGIN
{
$prog="packager";
$packlistname = "pack.lst";
$compiler = "";
$ignoreerrors = 0;
$logging = 0;
$logfilename = "packager_logfile.log"; # the default logfile name for global errors
@logfileinfo = ();
$plat = $^O;
$separator = "/";
$iswin = 0;
$isunix = 1;
}
1;
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# This file incorporates work covered by the following license notice:
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed
# with this work for additional information regarding copyright
# ownership. The ASF licenses this file to you under the Apache
# License, Version 2.0 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.apache.org/licenses/LICENSE-2.0 .
#
package packager::work;
use strict;
use warnings;
use base 'Exporter';
use packager::exiter;
use packager::globals;
our @EXPORT_OK = qw(
set_global_variable
create_package_todos
execute_system_calls
);
###########################################
# Setting global variables
###########################################
sub set_global_variable
{
my $compiler = $ENV{'OUTPATH'};
if ( $ENV{'PROEXT'} ) { $compiler = $compiler . $ENV{'PROEXT'}; }
$packager::globals::compiler = $compiler;
}
###########################################
# Generating a list of package calls
# corresponding to the package list
###########################################
sub create_package_todos
{
my ( $packagelist ) = @_;
my @targets = (); # only used, if the build server is not used
for my $line ( @{$packagelist} ) {
next if ($line =~ /^\s*\#/); # comment line
my ($product, $compilerlist, $languagelist, $target) =
($line =~ /^\s*(\w+?)\s+(\S+?)\s+(\S+?)\s+(\w+?)\s*$/);
my @compilers = split ',', $compilerlist;
# is the compiler of this "build" part of the compiler list in pack.lst ?
next unless grep { $_ eq $packager::globals::compiler } @compilers;
# products are separated in pack.lst by "|"
# now all information is available to create the targets for the systemcalls
for my $languagestring (split '\|', $languagelist) {
$languagestring =~ s/,/_/g; # comma in pack.lst becomes "_" in dmake command
push @targets, $target . '_' . $languagestring;
}
}
push @packager::globals::logfileinfo, map { $_ . "\n" } @targets;
return \@targets;
}
###########################################
# Executing the generated system calls
###########################################
sub execute_system_calls
{
my ( $targets ) = @_;
for ( my $i = 0; $i <= $#{$targets}; $i++ )
{
my $systemcall = "dmake " . ${$targets}[$i];
my $infoline = "Packager: $systemcall\n";
print $infoline;
push( @packager::globals::logfileinfo, $infoline);
my $returnvalue = system($systemcall);
$infoline = "Packager finished: $systemcall\n";
print $infoline;
push( @packager::globals::logfileinfo, $infoline);
if ( $returnvalue )
{
$infoline = "\nERROR: Packager $systemcall\n";
print $infoline;
push( @packager::globals::logfileinfo, $infoline);
if (!($packager::globals::ignoreerrors)) { packager::exiter::exit_program("ERROR: Packing not successful : $systemcall", "execute_system_calls"); }
}
}
}
1;
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
use strict;
use warnings;
use Test::More;
use lib '.';
BEGIN {
use_ok('packager::work', qw(
set_global_variable
create_package_todos
execute_system_calls
));
}
$packager::globals::compiler = 'gcc';
@packager::globals::logfileinfo = ();
my $packagelist = <<'END';
# Comment
some_product gcc,gcc3.3 en_US,en_GB|fr_FR some_target
other_thing x y z
END
my @packagelist = split "\n", $packagelist;
my $targets = create_package_todos( \@packagelist );
is_deeply(\@packager::globals::logfileinfo,
["some_target_en_US_en_GB\n",
"some_target_fr_FR\n"]);
is_deeply($targets,
["some_target_en_US_en_GB",
"some_target_fr_FR"]);
done_testing();
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# This file incorporates work covered by the following license notice:
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed
# with this work for additional information regarding copyright
# ownership. The ASF licenses this file to you under the Apache
# License, Version 2.0 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.apache.org/licenses/LICENSE-2.0 .
#
use lib ("$ENV{SOLARENV}/bin/modules");
use Cwd;
use packager::check;
use packager::files;
use packager::globals;
use packager::work;
####################################
# Main program
####################################
packager::check::check_environment();
packager::check::check_packlist();
packager::check::check_parameter();
packager::work::set_global_variable();
my $packagelist = packager::files::read_file($packager::globals::packlistname);
my $targets = packager::work::create_package_todos($packagelist);
packager::work::execute_system_calls($targets);
if ( $packager::globals::logging )
{
packager::files::save_file($packager::globals::logfilename, \@packager::globals::logfileinfo);
print "Log file written: $packager::globals::logfilename\n";
}
####################################
# End main program
####################################
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