return ofi;
}
-/**
- * Print copy of spec file, filling in Group/Description/Summary from specspo.
- * @param spec spec file control structure
- */
-static void
-printNewSpecfile(rpmSpec spec)
-{
- Header h;
- speclines sl = spec->sl;
- spectags st = spec->st;
- char * msgstr = NULL;
- int i, j;
-
- if (sl == NULL || st == NULL)
- return;
-
- for (i = 0; i < st->st_ntags; i++) {
- spectag t = st->st_t + i;
- const char * tn = rpmTagGetName(t->t_tag);
- const char * errstr;
- char *fmt;
-
- if (t->t_msgid == NULL)
- h = spec->packages->header;
- else {
- Package pkg;
- char *fe;
- char *buf = xstrdup(t->t_msgid);
-
- fe = strchr(buf, '(');
- h = NULL;
- for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) {
- const char *pkgname;
- h = pkg->header;
- (void) headerNVR(h, &pkgname, NULL, NULL);
- if (!strcmp(pkgname, buf))
- break;
- }
- if (pkg == NULL || h == NULL)
- h = spec->packages->header;
- free(buf);
- }
-
- if (h == NULL)
- continue;
-
- rasprintf(&fmt, "%%{%s}", tn);
- msgstr = _free(msgstr);
-
- msgstr = headerFormat(h, fmt, &errstr);
- if (msgstr == NULL) {
- rpmlog(RPMLOG_ERR, _("can't query %s: %s\n"), tn, errstr);
- return;
- }
- free(fmt);
-
- switch(t->t_tag) {
- case RPMTAG_SUMMARY:
- case RPMTAG_GROUP:
- sl->sl_lines[t->t_startx] = _free(sl->sl_lines[t->t_startx]);
- if (t->t_lang && strcmp(t->t_lang, RPMBUILD_DEFAULT_LANG))
- continue;
- { char *buf = NULL;
- rasprintf(&buf, "%s: %s", tn, msgstr);
- sl->sl_lines[t->t_startx] = buf;
- }
- break;
- case RPMTAG_DESCRIPTION:
- for (j = 1; j < t->t_nlines; j++) {
- if (*sl->sl_lines[t->t_startx + j] == '%')
- continue;
- sl->sl_lines[t->t_startx + j] =
- _free(sl->sl_lines[t->t_startx + j]);
- }
- if (t->t_lang && strcmp(t->t_lang, RPMBUILD_DEFAULT_LANG)) {
- sl->sl_lines[t->t_startx] = _free(sl->sl_lines[t->t_startx]);
- continue;
- }
- sl->sl_lines[t->t_startx + 1] = xstrdup(msgstr);
- if (t->t_nlines > 2)
- sl->sl_lines[t->t_startx + 2] = xstrdup("\n\n");
- break;
- }
- }
- msgstr = _free(msgstr);
-
- for (i = 0; i < sl->sl_nlines; i++) {
- const char * s = sl->sl_lines[i];
- if (s == NULL)
- continue;
- printf("%s", s);
- if (strchr(s, '\n') == NULL && s[strlen(s)-1] != '\n')
- printf("\n");
- }
-}
-
int rpmspecQuery(rpmts ts, QVA_t qva, const char * arg)
{
rpmSpec spec = NULL;