File design-center.spec of Package design-center

#
# spec file for package design-center
#
# Copyright (c) 2013 SUSE LINUX Products 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:           design-center

# Yes, its not FHS conformant but in sync with design-center documentation
# reported upstream as https://design-center.com/dev/issues/1896
%define         basedir   /var/%{name}
%define         workdir   %{basedir}

Summary:        The CFEngine Design Center
License:        MIT
Group:          Development/Tools/Other
Version:        3.6.0
Release:        0
Url:            http://cfengine.com/cfengine-design-center
Source:         %{name}-%{version}.tar.gz
# have cf-sketch and cf-dc-api look in /usr/share/cf-sketch, kkaempf@suse.de
# have cf-sketch load cf-dc-api.pl from /usr/share/cf-sketch, kkaempf@suse.de
Patch1:         design-center-%{version}.patch
# fix interpreter path for cf-agent, kkaempf@suse.de
Patch2:         fix-interpreter-path.patch

# wtf? SLE_11 does not honor rpmlintrc
%if 0%{?suse_version} <= 1130
BuildRequires:  -post-build-checks
%endif
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch
BuildRequires:  cfengine >= 3.4.0
BuildRequires:  libpromises-devel >= 3.4.0
Requires:       perl
# File::Path = 2.09
Requires:       perl(File::Path)
Requires:       perl(File::Which)
Requires:       perl(JSON)
# Mo = 0.31
Requires:       perl(Mo)
Requires:       ruby
Requires:       curl

%if 0%{?suse_version} > 01020
BuildRequires:  fdupes
%endif

%description
The Design Center is a public repository for customizable CFEngine
design patterns and code. Here you can download finished solutions to
use and adapt them for your environment, or find examples that inspire
you to develop new patterns. Design Center will become an increasingly
important way of working with CFEngine, a place for infrastructure
engineers to share and re-use knowledge and expertise.

%package examples
Summary: Examples for CFEngine design-center
Group:   Documentation/Howto
%description examples
Examples for CFEngine Design Center.

%prep
%setup -q
%patch1 -p1
%patch2 -p1

%build

# remove binaries

%{__rm} examples/verticalsysadmin_training_examples/eggdrop
%{__rm} examples/verticalsysadmin_training_examples/trn
%{__rm} examples/verticalsysadmin_training_examples/.vimrc
%{__rm} -rf examples/verticalsysadmin_training_examples/RCS
chmod -x examples/valentines_day_poem_report/bemine.cf
chmod -x tools/cf-sketch/perl-lib/DesignCenter/*.pm

%install

%{__install} -d %{buildroot}/%{_docdir}/%{name}

cp -a examples %{buildroot}/%{_docdir}/%{name}-examples
cp -a howto %{buildroot}/%{_datadir}/%{name}

%{__install} -d %{buildroot}/%{_sysconfdir}/cf-sketch
%{__install} -m 0644 tools/cf-sketch/{*.json,*.conf} %{buildroot}%{_sysconfdir}/cf-sketch

%{__install} -d %{buildroot}/%{_bindir}
%{__install} -m 0755 tools/cf-cmd/cf-cmd %{buildroot}%{_bindir}
%{__install} -m 0644 tools/cf-cmd/README.md %{buildroot}%{_docdir}/%{name}/README.cf-cmd
%{__install} -m 0755 tools/cf-locate/cf-locate %{buildroot}%{_bindir}
%{__install} -m 0644 tools/cf-locate/README.md %{buildroot}%{_docdir}/%{name}/README.cf-locate
%{__install} -m 0755 tools/cf-sketch/cf-sketch.pl %{buildroot}%{_bindir}/cf-sketch
%{__install} -m 0644 tools/cf-sketch/README.md %{buildroot}%{_docdir}/%{name}/README.cf-sketch

%{__install} -d %{buildroot}/%{_datadir}/%{name}/cf-sketch
%{__install} -m 0644 tools/cf-sketch/perl-lib/*.pm %{buildroot}/%{_datadir}/%{name}/cf-sketch
cp -a tools/cf-sketch/perl-lib/DCAPI %{buildroot}/%{_datadir}/%{name}/cf-sketch
cp -a tools/cf-sketch/perl-lib/DesignCenter %{buildroot}/%{_datadir}/%{name}/cf-sketch
cp -a tools/cf-sketch/perl-lib/Parser %{buildroot}/%{_datadir}/%{name}/cf-sketch
%{__install} -m 0755 tools/cf-sketch/cf-dc-api.pl %{buildroot}/%{_datadir}/%{name}/cf-sketch

cp -a sketches %{buildroot}/%{_datadir}/%{name}

%if 0%{?suse_version} > 01020
%fdupes %{buildroot}/usr
%endif


%files
%defattr(-,root,root)
%doc LICENSE AUTHORS README.markdown
%dir %{_sysconfdir}/cf-sketch
%config(noreplace) %{_sysconfdir}/cf-sketch/*.json
%config(noreplace) %{_sysconfdir}/cf-sketch/*.conf
%dir %{_datadir}/%{name}
%{_datadir}/%{name}

%{_bindir}/cf-cmd
%{_bindir}/cf-locate
%{_bindir}/cf-sketch

%files examples
%defattr(-,root,root)
%doc LICENSE

%changelog
openSUSE Build Service is sponsored by