[lxc-devel] [PATCH 3/3] lxc-rpm-build

Dwight Engen dwight.engen at oracle.com
Tue Sep 11 21:06:05 UTC 2012


On Tue, 11 Sep 2012 14:30:22 -0400
Dwight Engen <dwight.engen at oracle.com> wrote:

> On Mon, 10 Sep 2012 13:53:50 -0400
> Stéphane Graber <stgraber at ubuntu.com> wrote:
> 
> [...]
> > > The reason I changed them to expand was so the docs would be right
> > > (they had SUBST paths with ${var} still in them) but obviously I
> > > don't want to break code just to make the docs right :)
> > 
> > I'm not actually expending breakage but I'm expecting some dead
> > code. For example @LXCPATH@ is used in most scripts using some
> > workarounds as the value wasn't expanded, like:
> > libdir=@LIBDIR@
> > libexecdir=@LIBEXECDIR@
> > localstatedir=@LOCALSTATEDIR@
> > 
> > Once we apply your change, we'd have to check for such dead code and
> > clean it up.

fix expansion of LXCPATH,LXCROOTFSMOUNT,LXCTEMPLATEDIR

These variables are not expanded correctly in doc/lxc-create.sgml.in 
and a workaround is in place to ensure ${localstatedir}, and ${datadir}
are set in the various shell scripts that use it. There is no workaround
to ensure ${datadir} is set in src/lxc/lxc-create.in, nor is
${localstatedir} set in templates/lxc-altlinux.in so I think that these
are currently broken. 

Using AS_AC_EXPAND instead of AC_SUBST fixes these problems and removes
the need for the workarounds. In addition the lxc-start-ephemeral.in
script can be autoconf'ed instead of sed'ed by the makefile.

Signed-off-by: Dwight Engen <dwight.engen at oracle.com>
---
 configure.ac           |    7 ++++---
 src/lxc/Makefile.am    |    4 ----
 src/lxc/lxc-clone.in   |    1 -
 src/lxc/lxc-create.in  |    2 --
 src/lxc/lxc-destroy.in |    1 -
 src/lxc/lxc-ls.in      |    1 -
 src/lxc/lxc-setcap.in  |    3 ---
 src/lxc/lxc-setuid.in  |    3 ---
 8 files changed, 4 insertions(+), 18 deletions(-)

diff --git a/configure.ac b/configure.ac
index 1ae95ab..4bbfd9b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -112,11 +112,11 @@ AC_ARG_WITH([rootfs-path],
 	)], [], [with_rootfs_path=['${libdir}/lxc/rootfs']])
 
 AS_AC_EXPAND(LXC_GENERATE_DATE, "$(date)")
+AS_AC_EXPAND(LXCPATH, "${with_config_path}")
+AS_AC_EXPAND(LXCROOTFSMOUNT, "${with_rootfs_path}")
+AS_AC_EXPAND(LXCTEMPLATEDIR, ['${datadir}/lxc/templates'])
 
-AC_SUBST(LXCPATH, "${with_config_path}")
-AC_SUBST(LXCROOTFSMOUNT, "${with_rootfs_path}")
 AC_SUBST(LXCINITDIR, ['${libexecdir}'])
-AC_SUBST(LXCTEMPLATEDIR, ['${datadir}/lxc/templates'])
 
 AC_CHECK_HEADERS([linux/unistd.h linux/netlink.h linux/genetlink.h],
 				  [],
@@ -213,6 +213,7 @@ AC_CONFIG_FILES([
 	src/lxc/lxc-create
 	src/lxc/lxc-clone
 	src/lxc/lxc-shutdown
+	src/lxc/lxc-start-ephemeral
 	src/lxc/lxc-destroy
 
 	src/python-lxc/Makefile
diff --git a/src/lxc/Makefile.am b/src/lxc/Makefile.am
index 11c0257..7d86ad6 100644
--- a/src/lxc/Makefile.am
+++ b/src/lxc/Makefile.am
@@ -144,10 +144,6 @@ lxc_unshare_SOURCES = lxc_unshare.c
 lxc_wait_SOURCES = lxc_wait.c
 lxc_kill_SOURCES = lxc_kill.c
 
-lxc-start-ephemeral: lxc-start-ephemeral.in
-	[ -f $@ ] && rm -f $@ || true
-	$(SED) -e "s:[@]LXCPATH@:$(LXCPATH):" $< > $@
-
 install-exec-local: install-soPROGRAMS
 	mv $(DESTDIR)$(libdir)/liblxc.so $(DESTDIR)$(libdir)/liblxc.so.$(VERSION)
 	/sbin/ldconfig -l $(DESTDIR)$(libdir)/liblxc.so.$(VERSION)
diff --git a/src/lxc/lxc-clone.in b/src/lxc/lxc-clone.in
index c373861..920be7b 100644
--- a/src/lxc/lxc-clone.in
+++ b/src/lxc/lxc-clone.in
@@ -46,7 +46,6 @@ help() {
 
 shortoptions='ho:n:sL:v:p:t:'
 longoptions='help,orig:,name:,snapshot,fssize:,vgname:,lvprefix:,fstype:'
-localstatedir=@LOCALSTATEDIR@
 lxc_path=@LXCPATH@
 bindir=@BINDIR@
 snapshot=no
diff --git a/src/lxc/lxc-create.in b/src/lxc/lxc-create.in
index bd16e3c..79c67d6 100644
--- a/src/lxc/lxc-create.in
+++ b/src/lxc/lxc-create.in
@@ -64,10 +64,8 @@ help() {
 
 shortoptions='hn:f:t:B:'
 longoptions='help,name:,config:,template:,backingstore:,fstype:,dir:,lvname:,vgname:,fssize:'
-localstatedir=@LOCALSTATEDIR@
 lxc_path=@LXCPATH@
 bindir=@BINDIR@
-libdir=@LIBDIR@
 templatedir=@LXCTEMPLATEDIR@
 backingstore=_unset
 fstype=ext4
diff --git a/src/lxc/lxc-destroy.in b/src/lxc/lxc-destroy.in
index d3f041d..5c76569 100644
--- a/src/lxc/lxc-destroy.in
+++ b/src/lxc/lxc-destroy.in
@@ -41,7 +41,6 @@ help() {
 
 shortoptions='hn:f'
 longoptions='help,name:'
-localstatedir=@LOCALSTATEDIR@
 lxc_path=@LXCPATH@
 force=0
 
diff --git a/src/lxc/lxc-ls.in b/src/lxc/lxc-ls.in
index ea38054..009bb2e 100644
--- a/src/lxc/lxc-ls.in
+++ b/src/lxc/lxc-ls.in
@@ -17,7 +17,6 @@
 # License along with this library; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
-localstatedir=@LOCALSTATEDIR@
 lxc_path=@LXCPATH@
 
 usage()
diff --git a/src/lxc/lxc-setcap.in b/src/lxc/lxc-setcap.in
index 71e3710..7fd390c 100644
--- a/src/lxc/lxc-setcap.in
+++ b/src/lxc/lxc-setcap.in
@@ -83,9 +83,6 @@ lxc_dropcaps()
 
 shortoptions='hd'
 longoptions='help'
-libdir=@LIBDIR@
-libexecdir=@LIBEXECDIR@
-localstatedir=@LOCALSTATEDIR@
 
 getopt=$(getopt -o $shortoptions --longoptions  $longoptions -- "$@")
 if [ $? != 0 ]; then
diff --git a/src/lxc/lxc-setuid.in b/src/lxc/lxc-setuid.in
index 020dfae..84f18af 100644
--- a/src/lxc/lxc-setuid.in
+++ b/src/lxc/lxc-setuid.in
@@ -80,9 +80,6 @@ lxc_dropuid()
 
 shortoptions='hd'
 longoptions='help'
-libdir=@LIBDIR@
-libexecdir=@LIBEXECDIR@
-localstatedir=@LOCALSTATEDIR@
 
 getopt=$(getopt -o $shortoptions --longoptions  $longoptions -- "$@")
 if [ $? != 0 ]; then




More information about the lxc-devel mailing list