File pyflag.spec of Package pyflag

#
# spec file for package distorm
#
# Copyright (c) 2011 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:           pyflag
Version:        0.87+pre1
Release:        0
License:        GPL-2.0+
Summary:        Forensic and Log Analysis GUI
Url:            http://code.google.com/p/distorm/
Group:          Development/Libraries/Python
Source:         pyflag-0.87-pre1.tar.bz2
Source99:       pyflag-rpmlintrc
Patch0:		pyflag-0.87-pre1-fix-compile-issues.patch
%if 0
# from fedora
BuildRequires:  python-devel MySQL-python python-imaging pexpect pynetsnmp libextractor-devel libpcap-devel zlib-devel file-libs mysql-server mysql libtool swig clamav-lib file-devel
%endif
BuildRequires:  file-devel
BuildRequires:  pkg-config
BuildRequires:  python-dateutil
BuildRequires:  python-devel
BuildRequires:  python-imaging
BuildRequires:  python-mysql
BuildRequires:  python-pexpect
# pyflag is currently looking for afflib.h in /usr/include.  It's in /usr/include/afflib.  FIX
# BuildRequires:  afflib-devel
BuildRequires:  libewf-devel
BuildRequires:  zlib-devel
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
#!BuildIgnore: post-build-checks



%if 0%{?suse_version} && 0%{?suse_version} <= 1110
%{!?python_sitearch: %global python_sitearch %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
# need to set python_sitelib here I think if you want this to build for SLE
%else
%py_requires
%endif

%description
This application is designed to assist IT security professionals with
analyzing log files, tcpdump files and hard disk images for forensic
evidence.It performs data analysis using a MYSQL database.

%package devel
Summary: Libraries for Pyflag
Requires: %{name}%{?_isa} = %{version}-%{release}

%description devel
The package %{name}-devel contains the static libraries needed for Pyflag Development

%prep
%setup -q -n pyflag-0.87-pre1
%patch0 -p1

%build
export CFLAGS="%{optflags} -fno-strict-aliasing -fPIC"
%configure --disable-static
%{__make} %{?_smp_mflags} 

%install
%makeinstall

# from fedora
# rm -rf $RPM_BUILD_ROOT
# make install DESTDIR=$RPM_BUILD_ROOT

#Adding Shebang
sed -i -e '1i#!/usr/bin/python' $RPM_BUILD_ROOT/%{_bindir}/conf.py

pushd $RPM_BUILD_ROOT
#permissions for executable files
#for file in ./%{python_sitelib}/%{name}/{jpeg_carver,Tester,regkey_load,FlagHTTPServer,mspst,FlagGTKServer,examine,pdf_carver,pyclamd,zip_carver}.py; do
#   chmod a+x $file
#done
for file in ./%{_datadir}/%{name}/utilities/{EventLogTool,indexer,compare,export_index_hits,incremental_load,nsrl_load,whois_load,raid_guess}.py; do
   chmod a+x $file
done
for file in ./%{_datadir}/%{name}/utilities/{whois_load,regkeys_load,update_version}.sh; do
   chmod a+x $file
done
#chmod a+x ./%{python_sitelib}/%{name}/FileFormats/libole2.py
popd

# remove static libraries
find $RPM_BUILD_ROOT -name "*.a" -execdir rm -fv '{}' \;
find $RPM_BUILD_ROOT -name "*.la" -execdir rm -fv '{}' \;


%files
%defattr(755,root,root)
%{python_sitearch}/%{name}
%defattr(-,root,root)
%doc COPYING README TODO
# %{python_sitelib}/%{name}
%{_bindir}/*
# %{_libdir}/%{name}/*.so.*
%{_datadir}/%{name}
%{_mandir}/man1/*

# %files devel
# %{_libdir}/%{name}/*.so


%changelog