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

2012-09-11 Thread Dwight Engen
On Mon, 10 Sep 2012 13:53:50 -0400
Stéphane Graber  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.

Fixing the rpm build can be done without fixing the variable expand
problem by using DESTDIR, so this is a split out of fixing the rpm
build.

---


Fix rpm build, package templates.

Signed-off-by: Dwight Engen 
---
diff --git a/lxc.spec.in b/lxc.spec.in
index da7339a..e830305 100644
--- a/lxc.spec.in
+++ b/lxc.spec.in
@@ -68,9 +68,9 @@ PATH=$PATH:/usr/sbin:/sbin %configure $args --disable-rpath
 make %{?_smp_mflags}
 
 %install
-%makeinstall
-
-find $RPM_BUILD_ROOT -type f -name '*.la' -exec rm -f {} ';'  
+rm -rf %{buildroot}
+make install DESTDIR=%{buildroot}
+find %{buildroot} -type f -name '*.la' -exec rm -f {} ';'  
 
 %clean
 rm -rf %{buildroot}
@@ -92,20 +92,26 @@ rm -rf %{buildroot}
 %attr(4111,root,root) %{_bindir}/lxc-restart
 %{_mandir}/*
 %{_datadir}/doc/*
+%{_datadir}/lxc/*
 
 %files libs
 %defattr(-,root,root)
 %{_libdir}/*.so.*
 %{_libdir}/%{name}
-%attr(4555,root,root) %{_libdir}/%{name}/lxc-init
+%attr(4555,root,root) %{_libexecdir}/%{name}/lxc-init
 
 %files devel
 %defattr(-,root,root)
 %{_includedir}/%{name}/*
 %{_libdir}/*.so
-%{_datadir}/pkgconfig/*
+%{_libdir}/pkgconfig/*
 
 %changelog
+* Mon Sep 10 2012 Dwight Engen  - Version 0.8.0
+- fix lxc-init moved to libexec
+- .pc moved to _libdir
+- package template files /usr/share/lxc/templates
+
 * Thu Sep  8 2011 Greg Kurz  - Version 0.7.5.1
 - fix installed files for rpmbuild
 - introduce lxc-libs package


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel


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

2012-09-11 Thread Stéphane Graber
On 12-09-11 02:30 PM, Dwight Engen wrote:
> On Mon, 10 Sep 2012 13:53:50 -0400
> Stéphane Graber  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.
> 
> Fixing the rpm build can be done without fixing the variable expand
> problem by using DESTDIR, so this is a split out of fixing the rpm
> build.
> 
> ---
> 
> 
> Fix rpm build, package templates.
> 
> Signed-off-by: Dwight Engen 
> ---
> diff --git a/lxc.spec.in b/lxc.spec.in
> index da7339a..e830305 100644
> --- a/lxc.spec.in
> +++ b/lxc.spec.in
> @@ -68,9 +68,9 @@ PATH=$PATH:/usr/sbin:/sbin %configure $args --disable-rpath
>  make %{?_smp_mflags}
>  
>  %install
> -%makeinstall
> -
> -find $RPM_BUILD_ROOT -type f -name '*.la' -exec rm -f {} ';'  
> +rm -rf %{buildroot}
> +make install DESTDIR=%{buildroot}
> +find %{buildroot} -type f -name '*.la' -exec rm -f {} ';'  
>  
>  %clean
>  rm -rf %{buildroot}
> @@ -92,20 +92,26 @@ rm -rf %{buildroot}
>  %attr(4111,root,root) %{_bindir}/lxc-restart
>  %{_mandir}/*
>  %{_datadir}/doc/*
> +%{_datadir}/lxc/*
>  
>  %files libs
>  %defattr(-,root,root)
>  %{_libdir}/*.so.*
>  %{_libdir}/%{name}
> -%attr(4555,root,root) %{_libdir}/%{name}/lxc-init
> +%attr(4555,root,root) %{_libexecdir}/%{name}/lxc-init
>  
>  %files devel
>  %defattr(-,root,root)
>  %{_includedir}/%{name}/*
>  %{_libdir}/*.so
> -%{_datadir}/pkgconfig/*
> +%{_libdir}/pkgconfig/*
>  
>  %changelog
> +* Mon Sep 10 2012 Dwight Engen  - Version 0.8.0
> +- fix lxc-init moved to libexec
> +- .pc moved to _libdir
> +- package template files /usr/share/lxc/templates
> +
>  * Thu Sep  8 2011 Greg Kurz  - Version 0.7.5.1
>  - fix installed files for rpmbuild
>  - introduce lxc-libs package

Thanks.

Pushed to staging tree, just removed a trailing space on the find line
and used the commit message from your initial patch minus the part of
variable expansion.


-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com



signature.asc
Description: OpenPGP digital signature
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel


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

2012-09-11 Thread Dwight Engen
On Tue, 11 Sep 2012 14:30:22 -0400
Dwight Engen  wrote:

> On Mon, 10 Sep 2012 13:53:50 -0400
> Stéphane Graber  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 
---
 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 $shortop

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

2012-09-11 Thread Stéphane Graber
On 12-09-11 05:06 PM, Dwight Engen wrote:
> On Tue, 11 Sep 2012 14:30:22 -0400
> Dwight Engen  wrote:
> 
>> On Mon, 10 Sep 2012 13:53:50 -0400
>> Stéphane Graber  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 
> ---
>  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(-)

Thanks.

Did a quick testbuild and checked a few files, the result looks good and
will simplify things quite a bit.

Pushed to the staging branch.


-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com



signature.asc
Description: OpenPGP digital signature
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel