Building packages in COPR with own settings

Let’s start from some story behind. Let’s look at createrepo_c, it supports building with/without DRPM library. In RPM spec file we have:

%if 0%{?rhel} && 0%{?rhel} <= 7
%bcond_with drpm
%else
%bcond_without drpm
%endif

%if %{with drpm}
BuildRequires:  drpm-devel
%endif

Which means on RHEL8+ and other distros it will require at the build-time drpm-devel which is correct, and will not require it on RHEL7-. We don’t have drpm package in RHEL7- so it’s correct.

Now I want to build createrepo_c with drpm support for RHEL7 on COPR. I already built drpm there, but createrepo_c will not use drpm because %bcond_with disables option by default and allows you to enable it. Unfortunately (or fortunately) there is no way to pass parameters like --with drpm to COPR like to rpmbuild.. So we need to create package with RPM macros which will enable this option for us. Let’s create it!

Name:           drpm-rpm-macros
Version:        1
Release:        1%{?dist}
Summary:        RPM macros to enable DRPM

License:        Public Domain
URL:            https://github.com/ignatenkobrain/drpm-rpm-macros

BuildArch:      noarch
Provides:       drpm-macros = %{version}-%{release}

%description
%{summary}.

We have on EL7 and below %bcond_with drpm, but we want to enable DRPM.

%prep
%autosetup -c -D -T

%build
# Nothing to build

%install
mkdir -p %{buildroot}/%{_rpmconfigdir}/macros.d/
echo '%_with_drpm 1' > %{buildroot}/%{_rpmconfigdir}/macros.d/macros.drpm

%files
%{_rpmconfigdir}/macros.d/macros.drpm

%changelog
* Tue Apr 12 2016 Igor Gnatenko <ignatenko@redhat.com> - 1-1
- Initial package

Now we need to create src.rpm for this package and submit for building to the COPR. Once it’s done we need to modify buildroot options to always install this package. Just open settings of the project, click edit button on interesting chroot (in my case it’s epel-7-x86_64), add drpm-rpm-macros to the packages line and save. In all next builds in this chroot you will have drpm-rpm-macros installed automatically.

Now we can submit building of createrepo_c without any changes and it will be built with enabled drpm feature.

How-to set up network audio server based on PulseAudio and auto-discovered via Avahi

Today i played with my cubietruck and wanted to make network audio server. I just open laptop, connect to WiFi, choose remote sound device in gnome-control-center and listen music.

First of all I’d want to say many thanks to Jonas Wielicki for help with debugging problems and providing his ansible playbook with the same task, Stefan Majewsky who inspired Jonas about configuration management and to Felipe Sateler for tip with permissions.

Server configuration

I have installed minimal Fedora so it means that I don’t have avahi, pulseaudio and other tools in system. Let’s install them:

# dnf install pulseaudio pulseaudio-module-zeroconf avahi

Continue reading →

Python q

q is python module for Quick-and-dirty debugging output for tired programmers. Did you know about it? Toshio Kuratomi said about q yesterday and I use it now everywhere when I’m trying to debug things.

It allow you to easy print variables, function arguments, function returns to temp file when you executing code. Let’s see example:

#!/usr/bin/env python3
import q

@q
def q_test(var1=None, var2=None):
    print(q|var1 + var2)

def main():
    s = {'test': list(range(6))}
    q_test('arg', 'next')
    q.q(s)

if __name__ == '__main__':
    main()

After execution /tmp/q looks like:
Python q output

Building GNOME Calendar on Fedora

If you tried to build GNOME Calendar on Fedora you’ve got error like this:

  CCLD     gnome-calendar
gcal-event-widget.o: In function `gcal_event_widget_is_multiday':
/home/brain/git/GNOME/gnome-calendar/src/gcal-event-widget.c:1033: undefined reference to `icaltime_days_in_year'

This is because bug in libical and fixed in 1.0.1 release (Fedora 20+ provides 1.0). What do you want? Update libical and libical-devel to new release. You can just enable my COPR repository (ignatenkobrain/gnome-calendar) and update/install that packages. Also you can install latest release version of gnome-calendar for repo, but it’s under heavy development and I’d recommend to try it using jhbuild.

P.S. We are going to have GNOME Calendar in Fedora 22+. You can track review request in RHBZ.

css.php