5 kx
5 kx use File::Basename;
5 kx
5 kx use strict;
5 kx use warnings FATAL => 'all';
5 kx
5 kx my $path = dirname( __FILE__ );
5 kx
5 kx package _kxLab;
5 kx
5 kx
5 kx sub distro_name
5 kx {
5 kx my $name = "kxLab";
5 kx
5 kx open( FILE, "< $path/constants.mk" );
5 kx
5 kx while( <FILE> )
5 kx {
5 kx if( /^DISTRO_NAME(.+= +)(.+)/ )
5 kx {
5 kx $name = $2;
5 kx }
5 kx }
5 kx close( FILE );
5 kx
5 kx return $name;
5 kx }
5 kx
5 kx sub build_system_tmpdir
5 kx {
5 kx return $path . "/var/tmp";
5 kx }
5 kx
5 kx sub build_system_path
5 kx {
5 kx return $path;
5 kx }
5 kx
5 kx sub error
5 kx {
5 kx my $message = shift;
5 kx my $func = shift;
5 kx
5 kx print STDERR "Error: $message\n";
5 kx if( defined( $func ) )
5 kx {
5 kx &$func();
5 kx }
5 kx exit 1;
5 kx }
5 kx
5 kx sub command_error
5 kx {
5 kx my $command = shift;
5 kx my $context = shift;
5 kx
5 kx error( "$command failed at @{$context}[1] line @{$context}[2]" );
5 kx }
5 kx
5 kx sub system
5 kx {
5 kx my $command = shift;
5 kx
5 kx if( system( $command ) )
5 kx {
5 kx my @context = caller;
5 kx command_error($command, \@context);
5 kx }
5 kx }
5 kx
5 kx 1;