[DRBD-user] Re: Redhat 9 rpm build error

Lars Ellenberg Lars.Ellenberg at linbit.com
Thu Jan 22 13:33:50 CET 2004

Note: "permalinks" may not be as permanent as we would like,
direct links of old sources may well be a few messages off.


/ 2004-01-22 11:20:16 +0000
\ Nuno Miguel Pais Fernandes:
> On Wed, 2004-01-21 at 21:13, Garth Lezma wrote:
> > Hi folks,
> > 
> >             I'm trying to build an rpm from the 0.6.10 tarball for rh
> > 9. I made two changes.
> > 
> > 1. I modified the drbd_config add the rh specific line #define
> > SIGHAND_HACK
> > 2. I modified the kernel make file to take custom from the
> > EXTRAVERSION line.
> > 
> >  
> > 
> > I get the following error. I need to get a ha server up by the end of
> > the week so any help would be appreciated. Thanks.
> > 
> >  
> > 
> > RPM build errors:
> > 
> >     Installed (but unpackaged) file(s) found:
> >    /etc/drbd.conf
> >    /usr/share/man/ja/man5/drbd.conf.5.gz
> >    /usr/share/man/ja/man8/datadisk.8.gz
> >    /usr/share/man/ja/man8/drbd.8.gz
> >    /usr/share/man/ja/man8/drbdsetup.8.gz
> >    /usr/share/man/pt_BR/man5/drbd.conf.5.gz
> >    /usr/share/man/pt_BR/man8/datadisk.8.gz
> >    /usr/share/man/pt_BR/man8/drbd.8.gz
> >    /usr/share/man/pt_BR/man8/drbdsetup.8.gz

> Hum..
> 
> It seems a problem in spec file.
> Try adding to %files zone the specified files...

exactly.
though, my version of rpm does not choke on this.
please try the attached patch against 0.6.10.

	Lars Ellenberg
-------------- next part --------------
Index: Makefile
===================================================================
RCS file: /home/lars/DRBD/CVSHOME/drbd/drbd/Makefile,v
retrieving revision 1.20
diff -u -p -r1.20 Makefile
--- Makefile	7 Dec 2003 09:19:32 -0000	1.20
+++ Makefile	22 Jan 2004 12:01:40 -0000
@@ -20,7 +20,7 @@
 include Makefile.vars
 REL_VERSION = $(word 3, $(shell grep REL_VERSION drbd_config.h))
 
-all:
+all: INSTALL.html
 	@ for i in $(SUBDIRS); do $(MAKE) -C $$i all || test $$i = documentation || exit 1 ; done
 	@ echo -e "\n\tBuild successful."
 
@@ -29,7 +29,7 @@ install:
 
 clean:
 	@ set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i clean; done
-	rm -f *~ .filelist
+	rm -f *~ .filelist INSTALL.html INSTALL.pod
 	rm -rf dist
 
 uninstall:
@@ -37,10 +37,6 @@ uninstall:
 
 check_changelogs_up2date:
 	@ up2date=true; \
-	if ! grep "^Version: $(REL_VERSION)" >/dev/null 2>&1 drbd.spec; \
-	then \
-	   echo "You need to update the Version: tag in drbd.spec"; \
-	   up2date=false; fi; \
 	if ! sed -e '0,/^%changelog/d' drbd.spec \
 	   | grep "^- drbd ($(REL_VERSION)-" >/dev/null 2>&1 ; \
 	then \
@@ -57,8 +53,10 @@ check_changelogs_up2date:
 	$$up2date
 
 update.filelist:
-	cvs status | grep -o "/drbd/drbd/[^,]*" | sed "/documentation/d;s/\/drbd\/drbd/drbd-$(REL_VERSION)/" > .filelist
-	echo drbd-$(REL_VERSION)/documentation >> .filelist
+	cvs status | grep -o "/drbd/drbd/[^,]*" | \
+	sed "s/\/drbd\/drbd/drbd-$(REL_VERSION)/" > .filelist
+	find documentation -name "*.[58]" -o -name "*.html" | \
+	sed "s/^/drbd-$(REL_VERSION)\//" >> .filelist
 	echo drbd-$(REL_VERSION)/.filelist >> .filelist
 
 .filelist:
@@ -66,11 +64,13 @@ update.filelist:
 	@ false
 
 tgz: .filelist
+ifeq ($(FORCE),)
 	$(MAKE) -C documentation
+endif
 	cd scripts; ln -sf drbd datadisk
 	rm -f drbd-$(REL_VERSION)
 	ln -s . drbd-$(REL_VERSION)
-	tar -czvf drbd-$(REL_VERSION).tar.gz -T .filelist
+	tar --owner=0 --group=0 -czvf drbd-$(REL_VERSION).tar.gz --exclude CVS -T .filelist
 	rm drbd-$(REL_VERSION)
 
 ifeq ($(FORCE),)
@@ -83,15 +83,39 @@ rpm: tgz
 	         dist/RPMS/i386 \
 	         dist/SPECS \
 	         dist/SOURCES \
+	         dist/TMP \
 	         dist/install \
 	         dist/SRPMS
 	[ -h dist/SOURCES/drbd-$(REL_VERSION).tar.gz ] || \
 	  $(LN_S) $(PWD)/drbd-$(REL_VERSION).tar.gz \
 	          $(PWD)/dist/SOURCES/drbd-$(REL_VERSION).tar.gz
-	[ -f dist/SPECS/drbd.spec ] || \
-	  sed -e 's/^\(Packager:\).*/\1 ${USER}@${HOSTNAME}/;' drbd.spec \
-	  > dist/SPECS/drbd.spec
+	if test drbd.spec -nt dist/SPECS/drbd.spec ; then \
+	   sed -e 's/^\(Version:\).*/\1 '$(REL_VERSION)'/;' \
+	       -e 's/^\(Packager:\).*/\1 ${USER}@${HOSTNAME}/;' drbd.spec \
+	   > dist/SPECS/drbd.spec ; \
+	fi
 	$(RPMBUILD) -ba \
-	    --define "buildroot $(PWD)/dist/install" \
 	    --define "_topdir $(PWD)/dist" \
+	    --define "buildroot $(PWD)/dist/install" \
 	    $(PWD)/dist/SPECS/drbd.spec
+
+# the INSTALL file is writen in lge-markup, which is basically
+# wiki style plus some "conventions" :)
+# why don't I write in or convert to HTML directly?
+# editing INSTALL feels more natural this way ...
+
+INSTALL.html: INSTALL.pod
+	-pod2html --title "Howto Build and Install DRBD" \
+		< INSTALL.pod > INSTALL.html ; rm pod2htm[di].x~~
+#	-w3m -T text/html -dump < INSTALL.html > INSTALL.txt
+
+INSTALL.pod: INSTALL
+	-perl -pe 'BEGIN { print "=pod\n\n"; };                   \
+	 	s/^= +(.*?) +=$$/=head1 $$1/;                     \
+	 	s/^== +(.*?) +==$$/=head2 $$1/;                   \
+	 	if(s/^ +([^#]*)$$/$$1/ or /^\S/) {                \
+			s/(Note:)/B<$$1>/g;                       \
+			s/"([^"]+)"/C<$$1>/g;                     \
+	 		s,((^|[. ])/(\S|`[^`]*`)+),C<$$1>,g;\
+	 	}' \
+	 	< INSTALL > INSTALL.pod
Index: drbd.spec
===================================================================
RCS file: /home/lars/DRBD/CVSHOME/drbd/drbd/drbd.spec,v
retrieving revision 1.15
diff -u -p -r1.15 drbd.spec
--- drbd.spec	12 Dec 2003 14:39:48 -0000	1.15
+++ drbd.spec	22 Jan 2004 12:30:10 -0000
@@ -1,6 +1,6 @@
 Name: drbd
 Summary: Distributed Redundant Block Device driver for Linux
-Version: 0.6.10
+Version: 
 Release: 1
 Source: %{name}-%{version}.tar.gz
 Vendor: DRBD 
@@ -31,25 +31,58 @@ Authors:
 mkdir -p %{buildroot}
 
 make clean
+# note: MANDIR is not used anywhere in the makefiles
+#       maybe this should be changed
 make PREFIX=%{buildroot}/ MANDIR=%{_mandir} all install
 
 %install
+make PREFIX=%{buildroot}/ install
+FILELIST="%{_builddir}/%{name}-%{version}/file.list"
 cd %{buildroot}
 find lib/modules -name drbd.o -exec mv {} {}.new \; \
-         -fprintf %{_builddir}/%{name}-%{version}/file.list "/%p.new\n"
+         -fprintf "$FILELIST" "/%p.new\n"
+#
+# this is because /etc/init.d != /etc/rc.d != /etc/rc.d/init.d ...
+# you may want to edit this, or the file list below ;)
+#
+find etc/ -name drbd -printf "/%p\n" >> "$FILELIST"
+#
+# and I only want to install a hint to the example conf
+#
+cat <<___ > etc/drbd.conf
+#
+# please have a a look at the example configuration file in
+# %{_docdir}/drbd.conf
+#
+___
 
 %clean
-rm -rf %{buildroot}
+[ -n $RPM_BUILD_ROOT -a "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
 
 %files -f %{_builddir}/%{name}-%{version}/file.list
+%defattr(755,root,root)
+/sbin/drbdsetup
+/etc/ha.d/resource.d/datadisk
+
+%defattr(644,root,root)
+%config(noreplace) /etc/drbd.conf
+
+%defattr(700,root,root)
+%dir /var/lib/drbd
+
 %defattr(-,root,root)
-%{_mandir}/man8/datadisk.8.gz
-%{_mandir}/man8/drbd.8.gz
 %{_mandir}/man8/drbdsetup.8.gz
 %{_mandir}/man5/drbd.conf.5.gz
-/sbin/drbdsetup
-/etc/rc.d/init.d/drbd
-/etc/ha.d/resource.d/datadisk
+%{_mandir}/man8/drbd.8.gz
+%{_mandir}/man8/datadisk.8.gz
+%{_mandir}/ja/man8/drbdsetup.8.gz
+%{_mandir}/ja/man5/drbd.conf.5.gz
+%{_mandir}/ja/man8/drbd.8.gz
+%{_mandir}/ja/man8/datadisk.8.gz
+%{_mandir}/pt_BR/man8/drbdsetup.8.gz
+%{_mandir}/pt_BR/man5/drbd.conf.5.gz
+%{_mandir}/pt_BR/man8/drbd.8.gz
+%{_mandir}/pt_BR/man8/datadisk.8.gz
 %doc scripts/drbd.conf
 %doc documentation/NFS-Server-README.txt
 %doc COPYING
@@ -60,11 +93,11 @@ rm -rf %{buildroot}
 FL=%{_docdir}/%{name}-%{version}/file.list
 
 if [ $1 -eq 1 ]; then
-	for d in $(sed 's/^\(\/lib\/modules\/[^/]*\).*/\1/' $FL) ; do
+	for d in $(sed '/^\/lib/!d;s/^\(\/lib\/modules\/[^/]*\).*/\1/' $FL) ; do
 		find $d -name drbd.o -exec mv -f {} {}.old \;
 	done
 fi
-for f in $(sed 's/\.new$//' $FL) ; do
+for f in $(sed '/^\/lib/!d;s/\.new$//' $FL) ; do
 	ln -f $f.new $f 
 done
 
@@ -76,10 +109,10 @@ chkconfig --add drbd
 FL=%{_docdir}/%{name}-%{version}/file.list
 
 if [ $1 -eq 0 ]; then
-	for f in $(sed 's/\.new$//' $FL) ; do
+	for f in $(sed '/^\/lib/!d;s/\.new$//' $FL) ; do
 		rm $f
 	done
-	for d in $(sed 's/^\(\/lib\/modules\/[^/]*\).*/\1/' $FL) ; do
+	for d in $(sed '/^\/lib/!d;s/^\(\/lib\/modules\/[^/]*\).*/\1/' $FL) ; do
 		for f in $(find $d -name drbd.o.old -print) ; do
 			mv $f $(echo $f | sed 's/\.old$//')
 		done


More information about the drbd-user mailing list