capng_c 0.2.2 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2282b438c73cafe667183986b8beef357b3d397eff60249658f94d71326cafc8
4
- data.tar.gz: 8bb3439b3e3934efe4e83bda4e256780f4c7bb718a7f4883bc33d530483b5813
3
+ metadata.gz: bce3b9c0ad260ea018498a3b20f5906b79f8796cb791ba05417071ab9dfa32f4
4
+ data.tar.gz: e324f852c0f4433aa9572b2bfda44f4ab3b59ac0d8afb77fadd13ac9f76f53a8
5
5
  SHA512:
6
- metadata.gz: d24ec898c4b40f26cee597a369f10c4ada7973fdba6c4cb51e85812702f2d6684b83e69946e4f019d94ff595380663150d4af1833b99e0f84cba99599a579110
7
- data.tar.gz: d077c6cbbc46950174bbd6e0c2cbf296ac679b69a2231f560de846203718d562c920b53343db7d2dde48bd484cbcf3b50904c763f37ae99d330616bac0c015b1
6
+ metadata.gz: 45162d9090edd42d30626a9832ef1c970c45f78dfa3a77f7fea5a1184881d8a22bfaa0cc3c6e25eaf66e461cf1b09557a655b05b3789dcc9bd5a6f195b31e6b0
7
+ data.tar.gz: 1c4c28132d99e46afc10c49a5dcba7574e904ffa357bfca622da34bdf8e4ed614a8daecbb5144b1d756ba65b857176ede2bbd562c808d8660cd776d635e4ea6d
@@ -9,12 +9,12 @@ jobs:
9
9
  fail-fast: false
10
10
  matrix:
11
11
  label:
12
- - Debian GNU/Linux Buster amd64
12
+ - Debian GNU/Linux Bookworm amd64
13
13
  - Ubuntu Bionic amd64
14
14
  - Ubuntu Focal amd64
15
15
  include:
16
- - label: Debian GNU/Linux Buster amd64
17
- test-docker-image: debian:buster
16
+ - label: Debian GNU/Linux Bookworm amd64
17
+ test-docker-image: debian:bookworm
18
18
  test-script: ci/apt-test.sh
19
19
  - label: Ubuntu Bionic amd64
20
20
  test-docker-image: ubuntu:bionic
@@ -8,7 +8,7 @@ jobs:
8
8
  strategy:
9
9
  fail-fast: false
10
10
  matrix:
11
- ruby: [ '2.4', '2.5', '2.6' , '2.7' ]
11
+ ruby: [ '2.5', '2.6' , '2.7', '3.0', '3.1', '3.2', '3.3', '3.4' ]
12
12
  os:
13
13
  - ubuntu-latest
14
14
  name: Ruby ${{ matrix.ruby }} unit testing on ${{ matrix.os }}
@@ -25,6 +25,5 @@ jobs:
25
25
  env:
26
26
  CI: true
27
27
  run: |
28
- gem install bundler rake
29
28
  bundle install --jobs 4 --retry 3
30
- bundle exec rake
29
+ bundle exec rake
@@ -9,16 +9,16 @@ jobs:
9
9
  fail-fast: false
10
10
  matrix:
11
11
  label:
12
- - CentOS 7 x86_64
13
- - CentOS 8 x86_64
12
+ - RockyLinux 8 x86_64
13
+ - AlmaLinux 9 x86_64
14
14
  - Fedora 33 x86_64
15
15
  - AmazonLinux 2 x86_64
16
16
  include:
17
- - label: CentOS 7 x86_64
18
- test-docker-image: centos:7
17
+ - label: RockyLinux 8 x86_64
18
+ test-docker-image: rockylinux:8
19
19
  test-script: ci/yum-test.sh
20
- - label: CentOS 8 x86_64
21
- test-docker-image: centos:8
20
+ - label: AlmaLinux 9 x86_64
21
+ test-docker-image: almalinux:9
22
22
  test-script: ci/yum-test.sh
23
23
  - label: Fedora 33 x86_64
24
24
  test-docker-image: fedora:33
@@ -36,4 +36,4 @@ jobs:
36
36
  --tty \
37
37
  --volume ${PWD}:/capng \
38
38
  ${{ matrix.test-docker-image }} \
39
- /capng/${{ matrix.test-script }}
39
+ /capng/${{ matrix.test-script }}
data/Rakefile CHANGED
@@ -12,9 +12,7 @@ end
12
12
 
13
13
  require "rake/extensiontask"
14
14
 
15
- spec = eval File.read("capng_c.gemspec")
16
-
17
- Rake::ExtensionTask.new("capng", spec) do |ext|
15
+ Rake::ExtensionTask.new("capng") do |ext|
18
16
  ext.lib_dir = "lib/capng"
19
17
  end
20
18
 
data/ci/apt-test.sh CHANGED
@@ -7,9 +7,9 @@ export DEBIAN_FRONTEND=noninteractive
7
7
  apt update
8
8
  apt install -V -y lsb-release
9
9
 
10
- apt install -V -y ruby-dev git build-essential pkg-config
10
+ apt install -V -y ruby-dev git build-essential pkg-config libyaml-dev
11
11
  apt install -V -y libcap-ng-dev
12
12
  cd /capng && \
13
- gem install bundler --no-document && \
13
+ gem install bundler -v 2.3.27 --no-document && \
14
14
  bundle install && \
15
15
  bundle exec rake
data/ci/yum-test.sh CHANGED
@@ -34,6 +34,12 @@ case ${distribution} in
34
34
  ;;
35
35
  esac
36
36
  ;;
37
+ rocky)
38
+ DNF="dnf --enablerepo=powertools"
39
+ ;;
40
+ almalinux)
41
+ DNF="dnf --enablerepo=crb"
42
+ ;;
37
43
  esac
38
44
 
39
45
  ${DNF} groupinstall -y "Development Tools"
@@ -53,6 +59,7 @@ else
53
59
  rubygems \
54
60
  rpm-build
55
61
  fi
62
+ ${DNF} install -y libyaml-devel
56
63
  ${DNF} install -y libcap-ng-devel
57
64
 
58
65
  if [ $USE_SCL -eq 1 ]; then
@@ -60,5 +67,5 @@ if [ $USE_SCL -eq 1 ]; then
60
67
  export MANPATH=
61
68
  cd /capng && source /opt/rh/rh-ruby26/enable && gem install bundler --no-document && bundle install && bundle exec rake
62
69
  else
63
- cd /capng && gem install bundler --no-document && bundle install && bundle exec rake
70
+ cd /capng && gem install bundler -v 2.3.27 --no-document && bundle install && bundle exec rake
64
71
  fi
data/ext/capng/capng.c CHANGED
@@ -67,6 +67,19 @@ rb_capng_alloc(VALUE klass)
67
67
  return obj;
68
68
  }
69
69
 
70
+ static int
71
+ capng_get_file_descriptor(VALUE rb_file)
72
+ {
73
+ #ifdef HAVE_RB_IO_DESCRIPTOR
74
+ return rb_io_descriptor(rb_file);
75
+ #else
76
+ rb_io_t* fptr = NULL;
77
+
78
+ fptr = RFILE(rb_file)->fptr;
79
+ return fptr->fd;
80
+ #endif
81
+ }
82
+
70
83
  /*
71
84
  * Initalize CapNG class.
72
85
  *
@@ -500,15 +513,13 @@ static VALUE
500
513
  rb_capng_get_caps_file(VALUE self, VALUE rb_file)
501
514
  {
502
515
  int result = 0, fd = 0;
503
- rb_io_t* fptr = NULL;
504
516
 
505
517
  Check_Type(rb_file, T_FILE);
506
518
 
507
519
  if (NIL_P(rb_file)) {
508
520
  return Qfalse;
509
521
  }
510
- fptr = RFILE(rb_file)->fptr;
511
- fd = fptr->fd;
522
+ fd = capng_get_file_descriptor(rb_file);
512
523
  result = capng_get_caps_fd(fd);
513
524
 
514
525
  if (result == 0)
@@ -529,7 +540,6 @@ static VALUE
529
540
  rb_capng_apply_caps_file(VALUE self, VALUE rb_file)
530
541
  {
531
542
  int result = 0, fd = 0;
532
- rb_io_t* fptr = NULL;
533
543
 
534
544
  Check_Type(rb_file, T_FILE);
535
545
 
@@ -537,8 +547,7 @@ rb_capng_apply_caps_file(VALUE self, VALUE rb_file)
537
547
  return Qfalse;
538
548
  }
539
549
 
540
- fptr = RFILE(rb_file)->fptr;
541
- fd = fptr->fd;
550
+ fd = capng_get_file_descriptor(rb_file);
542
551
  result = capng_apply_caps_fd(fd);
543
552
 
544
553
  if (result == 0)
data/ext/capng/extconf.rb CHANGED
@@ -20,6 +20,10 @@ includedir = RbConfig::CONFIG["includedir"]
20
20
 
21
21
  dir_config("capng", includedir, libdir)
22
22
 
23
+ unless find_executable("pkg-config")
24
+ raise "Require pkg-config due to install capng_c gem. Please install pkg-config."
25
+ end
26
+
23
27
  pkg_config("libcap-ng")
24
28
  $CFLAGS << " -Wall -std=c99 -fPIC "
25
29
  # $CFLAGS << " -g -O0"
@@ -29,5 +33,6 @@ have_const("CAPNG_SELECT_ALL", "cap-ng.h")
29
33
  have_const("CAPNG_AMBIENT", "cap-ng.h")
30
34
  have_const("CAPNG_INIT_SUPP_GRP", "cap-ng.h")
31
35
  have_func("rb_sym2str", "ruby.h")
36
+ have_func("rb_io_descriptor", "ruby.h")
32
37
  have_func("capng_get_caps_fd", "cap-ng.h")
33
38
  create_makefile("capng/capng")
data/ext/capng/print.c CHANGED
@@ -129,8 +129,11 @@ rb_capng_print_caps_text(VALUE self, VALUE rb_where_name_or_type,
129
129
  result = capng_print_caps_text(CAPNG_PRINT_BUFFER, capability_type);
130
130
  }
131
131
 
132
- if (result)
133
- return rb_str_new2(result);
132
+ if (result) {
133
+ VALUE obj = rb_str_new2(result);
134
+ free(result);
135
+ return obj;
136
+ }
134
137
  else
135
138
  return rb_str_new2("none");
136
139
  }
@@ -191,8 +194,11 @@ rb_capng_print_caps_numeric(VALUE self, VALUE rb_where_name_or_type,
191
194
  result = capng_print_caps_numeric(CAPNG_PRINT_BUFFER, select);
192
195
  }
193
196
 
194
- if (result)
195
- return rb_str_new2(result);
197
+ if (result) {
198
+ VALUE obj = rb_str_new2(result);
199
+ free(result);
200
+ return obj;
201
+ }
196
202
  else
197
203
  return rb_str_new2("none");
198
204
  }
data/lib/capng/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class CapNG
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capng_c
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hiroshi Hatake
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2020-12-25 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: bundler
@@ -134,7 +133,6 @@ metadata:
134
133
  allowed_push_host: https://rubygems.org
135
134
  homepage_uri: https://github.com/fluent-plugins-nursery/capng_c
136
135
  source_code_uri: https://github.com/fluent-plugins-nursery/capng_c
137
- post_install_message:
138
136
  rdoc_options: []
139
137
  require_paths:
140
138
  - lib
@@ -149,8 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
149
147
  - !ruby/object:Gem::Version
150
148
  version: '0'
151
149
  requirements: []
152
- rubygems_version: 3.2.3
153
- signing_key:
150
+ rubygems_version: 3.6.9
154
151
  specification_version: 4
155
152
  summary: libcap-ng bindings for Ruby.
156
153
  test_files: []