summaryrefslogtreecommitdiff
path: root/lib/SlackBuild
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2018-06-02 09:53:53 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2018-06-02 09:53:53 +0200
commit14f145017b8c50e92384ab16bbdf48a84d7acc96 (patch)
tree212018c57bab25ecd80de25a64870083cd86e097 /lib/SlackBuild
parent1cab950be67dd778ce7e7fdce644c651eebff5fe (diff)
downloadslackbuilder-14f145017b8c50e92384ab16bbdf48a84d7acc96.tar.gz
slackbuilder-14f145017b8c50e92384ab16bbdf48a84d7acc96.tar.bz2
Handle DOWNLOAD_x86_64 and MD5SUM_x86_64
* lib/SlackBuild/Info.pm (for_arch): New method. * lib/SlackBuilder.pm (run): Call os_probe earlier. Merge request with info cloned for the proper architecture.
Diffstat (limited to 'lib/SlackBuild')
-rw-r--r--lib/SlackBuild/Info.pm36
1 files changed, 32 insertions, 4 deletions
diff --git a/lib/SlackBuild/Info.pm b/lib/SlackBuild/Info.pm
index 796643b..28daf73 100644
--- a/lib/SlackBuild/Info.pm
+++ b/lib/SlackBuild/Info.pm
@@ -44,10 +44,6 @@ of an info file.
Reads the attributes from the file named B<$filename>.
- new SlackBuild::Info(ATTR => VALUE, ...)
-
-Directly initializes attributes with the given values
-
new SlackBuild::Info
Returns an empty info object.
@@ -87,6 +83,38 @@ sub new {
return $self;
}
+=head2 for_arch
+
+ $clone = $info->for_arch($arch)
+
+Returns a clone of B<$info> with B<DOWNOAD> and B<MD5SUM> attributes adjusted
+for architecture B<$arch>.
+
+=cut
+
+sub for_arch {
+ my ($self, $arch) = @_;
+ my $clone = new SlackBuild::Info;
+ my @attrs = keys %attributes;
+
+ if (my $d = $self->{'DOWNLOAD_'.$arch}) {
+ if ($d ne 'UNSUPPORTED') {
+ $clone->{DOWNLOAD} = $d;
+ $clone->{MD5SUM} = $self->{'MD5SUM_'.$arch};
+ @attrs = grep { !/^(DOWNLOAD|MD5SUM)/ } @attrs;
+ }
+ }
+
+ foreach my $attr (@attrs) {
+ if ($self->{attr} && $attributes{$attr} eq 'ARRAY') {
+ $clone->{$attr} = [ @{$self->{$attr}} ];
+ } else {
+ $clone->{$attr} = $self->{$attr};
+ }
+ }
+ return $clone;
+}
+
=head1 STRING REPRESENTATION
When used is string context, objects of this class are represented as

Return to:

Send suggestions and report system problems to the System administrator.