-static void parse_delta_location( struct parsedata *pd,
- const char* str )
-{
- Pool *pool = pd->pool;
- if (str)
- {
- /* Separate the filename into its different parts.
- rpm/x86_64/alsa-1.0.14-31_31.2.x86_64.delta.rpm
- --> dir = rpm/x86_64
- name = alsa
- evr = 1.0.14-31_31.2
- suffix = x86_64.delta.rpm. */
- char *real_str = solv_strdup(str);
- char *s = real_str;
- char *s1, *s2;
- s1 = strrchr (s, '/');
- if (s1)
- {
- pd->delta.locdir = pool_strn2id(pool, s, s1 - s, 1);
- s = s1 + 1;
- }
- /* Guess suffix. */
- s1 = strrchr (s, '.');
- if (s1)
- {
- for (s2 = s1 - 1; s2 > s; s2--)
- if (*s2 == '.')
- break;
- if (!strcmp (s2, ".delta.rpm") || !strcmp (s2, ".patch.rpm"))
- {
- s1 = s2;
- /* We accept one more item as suffix. */
- for (s2 = s1 - 1; s2 > s; s2--)
- if (*s2 == '.')
- break;
- s1 = s2;
- }
- if (*s1 == '.')
- *s1++ = 0;
- pd->delta.locsuffix = pool_str2id(pool, s1, 1);
- }
- /* Last '-'. */
- s1 = strrchr (s, '-');
- if (s1)
- {
- /* Second to last '-'. */
- for (s2 = s1 - 1; s2 > s; s2--)
- if (*s2 == '-')
- break;
- }
- else
- s2 = 0;
- if (s2 > s && *s2 == '-')
- {
- *s2++ = 0;
- pd->delta.locevr = pool_str2id(pool, s2, 1);
- }
- pd->delta.locname = pool_str2id(pool, s, 1);
- free(real_str);
- }
-}
-