From 8e8d8cc25373ae92606fda4b3081abf26653039e Mon Sep 17 00:00:00 2001 From: NiR- Date: Mon, 9 Jun 2014 08:21:45 +0200 Subject: [PATCH 01/24] Correcting compilation for the last lxc development version. --- ext/lxc/lxc.c | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/ext/lxc/lxc.c b/ext/lxc/lxc.c index b43732c..bb4df28 100644 --- a/ext/lxc/lxc.c +++ b/ext/lxc/lxc.c @@ -51,20 +51,6 @@ struct container_data { struct lxc_container *container; }; -struct bdev_specs { - char *fstype; - uint64_t fssize; // fs size in bytes - struct { - char *zfsroot; - } zfs; - struct { - char *vg; - char *lv; - char *thinpool; // lvm thin pool to use, if any - } lvm; - char *dir; -}; - static char ** ruby_to_c_string_array(VALUE rb_arr) { From e69f956f1e1a2670c5b6832e225b3b838c337127 Mon Sep 17 00:00:00 2001 From: NiR- Date: Mon, 9 Jun 2014 18:13:58 +0200 Subject: [PATCH 02/24] Fixing liblxc name in travis conf. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 0cd65ed..7d6722d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,6 @@ before_install: - sudo apt-get install -y python-software-properties - sudo add-apt-repository -y ppa:ubuntu-lxc/daily - sudo apt-get update -y - - sudo apt-get install -y liblxc0 lxc lxc-dbg lxc-dev lxc-templates lxc-tests lxctl python3-lxc + - sudo apt-get install -y liblxc1 lxc lxc-dbg lxc-dev lxc-templates lxc-tests lxctl python3-lxc script: - bundle exec rake clean package From cc8d829d9b50ba372a5bf1d028d9a12792b1613c Mon Sep 17 00:00:00 2001 From: NiR- Date: Mon, 9 Jun 2014 18:12:36 +0200 Subject: [PATCH 03/24] Removing lxc daily ppa from travis build for ensuring that the ubuntu package is used. --- .travis.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0cd65ed..fa64958 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,12 +5,11 @@ rvm: - 2.1.0 branches: only: - - master + - 1.1.x before_install: - sudo apt-get update -y - sudo apt-get install -y python-software-properties - - sudo add-apt-repository -y ppa:ubuntu-lxc/daily - sudo apt-get update -y - - sudo apt-get install -y liblxc0 lxc lxc-dbg lxc-dev lxc-templates lxc-tests lxctl python3-lxc + - sudo apt-get install -y liblxc0 script: - bundle exec rake clean package From 06cbff1bcf7ceeda65c0c22b770eca1cbd221eb8 Mon Sep 17 00:00:00 2001 From: NiR- Date: Mon, 9 Jun 2014 21:26:53 +0200 Subject: [PATCH 04/24] Removing unused packages from travis conf --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 7d6722d..0813e2e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,6 @@ before_install: - sudo apt-get install -y python-software-properties - sudo add-apt-repository -y ppa:ubuntu-lxc/daily - sudo apt-get update -y - - sudo apt-get install -y liblxc1 lxc lxc-dbg lxc-dev lxc-templates lxc-tests lxctl python3-lxc + - sudo apt-get install -y liblxc1 script: - bundle exec rake clean package From f1aef98626137bfa274a9089d1e2af4b9f74d23b Mon Sep 17 00:00:00 2001 From: NiR- Date: Mon, 9 Jun 2014 21:45:28 +0200 Subject: [PATCH 05/24] Adding rdoc dependencies for ruby 1.8 --- ruby-lxc.gemspec | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ruby-lxc.gemspec b/ruby-lxc.gemspec index 2802efa..4df7fcb 100644 --- a/ruby-lxc.gemspec +++ b/ruby-lxc.gemspec @@ -13,6 +13,8 @@ Gem::Specification.new do |s| s.extensions = 'ext/lxc/extconf.rb' s.has_rdoc = true + s.add_development_dependency "rdoc" + s.add_development_dependency "rdoc-data" s.add_development_dependency "rake-compiler" s.homepage = 'https://github.com/lxc/ruby-lxc' From 89082e1db11a807d8ee5a0af56c136d8b380ee8c Mon Sep 17 00:00:00 2001 From: NiR- Date: Mon, 9 Jun 2014 22:34:58 +0200 Subject: [PATCH 06/24] Adding rdoc dependencies for ruby 1.8 --- ruby-lxc.gemspec | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ruby-lxc.gemspec b/ruby-lxc.gemspec index 2802efa..4df7fcb 100644 --- a/ruby-lxc.gemspec +++ b/ruby-lxc.gemspec @@ -13,6 +13,8 @@ Gem::Specification.new do |s| s.extensions = 'ext/lxc/extconf.rb' s.has_rdoc = true + s.add_development_dependency "rdoc" + s.add_development_dependency "rdoc-data" s.add_development_dependency "rake-compiler" s.homepage = 'https://github.com/lxc/ruby-lxc' From 0914af29140c2a6209e44b714bfc472c9e2f843b Mon Sep 17 00:00:00 2001 From: Andre Nathan Date: Wed, 11 Jun 2014 09:29:57 -0300 Subject: [PATCH 07/24] Next version will be 1.2.0 --- lib/lxc/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/lxc/version.rb b/lib/lxc/version.rb index 0a84461..1b94970 100644 --- a/lib/lxc/version.rb +++ b/lib/lxc/version.rb @@ -1,3 +1,3 @@ module LXC - VERSION = '1.1.1' + VERSION = '1.2.0' end From 9d231bc99ef1cdcfe264d738c39cbde8b454a232 Mon Sep 17 00:00:00 2001 From: Andre Nathan Date: Fri, 13 Jun 2014 14:38:05 -0300 Subject: [PATCH 08/24] Version 1.2.0 --- README.md | 2 +- debian/changelog | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 42bed99..c4dad30 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ simply run the commands below bundle install bundle exec rake compile bundle exec rake gem -gem install pkg/ruby-lxc-1.1.1.gem +gem install pkg/ruby-lxc-1.2.0.gem ``` or just add this to your ```Gemfile``` ```ruby diff --git a/debian/changelog b/debian/changelog index 759ca47..72e7c0e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +ruby-lxc (1.2.0-0digirati1) trusty; urgency=low + + * Version 1.2.0. + + -- Andre Nathan Fri, 13 Jun 2014 14:37:26 -0300 + ruby-lxc (1.1.1-0digirati1) trusty; urgency=low * Version 1.1.1. From 850b1f4b8a81b23c6bc0d24c674fc96c36c93bad Mon Sep 17 00:00:00 2001 From: Andre Nathan Date: Fri, 13 Jun 2014 14:49:54 -0300 Subject: [PATCH 09/24] Add notifications --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index 0813e2e..00b9d3c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,3 +14,7 @@ before_install: - sudo apt-get install -y liblxc1 script: - bundle exec rake clean package + +notifications: + email: + - andrenth@gmail.com From 6024d0e40beb8d12aa16a6f916a7e66b9127cceb Mon Sep 17 00:00:00 2001 From: Andre Nathan Date: Mon, 16 Jun 2014 14:17:40 -0300 Subject: [PATCH 10/24] Add travis build status --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index c4dad30..9c85a18 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Ruby-LXC +[![Build Status](https://travis-ci.org/lxc/ruby-lxc.svg?branch=master)](https://travis-ci.org/lxc/ruby-lxc) + ## Introduction Ruby-LXC is a Ruby binding for liblxc. It allows the creation and management From 10ff154014469b45a91df12daf3676951c15315d Mon Sep 17 00:00:00 2001 From: Andre Nathan Date: Wed, 24 Sep 2014 10:28:22 -0300 Subject: [PATCH 11/24] Better check for std{in,out,err} attach options --- ext/lxc/lxc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ext/lxc/lxc.c b/ext/lxc/lxc.c index cb07d07..e176dd7 100644 --- a/ext/lxc/lxc.c +++ b/ext/lxc/lxc.c @@ -546,10 +546,10 @@ is_string_array(VALUE v) } static int -is_io(VALUE v) +has_file_descriptor(VALUE v) { - return rb_respond_to(v, rb_intern("sysread")) && - rb_respond_to(v, rb_intern("syswrite")); + return rb_respond_to(v, rb_intern("fileno")) && + rb_funcall(v, rb_intern("fileno"), 0) != Qnil; } static void @@ -648,21 +648,21 @@ lxc_attach_parse_options(VALUE rb_opts) } rb_stdin = rb_hash_aref(rb_opts, SYMBOL("stdin")); if (!NIL_P(rb_stdin)) { - if (is_io(rb_stdin)) + if (has_file_descriptor(rb_stdin)) opts->stdin_fd = io_fileno(rb_stdin); else goto err; } rb_stdout = rb_hash_aref(rb_opts, SYMBOL("stdout")); if (!NIL_P(rb_stdout)) { - if (is_io(rb_stdout)) + if (has_file_descriptor(rb_stdout)) opts->stdout_fd = io_fileno(rb_stdout); else goto err; } rb_stderr = rb_hash_aref(rb_opts, SYMBOL("stderr")); if (!NIL_P(rb_stderr)) { - if (is_io(rb_stderr)) + if (has_file_descriptor(rb_stderr)) opts->stderr_fd = io_fileno(rb_stderr); else goto err; From 9bbf0444a759456ddc83d9db1a8d7cc88d60ebe5 Mon Sep 17 00:00:00 2001 From: Andre Nathan Date: Wed, 24 Sep 2014 10:43:18 -0300 Subject: [PATCH 12/24] Raise errors for attach options --- ext/lxc/lxc.c | 80 +++++++++++++++++++++++++++++++++++---------------- 1 file changed, 55 insertions(+), 25 deletions(-) diff --git a/ext/lxc/lxc.c b/ext/lxc/lxc.c index e176dd7..d1664c7 100644 --- a/ext/lxc/lxc.c +++ b/ext/lxc/lxc.c @@ -569,6 +569,7 @@ lxc_attach_free_options(lxc_attach_options_t *opts) static lxc_attach_options_t * lxc_attach_parse_options(VALUE rb_opts) { + char *error = NULL; lxc_attach_options_t default_opts = LXC_ATTACH_OPTIONS_DEFAULT; lxc_attach_options_t *opts; VALUE rb_attach_flags, rb_namespaces, rb_personality, rb_initial_cwd; @@ -583,96 +584,125 @@ lxc_attach_parse_options(VALUE rb_opts) if (NIL_P(rb_opts)) return opts; + error = NULL; + rb_attach_flags = rb_hash_aref(rb_opts, SYMBOL("flags")); if (!NIL_P(rb_attach_flags)) { - if (is_integer(rb_attach_flags)) + if (is_integer(rb_attach_flags)) { opts->attach_flags = NUM2INT(rb_attach_flags); - else + } else { + error = "flags must be an integer"; goto err; + } } rb_namespaces = rb_hash_aref(rb_opts, SYMBOL("namespaces")); if (!NIL_P(rb_namespaces)) { - if (is_integer(rb_namespaces)) + if (is_integer(rb_namespaces)) { opts->namespaces = NUM2INT(rb_namespaces); - else + } else { + error = "namespaces must be an integer"; goto err; + } } rb_personality = rb_hash_aref(rb_opts, SYMBOL("personality")); if (!NIL_P(rb_personality)) { - if (is_integer(rb_personality)) + if (is_integer(rb_personality)) { opts->personality = NUM2INT(rb_personality); - else + } else { + error = "personality must be an integer"; goto err; + } } rb_initial_cwd = rb_hash_aref(rb_opts, SYMBOL("initial_cwd")); if (!NIL_P(rb_initial_cwd)) { - if (is_string(rb_initial_cwd)) + if (is_string(rb_initial_cwd)) { opts->initial_cwd = StringValuePtr(rb_initial_cwd); - else + } else { + error = "initial_cwd must be a string"; goto err; + } } rb_uid = rb_hash_aref(rb_opts, SYMBOL("uid")); if (!NIL_P(rb_uid)) { - if (is_integer(rb_uid)) + if (is_integer(rb_uid)) { opts->uid = NUM2INT(rb_uid); - else + } else { + error = "uid must be an integer"; goto err; + } } rb_gid = rb_hash_aref(rb_opts, SYMBOL("gid")); if (!NIL_P(rb_gid)) { - if (is_integer(rb_gid)) + if (is_integer(rb_gid)) { opts->gid = NUM2INT(rb_gid); - else + } else { + error = "gid must be an integer"; goto err; + } } rb_env_policy = rb_hash_aref(rb_opts, SYMBOL("env_policy")); if (!NIL_P(rb_env_policy)) { - if (is_integer(rb_env_policy)) + if (is_integer(rb_env_policy)) { opts->env_policy = NUM2INT(rb_env_policy); - else + } else { + error = "env_policy must be an integer"; goto err; + } } rb_extra_env_vars = rb_hash_aref(rb_opts, SYMBOL("extra_env_vars")); if (!NIL_P(rb_extra_env_vars)) { - if (is_string_array(rb_extra_env_vars)) + if (is_string_array(rb_extra_env_vars)) { opts->extra_env_vars = ruby_to_c_string_array(rb_extra_env_vars); - else + } else { + error = "extra_env_vars must be a array of strings"; goto err; + } } rb_extra_keep_env = rb_hash_aref(rb_opts, SYMBOL("extra_keep_env")); if (!NIL_P(rb_extra_keep_env)) { - if (is_string_array(rb_extra_keep_env)) + if (is_string_array(rb_extra_keep_env)) { opts->extra_keep_env = ruby_to_c_string_array(rb_extra_keep_env); - else + } else { + error = "extra_keep_env must be a array of strings"; goto err; + } } rb_stdin = rb_hash_aref(rb_opts, SYMBOL("stdin")); if (!NIL_P(rb_stdin)) { - if (has_file_descriptor(rb_stdin)) + if (has_file_descriptor(rb_stdin)) { opts->stdin_fd = io_fileno(rb_stdin); - else + } else { + error = "stdin object must have a file descriptor"; goto err; + } } rb_stdout = rb_hash_aref(rb_opts, SYMBOL("stdout")); if (!NIL_P(rb_stdout)) { - if (has_file_descriptor(rb_stdout)) + if (has_file_descriptor(rb_stdout)) { opts->stdout_fd = io_fileno(rb_stdout); - else + } else { + error = "stdout object must have a file descriptor"; goto err; + } } rb_stderr = rb_hash_aref(rb_opts, SYMBOL("stderr")); if (!NIL_P(rb_stderr)) { - if (has_file_descriptor(rb_stderr)) + if (has_file_descriptor(rb_stderr)) { opts->stderr_fd = io_fileno(rb_stderr); - else + } else { + error = "stderr object must have a file descriptor"; goto err; + } } return opts; err: lxc_attach_free_options(opts); - return NULL; + if (error != NULL) + rb_raise(rb_eArgError, "%s", error); + else + return NULL; } static RETURN_WITHOUT_GVL_TYPE From 03584f60c5b6db46c00f1d30214452076c8283dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Mon, 23 Feb 2015 18:41:18 -0500 Subject: [PATCH 13/24] Update Travis configuration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 00b9d3c..5eec734 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,5 +16,6 @@ script: - bundle exec rake clean package notifications: + webhooks: https://linuxcontainers.org/webhook-lxcbot/ email: - andrenth@gmail.com From 75c0db54a8b4aed727531b4f51e6483b114b8b8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=89=E5=BC=A0=E7=BA=B8?= Date: Fri, 6 Mar 2015 12:22:51 +0800 Subject: [PATCH 14/24] Update README.md you need to install ruby-dev/lxc-dev(debian/ubuntu) before $(gem install ruby-lxc) --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 9c85a18..26d2c53 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,8 @@ Assuming a current installation of LXC is available, to install Ruby-LXC simply run the commands below ```sh +sudo apt-get install ruby-dev lxc-dev + bundle install bundle exec rake compile bundle exec rake gem @@ -27,6 +29,7 @@ gem "ruby-lxc", github: "lxc/ruby-lxc", require: "lxc" - Container lifecycle management (create, start, stop and destroy containers) ```ruby +require 'lxc' c = LXC::Container.new('foo') c.create('ubuntu') # create a container named foo with ubuntu template c.start From b262a3f5ad10dfbead8b0cb20e427f2e243ed05d Mon Sep 17 00:00:00 2001 From: Andre Nathan Date: Mon, 4 Jan 2016 11:22:21 -0200 Subject: [PATCH 15/24] Avoid rb_std{in,out,err} name clash with rubinius --- ext/lxc/lxc.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/ext/lxc/lxc.c b/ext/lxc/lxc.c index d1664c7..2fd5a62 100644 --- a/ext/lxc/lxc.c +++ b/ext/lxc/lxc.c @@ -574,7 +574,7 @@ lxc_attach_parse_options(VALUE rb_opts) lxc_attach_options_t *opts; VALUE rb_attach_flags, rb_namespaces, rb_personality, rb_initial_cwd; VALUE rb_uid, rb_gid, rb_env_policy, rb_extra_env_vars, rb_extra_keep_env; - VALUE rb_stdin, rb_stdout, rb_stderr; + VALUE rb_stdin_opt, rb_stdout_opt, rb_stderr_opt; opts = malloc(sizeof(*opts)); if (opts == NULL) @@ -667,28 +667,28 @@ lxc_attach_parse_options(VALUE rb_opts) goto err; } } - rb_stdin = rb_hash_aref(rb_opts, SYMBOL("stdin")); - if (!NIL_P(rb_stdin)) { - if (has_file_descriptor(rb_stdin)) { - opts->stdin_fd = io_fileno(rb_stdin); + rb_stdin_opt = rb_hash_aref(rb_opts, SYMBOL("stdin")); + if (!NIL_P(rb_stdin_opt)) { + if (has_file_descriptor(rb_stdin_opt)) { + opts->stdin_fd = io_fileno(rb_stdin_opt); } else { error = "stdin object must have a file descriptor"; goto err; } } - rb_stdout = rb_hash_aref(rb_opts, SYMBOL("stdout")); - if (!NIL_P(rb_stdout)) { - if (has_file_descriptor(rb_stdout)) { - opts->stdout_fd = io_fileno(rb_stdout); + rb_stdout_opt = rb_hash_aref(rb_opts, SYMBOL("stdout")); + if (!NIL_P(rb_stdout_opt)) { + if (has_file_descriptor(rb_stdout_opt)) { + opts->stdout_fd = io_fileno(rb_stdout_opt); } else { error = "stdout object must have a file descriptor"; goto err; } } - rb_stderr = rb_hash_aref(rb_opts, SYMBOL("stderr")); - if (!NIL_P(rb_stderr)) { - if (has_file_descriptor(rb_stderr)) { - opts->stderr_fd = io_fileno(rb_stderr); + rb_stderr_opt = rb_hash_aref(rb_opts, SYMBOL("stderr")); + if (!NIL_P(rb_stderr_opt)) { + if (has_file_descriptor(rb_stderr_opt)) { + opts->stderr_fd = io_fileno(rb_stderr_opt); } else { error = "stderr object must have a file descriptor"; goto err; From 9dbd2e901a34100ff6fcf5207a055b8a87896e2a Mon Sep 17 00:00:00 2001 From: Andre Nathan Date: Mon, 4 Jan 2016 11:41:36 -0200 Subject: [PATCH 16/24] Fix debian dependencies --- debian/control | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/control b/debian/control index 922a2c7..96283e8 100644 --- a/debian/control +++ b/debian/control @@ -2,13 +2,13 @@ Source: ruby-lxc Section: ruby Priority: optional Maintainer: Andre Nathan -Build-Depends: debhelper (>= 7.0.50~), gem2deb (>= 0.2.3~) +Build-Depends: debhelper (>= 7.0.50~), gem2deb (>= 0.2.3~), lxc-dev Standards-Version: 3.9.5 XS-Ruby-Versions: all Package: ruby-lxc Architecture: any XB-Ruby-Versions: ${ruby:Versions} -Depends: ${misc:Depends}, ${shlibs:Depends}, ruby | ruby-interpreter, lxc-dev +Depends: ${misc:Depends}, ${shlibs:Depends}, ruby | ruby-interpreter, liblxc1 Description: Ruby bindings for liblxc This package provides liblxc bindings for the Ruby programming language. From 5039b493c589882ab00e5503a66f443cf4414aed Mon Sep 17 00:00:00 2001 From: Andre Nathan Date: Mon, 4 Jan 2016 11:43:50 -0200 Subject: [PATCH 17/24] Version 1.2.1 --- debian/changelog | 6 ++++++ lib/lxc/version.rb | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 72e7c0e..36d0736 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +ruby-lxc (1.2.1-0digirati1) trusty; urgency=low + + * Version 1.2.1. + + -- Andre Nathan Fri, 04 Jan 2016 11:43:33 -0200 + ruby-lxc (1.2.0-0digirati1) trusty; urgency=low * Version 1.2.0. diff --git a/lib/lxc/version.rb b/lib/lxc/version.rb index 1b94970..bee56ac 100644 --- a/lib/lxc/version.rb +++ b/lib/lxc/version.rb @@ -1,3 +1,3 @@ module LXC - VERSION = '1.2.0' + VERSION = '1.2.1' end From c0712e16d639471d07bda2e7728f7173ff4c8d58 Mon Sep 17 00:00:00 2001 From: Jafar Al-Gharaibeh Date: Thu, 13 Oct 2016 13:07:05 -0500 Subject: [PATCH 18/24] Fix: undefined symbol error when loading lxc.so lxc_strerror() doesn't not exist, it is nothing more than an idea. LXC folks don't have plans to add it any time soon Signed-off-by: Jafar Al-Gharaibeh --- ext/lxc/lxc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ext/lxc/lxc.c b/ext/lxc/lxc.c index 2fd5a62..b45a141 100644 --- a/ext/lxc/lxc.c +++ b/ext/lxc/lxc.c @@ -42,7 +42,6 @@ extern void *rb_thread_call_without_gvl(void *(*func)(void *), void *data1, extern int lxc_wait_for_pid_status(pid_t pid); extern long lxc_config_parse_arch(const char *arch); -extern const char *lxc_strerror(int error); static VALUE Container; static VALUE Error; @@ -2069,7 +2068,7 @@ container_unfreeze(VALUE self) ret = RELEASING_GVL(unfreeze_without_gvl, data); if (!ret) - rb_raise(Error, "unable to unfreeze container: %s", lxc_strerror(ret)); + rb_raise(Error, "unable to unfreeze container"); return self; } From e4f78ad7f8c8013ffba3f4276bb9a33b10cc3800 Mon Sep 17 00:00:00 2001 From: Andre Nathan Date: Mon, 24 Oct 2016 10:55:25 -0200 Subject: [PATCH 19/24] Version 1.2.2 --- debian/changelog | 6 ++++++ lib/lxc/version.rb | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 36d0736..13520ef 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +ruby-lxc (1.2.2-0digirati1) trusty; urgency=low + + * Version 1.2.2. + + -- Andre Nathan Mon, 24 Oct 2016 10:55:05 -0200 + ruby-lxc (1.2.1-0digirati1) trusty; urgency=low * Version 1.2.1. diff --git a/lib/lxc/version.rb b/lib/lxc/version.rb index bee56ac..efc2bc1 100644 --- a/lib/lxc/version.rb +++ b/lib/lxc/version.rb @@ -1,3 +1,3 @@ module LXC - VERSION = '1.2.1' + VERSION = '1.2.2' end From 0eb378c2914b0a345d3aa321b1a63011dede6150 Mon Sep 17 00:00:00 2001 From: Jakub Skokan Date: Thu, 12 Apr 2018 12:29:36 +0200 Subject: [PATCH 20/24] Fix build with LXC 3.0 --- ext/lxc/lxc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ext/lxc/lxc.c b/ext/lxc/lxc.c index b45a141..b0ec634 100644 --- a/ext/lxc/lxc.c +++ b/ext/lxc/lxc.c @@ -6,6 +6,7 @@ #include #include #include +#include #define SYMBOL(s) ID2SYM(rb_intern(s)) From b3f43f273914fd37af8c10fa9a20a25591b1df07 Mon Sep 17 00:00:00 2001 From: Andre Nathan Date: Tue, 10 Jul 2018 10:29:23 -0300 Subject: [PATCH 21/24] Version 1.2.3 --- debian/changelog | 6 ++++++ lib/lxc/version.rb | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 13520ef..43c1c39 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +ruby-lxc (1.2.3-0digirati1) trusty; urgency=low + + * Version 1.2.3. + + -- Andre Nathan Mon, 10 Jul 2018 10:29:03 -0300 + ruby-lxc (1.2.2-0digirati1) trusty; urgency=low * Version 1.2.2. diff --git a/lib/lxc/version.rb b/lib/lxc/version.rb index efc2bc1..15bb139 100644 --- a/lib/lxc/version.rb +++ b/lib/lxc/version.rb @@ -1,3 +1,3 @@ module LXC - VERSION = '1.2.2' + VERSION = '1.2.3' end From 6bddbee7a5cb5c61108f7c5fd8e77dbd3b9e0e12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Wed, 21 Jun 2023 21:43:46 -0400 Subject: [PATCH 22/24] github: Add DCO/target tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber --- .github/workflows/commits.yml | 40 +++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/commits.yml diff --git a/.github/workflows/commits.yml b/.github/workflows/commits.yml new file mode 100644 index 0000000..57f5d69 --- /dev/null +++ b/.github/workflows/commits.yml @@ -0,0 +1,40 @@ +name: Commits +on: + - pull_request + +permissions: + contents: read + +jobs: + dco-check: + permissions: + pull-requests: read # for tim-actions/get-pr-commits to get list of commits from the PR + name: Signed-off-by (DCO) + runs-on: ubuntu-20.04 + steps: + - name: Get PR Commits + id: 'get-pr-commits' + uses: tim-actions/get-pr-commits@master + with: + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Check that all commits are signed-off + uses: tim-actions/dco@master + with: + commits: ${{ steps.get-pr-commits.outputs.commits }} + + target-branch: + permissions: + contents: none + name: Branch target + runs-on: ubuntu-20.04 + steps: + - name: Check branch target + env: + TARGET: ${{ github.event.pull_request.base.ref }} + run: | + set -x + [ "${TARGET}" = "master" ] && exit 0 + + echo "Invalid branch target: ${TARGET}" + exit 1 From cf94855c8ef74cba3d657f0f5bc70ab8a9a96ed6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Mon, 24 Jul 2023 11:07:35 -0400 Subject: [PATCH 23/24] github: Update for main branch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber --- .github/workflows/commits.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/commits.yml b/.github/workflows/commits.yml index 57f5d69..541a8f9 100644 --- a/.github/workflows/commits.yml +++ b/.github/workflows/commits.yml @@ -34,7 +34,7 @@ jobs: TARGET: ${{ github.event.pull_request.base.ref }} run: | set -x - [ "${TARGET}" = "master" ] && exit 0 + [ "${TARGET}" = "main" ] && exit 0 echo "Invalid branch target: ${TARGET}" exit 1 From 2902c02478f0a921942cda39c887aed68c7797fb Mon Sep 17 00:00:00 2001 From: Denis Knauf Date: Tue, 10 Oct 2023 15:31:34 +0200 Subject: [PATCH 24/24] arch_to_personality removed (lxc_config_parse_arch is not provided in API). lxc_wait_for_pid_status implementation added (not provided in API) --- ext/lxc/lxc.c | 64 +++++++++++++++++++++++++++++++++------------------ 1 file changed, 42 insertions(+), 22 deletions(-) diff --git a/ext/lxc/lxc.c b/ext/lxc/lxc.c index b0ec634..6a1f394 100644 --- a/ext/lxc/lxc.c +++ b/ext/lxc/lxc.c @@ -41,8 +41,28 @@ extern void *rb_thread_call_without_gvl(void *(*func)(void *), void *data1, #define RELEASING_GVL2(func, arg, killfunc, killarg) func(arg) #endif -extern int lxc_wait_for_pid_status(pid_t pid); -extern long lxc_config_parse_arch(const char *arch); +//extern int lxc_wait_for_pid_status(pid_t pid); +#include +#include +int lxc_wait_for_pid_status(pid_t pid) +{ + int status, ret; + +again: + ret = waitpid(pid, &status, 0); + if (ret == -1) { + if (errno == EINTR) + goto again; + + return -1; + } + + if (ret != pid) + goto again; + + return status; +} +//extern long lxc_config_parse_arch(const char *arch); static VALUE Container; static VALUE Error; @@ -98,24 +118,24 @@ free_c_string_array(char **arr) * "personality", either +:linux32+ or +:linux+, for the 32-bit and 64-bit * architectures, respectively. */ -static VALUE -lxc_arch_to_personality(VALUE self, VALUE rb_arch) -{ - int ret; - char *arch; - - arch = StringValuePtr(rb_arch); - ret = lxc_config_parse_arch(arch); - - switch (ret) { - case PER_LINUX32: - return SYMBOL("linux32"); - case PER_LINUX: - return SYMBOL("linux"); - default: - rb_raise(Error, "unknown personality"); - } -} +//static VALUE +//lxc_arch_to_personality(VALUE self, VALUE rb_arch) +//{ +// int ret; +// char *arch; +// +// arch = StringValuePtr(rb_arch); +// ret = lxc_config_parse_arch(arch); +// +// switch (ret) { +// case PER_LINUX32: +// return SYMBOL("linux32"); +// case PER_LINUX: +// return SYMBOL("linux"); +// default: +// rb_raise(Error, "unknown personality"); +// } +//} /* * call-seq: @@ -2127,8 +2147,8 @@ Init_lxc(void) { VALUE LXC = rb_define_module("LXC"); - rb_define_singleton_method(LXC, "arch_to_personality", - lxc_arch_to_personality, 1); + //rb_define_singleton_method(LXC, "arch_to_personality", + // lxc_arch_to_personality, 1); rb_define_singleton_method(LXC, "run_command", lxc_run_command, 1); rb_define_singleton_method(LXC, "run_shell", lxc_run_shell, 0); rb_define_singleton_method(LXC, "global_config_item",