cfengine/cfengine.spec

Mon, 28 Jan 2013 17:37:18 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Mon, 28 Jan 2013 17:37:18 +0100
changeset 758
a2c6460cfb16
parent 563
e39a632d12f7
permissions
-rw-r--r--

Correct socket error reporting improvement with IPv6 portable code,
after helpful recommendation by Saúl Ibarra Corretgé on OSips devlist.

     1 ##
     2 ##  cfengine.spec -- OpenPKG RPM Package Specification
     3 ##  Copyright (c) 2000-2012 OpenPKG Foundation e.V. <http://openpkg.net/>
     4 ##
     5 ##  Permission to use, copy, modify, and distribute this software for
     6 ##  any purpose with or without fee is hereby granted, provided that
     7 ##  the above copyright notice and this permission notice appear in all
     8 ##  copies.
     9 ##
    10 ##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    11 ##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    12 ##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    13 ##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
    14 ##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    15 ##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    16 ##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    17 ##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    18 ##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    19 ##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
    20 ##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    21 ##  SUCH DAMAGE.
    22 ##
    24 #   package information
    25 Name:         cfengine
    26 Summary:      Automated System Administration Tool
    27 URL:          http://www.cfengine.org/
    28 Vendor:       Oslo University College, Norway
    29 Packager:     OpenPKG Foundation e.V.
    30 Distribution: OpenPKG Community
    31 Class:        BASE
    32 Group:        System
    33 License:      GPL
    34 Version:      3.3.5
    35 Release:      20120800
    37 #   package options
    38 %option       with_fsl  yes
    40 #   list of sources
    41 Source0:      http://cfengine.com/source-code/download?file=cfengine-%{version}.tar.gz
    42 Source1:      rc.cfengine
    43 Source2:      fsl.cfengine
    45 #   build information
    46 BuildPreReq:  OpenPKG, openpkg >= 20100101, bison, flex, make, gcc, pkgconfig
    47 PreReq:       OpenPKG, openpkg >= 20100101
    48 BuildPreReq:  tokyocabinet, openssl, pcre
    49 PreReq:       tokyocabinet, openssl, pcre
    50 %if "%{with_fsl}" == "yes"
    51 BuildPreReq:  fsl
    52 PreReq:       fsl
    53 %endif
    55 %description
    56     Cfengine is a tool for setting up and maintaining BSD and System-5-like
    57     operating system optionally attached to a TCP/IP network. You can think
    58     of cfengine as a very high level language, much higher level than Perl
    59     or shell: a single statement can result in many hundreds of operations
    60     being performed on multiple hosts. Cfengine is good at performing a lot
    61     of common system administration tasks, and allows you to build on its
    62     strengths with your own scripts. You can also use it as a netwide
    63     front-end for `cron'.
    65 %track
    66     prog cfengine = {
    67         version   = %{version}
    68         url       = http://cfengine.com/source-code
    69         regex     = cfengine-(\d+.\d+\.\d+(p\d+)?)\.tar\.gz
    70     }
    72 %prep
    73     %setup -q
    74     %{l_shtool} subst \
    75         -e 's;\(LIBS=.*\)-ltokyocabinet;\1`%{l_prefix}/bin/pkg-config --libs-only-l tokyocabinet`;' \
    76         -e 's;\(LIBS=.*\)-lcrypto;\1`%{l_prefix}/bin/pkg-config --libs-only-l openssl`;' \
    77         -e "s;mandir=.\${datarootdir}/man.;;" \
    78         -e "s;mandir=.\${exec_prefix}/share/man.;;" \
    79         configure
    80     %{l_shtool} subst \
    81         -e 's;\(masterfilesdir = \$(projdatadir)\)/CoreBase;\1/cfengine;' \
    82         masterfiles/Makefile.in
    83     %{l_shtool} subst \
    84         -e 's;\(string *=>\) "/var/cfengine/masterfiles";\1 translatepath("$(sys.workdir)/masterfiles");' \
    85         -e 's;"/usr/local/sbin";"%{l_prefix}/bin";' \
    86         masterfiles/failsafe.cf
    87     %{l_shtool} subst \
    88         -e 's;\(/var/cfengine/masterfiles\);%{l_prefix}\1;g' \
    89         src/bootstrap.c
    91 %build
    92     #   configure package
    93     CC="%{l_cc}" \
    94     CFLAGS="%{l_cflags -O}" \
    95     CPPFLAGS="%{l_cppflags}" \
    96     LDFLAGS="%{l_fsl_ldflags}" \
    97     LIBS="%{l_fsl_libs}" \
    98     ./configure \
    99         --prefix=%{l_prefix} \
   100         --mandir=%{l_prefix}/man \
   101         --infodir=%{l_prefix}/info \
   102         --with-workdir=%{l_prefix}/var/cfengine \
   103         --with-tokyocabinet=%{l_prefix} \
   104         --with-openssl=%{l_prefix} \
   105         --with-pcre=%{l_prefix} \
   106         --without-sql \
   107         --disable-shared
   109     #   build package
   110     %{l_make} %{l_mflags -O}
   112 %install
   113     #   install package
   114     %{l_shtool} mkdir -f -p -m 755 \
   115         $RPM_BUILD_ROOT%{l_prefix}/var/cfengine \
   116         $RPM_BUILD_ROOT%{l_prefix}/share/cfengine/corebase
   117     %{l_make} %{l_mflags} install DESTDIR="$RPM_BUILD_ROOT"
   119     #   copy or move files to correct subdirectories
   120     mv \
   121         $RPM_BUILD_ROOT%{l_prefix}/share/doc/examples \
   122         $RPM_BUILD_ROOT%{l_prefix}/share/cfengine
   123     mv \
   124         $RPM_BUILD_ROOT%{l_prefix}/share/cfengine/*.cf \
   125         $RPM_BUILD_ROOT%{l_prefix}/share/cfengine/corebase/
   126     cp \
   127         $RPM_BUILD_ROOT%{l_prefix}/share/cfengine/corebase/* \
   128         $RPM_BUILD_ROOT%{l_prefix}/var/cfengine/masterfiles/
   129     cp -rp \
   130         $RPM_BUILD_ROOT%{l_prefix}/bin \
   131         $RPM_BUILD_ROOT%{l_prefix}/var/cfengine/
   133     #   strip down installation
   134     rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/doc >/dev/null 2>&1 || true
   135     rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/lib* >/dev/null 2>&1 || true
   136     rm -f $RPM_BUILD_ROOT%{l_prefix}/info/dir >/dev/null 2>&1 || true
   137     strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
   138     strip $RPM_BUILD_ROOT%{l_prefix}/var/cfengine/bin/* >/dev/null 2>&1 || true
   140     #   install run-command script
   141     %{l_shtool} mkdir -f -p -m 755 \
   142         $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
   143     %{l_shtool} install -c -m 755 %{l_value -s -a} \
   144         %{SOURCE rc.cfengine} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
   146     #   install OSSP fsl configuration
   147     %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
   148     %{l_shtool} install -c -m 644 %{l_value -s -a} \
   149         %{SOURCE fsl.cfengine} \
   150         $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
   152     #   determine installation files
   153     %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
   154         %{l_files_std} \
   155         '%config %{l_prefix}/var/cfengine/masterfiles/*' \
   156         '%config %{l_prefix}/etc/fsl/fsl.cfengine'
   158 %files -f files
   160 %clean
   162 %post
   163     #   generate a public/private key pair for localhost
   164     if [ ! -f $RPM_INSTALL_PREFIX/var/cfengine/ppkeys/localhost.priv ]; then
   165         $RPM_INSTALL_PREFIX/bin/cf-key
   166     fi
   167     ( echo "You must choose a policy server (hub) to use and supply the"
   168       echo "corresponding IP address while bootstrapping CFEngine for it"
   169       echo "to be useful:"
   170       echo ""
   171       echo "    # $RPM_INSTALL_PREFIX/var/cfengine/bin/cf-agent --bootstrap --policy-server <ipddr>"
   172     ) | %{l_rpmtool} msg -b -t notice

mercurial