-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdroid-hal-prjconf.inc
54 lines (44 loc) · 1.3 KB
/
droid-hal-prjconf.inc
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
Name: droid-hal-prjconf-%{device}
Summary: Project configs for %{device} Droid HAL adaptation for OBS
Version: 0
Release: 1
Group: Configs
License: BSD-3-Clause
Source0: %{name}-%{version}.tar.bz2
Provides: project-config
%description
%{summary}.
%prep
%setup -q -n %{name}-%{version}
%install
CONFDIR=prjconf
SUBMODULE=droid-hal-prjconf
SRC_GENERIC=$SUBMODULE/$CONFDIR
SRC_SPECIFIC=$CONFDIR
DESTDIR=$RPM_BUILD_ROOT/%{_datadir}/$CONFDIR
DEST=$DESTDIR/prjconf.xml
rm -rf %{buildroot}
mkdir -p $DESTDIR
cp -f $SRC_GENERIC/prjconf.inc $DEST
# The syntax inside the project configuration is not XML but RPM-like.
# Instead of the xml extension the inc extension makes more sense here,
# support both file extensions.
for ext in inc xml ; do
if [ -f $SRC_SPECIFIC/prjconf.$ext ]; then
if grep -q "^Macros:" $SRC_SPECIFIC/prjconf.$ext; then
echo "prjconf.$ext must not contain Macros section. Put them to macros.$ext"
exit -1
fi
cat $SRC_SPECIFIC/prjconf.$ext >> $DEST
fi
done
echo "Macros:" >> $DEST
cat $SRC_GENERIC/macros.inc >> $DEST
for ext in inc xml ; do
if [ -f $SRC_SPECIFIC/macros.$ext ]; then
grep -v "^Macros:" $SRC_SPECIFIC/macros.$ext >> $DEST
fi
done
%files
%defattr(-,root,root,-)
%{_datadir}/prjconf/*.xml