File wicd.spec of Package wicd

#
# spec file for package wicd
#
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2012 Benjamin Denisart <p.drouand@gmail.com>
#
# 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/
#


%define DISTRO suse

%if 0%{?suse_version} < 1230
%define _unitdir /lib/systemd/system
%else
%define _unitdir /usr/lib/systemd/system
%endif

Summary:        A wireless and wired network manager
License:        GPL-2.0
Group:          Productivity/Networking/System
Name:           wicd
Version:        1.7.4
Release:        0
Url:            https://launchpad.net/wicd/
Source:         %{name}-%{version}.tar.gz
Source99:       wicd-rpmlintrc
Patch0:         dbus-policy.patch
Patch1:         wicd-sanitize.patch
Patch2:         dhcpcd_914.patch
Patch3:         wicd-managedstdio.patch
Patch4:         wicd-logrotate.patch
Patch5:         env.patch
Patch6:         ipv6_dhcpcd.patch
BuildRequires:  dbus-1-python-devel
BuildRequires:  fdupes
BuildRequires:  gettext
BuildRequires:  hicolor-icon-theme
BuildRequires:  iproute2
#BuildRequires:  net-tools
#BuildRequires:  pm-utils
BuildRequires:  python-devel
BuildRequires:  python-setuptools
BuildRequires:  python-distribute
BuildRequires:  python-gobject2-devel
BuildRequires:  python-Babel
BuildRequires:  sysconfig
BuildRequires:  update-desktop-files
BuildRequires:  update-desktop-files
BuildRequires:  wireless-tools
BuildRequires:  wpa_supplicant
BuildRequires:  fdupes
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%{py_requires}
%{?systemd_requires}
BuildArch:      noarch

Requires:       %{name}-cli = %{version}
Requires:       %{name}-client
Requires:       %{name}-daemon = %{version}
Requires:       %{name}-gtk = %{version}
Requires:       %{name}-curses = %{version}
Recommends:     %{name}-lang = %{version}

%description
A complete network connection manager
Wicd supports wired and wireless networks, and capable of
creating and tracking profiles for both.  It has a
template-based wireless encryption system, which allows the user
to easily add encryption methods used.  It ships with some common
encryption types, such as WPA and WEP. Wicd will automatically
connect at startup to any preferred network within range.

This is a metapackage, it allows installation of all the components of
Wicd, including one of the clients, which must be manually chosen.

%package daemon
Summary:        Wired and wireless network manager - daemon
Group:          Productivity/Networking/System
Requires:       dbus-1-python
Requires:       dhcpcd
Requires:       ethtool
Requires:       iproute2
# net-tools-deprecated is needed for (e.g.) ifconfig on newer OpenSUSE Leap 15.
# In that case net-tools itself is not needed.
%if 0%{?suse_version} > 1315
Requires:	net-tools-deprecated
%else
Requires:       net-tools
%endif
#Requires:       pm-utils
Requires:       python-%{name} = %{version}
Requires:       wireless-tools
Requires:       wpa_supplicant
Requires:       rfkill
Recommends:     %{name}-gtk %{version}
Recommends:     %{name}-curses = %{version}
Recommends:     %{name}-cli = %{version}
Recommends:     %{name}-client
Recommends:     %{name}-lang = %{version}
#Conflicts:      NetworkManager
Suggests:       logrotate

%description daemon
Wicd is a general-purpose network configuration server which aims
 to provide a simple but flexible interface for connecting to networks.
 Its features include:
  * wide variety of settings;
  * ability to connect to (and maintain profiles for) both wired and
    wireless networks;
  * support for many encryption schemes, including WEP, WPA, WPA2 and
    custom schemes;
  * wireless-tools compatibility.

This package contains the daemon needed to run Wicd.

%package gtk
Summary:        Wired and wireless network manager - GTK+ client
Group:          Productivity/Networking/System
Requires:       %{name}-daemon
Requires:       python-gtk
Provides:       %{name}-client
Recommends:     %{name}-lang = %{version}

%description gtk
Wicd is a general-purpose network configuration server which aims
 to provide a simple but flexible interface for connecting to networks.
 Its features include:
  * wide variety of settings;
  * ability to connect to (and maintain profiles for) both wired and
    wireless networks;
  * support for many encryption schemes, including WEP, WPA, WPA2 and
    custom schemes;
  * wireless-tools compatibility.

This package provides the GTK+ client, which has no GNOME dependencies,
making it easy to use in Xfce, Fluxbox, Openbox, Enlightenment, ...
It also supports a tray icon showing network activity and signal
strength.

%package curses
Summary:        Wired and wireless network manager - Curses client
Group:          Productivity/Networking/System
Requires:       %{name}-daemon
Requires:       python-urwid
Provides:       %{name}-client
Recommends:     %{name}-lang = %{version}

%description curses
Wicd is a general-purpose network configuration server which aims
 to provide a simple but flexible interface for connecting to networks.
 Its features include:
  * wide variety of settings;
  * ability to connect to (and maintain profiles for) both wired and
    wireless networks;
  * support for many encryption schemes, including WEP, WPA, WPA2 and
    custom schemes;
  * wireless-tools compatibility.

This package provides the Curses/Urwid client, which is the client
of choice in environments without X server.

%package cli
Summary:        Wired and wireless network manager - scriptable console client
Group:          Productivity/Networking/System
Requires:       %{name}-daemon
Provides:       %{name}-client
Recommends:     %{name}-lang = %{version}

%description cli
Wicd is a general-purpose network configuration server which aims
 to provide a simple but flexible interface for connecting to networks.
 Its features include:
  * wide variety of settings;
  * ability to connect to (and maintain profiles for) both wired and
    wireless networks;
  * support for many encryption schemes, including WEP, WPA, WPA2 and
    custom schemes;
  * wireless-tools compatibility.

This package provides a scriptable console client.

%package -n python-%{name}
Summary:        Wired and wireless network manager - Python module
Group:          Productivity/Networking/System
Requires:       python >= 2.7

%description -n python-%{name}
Wicd is a general-purpose network configuration server which aims
 to provide a simple but flexible interface for connecting to networks.
 Its features include:
  * wide variety of settings;
  * ability to connect to (and maintain profiles for) both wired and
    wireless networks;
  * support for many encryption schemes, including WEP, WPA, WPA2 and
    custom schemes;
  * wireless-tools compatibility.

This package provides the Python module used by Wicd.

%{lang_package}

%prep
%setup -q
%patch0 -p1
%patch1 -p0
%patch2 -p0
%patch3 -p0
%patch4 -p0
%patch5 -p0
%patch6 -p0

%build
%{__python} setup.py configure \
            --distro=%{DISTRO} \
            --no-install-acpi \
            --no-install-docs \
		    --wicdgroup=netdev \
%if 0%{?suse_version}
		    --loggroup=root \
%else
		    --loggroup=adm \
%endif
            --systemd=%{_unitdir} \
            --no-install-init \
            --no-install-gnome-shell-extensions

%{__python} setup.py compile_translations

# pybabel currently doesn't support Asturian
#msgfmt po/ast.po -o translations/ast/LC_MESSAGES/wicd.mo
%{__python} setup.py build

%install
%{__python} setup.py install --prefix=%{_prefix} --skip-build --root=%{buildroot} --install-lib=%python2_sitelib

%{__mkdir} -p %{buildroot}/var/lib/%{name}/configurations

%suse_update_desktop_file $RPM_BUILD_ROOT/%{_sysconfdir}/xdg/autostart/%{name}-tray.desktop

# Add symlink to /usr/sbin/service (required for systemd service)
ln -rs $RPM_BUILD_ROOT/%{_sbindir}/service $RPM_BUILD_ROOT/%{_sbindir}/rcwicd

find $RPM_BUILD_ROOT/ -type f  -iname '*.la' -exec rm {} \;
find $RPM_BUILD_ROOT/ -type f  -iname '*.a' -exec rm {} \;
find $RPM_BUILD_ROOT/ -name ".empty_on_purpose" -delete

rm -rf $RPM_BUILD_ROOT/var/run

rm -f $RPM_BUILD_ROOT/%{_libexecdir}/pm-utils/sleep.d/55%{name}

# Wicd installs a logrotate script but script name is not conform
mv "$RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.d/%{name}.logrotate" "$RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.d/%{name}-daemon"

find $RPM_BUILD_ROOT/ -name "*.png" -exec chmod 644 {} \;
find $RPM_BUILD_ROOT/%{_sysconfdir}/%{name}/ -type f -exec chmod 644 {} \;
find $RPM_BUILD_ROOT/ \( -name "*.glade" -o -name "*.conf" -o -name "*.desktop" \) -exec chmod 644 {} \;

%fdupes -s %{buildroot}

%suse_update_desktop_file -r %{name} System Network

%find_lang %name

%clean
rm -rf $RPM_BUILD_ROOT

%pre daemon
%service_add_pre %{name}.service

%post daemon
%service_add_post %{name}.service

%preun daemon
%service_del_preun %{name}.service

%postun daemon
%service_del_postun %{name}.service

%files
%defattr(-,root,root)
%doc AUTHORS CHANGES README

%files daemon
%defattr(-,root,root)
/var/lib/%{name}
/var/log/%{name}
#%%{_libexecdir}/pm-utils/sleep.d/55%%{name}
%{_sbindir}/*
%{_mandir}/man5/*.gz
%{_mandir}/man8/%{name}.8.gz
%dir %{_mandir}/nl
%dir %{_mandir}/nl/man5
%{_mandir}/nl/man5/*.gz
%dir %{_mandir}/nl/man8
%{_mandir}/nl/man8/%{name}.8.gz

%defattr(755,root,root)
%dir %{_datadir}/%{name}/daemon
%dir %{_datadir}/%{name}
%dir %{_datadir}/%{name}/backends
%{_datadir}/%{name}/backends/*
%{_datadir}/%{name}/daemon/*

%defattr(644,root,root)
%{_datadir}/dbus-1/system-services/org.%{name}.daemon.service

%attr(644,root,root)
%dir %{_sysconfdir}/%{name}/encryption
%dir %{_sysconfdir}/%{name}/encryption/templates
%config %{_sysconfdir}/%{name}/encryption/templates/*

%defattr(755,root,root)
%dir %{_sysconfdir}/%{name}
%dir %{_sysconfdir}/%{name}/scripts

%defattr(644,root,root)
%{_unitdir}/%{name}.service
%{_sbindir}/rcwicd
%config %{_sysconfdir}/dbus-1/system.d/%{name}.conf
%config %{_sysconfdir}/logrotate.d/%{name}-daemon
%config %{_sysconfdir}/%{name}/dhclient.conf.template.default
%config %{_sysconfdir}/%{name}/scripts/*

%files gtk
%defattr(755,root,root)
%dir %{_datadir}/%{name}
%dir %{_datadir}/%{name}/gtk
%dir %{_mandir}/nl
%dir %{_mandir}/nl/man1
%{_bindir}/%{name}-client
%{_bindir}/%{name}-gtk
%{_datadir}/%{name}/gtk/configscript.py
%{_datadir}/%{name}/gtk/prefs.py
%{_datadir}/%{name}/gtk/%{name}-client.py
%{_datadir}/%{name}/gtk/gui.py

%defattr(644,root,root)
%dir %{_datadir}/%{name}
%dir %{_datadir}/%{name}/icons
%dir %{_datadir}/%{name}/icons/hicolor
%dir %{_datadir}/%{name}/icons/hicolor/*
%dir %{_datadir}/%{name}/icons/hicolor/*/status
%dir %{_datadir}/%{name}/icons/hicolor/*/devices
%{_datadir}/icons/hicolor/*/apps/%{name}*
%{_datadir}/%{name}/icons/hicolor/*/status/*
%{_datadir}/%{name}/icons/hicolor/*/devices/wired-gui.*
%{_sysconfdir}/xdg/autostart/%{name}-tray.desktop
%{_datadir}/applications/*
%{_datadir}/pixmaps/%{name}*
%{_datadir}/%{name}/gtk/%{name}.ui
%{_datadir}/%{name}/gtk/guiutil.py
%{_datadir}/%{name}/gtk/netentry.py

%defattr(644,root,root)
%{_mandir}/man1/%{name}-client.1.gz
%{_mandir}/nl/man1/%{name}-client.1.gz

%files -n python-%{name}
%defattr(755,root,root)
%python2_sitelib/%{name}/*.py
%python2_sitelib/%{name}/*.pyc
%dir %python2_sitelib/%{name}

%defattr(644,root,root)
%python2_sitelib/%{name}/__init__.py
%python2_sitelib/%{name}/misc.py
%python2_sitelib/%{name}/wpath.py
%python2_sitelib/%{name}/misc.pyc
%python2_sitelib/%{name}/wpath.pyc
%python2_sitelib/%{name}-%{version}-py%py2_ver.egg-info

%files cli
%defattr(-,root,root)
%{_bindir}/%{name}-cli
%{_mandir}/man8/%{name}-cli.8.gz

%attr(755,root,root)
%dir %{_datadir}/%{name}
%dir %{_datadir}/%{name}/cli
%{_datadir}/%{name}/cli/%{name}-cli.py

%files curses
%defattr(-,root,root)
%{_bindir}/%{name}-curses
%{_mandir}/man8/%{name}-curses.8.gz
%dir %{_mandir}/nl
%dir %{_mandir}/nl/man8
%{_mandir}/nl/man8/%{name}-curses.8.gz

%defattr(755,root,root)
%dir %{_datadir}/%{name}
%dir %{_datadir}/%{name}/curses
%{_datadir}/%{name}/curses/*

%files lang -f %{name}.lang
%defattr(-,root,root,-)

%changelog
openSUSE Build Service is sponsored by