rpm  5.4.15
rpm-rb.c
Go to the documentation of this file.
1 
13 #include "system.h"
14 #include "debug.h"
15 
16 #include "rpm-rb.h"
17 
18 #include "rpmts-rb.h"
19 #include "spec-rb.h"
20 #include "package-rb.h"
21 #include "rpmds-rb.h"
22 #include "rpmmc-rb.h"
23 
24 #include <rpmrc.h>
25 #include <rpmcb.h>
26 
27 #include <mire.h>
28 
29 #ifndef _GNU_SOURCE
30 #define _GNU_SOURCE
31 #endif
32 #include <stdio.h>
33 
34 
35 VALUE rpmModule;
36 
37 
38 void Init_rpm(void)
39 {
40  if(rpmReadConfigFiles(NULL, NULL) != 0)
41  rpm_rb_raise(1, "Reading config files failed");
42 
43  rpmModule = rb_define_module("RPM");
44 
45  Init_rpmts();
46  Init_spec();
47  Init_Package();
48  Init_rpmmc();
49  Init_rpmds();
50 }
51 
52 
53 void rpm_rb_raise(rpmRC error, char *message)
54 {
55  rb_require("rpmexceptions");
56  char *rb;
57  int i = asprintf(&rb, "raise RPM::Error.new(%i), '%s'", error, message);
58  if(i) rb_eval_string(rb);
59 }
int rpmReadConfigFiles(const char *file, const char *target)
Read macro configuration file(s) for a target.
Definition: rpmrc.c:1095
RPM pattern matching.
void Init_rpmts(void)
Definition: rpmts-rb.c:349
void Init_rpm(void)
Defines the "RPM" Ruby module and makes it known to the Interpreter.
Definition: rpm-rb.c:38
void Init_rpmds(void)
Definition: rpmds-rb.c:261
Ruby bindings to the RPM Transaction Set API.
void rpm_rb_raise(rpmRC error, char *message)
Raises a Ruby exception (RPM::Error).
Definition: rpm-rb.c:53
void Init_Package(void)
Creates a new RPM::Package instance.
Definition: package-rb.c:46
void Init_rpmmc(void)
Definition: rpmmc-rb.c:348
RPM Ruby bindings "RPM" module.
enum rpmRC_e rpmRC
RPM return codes.
const char const int i
Definition: bson.h:778
Ruby access to RPM's Package struct.
void Init_spec(void)
Initializes the Ruby class.
Definition: spec-rb.c:217
VALUE rpmModule
The "RPM" Ruby module.
Definition: rpm-rb.c:35
Ruby bindings for spec file access.
Ruby bindings to RPM's macro context facility.