1/*! \page builddependencies Generating build dependencies automatically
2
3As we start updating packages for the next Red Hat distro, I'd like to see
4packages start to make use of build dependencies. Basically build
5dependencies are just like install dependencies, but they are resolved
6against the build system just after parsing the spec file. Syntactically,
7build dependencies look just like install dependencies in a spec file with
8"Build" prefixed:
9
10\verbatim
11	BuildPreReq:
12	BuildRequires:
13	BuildConflicts:
14\endverbatim
15
16All the above dependencies include versions, files, existence/range tests, etc.
17The build dependency checking can also be turned off with --nodeps if necessary
18just like install dependency checking can. Eventually, build dependencies will
19be automated in rpm, but the major impediment to that effort is the engineering
20required to maintain the pretense that src rpm's are "noarch".
21
22Meanwhile, I've added a package called "InDependence-1.0" to powertools-6.2
23that may be of use in detecting build dependencies that can be added to
24spec files as part of rebuilding packages for Red Hat 6.2.
25
26Here's a short example of how to generate the package/file names that were used
27while building gnorpm using InDependence:
28
29\verbatim
30	rpm -U /mnt/redhat/comps/powertools/6.2/i386/InDependence-1.0-3.i386.rpm
31	rpm -i /mnt/redhat/comps/dist/6.2/SRPMS/gnorpm-0.9-11.src.rpm
32	cd /usr/src/redhat/SPECS
33	dep -detail rpmbuild -ba gnorpm.spec >& xxx
34	...
35	(the build will take longer since both dep and strace are pigs)
36	...
37	grep -- '::' xxx > yyy
38\endverbatim
39
40\verbatim
41Aside:	The dep perl wrapper is a "pig" only because it's exec'ing
42		rpm -qf <filename>
43        in order to turn filenames into package names. There are easier/faster
44	ways to get this information...
45
46	There's no way to speed up the
47		/sbin/strace -q -etrace=open,execve -o ...
48	command itself. The eventual implementation in rpm will snatch the
49	same open/execve syscalls using LD_PRELOAD.
50
51	Patches cheerfully accepted :-)
52\endverbatim
53
54Here's what's in yyy (\<packagename\>::\<filename\> format):
55
56\verbatim
57	ORBit-devel-0.4.95-2::/usr/bin/orbit-config
58	XFree86-libs-3.3.5-6::/usr/X11R6/lib/libICE.so.6
59	XFree86-libs-3.3.5-6::/usr/X11R6/lib/libSM.so.6
60	XFree86-libs-3.3.5-6::/usr/X11R6/lib/libX11.so.6
61	XFree86-libs-3.3.5-6::/usr/X11R6/lib/libXext.so.6
62	audiofile-0.1.9-1::/usr/lib/libaudiofile.so.0
63	autoconf-2.13-5::/usr/bin/autoconf
64	autoconf-2.13-5::/usr/bin/autoheader
65	autoconf-2.13-5::/usr/share/autoconf/acgeneral.m4
66	autoconf-2.13-5::/usr/share/autoconf/autoconf.m4f
67	automake-1.4-5::/usr/bin/aclocal
68	automake-1.4-5::/usr/bin/automake
69	bash-1.14.7-16::/bin/sh
70	bash-1.14.7-16::/etc/bashrc
71	binutils-2.9.1.0.23-7::/usr/bin/strip
72	binutils-2.9.1.0.23-7::/usr/lib/libbfd-2.9.1.0.24.so
73	binutils-2.9.1.0.23-7::/usr/lib/libopcodes-2.9.1.0.24.so
74	bzip2-0.9.5c-1::/usr/lib/libbz2.so.0
75	dev-2.7.10-2::/dev/null
76	diffutils-2.7-16::/usr/bin/cmp
77	egcs-1.1.2-25::/usr/bin/gcc
78	egcs-1.1.2-25::/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/specs
79	esound-0.2.14-1::/usr/lib/libesd.so.0
80	file-3.27-3::/usr/bin/file
81	file-3.27-3::/usr/share/magic
82	fileutils-4.0-8::/bin/chgrp
83	fileutils-4.0-8::/bin/chmod
84	fileutils-4.0-8::/bin/chown
85	fileutils-4.0-8::/bin/cp
86	fileutils-4.0-8::/bin/ln
87	fileutils-4.0-8::/bin/ls
88	fileutils-4.0-8::/bin/mkdir
89	fileutils-4.0-8::/bin/mv
90	fileutils-4.0-8::/bin/rm
91	fileutils-4.0-8::/usr/bin/install
92	findutils-4.1-32::/usr/bin/xargs
93	gawk-3.0.4-1::/bin/awk
94	gawk-3.0.4-1::/bin/gawk
95	gettext-0.10.35-13::/usr/bin/xgettext
96	glib-1.2.5-1::/usr/lib/libglib-1.2.so.0
97	glib-1.2.5-1::/usr/lib/libgmodule-1.2.so.0
98	glib-devel-1.2.5-1::/usr/bin/glib-config
99	glibc-2.1.2-13::/etc/localtime
100	glibc-2.1.2-13::/etc/nsswitch.conf
101	glibc-2.1.2-13::/lib/ld-linux.so.2
102	glibc-2.1.2-13::/lib/libc.so.6
103	glibc-2.1.2-13::/lib/libcrypt.so.1
104	glibc-2.1.2-13::/lib/libdb.so.2
105	glibc-2.1.2-13::/lib/libdl.so.2
106	glibc-2.1.2-13::/lib/libm.so.6
107	glibc-2.1.2-13::/lib/libnsl.so.1
108	glibc-2.1.2-13::/lib/libnss_dns.so.2
109	glibc-2.1.2-13::/lib/libnss_files.so.2
110	glibc-2.1.2-13::/lib/libnss_nis.so.2
111	glibc-2.1.2-13::/lib/libnss_nisplus.so.2
112	glibc-2.1.2-13::/lib/libresolv.so.2
113	glibc-2.1.2-13::/usr/bin/ldd
114	gnome-libs-1.0.54-1::/usr/lib/libart_lgpl.so.2
115	gnome-libs-1.0.54-1::/usr/lib/libgnome.so.32
116	gnome-libs-1.0.54-1::/usr/lib/libgnomesupport.so.0
117	gnome-libs-1.0.54-1::/usr/lib/libgnomeui.so.32
118	gnome-libs-devel-1.0.54-1::/usr/bin/gnome-config
119	grep-2.3-2::/bin/egrep
120	grep-2.3-2::/bin/fgrep
121	grep-2.3-2::/bin/grep
122	gtk+-1.2.5-2::/usr/lib/libgdk-1.2.so.0
123	gtk+-1.2.5-2::/usr/lib/libgtk-1.2.so.0
124	imlib-1.9.7-1::/usr/lib/libgdk_imlib.so.1
125	libghttp-1.0.4-1::/usr/lib/libghttp.so.1
126	libtool-1.3.3-1::/usr/bin/libtoolize
127	libtool-1.3.3-1::/usr/share/libtool/config.guess
128	libtool-1.3.3-1::/usr/share/libtool/config.sub
129	libtool-1.3.3-1::/usr/share/libtool/ltconfig
130	libtool-1.3.3-1::/usr/share/libtool/ltmain.sh
131	libxml-1.4.0-1::/usr/lib/libxml.so.1
132	libxml-devel-1.4.0-1::/usr/bin/xml-config
133	m4-1.4-12::/usr/bin/m4
134	make-3.77-6::/usr/bin/make
135	mktemp-1.5-1::/bin/mktemp
136	net-tools-1.53-1::/bin/hostname
137	patch-2.5-9::/usr/bin/patch
138	rootfiles-5.2-5::/root/.bashrc
139	rpm-3.0.4-0.16::/bin/rpm
140	rpm-3.0.4-0.16::/usr/lib/librpm.so.0
141	rpm-3.0.4-0.16::/usr/lib/rpm/find-provides
142	rpm-3.0.4-0.16::/usr/lib/rpm/find-requires
143	rpm-3.0.4-0.16::/usr/lib/rpm/macros
144	rpm-3.0.4-0.16::/usr/lib/rpm/rpmpopt
145	rpm-3.0.4-0.16::/usr/lib/rpm/rpmrc
146	sed-3.02-4::/bin/sed
147	setup-2.0.5-1::/etc/group
148	setup-2.0.5-1::/etc/host.conf
149	setup-2.0.5-1::/etc/passwd
150	sh-utils-2.0-1::/bin/basename
151	sh-utils-2.0-1::/bin/false
152	sh-utils-2.0-1::/bin/sleep
153	sh-utils-2.0-1::/bin/true
154	sh-utils-2.0-1::/usr/bin/expr
155	sh-utils-2.0-1::/usr/bin/id
156	texinfo-3.12h-2::/usr/bin/makeinfo
157	textutils-2.0-2::/bin/cat
158	textutils-2.0-2::/bin/sort
159	textutils-2.0-2::/usr/bin/cut
160	textutils-2.0-2::/usr/bin/tr
161	zlib-1.1.3-5::/usr/lib/libz.so.1
162\endverbatim
163
164The information can be used to generate build prerequisites. What is still
165needed is a sensible approach on
166
167\verbatim
168	1) eliminating obvious common dependencies (e.g. libtool, egcs).
169	2) identifying (and removing for now) per-platform build dependencies.
170	3) deciding on whether to add the build dependency on a file or on the
171	package that contains the file.
172	4) if adding a dependency on a package, choosing version ranges as
173	appropriate.
174\endverbatim
175
176but that's up to individual packagers.
177
178*/
179