support REPO_NO_LOCATION, rename "set_deleted" to the more clear "unset"
authorMichael Schroeder <mls@suse.de>
Tue, 13 Nov 2012 09:24:00 +0000 (10:24 +0100)
committerMichael Schroeder <mls@suse.de>
Tue, 13 Nov 2012 09:24:00 +0000 (10:24 +0100)
bindings/solv.i
ext/repo_arch.c
ext/repo_deb.c
ext/repo_rpmdb.c
src/libsolv.ver
src/repo.c
src/repo.h
src/repodata.c
src/repodata.h
src/solvable.c
src/solvable.h

index 54013d7..3fdd4a8 100644 (file)
@@ -1319,7 +1319,8 @@ typedef struct {
   static const int REPO_LOCALPOOL = REPO_LOCALPOOL;
   static const int REPO_USE_LOADING = REPO_USE_LOADING;
   static const int REPO_EXTEND_SOLVABLES = REPO_EXTEND_SOLVABLES;
-  static const int REPO_USE_ROOTDIR  = REPO_USE_ROOTDIR;
+  static const int REPO_USE_ROOTDIR = REPO_USE_ROOTDIR;
+  static const int REPO_NO_LOCATION = REPO_NO_LOCATION;
   static const int SOLV_ADD_NO_STUBS = SOLV_ADD_NO_STUBS;       /* repo_solv */
 #ifdef ENABLE_SUSEREPO
   static const int SUSETAGS_RECORD_SHARES = SUSETAGS_RECORD_SHARES;     /* repo_susetags */
index 6caa487..ebf42d3 100644 (file)
@@ -455,8 +455,10 @@ repo_add_arch_pkg(Repo *repo, const char *fn, int flags)
       if (!s->evr)
        s->evr = ID_EMPTY;
       s->provides = repo_addid_dep(repo, s->provides, pool_rel2id(pool, s->name, s->evr, REL_EQ, 1), 0);
-      repodata_set_location(data, s - pool->solvables, 0, 0, fn);
-      repodata_set_num(data, s - pool->solvables, SOLVABLE_DOWNLOADSIZE, (unsigned long long)stb.st_size);
+      if (!(flags & REPO_NO_LOCATION))
+       repodata_set_location(data, s - pool->solvables, 0, 0, fn);
+      if (S_ISREG(stb.st_mode))
+        repodata_set_num(data, s - pool->solvables, SOLVABLE_DOWNLOADSIZE, (unsigned long long)stb.st_size);
       if (pkgidhandle)
        {
          unsigned char pkgid[16];
@@ -852,7 +854,7 @@ repo_add_arch_local(Repo *repo, const char *dir, int flags)
   if (!(flags & REPO_NO_INTERNALIZE))
     repodata_internalize(data);
   if (flags & REPO_USE_ROOTDIR)
-    solv_free(dir);
+    solv_free((char *)dir);
   return 0;
 }
 
index aec35e3..e9e4e39 100644 (file)
@@ -595,7 +595,8 @@ repo_add_deb(Repo *repo, const char *deb, int flags)
   ctar[l2] = 0;
   s = pool_id2solvable(pool, repo_add_solvable(repo));
   control2solvable(s, data, (char *)ctar);
-  repodata_set_location(data, s - pool->solvables, 0, 0, deb);
+  if (!(flags & REPO_NO_LOCATION))
+    repodata_set_location(data, s - pool->solvables, 0, 0, deb);
   if (S_ISREG(stb.st_mode))
     repodata_set_num(data, s - pool->solvables, SOLVABLE_DOWNLOADSIZE, (unsigned long long)stb.st_size);
   if (gotpkgid)
index e0765a6..4889ded 100644 (file)
@@ -2012,7 +2012,8 @@ repo_add_rpm(Repo *repo, const char *rpm, int flags)
       solv_free(rpmhead);
       return 0;
     }
-  repodata_set_location(data, s - pool->solvables, 0, 0, rpm);
+  if (!(flags & REPO_NO_LOCATION))
+    repodata_set_location(data, s - pool->solvables, 0, 0, rpm);
   if (S_ISREG(stb.st_mode))
     repodata_set_num(data, s - pool->solvables, SOLVABLE_DOWNLOADSIZE, (unsigned long long)stb.st_size);
   repodata_set_num(data, s - pool->solvables, SOLVABLE_HEADEREND, headerend);
index f8d8b01..1745473 100644 (file)
@@ -155,7 +155,6 @@ SOLV_1.0 {
                repo_matchvalue;
                repo_reserve_ids;
                repo_search;
-               repo_set_deleted;
                repo_set_deparray;
                repo_set_id;
                repo_set_idarray;
@@ -163,6 +162,7 @@ SOLV_1.0 {
                repo_set_poolstr;
                repo_set_str;
                repo_sidedata_create;
+               repo_unset;
                repo_write;
                repo_write_filtered;
                repo_write_stdkeyfilter;
@@ -207,8 +207,6 @@ SOLV_1.0 {
                repodata_set_checksum;
                repodata_set_constant;
                repodata_set_constantid;
-               repodata_set_deleted;
-               repodata_set_deleted_uninternalized;
                repodata_set_deltalocation;
                repodata_set_id;
                repodata_set_idarray;
@@ -223,6 +221,8 @@ SOLV_1.0 {
                repodata_str2dir;
                repodata_stringify;
                repodata_swap_attrs;
+               repodata_unset;
+               repodata_unset_uninternalized;
                repodata_write;
                repodata_write_filtered;
                repopagestore_compress_page;
@@ -283,7 +283,6 @@ SOLV_1.0 {
                solvable_lookup_type;
                solvable_lookup_void;
                solvable_selfprovidedep;
-               solvable_set_deleted;
                solvable_set_deparray;
                solvable_set_id;
                solvable_set_idarray;
@@ -293,6 +292,7 @@ SOLV_1.0 {
                solvable_trivial_installable_map;
                solvable_trivial_installable_queue;
                solvable_trivial_installable_repo;
+               solvable_unset;
                solver_allruleinfos;
                solver_calc_duchanges;
                solver_calc_installsizechange;
index ed845ef..39e6ab8 100644 (file)
@@ -1613,7 +1613,7 @@ repo_set_idarray(Repo *repo, Id p, Id keyname, Queue *q)
 }
 
 void
-repo_set_deleted(Repo *repo, Id p, Id keyname)
+repo_unset(Repo *repo, Id p, Id keyname)
 {
   Repodata *data;
   if (p >= 0)
@@ -1665,7 +1665,7 @@ repo_set_deleted(Repo *repo, Id p, Id keyname)
        }
     }
   data = repo_last_repodata(repo);
-  repodata_set_deleted(data, p, keyname);
+  repodata_unset(data, p, keyname);
 }
 
 void
index 90ad055..4f93d1e 100644 (file)
@@ -114,6 +114,7 @@ static inline int pool_installable(const Pool *pool, Solvable *s)
 #define REPO_USE_LOADING               (1 << 3)
 #define REPO_EXTEND_SOLVABLES          (1 << 4)
 #define REPO_USE_ROOTDIR               (1 << 5)
+#define REPO_NO_LOCATION               (1 << 6)
 
 Repodata *repo_add_repodata(Repo *repo, int flags);
 Repodata *repo_id2repodata(Repo *repo, Id id);
@@ -142,7 +143,7 @@ void repo_add_idarray(Repo *repo, Id p, Id keyname, Id id);
 void repo_add_deparray(Repo *repo, Id p, Id keyname, Id dep, Id marker);
 void repo_set_idarray(Repo *repo, Id p, Id keyname, Queue *q);
 void repo_set_deparray(Repo *repo, Id p, Id keyname, Queue *q, Id marker);
-void repo_set_deleted(Repo *repo, Id p, Id keyname);
+void repo_unset(Repo *repo, Id p, Id keyname);
  
 void repo_internalize(Repo *repo);
 void repo_disable_paging(Repo *repo);
index a812ba8..af8a27c 100644 (file)
@@ -2529,7 +2529,7 @@ repodata_add_flexarray(Repodata *data, Id solvid, Id keyname, Id ghandle)
 }
 
 void
-repodata_set_deleted_uninternalized(Repodata *data, Id solvid, Id keyname)
+repodata_unset_uninternalized(Repodata *data, Id solvid, Id keyname)
 {
   Id *pp, *ap, **app;
   app = repodata_get_attrp(data, solvid);
@@ -2555,7 +2555,7 @@ repodata_set_deleted_uninternalized(Repodata *data, Id solvid, Id keyname)
 
 /* XXX: does not work correctly, needs fix in iterators! */
 void
-repodata_set_deleted(Repodata *data, Id solvid, Id keyname)
+repodata_unset(Repodata *data, Id solvid, Id keyname)
 {
   Repokey key;
   key.name = keyname;
index 3951ddd..7ce415b 100644 (file)
@@ -262,8 +262,8 @@ void repodata_add_poolstr_array(Repodata *data, Id solvid, Id keyname, const cha
 void repodata_add_fixarray(Repodata *data, Id solvid, Id keyname, Id ghandle);
 void repodata_add_flexarray(Repodata *data, Id solvid, Id keyname, Id ghandle);
 
-void repodata_set_deleted(Repodata *data, Id solvid, Id keyname);
-void repodata_set_deleted_uninternalized(Repodata *data, Id solvid, Id keyname);
+void repodata_unset(Repodata *data, Id solvid, Id keyname);
+void repodata_unset_uninternalized(Repodata *data, Id solvid, Id keyname);
 
 /* 
  merge/swap attributes from one solvable to another
index 2a73e0a..d0b4a2b 100644 (file)
@@ -734,7 +734,7 @@ solvable_set_deparray(Solvable *s, Id keyname, Queue *q, Id marker)
 }
 
 void
-solvable_set_deleted(Solvable *s, Id keyname)
+solvable_unset(Solvable *s, Id keyname)
 {
-  repo_set_deleted(s->repo, s - s->repo->pool->solvables, keyname);
+  repo_unset(s->repo, s - s->repo->pool->solvables, keyname);
 }
index 3ef9fe5..a6490b8 100644 (file)
@@ -70,7 +70,7 @@ void solvable_add_idarray(Solvable *s, Id keyname, Id id);
 void solvable_add_deparray(Solvable *s, Id keyname, Id dep, Id marker);
 void solvable_set_idarray(Solvable *s, Id keyname, Queue *q);
 void solvable_set_deparray(Solvable *s, Id keyname, Queue *q, Id marker);
-void solvable_set_deleted(Solvable *s, Id keyname);
+void solvable_unset(Solvable *s, Id keyname);
 
 int solvable_identical(Solvable *s1, Solvable *s2);
 Id solvable_selfprovidedep(Solvable *s);