summaryrefslogtreecommitdiffstats
path: root/lib/MGA/DrakISO
diff options
context:
space:
mode:
authorMartin Whitaker <mageia@martin-whitaker.me.uk>2017-12-19 15:56:01 +0000
committerMartin Whitaker <mageia@martin-whitaker.me.uk>2017-12-19 15:56:01 +0000
commit059b5c2a18e61cc7e4348e955025f9d77466647d (patch)
tree7afd2fa87166b389aaaf270397532aba8f394af0 /lib/MGA/DrakISO
parentc0814f2d23fa79238624cbc541dc1b5ad5917292 (diff)
downloaddrakiso-059b5c2a18e61cc7e4348e955025f9d77466647d.tar
drakiso-059b5c2a18e61cc7e4348e955025f9d77466647d.tar.gz
drakiso-059b5c2a18e61cc7e4348e955025f9d77466647d.tar.bz2
drakiso-059b5c2a18e61cc7e4348e955025f9d77466647d.tar.xz
drakiso-059b5c2a18e61cc7e4348e955025f9d77466647d.zip
Split Live class into ISOBuild base class and LiveBuild subclass.
Diffstat (limited to 'lib/MGA/DrakISO')
-rwxr-xr-xlib/MGA/DrakISO/BuildBoot.pm2
-rwxr-xr-xlib/MGA/DrakISO/BuildISO.pm2
-rwxr-xr-xlib/MGA/DrakISO/BuildLoop.pm2
-rwxr-xr-xlib/MGA/DrakISO/BuildRoot.pm2
-rw-r--r--lib/MGA/DrakISO/ISOBuild.pm64
-rw-r--r--lib/MGA/DrakISO/Live.pm76
-rw-r--r--lib/MGA/DrakISO/LiveBuild.pm81
7 files changed, 149 insertions, 80 deletions
diff --git a/lib/MGA/DrakISO/BuildBoot.pm b/lib/MGA/DrakISO/BuildBoot.pm
index 8fbc164..52fff4f 100755
--- a/lib/MGA/DrakISO/BuildBoot.pm
+++ b/lib/MGA/DrakISO/BuildBoot.pm
@@ -26,7 +26,7 @@ use common;
use File::Copy qw(mv);
-use MGA::DrakISO::Live;
+use MGA::DrakISO::LiveBuild;
use MGA::DrakISO::Utils;
use Exporter;
diff --git a/lib/MGA/DrakISO/BuildISO.pm b/lib/MGA/DrakISO/BuildISO.pm
index 6f983ab..4198a10 100755
--- a/lib/MGA/DrakISO/BuildISO.pm
+++ b/lib/MGA/DrakISO/BuildISO.pm
@@ -24,7 +24,7 @@ use strict;
use MDK::Common;
use common;
-use MGA::DrakISO::Live;
+use MGA::DrakISO::LiveBuild;
use MGA::DrakISO::Loopback;
use MGA::DrakISO::Utils;
diff --git a/lib/MGA/DrakISO/BuildLoop.pm b/lib/MGA/DrakISO/BuildLoop.pm
index e1cb82d..c8f3b06 100755
--- a/lib/MGA/DrakISO/BuildLoop.pm
+++ b/lib/MGA/DrakISO/BuildLoop.pm
@@ -26,7 +26,7 @@ use common;
use File::Temp qw(tmpnam);
-use MGA::DrakISO::Live;
+use MGA::DrakISO::LiveBuild;
use MGA::DrakISO::Loopback;
use MGA::DrakISO::Utils;
diff --git a/lib/MGA/DrakISO/BuildRoot.pm b/lib/MGA/DrakISO/BuildRoot.pm
index 20ad645..a81bf0d 100755
--- a/lib/MGA/DrakISO/BuildRoot.pm
+++ b/lib/MGA/DrakISO/BuildRoot.pm
@@ -24,7 +24,7 @@ use strict;
use MDK::Common;
use common;
-use MGA::DrakISO::Live;
+use MGA::DrakISO::LiveBuild;
use MGA::DrakISO::Loopback;
use MGA::DrakISO::Utils;
diff --git a/lib/MGA/DrakISO/ISOBuild.pm b/lib/MGA/DrakISO/ISOBuild.pm
new file mode 100644
index 0000000..d3305fe
--- /dev/null
+++ b/lib/MGA/DrakISO/ISOBuild.pm
@@ -0,0 +1,64 @@
+# Copyright (C) 2005 Mandriva
+# Olivier Blin <oblin@mandriva.com>
+# Copyright (C) 2017 Mageia
+# Martin Whitaker <mageia@martin-whitaker.me.uk>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# SYNOPSIS
+# --------
+# This package defines the base ISOBuild class that is used to hold all the
+# settings and configuration values needed to build an ISO. It provides a
+# number of helper functions which are used when building either type ISO.
+# The subclasses ClassicBuild and LiveBuild extend this class with functions
+# specific to building the two types of ISO.
+
+package MGA::DrakISO::ISOBuild;
+
+use strict;
+
+use MDK::Common;
+
+sub new {
+ my ($class) = @_;
+ bless {}, $class;
+}
+
+sub get_name {
+ my ($live) = @_;
+ my $fields = $live->{name_fields} || $live->default_name_fields;
+ join('-', grep { $_ } @{$live->{settings}}{@$fields});
+}
+
+sub get_set_suffix {
+ my ($live) = @_;
+ $live->{settings}{set} ? "-$live->{settings}{set}" : "";
+}
+
+sub get_builddir {
+ my ($live, $o_subdir) = @_;
+ $live->{settings}{builddir} . '/' . $live->get_name . $live->get_set_suffix . if_($o_subdir, '/' . $o_subdir);
+}
+
+sub get_absolute_path {
+ my ($live, $path) = @_;
+ if (defined $path && substr($path, 0, 1) ne '/') {
+ $live->{settings}{config_root} . '/' . $path;
+ } else {
+ $path;
+ }
+}
+
+1;
diff --git a/lib/MGA/DrakISO/Live.pm b/lib/MGA/DrakISO/Live.pm
deleted file mode 100644
index 8f54e62..0000000
--- a/lib/MGA/DrakISO/Live.pm
+++ /dev/null
@@ -1,76 +0,0 @@
-package MGA::DrakISO::Live;
-
-use strict;
-
-use MDK::Common;
-
-sub new {
- my ($class) = @_;
- bless {}, $class;
-}
-
-sub default_name_fields {
- my ($live) = @_;
- [ qw(name version product desktop),
- if_($live->{settings}{region} ne 'all', $live->{settings}{region}),
- qw(arch media)
- ];
-}
-
-sub get_name {
- my ($live) = @_;
- my $fields = $live->{name_fields} || default_name_fields($live);
- join('-', grep { $_ } @{$live->{settings}}{@$fields});
-}
-
-sub get_set_suffix {
- my ($live) = @_;
- $live->{settings}{set} ? "-$live->{settings}{set}" : "";
-}
-
-sub get_langs {
- my ($live) = @_;
- uniq(
- (ref $live->{regions} ? @{$live->{regions}{$live->{settings}{region}}} : ()),
- @{$live->{system}{langs_always}}
- );
-}
-
-sub get_builddir {
- my ($live, $o_subdir) = @_;
- $live->{settings}{builddir} . '/' . $live->get_name . $live->get_set_suffix . if_($o_subdir, '/' . $o_subdir);
-}
-
-sub get_system_root {
- my ($live) = @_;
- $live->{settings}{chroot} . '/' . $live->get_name . $live->get_set_suffix;
-}
-
-sub find_kernel {
- my ($live) = @_;
- require bootloader;
- local $::prefix = $live->get_system_root;
- my @kernels = bootloader::get_kernels_and_labels();
- my $kernel;
- if ($live->{system}{kernel}) {
- $kernel = find { $_->{version} eq $live->{system}{kernel} } @kernels;
- $kernel or die "kernel $live->{system}{kernel} can not be found\n";
- }
- $kernel ||= first(@kernels) or die "no kernel can be found\n";
-}
-
-sub get_initrd_name {
- my ($live) = @_;
- 'initrd-' . $live->find_kernel->{version} . '.img';
-}
-
-sub get_absolute_path {
- my ($live, $path) = @_;
- if (defined $path && substr($path, 0, 1) ne '/') {
- $live->{settings}{config_root} . '/' . $path;
- } else {
- $path;
- }
-}
-
-1;
diff --git a/lib/MGA/DrakISO/LiveBuild.pm b/lib/MGA/DrakISO/LiveBuild.pm
new file mode 100644
index 0000000..dbfda48
--- /dev/null
+++ b/lib/MGA/DrakISO/LiveBuild.pm
@@ -0,0 +1,81 @@
+# Copyright (C) 2005 Mandriva
+# Olivier Blin <oblin@mandriva.com>
+# Copyright (C) 2017 Mageia
+# Martin Whitaker <mageia@martin-whitaker.me.uk>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# SYNOPSIS
+# --------
+# This package defines the LiveBuild subclass that is used to hold all the
+# settings and configuration values needed to build a Live ISO. It provides
+# a number of helper functions over and above those provided by the ISOBuild
+# superclass.
+
+package MGA::DrakISO::LiveBuild;
+
+use strict;
+
+use MDK::Common;
+
+use MGA::DrakISO::ISOBuild;
+
+our @ISA = qw(MGA::DrakISO::ISOBuild);
+
+sub new {
+ my ($class) = @_;
+ bless {}, $class;
+}
+
+sub default_name_fields {
+ my ($live) = @_;
+ [ qw(name version product desktop),
+ if_($live->{settings}{region} ne 'all', $live->{settings}{region}),
+ qw(arch media)
+ ];
+}
+
+sub get_langs {
+ my ($live) = @_;
+ uniq(
+ (ref $live->{regions} ? @{$live->{regions}{$live->{settings}{region}}} : ()),
+ @{$live->{system}{langs_always}}
+ );
+}
+
+sub get_system_root {
+ my ($live) = @_;
+ $live->{settings}{chroot} . '/' . $live->get_name . $live->get_set_suffix;
+}
+
+sub find_kernel {
+ my ($live) = @_;
+ require bootloader;
+ local $::prefix = $live->get_system_root;
+ my @kernels = bootloader::get_kernels_and_labels();
+ my $kernel;
+ if ($live->{system}{kernel}) {
+ $kernel = find { $_->{version} eq $live->{system}{kernel} } @kernels;
+ $kernel or die "kernel $live->{system}{kernel} can not be found\n";
+ }
+ $kernel ||= first(@kernels) or die "no kernel can be found\n";
+}
+
+sub get_initrd_name {
+ my ($live) = @_;
+ 'initrd-' . $live->find_kernel->{version} . '.img';
+}
+
+1;