summaryrefslogtreecommitdiffstats
path: root/rpm/mk-rpm.sh
blob: 9e506722ba1e2a1f519f60dfd064c0b904d737c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash

{
    pushd $(git rev-parse --show-toplevel)

    # Check if setup.py version matches rpm/SPECS/logactio.spec
    PYVER=$(awk -F\" '/version =/ { print $2 }' setup.py)
    SPECVER=$(awk -F\  '/^Version:/{ print $2}' rpm/SPECS/logactio.spec)
    if [ "$PYVER" != "$SPECVER" ]; then
        echo "*** ERROR ***  Version mismatch between setup.py (v$PYVER) and logactio.spec (v$SPECVER)"
        exit 1
    fi

    python2 setup.py sdist --formats=bztar
    cp dist/logactio-*.tar.bz2 rpm/SOURCES
    cp init/sysv/logactio rpm/SOURCES/logactio.sysv
    cp init/systemd/logactio* rpm/SOURCES/
    rpmbuild -ba --define "_topdir $(pwd)/rpm" rpm/SPECS/logactio.spec

    popd
}