arpwatch/arpwatch.spec

Tue, 29 Mar 2011 20:04:34 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 29 Mar 2011 20:04:34 +0200
changeset 334
4a34d7a82eab
parent 64
6aeed4ef015a
child 387
33ae2d61c751
permissions
-rw-r--r--

Rework package yet again, correcting and introducing new buildconf logic:
Conditionally disable bootstrap stage comparison correctly, correct
english grammar, better find system as(1) and ld(1), indotruce detailed
optimization option messages, more completely guess cpu types, allow
profiled bootstrapping without a preinstalled GCC because many other
compilers have long since implemented 64-bit arithmetic, instruct make
to build sequentially (not in sparallel) when building a profiled
bootstrap as GCC online documents recommend, and generally improve
comment blocks.

The single most important correction in this changeset relates to the
GCC changed optimization policy since at least GCC 4.5, in which -march
is always passed and not always correctly guessed. In the case of this
package, allowing GCC to guess the architecture leads to wild build
errors at various subcomponents (zlib, libgcc, libiberty...) and
bootstrap stages. It seems quite platform specific, and the safest
approach to correcting this seems to be explicitly always specifying the
-march argument when bootstrapping GCC. Because the best choice 'native'
is not available when bootstrapping using a foreign (non GCC) compiler,
a guess is made according to rpmmacros l_platform in that case.

It is questionable as to whether these recent optimization changes
on the part of GCC or this package are compatible with each other,
or if either are complete or correct at all. At least applying these
corrections allows this package to build again in most cases test.

     1 ##
     2 ##  arpwatch.spec -- OpenPKG RPM Specification
     3 ##  Copyright (c) 2009 Michael Schloh von Bennewitz <michael@schloh.com>
     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 ##
    25 #   package information
    26 Name:         arpwatch
    27 Summary:      Ethernet Address Monitor Program
    28 URL:          http://ee.lbl.gov/
    29 Vendor:       Craig Leres
    30 Packager:     Michael Schloh von Bennewitz
    31 Distribution: MSvB Recherche Production
    32 Class:        EVAL
    33 Group:        Network
    34 License:      GPL
    35 Version:      2.1a15
    36 Release:      20090106
    38 #   package options
    39 %option       with_fsl  yes
    41 #   list of sources
    42 Source0:      ftp://ftp.ee.lbl.gov/arpwatch.tar.gz
    43 Source1:      rc.arpwatch
    44 Source2:      fsl.arpwatch
    45 Patch0:       arpwatch.patch
    47 #   build information
    48 Prefix:       %{l_prefix}
    49 BuildRoot:    %{l_buildroot}
    50 BuildPreReq:  OpenPKG, openpkg >= 20040130, libpcap, make
    51 PreReq:       OpenPKG, openpkg >= 20040130, libpcap
    52 %if "%{with_fsl}" == "yes"
    53 BuildPreReq:  fsl >= 1.2.0
    54 PreReq:       fsl >= 1.2.0
    55 %endif
    56 AutoReq:      no
    57 AutoReqProv:  no
    59 %description
    60     The arpwatch daemon monitors ethernet or fddi activity
    61     and maintains a database of ethernet/ip address pairings.
    62     It reports certain changes via email as well.
    64 %track
    65     prog arpwatch = {
    66         disabled
    67         comment   = "msvb: tracking is disabled as sources are unversioned"
    68         version   = %{version}
    69         url       = ftp://ftp.ee.lbl.gov/
    70         regex     = arpwatch-\.tar\.gz
    71     }
    73 %prep
    74     %setup -q
    76     #   before patching, correct unconsistent file modes
    77     chmod u+w *
    79     %patch -p0
    81     #   supply more detailed file path information
    82     %{l_shtool} subst %{l_value -s l_prefix} \
    83         arpwatch.8 \
    84         arpsnmp.8
    86 %build
    87     #   query for platform specific libraries
    88     loclibs=""
    89     case "%{l_platform -t}" in
    90         *-sunos* ) loclibs="-lsocket -lnsl" ;;
    91     esac
    93     #   run the autoconf(1) generated configuration logic
    94     CC="%{l_cc}" \
    95     CFLAGS="%{l_cflags -O}" \
    96     CPPFLAGS="%{l_cppflags}" \
    97     LDFLAGS="%{l_ldflags} %{l_fsl_ldflags}" \
    98     LIBS="%{l_fsl_libs} $loclibs" \
    99     ./configure \
   100         --prefix=%{l_prefix} \
   101         --localstatedir=%{l_prefix}/var/arpwatch/run
   103     #   run the native build logic using parallel make
   104     %{l_make} %{l_mflags -O}
   106 %install
   107     #   remove previously existing installations
   108     rm -rf $RPM_BUILD_ROOT
   110     #   create installation hierarchy
   111     %{l_shtool} mkdir -f -p -m 755 \
   112         $RPM_BUILD_ROOT%{l_prefix}/sbin \
   113         $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
   114         $RPM_BUILD_ROOT%{l_prefix}/man/man8 \
   115         $RPM_BUILD_ROOT%{l_prefix}/var/arpwatch/log \
   116         $RPM_BUILD_ROOT%{l_prefix}/var/arpwatch/run
   118     #   run the native installation logic
   119     %{l_make} %{l_mflags} install install-man install-data DESTDIR=$RPM_BUILD_ROOT
   121     #   install runcommand script
   122     %{l_shtool} install -c -m 755 %{l_value -s -a} \
   123         %{SOURCE rc.arpwatch} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
   125     #   install OSSP fsl configuration
   126     %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
   127     %{l_shtool} install -c -m 644 %{l_value -s -a} \
   128         %{SOURCE fsl.arpwatch} \
   129         $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
   131     #   determine installation files
   132     %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
   133         %{l_files_std} \
   134         '%not %dir %{l_prefix}/etc/fsl' \
   135         '%config %{l_prefix}/etc/fsl/fsl.arpwatch'
   137 %files -f files
   139 %clean
   140     rm -rf $RPM_BUILD_ROOT
   142 %pre
   143     #   before upgrading package, record runtime status and stop service
   144     [ $1 -eq 2 ] || exit 0
   145     eval `%{l_rc} arpwatch status 2>/dev/null | tee %{l_tmpfile}`
   146     %{l_rc} arpwatch stop 2>/dev/null
   147     exit 0
   149 %post
   150     if [ $1 -eq 1 ]; then
   151         #   after installing package, generate initial arp database
   152         %{l_shtool} install -c -o %{l_musr} -g %{l_mgrp} -m 644 \
   153             %{_builddir}/arpwatch-%{version}/arp.dat \
   154             $RPM_INSTALL_PREFIX/var/arpwatch/run/
   156         #   after installing package, announce security provision lo0
   157         ( echo "Before starting the arpwatch daemon, set the config variables"
   158           echo "\"arpwatch_iface\" and \"arpwatch_ipnet\" in $RPM_INSTALL_PREFIX/etc/rc.conf to"
   159           echo "describe the network interface and block(s) to be monitored."
   160         ) | %{l_rpmtool} msg -b -t notice
   161     fi
   162     if [ $1 -eq 2 ]; then
   163         #   after upgrading package, restore runtime status
   164         eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile} >/dev/null 2>&1 || true
   165         [ ".$arpwatch_active" = .yes ] && %{l_rc} arpwatch start
   166     fi
   167     exit 0
   169 %preun
   170     #   before removing package, stop service and remove log files
   171     [ $1 -eq 0 ] || exit 0
   172     %{l_rc} arpwatch stop 2>/dev/null
   173     rm -f $RPM_INSTALL_PREFIX/var/arpwatch/log/* >/dev/null 2>&1 || true
   174     rm -f $RPM_INSTALL_PREFIX/var/arpwatch/run/* >/dev/null 2>&1 || true
   175     exit 0

mercurial