summaryrefslogtreecommitdiff
path: root/packaging/rpmlint-mini.spec
blob: adeb8ee3d6f5f209eafa727383fd6f011008e925 (plain)
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
Name:           rpmlint-mini
#BuildRequires:  glib2-devel
#BuildRequires:  glib2-devel-static
BuildRequires:  pkg-config
BuildRequires:  python-magic
BuildRequires:  python-xml
BuildRequires:  python-rpm
BuildRequires:  rpmlint
# need to fetch the file from there
#BuildRequires:  checkbashisms
BuildRequires:  dash
BuildRequires:  libtool
#BuildRequires:  polkit-default-privs
Requires:       cpio
Summary:        Rpm correctness checker
License:        GPL-2.0+
Group:          System/Packages
Version:        1.5
Release:        0
Url:            http://rpmlint.zarb.org/
Source:         %{name}-%{version}.tar.bz2
#Source99:       desktop-file-utils-0.22.tar.xz
Source100:      rpmlint-deps.txt
Source101:      rpmlint.wrapper
Source102:      rpmlint-mini.config
Source103:      polkit-default-privs.config
Source1000:     rpmlint-mini.rpmlintrc
Source1001:     rpmlint-mini.manifest

%description
Rpmlint is a tool to check common errors on rpm packages. Binary and
source packages can be checked.

%prep
#%setup -q  -b 99
%setup -q
cp %{SOURCE1001} .
#cd ../desktop-file-utils-0.22

%build
#cd ../desktop-file-utils-0.22
#pushd src
#make desktop-file-validate V=1 DESKTOP_FILE_UTILS_LIBS="%{_libdir}/libglib-2.0.a -lpthread -lrt"
#popd

%install
%ifarch armv7l
%define ARCH armv7l
%endif
%ifarch armv7hl
%define ARCH armv7hl
%endif
%ifarch %ix86
%define ARCH i586
%endif
%ifarch x86_64
%define ARCH x86_64
%endif
%ifarch aarch64
%define ARCH aarch64
%endif
#cd ../desktop-file-utils-0.22
pwd
# test if the rpmlint works at all
set +e
/usr/bin/rpmlint rpmlint
test $? -gt 0 -a $? -lt 60 && exit 1
set -e
# okay, lets put it together
mkdir -p $RPM_BUILD_ROOT/opt/testing/share/rpmlint
install -m 755 -D src/%{ARCH}/desktop-file-validate $RPM_BUILD_ROOT/opt/testing/bin/desktop-file-validate
cp -a /usr/share/rpmlint/*.py $RPM_BUILD_ROOT/opt/testing/share/rpmlint
# install config files
install -d -m 755 $RPM_BUILD_ROOT/opt/testing/share/rpmlint/mini
for i in /etc/rpmlint/{licenses,rpmgroups,pie}.config "%{SOURCE103}"; do
  cp $i $RPM_BUILD_ROOT/opt/testing/share/rpmlint/mini
done
install -m 644 -D /usr/share/rpmlint/config $RPM_BUILD_ROOT/opt/testing/share/rpmlint/config
install -m 644 "%{SOURCE102}" $RPM_BUILD_ROOT/opt/testing/share/rpmlint
# extra data
install -m 755 -d $RPM_BUILD_ROOT/opt/testing/share/rpmlint/data
#install -m 644 /etc/polkit-default-privs.standard $RPM_BUILD_ROOT/opt/testing/share/rpmlint/data
install -m 644 -D /usr/include/python%{py_ver}/pyconfig.h $RPM_BUILD_ROOT/opt/testing/include/python%{py_ver}/pyconfig.h
#
cd %{py_libdir}
for f in $(<%{SOURCE100}); do
  find -path "*/$f" -exec install -D {} $RPM_BUILD_ROOT/opt/testing/%{_lib}/python%{py_ver}/{} \;
done
cd /usr/lib/python%{py_ver}
for f in $(<%{SOURCE100}); do
  find -path "*/$f" -exec install -D {} $RPM_BUILD_ROOT/opt/testing/%{_lib}/python%{py_ver}/{} \;
done
install -m 644 /usr/lib/python%{py_ver}/site-packages/magic.py $RPM_BUILD_ROOT/opt/testing/%{_lib}/python%{py_ver}/site-packages/magic.py
install -D /usr/bin/python $RPM_BUILD_ROOT/opt/testing/bin/python
cp -a %_libdir/libmagic.so.* $RPM_BUILD_ROOT/opt/testing/%{_lib}
cp -a %_libdir/libpython%{py_ver}.so.* $RPM_BUILD_ROOT/opt/testing/%{_lib}
cp -a %_bindir/rpmlint $RPM_BUILD_ROOT/opt/testing/share/rpmlint/rpmlint.py
pushd $RPM_BUILD_ROOT/opt/testing/share/rpmlint
PYTHONOPTIMIZE=1 python %py_libdir/py_compile.py *.py
rm *.py
popd
pushd $RPM_BUILD_ROOT/opt/testing/%{_lib}/python%{py_ver}/site-packages/
PYTHONOPTIMIZE=1 find -name \*.py -exec python %py_libdir/py_compile.py {} \;
find -name \*.py -delete
popd
rm -rf $RPM_BUILD_ROOT/{usr,etc}
rm -f $RPM_BUILD_ROOT/opt/testing/bin/rpmlint
install -m 755 -D %{SOURCE101} $RPM_BUILD_ROOT/opt/testing/bin/rpmlint
# hackatlon
%define my_requires %{_builddir}/%{?buildsubdir}/%{name}-requires
cat << EOF > %my_requires
cat - > file.list
%{__find_requires} < file.list > requires.list
%{__find_provides} < file.list > provides.list
while read i; do
    grep -F -v "\$i" requires.list > requires.list.new
    mv requires.list.new requires.list
done < provides.list
cat requires.list
rm -f requires.list provides.list file.list
EOF
chmod +x %my_requires
%define _use_internal_dependency_generator 0
%define __find_requires %my_requires
%define __find_provides %nil
# final run check to detect python dep changes
LD_LIBRARY_PATH=$RPM_BUILD_ROOT/opt/testing/%_lib
PYTHONPATH=$RPM_BUILD_ROOT/opt/testing/share/rpmlint
export PYTHONPATH LD_LIBRARY_PATH
$RPM_BUILD_ROOT/opt/testing/bin/python -tt -u -O $RPM_BUILD_ROOT/opt/testing/share/rpmlint/rpmlint.pyo --help || exit 1
echo ".. ok"

if [ "x%{_lib}" != "xlib" ] ; then
    ln -s /opt/testing/%{_lib} $RPM_BUILD_ROOT/opt/testing/lib
fi

%files
%manifest %{name}.manifest
%defattr(-,root,root,0755)
/opt/testing