summaryrefslogtreecommitdiffstats
path: root/lib/MGA/DrakISO/ISOBuild.pm
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/ISOBuild.pm
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/ISOBuild.pm')
-rw-r--r--lib/MGA/DrakISO/ISOBuild.pm64
1 files changed, 64 insertions, 0 deletions
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;