xbps-checkvers: add %t format to get requested template name from path (ie subpackage)

This commit is contained in:
Duncaen 2019-06-14 13:15:53 +02:00 committed by Duncan Overbruck
parent db2eb29cbc
commit dfa6e80d13
2 changed files with 9 additions and 0 deletions

View File

@ -635,6 +635,7 @@ static void
rcv_printf(rcv_t *rcv, FILE *fp, const char *pkgname, const char *repover, rcv_printf(rcv_t *rcv, FILE *fp, const char *pkgname, const char *repover,
const char *srcver) const char *srcver)
{ {
char tmpl[128], *p;
const char *f; const char *f;
for (f = rcv->format; *f; f++) { for (f = rcv->format; *f; f++) {
@ -659,6 +660,12 @@ rcv_printf(rcv_t *rcv, FILE *fp, const char *pkgname, const char *repover,
case 'n': fputs(pkgname, fp); break; case 'n': fputs(pkgname, fp); break;
case 'r': fputs(repover, fp); break; case 'r': fputs(repover, fp); break;
case 's': fputs(srcver, fp); break; case 's': fputs(srcver, fp); break;
case 't':
xbps_strlcpy(tmpl, rcv->fname, sizeof tmpl);
if ((p = strchr(tmpl, '/')))
*p = '\0';
fputs(tmpl, fp);
break;
} }
} }
fputc('\n', fp); fputc('\n', fp);

View File

@ -56,6 +56,8 @@ The package name.
The repository version. The repository version.
.It Cm \&%s .It Cm \&%s
The source package version. The source package version.
.It Cm \&%t
The requested template name (this can be a sub package).
.El .El
.Pp .Pp
The default format is The default format is