RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Olivier Thauvin
  Root:   /v/rpm/cvs                       Email:  [EMAIL PROTECTED]
  Module: rpm                              Date:   07-Aug-2007 02:10:00
  Branch: HEAD                             Handle: 2007080701095801

  Added files:
    rpm/perl                RPM_Dependencies.xs RPM_Files.xs RPM_Spec.xs
    rpm/perl/RPM            Dependencies.pm Files.pm Spec.pm
    rpm/perl/t              07.files.t 08.dependencies.t 09.spec.t
  Modified files:
    rpm                     Makefile.am
    rpm/perl                Makefile.PL.in Makefile.am RPM.xs rpmxs.c rpmxs.h
                            typemap
    rpm/perl/t              00.pod.coverage.t

  Log:
    - add Spec, rpmfi, rpmds object binding to perl modules

  Summary:
    Revision    Changes     Path
    2.208       +4  -1      rpm/Makefile.am
    1.13        +3  -0      rpm/perl/Makefile.PL.in
    1.17        +3  -0      rpm/perl/Makefile.am
    1.20        +3  -0      rpm/perl/RPM.xs
    1.1         +33 -0      rpm/perl/RPM/Dependencies.pm
    1.1         +33 -0      rpm/perl/RPM/Files.pm
    1.1         +34 -0      rpm/perl/RPM/Spec.pm
    1.1         +294 -0     rpm/perl/RPM_Dependencies.xs
    1.1         +213 -0     rpm/perl/RPM_Files.xs
    1.1         +253 -0     rpm/perl/RPM_Spec.xs
    1.3         +95 -0      rpm/perl/rpmxs.c
    1.4         +13 -0      rpm/perl/rpmxs.h
    1.4         +7  -1      rpm/perl/t/00.pod.coverage.t
    1.1         +6  -0      rpm/perl/t/07.files.t
    1.1         +6  -0      rpm/perl/t/08.dependencies.t
    1.1         +6  -0      rpm/perl/t/09.spec.t
    1.10        +33 -0      rpm/perl/typemap
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/Makefile.am
  ============================================================================
  $ cvs diff -u -r2.207 -r2.208 Makefile.am
  --- rpm/Makefile.am   6 Aug 2007 16:00:53 -0000       2.207
  +++ rpm/Makefile.am   7 Aug 2007 00:09:58 -0000       2.208
  @@ -15,7 +15,7 @@
        zlib/Makefile.in zlib/configure zlib/stamp-h.in \
       perl/typemap \
        perl/Makefile.PL.in \
  -     perl/00.pot.t perl/00.pod.coverage.t \
  +     perl/t/00.pod.t perl/t/00.pod.coverage.t \
        perl/rpmxs.c perl/rpmxs.h \
        perl/RPM.xs perl/RPM.pm perl/t/01.rpm.t \
        perl/RPM/Constant.pm perl/RPM_Constant.xs perl/t/02.rpmconstant.t \
  @@ -23,6 +23,9 @@
        perl/RPM_Transaction.xs perl/RPM/Transaction.pm perl/t/04.transaction.t 
\
        perl/RPM_PackageIterator.xs perl/RPM/PackageIterator.pm 
perl/t/05.packageiterator.t \
        perl/RPM_Problems.xs perl/RPM/Problems.pm perl/t/06.problems.t \
  +     perl/RPM_Files.xs perl/RPM/Files.pm perl/t/07.files.t \
  +     perl/RPM_Dependencies.xs perl/RPM/Dependencies.pm 
perl/t/08.dependencies.t \
  +     perl/RPM_Spec.xs perl/RPM/Spec.pm perl/t/09.spec.t \
        perl/hdlist-test.hdr perl/test-rpm-1.0-1.noarch.rpm 
perl/test-rpm-1.0-1.src.rpm \
        perl/META.yml perl/Makefile.PL.in perl/Makefile.am perl/Makefile.in \
        perl/README \
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/perl/Makefile.PL.in
  ============================================================================
  $ cvs diff -u -r1.12 -r1.13 Makefile.PL.in
  --- rpm/perl/Makefile.PL.in   6 Aug 2007 13:26:14 -0000       1.12
  +++ rpm/perl/Makefile.PL.in   7 Aug 2007 00:09:58 -0000       1.13
  @@ -15,6 +15,9 @@
       RPM_Transaction.o
       RPM_PackageIterator.o
       RPM_Problems.o
  +    RPM_Spec.o
  +    RPM_Files.o
  +    RPM_Dependencies.o
   );
   
   WriteMakefile(
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/perl/Makefile.am
  ============================================================================
  $ cvs diff -u -r1.16 -r1.17 Makefile.am
  --- rpm/perl/Makefile.am      6 Aug 2007 16:00:53 -0000       1.16
  +++ rpm/perl/Makefile.am      7 Aug 2007 00:09:58 -0000       1.17
  @@ -12,6 +12,9 @@
        RPM_Transaction.xs RPM/Transaction.pm t/04.transaction.t \
        RPM_PackageIterator.xs RPM/PackageIterator.pm t/05.packageiterator.t \
        RPM_Problems.xs RPM/Problems.pm t/06.problems.t \
  +     RPM_Files.xs RPM/Files.pm t/07.files.t \
  +     RPM_Dependencies.xs RPM/Dependencies.pm t/08.dependencies.t \
  +     RPM_Spec.xs RPM/Spec.pm t/09.spec.t \
        t/00.pod.coverage.t t/00.pod.t \
        hdlist-test.hdr test-rpm-1.0-1.noarch.rpm test-rpm-1.0-1.src.rpm
   
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/perl/RPM.xs
  ============================================================================
  $ cvs diff -u -r1.19 -r1.20 RPM.xs
  --- rpm/perl/RPM.xs   6 Aug 2007 13:26:14 -0000       1.19
  +++ rpm/perl/RPM.xs   7 Aug 2007 00:09:58 -0000       1.20
  @@ -50,6 +50,9 @@
       crutch_stack_wrap(boot_RPM__Transaction(aTHX_ cv));
       crutch_stack_wrap(boot_RPM__PackageIterator(aTHX_ cv));
       crutch_stack_wrap(boot_RPM__Problems(aTHX_ cv));
  +    crutch_stack_wrap(boot_RPM__Files(aTHX_ cv));
  +    crutch_stack_wrap(boot_RPM__Dependencies(aTHX_ cv)); 
  +    crutch_stack_wrap(boot_RPM__Spec(aTHX_ cv));
   #if DYING
       {
        HV *header_tags, *constants; */
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/perl/RPM/Dependencies.pm
  ============================================================================
  $ cvs diff -u -r0 -r1.1 Dependencies.pm
  --- /dev/null 2007-08-07 02:01:01 +0200
  +++ Dependencies.pm   2007-08-07 02:09:59 +0200
  @@ -0,0 +1,33 @@
  +package RPM::Dependencies;
  +
  +use strict;
  +use RPM;
  +
  +
  +=head1 NAME
  +
  +RPM::Dependencies
  +
  +=head1 DESCRIPTION
  +
  +=head1 SYNOPSIS
  +
  +=head1 FUNCTIONS
  +
  +=cut
  +
  +# currently everything is in the XS code
  +
  +1;
  +
  +__END__
  +
  +=head1 AUTHOR
  +
  +Olivier Thauvin <[EMAIL PROTECTED]>
  +
  +=head1 LICENSE
  +
  +This software is under GPL, refer to rpm license for details.
  +
  +=cut
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/perl/RPM/Files.pm
  ============================================================================
  $ cvs diff -u -r0 -r1.1 Files.pm
  --- /dev/null 2007-08-07 02:01:01 +0200
  +++ Files.pm  2007-08-07 02:09:59 +0200
  @@ -0,0 +1,33 @@
  +package RPM::Files;
  +
  +use strict;
  +use Exporter;
  +use RPM;
  +
  +=head1 NAME
  +
  +RPM::Files
  +
  +=head1 DESCRIPTION
  +
  +=head1 SYNOPSIS
  +
  +=head1 FUNCTIONS
  +
  +=cut
  +
  +# currently everything is in the XS code
  +
  +1;
  +
  +__END__
  +
  +=head1 AUTHOR
  +
  +Olivier Thauvin <[EMAIL PROTECTED]>
  +
  +=head1 LICENSE
  +
  +This software is under GPL, refer to rpm license for details.
  +
  +=cut
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/perl/RPM/Spec.pm
  ============================================================================
  $ cvs diff -u -r0 -r1.1 Spec.pm
  --- /dev/null 2007-08-07 02:01:01 +0200
  +++ Spec.pm   2007-08-07 02:09:59 +0200
  @@ -0,0 +1,34 @@
  +package RPM::Spec;
  +
  +use strict;
  +use Exporter;
  +use RPM;
  +
  +
  +=head1 NAME
  +
  +RPM::Dependencies
  +
  +=head1 DESCRIPTION
  +
  +=head1 SYNOPSIS
  +
  +=head1 FUNCTIONS
  +
  +=cut
  +
  +# currently everything is in the XS code
  +
  +1;
  +
  +__END__
  +
  +=head1 AUTHOR
  +
  +Olivier Thauvin <[EMAIL PROTECTED]>
  +
  +=head1 LICENSE
  +
  +This software is under GPL, refer to rpm license for details.
  +
  +=cut
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/perl/RPM_Dependencies.xs
  ============================================================================
  $ cvs diff -u -r0 -r1.1 RPM_Dependencies.xs
  --- /dev/null 2007-08-07 02:01:01 +0200
  +++ RPM_Dependencies.xs       2007-08-07 02:09:59 +0200
  @@ -0,0 +1,294 @@
  +#include "EXTERN.h"
  +#include "perl.h"
  +#include "XSUB.h"
  +
  +#undef Fflush
  +#undef Mkdir
  +#undef Stat
  +
  +#define _RPMEVR_INTERNAL
  +#include "rpmlib.h"
  +#include "rpmds.h"
  +#include "rpmevr.h"
  +
  +#include "rpmxs.h"
  +
  +#define sv2sens(sv) sv2senseflags(sv)
  +
  +#define sv2senseflags(sv) sv2constant((sv), "rpmsenseflags")
  +
  +#define sv2deptag(sv) sv2constant((sv), "rpmtag")
  +
  +void _newdep(SV * sv_deptag, char * name, SV * sv_sense, SV * sv_evr) {
  +    rpmTag deptag = 0;
  +    rpmsenseFlags sense = RPMSENSE_ANY;
  +    rpmds Dep;
  +    char * evr = NULL;
  +    dSP;
  +
  +    if (sv_deptag && SvOK(sv_deptag))
  +        deptag = sv2deptag(sv_deptag);
  +    if (sv_sense && SvOK(sv_sense))
  +        sense = sv2sens(sv_sense);
  +    if (sv_evr && SvOK(sv_evr))
  +        evr = SvPV_nolen(sv_evr);
  +    Dep = rpmdsSingle(deptag, 
  +        name,
  +        evr ? evr : "", sense);
  +    if (Dep) {
  +        XPUSHs(sv_2mortal(sv_setref_pv(newSVpv("", 0), "RPM::Dependencies", 
Dep)));
  +    }
  +    PUTBACK;
  +}
  +
  +MODULE = RPM::Dependencies           PACKAGE = RPM::Dependencies
  +
  +PROTOTYPES: ENABLE
  +
  +void
  +newsingle(perlclass, sv_tag, name, sv_sense = NULL, sv_evr = NULL)
  +    char * perlclass
  +    SV * sv_tag
  +    char * name
  +    SV * sv_sense
  +    SV * sv_evr
  +    PPCODE:
  +    PUTBACK;
  +    _newdep(sv_tag, name, sv_sense, sv_evr);
  +    SPAGAIN;
  +
  +void
  +DESTROY(Dep)
  +    rpmds Dep
  +    CODE:
  +#ifdef HDRPMMEM
  +    PRINTF_FREE(bless_rpmds, Dep, Dep->nrefs);
  +#endif
  +    Dep = rpmdsFree(Dep);
  +
  +int 
  +count(Dep)
  +    rpmds Dep
  +    CODE:
  +    RETVAL = rpmdsCount(Dep);
  +    OUTPUT:
  +    RETVAL
  +
  +int
  +move(Dep, index = 0)
  +    rpmds Dep
  +    int index
  +    CODE:
  +    if (index == -1) /* -1 do nothing and give actual index */
  +        RETVAL = rpmdsIx(Dep);
  +    else
  +        RETVAL = rpmdsSetIx(Dep, index);
  +    OUTPUT:
  +    RETVAL
  +
  +void
  +init(Dep)
  +    rpmds Dep
  +    CODE:
  +#ifdef HDLISTDEBUG
  +    PRINTF_CALL;
  +#endif
  +    rpmdsInit(Dep);
  +        
  +int
  +next(Dep)
  +    rpmds Dep
  +    CODE:
  +#ifdef HDLISTDEBUG
  +    PRINTF_CALL;
  +#endif
  +     RETVAL = rpmdsNext(Dep);
  +    OUTPUT:
  +    RETVAL
  +
  +int
  +hasnext(Dep)
  +    rpmds Dep
  +    CODE:
  +    RETVAL = rpmdsNext(Dep) > -1;
  +    OUTPUT:
  +    RETVAL
  +        
  +int
  +color(Dep)
  +    rpmds Dep
  +    CODE:
  +    RETVAL = rpmdsColor(Dep);
  +    OUTPUT:
  +    RETVAL
  +        
  +int
  +find(Dep, depb)
  +    rpmds Dep
  +    rpmds depb
  +    CODE:
  +    RETVAL = rpmdsFind(Dep, depb);
  +    OUTPUT:
  +    RETVAL
  +
  +int
  +merge(Dep, depb)
  +    rpmds Dep
  +    rpmds depb
  +    CODE:
  +    RETVAL = rpmdsMerge(&Dep, depb);
  +    OUTPUT:
  +    RETVAL
  +        
  +int
  +overlap(Dep1, Dep2)
  +    rpmds Dep1
  +    rpmds Dep2
  +    CODE:
  +    CHECK_RPMDS_IX(Dep1);
  +    CHECK_RPMDS_IX(Dep2);
  +    RETVAL = rpmdsCompare(Dep1, Dep2);
  +    OUTPUT:
  +    RETVAL
  +
  +void
  +info(Dep)
  +    rpmds Dep
  +    PREINIT:
  +    rpmsenseFlags flag;
  +    I32 gimme = GIMME_V;
  +    PPCODE:
  +#ifdef HDLISTDEBUG
  +    PRINTF_CALL;
  +#endif
  +    CHECK_RPMDS_IX(Dep);
  +    if (gimme == G_SCALAR) {
  +        XPUSHs(sv_2mortal(newSVpv(rpmdsDNEVR(Dep), 0)));
  +    } else {
  +        switch (rpmdsTagN(Dep)) {
  +            case RPMTAG_PROVIDENAME:
  +                XPUSHs(sv_2mortal(newSVpv("P", 0)));
  +            break;
  +            case RPMTAG_REQUIRENAME:
  +                XPUSHs(sv_2mortal(newSVpv("R", 0)));
  +            break;
  +            case RPMTAG_CONFLICTNAME:
  +                XPUSHs(sv_2mortal(newSVpv("C", 0)));
  +            break;
  +            case RPMTAG_OBSOLETENAME:
  +                XPUSHs(sv_2mortal(newSVpv("O", 0)));
  +            break;
  +            case RPMTAG_TRIGGERNAME:
  +                XPUSHs(sv_2mortal(newSVpv("T", 0)));
  +            break;
  +            default:
  +            break;
  +        }
  +        XPUSHs(sv_2mortal(newSVpv(rpmdsN(Dep), 0)));
  +        flag = rpmdsFlags(Dep);
  +        XPUSHs(sv_2mortal(newSVpvf("%s%s%s",
  +                        flag & RPMSENSE_LESS ? "<" : "",
  +                        flag & RPMSENSE_GREATER ? ">" : "",
  +                        flag & RPMSENSE_EQUAL ? "=" : "")));
  +        XPUSHs(sv_2mortal(newSVpv(rpmdsEVR(Dep), 0)));
  +    }
  +
  +void
  +tag(Dep)
  +    rpmds Dep
  +    PPCODE:
  +    XPUSHs(sv_2mortal(newSViv(rpmdsTagN(Dep))));
  +    
  +void
  +name(Dep)
  +    rpmds Dep
  +    PPCODE:
  +#ifdef HDLISTDEBUG
  +    PRINTF_CALL;
  +#endif
  +    CHECK_RPMDS_IX(Dep);
  +    XPUSHs(sv_2mortal(newSVpv(rpmdsN(Dep), 0)));
  +
  +void
  +flags(Dep)
  +    rpmds Dep
  +    PPCODE:
  +    CHECK_RPMDS_IX(Dep);
  +    XPUSHs(sv_2mortal(newSViv(rpmdsFlags(Dep))));
  +
  +void
  +evr(Dep)
  +    rpmds Dep
  +    PPCODE:
  +    CHECK_RPMDS_IX(Dep);
  +    XPUSHs(sv_2mortal(newSVpv(rpmdsEVR(Dep), 0)));
  +
  +int
  +nopromote(Dep, sv_nopromote = NULL)
  +    rpmds Dep
  +    SV * sv_nopromote
  +    CODE:
  +    if (sv_nopromote == NULL) {
  +        RETVAL = rpmdsNoPromote(Dep);
  +    } else {
  +        RETVAL = rpmdsSetNoPromote(Dep, SvIV(sv_nopromote));
  +    }
  +    OUTPUT:
  +    RETVAL
  +    
  +    
  +int
  +add(Dep, name,  sv_sense = NULL, sv_evr = NULL)
  +    rpmds Dep
  +    char * name
  +    SV * sv_evr
  +    SV * sv_sense
  +    PREINIT:
  +    rpmsenseFlags sense = RPMSENSE_ANY;
  +    rpmds Deptoadd;
  +    char * evr = NULL;
  +    CODE:
  +    RETVAL = 0;
  +    if (sv_sense && SvOK(sv_sense))
  +        sense = sv2sens(sv_sense);
  +    if (sv_evr && SvOK(sv_evr))
  +        evr = SvPV_nolen(sv_evr);
  +    Deptoadd = rpmdsSingle(rpmdsTagN(Dep), name,
  +         evr ? evr : "", sense);
  +    if (Deptoadd) {
  +        rpmdsMerge(&Dep, Deptoadd);
  +        Deptoadd = rpmdsFree(Deptoadd);
  +        RETVAL = 1;
  +    }
  +    OUTPUT:
  +    RETVAL
  +        
  +int
  +matchheader(Dep, header, sv_nopromote = NULL)
  +    Header header
  +    SV * sv_nopromote
  +    rpmds Dep
  +    PREINIT:
  +    int nopromote = 0;
  +    CODE:
  +    if (sv_nopromote != NULL)
  +        nopromote = SvIV(sv_nopromote);    
  +    RETVAL = _header_vs_dep(header, Dep, nopromote);
  +    OUTPUT:
  +    RETVAL
  +
  +int
  +matchheadername(Dep, header, sv_nopromote = NULL)
  +    rpmds Dep
  +    Header header
  +    SV * sv_nopromote
  +    PREINIT:
  +    int nopromote = 0;
  +    CODE:
  +    if (sv_nopromote != NULL)
  +        nopromote = SvIV(sv_nopromote);
  +    RETVAL = _headername_vs_dep(header, Dep, nopromote);
  +    OUTPUT:
  +    RETVAL
  +        
  +
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/perl/RPM_Files.xs
  ============================================================================
  $ cvs diff -u -r0 -r1.1 RPM_Files.xs
  --- /dev/null 2007-08-07 02:01:01 +0200
  +++ RPM_Files.xs      2007-08-07 02:09:59 +0200
  @@ -0,0 +1,213 @@
  +#include "EXTERN.h"
  +#include "perl.h"
  +#include "XSUB.h"
  +
  +#undef Fflush
  +#undef Mkdir
  +#undef Stat
  +
  +#include "rpmlib.h"
  +#include "rpmfi.h"
  +#include "rpmio_internal.h"
  +#include "rpmpgp.h"
  +
  +MODULE = RPM::Files          PACKAGE = RPM::Files
  +
  +PROTOTYPES: ENABLE
  +
  +void
  +DESTROY(Files)
  +    rpmfi Files
  +    PPCODE:
  +    Files = rpmfiFree(Files);
  +
  +int
  +compare(Files, Fb)
  +    rpmfi Files
  +    rpmfi Fb
  +    CODE:
  +    RETVAL = rpmfiCompare(Files, Fb);
  +    OUTPUT:
  +    RETVAL
  +
  +int
  +move(Files, index = 0)
  +    rpmfi Files;
  +    int index
  +    PREINIT:
  +    int i;
  +    CODE:
  +    index ++; /* keeping same behaviour than Header::Dep */
  +    rpmfiInit(Files, 0);
  +    RETVAL = 0;
  +    for (i=-1; i < index && (RETVAL = rpmfiNext(Files)) >= 0; i++) {}
  +    if (RETVAL == -1) {
  +        rpmfiInit(Files, 0);
  +        rpmfiNext(Files);
  +    }
  +    OUTPUT:
  +    RETVAL
  +
  +int
  +count(Files)
  +    rpmfi Files
  +    CODE:
  +    RETVAL = rpmfiFC(Files);
  +    OUTPUT:
  +    RETVAL
  +
  +int
  +countdir(Files)
  +    rpmfi Files
  +    CODE:
  +    RETVAL = rpmfiDC(Files);
  +    OUTPUT:
  +    RETVAL
  +
  +void
  +init(Files)
  +    rpmfi Files
  +    CODE:
  +    rpmfiInit(Files, 0);
  +        
  +void
  +initdir(Files)
  +    rpmfi Files
  +    CODE:
  +    rpmfiInitD(Files, 0);
  +
  +int
  +next(Files)
  +    rpmfi Files
  +    CODE:
  +    RETVAL = rpmfiNext(Files);
  +    OUTPUT:
  +    RETVAL
  +
  +int
  +hasnext(Files)
  +    rpmfi Files
  +    CODE:
  +    RETVAL = rpmfiNext(Files) > -1;
  +    OUTPUT:
  +    RETVAL
  +        
  +int
  +nextdir(Files)
  +    rpmfi Files
  +    CODE:
  +    RETVAL = rpmfiNextD(Files);
  +    OUTPUT:
  +    RETVAL
  +
  +void
  +filename(Files)
  +    rpmfi Files
  +    PPCODE:
  +    XPUSHs(sv_2mortal(newSVpv(rpmfiFN(Files), 0)));
  +
  +void
  +dirname(Files)
  +    rpmfi Files
  +    PPCODE:
  +    XPUSHs(sv_2mortal(newSVpv(rpmfiDN(Files), 0)));
  +
  +void
  +basename(Files)
  +    rpmfi Files
  +    PPCODE:
  +    XPUSHs(sv_2mortal(newSVpv(rpmfiBN(Files), 0)));
  +
  +void
  +fflags(Files)
  +    rpmfi Files
  +    PPCODE:
  +    XPUSHs(sv_2mortal(newSViv(rpmfiFFlags(Files))));
  +
  +void
  +mode(Files)
  +    rpmfi Files
  +    PPCODE:
  +    XPUSHs(sv_2mortal(newSVuv(rpmfiFMode(Files))));
  +
  +void
  +md5(Files)
  +    rpmfi Files
  +    PREINIT:
  +    const byte * md5;
  +    char * fmd5 = malloc((char) 33);
  +    PPCODE:
  +    if ((md5 = rpmfiDigest(Files, NULL, NULL)) != NULL && 
  +        *md5 != 0 /* return undef if empty */) {
  +        (void) pgpHexCvt(fmd5, md5, 16);
  +        XPUSHs(sv_2mortal(newSVpv(fmd5, 0)));
  +    }
  +    _free(fmd5);
  +
  +void
  +link(Files)
  +    rpmfi Files
  +    PREINIT:
  +    const char * link;
  +    PPCODE:
  +    if ((link = rpmfiFLink(Files)) != NULL && *link != 0 /* return undef if 
empty */) {
  +        XPUSHs(sv_2mortal(newSVpv(link, 0)));
  +    }
  +
  +void
  +user(Files)
  +    rpmfi Files
  +    PPCODE:
  +    XPUSHs(sv_2mortal(newSVpv(rpmfiFUser(Files), 0)));
  +
  +void
  +group(Files)
  +    rpmfi Files
  +    PPCODE:
  +    XPUSHs(sv_2mortal(newSVpv(rpmfiFGroup(Files), 0)));
  +
  +void
  +inode(Files)
  +    rpmfi Files
  +    PPCODE:
  +    XPUSHs(sv_2mortal(newSViv(rpmfiFInode(Files))));
  +    
  +void
  +size(Files)
  +    rpmfi Files
  +    PPCODE:
  +    XPUSHs(sv_2mortal(newSViv(rpmfiFSize(Files))));
  +
  +void
  +dev(Files)
  +    rpmfi Files
  +    PPCODE:
  +    XPUSHs(sv_2mortal(newSViv(rpmfiFRdev(Files))));
  +
  +void
  +color(Files)
  +    rpmfi Files
  +    PPCODE:
  +    XPUSHs(sv_2mortal(newSViv(rpmfiFColor(Files))));
  +
  +void
  +class(Files)
  +    rpmfi Files
  +    PREINIT:
  +    const char * class;
  +    PPCODE:
  +    if ((class = rpmfiFClass(Files)) != NULL)
  +        XPUSHs(sv_2mortal(newSVpv(rpmfiFClass(Files), 0)));
  +
  +void
  +mtime(Files)
  +    rpmfi Files
  +    PPCODE:
  +    XPUSHs(sv_2mortal(newSViv(rpmfiFMtime(Files))));
  +
  +void
  +nlink(Files)
  +    rpmfi Files
  +    PPCODE:
  +    XPUSHs(sv_2mortal(newSViv(rpmfiFNlink(Files))));
  +
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/perl/RPM_Spec.xs
  ============================================================================
  $ cvs diff -u -r0 -r1.1 RPM_Spec.xs
  --- /dev/null 2007-08-07 02:01:01 +0200
  +++ RPM_Spec.xs       2007-08-07 02:09:59 +0200
  @@ -0,0 +1,253 @@
  +#include "EXTERN.h"
  +#include "perl.h"
  +#include "XSUB.h"
  +
  +#undef Fflush
  +#undef Mkdir
  +#undef Stat
  +
  +#include "rpmlib.h"
  +#include "rpmio.h"
  +#include "rpmcli.h"
  +#include "stringbuf.h"
  +#include "rpmmacro.h"
  +#include "rpmspec.h"
  +#include "rpmbuild.h"
  +#include "rpmts.h"
  +
  +MODULE = RPM::Spec           PACKAGE = RPM::Spec
  +
  +PROTOTYPES: ENABLE
  +
  +void
  +new(perlclass, specfile = NULL, ...)
  +    char * perlclass
  +    char * specfile
  +    PREINIT:
  +    rpmts ts = NULL;
  +    SV * passphrase = NULL;
  +    SV * rootdir = NULL;
  +    SV * cookies = NULL;
  +    SV * anyarch = 0;
  +    SV * force = 0;
  +    SV * verify = 0;
  +    int i;
  +    PPCODE:
  +    for(i=2; i < items; i++) {
  +        if(strcmp(SvPV_nolen(ST(i)), "transaction") == 0) {
  +            i++;
  +            if (sv_isobject(ST(i)) && (SvTYPE(SvRV(ST(i))) == SVt_PVMG)) {
  +                ts = (rpmts)SvIV((SV*)SvRV(ST(i)));
  +                ts = rpmtsLink(ts, "RPM::Spec");  
  +            } else {
  +                croak( "transaction is not a blessed SV reference" );
  +                XSRETURN_UNDEF;
  +            } 
  +        } else if (strcmp(SvPV_nolen(ST(i)), "force") == 0) {
  +            i++;
  +            force = ST(i);
  +        } else if (strcmp(SvPV_nolen(ST(i)), "verify") == 0) {
  +            i++;
  +            verify = ST(i);
  +        } else if (strcmp(SvPV_nolen(ST(i)), "anyarch") == 0) {
  +            i++;
  +            anyarch = ST(i);
  +        } else if (strcmp(SvPV_nolen(ST(i)), "passphrase") == 0) {
  +            i++;
  +            passphrase = ST(i);
  +        } else if (strcmp(SvPV_nolen(ST(i)), "root") == 0) {
  +            i++;
  +            rootdir = ST(i);
  +        } else {
  +            warn("Unknown value in " "RPM::Spec" "->new, ignored");
  +            i++;
  +        }
  +    }
  +    if (!ts)
  +        ts = rpmtsCreate();
  +    PUTBACK;
  +    _newspec(ts, specfile, passphrase, rootdir, cookies, anyarch, force, 
verify);
  +    SPAGAIN;
  +    ts = rpmtsFree(ts);
  +    
  +void
  +DESTROY(spec)
  +    Spec spec
  +    CODE:
  +#ifdef HDRPMMEM
  +    PRINTF_FREE("RPM::Spec", spec, -1);
  +#endif
  +    freeSpec(spec);
  +
  +void
  +srcheader(spec)
  +    Spec spec
  +    PPCODE:
  +    if ( ! spec->sourceHeader) 
  +        initSourceHeader(spec, NULL); /* TODO NULL => @retval *sfp     srpm 
file list (may be NULL) */
  +    XPUSHs(sv_2mortal(sv_setref_pv(newSVpv("", 0), "RPM::Header", (void 
*)headerLink(spec->sourceHeader))));
  +
  +void
  +binheader(spec)
  +    Spec spec
  +    PREINIT:
  +    Package pkg;
  +    PPCODE:
  +    for (pkg = spec->packages; pkg != NULL; pkg = pkg->next)
  +        XPUSHs(sv_2mortal(sv_setref_pv(newSVpv("", 0), "RPM::Header", (void 
*)headerLink(pkg->header))));
  +    
  +void
  +srcrpm(spec)
  +    Spec spec
  +    PREINIT:
  +    const char *name, *version, *release;
  +    PPCODE:
  +    (void) headerNVR(spec->packages->header, &name, &version, &release);
  +    XPUSHs(sv_2mortal(newSVpvf("%s/%s-%s-%s.%ssrc.rpm",
  +        rpmGetPath("%{_srcrpmdir}", NULL),
  +        name, version, release,
  +        spec->noSource ? "no" : ""
  +        )));
  +    headerFreeTag(spec->packages->header, name, RPM_STRING_TYPE);
  +    headerFreeTag(spec->packages->header, version, RPM_STRING_TYPE);
  +    headerFreeTag(spec->packages->header, release, RPM_STRING_TYPE);
  +
  +void
  +binrpm(spec)
  +    Spec spec
  +    PREINIT:
  +    Package pkg;
  +    const char * binFormat;
  +    char * binRpm;
  +    char * path;
  +    PPCODE:
  +    for(pkg = spec->packages; pkg != NULL; pkg = pkg->next) {
  +        if (pkg->fileList == NULL)
  +            continue;
  +        /* headerCopyTags(h, pkg->header, copyTags); */
  +        binFormat = rpmGetPath("%{_rpmfilename}", NULL);
  +        binRpm = headerSprintf(pkg->header, binFormat, rpmTagTable,
  +                   rpmHeaderFormats, NULL);
  +        _free(binFormat);
  +        path = rpmGetPath("%{_rpmdir}/", binRpm, NULL);
  +        XPUSHs(sv_2mortal(newSVpv(path, 0)));
  +        _free(path);
  +        _free(binRpm);
  +    }
  +
  +void
  +check(spec, ts = NULL)
  +    Spec spec
  +    PREINIT:
  +    int rc;
  +    rpmts ts = rpmtsCreate();
  +    rpmps ps;
  +    PPCODE:
  +    PUTBACK;
  +    if (ts)
  +        ts = rpmtsLink(ts, "Spec_check");
  +    else
  +        ts = rpmtsCreate();
  +
  +    if ( ! spec->sourceHeader) 
  +        initSourceHeader(spec, NULL); /* TODO NULL => @retval *sfp     srpm 
file list (may be NULL) */
  +
  +    if (!headerIsEntry(spec->sourceHeader, RPMTAG_REQUIRENAME)
  +     && !headerIsEntry(spec->sourceHeader, RPMTAG_CONFLICTNAME))
  +        /* XSRETURN_UNDEF; */
  +        return;
  +
  +    (void) rpmtsAddInstallElement(ts, spec->sourceHeader, NULL, 0, NULL);
  +
  +    if(rpmtsCheck(ts))
  +        croak("Can't check rpmts"); /* any better idea ? */
  +
  +    ps = rpmtsProblems(ts);
  +    if (ps &&  rpmpsNumProblems(ps)) /* if no problem, return undef */
  +        XPUSHs(sv_2mortal(sv_setref_pv(newSVpv("", 0), "RPM::Dependencies", 
ps)));
  +    ts = rpmtsFree(ts);
  +    SPAGAIN;
  +    
  +    
  +int
  +build(spec, sv_buildflags)
  +    Spec spec
  +    SV * sv_buildflags
  +    PREINIT:
  +    rpmts ts = rpmtsCreate();
  +    CODE:
  +    RETVAL = _specbuild(ts, spec, sv_buildflags);
  +    ts = rpmtsFree(ts);
  +    OUTPUT:
  +    RETVAL
  +
  +const char *
  +specfile(spec)
  +    Spec spec
  +    CODE:
  +    RETVAL = spec->specFile;
  +    OUTPUT:
  +    RETVAL
  +        
  +void
  +sources(spec, is = 0)
  +    Spec spec
  +    int is
  +    PREINIT:
  +    struct Source *srcPtr;
  +    PPCODE:
  +    for (srcPtr = spec->sources; srcPtr != NULL; srcPtr = srcPtr->next) {
  +        if (is && !(srcPtr->flags & is))
  +            continue;
  +        XPUSHs(sv_2mortal(newSVpv(srcPtr->source, 0)));
  +    }
  +
  +void
  +sources_url(spec, is = 0)
  +    Spec spec
  +    int is
  +    PREINIT:
  +    struct Source * srcPtr;
  +    PPCODE:
  +    for (srcPtr = spec->sources; srcPtr != NULL; srcPtr = srcPtr->next) {
  +        if (is && !(srcPtr->flags & is))
  +            continue;
  +        XPUSHs(sv_2mortal(newSVpv(srcPtr->fullSource, 0)));
  +    }
  +
  +void
  +icon(spec)
  +    Spec spec
  +    PREINIT:
  +    Package pkg;
  +    PPCODE:
  +    /* TODO obsoletes ?
  +    for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) {
  +        char * dest = NULL;
  +        int len;
  +        if (!pkg->icon)
  +            continue;
  +        len = strlen(pkg->icon->source);
  +        dest = malloc(len);
  +        memcpy(dest, pkg->icon->source, len);
  +        XPUSHs(sv_2mortal(newSVpv(dest, len)));
  +    } */
  +
  +void
  +icon_url(spec)
  +    Spec spec
  +    PREINIT:
  +    Package pkg;
  +    /* TODO obsoletes ?
  +    PPCODE:
  +    for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) {
  +        char * dest = NULL;
  +        int len;
  +        if (!pkg->icon)
  +            continue;
  +        len = strlen(pkg->icon->fullSource);
  +        dest = malloc(len);
  +        memcpy(dest, pkg->icon->fullSource, len);
  +        XPUSHs(sv_2mortal(newSVpv(dest, len)));
  +    } */
  +
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/perl/rpmxs.c
  ============================================================================
  $ cvs diff -u -r1.2 -r1.3 rpmxs.c
  --- rpm/perl/rpmxs.c  5 Aug 2007 22:12:35 -0000       1.2
  +++ rpm/perl/rpmxs.c  7 Aug 2007 00:09:58 -0000       1.3
  @@ -17,6 +17,8 @@
   #include "rpmio.h"
   #include "rpmconstant.h"
   
  +#include "rpmxs.h"
  +
   static int scalar2constant(SV * svconstant, const char * context, int * val) 
{
       int rc = 0;
       if (!svconstant || !SvOK(svconstant)) {
  @@ -117,3 +119,96 @@
       PUTBACK;
       return;
   }
  +
  +int _headername_vs_dep(Header h, rpmds dep, int nopromote) {
  +    char *name; int type;
  +    int rc = 0;
  +    CHECK_RPMDS_IX(dep);
  +    headerGetEntry(h, RPMTAG_NAME, &type, (void **) &name, NULL);
  +    if (strcmp(name, rpmdsN(dep)) != 0)
  +        rc = 0;
  +    else
  +        rc = rpmdsNVRMatchesDep(h, dep, nopromote);
  +    headerFreeData(name, type);
  +    return rc;
  +    /* return 1 if match */
  +}
  +
  +int _header_vs_dep(Header h, rpmds dep, int nopromote) {
  +    CHECK_RPMDS_IX(dep);
  +    return rpmdsAnyMatchesDep(h, dep, nopromote);
  +    /* return 1 if match */
  +}
  +
  +/* Get a new specfile */
  +void _newspec(rpmts ts, char * filename, SV * svpassphrase, SV * svrootdir, 
SV * svcookies, SV * svanyarch, SV * svforce, SV * svverify) {
  +    Spec spec = NULL;
  +    char * passphrase = NULL;
  +    char * rootdir = NULL;
  +    char * cookies = NULL;
  +    int anyarch = 0;
  +    int force = 0;
  +    int verify = 0;
  +    dSP;
  +
  +    if (svpassphrase && SvOK(svpassphrase))
  +        passphrase = SvPV_nolen(svpassphrase);
  +    
  +    if (svrootdir && SvOK(svrootdir))
  +     rootdir = SvPV_nolen(svrootdir);
  +    else
  +     rootdir = "/";
  +    
  +    if (svcookies && SvOK(svcookies))
  +     cookies = SvPV_nolen(svcookies);
  +
  +    if (svanyarch && SvOK(svanyarch))
  +     anyarch = SvIV(svanyarch);
  +    
  +    if (svforce && SvOK(svforce))
  +     force = SvIV(svforce);
  +    
  +    if (svverify && SvOK(svverify))
  +     verify = SvIV(svverify);
  +    
  +    if (filename) {
  +        if (!parseSpec(ts, filename, rootdir, 0, passphrase, cookies, 
anyarch, force, verify))
  +            spec = rpmtsSetSpec(ts, NULL);
  +#ifdef HHACK
  +    } else {
  +        spec = newSpec();
  +#endif
  +    }
  +    if (spec) {
  +        XPUSHs(sv_2mortal(sv_setref_pv(newSVpv("", 0), "RPM::Spec", (void 
*)spec)));
  +    } else
  +        XPUSHs(sv_2mortal(&PL_sv_undef));
  +    PUTBACK;
  +    return;
  +}
  +
  +/* Building a spec file */
  +int _specbuild(rpmts ts, Spec spec, SV * sv_buildflags) {
  +    rpmBuildFlags buildflags = sv2constant(sv_buildflags, "rpmbuildflags");
  +    if (buildflags == RPMBUILD_NONE) croak("No action given for build");
  +    return buildSpec(ts, spec, buildflags, 0);
  +}
  +
  +void _installsrpms(rpmts ts, char * filename) {
  +    const char * specfile = NULL;
  +    const char * cookies = NULL;
  +    dSP;
  +    I32 gimme = GIMME_V;
  +    if (rpmInstallSource(
  +                ts,
  +                filename,
  +                &specfile,
  +                &cookies) == 0) { 
  +        XPUSHs(sv_2mortal(newSVpv(specfile, 0)));
  +        if (gimme == G_ARRAY)
  +        XPUSHs(sv_2mortal(newSVpv(cookies, 0)));
  +    }
  +    PUTBACK;
  +}
  +
  +
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/perl/rpmxs.h
  ============================================================================
  $ cvs diff -u -r1.3 -r1.4 rpmxs.h
  --- rpm/perl/rpmxs.h  5 Aug 2007 22:12:35 -0000       1.3
  +++ rpm/perl/rpmxs.h  7 Aug 2007 00:09:58 -0000       1.4
  @@ -3,6 +3,9 @@
   #ifndef _HAVE_RPMXS_H_
   #define _HAVE_RPMXS_H_
   
  +#define CHECK_RPMDS_IX(dep) if (rpmdsIx((dep)) < 0) \
  +    croak("You call RPM::Dependencies method after lastest next() of before 
init()")
  +
   /[EMAIL PROTECTED]@*/ /[EMAIL PROTECTED]@*/
   static unsigned char header_magic[8] = {
           0x8e, 0xad, 0xe8, 0x01, 0x00, 0x00, 0x00, 0x00
  @@ -26,4 +29,14 @@
   
   int sv2constant(SV * svconstant, const char * context);
   
  +int _headername_vs_dep(Header h, rpmds dep, int nopromote);
  +
  +int _header_vs_dep(Header h, rpmds dep, int nopromote);
  +
  +int _specbuild(rpmts ts, Spec spec, SV * sv_buildflags);
  +
  +void _installsrpms(rpmts ts, char * filename);
  +
  +void _newspec(rpmts ts, char * filename, SV * svpassphrase, SV * svrootdir, 
SV * svcookies, SV * svanyarch, SV * svforce, SV * svverify);
  +
   #endif
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/perl/t/00.pod.coverage.t
  ============================================================================
  $ cvs diff -u -r1.3 -r1.4 00.pod.coverage.t
  --- rpm/perl/t/00.pod.coverage.t      6 Aug 2007 13:26:15 -0000       1.3
  +++ rpm/perl/t/00.pod.coverage.t      7 Aug 2007 00:09:59 -0000       1.4
  @@ -4,7 +4,7 @@
   eval "use Test::Pod::Coverage";
   plan skip_all => "Test::Pod::Coverage required for testing pod coverage" if 
$@;
   
  -plan tests => 6;
  +plan tests => 9;
   
   SKIP: {
       skip "RPM no yet finished", 1;
  @@ -20,4 +20,10 @@
   pod_coverage_ok( "RPM::PackageIterator", "RPM::PackageIterator is covered" );
   }
   pod_coverage_ok( "RPM::Problems", "RPM::Problems is covered" );
  +SKIP: {
  +        skip "File Dependencies and Spec under works", 3;
  +pod_coverage_ok( "RPM::Files", "RPM::Files is covered" );
  +pod_coverage_ok( "RPM::Dependencies", "RPM::Dependencies is covered" );
  +pod_coverage_ok( "RPM::Spec", "RPM::Spec is covered" );
  +}
   
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/perl/t/07.files.t
  ============================================================================
  $ cvs diff -u -r0 -r1.1 07.files.t
  --- /dev/null 2007-08-07 02:01:01 +0200
  +++ 07.files.t        2007-08-07 02:10:00 +0200
  @@ -0,0 +1,6 @@
  +#!/bin/env perl
  +
  +use strict;
  +use Test::More tests => 1;
  +
  +use_ok('RPM::Files');
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/perl/t/08.dependencies.t
  ============================================================================
  $ cvs diff -u -r0 -r1.1 08.dependencies.t
  --- /dev/null 2007-08-07 02:01:01 +0200
  +++ 08.dependencies.t 2007-08-07 02:10:00 +0200
  @@ -0,0 +1,6 @@
  +#!/bin/env perl
  +
  +use strict;
  +use Test::More tests => 1;
  +
  +use_ok('RPM::Dependencies');
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/perl/t/09.spec.t
  ============================================================================
  $ cvs diff -u -r0 -r1.1 09.spec.t
  --- /dev/null 2007-08-07 02:01:01 +0200
  +++ 09.spec.t 2007-08-07 02:10:00 +0200
  @@ -0,0 +1,6 @@
  +#!/bin/env perl
  +
  +use strict;
  +use Test::More tests => 1;
  +
  +use_ok('RPM::Spec');
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/perl/typemap
  ============================================================================
  $ cvs diff -u -r1.9 -r1.10 typemap
  --- rpm/perl/typemap  6 Aug 2007 13:26:14 -0000       1.9
  +++ rpm/perl/typemap  7 Aug 2007 00:09:58 -0000       1.10
  @@ -4,6 +4,9 @@
   Header              O_OBJECT_header
   rpmts                        O_OBJECT_rpmts
   rpmps               O_OBJECT_rpmps
  +rpmfi               O_OBJECT_rpmfi
  +rpmds               O_OBJECT_rpmds
  +Spec                O_OBJECT_rpmspec
   rpmprobFilterFlags   T_IV
   rpmElementType               T_IV
   
  @@ -48,6 +51,30 @@
           XSRETURN_UNDEF;
       }
   
  +O_OBJECT_rpmfi
  +    if (sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVMG))
  +        $var = ($type)SvIV((SV*)SvRV( $arg ));
  +    else {
  +        warn( \"${Package}::$func_name() -- $var is not a blessed SV 
reference\" );
  +        XSRETURN_UNDEF;
  +    }
  +
  +O_OBJECT_rpmds
  +    if (sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVMG))
  +        $var = ($type)SvIV((SV*)SvRV( $arg ));
  +    else {
  +        warn( \"${Package}::$func_name() -- $var is not a blessed SV 
reference\" );
  +        XSRETURN_UNDEF;
  +    }
  +
  +O_OBJECT_rpmspec
  +    if (sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVMG))
  +        $var = ($type)SvIV((SV*)SvRV( $arg ));
  +    else {
  +        warn( \"${Package}::$func_name() -- $var is not a blessed SV 
reference\" );
  +        XSRETURN_UNDEF;
  +    }
  +
   OUTPUT
   O_OBJECT_rpmdb
           sv_setref_pv( $arg, "RPM::C::DB", (void*)$var );
  @@ -59,3 +86,9 @@
           sv_setref_pv( $arg, "RPM::Transaction", (void*)$var );
   O_OBJECT_rpmps
           sv_setref_pv( $arg, "RPM::Problems", (void*)$var );
  +O_OBJECT_rpmfi
  +        sv_setref_pv( $arg, "RPM::Files", (void*)$var );
  +O_OBJECT_rpmds
  +        sv_setref_pv( $arg, "RPM::Dependencies", (void*)$var );
  +O_OBJECT_rpmspec
  +        sv_setref_pv( $arg, "RPM::Spec", (void*)$var );
  @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                rpm-cvs@rpm5.org

Reply via email to