[lxc-devel] [PATCH] Add LXC version information to version.h
Stéphane Graber
stgraber at ubuntu.com
Mon Dec 2 15:34:37 UTC 2013
On Sun, Dec 01, 2013 at 11:14:17PM -0500, S.Çağlar Onur wrote:
> So that applications can get the LXC version number at compile time.
>
> This can be used to make applications/bindings that support compiling against
> multiple versions of LXC.
So I guess that information would indeed be useful to some external
software/bindings.
However I think we have to be careful there as my plan was to seriously
cut back in the number of public headers.
The goal for 1.0 is for liblxc1 to be the only bits we export for out of
tree use, currently, that'd be lxccontainer.h and its rdepends so:
- lxccontainer.h
- lxclock.h
- attach_options.h
Everything else would be available only for in-tree use.
I guess we could have lxccontainer.h include version.h and then ship version.h.
Looking at it again, especially in view of your changes, I suspect we
could kill version.c and the lxc_version function and simply have
lxccontainer.c return LXC_VERSION. (That'd avoid both lxccontainer.h and
version.h exporting the same function with two different names).
Actually I'm not completely sure we should even export lxclock, is there
any cases where we expect external users to want to mess with our locks?
>
> Signed-off-by: S.Çağlar Onur <caglar at 10ur.org>
> ---
> .gitignore | 1 +
> configure.ac | 7 ++++++-
> src/lxc/version.h | 31 -------------------------------
> src/lxc/version.h.in | 36 ++++++++++++++++++++++++++++++++++++
> 4 files changed, 43 insertions(+), 32 deletions(-)
> delete mode 100644 src/lxc/version.h
> create mode 100644 src/lxc/version.h.in
>
> diff --git a/.gitignore b/.gitignore
> index 65d9a77..a38ceb0 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -74,6 +74,7 @@ src/lxc/lxc-version
> src/lxc/lxc-wait
> src/lxc/legacy/lxc-ls
> src/lxc/lxc-user-nic
> +src/lxc/version.h
>
> src/python-lxc/build/
> src/python-lxc/lxc/__pycache__/
> diff --git a/configure.ac b/configure.ac
> index e9d3128..7b3da91 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -14,6 +14,11 @@ AC_INIT([lxc], [lxc_version])
> AC_SUBST(LXC_VERSION_BASE, lxc_version_base)
> AC_SUBST(LXC_VERSION_BETA, lxc_version_beta)
>
> +AC_SUBST([LXC_VERSION_MAJOR], [lxc_version_major])
> +AC_SUBST([LXC_VERSION_MINOR], [lxc_version_minor])
> +AC_SUBST([LXC_VERSION_MICRO], [lxc_version_micro])
> +AC_SUBST([LXC_VERSION], [lxc_version])
> +
> AC_CONFIG_SRCDIR([configure.ac])
> AC_CONFIG_AUX_DIR([config])
> AC_CONFIG_HEADERS([src/config.h])
> @@ -554,7 +559,7 @@ AC_CONFIG_FILES([
> src/lxc/lxc-start-ephemeral
> src/lxc/legacy/lxc-ls
> src/lxc/lxc.functions
> -
> + src/lxc/version.h
> src/python-lxc/Makefile
>
> src/lua-lxc/Makefile
> diff --git a/src/lxc/version.h b/src/lxc/version.h
> deleted file mode 100644
> index e2b0fc4..0000000
> --- a/src/lxc/version.h
> +++ /dev/null
> @@ -1,31 +0,0 @@
> -/*
> - * lxc: linux Container library
> - *
> - * (C) Copyright IBM Corp. 2007, 2008
> - *
> - * Authors:
> - * Daniel Lezcano <daniel.lezcano at free.fr>
> - *
> - * This library is free software; you can redistribute it and/or
> - * modify it under the terms of the GNU Lesser General Public
> - * License as published by the Free Software Foundation; either
> - * version 2.1 of the License, or (at your option) any later version.
> - *
> - * This library is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> - * Lesser General Public License for more details.
> - *
> - * You should have received a copy of the GNU Lesser General Public
> - * License along with this library; if not, write to the Free Software
> - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
> - */
> -#ifndef _version_h
> -#define _version_h
> -
> -/*
> - * Returns the version number of the library
> - */
> -extern const char *lxc_version(void);
> -
> -#endif
> diff --git a/src/lxc/version.h.in b/src/lxc/version.h.in
> new file mode 100644
> index 0000000..6867b6e
> --- /dev/null
> +++ b/src/lxc/version.h.in
> @@ -0,0 +1,36 @@
> +/*
> + * lxc: linux Container library
> + *
> + * (C) Copyright IBM Corp. 2007, 2008
> + *
> + * Authors:
> + * Daniel Lezcano <daniel.lezcano at free.fr>
> + *
> + * This library is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * This library is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this library; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
> + */
> +#ifndef _VERSION_H
> +#define _VERSION_H
> +
> +#define LXC_VERSION_MAJOR @LXC_VERSION_MAJOR@
> +#define LXC_VERSION_MINOR @LXC_VERSION_MINOR@
> +#define LXC_VERSION_MICRO @LXC_VERSION_MICRO@
> +#define LXC_VERSION "@LXC_VERSION@"
> +
> +/*
> + * Returns the version number of the library
> + */
> +extern const char *lxc_version(void);
> +
> +#endif
> --
> 1.8.3.2
>
>
> ------------------------------------------------------------------------------
> Rapidly troubleshoot problems before they affect your business. Most IT
> organizations don't have a clear picture of how application performance
> affects their revenue. With AppDynamics, you get 100% visibility into your
> Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
> http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk
> _______________________________________________
> Lxc-devel mailing list
> Lxc-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/lxc-devel
--
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20131202/d34e891c/attachment.pgp>
More information about the lxc-devel
mailing list