-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrpmbuild-setup
executable file
·56 lines (40 loc) · 1.31 KB
/
rpmbuild-setup
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/sh
set -e
set -x
DISTRO_RELEASE="el$( lsb_release -sr | awk -F "." '{ print $1 }' )_1"
DEB_RELEASE="$( head debian-common/changelog -n1 | sed 's/.*(\([^)]*\)).*/\1/' )"
RELEASE="$( echo "$DEB_RELEASE" | cut -d '-' -f2 )"
VERSION="$( echo "$DEB_RELEASE" | cut -d '-' -f1 )"
PYTHON_VERSION_MAJOR=$(python3 --version | cut -d ' ' -f2 | cut -d '.' -f1)
PYTHON_VERSION_MINOR=$(python3 --version | cut -d ' ' -f2 | cut -d '.' -f2)
PYTHON_REQUIRES="python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}"
PYTHON_PATH="python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}"
echo "Setting up for '$DISTRO_RELEASE' Version: '$VERSION' Release: '$RELEASE'"
TOPDIR="$( pwd )/rpmbuild"
SRCDIR="$( pwd )"
mkdir -p "$TOPDIR"
mkdir -p "$TOPDIR/RPMS"
mkdir -p "$TOPDIR/BUILD"
mkdir -p "$TOPDIR/BUILDROOT"
cat > rpmbuild/config.spec <<SPECFILE
%define _topdir $TOPDIR
%define _srcdir $SRCDIR
Name: python3-cinp
Summary: CInP Client/Server Libraries
Version: $VERSION
Release: $RELEASE.$DISTRO_RELEASE
License: Apache2
Group: multiverse/python
Requires: $PYTHON_REQUIRES
BuildArch: noarch
%description
CInP Python Client and Server Libraries
%install
cd %{_srcdir}
make install DESTDIR=%{buildroot}/
%files
/usr/lib/$PYTHON_PATH/site-packages/*
%changelog
%post
%postun
SPECFILE