Module: RPM
- Defined in:
- lib/rpm.rb,
lib/rpm/version.rb,
ext/rpm/rpm.c
Defined Under Namespace
Classes: Changelog, Conflict, DB, Dependency, File, Icon, MatchIterator, Obsolete, Package, Patch, Provide, Require, Source, Transaction, Version
Constant Summary collapse
- PKG_NAME =
'ruby-rpm'
- VERSION =
'1.3.1'
- CallbackData =
rpm_sCallbackData
- Problem =
rpm_sProblem
- PROB_FILER_FORCE =
INT2NUM(RPMPROB_FILTER_REPLACEPKG | RPMPROB_FILTER_REPLACENEWFILES | RPMPROB_FILTER_REPLACEOLDFILES)
- PROB_FILER_REPLACEFILES =
INT2NUM(RPMPROB_FILTER_REPLACENEWFILES | RPMPROB_FILTER_REPLACEOLDFILES)
- PROB_FILER_IGNORESIZE =
INT2NUM(RPMPROB_FILTER_DISKSPACE | RPMPROB_FILTER_DISKNODES)
- BUILD__UNTIL_PREP =
INT2NUM(RPMBUILD_PREP)
- BUILD__UNTIL_BUILD =
INT2NUM(RPMBUILD_PREP | RPMBUILD_BUILD)
- BUILD__UNTIL_INSTALL =
INT2NUM(RPMBUILD_PREP | RPMBUILD_BUILD | RPMBUILD_INSTALL)
- BUILD__BINARY_PACKAGE =
INT2NUM(RPMBUILD_PREP | RPMBUILD_BUILD | RPMBUILD_INSTALL | RPMBUILD_PACKAGEBINARY | RPMBUILD_CLEAN)
- BUILD__SOURCE_PACKAGE =
INT2NUM(RPMBUILD_PREP | RPMBUILD_BUILD | RPMBUILD_INSTALL | RPMBUILD_PACKAGESOURCE | RPMBUILD_CLEAN)
- BUILD__ALL_PACKAGE =
INT2NUM(RPMBUILD_PREP | RPMBUILD_BUILD | RPMBUILD_INSTALL | RPMBUILD_PACKAGEBINARY | RPMBUILD_PACKAGESOURCE | RPMBUILD_CLEAN)
- BUILD__CHECK_FILELIST =
INT2NUM(RPMBUILD_PREP | RPMBUILD_BUILD | RPMBUILD_INSTALL | RPMBUILD_FILECHECK)
- ChangeLog =
rpm_sChangeLog
Class Method Summary collapse
-
.[](name) ⇒ String
Value of macro
name
. -
.[]=(name, val) ⇒ Object
Setup a macro.
- .expand(name) ⇒ Object
- .init_macros(*args) ⇒ Object
-
.readrc(*args) ⇒ Object
Read configuration files.
-
.verbosity ⇒ Number
Verbosity level.
-
.verbosity=(verbosity) ⇒ Object
Sets the verbosity level.
- .vercmp(ver1, ver2) ⇒ Object
Class Method Details
.[](name) ⇒ String
Returns value of macro name
.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'ext/rpm/rpm.c', line 23
static VALUE
m_aref(VALUE m, VALUE name)
{
char buf[BUFSIZ];
char* tmp;
VALUE val;
if (TYPE(name) != T_STRING) {
rb_raise(rb_eTypeError, "illegal argument type");
}
sprintf(buf, "%%{%s}", RSTRING_PTR(name));
tmp = strdup(buf);
expandMacros(NULL, NULL, buf, BUFSIZ);
if (strcmp(tmp, buf) == 0) {
val = Qnil;
} else {
val = rb_str_new2(buf);
}
free(tmp);
return val;
}
|
.[]=(name, val) ⇒ Object
Setup a macro
58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'ext/rpm/rpm.c', line 58
static VALUE
m_aset(VALUE m, VALUE name, VALUE val)
{
if (TYPE(name) != T_STRING
|| (val != Qnil && TYPE(val) != T_STRING)) {
rb_raise(rb_eTypeError, "illegal argument type(s)");
}
if (val == Qnil) {
delMacro(NULL, RSTRING_PTR(name));
} else {
addMacro(NULL, RSTRING_PTR(name), NULL, RSTRING_PTR(val), RMIL_DEFAULT);
}
return Qnil;
}
|
.expand(name) ⇒ Object
13 14 15 16 17 |
# File 'ext/rpm/rpm.c', line 13
static VALUE
m_expand(VALUE m, VALUE name)
{
return rb_str_new2(rpmExpand(StringValueCStr(name), NULL));
}
|
.init_macros(*args) ⇒ Object
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
# File 'ext/rpm/rpm.c', line 116
static VALUE
m_init_macros(int argc, VALUE* argv, VALUE m)
{
register int i;
char buf[BUFSIZ];
if (argc == 0) {
rb_raise(rb_eArgError, "too few argument(>= 1)");
}
buf[0] = '\0';
for (i = 0; i < argc; i++) {
if (TYPE(argv[i]) != T_STRING) {
rb_raise(rb_eTypeError, "illegal argument type(s)");
}
strcat(buf, RSTRING_PTR(argv[i]));
strcat(buf, ":");
}
rpmInitMacros(NULL, buf);
return Qnil;
}
|
.readrc(*args) ⇒ Object
Read configuration files
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'ext/rpm/rpm.c', line 82
static VALUE
m_readrc(int argc, VALUE* argv, VALUE m)
{
register int i;
char buf[BUFSIZ];
if (argc == 0) {
rb_raise(rb_eArgError, "too few argument(>= 1)");
}
buf[0] = '\0';
for (i = 0; i < argc; i++) {
if (TYPE(argv[i]) != T_STRING) {
rb_raise(rb_eTypeError, "illegal argument type(s)");
}
strcat(buf, RSTRING_PTR(argv[i]));
strcat(buf, ":");
}
rpmFreeMacros(NULL);
if (rpmReadConfigFiles(buf, NULL)) {
rb_raise(rb_eRuntimeError, "can not read rc file %s", buf);
}
return Qnil;
}
|
.verbosity ⇒ Number
Returns Verbosity level.
152 153 154 155 156 |
# File 'ext/rpm/rpm.c', line 152
static VALUE
m_get_verbosity(VALUE m)
{
return INT2NUM(rpm_verbosity);
}
|
.verbosity=(verbosity) ⇒ Object
Sets the verbosity level
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
# File 'ext/rpm/rpm.c', line 168
static VALUE
m_set_verbosity(VALUE m, VALUE verbosity)
{
int v = NUM2INT(rb_Integer(verbosity));
switch (v) {
case RPMLOG_EMERG: case RPMLOG_ALERT:
case RPMLOG_CRIT: case RPMLOG_ERR:
case RPMLOG_WARNING: case RPMLOG_NOTICE:
case RPMLOG_INFO: case RPMLOG_DEBUG:
break;
default:
rb_raise(rb_eArgError, "invalid verbosity");
}
rpmSetVerbosity(v);
rpm_verbosity = v;
return Qnil;
}
|