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:   04-Aug-2007 18:36:41
  Branch: HEAD                             Handle: 2007080417364100

  Added files:
    rpm/perl/RPM            Constant.pm
    rpm/perl/t              02.rpmconstant.t
  Modified files:
    rpm/perl                Makefile.PL.in Makefile.am RPM.xs

  Log:
    - add RPM::Constant perl module

  Summary:
    Revision    Changes     Path
    1.9         +5  -5      rpm/perl/Makefile.PL.in
    1.8         +6  -6      rpm/perl/Makefile.am
    1.15        +10 -0      rpm/perl/RPM.xs
    1.1         +67 -0      rpm/perl/RPM/Constant.pm
    1.1         +13 -0      rpm/perl/t/02.rpmconstant.t
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/perl/Makefile.PL.in
  ============================================================================
  $ cvs diff -u -r1.8 -r1.9 Makefile.PL.in
  --- rpm/perl/Makefile.PL.in   4 Aug 2007 02:19:55 -0000       1.8
  +++ rpm/perl/Makefile.PL.in   4 Aug 2007 16:36:41 -0000       1.9
  @@ -2,19 +2,19 @@
   # See lib/ExtUtils/MakeMaker.pm for details of how to influence
   # the contents of the Makefile that is written.
   
  -my @libdir = qw(build lib popt rpmdb rpmio);
  +my @libdir = qw(. build lib popt rpmdb rpmio rpmconstant);
   
   my @ldaddp = map { '[EMAIL PROTECTED]@/' . $_ . '/.libs' } @libdir;
  -my @ldadd = map { '-l' . $_ } qw(rpmio rpmbuild rpm popt rpmdb);
  +my @ldadd = map { '-l' . $_ } qw(rpmio rpmbuild rpm popt rpmdb rpmconstant);
   
   WriteMakefile(
              'NAME'    => 'RPM',
  -           'OBJECT'  => 'RPM.o RPM_Ts.o RPM_Header.o',
  +           'OBJECT'  => 'RPM.o RPM_Ts.o RPM_Header.o RPM_Constant.o',
              'VERSION' => '@VERSION@',
              'MAKEFILE'=> 'Makefile.perl',
  -           'LIBS'    => [join(' ', @ldaddp) . join(' ', @ldadd) . ' 
@LDFLAGS@ @LIBS@'],
  +           'LIBS'    => [join(' ', @ldaddp) . ' ' . join(' ', @ldadd) . ' 
@LDFLAGS@ @LIBS@'],
              'CCFLAGS' => '@CFLAGS@',
              'OPTIMIZE'=> '-g',
  -           'INC'     => join(' ', map { '[EMAIL PROTECTED]@/'. $_ } qw(build 
lib popt rpmdb rpmio)) . ' @CPPFLAGS@',
  +           'INC'     => join(' ', map { '[EMAIL PROTECTED]@/'. $_ } @libdir) 
. ' @CPPFLAGS@',
   );
   
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/perl/Makefile.am
  ============================================================================
  $ cvs diff -u -r1.7 -r1.8 Makefile.am
  --- rpm/perl/Makefile.am      4 Aug 2007 02:19:55 -0000       1.7
  +++ rpm/perl/Makefile.am      4 Aug 2007 16:36:41 -0000       1.8
  @@ -5,18 +5,17 @@
   EXTRA_DIST = \
        MANIFEST \
        Makefile.PL.in \
  -     RPM.xs RPM_Header.xs RPM_Ts.xs \
  -     RPM.pm \
  -     t/01.rpm.t
  +     RPM.xs RPM.pm t/01.rpm.t\
  +     RPM_Header.xs RPM_Ts.xs \
  +     RPM/Constant.pm RPM_Constant.xs t/02.rpmconstant.t
   
   noinst_DATA = .made_mod
   
   .made_mod: Makefile.perl $(EXTRA_DIST)
  -     $(MAKE) -f Makefile.perl
  -     touch $@
  +     $(MAKE) -f Makefile.perl || $(MAKE) -f Makefile.perl
   
   test:
  -     $(MAKE) -f Makefile.perl test
  +     $(MAKE) -f Makefile.perl test || $(MAKE) -f Makefile.perl test
   
   MANIFEST: Makefile
        echo -n > MANIFEST
  @@ -28,6 +27,7 @@
        $(PERL) Makefile.PL MAKEFILE=$@
   
   install-data-local:
  +     $(MAKE) -f Makefile.perl PREFIX=$(prefix) install || \
        $(MAKE) -f Makefile.perl PREFIX=$(prefix) install
   
   CLEANFILES = *~
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/perl/RPM.xs
  ============================================================================
  $ cvs diff -u -r1.14 -r1.15 RPM.xs
  --- rpm/perl/RPM.xs   4 Aug 2007 00:33:16 -0000       1.14
  +++ rpm/perl/RPM.xs   4 Aug 2007 16:36:41 -0000       1.15
  @@ -35,7 +35,17 @@
   MODULE = RPM         PACKAGE = RPM
   
   PROTOTYPES: ENABLE
  +
  +#define crutch_stack_wrap(directive) do { \
  +  PUSHMARK(SP); \
  +  PUTBACK; \
  +  directive; \
  +  SPAGAIN; \
  +  PUTBACK; \
  +} while(0)
  +
   BOOT:
  +    crutch_stack_wrap(boot_RPM__Constant(aTHX_ cv));
   #if DYING
       {
        HV *header_tags, *constants; */
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/perl/RPM/Constant.pm
  ============================================================================
  $ cvs diff -u -r0 -r1.1 Constant.pm
  --- /dev/null 2007-08-04 18:33:00 +0200
  +++ Constant.pm       2007-08-04 18:36:41 +0200
  @@ -0,0 +1,67 @@
  +package RPM::Constant;
  +
  +use strict;
  +use Exporter;
  +use RPM;
  +
  +our @ISA = qw(Exporter);
  +
  +our @EXPORT = qw(
  +    listallcontext
  +    listcontext
  +    getvalue
  +);
  +
  +=head1 NAME
  +
  +RPM::Constant
  +
  +=head1 DESCRIPTION
  +
  +RPM::Constant provide function to map internal C value use inside rpm
  +to textual value anybody can use in all RPM modules.
  +
  +=head1 SYNOPSIS
  +
  +    use RPM::Constant;
  +
  +    my $value = getvalue("anyflagset", "anyflags");
  +    if (defined($value)) {
  +        print "Value: $value\n";
  +    } else {
  +        print STDERR "cannot find anyflags in anyflagset\n";
  +    }
  +
  +=head1 FUNCTIONS
  +
  +=head2 listallcontext
  +
  +Return an array listing all existing context, aka flags type.
  +
  +=head2 listcontext(contextname)
  +
  +Return all textuals value handle in a context, undef if B<contextname> does
  +not exists.
  +
  +=head2 getvalue(contextname, value)
  +
  +Return the internal C value for B<value> textual value, undef B<value> in
  +B<contextname> cannot be found.
  +
  +=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/t/02.rpmconstant.t
  ============================================================================
  $ cvs diff -u -r0 -r1.1 02.rpmconstant.t
  --- /dev/null 2007-08-04 18:33:00 +0200
  +++ 02.rpmconstant.t  2007-08-04 18:36:41 +0200
  @@ -0,0 +1,13 @@
  +#!/bin/env perl
  +
  +use strict;
  +use Test::More tests => 5;
  +
  +use_ok('RPM::Constant');
  +use RPM::Constant;
  +can_ok('RPM::Constant', qw(listallcontext listcontext getvalue));
  +my ($context) = listallcontext();
  +ok($context, "Can get context list");
  +my ($textual) = listcontext($context);
  +ok($textual, "can get list of value");
  +ok(defined(getvalue($context, $textual)), "can get value from context");
  @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                rpm-cvs@rpm5.org

Reply via email to