apt-pkg 0.0.2 → 0.0.3
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 +4 -4
- data/History.md +6 -0
- data/LICENSE +1 -1
- data/README.md +21 -16
- data/ext/apt_pkg/apt-pkg.cpp +75 -78
- data/ext/apt_pkg/apt-pkg.h +24 -0
- data/ext/apt_pkg/configuration.cpp +182 -0
- data/ext/apt_pkg/configuration.h +5 -0
- data/ext/apt_pkg/pkgcache.cpp +65 -0
- data/ext/apt_pkg/pkgcache.h +7 -0
- data/test/apt_pkg_cache_test.rb +40 -0
- data/test/apt_pkg_configuration_test.rb +74 -0
- data/test/apt_pkg_test.rb +33 -21
- data/test/test_helper.rb +0 -1
- metadata +26 -17
- data/.gitignore +0 -4
- data/Rakefile +0 -18
- data/apt-pkg.gemspec +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a15a6f04cd0bacddacf0cfed8521bc4001bc5a31
|
4
|
+
data.tar.gz: 5f95076ea9c816f6e604904e1cf1602b64eff022
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76f75b505d7e04f39ca5f4717c93b2a1bbfe92be3f0340f196a3e8e7492673a32174cf54b80d83b9c2f0f9f3ff9160d7da2863cf513239f2f3cd39c1245c9b53
|
7
|
+
data.tar.gz: 3add16347b3a0bc3ca2cfbf155f50d7e866aa1572689965ab46641fb337126267871afd8b5d24037b27b52f59b8d1e165f90017ea9675acc154ce308a877f70a
|
data/History.md
ADDED
data/LICENSE
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License
|
2
2
|
|
3
|
-
Copyright (c) 2014 Laurent Arnoud <laurent@spkdev.net>
|
3
|
+
Copyright (c) 2014-2015 Laurent Arnoud <laurent@spkdev.net>
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining
|
6
6
|
a copy of this software and associated documentation files (the
|
data/README.md
CHANGED
@@ -1,9 +1,21 @@
|
|
1
1
|
# Ruby interface to apt-pkg
|
2
2
|
|
3
|
+
Goal of this project is to have a proper Ruby binding to APT like in
|
4
|
+
[Python](https://apt.alioth.debian.org/python-apt-doc/library/apt_pkg.html).
|
5
|
+
|
6
|
+
Currently install, remove packages commands are **not** implemented.
|
7
|
+
|
8
|
+
Simple search is implemented with:
|
9
|
+
|
10
|
+
~~~ ruby
|
11
|
+
require 'apt_pkg'
|
12
|
+
Debian::AptPkg::PkgCache.pkg_names("vim")
|
13
|
+
~~~
|
14
|
+
|
3
15
|
## INSTALL
|
4
16
|
|
5
17
|
~~~ console
|
6
|
-
aptitude install libapt-pkg-dev
|
18
|
+
aptitude install build-essential ruby-dev libapt-pkg-dev (~> 1.0)
|
7
19
|
gem install apt-pkg
|
8
20
|
~~~
|
9
21
|
|
@@ -11,18 +23,10 @@ gem install apt-pkg
|
|
11
23
|
|
12
24
|
~~~ ruby
|
13
25
|
require 'apt_pkg'
|
14
|
-
|
15
|
-
Debian::AptPkg.check_dep('1', '<', '2') # => true
|
16
|
-
Debian::AptPkg.check_dep('1', Debian::AptPkg::NOT_EQUALS, '2') # => true
|
17
|
-
Debian::AptPkg.check_domain_list("alioth.debian.org", "debian.net,debian.org") # => true
|
18
|
-
Debian::AptPkg.cmp_version('1.1', '1.0') # => 1
|
19
|
-
Debian::AptPkg.size_to_str(10000) # => '10.0 k'
|
20
|
-
Debian::AptPkg.string_to_bool('yes') # => 1
|
21
|
-
Debian::AptPkg.time_to_str(3601) # => '1h 0min 1s'
|
22
|
-
Debian::AptPkg.upstream_version('3.4.15-1+b1') # => '3.4.15'
|
23
|
-
Debian::AptPkg.uri_to_filename('http://debian.org/index.html') # => 'debian.org_index.html'
|
24
26
|
~~~
|
25
27
|
|
28
|
+
See https://spk.github.io/ruby-apt-pkg/
|
29
|
+
|
26
30
|
## BUILD
|
27
31
|
|
28
32
|
~~~ console
|
@@ -37,12 +41,13 @@ bundle exec rake compile
|
|
37
41
|
bundle exec rake test
|
38
42
|
~~~
|
39
43
|
|
40
|
-
## REFERENCES
|
41
|
-
|
42
|
-
* http://apt.alioth.debian.org/python-apt-doc/library/apt_pkg.html
|
43
|
-
|
44
44
|
## LICENSE
|
45
45
|
|
46
46
|
The MIT License
|
47
47
|
|
48
|
-
Copyright (c) 2014 Laurent Arnoud <laurent@spkdev.net>
|
48
|
+
Copyright (c) 2014-2015 Laurent Arnoud <laurent@spkdev.net>
|
49
|
+
|
50
|
+
---
|
51
|
+
[](https://rubygems.org/gems/apt-pkg)
|
52
|
+
[](https://travis-ci.org/spk/ruby-apt-pkg)
|
53
|
+
[](http://opensource.org/licenses/MIT)
|
data/ext/apt_pkg/apt-pkg.cpp
CHANGED
@@ -1,27 +1,6 @@
|
|
1
|
-
#include
|
2
|
-
#include
|
3
|
-
#include
|
4
|
-
#include <apt-pkg/pkgcache.h>
|
5
|
-
#include <apt-pkg/strutl.h>
|
6
|
-
#include <apt-pkg/init.h>
|
7
|
-
|
8
|
-
using namespace std;
|
9
|
-
|
10
|
-
/* from '<ruby/dl.h>' */
|
11
|
-
#define INT2BOOL(x) ((x) ? Qtrue : Qfalse)
|
12
|
-
|
13
|
-
/* function prototypes */
|
14
|
-
extern "C" void Init_apt_pkg();
|
15
|
-
/* String functions */
|
16
|
-
static VALUE uri_to_filename(VALUE self, VALUE uri);
|
17
|
-
static VALUE time_to_str(VALUE self, VALUE secondes);
|
18
|
-
static VALUE size_to_str(VALUE self, VALUE size);
|
19
|
-
static VALUE string_to_bool(VALUE self, VALUE text);
|
20
|
-
static VALUE check_domain_list(VALUE self, VALUE host, VALUE list);
|
21
|
-
/* Versioning */
|
22
|
-
static VALUE cmp_version(VALUE self, VALUE pkg_version_a, VALUE pkg_version_b);
|
23
|
-
static VALUE check_dep(VALUE self, VALUE pkg_version_a, VALUE cmp_type, VALUE pkg_version_b);
|
24
|
-
static VALUE upstream_version(VALUE self, VALUE ver);
|
1
|
+
#include "apt-pkg.h"
|
2
|
+
#include "configuration.h"
|
3
|
+
#include "pkgcache.h"
|
25
4
|
|
26
5
|
/*
|
27
6
|
* call-seq: cmp_version(pkg_version_a, pkg_version_b) -> int
|
@@ -38,8 +17,9 @@ static VALUE upstream_version(VALUE self, VALUE ver);
|
|
38
17
|
**/
|
39
18
|
static
|
40
19
|
VALUE cmp_version(VALUE self, VALUE pkg_version_a, VALUE pkg_version_b) {
|
41
|
-
|
42
|
-
|
20
|
+
int res = debVS.CmpVersion(StringValuePtr(pkg_version_a),
|
21
|
+
StringValuePtr(pkg_version_b));
|
22
|
+
return INT2FIX(res);
|
43
23
|
}
|
44
24
|
|
45
25
|
/*
|
@@ -59,21 +39,22 @@ VALUE cmp_version(VALUE self, VALUE pkg_version_a, VALUE pkg_version_b) {
|
|
59
39
|
**/
|
60
40
|
static
|
61
41
|
VALUE check_dep(VALUE self, VALUE pkg_version_a, VALUE cmp_type, VALUE pkg_version_b) {
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
42
|
+
unsigned int op = 0;
|
43
|
+
if (TYPE(cmp_type) == T_FIXNUM) {
|
44
|
+
op = NUM2INT(cmp_type);
|
45
|
+
} else {
|
46
|
+
const char *op_str = StringValuePtr(cmp_type);
|
47
|
+
if (strcmp(op_str, ">") == 0) op_str = ">>";
|
48
|
+
if (strcmp(op_str, "<") == 0) op_str = "<<";
|
49
|
+
if (*debListParser::ConvertRelation(op_str, op) != 0)
|
50
|
+
{
|
51
|
+
rb_raise(rb_eArgError, "Bad comparison operation");
|
52
|
+
return 0;
|
53
|
+
}
|
54
|
+
}
|
55
|
+
int res = debVS.CheckDep(StringValuePtr(pkg_version_a), op,
|
56
|
+
StringValuePtr(pkg_version_b));
|
57
|
+
return INT2BOOL(res);
|
77
58
|
}
|
78
59
|
|
79
60
|
/*
|
@@ -86,7 +67,7 @@ VALUE check_dep(VALUE self, VALUE pkg_version_a, VALUE cmp_type, VALUE pkg_versi
|
|
86
67
|
**/
|
87
68
|
static
|
88
69
|
VALUE uri_to_filename(VALUE self, VALUE uri) {
|
89
|
-
|
70
|
+
return rb_str_new2(URItoFileName(StringValuePtr(uri)).c_str());
|
90
71
|
}
|
91
72
|
|
92
73
|
/*
|
@@ -99,7 +80,7 @@ VALUE uri_to_filename(VALUE self, VALUE uri) {
|
|
99
80
|
**/
|
100
81
|
static
|
101
82
|
VALUE upstream_version(VALUE self, VALUE ver) {
|
102
|
-
|
83
|
+
return rb_str_new2(debVS.UpstreamVersion(StringValuePtr(ver)).c_str());
|
103
84
|
}
|
104
85
|
|
105
86
|
/*
|
@@ -112,7 +93,7 @@ VALUE upstream_version(VALUE self, VALUE ver) {
|
|
112
93
|
**/
|
113
94
|
static
|
114
95
|
VALUE time_to_str(VALUE self, VALUE secondes) {
|
115
|
-
|
96
|
+
return rb_str_new2(TimeToStr(NUM2INT(secondes)).c_str());
|
116
97
|
}
|
117
98
|
|
118
99
|
/*
|
@@ -125,7 +106,7 @@ VALUE time_to_str(VALUE self, VALUE secondes) {
|
|
125
106
|
**/
|
126
107
|
static
|
127
108
|
VALUE size_to_str(VALUE self, VALUE size) {
|
128
|
-
|
109
|
+
return rb_str_new2(SizeToStr(NUM2INT(size)).c_str());
|
129
110
|
}
|
130
111
|
|
131
112
|
/*
|
@@ -133,14 +114,14 @@ VALUE size_to_str(VALUE self, VALUE size) {
|
|
133
114
|
*
|
134
115
|
* Parse the string input and return a boolean.
|
135
116
|
*
|
136
|
-
* Debian::AptPkg.string_to_bool('yes') # =>
|
137
|
-
* Debian::AptPkg.string_to_bool('no') # =>
|
138
|
-
* Debian::AptPkg.string_to_bool('no-recognized') # =>
|
117
|
+
* Debian::AptPkg.string_to_bool('yes') # => true
|
118
|
+
* Debian::AptPkg.string_to_bool('no') # => false
|
119
|
+
* Debian::AptPkg.string_to_bool('no-recognized') # => false
|
139
120
|
*
|
140
121
|
**/
|
141
122
|
static
|
142
123
|
VALUE string_to_bool(VALUE self, VALUE text) {
|
143
|
-
|
124
|
+
return INT2BOOL(StringToBool(StringValuePtr(text)) == 1);
|
144
125
|
}
|
145
126
|
|
146
127
|
/*
|
@@ -153,40 +134,56 @@ VALUE string_to_bool(VALUE self, VALUE text) {
|
|
153
134
|
**/
|
154
135
|
static
|
155
136
|
VALUE check_domain_list(VALUE self, VALUE host, VALUE list) {
|
156
|
-
|
157
|
-
|
137
|
+
int res = CheckDomainList(StringValuePtr(host), StringValuePtr(list));
|
138
|
+
return INT2BOOL(res);
|
158
139
|
}
|
159
140
|
|
160
141
|
void
|
161
142
|
Init_apt_pkg() {
|
162
|
-
|
163
|
-
|
164
|
-
|
143
|
+
pkgInitConfig(*_config);
|
144
|
+
pkgInitSystem(*_config, _system);
|
145
|
+
|
146
|
+
/* Base module */
|
147
|
+
VALUE rb_mDebian = rb_define_module("Debian");
|
148
|
+
VALUE rb_mDebianAptPkg = rb_define_module_under(rb_mDebian, "AptPkg");
|
149
|
+
VALUE rb_mDebianAptPkgConfiguration
|
150
|
+
= rb_define_module_under(rb_mDebianAptPkg, "Configuration");
|
151
|
+
|
152
|
+
rb_define_singleton_method(rb_mDebianAptPkg, "uri_to_filename",
|
153
|
+
RUBY_METHOD_FUNC(uri_to_filename), 1);
|
154
|
+
rb_define_singleton_method(rb_mDebianAptPkg, "time_to_str",
|
155
|
+
RUBY_METHOD_FUNC(time_to_str), 1);
|
156
|
+
rb_define_singleton_method(rb_mDebianAptPkg, "size_to_str",
|
157
|
+
RUBY_METHOD_FUNC(size_to_str), 1);
|
158
|
+
rb_define_singleton_method(rb_mDebianAptPkg, "string_to_bool",
|
159
|
+
RUBY_METHOD_FUNC(string_to_bool), 1);
|
160
|
+
rb_define_singleton_method(rb_mDebianAptPkg, "check_domain_list",
|
161
|
+
RUBY_METHOD_FUNC(check_domain_list), 2);
|
162
|
+
rb_define_singleton_method(rb_mDebianAptPkg, "cmp_version",
|
163
|
+
RUBY_METHOD_FUNC(cmp_version), 2);
|
164
|
+
rb_define_singleton_method(rb_mDebianAptPkg, "check_dep",
|
165
|
+
RUBY_METHOD_FUNC(check_dep), 3);
|
166
|
+
rb_define_singleton_method(rb_mDebianAptPkg, "upstream_version",
|
167
|
+
RUBY_METHOD_FUNC(upstream_version), 1);
|
165
168
|
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
169
|
+
/* Represents less equal operator. */
|
170
|
+
rb_define_const(rb_mDebianAptPkg, "LESS_EQ", INT2FIX(pkgCache::Dep::LessEq));
|
171
|
+
/* Represents greater equal operator. */
|
172
|
+
rb_define_const(rb_mDebianAptPkg, "GREATER_EQ", INT2FIX(pkgCache::Dep::GreaterEq));
|
173
|
+
/* Represents less operator. */
|
174
|
+
rb_define_const(rb_mDebianAptPkg, "LESS", INT2FIX(pkgCache::Dep::Less));
|
175
|
+
/* Represents greater operator. */
|
176
|
+
rb_define_const(rb_mDebianAptPkg, "GREATER", INT2FIX(pkgCache::Dep::Greater));
|
177
|
+
/* Represents equals operator. */
|
178
|
+
rb_define_const(rb_mDebianAptPkg, "EQUALS", INT2FIX(pkgCache::Dep::Equals));
|
179
|
+
/* Represents not equals operator. */
|
180
|
+
rb_define_const(rb_mDebianAptPkg, "NOT_EQUALS", INT2FIX(pkgCache::Dep::NotEquals));
|
174
181
|
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
/* Represents less operator. */
|
180
|
-
rb_define_const(rb_mDebianAptPkg, "LESS", INT2FIX(pkgCache::Dep::Less));
|
181
|
-
/* Represents greater operator. */
|
182
|
-
rb_define_const(rb_mDebianAptPkg, "GREATER", INT2FIX(pkgCache::Dep::Greater));
|
183
|
-
/* Represents equals operator. */
|
184
|
-
rb_define_const(rb_mDebianAptPkg, "EQUALS", INT2FIX(pkgCache::Dep::Equals));
|
185
|
-
/* Represents not equals operator. */
|
186
|
-
rb_define_const(rb_mDebianAptPkg, "NOT_EQUALS", INT2FIX(pkgCache::Dep::NotEquals));
|
182
|
+
/* Represents the version of apt. */
|
183
|
+
rb_define_const(rb_mDebianAptPkg, "VERSION", rb_str_new2(pkgVersion));
|
184
|
+
/* Represents the version of apt_pkg library. */
|
185
|
+
rb_define_const(rb_mDebianAptPkg, "LIB_VERSION", rb_str_new2(pkgLibVersion));
|
187
186
|
|
188
|
-
|
189
|
-
|
190
|
-
/* Represents the version of apt_pkg library. */
|
191
|
-
rb_define_const(rb_mDebianAptPkg, "LIB_VERSION", rb_str_new2(pkgLibVersion));
|
187
|
+
init_apt_pkg_configuration();
|
188
|
+
init_apt_pkg_pkgcache();
|
192
189
|
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
#include <ruby.h>
|
2
|
+
#include <apt-pkg/deblistparser.h>
|
3
|
+
#include <apt-pkg/debversion.h>
|
4
|
+
#include <apt-pkg/pkgcache.h>
|
5
|
+
#include <apt-pkg/strutl.h>
|
6
|
+
#include <apt-pkg/init.h>
|
7
|
+
|
8
|
+
/* from '<ruby/dl.h>' */
|
9
|
+
#define INT2BOOL(x) ((x) ? Qtrue : Qfalse)
|
10
|
+
|
11
|
+
using namespace std;
|
12
|
+
|
13
|
+
/* function prototypes */
|
14
|
+
extern "C" void Init_apt_pkg();
|
15
|
+
/* String functions */
|
16
|
+
static VALUE uri_to_filename(VALUE self, VALUE uri);
|
17
|
+
static VALUE time_to_str(VALUE self, VALUE secondes);
|
18
|
+
static VALUE size_to_str(VALUE self, VALUE size);
|
19
|
+
static VALUE string_to_bool(VALUE self, VALUE text);
|
20
|
+
static VALUE check_domain_list(VALUE self, VALUE host, VALUE list);
|
21
|
+
/* Versioning */
|
22
|
+
static VALUE cmp_version(VALUE self, VALUE pkg_version_a, VALUE pkg_version_b);
|
23
|
+
static VALUE check_dep(VALUE self, VALUE pkg_version_a, VALUE cmp_type, VALUE pkg_version_b);
|
24
|
+
static VALUE upstream_version(VALUE self, VALUE ver);
|
@@ -0,0 +1,182 @@
|
|
1
|
+
#include "configuration.h"
|
2
|
+
|
3
|
+
/*
|
4
|
+
* call-seq: architectures() -> array
|
5
|
+
*
|
6
|
+
* Return the list of architectures supported on this system.
|
7
|
+
*
|
8
|
+
* Debian::AptPkg::Configuration.architectures # => ["amd64"]
|
9
|
+
*
|
10
|
+
**/
|
11
|
+
static
|
12
|
+
VALUE architectures(VALUE self) {
|
13
|
+
VALUE result = rb_ary_new();
|
14
|
+
std::vector<std::string> arches = APT::Configuration::getArchitectures();
|
15
|
+
std::vector<std::string>::const_iterator I;
|
16
|
+
for (I = arches.begin(); I != arches.end(); I++)
|
17
|
+
{
|
18
|
+
rb_ary_push(result, rb_str_new2((*I).c_str()));
|
19
|
+
}
|
20
|
+
return result;
|
21
|
+
}
|
22
|
+
|
23
|
+
/*
|
24
|
+
* call-seq: check_architecture(arch) -> bool
|
25
|
+
*
|
26
|
+
* Are we interested in the given Architecture.
|
27
|
+
*
|
28
|
+
* Debian::AptPkg::Configuration.check_architecture("all") # => true
|
29
|
+
*
|
30
|
+
**/
|
31
|
+
static
|
32
|
+
VALUE check_architecture(VALUE self, VALUE arch) {
|
33
|
+
int res = APT::Configuration::checkArchitecture(StringValuePtr(arch));
|
34
|
+
return INT2BOOL(res);
|
35
|
+
}
|
36
|
+
|
37
|
+
/*
|
38
|
+
* call-seq: languages() -> array
|
39
|
+
*
|
40
|
+
* Return the list of languages code.
|
41
|
+
*
|
42
|
+
* Params:
|
43
|
+
*
|
44
|
+
* +all+:: All languages code or short for false.
|
45
|
+
*
|
46
|
+
* Debian::AptPkg::Configuration.languages # => ["en", "none", "fr"]
|
47
|
+
* Debian::AptPkg::Configuration.languages(false) # => ["en"]
|
48
|
+
*
|
49
|
+
**/
|
50
|
+
static
|
51
|
+
VALUE languages(int argc, VALUE* argv, VALUE self) {
|
52
|
+
VALUE all;
|
53
|
+
rb_scan_args(argc, argv, "01", &all);
|
54
|
+
VALUE result = rb_ary_new();
|
55
|
+
std::vector<std::string> const langs = APT::Configuration::getLanguages(all);
|
56
|
+
std::vector<std::string>::const_iterator I;
|
57
|
+
for (I = langs.begin(); I != langs.end(); I++)
|
58
|
+
{
|
59
|
+
rb_ary_push(result, rb_str_new2((*I).c_str()));
|
60
|
+
}
|
61
|
+
return result;
|
62
|
+
}
|
63
|
+
|
64
|
+
/*
|
65
|
+
* call-seq: check_language(lang, all) -> bool
|
66
|
+
*
|
67
|
+
* Are we interested in the given language.
|
68
|
+
*
|
69
|
+
* Debian::AptPkg::Configuration.check_language("fr") # => true
|
70
|
+
*
|
71
|
+
**/
|
72
|
+
static
|
73
|
+
VALUE check_language(int argc, VALUE* argv, VALUE self) {
|
74
|
+
if (argc > 2 || argc == 0) {
|
75
|
+
rb_raise(rb_eArgError, "wrong number of arguments");
|
76
|
+
}
|
77
|
+
VALUE lang, all;
|
78
|
+
rb_scan_args(argc, argv, "11", &lang, &all);
|
79
|
+
int res = APT::Configuration::checkLanguage(StringValuePtr(lang), all);
|
80
|
+
return INT2BOOL(res);
|
81
|
+
}
|
82
|
+
|
83
|
+
/*
|
84
|
+
* call-seq: compressors() -> array
|
85
|
+
*
|
86
|
+
* Return the list of compressors supported on this system.
|
87
|
+
*
|
88
|
+
* Debian::AptPkg::Configuration.compressors # => ["gz"]
|
89
|
+
*
|
90
|
+
**/
|
91
|
+
static
|
92
|
+
VALUE compressors(VALUE self) {
|
93
|
+
VALUE result = rb_ary_new();
|
94
|
+
std::vector<std::string> cmps = APT::Configuration::getCompressionTypes();
|
95
|
+
std::vector<std::string>::const_iterator I;
|
96
|
+
for (I = cmps.begin(); I != cmps.end(); I++)
|
97
|
+
{
|
98
|
+
rb_ary_push(result, rb_str_new2((*I).c_str()));
|
99
|
+
}
|
100
|
+
return result;
|
101
|
+
}
|
102
|
+
|
103
|
+
/*
|
104
|
+
* call-seq: config_find(name, default_key = '') -> string
|
105
|
+
*
|
106
|
+
* Return the value stored at the option named key, or the value given by the
|
107
|
+
* string default if the option in question is not set.
|
108
|
+
*
|
109
|
+
* Params:
|
110
|
+
*
|
111
|
+
* +name+:: Key name.
|
112
|
+
* +default_key+:: Default key when config option not set.
|
113
|
+
*
|
114
|
+
* Debian::AptPkg::Configuration.config_find('Dir::Etc::main') # => "apt.conf"
|
115
|
+
*
|
116
|
+
**/
|
117
|
+
static
|
118
|
+
VALUE config_find(int argc, VALUE* argv, VALUE self) {
|
119
|
+
if (argc > 2 || argc == 0) {
|
120
|
+
rb_raise(rb_eArgError, "wrong number of arguments");
|
121
|
+
}
|
122
|
+
VALUE name, default_key;
|
123
|
+
rb_scan_args(argc, argv, "11", &name, &default_key);
|
124
|
+
if (NIL_P(default_key))
|
125
|
+
default_key = rb_str_new2("");
|
126
|
+
return rb_str_new2(_config->Find(StringValuePtr(name),
|
127
|
+
StringValuePtr(default_key)).c_str());
|
128
|
+
}
|
129
|
+
|
130
|
+
/*
|
131
|
+
* call-seq: config_find_file(name, default_key = '') -> string
|
132
|
+
*
|
133
|
+
* Locate the given key using find() and return the path to the file/directory.
|
134
|
+
* This uses a special algorithms which moves upwards in the configuration space
|
135
|
+
* and prepends the values of the options to the result. These methods are
|
136
|
+
* generally used for the options stored in the ‘Dir’ section of the
|
137
|
+
* configuration.
|
138
|
+
*
|
139
|
+
* Params:
|
140
|
+
*
|
141
|
+
* +name+:: Key name.
|
142
|
+
* +default_key+:: Default key when config option not set.
|
143
|
+
*
|
144
|
+
* Debian::AptPkg::Configuration.config_find_file('Dir::Etc::main') # => "/etc/apt/apt.conf"
|
145
|
+
*
|
146
|
+
**/
|
147
|
+
static
|
148
|
+
VALUE config_find_file(int argc, VALUE* argv, VALUE self) {
|
149
|
+
if (argc > 2 || argc == 0) {
|
150
|
+
rb_raise(rb_eArgError, "wrong number of arguments");
|
151
|
+
}
|
152
|
+
VALUE name, default_key;
|
153
|
+
rb_scan_args(argc, argv, "11", &name, &default_key);
|
154
|
+
if (NIL_P(default_key))
|
155
|
+
default_key = rb_str_new2("");
|
156
|
+
return rb_str_new2(_config->FindFile(StringValuePtr(name),
|
157
|
+
StringValuePtr(default_key)).c_str());
|
158
|
+
}
|
159
|
+
|
160
|
+
void
|
161
|
+
init_apt_pkg_configuration() {
|
162
|
+
VALUE rb_mDebian = rb_define_module("Debian");
|
163
|
+
VALUE rb_mDebianAptPkg = rb_define_module_under(rb_mDebian, "AptPkg");
|
164
|
+
VALUE rb_mDebianAptPkgConfiguration =
|
165
|
+
rb_define_module_under(rb_mDebianAptPkg, "Configuration");
|
166
|
+
|
167
|
+
rb_define_singleton_method(rb_mDebianAptPkgConfiguration, "architectures",
|
168
|
+
RUBY_METHOD_FUNC(architectures), 0);
|
169
|
+
rb_define_singleton_method(rb_mDebianAptPkgConfiguration, "check_architecture",
|
170
|
+
RUBY_METHOD_FUNC(check_architecture), 1);
|
171
|
+
rb_define_singleton_method(rb_mDebianAptPkgConfiguration, "languages",
|
172
|
+
RUBY_METHOD_FUNC(languages), -1);
|
173
|
+
rb_define_singleton_method(rb_mDebianAptPkgConfiguration, "check_language",
|
174
|
+
RUBY_METHOD_FUNC(check_language), -1);
|
175
|
+
rb_define_singleton_method(rb_mDebianAptPkgConfiguration, "compressors",
|
176
|
+
RUBY_METHOD_FUNC(compressors), 0);
|
177
|
+
|
178
|
+
rb_define_singleton_method(rb_mDebianAptPkgConfiguration, "config_find",
|
179
|
+
RUBY_METHOD_FUNC(config_find), -1);
|
180
|
+
rb_define_singleton_method(rb_mDebianAptPkgConfiguration, "config_find_file",
|
181
|
+
RUBY_METHOD_FUNC(config_find_file), -1);
|
182
|
+
}
|
@@ -0,0 +1,65 @@
|
|
1
|
+
#include "pkgcache.h"
|
2
|
+
|
3
|
+
/*
|
4
|
+
* call-seq: gen_caches() -> bool
|
5
|
+
*
|
6
|
+
* Call the main cache generator.
|
7
|
+
*
|
8
|
+
* Debian::AptPkg::PkgCache.gen_caches # => false
|
9
|
+
*
|
10
|
+
**/
|
11
|
+
static
|
12
|
+
VALUE gen_caches(VALUE self) {
|
13
|
+
pkgCacheFile CacheFile;
|
14
|
+
int res = CacheFile.BuildCaches(NULL, true);
|
15
|
+
return INT2BOOL(res);
|
16
|
+
}
|
17
|
+
|
18
|
+
/*
|
19
|
+
* call-seq: pkg_names() -> array, nil
|
20
|
+
*
|
21
|
+
* List the names of all packages in the system.
|
22
|
+
* Return nil when cache is not generated.
|
23
|
+
*
|
24
|
+
* Debian::AptPkg::PkgCache.pkg_names('gcolor2') # => ["gcolor2"]
|
25
|
+
*
|
26
|
+
**/
|
27
|
+
static
|
28
|
+
VALUE pkg_names(int argc, VALUE* argv, VALUE self) {
|
29
|
+
if (argc > 1 || argc == 0) {
|
30
|
+
rb_raise(rb_eArgError, "You must give at least one search argument");
|
31
|
+
}
|
32
|
+
VALUE name;
|
33
|
+
rb_scan_args(argc, argv, "01", &name);
|
34
|
+
if (NIL_P(name) || RSTRING_LEN(name) < 1) {
|
35
|
+
rb_raise(rb_eArgError, "You must give at least one search pattern");
|
36
|
+
}
|
37
|
+
VALUE result = rb_ary_new();
|
38
|
+
|
39
|
+
pkgCacheFile CacheFile;
|
40
|
+
if (CacheFile.GetPkgCache() == 0) {
|
41
|
+
return Qnil;
|
42
|
+
}
|
43
|
+
pkgCache::GrpIterator I = CacheFile.GetPkgCache()->GrpBegin();
|
44
|
+
|
45
|
+
const char *pkgname = StringValuePtr(name);
|
46
|
+
for (;I.end() != true; ++I) {
|
47
|
+
if (strncmp(I.Name(), pkgname, strlen(pkgname)) == 0) {
|
48
|
+
rb_ary_push(result, rb_str_new2(I.Name()));
|
49
|
+
}
|
50
|
+
}
|
51
|
+
return result;
|
52
|
+
}
|
53
|
+
|
54
|
+
void
|
55
|
+
init_apt_pkg_pkgcache() {
|
56
|
+
VALUE rb_mDebian = rb_define_module("Debian");
|
57
|
+
VALUE rb_mDebianAptPkg = rb_define_module_under(rb_mDebian, "AptPkg");
|
58
|
+
VALUE rb_mDebianAptPkgConfiguration = rb_define_module_under(rb_mDebianAptPkg,
|
59
|
+
"PkgCache");
|
60
|
+
|
61
|
+
rb_define_singleton_method(rb_mDebianAptPkgConfiguration, "gen_caches",
|
62
|
+
RUBY_METHOD_FUNC(gen_caches), 0);
|
63
|
+
rb_define_singleton_method(rb_mDebianAptPkgConfiguration, "pkg_names",
|
64
|
+
RUBY_METHOD_FUNC(pkg_names), -1);
|
65
|
+
}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require_relative 'test_helper'
|
2
|
+
|
3
|
+
describe Debian::AptPkg::PkgCache do
|
4
|
+
describe '.gen_caches' do
|
5
|
+
it 'return boolean' do
|
6
|
+
if Process.uid == 0
|
7
|
+
Debian::AptPkg::PkgCache.gen_caches.must_equal true
|
8
|
+
else
|
9
|
+
Debian::AptPkg::PkgCache.gen_caches.must_equal false
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe '.pkg_names' do
|
15
|
+
it 'argument' do
|
16
|
+
lambda {
|
17
|
+
Debian::AptPkg::PkgCache.pkg_names
|
18
|
+
}.must_raise ArgumentError
|
19
|
+
|
20
|
+
lambda {
|
21
|
+
Debian::AptPkg::PkgCache.pkg_names(nil)
|
22
|
+
}.must_raise ArgumentError
|
23
|
+
|
24
|
+
lambda {
|
25
|
+
Debian::AptPkg::PkgCache.pkg_names("")
|
26
|
+
}.must_raise ArgumentError
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'be filtered' do
|
30
|
+
search = Debian::AptPkg::PkgCache.pkg_names("vim")
|
31
|
+
# CI specific cache can not be present
|
32
|
+
unless search.nil? || search.empty?
|
33
|
+
search.must_include "vim"
|
34
|
+
search.must_include "vim-nox"
|
35
|
+
search.must_include "vim-gtk"
|
36
|
+
search.wont_include "emacs"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
require_relative 'test_helper'
|
2
|
+
|
3
|
+
describe Debian::AptPkg::Configuration do
|
4
|
+
it 'architectures return an array' do
|
5
|
+
arches = Debian::AptPkg::Configuration.architectures
|
6
|
+
arches.must_be_instance_of Array
|
7
|
+
arches.wont_be_empty
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'languages return an array' do
|
11
|
+
all_langs = Debian::AptPkg::Configuration.languages
|
12
|
+
all_langs.must_be_instance_of Array
|
13
|
+
all_langs.wont_be_empty
|
14
|
+
|
15
|
+
langs = Debian::AptPkg::Configuration.languages(false)
|
16
|
+
langs.must_be_instance_of Array
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'check_architecture' do
|
20
|
+
Debian::AptPkg::Configuration.check_architecture('all').must_equal true
|
21
|
+
|
22
|
+
arches = Debian::AptPkg::Configuration.architectures
|
23
|
+
c = Debian::AptPkg::Configuration.check_architecture(arches.first)
|
24
|
+
c.must_equal true
|
25
|
+
|
26
|
+
# http://buildd.debian-ports.org/status/fetch.php?pkg=ruby2.1&arch=m68k&ver=2.1.2-2&stamp=1400604298
|
27
|
+
Debian::AptPkg::Configuration.check_architecture('m68k').must_equal false
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'check_language' do
|
31
|
+
lambda {
|
32
|
+
Debian::AptPkg::Configuration.check_language
|
33
|
+
}.must_raise ArgumentError
|
34
|
+
|
35
|
+
langs = Debian::AptPkg::Configuration.languages
|
36
|
+
Debian::AptPkg::Configuration.check_language(langs.first).must_equal true
|
37
|
+
|
38
|
+
c = Debian::AptPkg::Configuration.check_language('gallifreyan')
|
39
|
+
c.must_equal false
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'compressors return an array' do
|
43
|
+
cmps = Debian::AptPkg::Configuration.compressors
|
44
|
+
cmps.must_be_instance_of Array
|
45
|
+
cmps.wont_be_empty
|
46
|
+
cmps.must_include 'gz'
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'find configuration value' do
|
50
|
+
lambda {
|
51
|
+
Debian::AptPkg::Configuration.config_find
|
52
|
+
}.must_raise ArgumentError
|
53
|
+
|
54
|
+
Debian::AptPkg::Configuration.config_find('Dir::Etc::main').
|
55
|
+
must_equal "apt.conf"
|
56
|
+
Debian::AptPkg::Configuration.config_find('Dir::Etc::netrc').
|
57
|
+
must_equal "auth.conf"
|
58
|
+
Debian::AptPkg::Configuration.config_find('Dir::Etc::parts').
|
59
|
+
must_equal "apt.conf.d"
|
60
|
+
Debian::AptPkg::Configuration.config_find('Spk', 'DebianUser').
|
61
|
+
must_equal "DebianUser"
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'find file' do
|
65
|
+
lambda {
|
66
|
+
Debian::AptPkg::Configuration.config_find_file
|
67
|
+
}.must_raise ArgumentError
|
68
|
+
|
69
|
+
Debian::AptPkg::Configuration.config_find_file('Dir::Etc::main').
|
70
|
+
must_equal "/etc/apt/apt.conf"
|
71
|
+
Debian::AptPkg::Configuration.config_find_file('Dir::Etc::netrc').
|
72
|
+
must_equal "/etc/apt/auth.conf"
|
73
|
+
end
|
74
|
+
end
|
data/test/apt_pkg_test.rb
CHANGED
@@ -1,9 +1,7 @@
|
|
1
|
-
# encoding: UTF-8
|
2
1
|
require_relative 'test_helper'
|
3
2
|
|
4
3
|
describe Debian::AptPkg do
|
5
|
-
|
6
|
-
describe 'Debian::AptPkg.cmp_version' do
|
4
|
+
describe '.cmp_version' do
|
7
5
|
it 'should compare version' do
|
8
6
|
Debian::AptPkg.cmp_version('1.1', '1.0').must_be :>, 0
|
9
7
|
Debian::AptPkg.cmp_version('1.0', '1.0').must_be :==, 0
|
@@ -11,7 +9,7 @@ describe Debian::AptPkg do
|
|
11
9
|
end
|
12
10
|
end
|
13
11
|
|
14
|
-
describe '
|
12
|
+
describe '.check_dep' do
|
15
13
|
describe 'LessEq' do
|
16
14
|
it 'should compare Debian version' do
|
17
15
|
Debian::AptPkg.check_dep('1', '<=', '2').must_equal true
|
@@ -19,6 +17,7 @@ describe Debian::AptPkg do
|
|
19
17
|
Debian::AptPkg.check_dep('1', '<=', '1').must_equal true
|
20
18
|
end
|
21
19
|
end
|
20
|
+
|
22
21
|
describe 'GreaterEq' do
|
23
22
|
it 'should compare Debian version' do
|
24
23
|
Debian::AptPkg.check_dep('1', '>=', '2').must_equal false
|
@@ -26,6 +25,7 @@ describe Debian::AptPkg do
|
|
26
25
|
Debian::AptPkg.check_dep('1', '>=', '1').must_equal true
|
27
26
|
end
|
28
27
|
end
|
28
|
+
|
29
29
|
describe 'Less' do
|
30
30
|
it 'should compare Debian version' do
|
31
31
|
Debian::AptPkg.check_dep('1', '<', '2').must_equal true
|
@@ -33,6 +33,7 @@ describe Debian::AptPkg do
|
|
33
33
|
Debian::AptPkg.check_dep('1', '<', '1').must_equal false
|
34
34
|
end
|
35
35
|
end
|
36
|
+
|
36
37
|
describe 'Greater' do
|
37
38
|
it 'should compare Debian version' do
|
38
39
|
Debian::AptPkg.check_dep('1', '>', '2').must_equal false
|
@@ -40,6 +41,7 @@ describe Debian::AptPkg do
|
|
40
41
|
Debian::AptPkg.check_dep('1', '>', '1').must_equal false
|
41
42
|
end
|
42
43
|
end
|
44
|
+
|
43
45
|
describe 'Equals' do
|
44
46
|
it 'should compare Debian version' do
|
45
47
|
Debian::AptPkg.check_dep('1', '=', '2').must_equal false
|
@@ -47,56 +49,66 @@ describe Debian::AptPkg do
|
|
47
49
|
Debian::AptPkg.check_dep('1', '=', '1').must_equal true
|
48
50
|
end
|
49
51
|
end
|
52
|
+
|
50
53
|
describe 'NotEquals' do
|
51
54
|
it 'should compare Debian version' do
|
52
|
-
Debian::AptPkg.check_dep('1', Debian::AptPkg::NOT_EQUALS, '2').
|
53
|
-
|
54
|
-
Debian::AptPkg.check_dep('
|
55
|
+
Debian::AptPkg.check_dep('1', Debian::AptPkg::NOT_EQUALS, '2').
|
56
|
+
must_equal true
|
57
|
+
Debian::AptPkg.check_dep('2', Debian::AptPkg::NOT_EQUALS, '1').
|
58
|
+
must_equal true
|
59
|
+
Debian::AptPkg.check_dep('1', Debian::AptPkg::NOT_EQUALS, '1').
|
60
|
+
must_equal false
|
55
61
|
end
|
56
62
|
end
|
63
|
+
|
57
64
|
describe 'Errors' do
|
58
65
|
it 'should raise argument error with bad comparison' do
|
59
|
-
lambda {
|
66
|
+
lambda {
|
67
|
+
Debian::AptPkg.check_dep('1', 'bad', '2')
|
68
|
+
}.must_raise ArgumentError
|
60
69
|
end
|
61
70
|
end
|
62
71
|
end
|
63
72
|
|
64
|
-
describe '
|
73
|
+
describe '.uri_to_filename' do
|
65
74
|
it 'should return a filename which can be used to store the file' do
|
66
|
-
Debian::AptPkg.uri_to_filename('http://debian.org/index.html').
|
75
|
+
Debian::AptPkg.uri_to_filename('http://debian.org/index.html').
|
76
|
+
must_equal 'debian.org_index.html'
|
67
77
|
end
|
68
78
|
end
|
69
79
|
|
70
|
-
describe '
|
71
|
-
it 'Return the upstream version for the Debian package version
|
80
|
+
describe '.upstream_version' do
|
81
|
+
it 'Return the upstream version for the Debian package version' do
|
72
82
|
Debian::AptPkg.upstream_version('3.4.15-1+b1').must_equal '3.4.15'
|
73
83
|
end
|
74
84
|
end
|
75
85
|
|
76
|
-
describe '
|
86
|
+
describe '.time_to_str' do
|
77
87
|
it 'Format a given duration in human-readable manner' do
|
78
88
|
Debian::AptPkg.time_to_str(3601).must_equal '1h 0min 1s'
|
79
89
|
end
|
80
90
|
end
|
81
91
|
|
82
|
-
describe '
|
92
|
+
describe '.size_to_str' do
|
83
93
|
it 'Return a string describing the size in a human-readable manner' do
|
84
94
|
Debian::AptPkg.size_to_str(10000).must_equal '10.0 k'
|
85
95
|
end
|
86
96
|
end
|
87
97
|
|
88
|
-
describe '
|
98
|
+
describe '.string_to_bool' do
|
89
99
|
it 'Parse the string input and return a boolean' do
|
90
|
-
Debian::AptPkg.string_to_bool('yes').must_equal
|
91
|
-
Debian::AptPkg.string_to_bool('no').must_equal
|
92
|
-
Debian::AptPkg.string_to_bool('no-recognized').must_equal
|
100
|
+
Debian::AptPkg.string_to_bool('yes').must_equal true
|
101
|
+
Debian::AptPkg.string_to_bool('no').must_equal false
|
102
|
+
Debian::AptPkg.string_to_bool('no-recognized').must_equal false
|
93
103
|
end
|
94
104
|
end
|
95
105
|
|
96
|
-
describe '
|
106
|
+
describe '.check_domain_list' do
|
97
107
|
it 'See if the host name given by host is one of the domains given' do
|
98
|
-
Debian::AptPkg.check_domain_list("alioth.debian.org",
|
99
|
-
|
108
|
+
Debian::AptPkg.check_domain_list("alioth.debian.org",
|
109
|
+
"debian.net,debian.org").must_equal true
|
110
|
+
Debian::AptPkg.check_domain_list("git.debian.org",
|
111
|
+
"spkdev.net").must_equal false
|
100
112
|
end
|
101
113
|
end
|
102
114
|
end
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,69 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apt-pkg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Laurent Arnoud
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-12-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake-compiler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: minitest
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rdoc
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
description: Ruby interface to apt-pkg
|
@@ -72,17 +72,25 @@ executables: []
|
|
72
72
|
extensions:
|
73
73
|
- ext/apt_pkg/extconf.rb
|
74
74
|
extra_rdoc_files:
|
75
|
+
- History.md
|
75
76
|
- README.md
|
77
|
+
- ext/apt_pkg/configuration.cpp
|
76
78
|
- ext/apt_pkg/apt-pkg.cpp
|
79
|
+
- ext/apt_pkg/pkgcache.cpp
|
77
80
|
files:
|
78
|
-
- .gitignore
|
79
81
|
- Gemfile
|
82
|
+
- History.md
|
80
83
|
- LICENSE
|
81
84
|
- README.md
|
82
|
-
- Rakefile
|
83
|
-
- apt-pkg.gemspec
|
84
85
|
- ext/apt_pkg/apt-pkg.cpp
|
86
|
+
- ext/apt_pkg/apt-pkg.h
|
87
|
+
- ext/apt_pkg/configuration.cpp
|
88
|
+
- ext/apt_pkg/configuration.h
|
85
89
|
- ext/apt_pkg/extconf.rb
|
90
|
+
- ext/apt_pkg/pkgcache.cpp
|
91
|
+
- ext/apt_pkg/pkgcache.h
|
92
|
+
- test/apt_pkg_cache_test.rb
|
93
|
+
- test/apt_pkg_configuration_test.rb
|
86
94
|
- test/apt_pkg_test.rb
|
87
95
|
- test/test_helper.rb
|
88
96
|
homepage: http://github.com/spk/ruby-apt-pkg
|
@@ -91,23 +99,24 @@ licenses:
|
|
91
99
|
metadata: {}
|
92
100
|
post_install_message:
|
93
101
|
rdoc_options:
|
94
|
-
- --charset=UTF-8
|
102
|
+
- "--charset=UTF-8"
|
95
103
|
require_paths:
|
96
104
|
- lib
|
97
105
|
required_ruby_version: !ruby/object:Gem::Requirement
|
98
106
|
requirements:
|
99
|
-
- -
|
107
|
+
- - ">="
|
100
108
|
- !ruby/object:Gem::Version
|
101
109
|
version: '0'
|
102
110
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
111
|
requirements:
|
104
|
-
- -
|
112
|
+
- - ">="
|
105
113
|
- !ruby/object:Gem::Version
|
106
114
|
version: '0'
|
107
115
|
requirements: []
|
108
116
|
rubyforge_project:
|
109
|
-
rubygems_version: 2.
|
117
|
+
rubygems_version: 2.4.5.1
|
110
118
|
signing_key:
|
111
119
|
specification_version: 4
|
112
120
|
summary: Ruby interface to libapt-pkg
|
113
121
|
test_files: []
|
122
|
+
has_rdoc:
|
data/.gitignore
DELETED
data/Rakefile
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
require 'rake/extensiontask'
|
2
|
-
require 'rake/testtask'
|
3
|
-
require 'rdoc/task'
|
4
|
-
|
5
|
-
Rake::ExtensionTask.new('apt_pkg')
|
6
|
-
|
7
|
-
Rake::Task[:test].prerequisites << :clean
|
8
|
-
Rake::Task[:test].prerequisites << :compile
|
9
|
-
|
10
|
-
Rake::TestTask.new do |t|
|
11
|
-
t.pattern = 'test/**/*_test.rb'
|
12
|
-
end
|
13
|
-
|
14
|
-
RDoc::Task.new do |rd|
|
15
|
-
rd.rdoc_files.include("ext/**/*.cpp")
|
16
|
-
end
|
17
|
-
|
18
|
-
task default: [:test]
|
data/apt-pkg.gemspec
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
Gem::Specification.new do |s|
|
2
|
-
s.name = "apt-pkg"
|
3
|
-
s.version = '0.0.2'
|
4
|
-
|
5
|
-
s.authors = ["Laurent Arnoud"]
|
6
|
-
s.description = %q{Ruby interface to apt-pkg}
|
7
|
-
s.summary = %q{Ruby interface to libapt-pkg}
|
8
|
-
s.email = %q{laurent@spkdev.net}
|
9
|
-
s.license = "MIT"
|
10
|
-
s.extensions = ["ext/apt_pkg/extconf.rb"]
|
11
|
-
s.extra_rdoc_files = Dir['*.md', 'ext/**/*.cpp']
|
12
|
-
s.files = `git ls-files`.split($\)
|
13
|
-
s.homepage = %q{http://github.com/spk/ruby-apt-pkg}
|
14
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
15
|
-
s.require_paths = ["lib"]
|
16
|
-
s.add_development_dependency('rake')
|
17
|
-
s.add_development_dependency('rake-compiler')
|
18
|
-
s.add_development_dependency('minitest')
|
19
|
-
s.add_development_dependency('rdoc')
|
20
|
-
end
|