Blob Blame History Raw
# Generated by go2rpm 1
%bcond_without check

# https://github.com/OpenPrinting/ipp-usb
%global goipath         github.com/OpenPrinting/ipp-usb
Version:                0.9.14
%global tag             0.9.14

%gometa

%global common_description %{expand:
HTTP reverse proxy, backed by IPP-over-USB connection to device. It enables
 driverless support for USB devices capable of using IPP-over-USB protocol.
}

%global golicenses      LICENSE
%global godocs          README.md

# we ship devel rpm too, which means it needs to require avahi and libusbx
# too to work correctly
%global godevelheader %{expand:
Requires:  pkgconfig(avahi-client) >= 0.7
Requires:  pkgconfig(libusb-1.0) >= 1.0
}

Name:           %{goname}
Release:        1%{?dist}
Summary:        HTTP reverse proxy, backed by IPP-over-USB connection to device

# Upstream license specification: BSD-2-Clause
License:        BSD
URL:            %{gourl}
Source0:        %{gosource}

# needed for registering device on localhost
BuildRequires:  pkgconfig(avahi-client) >= 0.7
# implements IPP protocol used in ipp-usb
BuildRequires:  golang(github.com/OpenPrinting/goipp)
# for functions working with USB devices
BuildRequires:  pkgconfig(libusb-1.0) >= 1.0
# for using pkg-config in spec
BuildRequires:  pkgconf-pkg-config
# for macros in rpm scriptlets
BuildRequires:  systemd-rpm-macros


%package -n ipp-usb
Summary: HTTP reverse proxy capable of IPP-over-USB connection
# ipp-usb is a systemd service
Requires: systemd
# ipp-usb is started when USB device shows up and has a udev rule for it
Requires: systemd-udev

%description -n ipp-usb
%{common_description}

%description
%{common_description}

%gopkg

%prep
%goprep

%build
%gobuild -o %{gobuilddir}/bin/ipp-usb %{goipath}

%install
%gopkginstall

install -m 0755 -vd                        %{buildroot}%{_sbindir}
install -m 0755 -vp %{gobuilddir}/bin/*    %{buildroot}%{_sbindir}/
install -m 0755 -vd                        %{buildroot}%{_udevrulesdir}
install -m 0644 -vp systemd-udev/*.rules   %{buildroot}%{_udevrulesdir}
install -m 0755 -vd                        %{buildroot}%{_unitdir}
install -m 0644 -vp systemd-udev/*.service %{buildroot}%{_unitdir}
install -m 0755 -vd                        %{buildroot}%{_sysconfdir}/ipp-usb
install -m 0644 -vp ipp-usb.conf           %{buildroot}%{_sysconfdir}/ipp-usb/
install -m 0755 -vd                        %{buildroot}%{_mandir}/man8
install -m 0644 -vp ipp-usb.8              %{buildroot}%{_mandir}/man8

%post -n ipp-usb
%systemd_post ipp-usb.service

%preun -n ipp-usb
%systemd_preun ipp-usb.service

%postun -n ipp-usb
%systemd_postun_with_restart ipp-usb.service

%if %{with check}
%check
%gocheck
%endif

%files -n ipp-usb
%license LICENSE
%doc README.md
%{_sbindir}/*
%{_mandir}/man8/ipp-usb.8.*
%dir %{_sysconfdir}/ipp-usb/
%config(noreplace) %{_sysconfdir}/ipp-usb/ipp-usb.conf
%{_udevrulesdir}/*.rules
%{_unitdir}/*.service

%gopkgfiles

%changelog
* Tue Oct 06 2020 Zdenek Dohnal <zdohnal@redhat.com> - 0.9.14-1
- 0.9.14-1

* Fri Sep 04 2020 Zdenek Dohnal <zdohnal@redhat.com> - 0.9.13-1
- Initial import (#1875726)