From 41fc4d35c0fbd6f27899aecf2405f854a892f102 Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Thu, 1 Nov 2012 21:56:35 -0500 Subject: in get_filename_from_link, added only do the substitution if $filename --- SBO-Lib/lib/SBO/Lib.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'SBO-Lib/lib/SBO/Lib.pm') diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm index 7b9dff7..c7c186b 100644 --- a/SBO-Lib/lib/SBO/Lib.pm +++ b/SBO-Lib/lib/SBO/Lib.pm @@ -366,7 +366,7 @@ sub get_filename_from_link ($) { my $fn = shift; my $regex = qr#/([^/]+)$#; my $filename = $fn =~ $regex ? $distfiles .'/'. ($fn =~ $regex)[0] : undef; - $filename =~ s/%2B/+/g; + $filename =~ s/%2B/+/g if $filename; return $filename; } @@ -771,4 +771,4 @@ sub get_build_queue ($$) { push @build_queue, $sb; } return \@build_queue; -} \ No newline at end of file +} -- cgit v1.2.3 From 942bfa63aec5bd4cc229f44ffe2e2437374cb091 Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Thu, 1 Nov 2012 22:22:18 -0500 Subject: get_build_queue: take an array ref as first arg, make the temp_queue keep state, changes for clarity --- SBO-Lib/lib/SBO/Lib.pm | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'SBO-Lib/lib/SBO/Lib.pm') diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm index c7c186b..ae827de 100644 --- a/SBO-Lib/lib/SBO/Lib.pm +++ b/SBO-Lib/lib/SBO/Lib.pm @@ -754,16 +754,18 @@ sub add_to_queue ($) { # recursively add a sbo's requirements to the build queue. sub get_build_queue ($$) { - unless ($_[0] && $_[1]) { - script_error 'get_build_queue requires two arguments.'; + exists $_[1] or script_error 'get_build_queue requires two arguments.'; + my ($sbos, $warnings) = @_; + state $temp_queue = ['']; + my @build_queue; + for my $sbo (@$sbos) { + my %args = ( + QUEUE => \@temp_queue, + NAME => $sbo, + WARNINGS => $warnings + ); + add_to_queue(\%args); } - my (@temp_queue, @build_queue); - my %args = ( - QUEUE => \@temp_queue, - NAME => $_[0], - WARNINGS => \%{$_[1]} - ); - add_to_queue(\%args); # Remove duplicate entries (leaving first occurrence) my %seen; for my $sb( reverse(@temp_queue) ) { -- cgit v1.2.3 From 8918833a741fb9c9d8331574bd805267276bb211 Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Thu, 1 Nov 2012 22:23:31 -0500 Subject: remove extraneous locations stuff from add_to_queue - get_sbo_location does not return a list --- SBO-Lib/lib/SBO/Lib.pm | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'SBO-Lib/lib/SBO/Lib.pm') diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm index ae827de..c8b844c 100644 --- a/SBO-Lib/lib/SBO/Lib.pm +++ b/SBO-Lib/lib/SBO/Lib.pm @@ -734,11 +734,7 @@ sub add_to_queue ($) { my $sbo = \${$args}{NAME}; return unless $$sbo; push(@{$args}{QUEUE}, $$sbo); - my @locations = get_sbo_location $$sbo; - my $location; - for my $loc (@locations) { - $location = $loc if basename($loc) eq $$sbo; - } + my $location = get_sbo_location $$sbo; return unless $location; my $requires = get_from_info (LOCATION => $location, GET => 'REQUIRES'); for my $req (@$requires) { -- cgit v1.2.3 From da74382cb1def30948c8170ccc1ff5da47f05a66 Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Thu, 1 Nov 2012 22:58:58 -0500 Subject: but fix to state $temp_queue where had an empty element at end, label for loop in get_build_queue, use unshift in add_to_queue instead of reversing array in get_build_queue, label for loop in add_to_queue --- SBO-Lib/lib/SBO/Lib.pm | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'SBO-Lib/lib/SBO/Lib.pm') diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm index c8b844c..24fae5f 100644 --- a/SBO-Lib/lib/SBO/Lib.pm +++ b/SBO-Lib/lib/SBO/Lib.pm @@ -733,12 +733,12 @@ sub add_to_queue ($) { my $args = shift; my $sbo = \${$args}{NAME}; return unless $$sbo; - push(@{$args}{QUEUE}, $$sbo); + unshift @$args{QUEUE}, $$sbo; my $location = get_sbo_location $$sbo; return unless $location; my $requires = get_from_info (LOCATION => $location, GET => 'REQUIRES'); - for my $req (@$requires) { - next if $req eq $$sbo; + FIRST: for my $req (@$requires) { + next FIRST if $req eq $$sbo; if ($req eq "%README%") { ${$args}{WARNINGS}{$$sbo}="%README%"; } else { @@ -752,20 +752,19 @@ sub add_to_queue ($) { sub get_build_queue ($$) { exists $_[1] or script_error 'get_build_queue requires two arguments.'; my ($sbos, $warnings) = @_; - state $temp_queue = ['']; - my @build_queue; + state $temp_queue = [()]; for my $sbo (@$sbos) { my %args = ( - QUEUE => \@temp_queue, + QUEUE => $temp_queue,, NAME => $sbo, WARNINGS => $warnings ); add_to_queue(\%args); } # Remove duplicate entries (leaving first occurrence) - my %seen; - for my $sb( reverse(@temp_queue) ) { - next if $seen{ $sb }++; + my (%seen, @build_queue); + FIRST: for my $sb (@$temp_queue) { + next FIRST if $seen{$sb}++; push @build_queue, $sb; } return \@build_queue; -- cgit v1.2.3 From b73343f9cd0936748b6fe5ecd19a42965bfa52f7 Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Thu, 1 Nov 2012 23:07:18 -0500 Subject: add ability to empty $temp_queue in order to facilitate unit testing --- SBO-Lib/lib/SBO/Lib.pm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'SBO-Lib/lib/SBO/Lib.pm') diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm index 24fae5f..1087fb4 100644 --- a/SBO-Lib/lib/SBO/Lib.pm +++ b/SBO-Lib/lib/SBO/Lib.pm @@ -749,10 +749,11 @@ sub add_to_queue ($) { } # recursively add a sbo's requirements to the build queue. -sub get_build_queue ($$) { +sub get_build_queue ($$;$) { exists $_[1] or script_error 'get_build_queue requires two arguments.'; - my ($sbos, $warnings) = @_; - state $temp_queue = [()]; + my ($sbos, $warnings, $empty) = @_; + state $temp_queue = []; + $temp_queue = [] if $empty; for my $sbo (@$sbos) { my %args = ( QUEUE => $temp_queue,, -- cgit v1.2.3 From ff2c85003c3e64b8f145b6f558b3d63b8e6541bb Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Thu, 1 Nov 2012 23:22:07 -0500 Subject: use my instead of state for $temp_queue, rip out $empty junk --- SBO-Lib/lib/SBO/Lib.pm | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'SBO-Lib/lib/SBO/Lib.pm') diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm index 1087fb4..e9f10d9 100644 --- a/SBO-Lib/lib/SBO/Lib.pm +++ b/SBO-Lib/lib/SBO/Lib.pm @@ -749,11 +749,10 @@ sub add_to_queue ($) { } # recursively add a sbo's requirements to the build queue. -sub get_build_queue ($$;$) { +sub get_build_queue ($$) { exists $_[1] or script_error 'get_build_queue requires two arguments.'; - my ($sbos, $warnings, $empty) = @_; - state $temp_queue = []; - $temp_queue = [] if $empty; + my ($sbos, $warnings) = @_; + my $temp_queue = []; for my $sbo (@$sbos) { my %args = ( QUEUE => $temp_queue,, -- cgit v1.2.3 From 115d15c04a36dd01af39ae99e0ce9016fbba1551 Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Sun, 4 Nov 2012 08:18:04 -0600 Subject: get_sbo_download - no prototype, keep state, deal with either a single scalar or array passed in, return based on wantarray --- SBO-Lib/lib/SBO/Lib.pm | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'SBO-Lib/lib/SBO/Lib.pm') diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm index e9f10d9..21f62c6 100644 --- a/SBO-Lib/lib/SBO/Lib.pm +++ b/SBO-Lib/lib/SBO/Lib.pm @@ -219,17 +219,29 @@ sub get_inst_names ($) { } # search the SLACKBUILDS.TXT for a given sbo's directory -sub get_sbo_location ($) { +sub get_sbo_location { exists $_[0] or script_error 'get_sbo_location requires an argument.'; - my $sbo = shift; - my $regex = qr#LOCATION:\s+\.(/[^/]+/\Q$sbo\E)$#; + my @sbos = @_; + state $loc_store = {}; + # if scalar context and we've already have the location, return it now. + unless (wantarray) { + return $loc_store{$sbos[0]} if exists $loc_store{$sbos[0]}; + } + my %locations; my $fh = open_read $slackbuilds_txt; - while (my $line = <$fh>) { - if (my $loc = ($line =~ $regex)[0]) { - return "$config{SBO_HOME}$loc"; + for my $sbo (@$sbos) { + my $regex = qr#LOCATION:\s+\.(/[^/]+/\Q$sbo\E)$#; + while (my $line = <$fh>) { + if (my $loc = ($line =~ $regex)[0]) { + $loc_store{$sbo} = "$config{SBO_HOME}$loc"; + return $loc_store{$sbo} unless wantarray; + $locations{$sbo} = $loc_store{$sbo}; + } } + seek $fh, 0, 0; } - return; + close $fh; + return %locations; } # pull the sbo name from a $location: $config{SBO_HOME}/system/wine, etc. -- cgit v1.2.3 From 23751d7cf1774684214ce7f210456d74f5eb683a Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Sun, 4 Nov 2012 08:32:03 -0600 Subject: also handle being passed an array ref --- SBO-Lib/lib/SBO/Lib.pm | 2 ++ 1 file changed, 2 insertions(+) (limited to 'SBO-Lib/lib/SBO/Lib.pm') diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm index 21f62c6..4ad01e5 100644 --- a/SBO-Lib/lib/SBO/Lib.pm +++ b/SBO-Lib/lib/SBO/Lib.pm @@ -222,6 +222,7 @@ sub get_inst_names ($) { sub get_sbo_location { exists $_[0] or script_error 'get_sbo_location requires an argument.'; my @sbos = @_; + @sbos = $sbos[0] if ref $sbos[0] eq 'ARRAY'; state $loc_store = {}; # if scalar context and we've already have the location, return it now. unless (wantarray) { @@ -233,6 +234,7 @@ sub get_sbo_location { my $regex = qr#LOCATION:\s+\.(/[^/]+/\Q$sbo\E)$#; while (my $line = <$fh>) { if (my $loc = ($line =~ $regex)[0]) { + # save what we found for later requests $loc_store{$sbo} = "$config{SBO_HOME}$loc"; return $loc_store{$sbo} unless wantarray; $locations{$sbo} = $loc_store{$sbo}; -- cgit v1.2.3 From 35db9c2aaea8d7f7b211bc12609840ea2ef5ac64 Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Sun, 4 Nov 2012 08:48:49 -0600 Subject: use MAKEOPTS for -j instead of hacking the SlackBuild --- SBO-Lib/lib/SBO/Lib.pm | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'SBO-Lib/lib/SBO/Lib.pm') diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm index 4ad01e5..2eb996d 100644 --- a/SBO-Lib/lib/SBO/Lib.pm +++ b/SBO-Lib/lib/SBO/Lib.pm @@ -599,8 +599,6 @@ sub perform_sbo (%) { # set any changes we need to make to the .SlackBuild, setup the command $args{JOBS} = 0 if $args{JOBS} eq 'FALSE'; - $changes{make} = "-j $args{JOBS}" if $args{JOBS}; - if ($args{ARCH} eq 'x86_64' and ($args{C32} || $args{X32})) { if ($args{C32}) { @@ -610,8 +608,9 @@ sub perform_sbo (%) { } $cmd = '. /etc/profile.d/32dev.sh &&'; } - $cmd .= "/bin/sh $location/$sbo.SlackBuild"; - $cmd = "$args{OPTS} $cmd" if $args{OPTS}; + $cmd .= " $args{OPTS}" if $args{OPTS}; + $cmd .= " MAKEOPTS=\"-j$args{JOBS}\"" if $args{JOBS}; + $cmd .= " /bin/sh $location/$sbo.SlackBuild"; my $tempfh = tempfile (DIR => $tempdir); my $fn = get_tmp_extfn $tempfh; rewrite_slackbuild ( -- cgit v1.2.3 From b34346c933cee1a01a3df854becffea2d6f6333b Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Sun, 4 Nov 2012 08:53:47 -0600 Subject: tee the running of the slackbuild instead of the tar and makepkg via editing the slackbuild --- SBO-Lib/lib/SBO/Lib.pm | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) (limited to 'SBO-Lib/lib/SBO/Lib.pm') diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm index 2eb996d..d3ba865 100644 --- a/SBO-Lib/lib/SBO/Lib.pm +++ b/SBO-Lib/lib/SBO/Lib.pm @@ -457,30 +457,19 @@ sub check_multilib () { sub rewrite_slackbuild (%) { my %args = ( SLACKBUILD => '', - TEMPFN => '', CHANGES => {}, @_ ); - unless ($args{SLACKBUILD} && $args{TEMPFN}) { - script_error 'rewrite_slackbuild requires SLACKBUILD and TEMPFN.'; - } + $args{SLACKBUILD} or script_error 'rewrite_slackbuild requires SLACKBUILD.'; my $slackbuild = $args{SLACKBUILD}; my $changes = $args{CHANGES}; copy ($slackbuild, "$slackbuild.orig") or die "Unable to backup $slackbuild to $slackbuild.orig\n"; - my $tar_regex = qr/(un|)tar .*$/; - my $makepkg_regex = qr/makepkg/; my $libdir_regex = qr/^\s*LIBDIRSUFFIX="64"\s*$/; - my $make_regex = qr/^\s*make(| \Q||\E exit 1)$/; my $arch_regex = qr/\$VERSION-\$ARCH-\$BUILD/; # tie the slackbuild, because this is the easiest way to handle this. tie my @sb_file, 'Tie::File', $slackbuild; for my $line (@sb_file) { - # get the output of the tar and makepkg commands. hope like hell that v - # is specified among tar's arguments - if ($line =~ $tar_regex || $line =~ $makepkg_regex) { - $line = "$line | tee -a $args{TEMPFN}"; - } # then check for and apply any other %$changes if (exists $$changes{libdirsuffix}) { $line =~ s/64/$$changes{libdirsuffix}/ if $line =~ $libdir_regex; @@ -613,9 +602,9 @@ sub perform_sbo (%) { $cmd .= " /bin/sh $location/$sbo.SlackBuild"; my $tempfh = tempfile (DIR => $tempdir); my $fn = get_tmp_extfn $tempfh; + $cmd .= " | tee -a $fn"; rewrite_slackbuild ( SLACKBUILD => "$location/$sbo.SlackBuild", - TEMPFN => $fn, CHANGES => \%changes, ); chdir $location, my $out = system $cmd; -- cgit v1.2.3 From 04363616393265d572fb59181a1957f15a1124c1 Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Sun, 4 Nov 2012 10:20:44 -0600 Subject: $loc_store is a reference, call it correctly --- SBO-Lib/lib/SBO/Lib.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'SBO-Lib/lib/SBO/Lib.pm') diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm index d3ba865..92c3f4d 100644 --- a/SBO-Lib/lib/SBO/Lib.pm +++ b/SBO-Lib/lib/SBO/Lib.pm @@ -226,7 +226,7 @@ sub get_sbo_location { state $loc_store = {}; # if scalar context and we've already have the location, return it now. unless (wantarray) { - return $loc_store{$sbos[0]} if exists $loc_store{$sbos[0]}; + return $$loc_store{$sbos[0]} if exists $$loc_store{$sbos[0]}; } my %locations; my $fh = open_read $slackbuilds_txt; @@ -235,9 +235,9 @@ sub get_sbo_location { while (my $line = <$fh>) { if (my $loc = ($line =~ $regex)[0]) { # save what we found for later requests - $loc_store{$sbo} = "$config{SBO_HOME}$loc"; - return $loc_store{$sbo} unless wantarray; - $locations{$sbo} = $loc_store{$sbo}; + $$loc_store{$sbo} = "$config{SBO_HOME}$loc"; + return $$loc_store{$sbo} unless wantarray; + $locations{$sbo} = $$loc_store{$sbo}; } } seek $fh, 0, 0; -- cgit v1.2.3 From a486cef99ec7ad33329e1671533b28cf06980bae Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Sun, 4 Nov 2012 10:21:38 -0600 Subject: @sbos is an array, dont call it as an array ref --- SBO-Lib/lib/SBO/Lib.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'SBO-Lib/lib/SBO/Lib.pm') diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm index 92c3f4d..adea1b3 100644 --- a/SBO-Lib/lib/SBO/Lib.pm +++ b/SBO-Lib/lib/SBO/Lib.pm @@ -230,7 +230,7 @@ sub get_sbo_location { } my %locations; my $fh = open_read $slackbuilds_txt; - for my $sbo (@$sbos) { + for my $sbo (@sbos) { my $regex = qr#LOCATION:\s+\.(/[^/]+/\Q$sbo\E)$#; while (my $line = <$fh>) { if (my $loc = ($line =~ $regex)[0]) { -- cgit v1.2.3 From d7c8d7672c954550a59074382413f89aa3586134 Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Sun, 4 Nov 2012 10:22:24 -0600 Subject: remove last bit of leftover crud from the make -j# thing --- SBO-Lib/lib/SBO/Lib.pm | 3 --- 1 file changed, 3 deletions(-) (limited to 'SBO-Lib/lib/SBO/Lib.pm') diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm index adea1b3..b829a3c 100644 --- a/SBO-Lib/lib/SBO/Lib.pm +++ b/SBO-Lib/lib/SBO/Lib.pm @@ -474,9 +474,6 @@ sub rewrite_slackbuild (%) { if (exists $$changes{libdirsuffix}) { $line =~ s/64/$$changes{libdirsuffix}/ if $line =~ $libdir_regex; } - if (exists $$changes{make}) { - $line =~ s/make/make $$changes{make}/ if $line =~ $make_regex; - } if (exists $$changes{arch_out}) { $line =~ s/\$ARCH/$$changes{arch_out}/ if $line =~ $arch_regex; } -- cgit v1.2.3 From 0513f8c31e01f9696c11babcaf44c55a0fe9199c Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Sun, 4 Nov 2012 10:25:53 -0600 Subject: get_sbo_location should return undef if it finds nothing --- SBO-Lib/lib/SBO/Lib.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'SBO-Lib/lib/SBO/Lib.pm') diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm index b829a3c..b34ba8f 100644 --- a/SBO-Lib/lib/SBO/Lib.pm +++ b/SBO-Lib/lib/SBO/Lib.pm @@ -243,7 +243,7 @@ sub get_sbo_location { seek $fh, 0, 0; } close $fh; - return %locations; + return %locations > 0 ? %locations : undef; } # pull the sbo name from a $location: $config{SBO_HOME}/system/wine, etc. -- cgit v1.2.3 From f32a8fb3fbab6ea530335e4437632c66ace06d8b Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Sun, 4 Nov 2012 10:27:19 -0600 Subject: fix to last fix --- SBO-Lib/lib/SBO/Lib.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'SBO-Lib/lib/SBO/Lib.pm') diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm index b34ba8f..e7c8424 100644 --- a/SBO-Lib/lib/SBO/Lib.pm +++ b/SBO-Lib/lib/SBO/Lib.pm @@ -243,7 +243,7 @@ sub get_sbo_location { seek $fh, 0, 0; } close $fh; - return %locations > 0 ? %locations : undef; + return keys %locations > 0 ? %locations : undef; } # pull the sbo name from a $location: $config{SBO_HOME}/system/wine, etc. -- cgit v1.2.3 From a636f1ac70ad26f4b547b58c3916ca11f2d0ebbe Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Sun, 4 Nov 2012 10:50:16 -0600 Subject: call get_sbo_location correctly for new changes --- SBO-Lib/lib/SBO/Lib.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'SBO-Lib/lib/SBO/Lib.pm') diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm index e7c8424..9774bc9 100644 --- a/SBO-Lib/lib/SBO/Lib.pm +++ b/SBO-Lib/lib/SBO/Lib.pm @@ -297,7 +297,7 @@ sub get_available_updates () { my @updates; my $pkg_list = get_installed_sbos; FIRST: for my $key (keys @$pkg_list) { - my $location = get_sbo_location $$pkg_list[$key]{name}; + my $location = get_sbo_location ($$pkg_list[$key]{name}); # if we can't find a location, assume invalid and skip next FIRST unless defined $location; my $version = get_sbo_version $location; @@ -733,7 +733,7 @@ sub add_to_queue ($) { my $sbo = \${$args}{NAME}; return unless $$sbo; unshift @$args{QUEUE}, $$sbo; - my $location = get_sbo_location $$sbo; + my $location = get_sbo_location ($$sbo); return unless $location; my $requires = get_from_info (LOCATION => $location, GET => 'REQUIRES'); FIRST: for my $req (@$requires) { -- cgit v1.2.3 From d65db2b251e09a1f56bec3aa09ac764e7c7f9d6f Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Sun, 4 Nov 2012 11:11:58 -0600 Subject: fix to check-and-dereference-array-ref logic. passes tests. --- SBO-Lib/lib/SBO/Lib.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'SBO-Lib/lib/SBO/Lib.pm') diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm index 9774bc9..c579e67 100644 --- a/SBO-Lib/lib/SBO/Lib.pm +++ b/SBO-Lib/lib/SBO/Lib.pm @@ -222,7 +222,10 @@ sub get_inst_names ($) { sub get_sbo_location { exists $_[0] or script_error 'get_sbo_location requires an argument.'; my @sbos = @_; - @sbos = $sbos[0] if ref $sbos[0] eq 'ARRAY'; + if (ref $sbos[0] eq 'ARRAY') { + my $tmp = $sbos[0]; + @sbos = @$tmp; + } state $loc_store = {}; # if scalar context and we've already have the location, return it now. unless (wantarray) { -- cgit v1.2.3 From 7697c34d09d9e8d225e9be4a9a7efabd16e3306c Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Sun, 4 Nov 2012 12:37:45 -0600 Subject: ditch prototype for compare_md5s --- SBO-Lib/lib/SBO/Lib.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'SBO-Lib/lib/SBO/Lib.pm') diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm index c579e67..3968c66 100644 --- a/SBO-Lib/lib/SBO/Lib.pm +++ b/SBO-Lib/lib/SBO/Lib.pm @@ -398,7 +398,7 @@ sub compute_md5sum ($) { return $md5sum; } -sub compare_md5s ($$) { +sub compare_md5s { exists $_[1] or script_error 'compare_md5s requires two arguments.'; my ($first, $second) = @_; return $first eq $second ? 1 : undef; @@ -413,7 +413,7 @@ sub verify_distfile ($$) { return unless -d $distfiles; return unless -f $filename; my $md5sum = compute_md5sum $filename; - return compare_md5s $info_md5sum, $md5sum; + return compare_md5s ($info_md5sum, $md5sum); } # for a given distfile, attempt to retrieve it and, if successful, check its @@ -428,7 +428,7 @@ sub get_distfile ($$) { die "Unable to wget $link\n"; my $md5sum = compute_md5sum $filename; # can't do anything if the link in the .info doesn't lead to a good d/l - compare_md5s $md5sum, $exp_md5 or die "md5sum failure for $filename.\n"; + compare_md5s ($md5sum, $exp_md5) or die "md5sum failure for $filename.\n"; return 1; } -- cgit v1.2.3 From 1c0c886cfd56905e44fa87095ba53e854df6895c Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Sun, 4 Nov 2012 12:41:40 -0600 Subject: rename $multi variable to more descriptive $multilib --- SBO-Lib/lib/SBO/Lib.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'SBO-Lib/lib/SBO/Lib.pm') diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm index 3968c66..3190ad1 100644 --- a/SBO-Lib/lib/SBO/Lib.pm +++ b/SBO-Lib/lib/SBO/Lib.pm @@ -641,18 +641,18 @@ sub do_slackbuild (%) { my $location = $args{LOCATION}; my $sbo = get_sbo_from_loc $location; my $arch = get_arch; - my $multi = check_multilib; + my $multilib = check_multilib; my $version = get_sbo_version $location; my $x32; # ensure x32 stuff is set correctly, or that we're setup for it if ($args{COMPAT32}) { - die "compat32 requires multilib.\n" unless $multi; + die "compat32 requires multilib.\n" unless $multilib; die "compat32 requires /usr/sbin/convertpkg-compat32.\n" unless -f '/usr/sbin/convertpkg-compat32'; } else { if ($arch eq 'x86_64') { $x32 = check_x32 $args{LOCATION}; - if ($x32 && ! $multi) { + if ($x32 && ! $multilib) { die "$sbo is 32-bit which requires multilib on x86_64.\n"; } } -- cgit v1.2.3 From 9000e498363367a97e01f5e116df6be20c82c497 Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Sun, 4 Nov 2012 12:53:44 -0600 Subject: remove compare_md5s sub, call verify_distfile from get_distfile instead of comparing in both places --- SBO-Lib/lib/SBO/Lib.pm | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'SBO-Lib/lib/SBO/Lib.pm') diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm index 3190ad1..b1aa75c 100644 --- a/SBO-Lib/lib/SBO/Lib.pm +++ b/SBO-Lib/lib/SBO/Lib.pm @@ -398,12 +398,6 @@ sub compute_md5sum ($) { return $md5sum; } -sub compare_md5s { - exists $_[1] or script_error 'compare_md5s requires two arguments.'; - my ($first, $second) = @_; - return $first eq $second ? 1 : undef; -} - # for a given distfile, see whether or not it exists, and if so, if its md5sum # matches the sbo's .info file sub verify_distfile ($$) { @@ -413,14 +407,14 @@ sub verify_distfile ($$) { return unless -d $distfiles; return unless -f $filename; my $md5sum = compute_md5sum $filename; - return compare_md5s ($info_md5sum, $md5sum); + return $info_md5 eq $md5sum ? 1 : 0; } # for a given distfile, attempt to retrieve it and, if successful, check its # md5sum against that in the sbo's .info file sub get_distfile ($$) { exists $_[1] or script_error 'get_distfile requires an argument'; - my ($link, $exp_md5) = @_; + my ($link, $info_md5) = @_; my $filename = get_filename_from_link $link; mkdir $distfiles unless -d $distfiles; chdir $distfiles; @@ -428,7 +422,8 @@ sub get_distfile ($$) { die "Unable to wget $link\n"; my $md5sum = compute_md5sum $filename; # can't do anything if the link in the .info doesn't lead to a good d/l - compare_md5s ($md5sum, $exp_md5) or die "md5sum failure for $filename.\n"; + verify_distfile ($link, $info_md5) ? return 1 + : die "md5sum failure for $filename.\n"; return 1; } -- cgit v1.2.3 From e8d07426f592040e945709c1bc574ea3283343f2 Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Sun, 4 Nov 2012 12:55:53 -0600 Subject: rename $info_md5sum to equally clear but more concise $info_md5 --- SBO-Lib/lib/SBO/Lib.pm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'SBO-Lib/lib/SBO/Lib.pm') diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm index b1aa75c..2f5eac6 100644 --- a/SBO-Lib/lib/SBO/Lib.pm +++ b/SBO-Lib/lib/SBO/Lib.pm @@ -402,7 +402,7 @@ sub compute_md5sum ($) { # matches the sbo's .info file sub verify_distfile ($$) { exists $_[1] or script_error 'verify_distfile requires two arguments.'; - my ($link, $info_md5sum) = @_; + my ($link, $info_md5) = @_; my $filename = get_filename_from_link $link; return unless -d $distfiles; return unless -f $filename; @@ -420,7 +420,6 @@ sub get_distfile ($$) { chdir $distfiles; system ("wget --no-check-certificate $link") == 0 or die "Unable to wget $link\n"; - my $md5sum = compute_md5sum $filename; # can't do anything if the link in the .info doesn't lead to a good d/l verify_distfile ($link, $info_md5) ? return 1 : die "md5sum failure for $filename.\n"; -- cgit v1.2.3 From 89e350f22d044f8073670db354832e3043e710e6 Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Sun, 4 Nov 2012 13:30:41 -0600 Subject: removed superfluous "return unless -d $distfiles;" from verify_distfile subroutine --- SBO-Lib/lib/SBO/Lib.pm | 1 - 1 file changed, 1 deletion(-) (limited to 'SBO-Lib/lib/SBO/Lib.pm') diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm index 2f5eac6..b1ce1b7 100644 --- a/SBO-Lib/lib/SBO/Lib.pm +++ b/SBO-Lib/lib/SBO/Lib.pm @@ -404,7 +404,6 @@ sub verify_distfile ($$) { exists $_[1] or script_error 'verify_distfile requires two arguments.'; my ($link, $info_md5) = @_; my $filename = get_filename_from_link $link; - return unless -d $distfiles; return unless -f $filename; my $md5sum = compute_md5sum $filename; return $info_md5 eq $md5sum ? 1 : 0; -- cgit v1.2.3 From 9ba90c245c82b5ff12fd0a9301440c17339fe4c0 Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Sun, 4 Nov 2012 13:34:14 -0600 Subject: comment typo fix: computer -> compute --- SBO-Lib/lib/SBO/Lib.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'SBO-Lib/lib/SBO/Lib.pm') diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm index b1ce1b7..3b1e2a5 100644 --- a/SBO-Lib/lib/SBO/Lib.pm +++ b/SBO-Lib/lib/SBO/Lib.pm @@ -387,7 +387,7 @@ sub get_filename_from_link ($) { return $filename; } -# for a given file, computer its md5sum +# for a given file, compute its md5sum sub compute_md5sum ($) { -f $_[0] or script_error 'compute_md5sum requires a file argument.'; my $fh = open_read shift; -- cgit v1.2.3 From b44271a81f96a195c2f7540b86899e00f5028b89 Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Sun, 4 Nov 2012 13:50:02 -0600 Subject: clean up a comment and remove so superfluous code --- SBO-Lib/lib/SBO/Lib.pm | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'SBO-Lib/lib/SBO/Lib.pm') diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm index 3b1e2a5..ba7eb19 100644 --- a/SBO-Lib/lib/SBO/Lib.pm +++ b/SBO-Lib/lib/SBO/Lib.pm @@ -329,13 +329,7 @@ sub get_download_info (%) { $downs = get_from_info (LOCATION => $args{LOCATION}, GET => $get); # did we get nothing back, or UNSUPPORTED/UNTESTED? if ($args{X64}) { - my $nothing; - if (! $$downs[0]) { - $nothing++; - } elsif ($$downs[0] =~ qr/^UN(SUPPOR|TES)TED$/) { - $nothing++; - } - if ($nothing) { + if (! $$downs[0] || $$downs[0] =~ qr/^UN(SUPPOR|TES)TED$/) { $args{X64} = 0; $downs = get_from_info (LOCATION => $args{LOCATION}, GET => 'DOWNLOAD'); @@ -377,7 +371,7 @@ sub get_sbo_downloads (%) { return %dl_info; } -# given a link, grab the filename from the end of it +# given a link, grab the filename from it and prepend $distfiles sub get_filename_from_link ($) { exists $_[0] or script_error 'get_filename_from_link requires an argument'; my $fn = shift; -- cgit v1.2.3 From 1f448412a2dadf308689e40d9694a109e510e835 Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Sun, 4 Nov 2012 14:01:12 -0600 Subject: make get_sbo_location state-keeping more correct, rename $loc_store to $store --- SBO-Lib/lib/SBO/Lib.pm | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'SBO-Lib/lib/SBO/Lib.pm') diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm index ba7eb19..e33296c 100644 --- a/SBO-Lib/lib/SBO/Lib.pm +++ b/SBO-Lib/lib/SBO/Lib.pm @@ -226,21 +226,22 @@ sub get_sbo_location { my $tmp = $sbos[0]; @sbos = @$tmp; } - state $loc_store = {}; + state $store = {}; # if scalar context and we've already have the location, return it now. unless (wantarray) { - return $$loc_store{$sbos[0]} if exists $$loc_store{$sbos[0]}; + return $$store{$sbos[0]} if exists $$store{$sbos[0]}; } my %locations; my $fh = open_read $slackbuilds_txt; - for my $sbo (@sbos) { + FIRST: for my $sbo (@sbos) { + $locations{$sbo} = $store{$sbo}, next FIRST if exists $$store{$sbo}; my $regex = qr#LOCATION:\s+\.(/[^/]+/\Q$sbo\E)$#; while (my $line = <$fh>) { if (my $loc = ($line =~ $regex)[0]) { # save what we found for later requests - $$loc_store{$sbo} = "$config{SBO_HOME}$loc"; - return $$loc_store{$sbo} unless wantarray; - $locations{$sbo} = $$loc_store{$sbo}; + $$store{$sbo} = "$config{SBO_HOME}$loc"; + return $$store{$sbo} unless wantarray; + $locations{$sbo} = $$store{$sbo}; } } seek $fh, 0, 0; -- cgit v1.2.3 From 94c934d913a4ac9e282f0b681cec6fc246eff360 Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Sun, 4 Nov 2012 14:03:29 -0600 Subject: bug fix to last thing, and rename $vars to $store in get_from_info for consistency with get_sbo_location state variable --- SBO-Lib/lib/SBO/Lib.pm | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'SBO-Lib/lib/SBO/Lib.pm') diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm index e33296c..dfe0c60 100644 --- a/SBO-Lib/lib/SBO/Lib.pm +++ b/SBO-Lib/lib/SBO/Lib.pm @@ -234,7 +234,7 @@ sub get_sbo_location { my %locations; my $fh = open_read $slackbuilds_txt; FIRST: for my $sbo (@sbos) { - $locations{$sbo} = $store{$sbo}, next FIRST if exists $$store{$sbo}; + $locations{$sbo} = $$store{$sbo}, next FIRST if exists $$store{$sbo}; my $regex = qr#LOCATION:\s+\.(/[^/]+/\Q$sbo\E)$#; while (my $line = <$fh>) { if (my $loc = ($line =~ $regex)[0]) { @@ -266,26 +266,26 @@ sub get_from_info (%) { unless ($args{LOCATION} && $args{GET}) { script_error 'get_from_info requires LOCATION and GET.'; } - state $vars = {PRGNAM => ['']}; + state $store = {PRGNAM => ['']}; my $sbo = get_sbo_from_loc $args{LOCATION}; - return $$vars{$args{GET}} if $$vars{PRGNAM}[0] eq $sbo; + return $$store{$args{GET}} if $$store{PRGNAM}[0] eq $sbo; # if we're here, we haven't read in the .info file yet. my $fh = open_read "$args{LOCATION}/$sbo.info"; - # suck it all in, clean it all up, stuff it all in $vars. + # suck it all in, clean it all up, stuff it all in $store. my $contents = do {local $/; <$fh>}; $contents =~ s/("|\\\n)//g; - $vars = {$contents =~ /^(\w+)=(.*)$/mg}; + $store = {$contents =~ /^(\w+)=(.*)$/mg}; # fill the hash with array refs - even for single values, # since consistency here is a lot easier than sorting it out later - for my $key (keys %$vars) { - if ($$vars{$key} =~ /\s/) { - my @array = split ' ', $$vars{$key}; - $$vars{$key} = \@array; + for my $key (keys %$store) { + if ($$store{$key} =~ /\s/) { + my @array = split ' ', $$store{$key}; + $$store{$key} = \@array; } else { - $$vars{$key} = [$$vars{$key}]; + $$store{$key} = [$$store{$key}]; } } - return exists $$vars{$args{GET}} ? $$vars{$args{GET}} : undef; + return exists $$store{$args{GET}} ? $$store{$args{GET}} : undef; } # find the version in the tree for a given sbo (provided a location) -- cgit v1.2.3 From 974bead83585ebb14ded73b043506a86d1160a0b Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Sun, 4 Nov 2012 22:55:24 -0600 Subject: remove prototype from verify_distfile, cleanups/perl golf --- SBO-Lib/lib/SBO/Lib.pm | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'SBO-Lib/lib/SBO/Lib.pm') diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm index dfe0c60..9583a4f 100644 --- a/SBO-Lib/lib/SBO/Lib.pm +++ b/SBO-Lib/lib/SBO/Lib.pm @@ -395,7 +395,7 @@ sub compute_md5sum ($) { # for a given distfile, see whether or not it exists, and if so, if its md5sum # matches the sbo's .info file -sub verify_distfile ($$) { +sub verify_distfile { exists $_[1] or script_error 'verify_distfile requires two arguments.'; my ($link, $info_md5) = @_; my $filename = get_filename_from_link $link; @@ -415,8 +415,7 @@ sub get_distfile ($$) { system ("wget --no-check-certificate $link") == 0 or die "Unable to wget $link\n"; # can't do anything if the link in the .info doesn't lead to a good d/l - verify_distfile ($link, $info_md5) ? return 1 - : die "md5sum failure for $filename.\n"; + verify_distfile (@_) ? return 1 : die "md5sum failure for $filename.\n"; return 1; } @@ -489,9 +488,8 @@ sub revert_slackbuild ($) { sub check_distfiles (%) { exists $_[0] or script_error 'check_distfiles requires an argument.'; my %dists = @_; - for my $link (keys %dists) { - my $md5sum = $dists{$link}; - get_distfile $link, $md5sum unless verify_distfile $link, $md5sum; + while (my ($link, $md5) = each %dists) { + get_distfile $link, $md5 unless verify_distfile ($link, $md5) } return 1; } -- cgit v1.2.3 From 62b6156406606a18e9cdbc4fdc52bedae4f21835 Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Mon, 5 Nov 2012 03:19:39 -0600 Subject: git rid of prototype for open_fh. all tests pass. --- SBO-Lib/lib/SBO/Lib.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'SBO-Lib/lib/SBO/Lib.pm') diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm index 9583a4f..07e3975 100644 --- a/SBO-Lib/lib/SBO/Lib.pm +++ b/SBO-Lib/lib/SBO/Lib.pm @@ -68,7 +68,7 @@ sub script_error (;$) { } # sub for opening files, second arg is like '<','>', etc -sub open_fh ($$) { +sub open_fh { exists $_[1] or script_error 'open_fh requires two arguments'; unless ($_[1] eq '>') { -f $_[0] or script_error 'open_fh first argument not a file'; @@ -79,7 +79,7 @@ sub open_fh ($$) { } sub open_read ($) { - return open_fh shift, '<'; + return open_fh (shift, '<'); } # global config variables @@ -227,7 +227,7 @@ sub get_sbo_location { @sbos = @$tmp; } state $store = {}; - # if scalar context and we've already have the location, return it now. + # if scalar context and we already have the location, return it now. unless (wantarray) { return $$store{$sbos[0]} if exists $$store{$sbos[0]}; } -- cgit v1.2.3 From 63db7af11265967d0111c8224aa07c040fb438b9 Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Mon, 5 Nov 2012 03:21:13 -0600 Subject: git rid of prototype for get_distfile. all tests pass. --- SBO-Lib/lib/SBO/Lib.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'SBO-Lib/lib/SBO/Lib.pm') diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm index 07e3975..b6acd49 100644 --- a/SBO-Lib/lib/SBO/Lib.pm +++ b/SBO-Lib/lib/SBO/Lib.pm @@ -406,7 +406,7 @@ sub verify_distfile { # for a given distfile, attempt to retrieve it and, if successful, check its # md5sum against that in the sbo's .info file -sub get_distfile ($$) { +sub get_distfile { exists $_[1] or script_error 'get_distfile requires an argument'; my ($link, $info_md5) = @_; my $filename = get_filename_from_link $link; @@ -489,7 +489,7 @@ sub check_distfiles (%) { exists $_[0] or script_error 'check_distfiles requires an argument.'; my %dists = @_; while (my ($link, $md5) = each %dists) { - get_distfile $link, $md5 unless verify_distfile ($link, $md5) + get_distfile ($link, $md5) unless verify_distfile ($link, $md5); } return 1; } -- cgit v1.2.3 From 726522b533984f1b9652b580153a65d4c12b3ae9 Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Mon, 5 Nov 2012 03:23:35 -0600 Subject: git rid of prototype for get_build_queue. all tests pass. --- SBO-Lib/lib/SBO/Lib.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'SBO-Lib/lib/SBO/Lib.pm') diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm index b6acd49..09a1822 100644 --- a/SBO-Lib/lib/SBO/Lib.pm +++ b/SBO-Lib/lib/SBO/Lib.pm @@ -737,7 +737,7 @@ sub add_to_queue ($) { } # recursively add a sbo's requirements to the build queue. -sub get_build_queue ($$) { +sub get_build_queue { exists $_[1] or script_error 'get_build_queue requires two arguments.'; my ($sbos, $warnings) = @_; my $temp_queue = []; -- cgit v1.2.3 From 7830eacceca75d099dacb1ea1362465042f9cc2f Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Mon, 5 Nov 2012 03:26:31 -0600 Subject: git rid of prototype for get_symlink_from_filename. all tests pass. --- SBO-Lib/lib/SBO/Lib.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'SBO-Lib/lib/SBO/Lib.pm') diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm index 09a1822..95da0d7 100644 --- a/SBO-Lib/lib/SBO/Lib.pm +++ b/SBO-Lib/lib/SBO/Lib.pm @@ -420,7 +420,7 @@ sub get_distfile { } # for a given distfile, figure out what the full path to its symlink will be -sub get_symlink_from_filename ($$) { +sub get_symlink_from_filename { exists $_[1] or script_error 'get_symlink_from_filename requires two arguments'; -f $_[0] or script_error @@ -502,7 +502,7 @@ sub create_symlinks ($%) { my @symlinks; for my $link (keys %downloads) { my $filename = get_filename_from_link $link; - my $symlink = get_symlink_from_filename $filename, $location; + my $symlink = get_symlink_from_filename ($filename, $location); push @symlinks, $symlink; symlink $filename, $symlink; } -- cgit v1.2.3 From ca4560befa9477822940c8cfb0a2378171acb2ee Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Mon, 5 Nov 2012 03:29:31 -0600 Subject: get rid of useless (%) prototypes. all tests pass. --- SBO-Lib/lib/SBO/Lib.pm | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'SBO-Lib/lib/SBO/Lib.pm') diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm index 95da0d7..fb3fdf9 100644 --- a/SBO-Lib/lib/SBO/Lib.pm +++ b/SBO-Lib/lib/SBO/Lib.pm @@ -257,7 +257,7 @@ sub get_sbo_from_loc ($) { } # pull piece(s) of data, GET, from the $sbo.info file under LOCATION. -sub get_from_info (%) { +sub get_from_info { my %args = ( LOCATION => '', GET => '', @@ -318,7 +318,7 @@ sub get_available_updates () { # get downloads and md5sums from an sbo's .info file, first # checking for x86_64-specific info if we are told to -sub get_download_info (%) { +sub get_download_info { my %args = ( LOCATION => 0, X64 => 1, @@ -352,7 +352,7 @@ sub get_arch () { } # TODO: should probably combine this with get_download_info -sub get_sbo_downloads (%) { +sub get_sbo_downloads { my %args = ( LOCATION => '', 32 => 0, @@ -444,7 +444,7 @@ sub check_multilib () { } # make a backup of the existent SlackBuild, and rewrite the original as needed -sub rewrite_slackbuild (%) { +sub rewrite_slackbuild { my %args = ( SLACKBUILD => '', CHANGES => {}, @@ -485,7 +485,7 @@ sub revert_slackbuild ($) { # for each $download, see if we have it, and if the copy we have is good, # otherwise download a new copy -sub check_distfiles (%) { +sub check_distfiles { exists $_[0] or script_error 'check_distfiles requires an argument.'; my %dists = @_; while (my ($link, $md5) = each %dists) { @@ -511,7 +511,7 @@ sub create_symlinks ($%) { # pull the untarred source directory or created package name from the temp # file (the one we tee'd to) -sub grok_temp_file (%) { +sub grok_temp_file { my %args = ( FH => '', REGEX => '', @@ -554,7 +554,7 @@ sub get_tmp_extfn ($) { } # prep and run .SlackBuild -sub perform_sbo (%) { +sub perform_sbo { my %args = ( OPTS => 0, JOBS => 0, @@ -615,7 +615,7 @@ sub do_convertpkg ($) { } # "public interface", sort of thing. -sub do_slackbuild (%) { +sub do_slackbuild { my %args = ( OPTS => 0, JOBS => 0, @@ -665,7 +665,7 @@ sub do_slackbuild (%) { } # remove work directories (source and packaging dirs under /tmp/SBo) -sub make_clean (%) { +sub make_clean { my %args = ( SBO => '', SRC => '', @@ -684,7 +684,7 @@ sub make_clean (%) { } # remove distfiles -sub make_distclean (%) { +sub make_distclean { my %args = ( SRC => '', VERSION => '', -- cgit v1.2.3 From 336d4150f10389ddd0fa30c0327ddf3efc72d79f Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Mon, 5 Nov 2012 04:21:14 -0600 Subject: get rid of prototype for create_symlinks, all tests pass --- SBO-Lib/lib/SBO/Lib.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'SBO-Lib/lib/SBO/Lib.pm') diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm index fb3fdf9..dbc7ca2 100644 --- a/SBO-Lib/lib/SBO/Lib.pm +++ b/SBO-Lib/lib/SBO/Lib.pm @@ -496,7 +496,7 @@ sub check_distfiles { # given a location and a list of download links, assemble a list of symlinks, # and create them. -sub create_symlinks ($%) { +sub create_symlinks { exists $_[1] or script_error 'create_symlinks requires two arguments.'; my ($location, %downloads) = @_; my @symlinks; @@ -649,7 +649,7 @@ sub do_slackbuild { 32 => $args{COMPAT32} ); check_distfiles %downloads; - my @symlinks = create_symlinks $args{LOCATION}, %downloads; + my @symlinks = create_symlinks ($args{LOCATION}, %downloads); # setup and run the .SlackBuild itself my ($pkg, $src) = perform_sbo ( OPTS => $args{OPTS}, -- cgit v1.2.3 From 51b62ac5d35bc6a8987dd34ab896a0308a49dec4 Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Thu, 8 Nov 2012 06:50:25 -0600 Subject: use --delete when running rsync_tree --- SBO-Lib/lib/SBO/Lib.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'SBO-Lib/lib/SBO/Lib.pm') diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm index dbc7ca2..921496b 100644 --- a/SBO-Lib/lib/SBO/Lib.pm +++ b/SBO-Lib/lib/SBO/Lib.pm @@ -160,7 +160,7 @@ sub check_home () { sub rsync_sbo_tree () { my $slk_version = get_slack_version; my @arg = ('rsync', '-a', '--exclude=*.tar.gz', '--exclude=*.tar.gz.asc'); - push @arg, "rsync://slackbuilds.org/slackbuilds/$slk_version/*"; + push @arg, '--delete', "rsync://slackbuilds.org/slackbuilds/$slk_version/*"; my $out = system @arg, $config{SBO_HOME}; my $wanted = sub { $File::Find::name ? chown 0, 0, $File::Find::name -- cgit v1.2.3