summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorOliver Tappe2007-07-10 22:57:27 +0200
committerOliver Tappe2007-07-10 22:57:27 +0200
commitd5113273cf2cefd1db9942e4d743f455aa8f669a (patch)
treef51f0d84dbd40b62b12d6e30479464eba391eff3 /bin
parentAdaptions for Ubu 7.04 and Bugfixes for older Versions (diff)
downloadcore-d5113273cf2cefd1db9942e4d743f455aa8f669a.tar.gz
core-d5113273cf2cefd1db9942e4d743f455aa8f669a.tar.xz
core-d5113273cf2cefd1db9942e4d743f455aa8f669a.zip
* more work towards perlcritic compliance, fixed the low-hanging fruit
for level 4 git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1234 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'bin')
-rwxr-xr-xbin/devel-tools/determineMinimumPackageSet.pl18
-rwxr-xr-xbin/devel-tools/extractTranslations.pl20
-rwxr-xr-xbin/devel-tools/parseSusePatterns.pl25
-rwxr-xr-xbin/slxldd6
-rwxr-xr-xbin/slxsettings8
5 files changed, 48 insertions, 29 deletions
diff --git a/bin/devel-tools/determineMinimumPackageSet.pl b/bin/devel-tools/determineMinimumPackageSet.pl
index 193483ae..e2747674 100755
--- a/bin/devel-tools/determineMinimumPackageSet.pl
+++ b/bin/devel-tools/determineMinimumPackageSet.pl
@@ -11,6 +11,7 @@
# General information about OpenSLX can be found at http://openslx.org/
# -----------------------------------------------------------------------------
use strict;
+use warnings;
my $abstract = q[
determineMinimumPackageSet.pl
@@ -61,12 +62,12 @@ sub slurpFile
{
my $file = shift;
- if (!open(F, "< $file")) {
- die _tr("could not open file '%s' for reading! (%s)", $file, $!);
- }
+ my $fh;
+ open($fh, '<', $file)
+ or die _tr("could not open file '%s' for reading! (%s)", $file, $!);
local $/ = undef;
- my $text = <F>;
- close(F);
+ my $text = <$fh>;
+ close($fh);
return $text;
}
@@ -107,7 +108,11 @@ sub handlePackage
($rpmRes, $rpmOut) = callRpm(qq[rpm -q --provides "$pkgName"]);
my $provides
= join ' ',
- map { s[^\s*(.+?)\s*$][$1]; qq["$_"]; }
+ map {
+ my $rpm = $_;
+ $rpm =~ s[^\s*(.+?)\s*$][$1];
+ qq["$rpm"];
+ }
split "\n", $rpmOut;
($rpmRes, $rpmOut) = callRpm(qq[rpm -q --whatrequires $provides]);
if ($rpmRes == 0) {
@@ -138,6 +143,7 @@ sub determineMinimumPackageSet
print "." unless $verbose;
handlePackage($p);
}
+ return;
}
__END__
diff --git a/bin/devel-tools/extractTranslations.pl b/bin/devel-tools/extractTranslations.pl
index 9bef83c9..eab71f04 100755
--- a/bin/devel-tools/extractTranslations.pl
+++ b/bin/devel-tools/extractTranslations.pl
@@ -15,6 +15,7 @@
# and modules.
# -----------------------------------------------------------------------------
use strict;
+use warnings;
my $abstract = q[
extractTranslations.pl
@@ -32,6 +33,8 @@ use File::Find;
use Getopt::Long;
use Pod::Usage;
+use OpenSLX::Utils;
+
my (
$helpReq,
$show,
@@ -86,11 +89,7 @@ sub ExtractTrStrings
|| $_ eq 'Translations'
|| $_ eq 'devel-tools');
return if -d;
- open(F, "< $_")
- or die "could not open file $_ for reading!";
- local $/ = undef;
- my $text = <F>;
- close(F);
+ my $text = slurpFile($_);
if ($File::Find::name !~ m[\.pm$] && $text !~ m[^#!.+/perl]im) {
# ignore anything other than perl-modules and -scripts
return;
@@ -129,11 +128,7 @@ sub UpdateTrModule
print "updating $File::Find::name...\n";
my $trModule = $_;
my $useKeyAsTranslation = ($trModule eq 'posix.pm');
- open(F, "< $trModule")
- or die "could not open file $trModule for reading!";
- $/ = undef;
- my $text = <F>;
- close(F);
+ my $text = slurpFile($trModule);
if ($text !~ m[%translations\s*=\s*\(\s*(.+)\s*\);]os) {
print "\t*** No translations found - file will be skipped! ***\n";
return;
@@ -188,10 +183,7 @@ sub UpdateTrModule
[$updatedTranslations);]os;
if ($newCount + $delCount) {
chomp $text;
- open(F, "> $trModule")
- or die "could not open file $trModule for writing!";
- print F "$text\n";
- close(F);
+ spitFile($trModule, $text."\n");
print "\tadded $newCount strings, kept $keepCount and removed $delCount.\n";
} else {
print "\tnothing changed\n";
diff --git a/bin/devel-tools/parseSusePatterns.pl b/bin/devel-tools/parseSusePatterns.pl
index 8ccc13da..317a9c47 100755
--- a/bin/devel-tools/parseSusePatterns.pl
+++ b/bin/devel-tools/parseSusePatterns.pl
@@ -15,6 +15,7 @@
# SUSE-pattern-files (*.pat).
# -----------------------------------------------------------------------------
use strict;
+use warnings;
my $abstract = q[
parseSusePatterns.pl
@@ -61,13 +62,14 @@ sub parsePatternFile
my $patternFile = shift;
my $outmost = shift;
- if (!open(PAT, "<$patternFile")) {
+ my $patFH;
+ if (!open($patFH, '<', $patternFile)) {
return unless $outmost;
die "unable to open $patternFile";
}
undef $/;
- my $content = <PAT>;
- close(PAT);
+ my $content = <$patFH>;
+ close($patFH);
$patternNames{$patternFile} = 1;
if ($content =~ m[^\=Sum.de:\s*(.+?)\s*$]ms) {
@@ -88,6 +90,7 @@ sub parsePatternFile
if ($content =~ m[^\+Prc:\s*?$(.+?)^\-Prc:\s*?$]ms) {
addPkgNames($1);
}
+ return;
}
sub addSubPatterns
@@ -96,7 +99,11 @@ sub addSubPatterns
my @subPatterns
= grep { length($_) > 0 }
- map { $_ =~ s[^\s*(.+?)\s*$][$1]; $_ }
+ map {
+ my $pattern = $_;
+ $pattern =~ s[^\s*(.+?)\s*$][$1];
+ $pattern;
+ }
split "\n", $patternNames;
foreach my $subPattern (@subPatterns) {
@@ -105,6 +112,7 @@ sub addSubPatterns
parsePatternFile($subPatternFile);
}
}
+ return;
}
sub addPkgNames
@@ -113,15 +121,18 @@ sub addPkgNames
my @pkgNames
= grep { length($_) > 0 }
- map { $_ =~ s[^\s*(.+?)\s*$][$1]; $_ }
+ map {
+ my $pkg = $_;
+ $pkg =~ s[^\s*(.+?)\s*$][$1];
+ $pkg;
+ }
split "\n", $pkgs;
foreach my $pkgName (@pkgNames) {
$packageNames{$pkgName} = 1;
}
+ return;
}
-__END__
-
=head1 NAME
parseSusePatterns.pl - OpenSLX script to extract a package list from
diff --git a/bin/slxldd b/bin/slxldd
index d2553253..9458fd00 100755
--- a/bin/slxldd
+++ b/bin/slxldd
@@ -111,7 +111,7 @@ sub fetchLoaderConfigFile
while (<$ldconfFH>) {
chomp;
if (/^\s*include\s+(.+?)\s*$/i) {
- foreach my $incFile (<$rootPath$1>) {
+ while (my $incFile = <$rootPath$1>) {
fetchLoaderConfigFile($incFile);
}
next;
@@ -124,6 +124,7 @@ sub fetchLoaderConfigFile
}
close $ldconfFH
or die(_tr("unable to close file '%s' (%s)", $ldConfFile, $!));
+ return;
}
sub fetchLoaderConfig
@@ -152,6 +153,7 @@ sub fetchLoaderConfig
{
push @libFolders, "$rootPath/usr/lib32";
}
+ return;
}
sub addLib
@@ -200,6 +202,7 @@ sub addLib
$libInfo{$lib} = $libPath;
push @filesToDo, $libPath;
}
+ return;
}
sub addLibsForBinary
@@ -273,6 +276,7 @@ sub addLibsForBinary
addLib($1, $bitwidth, $rpath);
}
}
+ return;
}
=head1 NAME
diff --git a/bin/slxsettings b/bin/slxsettings
index 278cb2c2..5aa0dfa3 100755
--- a/bin/slxsettings
+++ b/bin/slxsettings
@@ -161,7 +161,11 @@ sub changedHandler
# invoke a key-specific change handler if it exists:
$key =~ tr[-][_];
- eval { no strict 'refs'; "${key}_changed_handler"->(); };
+
+ no strict 'refs'; ## no critic (ProhibitNoStrict)
+ "${key}_changed_handler"->();
+
+ return;
}
sub private_path_changed_handler
@@ -169,6 +173,8 @@ sub private_path_changed_handler
# create the default config folders (for default system only):
require OpenSLX::ConfigFolder;
OpenSLX::ConfigFolder::createConfigFolderForDefaultSystem();
+
+ return;
}
=head1 NAME