Make susetags2solv directly read content files, so that we can use its
authorMichael Matz <matz@suse.de>
Mon, 11 Feb 2008 15:59:27 +0000 (15:59 +0000)
committerMichael Matz <matz@suse.de>
Mon, 11 Feb 2008 15:59:27 +0000 (15:59 +0000)
vendor for the solvables from the packages file.  So content2solv isn't
necessary, remove it and its call in repo2solv.sh.

tools/CMakeLists.txt
tools/content2solv.c [deleted file]
tools/repo2solv.sh
tools/repo_susetags.c
tools/susetags2solv.c

index 65a9f6f..43c35df 100644 (file)
@@ -18,7 +18,7 @@ SET(helix2solv_REPOS helix2solv.c repo_helix.h repo_helix.c repo_write.c common_
 ADD_EXECUTABLE( helix2solv ${helix2solv_REPOS} )
 TARGET_LINK_LIBRARIES( helix2solv satsolver ${EXPAT_LIBRARY})
 
-SET(susetags2solv_REPOS susetags2solv.c repo_susetags.h repo_susetags.c repo_write.c common_write.c)
+SET(susetags2solv_REPOS susetags2solv.c repo_susetags.h repo_susetags.c repo_content.c repo_write.c common_write.c)
 ADD_EXECUTABLE( susetags2solv ${susetags2solv_REPOS} )
 TARGET_LINK_LIBRARIES( susetags2solv satsolver)
 
@@ -27,15 +27,6 @@ ADD_EXECUTABLE( patchxml2solv ${patchxml2solv_REPOS} )
 TARGET_LINK_LIBRARIES( patchxml2solv satsolver ${EXPAT_LIBRARY})
 
 
-SET(content2solv_REPOS
-  content2solv.c
-  repo_content.h
-  repo_content.c
-  repo_write.c common_write.c)
-ADD_EXECUTABLE( content2solv ${content2solv_REPOS} )
-TARGET_LINK_LIBRARIES( content2solv satsolver)
-
-
 SET(dumpsolv_REPOS dumpsolv.c)
 ADD_EXECUTABLE( dumpsolv ${dumpsolv_REPOS} )
 TARGET_LINK_LIBRARIES( dumpsolv satsolver)
@@ -59,7 +50,6 @@ install(TARGETS
                 helix2solv 
                 rpmmd2solv 
                 rpmdb2solv
-               content2solv
    DESTINATION ${BIN_INSTALL_DIR} )
 
 install(PROGRAMS repo2solv.sh DESTINATION ${BIN_INSTALL_DIR} )
diff --git a/tools/content2solv.c b/tools/content2solv.c
deleted file mode 100644 (file)
index fca1757..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2007, Novell Inc.
- *
- * This program is licensed under the BSD license, read LICENSE.BSD
- * for further information
- */
-
-#include <sys/types.h>
-#include <limits.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "pool.h"
-#include "repo.h"
-#include "repo_content.h"
-#include "common_write.h"
-
-int
-main(int argc, char **argv)
-{
-  Pool *pool = pool_create();
-  Repo *repo = repo_create(pool, "<stdin>");
-  repo_add_content(repo, stdin);
-  tool_write(repo, 0, 0);
-  pool_free(pool);
-  return 0;
-}
index ff206c8..c12f604 100755 (executable)
@@ -56,8 +56,6 @@ if test -d repodata; then
 elif test -d suse/setup/descr && test -s content; then
   olddir=`pwd`
   cd suse/setup/descr || exit 2
-  filepack=`mktemp` || exit 3
-  filecont=`mktemp` || exit 3
   (
     # First packages
     if test -s packages.gz; then
@@ -91,9 +89,6 @@ elif test -d suse/setup/descr && test -s content; then
        esac
       done
     fi
-  ) | susetags2solv -a > $filepack
+  ) | susetags2solv -a -c "${olddir}/content"
   cd "$olddir"
-  content2solv < content > $filecont
-  mergesolv $filecont $filepack
-  rm -f $filepack $filecont
 fi
index 965d362..e52fa3d 100644 (file)
@@ -14,9 +14,6 @@
 
 #include "pool.h"
 #include "repo.h"
-#if 0
-#include "attr_store.h"
-#endif
 #include "tools_util.h"
 #include "repo_susetags.h"
 
@@ -82,10 +79,6 @@ adddep(Pool *pool, struct parsedata *pd, unsigned int olddeps, char *line, Id ma
   return repo_addid_dep(pd->repo, olddeps, id, marker);
 }
 
-#if 0
-Attrstore *attr;
-#endif
-
 /*
  * add_location
  * 
@@ -344,11 +337,6 @@ commit_diskusage (struct parsedata *pd, unsigned entry)
     if (pd->dirs[i][1] || pd->dirs[i][2])
       {
        repodata_add_dirnumnum(pd->data, entry, id_diskusage, pd->dirs[i][0], pd->dirs[i][1], pd->dirs[i][2]);
-#if 0
-        add_attr_intlist_int (attr, entry, id_diskusage, pd->dirs[i][0]);
-        add_attr_intlist_int (attr, entry, id_diskusage, pd->dirs[i][1]);
-        add_attr_intlist_int (attr, entry, id_diskusage, pd->dirs[i][2]);
-#endif
       }
   pd->ndirs = 0;
 }
@@ -395,16 +383,11 @@ repo_add_susetags(Repo *repo, FILE *fp, Id vendor, int with_attr)
   struct parsedata pd;
   Repodata *data = 0;
 
-#if 1
   if (with_attr)
     {
-#if 0
-      attr = new_store(pool);
-#endif
       data = repo_add_repodata(repo);
       init_attr_ids(pool);
     }
-#endif
 
   memset(&pd, 0, sizeof(pd));
   line = malloc(1024);
index db302a9..3d1888f 100644 (file)
@@ -15,6 +15,7 @@
 #include "pool.h"
 #include "repo.h"
 #include "repo_susetags.h"
+#include "repo_content.h"
 #include "common_write.h"
 
 int
@@ -22,6 +23,8 @@ main(int argc, char **argv)
 {
   int with_attr = 0;
   int test_separate = 0;
+  const char *contentfile = 0;
+  Id vendor = 0;
   argv++;
   argc--;
   while (argc--)
@@ -33,13 +36,34 @@ main(int argc, char **argv)
            {
              case 'a': with_attr = 1; break;
              case 's': test_separate = 1; break;
+             case 'c':
+               if (argc)
+                 {
+                   contentfile = argv[1];
+                   argv++;
+                   argc--;
+                 }
+               break;
              default : break;
            }
       argv++;
     }
   Pool *pool = pool_create();
   Repo *repo = repo_create(pool, "<stdin>");
-  repo_add_susetags(repo, stdin, 0, with_attr);
+  if (contentfile)
+    {
+      FILE *fp = fopen (contentfile, "r");
+      if (!fp)
+        {
+         perror("opening content file");
+         exit (1);
+       }
+      repo_add_content(repo, fp);
+      if (!strncmp (id2str(pool, pool->solvables[repo->start].name), "product:", 8))
+        vendor = pool->solvables[repo->start].vendor;
+      fclose (fp);
+    }
+  repo_add_susetags(repo, stdin, vendor, with_attr);
   tool_write(repo, 0, with_attr && test_separate);
   pool_free(pool);
   exit(0);