pacct 0.8.1-universal-linux → 0.8.2-universal-linux
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +33 -1
- data/ext/pacct/extconf.rb +2 -0
- data/ext/pacct/pacct_c.c +7 -4
- data/lib/pacct/version.rb +1 -1
- data/rpm/SOURCES +0 -0
- data/rpm/pacct.spec +69 -0
- metadata +52 -35
data/Rakefile
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
2
|
require "rspec/core/rake_task"
|
3
3
|
|
4
|
+
require "./lib/pacct/version.rb"
|
5
|
+
|
4
6
|
task :default => :spec
|
5
7
|
|
6
8
|
desc "Run specs"
|
@@ -10,6 +12,36 @@ RSpec::Core::RakeTask.new(:spec) do |task|
|
|
10
12
|
end
|
11
13
|
|
12
14
|
task :docs do
|
13
|
-
system("rdoc
|
15
|
+
system("rdoc ext lib")
|
16
|
+
end
|
17
|
+
|
18
|
+
desc "Build RPM"
|
19
|
+
task :rpm do
|
20
|
+
Rake::Task['build'].invoke
|
21
|
+
|
22
|
+
package = "pkg/pacct-#{Pacct::VERSION}-universal-linux.gem"
|
23
|
+
|
24
|
+
FileUtils.cp(package, 'rpm/SOURCES')
|
25
|
+
|
26
|
+
home_dir = Etc.getpwuid.dir
|
27
|
+
|
28
|
+
rpmbuild_dir = File.join(home_dir, 'rpmbuild')
|
29
|
+
spec_dir = File.join(rpmbuild_dir, 'SPECS')
|
30
|
+
src_dir = File.join(rpmbuild_dir, 'SOURCES')
|
31
|
+
|
32
|
+
[rpmbuild_dir, spec_dir, src_dir].each do |dir|
|
33
|
+
FileUtils.mkdir_p(dir)
|
34
|
+
end
|
35
|
+
|
36
|
+
FileUtils.cp('rpm/pacct.spec', spec_dir)
|
37
|
+
FileUtils.cp(package, src_dir)
|
38
|
+
|
39
|
+
rake_dir = Dir.pwd
|
40
|
+
|
41
|
+
Dir.chdir(rpmbuild_dir)
|
42
|
+
|
43
|
+
system 'rpmbuild -ba SPECS/pacct.spec'
|
44
|
+
|
45
|
+
Dir.chdir(rake_dir)
|
14
46
|
end
|
15
47
|
|
data/ext/pacct/extconf.rb
CHANGED
data/ext/pacct/pacct_c.c
CHANGED
@@ -88,6 +88,7 @@ static comp_t ulong_to_comp_t(unsigned long l) {
|
|
88
88
|
}
|
89
89
|
|
90
90
|
//Checks the result of a call, raising an error if it fails
|
91
|
+
//To do: handle non-integer values in the rb_raise format string?
|
91
92
|
#define CHECK_CALL(expr, expected_result) \
|
92
93
|
{ \
|
93
94
|
typeof(expr) expected = (expected_result); \
|
@@ -102,9 +103,7 @@ static comp_t ulong_to_comp_t(unsigned long l) {
|
|
102
103
|
err = rb_funcall(cSystemCallError, id_new, 2, rb_str_new2(buf), INT2NUM(errno)); \
|
103
104
|
rb_exc_raise(err); \
|
104
105
|
} else { \
|
105
|
-
|
106
|
-
snprintf(buf, sizeof(buf), #expr ": result %i expected, not %i - %s(%u)", expected, result, __FILE__, __LINE__); \
|
107
|
-
rb_raise(rb_eRuntimeError, buf); \
|
106
|
+
rb_raise(rb_eRuntimeError, #expr ": result %i expected, not %i - %s(%u)", expected, result, __FILE__, __LINE__); \
|
108
107
|
} \
|
109
108
|
} \
|
110
109
|
} \
|
@@ -846,6 +845,10 @@ void Init_pacct_c() {
|
|
846
845
|
if(mRSpec == Qtrue) {
|
847
846
|
/*
|
848
847
|
*Document-module: Pacct::Test
|
848
|
+
*
|
849
|
+
*Contains unit-testing methods
|
850
|
+
*
|
851
|
+
*Only defined when RSpec is loaded
|
849
852
|
*/
|
850
853
|
VALUE mTest = rb_define_module_under(mPacct, "Test");
|
851
854
|
rb_define_module_function(mTest, "check_call", test_check_call_macro, 1);
|
@@ -853,4 +856,4 @@ void Init_pacct_c() {
|
|
853
856
|
rb_define_module_function(mTest, "read_failure", test_read_failure, 0);
|
854
857
|
rb_define_module_function(mTest, "comp_t_to_ulong", test_comp_t_to_ulong, 1);
|
855
858
|
}
|
856
|
-
}
|
859
|
+
}
|
data/lib/pacct/version.rb
CHANGED
data/rpm/SOURCES
ADDED
Binary file
|
data/rpm/pacct.spec
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
Name: ruby-pacct
|
2
|
+
Version: 0.8.1
|
3
|
+
Release: 1%{?dist}
|
4
|
+
Summary: A Ruby C extension for reading Linux process accounting files in acct(5) format
|
5
|
+
|
6
|
+
%define gem_name pacct
|
7
|
+
%define gem %{gem_name}-%{version}-universal-linux
|
8
|
+
|
9
|
+
Group: Development/Libraries
|
10
|
+
License: MIT
|
11
|
+
URL: https://github.com/blm768/pacct
|
12
|
+
Source0: %{gem}.gem
|
13
|
+
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
|
14
|
+
|
15
|
+
BuildRequires: ruby-devel
|
16
|
+
Requires: rubygems
|
17
|
+
|
18
|
+
%description
|
19
|
+
A Ruby C extension for reading Linux process accounting files in acct(5) format
|
20
|
+
|
21
|
+
%prep
|
22
|
+
#gem unpack %{SOURCE0}
|
23
|
+
#%setup -q -D -T -n %{gem}
|
24
|
+
%setup -q -D -T -n .
|
25
|
+
cp %{SOURCE0} .
|
26
|
+
|
27
|
+
#gem spec %{SOURCE0} -l --ruby > %{gem}.gemspec
|
28
|
+
|
29
|
+
%define gem_dir /usr/lib/ruby/gems/1.8
|
30
|
+
%define gem_instdir %{gem_dir}/gems/%{gem}
|
31
|
+
|
32
|
+
%build
|
33
|
+
mkdir -p ./%{gem_dir}
|
34
|
+
|
35
|
+
#gem build %{gem_name}.gemspec
|
36
|
+
|
37
|
+
export CONFIGURE_ARGS="--with-cflags='%{optflags}'"
|
38
|
+
gem install -V \
|
39
|
+
--local \
|
40
|
+
--install-dir ./%{gem_dir} \
|
41
|
+
--bindir ./%{_bindir} \
|
42
|
+
--force \
|
43
|
+
--rdoc \
|
44
|
+
%{gem}.gem
|
45
|
+
|
46
|
+
%install
|
47
|
+
rm -rf %{buildroot}
|
48
|
+
mkdir -p %{buildroot}%{gem_instdir}
|
49
|
+
|
50
|
+
cp -a ./%{gem_dir}/* %{buildroot}%{gem_dir}/
|
51
|
+
|
52
|
+
#mkdir -p %{buildroot}%{gem_extdir_mri}/ext
|
53
|
+
#mv %{buildroot}%{gem_instdir}/lib/pacct/pacct_c.so %{buildroot}%{gem_extdir_mri}/ext
|
54
|
+
|
55
|
+
%clean
|
56
|
+
rm -rf %{buildroot}
|
57
|
+
|
58
|
+
|
59
|
+
%files
|
60
|
+
%defattr(-,root,root,-)
|
61
|
+
%doc %{gem_dir}/doc/%{gem}/*
|
62
|
+
%{gem_instdir}/*
|
63
|
+
%exclude %{gem_instdir}/.gitignore
|
64
|
+
%{gem_dir}/specifications/%{gem}.gemspec
|
65
|
+
%{gem_dir}/cache/%{gem}.gem
|
66
|
+
%exclude %{gem_dir}/bin/ruby_noexec_wrapper
|
67
|
+
|
68
|
+
%changelog
|
69
|
+
|
metadata
CHANGED
@@ -1,40 +1,46 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: pacct
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 59
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 8
|
9
|
+
- 2
|
10
|
+
version: 0.8.2
|
6
11
|
platform: universal-linux
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- Ben Merritt
|
9
14
|
autorequire:
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
17
|
+
|
18
|
+
date: 2013-05-13 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
15
21
|
name: rspec
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - ! '>='
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: '0'
|
22
|
-
type: :development
|
23
22
|
prerelease: false
|
24
|
-
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
24
|
none: false
|
26
|
-
requirements:
|
27
|
-
- -
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 3
|
29
|
+
segments:
|
30
|
+
- 0
|
31
|
+
version: "0"
|
32
|
+
type: :development
|
33
|
+
version_requirements: *id001
|
30
34
|
description: A C extension library for parsing accounting files in acct(5) format
|
31
|
-
email:
|
35
|
+
email:
|
32
36
|
- blm768@gmail.com
|
33
37
|
executables: []
|
34
|
-
|
38
|
+
|
39
|
+
extensions:
|
35
40
|
- ext/pacct/extconf.rb
|
36
41
|
extra_rdoc_files: []
|
37
|
-
|
42
|
+
|
43
|
+
files:
|
38
44
|
- .gitignore
|
39
45
|
- Gemfile
|
40
46
|
- LICENSE.txt
|
@@ -45,6 +51,8 @@ files:
|
|
45
51
|
- lib/pacct.rb
|
46
52
|
- lib/pacct/version.rb
|
47
53
|
- pacct.gemspec
|
54
|
+
- rpm/SOURCES
|
55
|
+
- rpm/pacct.spec
|
48
56
|
- snapshot/pacct
|
49
57
|
- snapshot/pacct_invalid_ids
|
50
58
|
- snapshot/pacct_invalid_length
|
@@ -54,29 +62,38 @@ files:
|
|
54
62
|
- spec/spec_helper.rb
|
55
63
|
homepage: https://github.com/blm768/pacct
|
56
64
|
licenses: []
|
65
|
+
|
57
66
|
post_install_message:
|
58
67
|
rdoc_options: []
|
59
|
-
|
68
|
+
|
69
|
+
require_paths:
|
60
70
|
- lib
|
61
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
71
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
62
72
|
none: false
|
63
|
-
requirements:
|
64
|
-
- -
|
65
|
-
- !ruby/object:Gem::Version
|
66
|
-
|
67
|
-
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
hash: 3
|
77
|
+
segments:
|
78
|
+
- 0
|
79
|
+
version: "0"
|
80
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
81
|
none: false
|
69
|
-
requirements:
|
70
|
-
- -
|
71
|
-
- !ruby/object:Gem::Version
|
72
|
-
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
hash: 3
|
86
|
+
segments:
|
87
|
+
- 0
|
88
|
+
version: "0"
|
73
89
|
requirements: []
|
90
|
+
|
74
91
|
rubyforge_project:
|
75
|
-
rubygems_version: 1.8.
|
92
|
+
rubygems_version: 1.8.25
|
76
93
|
signing_key:
|
77
94
|
specification_version: 3
|
78
95
|
summary: A C extension library for parsing accounting files in acct(5) format
|
79
|
-
test_files:
|
96
|
+
test_files:
|
80
97
|
- spec/entry_spec.rb
|
81
98
|
- spec/log_spec.rb
|
82
99
|
- spec/pacct_spec.rb
|