Debian Codegraph @

build/redhat/NOTES

raw
1 Here's a useful usenet article that shows how to build a filelist
2 instead of having to specify each one.
3 -----------------------------------------------------------------
4
5 From: John Ross Hunt ([email protected])
6 Subject: RE: Newbie to build spec files
7 Newsgroups: linux.redhat.rpm
8 Date: 2000/07/27
9
10
11 > So, is there a better way, in RPM 3, to populate %files?
12 > Because I know
13 > 'buildroot' and it has nothing to do with %files.
14
15 I found this bit of code in a .spec file to build a %files list on the fly
16 and have been using it ever since. I've always thought RPM should be able
17 to provide a default %files list in the event one isn't present in the .spec
18 file.
19
20 --
21 John Ross Hunt
22 [email protected] <mailto:[email protected]>
23
24
25
26 %define pkg_name foo
27
28 %install
29 rm -rf $RPM_BUILD_ROOT
30 make install DESTDIR=$RPM_BUILD_ROOT
31
32 cd $RPM_BUILD_ROOT
33 find . -type d | sed '1,2d;s,^\.,\%attr(-\,root\,root) \%dir ,' > \
34 $RPM_BUILD_DIR/file.list.%{pkg_name}
35
36 find . -type f | sed -e 's,^\.,\%attr(-\,root\,root) ,' \
37 -e '/\/etc\//s|^|%config|' >> \
38 $RPM_BUILD_DIR/file.list.%{pkg_name}
39
40 find . -type l | sed 's,^\.,\%attr(-\,root\,root) ,' >> \
41 $RPM_BUILD_DIR/file.list.%{pkg_name}
42
43 %clean
44 rm -rf $RPM_BUILD_ROOT $RPM_BUILD_DIR/file.list.%{pkg_name}
45
46 %files -f ../file.list.%{pkg_name}
47 %doc README TODO example
48 -----------------------------------------------------------------