Now the RPM version is derived from the git tags as
per git-describe.
---
 Makefile          |   29 ++++++++++-----
 xs-config.spec    |   95 -----------------------------------------------------
 xs-config.spec.in |   95 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 114 insertions(+), 105 deletions(-)
 delete mode 100644 xs-config.spec
 create mode 100644 xs-config.spec.in

diff --git a/Makefile b/Makefile
index c54265e..e6eeeb6 100644
--- a/Makefile
+++ b/Makefile
@@ -15,29 +15,38 @@ $(DESTDIR):
 # For developers:
 
 # rpm target directory
-RPMDIR = /usr/src/redhat
+BUILDDIR = $(PWD)/build
 
 # olpc configuration tree
 OLPCIMG = fsroot.olpc.img
 
 # symbols
-NAME = xs-config
-VERSION = 0.2.7
-RELEASE = 2
+PKGNAME = xs-config
+VERSION = $(shell git describe | sed 's/^v//' | sed 's/-/./g')
+RELEASE = 1
 ARCH = noarch
 
-NV = $(NAME)-$(VERSION)
+NV = $(PKGNAME)-$(VERSION)
+
+RPMBUILD = rpmbuild \
+       --define "_topdir $(BUILDDIR)" \
 
 SOURCES: Makefile $(SCRIPTS)
+       mkdir -p $(BUILDDIR)/BUILD $(BUILDDIR)/RPMS \
+       $(BUILDDIR)/SOURCES $(BUILDDIR)/SPECS $(BUILDDIR)/SRPMS
        mkdir -p $(NV)
        cp -p Makefile $(NV)
        rsync -ar $(OLPCIMG)/ $(NV)/$(OLPCROOT)
        cp -p $(SCRIPTS) $(NV)/$(OLPCROOT)
-       tar czf $(RPMDIR)/SOURCES/$(NV).tar.gz $(NV)
+       tar czf $(BUILDDIR)/SOURCES/$(NV).tar.gz $(NV)
        rm -rf $(NV)
 
-rpm: SOURCES
-       rpmbuild -ba --target $(ARCH) $(NAME).spec
-       rm -f $(NV)-*.$(ARCH).rpm
-       cp -p $(RPMDIR)/RPMS/$(ARCH)/$(NV)-$(RELEASE).$(ARCH).rpm .
+xs-config.spec: xs-config.spec.in
+       sed -e 's:@VERSION@:$(VERSION):g' < $< > $@
+
+.PHONY: xs-config.spec.in
 
+rpm: SOURCES xs-config.spec
+       $(RPMBUILD) -ba --target $(ARCH) $(PKGNAME).spec
+       rm -fr $(BUILDDIR)/BUILD/$(NV)
+       rpmlint $(BUILDDIR)/RPMS/$(ARCH)/$(NV)-$(ARCH).rpm
diff --git a/xs-config.spec b/xs-config.spec
deleted file mode 100644
index 46607c3..0000000
--- a/xs-config.spec
+++ /dev/null
@@ -1,95 +0,0 @@
-# install root
-%define DESTDIR  /
-
-%define OLPCROOT %{DESTDIR}/fsroot.olpc
-
-%define LINK    %{OLPCROOT}/symlink-tree.py
-%define UNLINK   %{OLPCROOT}/unlink-tree.py
-
-Requires: python
-
-#  This really should just require xs-pkgs, right ?
-#  or nothing at all...
-#  Now a list of packages modified by xs-config
-Requires: authconfig  
-Requires: bind  
-Requires: glibc  
-Requires: glibc-common  
-Requires: httpd  
-Requires: info  
-Requires: initscripts  
-Requires: iptables  
-Requires: lighttpd  
-Requires: module-init-tools  
-Requires: nscd  
-Requires: nss  
-Requires: openssh-server  
-Requires: radvd  
-Requires: rpm  
-Requires: selinux-policy  
-Requires: setup  
-Requires: smartmontools  
-Requires: sudo  
-Requires: sysklogd  
-Requires: xml-common  
-Requires: xs-pkgs
-Requires: kernel
-
-Summary: XS/XSX default configuration
-Name: xs-config
-Version: 0.2.7
-Release: 2
-BuildRoot: %{_builddir}/%{name}-root
-Distribution: OLPC XS/XSX School Server
-Group: Base System/Administration Tools
-License: GPL
-Packager: John Watlington <[EMAIL PROTECTED]>
-Source: %{name}-%{version}.tar.gz
-URL: http://dev.laptop.org/git.do?p=projects/xs-config;a=summary
-Vendor: OLPC
-%description
-The default configuration of an OLPC XS School server. Don't install this if 
you don't understand what it is!
-
-%prep
-%setup
-%install
-rm -rf $RPM_BUILD_ROOT
-make DESTDIR=$RPM_BUILD_ROOT/%{DESTDIR} install
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-%post
-%{LINK} %{OLPCROOT} %{DESTDIR}
-#
-#  If any kernel modules are being installed using this mechanism, you
-#  need to depmod them in...
-depmod -b %{DESTDIR} -C %{DESTDIR}/etc/depmod.d
-#
-#  There are some files which must be copied, not symlinked
-#  syslog.conf, sysctl.conf, and sudoers are examples.
-rm %{DESTDIR}/etc/sudoers
-cp -fp %{OLPCROOT}/etc/sudoers %{DESTDIR}/etc/
-chmod 0440 %{DESTDIR}/etc/sudoers
-rm %{DESTDIR}/etc/syslog.conf
-cp -fp %{OLPCROOT}/etc/syslog.conf %{DESTDIR}/etc/
-rm %{DESTDIR}/etc/sysctl.conf
-cp -fp %{OLPCROOT}/etc/sysctl.conf %{DESTDIR}/etc/
-rm %{DESTDIR}/etc/httpd/conf/httpd.conf
-cp -fp %{OLPCROOT}/etc/httpd/conf/httpd.conf %{DESTDIR}/etc/httpd/conf/
-#
-#  Delete link script ?
-rm %{LINK}*
-#  Temporary fix to remove script symlinks
-rm %{DESTDIR}/symlink-tree.py*
-rm %{DESTDIR}/unlink-tree.py*
-
-%preun
-#  If this is an uninstall...
-if [ $1 -eq 0 ]
-then
-   %{UNLINK} %{OLPCROOT} %{DESTDIR}
-   rm %{UNLINK}*
-fi
-
-%files
-%config(noreplace) %{OLPCROOT}
diff --git a/xs-config.spec.in b/xs-config.spec.in
new file mode 100644
index 0000000..0ecb47c
--- /dev/null
+++ b/xs-config.spec.in
@@ -0,0 +1,95 @@
+# install root
+%define DESTDIR  /
+
+%define OLPCROOT %{DESTDIR}/fsroot.olpc
+
+%define LINK    %{OLPCROOT}/symlink-tree.py
+%define UNLINK   %{OLPCROOT}/unlink-tree.py
+
+Requires: python
+
+#  This really should just require xs-pkgs, right ?
+#  or nothing at all...
+#  Now a list of packages modified by xs-config
+Requires: authconfig  
+Requires: bind  
+Requires: glibc  
+Requires: glibc-common  
+Requires: httpd  
+Requires: info  
+Requires: initscripts  
+Requires: iptables  
+Requires: lighttpd  
+Requires: module-init-tools  
+Requires: nscd  
+Requires: nss  
+Requires: openssh-server  
+Requires: radvd  
+Requires: rpm  
+Requires: selinux-policy  
+Requires: setup  
+Requires: smartmontools  
+Requires: sudo  
+Requires: sysklogd  
+Requires: xml-common  
+Requires: xs-pkgs
+Requires: kernel
+
+Summary: XS/XSX default configuration
+Name: xs-config
+Version: @VERSION@
+Release: 1
+BuildRoot: %{_builddir}/%{name}-root
+Distribution: OLPC XS/XSX School Server
+Group: Base System/Administration Tools
+License: GPL
+Packager: John Watlington <[EMAIL PROTECTED]>
+Source: %{name}-%{version}.tar.gz
+URL: http://dev.laptop.org/git.do?p=projects/xs-config;a=summary
+Vendor: OLPC
+%description
+The default configuration of an OLPC XS School server. Don't install this if 
you don't understand what it is!
+
+%prep
+%setup
+%install
+rm -rf $RPM_BUILD_ROOT
+make DESTDIR=$RPM_BUILD_ROOT/%{DESTDIR} install
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post
+%{LINK} %{OLPCROOT} %{DESTDIR}
+#
+#  If any kernel modules are being installed using this mechanism, you
+#  need to depmod them in...
+depmod -b %{DESTDIR} -C %{DESTDIR}/etc/depmod.d
+#
+#  There are some files which must be copied, not symlinked
+#  syslog.conf, sysctl.conf, and sudoers are examples.
+rm %{DESTDIR}/etc/sudoers
+cp -fp %{OLPCROOT}/etc/sudoers %{DESTDIR}/etc/
+chmod 0440 %{DESTDIR}/etc/sudoers
+rm %{DESTDIR}/etc/syslog.conf
+cp -fp %{OLPCROOT}/etc/syslog.conf %{DESTDIR}/etc/
+rm %{DESTDIR}/etc/sysctl.conf
+cp -fp %{OLPCROOT}/etc/sysctl.conf %{DESTDIR}/etc/
+rm %{DESTDIR}/etc/httpd/conf/httpd.conf
+cp -fp %{OLPCROOT}/etc/httpd/conf/httpd.conf %{DESTDIR}/etc/httpd/conf/
+#
+#  Delete link script ?
+rm %{LINK}*
+#  Temporary fix to remove script symlinks
+rm %{DESTDIR}/symlink-tree.py*
+rm %{DESTDIR}/unlink-tree.py*
+
+%preun
+#  If this is an uninstall...
+if [ $1 -eq 0 ]
+then
+   %{UNLINK} %{OLPCROOT} %{DESTDIR}
+   rm %{UNLINK}*
+fi
+
+%files
+%config(noreplace) %{OLPCROOT}
-- 
1.5.5.1

_______________________________________________
Server-devel mailing list
Server-devel@lists.laptop.org
http://lists.laptop.org/listinfo/server-devel

Reply via email to