125 lines
3.7 KiB
RPMSpec
125 lines
3.7 KiB
RPMSpec
![]() |
#
|
||
|
# spec file for package perl-Shell-Config-Generate
|
||
|
#
|
||
|
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
|
||
|
#
|
||
|
# All modifications and additions to the file contributed by third parties
|
||
|
# remain the property of their copyright owners, unless otherwise agreed
|
||
|
# upon. The license for this file, and modifications and additions to the
|
||
|
# file, is the same license as for the pristine package itself (unless the
|
||
|
# license for the pristine package is not an Open Source License, in which
|
||
|
# case the license is the MIT License). An "Open Source License" is a
|
||
|
# license that conforms to the Open Source Definition (Version 1.9)
|
||
|
# published by the Open Source Initiative.
|
||
|
|
||
|
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
||
|
#
|
||
|
|
||
|
|
||
|
Name: perl-Shell-Config-Generate
|
||
|
Version: 0.21
|
||
|
Release: 0
|
||
|
%define cpan_name Shell-Config-Generate
|
||
|
Summary: Portably generate config for any shell
|
||
|
License: Artistic-1.0 or GPL-1.0+
|
||
|
Group: Development/Libraries/Perl
|
||
|
Url: http://search.cpan.org/dist/Shell-Config-Generate/
|
||
|
Source: http://www.cpan.org/authors/id/P/PL/PLICEASE/%{cpan_name}-%{version}.tar.gz
|
||
|
BuildArch: noarch
|
||
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||
|
BuildRequires: perl
|
||
|
BuildRequires: perl-macros
|
||
|
BuildRequires: perl(Module::Build) >= 0.28
|
||
|
BuildRequires: perl(Shell::Guess) >= 0.02
|
||
|
BuildRequires: perl(Test::Differences)
|
||
|
BuildRequires: perl(Test::More) >= 0.94
|
||
|
BuildRequires: perl(autodie)
|
||
|
Requires: perl(Shell::Guess) >= 0.02
|
||
|
Requires: perl(autodie)
|
||
|
%{perl_requires}
|
||
|
|
||
|
%description
|
||
|
This module provides an interface for specifying shell configurations for
|
||
|
different shell environments without having to worry about the arcane
|
||
|
differences between shells such as csh, sh, cmd.exe and command.com.
|
||
|
|
||
|
It does not modify the current environment, but it can be used to create
|
||
|
shell configurations which do modify the environment.
|
||
|
|
||
|
This module uses the Shell::Guess manpage to represent the different types
|
||
|
of shells that are supported. In this way you can statically specify just
|
||
|
one or more shells:
|
||
|
|
||
|
#!/usr/bin/perl
|
||
|
use Shell::Guess;
|
||
|
use Shell::Config::Generate;
|
||
|
my $config = Shell::Config::Generate->new;
|
||
|
# ... config config ...
|
||
|
$config->generate_file(Shell::Guess->bourne_shell, 'foo.sh' );
|
||
|
$config->generate_file(Shell::Guess->c_shell, 'foo.csh');
|
||
|
$config->generate_file(Shell::Guess->cmd_shell, 'foo.cmd');
|
||
|
$config->generate_file(Shell::Guess->command_shell, 'foo.bat');
|
||
|
|
||
|
This will create foo.sh and foo.csh versions of the configurations, which
|
||
|
can be sourced like so:
|
||
|
|
||
|
#!/bin/sh
|
||
|
. ./foo.sh
|
||
|
|
||
|
or
|
||
|
|
||
|
#!/bin/csh
|
||
|
source foo.csh
|
||
|
|
||
|
It also creates '.cmd' and '.bat' files with the same configuration which
|
||
|
can be used in Windows. The configuration can be imported back into your
|
||
|
shell by simply executing these files:
|
||
|
|
||
|
C:\> foo.cmd
|
||
|
|
||
|
or
|
||
|
|
||
|
C:\> foo.bat
|
||
|
|
||
|
Alternatively you can use the shell that called your Perl script using the
|
||
|
Shell::Guess manpage's 'running_shell' method, and write the output to
|
||
|
standard out.
|
||
|
|
||
|
#!/usr/bin/perl
|
||
|
use Shell::Guess;
|
||
|
use Shell::Config::Generate;
|
||
|
my $config = Shell::Config::Generate->new;
|
||
|
# ... config config ...
|
||
|
print $config->generate(Shell::Guess->running_shell);
|
||
|
|
||
|
If you use this pattern, you can eval the output of your script using your
|
||
|
shell's back ticks to import the configuration into the shell.
|
||
|
|
||
|
#!/bin/sh
|
||
|
eval `script.pl`
|
||
|
|
||
|
or
|
||
|
|
||
|
#!/bin/csh
|
||
|
eval `script.pl`
|
||
|
|
||
|
%prep
|
||
|
%setup -q -n %{cpan_name}-%{version}
|
||
|
|
||
|
%build
|
||
|
%{__perl} Build.PL installdirs=vendor
|
||
|
./Build build flags=%{?_smp_mflags}
|
||
|
|
||
|
%check
|
||
|
./Build test
|
||
|
|
||
|
%install
|
||
|
./Build install destdir=%{buildroot} create_packlist=0
|
||
|
%perl_gen_filelist
|
||
|
|
||
|
%files -f %{name}.files
|
||
|
%defattr(-,root,root,755)
|
||
|
%doc Changes example LICENSE README
|
||
|
|
||
|
%changelog
|