From 8e7e412c7d6c6031b69e156996675c25fd8ffbbd Mon Sep 17 00:00:00 2001 From: Paul Moore Date: Thu, 28 Sep 2006 22:15:55 +0000 Subject: [PATCH] Changes to make it easier to bump the version number, also allow the individual components to have their own version numbers --- CHANGELOG | 3 +- Makefile | 33 ++++++++++++++----- .../netlabel_tools.spec | 5 +++ include/libnetlabel.h | 4 +-- macros.mk | 10 ++++-- netlabelctl/main.c | 7 ++-- version_info | 15 +++++++++ 7 files changed, 60 insertions(+), 17 deletions(-) rename netlabel_tools.spec => extra/netlabel_tools.spec (84%) create mode 100644 version_info diff --git a/CHANGELOG b/CHANGELOG index c351a81..d7014eb 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,11 +1,12 @@ NetLabel Tools CHANGELOG ============================================================================== -* Version X.XX (XXXXXX) +* Release X.XX (XXXXXX) ------------------------------------------------------------------------------ o Changed to support the updated use of Netlink attributes by NetLabel o Ported to use the libnl (version 1.0-pre5/6) library o Try to cleanup the error reporting a little bit +o Changed the version/release information * Version 0.16 (August 3, 2006) ------------------------------------------------------------------------------ diff --git a/Makefile b/Makefile index a4a43a7..fd1f669 100644 --- a/Makefile +++ b/Makefile @@ -56,20 +56,15 @@ SUBDIRS = libnetlabel netlabelctl all: $(SUBDIRS) -$(SUBDIRS): - @echo "INFO: entering directory $@/ ..." - @$(MAKE) -s -C $@ - tarball: clean - @name=$$(grep "^Name:" netlabel_tools.spec | awk '{ print $$2 }'); \ - ver=$$(grep "^Version:" netlabel_tools.spec | awk '{ print $$2 }'); \ - tarball=$$name-$$ver.tar.gz; \ + @ver=$$(. version_info; echo $$VERSION_RELEASE); \ + tarball=netlabel_tools-$$ver.tar.gz; \ echo "INFO: creating the tarball ../$$tarball"; \ tmp_dir=$$(mktemp -d /tmp/netlabel_tools.XXXXX); \ - rel_dir=$$tmp_dir/$$name-$$ver; \ + rel_dir=$$tmp_dir/netlabel_tools-$$ver; \ mkdir $$rel_dir; \ tar cf - . | (cd $$rel_dir; tar xf -); \ - (cd $$tmp_dir; tar zcf $$tarball $$name-$$ver); \ + (cd $$tmp_dir; tar zcf $$tarball netlabel_tools-$$ver); \ mv $$tmp_dir/$$tarball ..; \ rm -rf $$tmp_dir; @@ -82,7 +77,27 @@ install: $(SUBDIRS) @install -o $(OWNER) -g $(GROUP) -m 644 docs/man/netlabelctl.8 \ $(INSTALL_MAN_DIR)/man8 +$(VERSION_HDR): version_info + @echo "INFO: creating the version header file" + @hdr="$(VERSION_HDR)"; \ + . version_info; \ + echo "/* automatically generated - do not edit */" > $$hdr; \ + echo "#ifndef _VERSION_H" >> $$hdr; \ + echo "#define _VERSION_H" >> $$hdr; \ + echo "#define VERSION_RELEASE \"$$VERSION_RELEASE\"" >> $$hdr; \ + echo "#define VERSION_LIBNETLABEL \"$$VERSION_LIBNETLABEL\"" >> $$hdr;\ + echo "#define VERSION_NETLABELCTL \"$$VERSION_NETLABELCTL\"" >> $$hdr;\ + echo "#define VERSION_NETLABELD \"$$VERSION_NETLABELD\"" >> $$hdr; \ + echo "#endif" >> $$hdr; + + +$(SUBDIRS): $(VERSION_HDR) + @echo "INFO: entering directory $@/ ..." + @$(MAKE) -s -C $@ + clean: + @echo "INFO: removing the version header file"; \ + rm -f $(VERSION_HDR) @for dir in $(SUBDIRS); do \ echo "INFO: cleaning in $$dir/"; \ $(MAKE) -s -C $$dir clean; \ diff --git a/netlabel_tools.spec b/extra/netlabel_tools.spec similarity index 84% rename from netlabel_tools.spec rename to extra/netlabel_tools.spec index 2e4c046..6e9e3a9 100644 --- a/netlabel_tools.spec +++ b/extra/netlabel_tools.spec @@ -37,6 +37,11 @@ rm -rf $RPM_BUILD_ROOT %attr(0644,root,root) %{_mandir}/man8/* %changelog +* Thu Sep 28 2006 Paul Moore X.XX-1 +- This specfile will no longer be updated for individual release numbers, + however, it will be kept up to date so that it could be used to build + a netlabel_tools RPM once the correct version information has been entered + * Thu Aug 3 2006 Paul Moore 0.16-1 - Bumped version number. diff --git a/include/libnetlabel.h b/include/libnetlabel.h index b6fe771..22bd740 100644 --- a/include/libnetlabel.h +++ b/include/libnetlabel.h @@ -34,13 +34,13 @@ #include #include +#include /* * Version */ -#define NETLBL_VER_STRING "X.XX" -#define NETLBL_VER_DATE "Development" +#define NETLBL_VER_STRING VERSION_LIBNETLABEL /* * Types diff --git a/macros.mk b/macros.mk index 1df54a6..a874228 100644 --- a/macros.mk +++ b/macros.mk @@ -31,7 +31,7 @@ # simple /bin/sh script to find the top of the tree # -TOPDIR = ` \ +TOPDIR = $$( \ ftd() { \ cd $$1; \ if [ -r "macros.mk" ]; then \ @@ -40,7 +40,7 @@ TOPDIR = ` \ ftd "../"; \ fi \ }; \ - ftd .` + ftd .) # # build configuration @@ -52,6 +52,12 @@ LIBFLAGS = CFLAGS = -O0 -g -Wall LDFLAGS = -g +# +# build constants +# + +VERSION_HDR = include/version.h + # # build macros # diff --git a/netlabelctl/main.c b/netlabelctl/main.c index 61e3775..27fb96b 100644 --- a/netlabelctl/main.c +++ b/netlabelctl/main.c @@ -32,6 +32,7 @@ #include #include +#include #include "netlabelctl.h" @@ -72,9 +73,9 @@ static void nlctl_usage_print(FILE *fp) static void nlctl_ver_print(FILE *fp) { fprintf(fp, - "NetLabel Control Utility, version %s (%s)\n", - NETLBL_VER_STRING, - NETLBL_VER_DATE); + "NetLabel Control Utility, version %s (libnetlabel %s)\n", + VERSION_NETLABELCTL, + NETLBL_VER_STRING); } /** diff --git a/version_info b/version_info new file mode 100644 index 0000000..2aa44bc --- /dev/null +++ b/version_info @@ -0,0 +1,15 @@ +# +# version_info - version information for the various netlabel tool components +# + +# release +VERSION_RELEASE="X.XX" + +# libnetlabel +VERSION_LIBNETLABEL="X.XX" + +# netlabelctl +VERSION_NETLABELCTL="X.XX" + +# netlabeld +VERSION_NETLABELD="X.XX"