Author: dmacvicar
Date: Fri Sep 12 14:02:11 2008
New Revision: 11035
URL: http://svn.opensuse.org/viewcvs/zypp?rev=11035&view=rev
Log:
- add repo_add_poolstr_array
- move updates="key,key.." to repomd.xml
Modified:
trunk/sat-solver/src/repo.c
trunk/sat-solver/src/repo.h
trunk/sat-solver/tools/repo_repomdxml.c
trunk/sat-solver/tools/repo_updateinfoxml.c
Modified: trunk/sat-solver/src/repo.c
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/repo.c?rev=11035&r1=11034&r2=11035&view=diff
==============================================================================
--- trunk/sat-solver/src/repo.c (original)
+++ trunk/sat-solver/src/repo.c Fri Sep 12 14:02:11 2008
@@ -1029,6 +1029,17 @@
}
void
+repo_add_poolstr_array(Repo *repo, Id p, Id keyname, const char *str)
+{
+ Repodata *data = repo_findrepodata(repo, p, keyname);
+ if (p < 0)
+ p = p + data->extrastart;
+ else
+ p = p - data->start;
+ repodata_add_poolstr_array(data, repodata_get_handle(data, p), keyname, str);
+}
+
+void
repo_internalize(Repo *repo)
{
int i;
Modified: trunk/sat-solver/src/repo.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/repo.h?rev=11035&r1=11034&r2=11035&view=diff
==============================================================================
--- trunk/sat-solver/src/repo.h (original)
+++ trunk/sat-solver/src/repo.h Fri Sep 12 14:02:11 2008
@@ -228,6 +228,7 @@
void repo_set_num(Repo *repo, Id p, Id keyname, Id num);
void repo_set_str(Repo *repo, Id p, Id keyname, const char *str);
void repo_set_poolstr(Repo *repo, Id p, Id keyname, const char *str);
+void repo_add_poolstr_array(Repo *repo, Id p, Id keyname, const char *str);
void repo_internalize(Repo *repo);
void repo_disable_paging(Repo *repo);
Modified: trunk/sat-solver/tools/repo_repomdxml.c
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/tools/repo_repomdxml.c?rev=11035&r1=11034&r2=11035&view=diff
==============================================================================
--- trunk/sat-solver/tools/repo_repomdxml.c (original)
+++ trunk/sat-solver/tools/repo_repomdxml.c Fri Sep 12 14:02:11 2008
@@ -92,6 +92,34 @@
{ NUMSTATES }
};
+/*
+ * split l into m parts, store to sp[]
+ * split at whitespace
+ */
+
+static inline int
+split_comma(char *l, char **sp, int m)
+{
+ int i;
+ for (i = 0; i < m;)
+ {
+ while (*l == ',')
+ l++;
+ if (!*l)
+ break;
+ sp[i++] = l;
+ if (i == m)
+ break;
+ while (*l && !(*l == ','))
+ l++;
+ if (!*l)
+ break;
+ *l++ = 0;
+ }
+ return i;
+}
+
+
struct parsedata {
int depth;
enum state state;
@@ -113,7 +141,7 @@
* find attribute
*/
-static const char *
+static inline const char *
find_attr(const char *txt, const char **atts)
{
for (; *atts; atts += 2)
@@ -124,6 +152,7 @@
return 0;
}
+
static void XMLCALL
startElement(void *userData, const char *name, const char **atts)
{
@@ -165,15 +194,44 @@
{
case STATE_START: break;
case STATE_REPOMD:
- expirestr = find_attr("expire", atts);
- if ( expirestr != NULL )
- expire = atoi(expirestr);
- if ( expire > 0 )
- {
- /* save the timestamp in the non solvable number 1 */
- repo_set_num(pd->repo, -1, REPOSITORY_EXPIRE, expire);
+ {
+ const char *updstr;
+ char *value;
+ char *fvalue;
+
+ expirestr = (char*) find_attr("expire", atts);
+ if ( expirestr != NULL )
+ expire = atoi(expirestr);
+ if ( expire > 0 )
+ {
+ /* save the timestamp in the non solvable number 1 */
+ repo_set_num(pd->repo, -1, REPOSITORY_EXPIRE, expire);
+ }
+
+ updstr = find_attr("updates", atts);
+ if ( updstr != NULL )
+ {
+ value = strdup(updstr);
+ fvalue = value; /* save the first */
+ if ( value != NULL )
+ {
+ char *sp[2];
+ while (value)
+ {
+ int words = split_comma(value, sp, 2);
+ if (!words)
+ break;
+ if (sp[0])
+ repo_add_poolstr_array(pd->repo, -1, REPOSITORY_UPDATES, sp[0]);
+ if (words == 1)
+ break;
+ value = sp[1];
+ }
+ free(fvalue);
+ }
+ }
+ break;
}
- break;
case STATE_DATA: break;
case STATE_LOCATION: break;
case STATE_CHECKSUM: break;
Modified: trunk/sat-solver/tools/repo_updateinfoxml.c
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/tools/repo_updateinfoxml.c?rev=11035&r1=11034&r2=11035&view=diff
==============================================================================
--- trunk/sat-solver/tools/repo_updateinfoxml.c (original)
+++ trunk/sat-solver/tools/repo_updateinfoxml.c Fri Sep 12 14:02:11 2008
@@ -135,22 +135,6 @@
static int package_filename_seen = 0;
static int package_flags = 0; /* same for reboot/restart flags, to be written at </package> */
-
-/*
- * find attribute
- */
-
-static const char *
-find_attr(const char *txt, const char **atts)
-{
- for (; *atts; atts += 2)
- {
- if (!strcmp(*atts, txt))
- return atts[1];
- }
- return 0;
-}
-
/*
* create evr (as Id) from 'epoch', 'version' and 'release' attributes
*/
@@ -360,15 +344,9 @@
break;
case STATE_PKGLIST:
break;
- /* <collection short="F8" id="PRODUCT0001444"> */
+ /*