[lxc-devel] [lxc/master] configure.ac: add --enable-deprecated flag

brauner on Github lxc-bot at linuxcontainers.org
Wed Feb 24 19:14:03 UTC 2016


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 300 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20160224/b9c8a5e1/attachment.bin>
-------------- next part --------------
From 880dd6a5f96a222a06d9b803fcb5947e0dec2aa7 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at mailbox.org>
Date: Wed, 24 Feb 2016 00:02:49 +0100
Subject: [PATCH 1/2] mark lxc-clone & lxc-start-ephemeral as deprecated

- add deprecation not to man pages
- print deprecation info to stderr when the executables are invoked

Signed-off-by: Christian Brauner <christian.brauner at mailbox.org>
---
 doc/lxc-clone.sgml.in           | 3 ++-
 doc/lxc-start-ephemeral.sgml.in | 2 +-
 src/lxc/lxc-start-ephemeral.in  | 4 ++++
 src/lxc/lxc_clone.c             | 2 ++
 4 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/doc/lxc-clone.sgml.in b/doc/lxc-clone.sgml.in
index 42c119c..f134b80 100644
--- a/doc/lxc-clone.sgml.in
+++ b/doc/lxc-clone.sgml.in
@@ -278,7 +278,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
   <refsect1>
     <title>Notes</title>
     <para>
-    <command>lxc-clone</command> is superseded by <command>lxc-copy</command>.
+    <command>lxc-clone</command> is deprecated in favor of
+    <command>lxc-copy</command>.
     </para>
   </refsect1>
 
diff --git a/doc/lxc-start-ephemeral.sgml.in b/doc/lxc-start-ephemeral.sgml.in
index 6db4059..6831578 100644
--- a/doc/lxc-start-ephemeral.sgml.in
+++ b/doc/lxc-start-ephemeral.sgml.in
@@ -230,7 +230,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
   <refsect1>
     <title>Notes</title>
     <para>
-    <command>lxc-start-ephemeral</command> is superseded by
+    <command>lxc-start-ephemeral</command> is deprecated in favor of
     <command>lxc-copy</command>.
     </para>
   </refsect1>
diff --git a/src/lxc/lxc-start-ephemeral.in b/src/lxc/lxc-start-ephemeral.in
index 8d33775..b39aaba 100644
--- a/src/lxc/lxc-start-ephemeral.in
+++ b/src/lxc/lxc-start-ephemeral.in
@@ -36,6 +36,10 @@ import tempfile
 _ = gettext.gettext
 gettext.textdomain("lxc-start-ephemeral")
 
+def printstderr(*args):
+    print("lxc-start-ephemeral is deprecated in favor of lxc-copy\n", *args, file = sys.stderr)
+
+printstderr()
 
 # Other functions
 def randomMAC():
diff --git a/src/lxc/lxc_clone.c b/src/lxc/lxc_clone.c
index e88c18b..6bd2226 100644
--- a/src/lxc/lxc_clone.c
+++ b/src/lxc/lxc_clone.c
@@ -121,6 +121,8 @@ int main(int argc, char *argv[])
 	int c;
 	bool ret;
 
+	fprintf(stderr, "lxc-clone is deprecated in favor of lxc-copy.\n\n");
+
 	if (argc < 3)
 		usage(argv[0]);
 

From 2fb8e25d77c9962cc707b9d5de4f61fd23a7c265 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at mailbox.org>
Date: Wed, 24 Feb 2016 19:28:12 +0100
Subject: [PATCH 2/2] configure.ac: add --enable-deprecated flag

- lxc-clone and lxc-start-ephemeral are marked deprecated. We add a
  --enable-deprecated flag to configure.ac allowing us to enable these
  deprecated executables
- update tests to use lxc-copy instead of lxc-clone

Signed-off-by: Christian Brauner <christian.brauner at mailbox.org>
---
 config/bash/lxc.in             |  2 +-
 configure.ac                   |  7 +++++++
 doc/Makefile.am                |  5 +++--
 doc/ja/Makefile.am             |  5 +++--
 doc/ko/Makefile.am             |  5 +++--
 src/lxc/Makefile.am            | 12 ++++++++++--
 src/lxc/arguments.h            |  2 +-
 src/tests/lxc-test-cloneconfig |  2 +-
 src/tests/lxc-test-snapdeps    |  4 ++--
 src/tests/lxc-test-unpriv      |  2 +-
 10 files changed, 32 insertions(+), 14 deletions(-)

diff --git a/config/bash/lxc.in b/config/bash/lxc.in
index 344d5cb..7dcf302 100644
--- a/config/bash/lxc.in
+++ b/config/bash/lxc.in
@@ -98,6 +98,6 @@ _have lxc-start && {
 
     complete -o default -F _lxc_generic_t lxc-create
 
-    complete -o default -F _lxc_generic_o lxc-clone
+    complete -o default -F _lxc_generic_o lxc-copy
     complete -o default -F _lxc_generic_o lxc-start-ephemeral
 }
diff --git a/configure.ac b/configure.ac
index 68d89b2..fd2c569 100644
--- a/configure.ac
+++ b/configure.ac
@@ -147,6 +147,13 @@ if test "x$with_systemdsystemunitdir" != "xno"; then
   AC_SUBST([SYSTEMD_UNIT_DIR], [$with_systemdsystemunitdir])
 fi
 
+# Allow enabling deprecated executables
+AC_ARG_ENABLE([deprecated],
+	[AC_HELP_STRING([--enable-deprecated],
+	[enable deprecated executables [default=no]])],
+	[], [enable_deprecated=false])
+AM_CONDITIONAL([ENABLE_DEPRECATED], [test "x$enable_deprecated" = "xyes"])
+
 # Allow disabling rpath
 AC_ARG_ENABLE([rpath],
 	[AC_HELP_STRING([--enable-rpath], [set rpath in executables [default=no]])],
diff --git a/doc/Makefile.am b/doc/Makefile.am
index c309ef8..09ded03 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -21,7 +21,6 @@ man_MANS = \
 	lxc-cgroup.1 \
 	lxc-checkconfig.1 \
 	lxc-checkpoint.1 \
-	lxc-clone.1 \
 	lxc-config.1 \
 	lxc-console.1 \
 	lxc-copy.1 \
@@ -50,8 +49,10 @@ man_MANS = \
 	\
 	lxc.7
 
+if ENABLE_DEPRECATED
 if ENABLE_PYTHON
-    man_MANS += lxc-start-ephemeral.1
+    man_MANS += lxc-start-ephemeral.1 lxc-clone.1
+endif
 endif
 
 %.1 : %.sgml
diff --git a/doc/ja/Makefile.am b/doc/ja/Makefile.am
index 671dcfe..24776dd 100644
--- a/doc/ja/Makefile.am
+++ b/doc/ja/Makefile.am
@@ -13,7 +13,6 @@ man_MANS = \
 	lxc-cgroup.1 \
 	lxc-checkconfig.1 \
 	lxc-checkpoint.1 \
-	lxc-clone.1 \
 	lxc-config.1 \
 	lxc-console.1 \
 	lxc-copy.1 \
@@ -42,8 +41,10 @@ man_MANS = \
 	\
 	lxc.7
 
+if ENABLE_DEPRECATED
 if ENABLE_PYTHON
-    man_MANS += lxc-start-ephemeral.1
+    man_MANS += lxc-start-ephemeral.1 lxc-clone.1
+endif
 endif
 
 %.1 : %.sgml
diff --git a/doc/ko/Makefile.am b/doc/ko/Makefile.am
index 6d0cf4d..a938c70 100644
--- a/doc/ko/Makefile.am
+++ b/doc/ko/Makefile.am
@@ -13,7 +13,6 @@ man_MANS = \
 	lxc-cgroup.1 \
 	lxc-checkconfig.1 \
 	lxc-checkpoint.1 \
-	lxc-clone.1 \
 	lxc-config.1 \
 	lxc-console.1 \
 	lxc-copy.1 \
@@ -42,8 +41,10 @@ man_MANS = \
 	\
 	lxc.7
 
+if ENABLE_DEPRECATED
 if ENABLE_PYTHON
-    man_MANS += lxc-start-ephemeral.1
+    man_MANS += lxc-start-ephemeral.1 lxc-clone.1
+endif
 endif
 
 %.1 : %.sgml
diff --git a/src/lxc/Makefile.am b/src/lxc/Makefile.am
index 85791db..9f7a29e 100644
--- a/src/lxc/Makefile.am
+++ b/src/lxc/Makefile.am
@@ -192,16 +192,17 @@ bin_SCRIPTS = lxc-checkconfig
 EXTRA_DIST = \
 	lxc-top.lua
 
+if ENABLE_DEPRECATED
 if ENABLE_PYTHON
 bin_SCRIPTS += lxc-start-ephemeral
 endif
+endif
 
 bin_PROGRAMS = \
 	lxc-attach \
 	lxc-autostart \
 	lxc-cgroup \
 	lxc-checkpoint \
-	lxc-clone \
 	lxc-copy \
 	lxc-config \
 	lxc-console \
@@ -222,6 +223,10 @@ bin_PROGRAMS = \
 	lxc-usernsexec \
 	lxc-wait
 
+if ENABLE_DEPRECATED
+bin_PROGRAMS += lxc-clone
+endif
+
 sbin_PROGRAMS = init.lxc
 pkglibexec_PROGRAMS = \
 	lxc-monitord \
@@ -246,7 +251,6 @@ lxc_info_SOURCES = lxc_info.c
 init_lxc_SOURCES = lxc_init.c
 lxc_monitor_SOURCES = lxc_monitor.c
 lxc_monitord_SOURCES = lxc_monitord.c
-lxc_clone_SOURCES = lxc_clone.c
 lxc_ls_SOURCES = lxc_ls.c
 lxc_copy_SOURCES = lxc_copy.c
 lxc_start_SOURCES = lxc_start.c
@@ -261,6 +265,10 @@ lxc_usernsexec_SOURCES = lxc_usernsexec.c
 lxc_user_nic_SOURCES = lxc_user_nic.c network.c network.h
 lxc_checkpoint_SOURCES = lxc_checkpoint.c
 
+if ENABLE_DEPRECATED
+lxc_clone_SOURCES = lxc_clone.c
+endif
+
 if !HAVE_GETSUBOPT
 lxc_copy_SOURCES += ../include/getsubopt.c ../include/getsubopt.h
 endif
diff --git a/src/lxc/arguments.h b/src/lxc/arguments.h
index 861437e..6bc6fcd 100644
--- a/src/lxc/arguments.h
+++ b/src/lxc/arguments.h
@@ -102,7 +102,7 @@ struct lxc_arguments {
 	int list;
 	char *groups; /* also used by lxc-ls */
 
-	/* lxc-snapshot and lxc-clone */
+	/* lxc-snapshot and lxc-copy */
 	enum task {
 		CLONE,
 		DESTROY,
diff --git a/src/tests/lxc-test-cloneconfig b/src/tests/lxc-test-cloneconfig
index 0f38369..4e51cc4 100755
--- a/src/tests/lxc-test-cloneconfig
+++ b/src/tests/lxc-test-cloneconfig
@@ -124,7 +124,7 @@ for f in $s/*.conf; do
 	echo "Test $testnum starting ($f)"
 	lxc-create -t busybox -f $f -n lxctestb
 	touch $CONTAINER_PATH/x1
-	lxc-clone -s -o lxctestb -n lxctestb2
+	lxc-copy -s -n lxctestb -N lxctestb2
 	# verify that # nics did not change
 	verify_numnics
 	# verify hwaddr, if any changed
diff --git a/src/tests/lxc-test-snapdeps b/src/tests/lxc-test-snapdeps
index 273ecc8..3f95bba 100644
--- a/src/tests/lxc-test-snapdeps
+++ b/src/tests/lxc-test-snapdeps
@@ -52,7 +52,7 @@ cleanup
 trap cleanup EXIT SIGHUP SIGINT SIGTERM
 
 lxc-create -t busybox -n snapdeptest
-lxc-clone -s -o snapdeptest -n snapdeptest1
+lxc-copy -s -n snapdeptest -N snapdeptest1
 fail=0
 lxc-destroy -n snapdeptest || fail=1
 if [ $fail -eq 0 ]; then
@@ -61,7 +61,7 @@ if [ $fail -eq 0 ]; then
 fi
 
 for i in `seq 2 20`; do
-	lxc-clone -s -o snapdeptest -n snapdeptest$i
+	lxc-copy -s -n snapdeptest -N snapdeptest$i
 done
 
 verify_deps 20
diff --git a/src/tests/lxc-test-unpriv b/src/tests/lxc-test-unpriv
index 93c91a9..141f509 100755
--- a/src/tests/lxc-test-unpriv
+++ b/src/tests/lxc-test-unpriv
@@ -134,7 +134,7 @@ run_cmd lxc-info -n c1
 run_cmd lxc-attach -n c1 -- /bin/true
 
 run_cmd lxc-stop -n c1
-run_cmd lxc-clone -s -o c1 -n c2
+run_cmd lxc-copy -s -n c1 -N c2
 run_cmd lxc-start -n c2 -d
 p1=$(run_cmd lxc-info -n c2 -p -H)
 [ "$p1" != "-1" ] || { echo "Failed to start container c2"; false; }


More information about the lxc-devel mailing list