gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r23120 - in Extractor/src/plugins: . testdata


From: gnunet
Subject: [GNUnet-SVN] r23120 - in Extractor/src/plugins: . testdata
Date: Sun, 5 Aug 2012 22:01:02 +0200

Author: grothoff
Date: 2012-08-05 22:01:02 +0200 (Sun, 05 Aug 2012)
New Revision: 23120

Added:
   Extractor/src/plugins/test_rpm.c
   Extractor/src/plugins/testdata/rpm_test.rpm
Modified:
   Extractor/src/plugins/Makefile.am
   Extractor/src/plugins/gif_extractor.c
   Extractor/src/plugins/mime_extractor.c
   Extractor/src/plugins/ogg_extractor.c
   Extractor/src/plugins/rpm_extractor.c
Log:
porting RPM to new API, fixing bugs with RPM's extracted INSTALLED_SIZE and 
BUILDTIME values

Modified: Extractor/src/plugins/Makefile.am
===================================================================
--- Extractor/src/plugins/Makefile.am   2012-08-05 18:40:04 UTC (rev 23119)
+++ Extractor/src/plugins/Makefile.am   2012-08-05 20:01:02 UTC (rev 23120)
@@ -13,7 +13,8 @@
 
 EXTRA_DIST = template_extractor.c \
   testdata/ogg_courseclear.ogg \
-  testdata/gif_image.gif
+  testdata/gif_image.gif \
+  testdata/rpm_test.rpm
 
 if HAVE_VORBISFILE
 PLUGIN_OGG=libextractor_ogg.la
@@ -30,10 +31,16 @@
 TEST_GIF=test_gif
 endif
 
+if HAVE_LIBRPM
+PLUGIN_RPM=libextractor_rpm.la
+TEST_RPM=test_rpm
+endif
+
 plugin_LTLIBRARIES = \
   $(PLUGIN_OGG) \
   $(PLUGIN_MIME) \
-  $(PLUGIN_GIF)
+  $(PLUGIN_GIF) \
+  $(PLUGIN_RPM)
 
 if HAVE_ZZUF
   fuzz_tests=fuzz_default.sh 
@@ -42,7 +49,8 @@
 check_PROGRAMS = \
   $(TEST_OGG) \
   $(TEST_MIME) \
-  $(TEST_GIF)
+  $(TEST_GIF) \
+  $(TEST_RPM)
 
 TESTS = \
   $(fuzz_tests) \
@@ -100,4 +108,18 @@
   $(top_builddir)/src/plugins/libtest.la
 
 
+libextractor_rpm_la_SOURCES = \
+  rpm_extractor.c
+libextractor_rpm_la_LDFLAGS = \
+  $(PLUGINFLAGS)
+libextractor_rpm_la_LIBADD = \
+  $(top_builddir)/src/main/libextractor.la \
+  -lrpm
 
+test_rpm_SOURCES = \
+  test_rpm.c
+test_rpm_LDADD = \
+  $(top_builddir)/src/plugins/libtest.la
+
+
+

Modified: Extractor/src/plugins/gif_extractor.c
===================================================================
--- Extractor/src/plugins/gif_extractor.c       2012-08-05 18:40:04 UTC (rev 
23119)
+++ Extractor/src/plugins/gif_extractor.c       2012-08-05 20:01:02 UTC (rev 
23120)
@@ -17,7 +17,11 @@
      Free Software Foundation, Inc., 59 Temple Place - Suite 330,
      Boston, MA 02111-1307, USA.
  */
-
+/**
+ * @file plugins/gif_extractor.c
+ * @brief plugin to support GIF files
+ * @author Christian Grothoff
+ */
 #include "platform.h"
 #include "extractor.h"
 #include <gif_lib.h>

Modified: Extractor/src/plugins/mime_extractor.c
===================================================================
--- Extractor/src/plugins/mime_extractor.c      2012-08-05 18:40:04 UTC (rev 
23119)
+++ Extractor/src/plugins/mime_extractor.c      2012-08-05 20:01:02 UTC (rev 
23120)
@@ -17,7 +17,11 @@
      Free Software Foundation, Inc., 59 Temple Place - Suite 330,
      Boston, MA 02111-1307, USA.
  */
-
+/**
+ * @file plugins/mime_extractor.c
+ * @brief plugin to determine mime types using libmagic (from 'file')
+ * @author Christian Grothoff
+ */
 #include "platform.h"
 #include "extractor.h"
 #include <magic.h>

Modified: Extractor/src/plugins/ogg_extractor.c
===================================================================
--- Extractor/src/plugins/ogg_extractor.c       2012-08-05 18:40:04 UTC (rev 
23119)
+++ Extractor/src/plugins/ogg_extractor.c       2012-08-05 20:01:02 UTC (rev 
23120)
@@ -17,6 +17,11 @@
      Free Software Foundation, Inc., 59 Temple Place - Suite 330,
      Boston, MA 02111-1307, USA.
  */
+/**
+ * @file plugins/ogg_extractor.c
+ * @brief plugin to support OGG files
+ * @author Christian Grothoff
+ */
 #include "platform.h"
 #include "extractor.h"
 #include "extractor_plugins.h"

Modified: Extractor/src/plugins/rpm_extractor.c
===================================================================
--- Extractor/src/plugins/rpm_extractor.c       2012-08-05 18:40:04 UTC (rev 
23119)
+++ Extractor/src/plugins/rpm_extractor.c       2012-08-05 20:01:02 UTC (rev 
23120)
@@ -1,10 +1,10 @@
 /*
      This file is part of libextractor.
-     (C) 2002, 2003, 2008, 2009 Vidyut Samanta and Christian Grothoff
+     (C) 2002, 2003, 2008, 2009, 2012 Vidyut Samanta and Christian Grothoff
 
      libextractor is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
-     by the Free Software Foundation; either version 2, or (at your
+     by the Free Software Foundation; either version 3, or (at your
      option) any later version.
 
      libextractor is distributed in the hope that it will be useful, but
@@ -17,7 +17,11 @@
      Free Software Foundation, Inc., 59 Temple Place - Suite 330,
      Boston, MA 02111-1307, USA.
  */
-
+/**
+ * @file plugins/rpm_extractor.c
+ * @brief plugin to support RPM files
+ * @author Christian Grothoff
+ */
 #include "platform.h"
 #include "extractor.h"
 #include <stdint.h>
@@ -28,47 +32,128 @@
 #include <sys/types.h>
 #include <signal.h>
 
-/* ******************** pipe feeder ************************ */
 
-struct PipeArgs {                             
-  const char * data;
-  size_t pos;
-  size_t size;
+/**
+ * Closure for the 'pipe_feeder'.
+ */
+struct PipeArgs 
+{
+  
+  /**
+   * Context for reading data from.
+   */
+  struct EXTRACTOR_ExtractContext *ec;
+
+  /**
+   * Lock for synchronizing access to 'ec'.
+   */
+  pthread_mutex_t lock;
+
+  /**
+   * Pipe to write to at [1].
+   */
   int pi[2];
+
+  /**
+   * Set to 1 if we should stop writing to the pipe.
+   */
   int shutdown;
 };
 
+
+/**
+ * Size of the buffer we use for reading.
+ */
+#define BUF_SIZE (16 * 1024)
+
+
+/**
+ * Main function of a helper thread that passes the package data
+ * to librpm.
+ *
+ * @param args the 'struct PipeArgs*'
+ * @return NULL
+ */
 static void *
-pipe_feeder(void * args)
+pipe_feeder (void * args)
 {
-  ssize_t ret;
-  struct PipeArgs * p = args;
+  struct PipeArgs *p = args;
+  ssize_t rret;
+  ssize_t wret;
+  ssize_t done;
+  void *ptr;
+  char *buf;
 
-  while ( (p->shutdown == 0) &&
-         (0 < (ret = WRITE(p->pi[1],
-                           &p->data[p->pos],
-                           p->size - p->pos))) )
-         p->pos += ret;
-  CLOSE(p->pi[1]);
+  /* buffer is heap-allocated as this is a thread and 
+     large stack allocations might not be the best idea */
+  while (0 == p->shutdown)
+    {
+      pthread_mutex_lock (&p->lock);
+      if (-1 == (rret = p->ec->read (p->ec->cls, &ptr, BUF_SIZE)))
+       {
+         pthread_mutex_unlock (&p->lock);
+         break;
+       }
+      pthread_mutex_unlock (&p->lock);
+      if (0 == rret)
+       break;
+      buf = ptr;
+      done = 0;
+      while ( (0 == p->shutdown) &&
+             (done < rret) )
+       {
+         if (-1 == (wret = WRITE (p->pi[1],
+                                  &buf[done],
+                                  rret - done)))
+           {
+             break;
+           }
+         if (0 == wret)
+           break;
+         done += wret;    
+       }
+      if (done != rret)
+       break;
+    }
+  CLOSE (p->pi[1]);
   return NULL;                     
 }
 
-static void
-sigalrmHandler (int sig)
+
+/**
+ * LOG callback called by librpm.  Does nothing, we
+ * just need this to override the default behavior.
+ */
+static int 
+discard_log_callback (rpmlogRec rec,
+                     void *ctx) 
 {
-  /* do nothing */
+  /* do nothing! */
+  return 0;
 }
+ 
 
-
-/* *************** real libextractor stuff ***************** */
-
-typedef struct
+/**
+ * Mapping from RPM tags to LE types.
+ */
+struct Matches
 {
+  /**
+   * RPM tag.
+   */
   int32_t rtype;
+
+  /**
+   * Corresponding LE type.
+   */
   enum EXTRACTOR_MetaType type;
-} Matches;
+};
 
-static Matches tests[] = {
+
+/**
+ * List of mappings from RPM tags to LE types.
+ */ 
+static struct Matches tests[] = {
   {RPMTAG_NAME, EXTRACTOR_METATYPE_PACKAGE_NAME},
   {RPMTAG_VERSION, EXTRACTOR_METATYPE_SOFTWARE_VERSION},
   {RPMTAG_GROUP, EXTRACTOR_METATYPE_SECTION},
@@ -148,25 +233,21 @@
     RPMTAG_POSTTRANSPROG       = 1154, /* s */
     RPMTAG_DISTTAG             = 1155, /* s */
 #endif
-  {0, 0},
+  {0, 0}
 };
 
-static int discardCB(rpmlogRec rec, void *ctx) {
-  /* do nothing! */
-  return 0;
-}
 
-/* mimetype = application/x-rpm */
-int 
-EXTRACTOR_rpm_extract (const char *data,
-                      size_t size,
-                      EXTRACTOR_MetaDataProcessor proc,
-                      void *proc_cls,
-                      const char *options)
+/**
+ * Main entry method for the 'application/x-rpm' extraction plugin. 
+ *
+ * @param ec extraction context provided to the plugin
+ */
+void
+EXTRACTOR_rpm_extract_method (struct EXTRACTOR_ExtractContext *ec)
 {
   struct PipeArgs parg;
   pthread_t pthr;
-  void * unused;
+  void *unused;
   const char *str;
   Header hdr;
   HeaderIterator hi;
@@ -178,24 +259,28 @@
   struct sigaction sig;
   struct sigaction old;
 
-  if (0 != pipe(parg.pi))
-    return 0;
-  fdi = NULL;
-  parg.data = data;
-  parg.pos = 0;
-  parg.size = size;
+  parg.ec = ec;
   parg.shutdown = 0;
-  if (0 != pthread_create(&pthr,
-                         NULL,
-                         &pipe_feeder,
-                         &parg))
+  if (0 != pipe (parg.pi))
+    return;
+  if (0 != pthread_mutex_init (&parg.lock, NULL))
     {
-      CLOSE(parg.pi[0]);
-      CLOSE(parg.pi[1]);
-      return 0;
+      CLOSE (parg.pi[0]);
+      CLOSE (parg.pi[1]);
+      return;
     }
-  rpmlogSetCallback(&discardCB, NULL);
-  fdi = fdDup(parg.pi[0]);
+  if (0 != pthread_create (&pthr,
+                          NULL,
+                          &pipe_feeder,
+                          &parg))
+    {
+      pthread_mutex_destroy (&parg.lock);
+      CLOSE (parg.pi[0]);
+      CLOSE (parg.pi[1]);
+      return;
+    }
+  rpmlogSetCallback (&discard_log_callback, NULL);
+  fdi = fdDup (parg.pi[0]);
   ts = rpmtsCreate();
   rc = rpmReadPackageFile (ts, fdi, "GNU libextractor", &hdr);
   switch (rc)
@@ -209,100 +294,123 @@
     default:
       goto END;
     }
-
-  if (0 != proc (proc_cls, 
-                "rpm",
-                EXTRACTOR_METATYPE_MIMETYPE,
-                EXTRACTOR_METAFORMAT_UTF8,
-                "text/plain",
-                "application/x-rpm",
-                strlen ("application/x-rpm") +1))
-    return 1;
+  pthread_mutex_lock (&parg.lock);
+  if (0 != ec->proc (ec->cls, 
+                    "rpm",
+                    EXTRACTOR_METATYPE_MIMETYPE,
+                    EXTRACTOR_METAFORMAT_UTF8,
+                    "text/plain",
+                    "application/x-rpm",
+                    strlen ("application/x-rpm") +1))
+    {
+      pthread_mutex_unlock (&parg.lock);
+      goto END;
+    }
+  pthread_mutex_unlock (&parg.lock);
   hi = headerInitIterator (hdr);
   p = rpmtdNew ();
   while (1 == headerNext (hi, p))
-    {
-      i = 0;
-      while (tests[i].rtype != 0)
-        {
-          if (tests[i].rtype == p->tag)
-            {
-              switch (p->type)
-                {
-                case RPM_STRING_ARRAY_TYPE:
-                case RPM_I18NSTRING_TYPE:
-                case RPM_STRING_TYPE:
-                    while (NULL != (str = rpmtdNextString (p))) 
-                     {
-                       if (0 != proc (proc_cls, 
-                                      "rpm",
-                                      tests[i].type,
-                                      EXTRACTOR_METAFORMAT_UTF8,
-                                      "text/plain",
-                                      str,
-                                      strlen (str) +1))
-                         return 1;
-                     }
-                    break;
-                case RPM_INT32_TYPE:
-                  {
-                    if (p->tag == RPMTAG_BUILDTIME)
-                      {
-                        char tmp[30];
+    for (i = 0; 0 != tests[i].rtype; i++)
+      {
+       if (tests[i].rtype != p->tag)
+         continue;
+       switch (p->type)
+         {
+         case RPM_STRING_ARRAY_TYPE:
+         case RPM_I18NSTRING_TYPE:
+         case RPM_STRING_TYPE:
+           while (NULL != (str = rpmtdNextString (p))) 
+             {
+               pthread_mutex_lock (&parg.lock);
+               if (0 != ec->proc (ec->cls, 
+                                  "rpm",
+                                  tests[i].type,
+                                  EXTRACTOR_METAFORMAT_UTF8,
+                                  "text/plain",
+                                  str,
+                                  strlen (str) + 1))
+                 
+                 {              
+                   pthread_mutex_unlock (&parg.lock);
+                   goto CLEANUP;
+                 }
+               pthread_mutex_unlock (&parg.lock);
+             }
+           break;
+         case RPM_INT32_TYPE:
+           {
+             if (p->tag == RPMTAG_BUILDTIME)
+               {
+                 char tmp[30];
+                 uint32_t *v = rpmtdNextUint32 (p);
+                 time_t tp = (time_t) *v;
 
-                        ctime_r ((time_t *) p, tmp);
-                        tmp[strlen (tmp) - 1] = '\0';   /* eat linefeed */
+                 ctime_r (&tp, tmp);
+                 tmp[strlen (tmp) - 1] = '\0';   /* eat linefeed */            
  
+                 pthread_mutex_lock (&parg.lock);
+                 if (0 != ec->proc (ec->cls, 
+                                    "rpm",
+                                    tests[i].type,
+                                    EXTRACTOR_METAFORMAT_UTF8,
+                                    "text/plain",
+                                    tmp,
+                                    strlen (tmp) + 1))
+                   {
+                     pthread_mutex_unlock (&parg.lock);
+                     goto CLEANUP;
+                   }
+                 pthread_mutex_unlock (&parg.lock);
+               }
+             else
+               {
+                 char tmp[14];
+                 uint32_t *s = rpmtdNextUint32 (p);
 
-                       if (0 != proc (proc_cls, 
-                                      "rpm",
-                                      tests[i].type,
-                                      EXTRACTOR_METAFORMAT_UTF8,
-                                      "text/plain",
-                                      tmp,
-                                      strlen (tmp) +1))
-                         return 1;
-                      }
-                    else
-                      {
-                        char tmp[14];
-
-                        sprintf (tmp, "%d", *(int *) p);
-                       if (0 != proc (proc_cls, 
-                                      "rpm",
-                                      tests[i].type,
-                                      EXTRACTOR_METAFORMAT_UTF8,
-                                      "text/plain",
-                                      tmp,
-                                      strlen (tmp) +1))
-                         return 1;
-                      }
-                    break;
-                  }
-               default:
-                       break;
-                }
-            }
-          i++;
-        }
-    }
+                 snprintf (tmp, 
+                           sizeof (tmp), 
+                           "%u", 
+                           (unsigned int) *s);
+                 pthread_mutex_lock (&parg.lock);
+                 if (0 != ec->proc (ec->cls, 
+                                    "rpm",
+                                    tests[i].type,
+                                    EXTRACTOR_METAFORMAT_UTF8,
+                                    "text/plain",
+                                    tmp,
+                                    strlen (tmp) + 1))
+                   {
+                     pthread_mutex_unlock (&parg.lock);
+                     goto CLEANUP;
+                   }
+                 pthread_mutex_unlock (&parg.lock);
+               }
+             break;
+           }
+         default:
+           break;
+         }      
+      }
+ CLEANUP:
   rpmtdFree (p);
   headerFreeIterator (hi);
   headerFree (hdr);
   rpmtsFree(ts);
- END:                                          
-  /* make sure SIGALRM does not kill us */
+
+ END:                          
+  /* make sure SIGALRM does not kill us, then use it to
+     kill the thread */
   memset (&sig, 0, sizeof (struct sigaction));
   memset (&old, 0, sizeof (struct sigaction));
   sig.sa_flags = SA_NODEFER;
-  sig.sa_handler = &sigalrmHandler;
+  sig.sa_handler = SIG_IGN;
   sigaction (SIGALRM, &sig, &old);
   parg.shutdown = 1;
-  pthread_kill(pthr, SIGALRM);
-  pthread_join(pthr, &unused);
+  CLOSE (parg.pi[0]);
+  Fclose (fdi);  
+  pthread_kill (pthr, SIGALRM);
+  pthread_join (pthr, &unused);
+  pthread_mutex_destroy (&parg.lock);
   sigaction (SIGALRM, &old, &sig);
-  Fclose(fdi);
-  CLOSE(parg.pi[0]);
-  return 0;
 }
 
 /* end of rpm_extractor.c */

Added: Extractor/src/plugins/test_rpm.c
===================================================================
--- Extractor/src/plugins/test_rpm.c                            (rev 0)
+++ Extractor/src/plugins/test_rpm.c    2012-08-05 20:01:02 UTC (rev 23120)
@@ -0,0 +1,326 @@
+/*
+     This file is part of libextractor.
+     (C) 2012 Vidyut Samanta and Christian Grothoff
+
+     libextractor is free software; you can redistribute it and/or modify
+     it under the terms of the GNU General Public License as published
+     by the Free Software Foundation; either version 3, or (at your
+     option) any later version.
+
+     libextractor is distributed in the hope that it will be useful, but
+     WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+     General Public License for more details.
+
+     You should have received a copy of the GNU General Public License
+     along with libextractor; see the file COPYING.  If not, write to the
+     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+     Boston, MA 02111-1307, USA.
+*/
+/**
+ * @file plugins/test_rpm.c
+ * @brief testcase for ogg plugin
+ * @author Christian Grothoff
+ */
+#include "platform.h"
+#include "test_lib.h"
+
+
+/**
+ * Expected package summary text.
+ */
+#define SUMMARY "The GNU libtool, which simplifies the use of shared 
libraries."
+
+/**
+ * Expected package description text.
+ */
+#define DESCRIPTION "The libtool package contains the GNU libtool, a set of 
shell scripts\n"\
+  "which automatically configure UNIX and UNIX-like architectures to\n"        
\
+  "generically build shared libraries.  Libtool provides a consistent,\n" \
+  "portable interface which simplifies the process of using shared\n"  \
+  "libraries.\n"                                                       \
+  "\n"                                                                 \
+  "If you are developing programs which will use shared libraries, you\n" \
+  "should install libtool."
+
+
+/**
+ * Main function for the RPM testcase.
+ *
+ * @param argc number of arguments (ignored)
+ * @param argv arguments (ignored)
+ * @return 0 on success
+ */
+int
+main (int argc, char *argv[])
+{
+  struct SolutionData rpm_test_sol[] =
+    {
+      { 
+       EXTRACTOR_METATYPE_MIMETYPE,
+       EXTRACTOR_METAFORMAT_UTF8,
+       "text/plain",
+       "application/x-rpm",
+       strlen ("application/x-rpm") + 1,
+       0 
+      },
+      { 
+       EXTRACTOR_METATYPE_PACKAGE_NAME,
+       EXTRACTOR_METAFORMAT_UTF8,
+       "text/plain",
+       "libtool",
+       strlen ("libtool") + 1,
+       0 
+      },
+      { 
+       EXTRACTOR_METATYPE_SOFTWARE_VERSION,
+       EXTRACTOR_METAFORMAT_UTF8,
+       "text/plain",
+       "1.5",
+       strlen ("1.5") + 1,
+       0 
+      },
+      { 
+       EXTRACTOR_METATYPE_PACKAGE_VERSION,
+       EXTRACTOR_METAFORMAT_UTF8,
+       "text/plain",
+       "6",
+       strlen ("6") + 1,
+       0 
+      },
+      { 
+       EXTRACTOR_METATYPE_SUMMARY,
+       EXTRACTOR_METAFORMAT_UTF8,
+       "text/plain",
+       SUMMARY,
+       strlen (SUMMARY) + 1,
+       0 
+      },
+      { 
+       EXTRACTOR_METATYPE_DESCRIPTION,
+       EXTRACTOR_METAFORMAT_UTF8,
+       "text/plain",
+       DESCRIPTION,
+       strlen (DESCRIPTION) + 1,
+       0 
+      },
+      { 
+       EXTRACTOR_METATYPE_CREATION_DATE,
+       EXTRACTOR_METAFORMAT_UTF8,
+       "text/plain",
+       "Thu Oct  2 11:44:33 2003",
+       strlen ("Thu Oct  2 11:44:33 2003") + 1,
+       0 
+      },
+      { 
+       EXTRACTOR_METATYPE_BUILDHOST,
+       EXTRACTOR_METAFORMAT_UTF8,
+       "text/plain",
+       "bullwinkle.devel.redhat.com",
+       strlen ("bullwinkle.devel.redhat.com") + 1,
+       0 
+      },
+      { 
+       EXTRACTOR_METATYPE_PACKAGE_INSTALLED_SIZE,
+       EXTRACTOR_METAFORMAT_UTF8,
+       "text/plain",
+       "2623621", 
+       strlen ("2623621") + 1,
+       0 
+      },
+      { 
+       EXTRACTOR_METATYPE_PACKAGE_DISTRIBUTION,
+       EXTRACTOR_METAFORMAT_UTF8,
+       "text/plain",
+       "Red Hat Linux",
+       strlen ("Red Hat Linux") + 1,
+       0 
+      },
+      { 
+       EXTRACTOR_METATYPE_VENDOR,
+       EXTRACTOR_METAFORMAT_UTF8,
+       "text/plain",
+       "Red Hat, Inc.",
+       strlen ("Red Hat, Inc.") + 1,
+       0 
+      },
+      { 
+       EXTRACTOR_METATYPE_LICENSE,
+       EXTRACTOR_METAFORMAT_UTF8,
+       "text/plain",
+       "GPL",
+       strlen ("GPL") + 1,
+       0 
+      },
+      { 
+       EXTRACTOR_METATYPE_PACKAGE_MAINTAINER,
+       EXTRACTOR_METAFORMAT_UTF8,
+       "text/plain",
+       "Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>",
+       strlen ("Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>") + 1,
+       0 
+      },
+      { 
+       EXTRACTOR_METATYPE_SECTION,
+       EXTRACTOR_METAFORMAT_UTF8,
+       "text/plain",
+       "Development/Tools",
+       strlen ("Development/Tools") + 1,
+       0 
+      },
+      { 
+       EXTRACTOR_METATYPE_URL,
+       EXTRACTOR_METAFORMAT_UTF8,
+       "text/plain",
+       "http://www.gnu.org/software/libtool/";,
+       strlen ("http://www.gnu.org/software/libtool/";) + 1,
+       0 
+      },
+      { 
+       EXTRACTOR_METATYPE_TARGET_OS,
+       EXTRACTOR_METAFORMAT_UTF8,
+       "text/plain",
+       "linux",
+       strlen ("linux") + 1,
+       0 
+      },
+      { 
+       EXTRACTOR_METATYPE_TARGET_ARCHITECTURE,
+       EXTRACTOR_METAFORMAT_UTF8,
+       "text/plain",
+       "ia64",
+       strlen ("ia64") + 1,
+       0 
+      },
+      { 
+       EXTRACTOR_METATYPE_PACKAGE_PROVIDES,
+       EXTRACTOR_METAFORMAT_UTF8,
+       "text/plain",
+       "libtool",
+       strlen ("libtool") + 1,
+       0 
+      },
+      { 
+       EXTRACTOR_METATYPE_PACKAGE_DEPENDENCY,
+       EXTRACTOR_METAFORMAT_UTF8,
+       "text/plain",
+       "/bin/sh",
+       strlen ("/bin/sh") + 1,
+       0 
+      },
+      { 
+       EXTRACTOR_METATYPE_PACKAGE_DEPENDENCY,
+       EXTRACTOR_METAFORMAT_UTF8,
+       "text/plain",
+       "/bin/sh",
+       strlen ("/bin/sh") + 1,
+       0 
+      },
+      { 
+       EXTRACTOR_METATYPE_PACKAGE_DEPENDENCY,
+       EXTRACTOR_METAFORMAT_UTF8,
+       "text/plain",
+       "/bin/sh",
+       strlen ("/bin/sh") + 1,
+       0 
+      },
+      { 
+       EXTRACTOR_METATYPE_PACKAGE_DEPENDENCY,
+       EXTRACTOR_METAFORMAT_UTF8,
+       "text/plain",
+       "/sbin/install-info",
+       strlen ("/sbin/install-info") + 1,
+       0 
+      },
+      { 
+       EXTRACTOR_METATYPE_PACKAGE_DEPENDENCY,
+       EXTRACTOR_METAFORMAT_UTF8,
+       "text/plain",
+       "autoconf",
+       strlen ("autoconf") + 1,
+       0 
+      },
+      { 
+       EXTRACTOR_METATYPE_PACKAGE_DEPENDENCY,
+       EXTRACTOR_METAFORMAT_UTF8,
+       "text/plain",
+       "automake",
+       strlen ("automake") + 1,
+       0 
+      },
+      { 
+       EXTRACTOR_METATYPE_PACKAGE_DEPENDENCY,
+       EXTRACTOR_METAFORMAT_UTF8,
+       "text/plain",
+       "libtool-libs",
+       strlen ("libtool-libs") + 1,
+       0 
+      },
+      { 
+       EXTRACTOR_METATYPE_PACKAGE_DEPENDENCY,
+       EXTRACTOR_METAFORMAT_UTF8,
+       "text/plain",
+       "m4",
+       strlen ("m4") + 1,
+       0 
+      },
+      { 
+       EXTRACTOR_METATYPE_PACKAGE_DEPENDENCY,
+       EXTRACTOR_METAFORMAT_UTF8,
+       "text/plain",
+       "mktemp",
+       strlen ("mktemp") + 1,
+       0 
+      },
+      { 
+       EXTRACTOR_METATYPE_PACKAGE_DEPENDENCY,
+       EXTRACTOR_METAFORMAT_UTF8,
+       "text/plain",
+       "perl",
+       strlen ("perl") + 1,
+       0 
+      },
+      { 
+       EXTRACTOR_METATYPE_PACKAGE_DEPENDENCY,
+       EXTRACTOR_METAFORMAT_UTF8,
+       "text/plain",
+       "rpmlib(CompressedFileNames)",
+       strlen ("rpmlib(CompressedFileNames)") + 1,
+       0 
+      },
+      { 
+       EXTRACTOR_METATYPE_PACKAGE_DEPENDENCY,
+       EXTRACTOR_METAFORMAT_UTF8,
+       "text/plain",
+       "rpmlib(PayloadFilesHavePrefix)",
+       strlen ("rpmlib(PayloadFilesHavePrefix)") + 1,
+       0 
+      },
+      { 
+       EXTRACTOR_METATYPE_PACKAGE_DEPENDENCY,
+       EXTRACTOR_METAFORMAT_UTF8,
+       "text/plain",
+       "rpmlib(VersionedDependencies)",
+       strlen ("rpmlib(VersionedDependencies)") + 1,
+       0 
+      },
+      { 
+       EXTRACTOR_METATYPE_TARGET_PLATFORM,
+       EXTRACTOR_METAFORMAT_UTF8,
+       "text/plain",
+       "ia64-redhat-linux-gnu",
+       strlen ("ia64-redhat-linux-gnu") + 1,
+       0 
+      },
+      { 0, 0, NULL, NULL, 0, -1 }
+    };
+  struct ProblemSet ps[] =
+    {
+      { "testdata/rpm_test.rpm",
+       rpm_test_sol },
+      { NULL, NULL }
+    };
+  return ET_main ("rpm", ps);
+}
+
+/* end of test_rpm.c */

Copied: Extractor/src/plugins/testdata/rpm_test.rpm (from rev 23117, 
Extractor/test/test.rpm)
===================================================================
(Binary files differ)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]