From 22e595ded4d1bc5bf6b8987ffcdd0f522d1a1bd0 Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Sat, 1 Sep 2012 03:29:58 -0500 Subject: more cleanups --- SBO-Lib/lib/SBO/Lib.pm | 19 ++----------------- sboclean | 1 - sboconfig | 7 +------ sbofind | 1 - sbosnap | 3 --- sboupgrade | 1 - 6 files changed, 3 insertions(+), 29 deletions(-) diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm index c5acbd3..ff3c681 100644 --- a/SBO-Lib/lib/SBO/Lib.pm +++ b/SBO-Lib/lib/SBO/Lib.pm @@ -35,7 +35,6 @@ our @EXPORT = qw( get_sbo_location get_from_info get_tmp_extfn - get_tmp_perlfn $tempdir $conf_dir $conf_file @@ -524,28 +523,14 @@ sub get_pkg_name ($) { REGEX => qr/^Slackware\s+package\s+([^\s]+)\s+created\.$/); } -# clear the close-on-exec bit from a temp file handle -sub clear_coe_bit ($) { - exists $_[0] or script_error 'clear_coe_bit requires an argument'; - my $fh = shift; - fcntl ($fh, F_SETFD, 0) or die "no unset exec-close thingy\n"; - return $fh; -} - # return a filename from a temp fh for use externally sub get_tmp_extfn ($) { exists $_[0] or script_error 'get_tmp_extfn requires an argument.'; - my $fh = clear_coe_bit shift; + my $fh = shift; + fcntl ($fh, F_SETFD, 0) or die "Can't unset exec-on-close bit\n"; return '/dev/fd/'. fileno $fh; } -# return a filename from a temp fh for use internally -sub get_tmp_perlfn ($) { - exists $_[0] or script_error 'get_tmp_perlfn requires an argument.'; - my $fh = clear_coe_bit shift; - return "+<=&". fileno $fh; -} - # prep and run .SlackBuild sub perform_sbo (%) { my %args = ( diff --git a/sboclean b/sboclean index d85b7bc..b5588c7 100755 --- a/sboclean +++ b/sboclean @@ -17,7 +17,6 @@ use File::Basename; use Getopt::Std; use File::Path qw(remove_tree); -#my %config = %SBO::Lib::config; my $self = basename ($0); sub show_usage () { diff --git a/sboconfig b/sboconfig index e993430..c181b29 100755 --- a/sboconfig +++ b/sboconfig @@ -19,7 +19,6 @@ use File::Copy; use File::Path qw(make_path); use File::Temp qw(tempfile);; -#my %config = %SBO::Lib::config; my $self = basename ($0); sub show_usage () { @@ -80,9 +79,6 @@ if (exists $changes{JOBS}) { ($changes{JOBS} =~ /^\d+$/ || $changes{JOBS} eq 'FALSE'); } -#my $conf_dir = $SBO::Lib::conf_dir; -#my $conf_file = $SBO::Lib::conf_file; - # safely modify our conf file; write its contents to a temp file, modify the # temp file, write the contents of the temp file back to the conf file sub config_write ($$) { @@ -92,7 +88,6 @@ sub config_write ($$) { mkdir $conf_dir or die "Unable to create $conf_dir. Exiting.\n"; } if (-f $conf_file) { -# my $tempfh = tempfile (DIR => $SBO::Lib::tempdir); my $tempfh = tempfile (DIR => $tempdir); my $conffh = open_read $conf_file; my $conftents = do {local $/; <$conffh>}; @@ -108,7 +103,7 @@ sub config_write ($$) { untie @temp; # otherwise, append our new $key=$value pair print {$tempfh} "$key=$val\n" unless $has; - # then over the conf file with the contents of the temp file + # then over write the conf file with the contents of the temp file seek $tempfh, 0, 0; my $contents = do {local $/; <$tempfh>}; close $conffh; diff --git a/sbofind b/sbofind index 63ef7e9..180df7a 100755 --- a/sbofind +++ b/sbofind @@ -16,7 +16,6 @@ use SBO::Lib; use File::Basename; use Getopt::Std; -#my %config = %SBO::Lib::config; my $self = basename ($0); sub show_usage () { diff --git a/sbosnap b/sbosnap index d17b8c7..9072941 100755 --- a/sbosnap +++ b/sbosnap @@ -9,8 +9,6 @@ # author: Jacob Pipkin # date: Setting Orange, the 37th day of Discord in the YOLD 3178 # license: WTFPL -# changelog: -# .01: initial creation. use 5.16.0; use strict; @@ -19,7 +17,6 @@ use SBO::Lib; use File::Basename; use Getopt::Std; -#my %config = %SBO::Lib::config; my $sbo_home = $config{SBO_HOME}; my $self = basename ($0); diff --git a/sboupgrade b/sboupgrade index 0403712..842e833 100755 --- a/sboupgrade +++ b/sboupgrade @@ -17,7 +17,6 @@ use File::Basename; use Getopt::Std; use File::Copy; -#my %config = %SBO::Lib::config; my $self = basename ($0); sub show_usage () { -- cgit v1.2.3