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:   14-Aug-2007 02:28:28
  Branch: HEAD                             Handle: 2007081401282701

  Modified files:
    rpm/perl                RPM_Files.xs
    rpm/perl/RPM            Files.pm
    rpm/perl/t              00.pod.coverage.t

  Log:
    - perl RPM::Files update, cleanup and doc

  Summary:
    Revision    Changes     Path
    1.3         +84 -2      rpm/perl/RPM/Files.pm
    1.4         +129 -112   rpm/perl/RPM_Files.xs
    1.7         +1  -1      rpm/perl/t/00.pod.coverage.t
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/perl/RPM/Files.pm
  ============================================================================
  $ cvs diff -u -r1.2 -r1.3 Files.pm
  --- rpm/perl/RPM/Files.pm     9 Aug 2007 16:16:02 -0000       1.2
  +++ rpm/perl/RPM/Files.pm     14 Aug 2007 00:28:27 -0000      1.3
  @@ -1,7 +1,6 @@
   package RPM::Files;
   
   use strict;
  -use Exporter;
   use RPM;
   use RPM::Header;
   
  @@ -20,10 +19,93 @@
   Create a new B<RPM::Files> iterator from $header. $header is a
   L<RPM::Header> object.
   
  -=head2 count
  +=head2 $files->count
   
   Return the count of files inside the iterator.
   
  +=head2 $files->init
  +
  +Prepare the file iterator for first L<next> call
  +
  +=head2 $files->next
  +
  +Jump to next entry and return current internal index. The function return
  +"OEO" instead 0, which is true. Return nothing when last entry is reached.
  +
  +=head2 $files->count_dir
  +
  +Return the number of parent directory.
  +
  +=head2 $files->init_dir
  +
  +Preprare iterator for next_dir first call
  +
  +=head2 $files->next_dir
  +
  +Jump to next entry and return current internal index. The function return
  +"OEO" instead 0, which is true. Return nothing when last entry is reached.
  +
  +=head2 $files->filename
  +
  +Return the current filename
  +
  +=head2 $files->basename
  +
  +Return the current basename
  +
  +=head2 $files->dirname
  +
  +Return the parent directory path of current file
  +
  +=head2 $files->fflags
  +
  +Return the rpm file flags fo current file
  +
  +=head2 $files->mode
  +
  +Return the (unix) mode of current file
  +
  +=head2 $files->digest
  +
  +Return the digest of the file and the id of used algorythm.
  +
  +=head2 $files->link
  +
  +If the current file is a symlink, return the target path.
  +
  +=head2 $files->user
  +
  +Return the owner of the file.
  +
  +=head2 $files->group
  +
  +Return the group owning the file.
  +
  +=head2 $files->inode
  +
  +Return the inode number of the file.
  +
  +=head2 $files->size
  +
  +Return the size of the current file.
  +
  +=head2 $files->dev
  +
  +Return de device ID where the file is located.
  +
  +=head2 $files->color
  +
  +Return de file color of the current file.
  +
  +=head2 $files->class
  +
  +Return the class of the current file, aka the mime type as given
  +by L<file(1)>.
  +
  +=head2 $files->mtime
  +
  +Return the modification time of the current file.
  +
   =cut
   
   # currently everything is in the XS code
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/perl/RPM_Files.xs
  ============================================================================
  $ cvs diff -u -r1.3 -r1.4 RPM_Files.xs
  --- rpm/perl/RPM_Files.xs     10 Aug 2007 19:06:27 -0000      1.3
  +++ rpm/perl/RPM_Files.xs     14 Aug 2007 00:28:27 -0000      1.4
  @@ -6,10 +6,12 @@
   #undef Mkdir
   #undef Stat
   
  +#if 0
   #include "../config.h"
   #ifdef HAVE_BEECRYPT_API_H
   #include <beecrypt/api.h>
   #endif
  +#endif
   
   #include "rpmlib.h"
   #include "rpmfi.h"
  @@ -44,186 +46,201 @@
       OUTPUT:
       RETVAL
   
  -int
  -_compare(Files, Fb)
  +void
  +init(Files)
       rpmfi Files
  -    rpmfi Fb
       CODE:
  -    RETVAL = rpmfiCompare(Files, Fb);
  -    OUTPUT:
  -    RETVAL
  +    rpmfiInit(Files, 0);
   
  -int
  -_move(Files, index = 0)
  -    rpmfi Files;
  -    int index
  +char *
  +next(Files)
  +    rpmfi Files
       PREINIT:
  -    int i;
  +    char val[16];
  +    int idx = 0;
       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);
  +    if ((idx = rpmfiNext(Files)) == -1) {
  +        RETVAL = NULL;
  +    } else {
  +        snprintf(val, 12, idx == 0 ? "%dE0" : "%d", idx);
  +        RETVAL = val;
       }
       OUTPUT:
       RETVAL
   
  -
   int
  -_countdir(Files)
  +count_dir(Files)
       rpmfi Files
       CODE:
       RETVAL = rpmfiDC(Files);
       OUTPUT:
       RETVAL
   
  +
   void
  -_init(Files)
  -    rpmfi Files
  -    CODE:
  -    rpmfiInit(Files, 0);
  -        
  -void
  -_initdir(Files)
  +init_dir(Files)
       rpmfi Files
       CODE:
       rpmfiInitD(Files, 0);
   
  -int
  -_next(Files)
  +char *
  +next_dir(Files)
       rpmfi Files
  +    PREINIT:
  +    char val[16];
  +    int idx = 0;
       CODE:
  -    RETVAL = rpmfiNext(Files);
  +    if ((idx = rpmfiNextD(Files)) == -1) {
  +        RETVAL = NULL;
  +    } else {
  +        snprintf(val, 12, idx == 0 ? "%dE0" : "%d", idx);
  +        RETVAL = val;
  +    }
       OUTPUT:
       RETVAL
   
   int
  -_hasnext(Files)
  +_compare(Files, Fb)
       rpmfi Files
  +    rpmfi Fb
       CODE:
  -    RETVAL = rpmfiNext(Files) > -1;
  +    RETVAL = rpmfiCompare(Files, Fb);
       OUTPUT:
       RETVAL
           
  -int
  -_nextdir(Files)
  +const char *
  +filename(Files)
       rpmfi Files
       CODE:
  -    RETVAL = rpmfiNextD(Files);
  +    RETVAL = rpmfiFN(Files);
       OUTPUT:
       RETVAL
   
  -void
  -_filename(Files)
  +const char *
  +dirname(Files)
       rpmfi Files
  -    PPCODE:
  -    XPUSHs(sv_2mortal(newSVpv(rpmfiFN(Files), 0)));
  -
  -void
  -_dirname(Files)
  -    rpmfi Files
  -    PPCODE:
  -    XPUSHs(sv_2mortal(newSVpv(rpmfiDN(Files), 0)));
  +    CODE:
  +    RETVAL = rpmfiDN(Files);
  +    OUTPUT:
  +    RETVAL
   
  -void
  -_basename(Files)
  +const char *
  +basename(Files)
       rpmfi Files
  -    PPCODE:
  -    XPUSHs(sv_2mortal(newSVpv(rpmfiBN(Files), 0)));
  +    CODE:
  +    RETVAL = rpmfiBN(Files);
  +    OUTPUT:
  +    RETVAL
   
  -void
  -_fflags(Files)
  +unsigned int
  +fflags(Files)
       rpmfi Files
  -    PPCODE:
  -    XPUSHs(sv_2mortal(newSViv(rpmfiFFlags(Files))));
  +    CODE:
  +    RETVAL = rpmfiFFlags(Files);
  +    OUTPUT:
  +    RETVAL
   
  -void
  -_mode(Files)
  +unsigned int
  +mode(Files)
       rpmfi Files
  -    PPCODE:
  -    XPUSHs(sv_2mortal(newSVuv(rpmfiFMode(Files))));
  +    CODE:
  +    RETVAL = rpmfiFMode(Files);
  +    OUTPUT:
  +    RETVAL
   
   void
  -_md5(Files)
  +digest(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)));
  +    const unsigned char * digest;
  +    int algop = 0;
  +    size_t lenp = 0;
  +    PPCODE:
  +    if ((digest = rpmfiDigest(Files, &algop, &lenp)) != NULL
  +        /* return undef if empty */) {
  +        if (lenp) {
  +        XPUSHs(sv_2mortal(newSVpv(digest, lenp)));
  +        XPUSHs(sv_2mortal(newSViv(algop)));
  +        }
       }
  -    _free(fmd5);
   
  -void
  -_link(Files)
  +const char *
  +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)));
  -    }
  +    CODE:
  +    RETVAL = rpmfiFLink(Files);
  +    OUTPUT:
  +    RETVAL
   
  -void
  -_user(Files)
  +const char *
  +user(Files)
       rpmfi Files
  -    PPCODE:
  -    XPUSHs(sv_2mortal(newSVpv(rpmfiFUser(Files), 0)));
  +    CODE:
  +    RETVAL = rpmfiFUser(Files);
  +    OUTPUT:
  +    RETVAL
   
  -void
  -_group(Files)
  +const char *
  +group(Files)
       rpmfi Files
  -    PPCODE:
  -    XPUSHs(sv_2mortal(newSVpv(rpmfiFGroup(Files), 0)));
  +    CODE:
  +    RETVAL = rpmfiFGroup(Files);
  +    OUTPUT:
  +    RETVAL
   
  -void
  -_inode(Files)
  +int
  +inode(Files)
       rpmfi Files
  -    PPCODE:
  -    XPUSHs(sv_2mortal(newSViv(rpmfiFInode(Files))));
  +    CODE:
  +    RETVAL = rpmfiFInode(Files);
  +    OUTPUT:
  +    RETVAL
       
  -void
  -_size(Files)
  +int
  +size(Files)
       rpmfi Files
  -    PPCODE:
  -    XPUSHs(sv_2mortal(newSViv(rpmfiFSize(Files))));
  +    CODE:
  +    RETVAL = rpmfiFSize(Files);
  +    OUTPUT:
  +    RETVAL
   
  -void
  -_dev(Files)
  +int
  +dev(Files)
       rpmfi Files
  -    PPCODE:
  -    XPUSHs(sv_2mortal(newSViv(rpmfiFRdev(Files))));
  +    CODE:
  +    RETVAL = rpmfiFRdev(Files);
  +    OUTPUT:
  +    RETVAL
   
  -void
  -_color(Files)
  +int
  +color(Files)
       rpmfi Files
  -    PPCODE:
  -    XPUSHs(sv_2mortal(newSViv(rpmfiFColor(Files))));
  +    CODE:
  +    RETVAL = rpmfiFColor(Files);
  +    OUTPUT:
  +    RETVAL
   
  -void
  -_class(Files)
  +const char *
  +class(Files)
       rpmfi Files
  -    PREINIT:
  -    const char * class;
  -    PPCODE:
  -    if ((class = rpmfiFClass(Files)) != NULL)
  -        XPUSHs(sv_2mortal(newSVpv(rpmfiFClass(Files), 0)));
  +    CODE:
  +    RETVAL = rpmfiFClass(Files);
  +    OUTPUT:
  +    RETVAL
   
  -void
  -_mtime(Files)
  +int
  +mtime(Files)
       rpmfi Files
  -    PPCODE:
  -    XPUSHs(sv_2mortal(newSViv(rpmfiFMtime(Files))));
  +    CODE:
  +    RETVAL = rpmfiFMtime(Files);
  +    OUTPUT:
  +    RETVAL
   
  -void
  +int
   _nlink(Files)
       rpmfi Files
  -    PPCODE:
  -    XPUSHs(sv_2mortal(newSViv(rpmfiFNlink(Files))));
  +    CODE:
  +    RETVAL = rpmfiFNlink(Files);
  +    OUTPUT:
  +    RETVAL
   
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/perl/t/00.pod.coverage.t
  ============================================================================
  $ cvs diff -u -r1.6 -r1.7 00.pod.coverage.t
  --- rpm/perl/t/00.pod.coverage.t      9 Aug 2007 16:16:02 -0000       1.6
  +++ rpm/perl/t/00.pod.coverage.t      14 Aug 2007 00:28:28 -0000      1.7
  @@ -23,7 +23,7 @@
   pod_coverage_ok( "RPM::Files", "RPM::Files is covered" );
   pod_coverage_ok( "RPM::Dependencies", "RPM::Dependencies is covered" );
   SKIP: {
  -        skip "File Dependencies and Spec under works", 1;
  +        skip "File Spec under works", 1;
   pod_coverage_ok( "RPM::Spec", "RPM::Spec is covered" );
   }
   
  @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                rpm-cvs@rpm5.org

Reply via email to