17 #define _RPMTS_INTERNAL 39 Data_Get_Struct(s,
void, ptr);
49 VALUE NVRA = rb_ary_new();
63 for (i = 0; i < nkeys; i++)
64 rb_ary_push(NVRA, rb_str_new2(keys[i]));
67 fprintf(stderr,
"==> %s(0x%lx) ptr %p NVRA 0x%lx\n",
68 __FUNCTION__, s, ptr, NVRA);
85 rb_scan_args(argc, argv,
"02", &v_tag, &v_key);
88 _tag = FIX2INT(v_tag);
90 _key = StringValueCStr(v_key);
125 VALUE specfile_v, rootURL_v, recursing_v, passphrase_v, cookie_v,
126 anyarch_v, force_v, verify_v;
127 rb_scan_args(argc, argv,
"8", &specfile_v, &rootURL_v, &recursing_v,
128 &passphrase_v, &cookie_v, &anyarch_v, &force_v, &verify_v);
132 Check_Type(specfile_v, T_STRING);
133 char *specfile = RSTRING_PTR(specfile_v);
135 Check_Type(rootURL_v, T_STRING);
136 char *rootURL = RSTRING_PTR(rootURL_v);
139 switch(TYPE(cookie_v)) {
141 cookie = RSTRING_PTR(cookie_v);
147 rpm_rb_raise(1,
"cookie must be either NIL or a string");
151 Check_Type(passphrase_v, T_STRING);
152 char *passphrase = RSTRING_PTR(passphrase_v);
155 switch(TYPE(recursing_v)) {
164 "Parameter 'recursing' must be either true or false");
169 switch(TYPE(anyarch_v)) {
178 "Parameter 'anyarch' must be either true or false");
183 switch(TYPE(verify_v)) {
192 "Parameter 'verify' must be either true or false");
197 switch(TYPE(force_v)) {
206 "Parameter 'force' must be either true or false");
212 int error =
parseSpec(ts, specfile, rootURL,
213 recursing, passphrase, cookie, anyarch, force, verify);
222 rb_iv_set(spec_v,
"ts", obj);
231 rb_define_method(klass,
"mi", &
rpmts_mi, -1);
241 fprintf(stderr,
"==> %s(0x%lx)\n", __FUNCTION__, s);
249 fprintf(stderr,
"==> %s(0x%lx, 0x%lx)\n", __FUNCTION__, s, v);
250 return INT2FIX(
_debug = FIX2INT(v));
259 fprintf(stderr,
"==> %s(0x%lx) ptr %p\n", __FUNCTION__, s, ptr);
269 fprintf(stderr,
"==> %s(0x%lx, 0x%lx) ptr %p\n", __FUNCTION__, s, v, ptr);
280 fprintf(stderr,
"==> %s(0x%lx) ptr %p\n", __FUNCTION__, s, ptr);
290 fprintf(stderr,
"==> %s(0x%lx, 0x%lx) ptr %p\n", __FUNCTION__, s, v, ptr);
319 fprintf(stderr,
"==> %s(%p)\n", __FUNCTION__, ts);
327 char * _rootdir =
"/";
330 rb_scan_args(argc, argv,
"01", &v_rootdir);
332 if (!NIL_P(v_rootdir))
333 _rootdir = StringValueCStr(v_rootdir);
339 fprintf(stderr,
"==> %s(%p[%d], 0x%lx) ts %p\n", __FUNCTION__, argv, argc, s, ts
341 return Data_Wrap_Struct(s, 0,
rpmts_free, ts);
353 fprintf(stderr,
"==> %s() rpmtsClass 0x%lx\n", __FUNCTION__,
rpmtsClass);
355 rb_include_module(
rpmtsClass, rb_mEnumerable);
Spec rpmtsSpec(rpmts ts)
Get spec control structure from transaction set.
static VALUE rpmts_parse_spec(int argc, VALUE *argv, VALUE obj)
Parses a spec file and returns a new RPM::Spec object to access it.
const char * rpmtsRootDir(rpmts ts)
Get transaction rootDir, i.e.
static void initMethods(VALUE klass)
static void initProperties(VALUE klass)
static VALUE rpmts_debug_get(VALUE s)
VALUE rpmtsClass
Consitutes the RPM::Ts class, binding to RPM's TransactionSet API.
static VALUE rpmts_rootdir_get(VALUE s)
int parseSpec(rpmts ts, const char *specFile, const char *rootURL, int recursing, const char *passPhrase, const char *cookie, int anyarch, int force, int verify)
Parse spec file into spec control structure.
static VALUE rpmtsLoadNVRA(VALUE s)
VALUE spec_wrap(Spec spec)
Wraps an already existing Spec_s structure in a Ruby class.
int argvCount(const ARGV_t argv)
Return no.
ARGV_t argvFree(ARGV_t argv)
Destroy an argv array.
static VALUE rpmts_vsflags_get(VALUE s)
Ruby bindings to the RPM Transaction Set API.
int rpmdbMireApply(rpmdb db, rpmTag tag, rpmMireMode mode, const char *pat, const char ***argvp)
Return array of keys matching a pattern.
void rpm_rb_raise(rpmRC error, char *message)
Raises a Ruby exception (RPM::Error).
void rpmtsSetRootDir(rpmts ts, const char *rootDir)
Set transaction rootDir, i.e.
static VALUE rpmts_rootdir_set(VALUE s, VALUE v)
RPM Ruby bindings "RPM" module.
static void * rpmts_ptr(VALUE s)
Returns the RPMTS structure wrapped in a RPM::Ts ruby object.
rpmdb rpmtsGetRdb(rpmts ts)
Get transaction set database handle.
This is the only module users of librpmbuild should need to include.
rpmts rpmtsFree(rpmts ts)
Destroy transaction set, closing the database as well.
rpmts rpmtsCreate(void)
Create an empty transaction set.
static void rpmts_free(rpmts ts)
rpmVSFlags rpmtsSetVSFlags(rpmts ts, rpmVSFlags vsflags)
Set verify signatures flag(s).
struct rpmts_s * rpmts
The RPM Transaction Set.
Structures and prototypes used for an "rpmts" transaction set.
rpmVSFlags rpmtsVSFlags(rpmts ts)
Get verify signatures flag(s).
static VALUE rpmts_debug_set(VALUE s, VALUE v)
int rpmtsOpenDB(rpmts ts, int dbmode)
Open the database used by the transaction.
VALUE rpmModule
The "RPM" Ruby module.
Ruby bindings for spec file access.
VALUE rpmrb_NewMi(void *_ts, int _tag, void *_key, int _len)
Access RPM indices using Berkeley DB interface(s).
static VALUE rpmts_vsflags_set(VALUE s, VALUE v)
static VALUE rpmts_mi(int argc, VALUE *argv, VALUE s)
#define RPMDBI_PACKAGES
Pseudo-tags used by the rpmdb and rpmgi iterator API's.
static VALUE rpmts_new(int argc, VALUE *argv, VALUE s)
static VALUE rpmts_NVRA_get(VALUE s)