# Copyright (C) 2005 Mandriva # Olivier Blin # Copyright (C) 2017-2018 Mageia # Martin Whitaker # # 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, 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 ($build) = @_; my $fields = $build->{iso_name_fields} || $build->default_name_fields; join('-', grep { $_ } @{$build->{settings}}{@$fields}); } sub get_set_suffix { my ($build) = @_; $build->{settings}{set} ? "-$build->{settings}{set}" : ""; } sub get_build_dir { my ($build, $o_subdir) = @_; $build->{settings}{workdir} . '/' . $build->get_name . $build->get_set_suffix . if_($o_subdir, '/' . $o_subdir); } sub get_chroot_dir { my ($build) = @_; get_build_dir($build, 'chroot'); } sub get_absolute_path { my ($build, $path) = @_; if (defined $path && substr($path, 0, 1) ne '/') { $build->{settings}{config_root} . '/' . $path; } else { $path; } } 1;