Class: RPM::Spec
- Inherits:
-
Data
- Object
- Data
- RPM::Spec
- Defined in:
- ext/rpm/spec.c
Class Method Summary (collapse)
-
+ (Spec) new
Create a spec file object from a spec file.
-
+ (Spec) open
Create a spec file object from a spec file.
Instance Method Summary (collapse)
-
- (Number) build
Builds the spec file.
- - (Object) build_restrictions
-
- (Array<String>) buildarchs
Return Build architectures defined in the spec file.
-
- (Array<RPM::Conflict>) buildconflicts
Return Build conflicts defined in the spec file.
-
- (Array<RPM::Require>) buildrequires
Return Build requires defined in the spec file.
-
- (String) buildroot
Return Build root defined in the spec file.
-
- (String) buildsubdir
Return Build subdirectory defined in the spec file.
-
- (String) expand_macros
Expands a macro in the spec file.
-
- (Array<RPM::Package>) packages
Packages defined in the spec file.
-
- (Array<RPM::Source>) sources
Sources defined in the spec file.
Class Method Details
+ (Spec) new
Create a spec file object from a spec file
|
# File 'ext/rpm/spec.c'
static VALUE
spec_s_open(VALUE klass, VALUE filename)
{
#if RPM_VERSION_CODE < RPM_VERSION(4,1,0)
Spec rspec;
#else
rpmts ts = NULL;
#endif
if (TYPE(filename) != T_STRING) {
rb_raise(rb_eTypeError, "illegal argument type");
}
|
+ (Spec) open
Create a spec file object from a spec file
|
# File 'ext/rpm/spec.c'
static VALUE
spec_s_open(VALUE klass, VALUE filename)
{
#if RPM_VERSION_CODE < RPM_VERSION(4,1,0)
Spec rspec;
#else
rpmts ts = NULL;
#endif
if (TYPE(filename) != T_STRING) {
rb_raise(rb_eTypeError, "illegal argument type");
}
|
Instance Method Details
- (Number) build
Builds the spec file
|
# File 'ext/rpm/spec.c'
VALUE
rpm_spec_build(int argc, VALUE* argv, VALUE spec)
{
int flags, test;
rpmRC rc;
switch (argc) {
case 0:
rb_raise(rb_eArgError, "argument too few(1..2)");
case 1:
flags = NUM2INT(argv[0]);
test = 0;
break;
case 2:
flags = NUM2INT(argv[0]);
test = RTEST(argv[1]);
break;
default:
rb_raise(rb_eArgError, "argument too many(0..1)");
}
|
- (Object) build_restrictions
- (Array<String>) buildarchs
Return Build architectures defined in the spec file
|
# File 'ext/rpm/spec.c'
VALUE
rpm_spec_get_buildarchs(VALUE spec)
{
VALUE ba = rb_ivar_get(spec, id_ba);
if (NIL_P(ba)) {
register int i;
ba = rb_ary_new();
for (i = 0; i < RPM_SPEC(spec)->BACount; i++) {
rb_ary_push(ba, rb_str_new2(RPM_SPEC(spec)->BANames[i]));
}
|
- (Array<RPM::Conflict>) buildconflicts
Return Build conflicts defined in the spec file
|
# File 'ext/rpm/spec.c'
VALUE
rpm_spec_get_buildconflicts(VALUE spec)
{
VALUE bc = rb_ivar_get(spec, id_bc);
#if RPM_VERSION_CODE < RPM_VERSION(4,6,0) || RPM_VERSION_CODE >= RPM_VERSION(5,0,0)
if (NIL_P(bc)) {
const char** names;
const char** vers;
int_32* flags;
int_32 count;
rpmTagType nt, vt, type;
register int i;
bc = rb_ary_new();
if (!headerGetEntryMinMemory(RPM_SPEC(spec)->buildRestrictions,
RPMTAG_CONFLICTNAME, (hTYP_t)&nt,
(hPTR_t*)&names, (hCNT_t)&count)) {
goto leave;
}
|
- (Array<RPM::Require>) buildrequires
Return Build requires defined in the spec file
|
# File 'ext/rpm/spec.c'
VALUE
rpm_spec_get_buildrequires(VALUE spec)
{
VALUE br = rb_ivar_get(spec, id_br);
#if RPM_VERSION_CODE < RPM_VERSION(4,6,0) || RPM_VERSION_CODE >= RPM_VERSION(5,0,0)
if (NIL_P(br)) {
const char** names;
const char** vers;
int_32* flags;
int_32 count;
rpmTagType nt, vt, type;
register int i;
br = rb_ary_new();
if (!headerGetEntryMinMemory(RPM_SPEC(spec)->buildRestrictions,
RPMTAG_REQUIRENAME, (hTYP_t)&nt,
(hPTR_t*)&names, (hCNT_t)&count)) {
goto leave;
}
|
- (String) buildroot
Return Build root defined in the spec file
|
# File 'ext/rpm/spec.c'
VALUE
rpm_spec_get_buildroot(VALUE spec)
{
#if RPM_VERSION_CODE < RPM_VERSION(4,5,90)
if (RPM_SPEC(spec)->buildRootURL) {
return rb_str_new2(RPM_SPEC(spec)->buildRootURL);
}
|
- (String) buildsubdir
Return Build subdirectory defined in the spec file
|
# File 'ext/rpm/spec.c'
VALUE
rpm_spec_get_buildsubdir(VALUE spec)
{
if (RPM_SPEC(spec)->buildSubdir) {
return rb_str_new2(RPM_SPEC(spec)->buildSubdir);
}
|
- (String) expand_macros
Expands a macro in the spec file
|
# File 'ext/rpm/spec.c'
VALUE
rpm_spec_expand_macros(VALUE spec, VALUE name)
{
char buf[BUFSIZ];
char* tmp;
VALUE val;
if (TYPE(name) != T_STRING) {
rb_raise(rb_eTypeError, "illegal argument type");
}
|
- (Array<RPM::Package>) packages
Packages defined in the spec file
|
# File 'ext/rpm/spec.c'
VALUE
rpm_spec_get_packages(VALUE spec)
{
VALUE pkg = rb_ivar_get(spec, id_pkg);
if (NIL_P(pkg)) {
Package p = RPM_SPEC(spec)->packages;
pkg = rb_ary_new();
while (p != NULL) {
if (p->fileList)
rb_ary_push(pkg, rpm_package_new_from_header(p->header));
p = p->next;
}
|
- (Array<RPM::Source>) sources
Sources defined in the spec file
|
# File 'ext/rpm/spec.c'
VALUE
rpm_spec_get_sources(VALUE spec)
{
VALUE src = rb_ivar_get(spec, id_src);
if (NIL_P(src)) {
struct Source* s = RPM_SPEC(spec)->sources;
src = rb_ary_new();
while (s != NULL) {
VALUE obj = Qnil;
if (s->flags & RPMBUILD_ISSOURCE) {
obj = rpm_source_new(s->fullSource, s->num, s->flags & RPMBUILD_ISNO);
}
|