rpm  5.4.10
Macros | Functions | Variables
spec-rb.c File Reference

Ruby bindings for spec file access. More...

#include "system.h"
#include "rpm-rb.h"
#include "spec-rb.h"
#include "rpmmc-rb.h"
#include "package-rb.h"
#include <stdio.h>
#include <rpmtag.h>
#include <rpmtypes.h>
#include <rpmio.h>
#include <rpmbuild.h>
#include <rpmspec.h>
#include <rpmmacro.h>
Include dependency graph for spec-rb.c:

Go to the source code of this file.

Macros

#define _GNU_SOURCE
#define _RPMTS_INTERNAL
#define _RPMFI_INTERNAL

Functions

static void _spec_free (Spec spec)
 C destructor for the Spec class.
static Spec _spec_get_spec (VALUE self)
 Returns the wrapped Spec structure.
static rpmts _spec_get_ts (VALUE self)
 Returns the hiddenly associated transaction set.
static VALUE _spec_get_sources (VALUE self, int flags)
 A helper routine that returns a Ruby array containing all sources that match a specific set of OR'ed flags.
static VALUE spec_get_sources (VALUE self)
 Returns an array of all sources defined in the spec file.
static VALUE spec_get_patches (VALUE self)
 Returns an array of all patches defined in the spec file.
static VALUE spec_get_packages (VALUE self)
 Returns all packages associated with the spec file.
static VALUE spec_get_macros (VALUE self)
 Returns the macro context of the spec file.
static VALUE spec_build (VALUE argc, VALUE *argv, VALUE self)
 Builds a part of the spec file.
VALUE spec_wrap (Spec spec)
 Wraps an already existing Spec_s structure in a Ruby class.
void Init_spec (void)
 Initializes the Ruby class.

Variables

VALUE specClass
 The Ruby class representation of the Spec_s structure and methods.

Detailed Description

Ruby bindings for spec file access.

Definition in file spec-rb.c.

Macro Definition Documentation

#define _GNU_SOURCE

Definition at line 17 of file spec-rb.c.

#define _RPMFI_INTERNAL

Definition at line 22 of file spec-rb.c.

#define _RPMTS_INTERNAL

Definition at line 21 of file spec-rb.c.

Function Documentation

static void _spec_free ( Spec  spec)
static

C destructor for the Spec class.

Definition at line 38 of file spec-rb.c.

References freeSpec().

Referenced by spec_wrap().

static VALUE _spec_get_sources ( VALUE  self,
int  flags 
)
static

A helper routine that returns a Ruby array containing all sources that match a specific set of OR'ed flags.

Definition at line 73 of file spec-rb.c.

References _spec_get_spec(), Source::flags, Source::fullSource, Source::next, and Spec_s::sources.

Referenced by spec_get_patches(), and spec_get_sources().

static Spec _spec_get_spec ( VALUE  self)
static

Returns the wrapped Spec structure.

Definition at line 48 of file spec-rb.c.

Referenced by _spec_get_sources(), spec_build(), spec_get_macros(), and spec_get_packages().

static rpmts _spec_get_ts ( VALUE  self)
static

Returns the hiddenly associated transaction set.

Definition at line 60 of file spec-rb.c.

Referenced by spec_build().

void Init_spec ( void  )

Initializes the Ruby class.

Definition at line 217 of file spec-rb.c.

References rpmModule, spec_build(), spec_get_macros(), spec_get_packages(), spec_get_patches(), spec_get_sources(), and specClass.

Referenced by Init_rpm().

static VALUE spec_build ( VALUE  argc,
VALUE *  argv,
VALUE  self 
)
static

Builds a part of the spec file.

This method will call buildSpec() to build parts of the spec file. Its mode of operation is determined by the constants in rpmBuildFlags_e, which are mapped in the RPM Ruby module. Will throw an exception if the build fails.

call-seq: RPM::Spec::build(flags, test = false) -> RPM::Spec

Parameters
flagsA combination of flags that control the build.
testIf set to true, the scriptlets won't actually be run.
Returns
The RPM::Spec instance
See Also
buildSpec, rpmBuildFlags_e

Definition at line 176 of file spec-rb.c.

References _spec_get_spec(), _spec_get_ts(), buildSpec(), and rpm_rb_raise().

Referenced by Init_spec().

static VALUE spec_get_macros ( VALUE  self)
static

Returns the macro context of the spec file.

call-seq: RPM::Spec::macros -> RPM::Mc

Returns
The macro context associated with the spec file.

Definition at line 153 of file spec-rb.c.

References _spec_get_spec(), Spec_s::macros, and rpmmc_wrap().

Referenced by Init_spec().

static VALUE spec_get_packages ( VALUE  self)
static

Returns all packages associated with the spec file.

This returns all packages that are the result of the spec file would it be built. It serves as a factory method creating RPM::Package classes.

call-seq: RPM::Spec::packages -> Array

Returns
An array of all packages
See Also
packageClass

Definition at line 131 of file spec-rb.c.

References _spec_get_spec(), Package_s::next, packageClass, and Spec_s::packages.

Referenced by Init_spec().

static VALUE spec_get_patches ( VALUE  self)
static

Returns an array of all patches defined in the spec file.

call-seq: RPM::Spec::patches -> Array

Returns
An array containing the full name of all patch URIs

Definition at line 112 of file spec-rb.c.

References _spec_get_sources(), and RPMFILE_PATCH.

Referenced by Init_spec().

static VALUE spec_get_sources ( VALUE  self)
static

Returns an array of all sources defined in the spec file.

call-seq: RPM::Spec::sources -> Array

Returns
An array containing the full name of all source URIs

Definition at line 97 of file spec-rb.c.

References _spec_get_sources(), and RPMFILE_SOURCE.

Referenced by Init_spec().

VALUE spec_wrap ( Spec  spec)

Wraps an already existing Spec_s structure in a Ruby class.

Definition at line 210 of file spec-rb.c.

References _spec_free(), and specClass.

Referenced by rpmts_parse_spec().

Variable Documentation

VALUE specClass

The Ruby class representation of the Spec_s structure and methods.

This is the RPM::Spec class. It is generated from an existing transaction set via RPM::Ts::parse_spec. Instances of RPM::Spec provide access to information about the spec file itself (such as a list of sources and patches, or access to the macro context associated with the spec file), and also allow building the spec file.

Raise exceptions on build failures.

Definition at line 31 of file spec-rb.c.

Referenced by Init_spec(), and spec_wrap().