summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStanislav Brabec <sbrabec@suse.cz>2022-03-21 22:55:38 +0100
committerPanu Matilainen <pmatilai@redhat.com>2022-06-28 14:51:02 +0300
commitf0d640d64a978722e4e5bc0bd4e14bcb87bf409a (patch)
tree7d0956187e347246dd93e698240860cedad3f9b9
parentf8dd9fc9f0a3a0dd99390e996b19e885028832f2 (diff)
downloadrpm-f0d640d64a978722e4e5bc0bd4e14bcb87bf409a.tar.gz
Add TranslationURL tag
Create a new optional TranslationURL tag that allows to specify URL for translators. Third party tools can visualize it and motivate people to translate. (cherry picked from commit c10073d1932a536c9f2db59b8426d4e630b21216)
-rw-r--r--build/parsePreamble.c5
-rw-r--r--build/parseSpec.c1
-rw-r--r--docs/manual/tags.md1
-rw-r--r--include/rpm/rpmtag.h1
-rw-r--r--tests/rpmgeneral.at1
5 files changed, 9 insertions, 0 deletions
diff --git a/build/parsePreamble.c b/build/parsePreamble.c
index bf2e608d4..d5cc4b45a 100644
--- a/build/parsePreamble.c
+++ b/build/parsePreamble.c
@@ -41,6 +41,7 @@ static const rpmTagVal copyTagsDuringParse[] = {
RPMTAG_PREFIXES,
RPMTAG_DISTTAG,
RPMTAG_BUGURL,
+ RPMTAG_TRANSLATIONURL,
RPMTAG_GROUP,
RPMTAG_MODULARITYLABEL,
0
@@ -533,6 +534,7 @@ static struct optionalTag {
{ RPMTAG_DISTURL, "%{disturl}" },
{ RPMTAG_DISTTAG, "%{disttag}" },
{ RPMTAG_BUGURL, "%{bugurl}" },
+ { RPMTAG_TRANSLATIONURL, "%{translationurl}" },
{ RPMTAG_MODULARITYLABEL, "%{modularitylabel}"},
{ -1, NULL }
};
@@ -806,6 +808,8 @@ static rpmRC handlePreambleTag(rpmSpec spec, Package pkg, rpmTagVal tag,
/* XXX TODO: validate format somehow */
case RPMTAG_VCS:
SINGLE_TOKEN_ONLY;
+ /* fallthrough */
+ case RPMTAG_TRANSLATIONURL:
headerPutString(pkg->header, tag, field);
break;
case RPMTAG_GROUP:
@@ -1037,6 +1041,7 @@ static struct PreambleRec_s const preambleList[] = {
{RPMTAG_DOCDIR, 0, 0, 0, LEN_AND_STR("docdir")},
{RPMTAG_DISTTAG, 0, 0, 1, LEN_AND_STR("disttag")},
{RPMTAG_BUGURL, 0, 0, 1, LEN_AND_STR("bugurl")},
+ {RPMTAG_TRANSLATIONURL, 0, 0, 1, LEN_AND_STR("translationurl")},
{RPMTAG_ORDERNAME, 2, 0, 0, LEN_AND_STR("orderwithrequires")},
{RPMTAG_REMOVEPATHPOSTFIXES,0, 0, 1, LEN_AND_STR("removepathpostfixes")},
{RPMTAG_MODULARITYLABEL, 0, 0, 1, LEN_AND_STR("modularitylabel")},
diff --git a/build/parseSpec.c b/build/parseSpec.c
index 07e79eba5..714ebc375 100644
--- a/build/parseSpec.c
+++ b/build/parseSpec.c
@@ -638,6 +638,7 @@ static const rpmTagVal sourceTags[] = {
RPMTAG_CHANGELOGTEXT,
RPMTAG_URL,
RPMTAG_BUGURL,
+ RPMTAG_TRANSLATIONURL,
RPMTAG_HEADERI18NTABLE,
RPMTAG_VCS,
RPMTAG_MODULARITYLABEL,
diff --git a/docs/manual/tags.md b/docs/manual/tags.md
index ed8af8195..666a1eff3 100644
--- a/docs/manual/tags.md
+++ b/docs/manual/tags.md
@@ -75,6 +75,7 @@ Policytypesindexes | 5032 | int32 array
Rpmversion | 1064 | string | Version of rpm used to build the package.
Sourcepkgid | 1146 | bin
Sourcerpm | 1044 | string | Package source rpm file name.
+Translationurl | 5100 | string | URL of upstream translation service/repository
Url | 1020 | string | Package URL, typically project upstream website.
Vcs | 5034 | string | (Public) upstream source code VCS location. Format `<vcs>:<address>` with `<vcs>` being the VCS command used (e.g. `git`, `svn`, `hg`, ...) and `<address>` being the location of the repository as used by the VCS tool to clone/checkout the repository (e.g. `https://github.com/rpm-software-management/rpm.git`).
Vendor | 1011 | string | Package vendor contact information.
diff --git a/include/rpm/rpmtag.h b/include/rpm/rpmtag.h
index 403ac2b5f..c57ef04da 100644
--- a/include/rpm/rpmtag.h
+++ b/include/rpm/rpmtag.h
@@ -378,6 +378,7 @@ typedef enum rpmTag_e {
RPMTAG_PAYLOADDIGESTALT = 5097, /* s[] */
RPMTAG_ARCHSUFFIX = 5098, /* s extension */
RPMTAG_SPEC = 5099, /* s */
+ RPMTAG_TRANSLATIONURL = 5100, /* s */
RPMTAG_FIRSTFREE_TAG /*!< internal */
} rpmTag;
diff --git a/tests/rpmgeneral.at b/tests/rpmgeneral.at
index c51dc4b2a..43984babe 100644
--- a/tests/rpmgeneral.at
+++ b/tests/rpmgeneral.at
@@ -292,6 +292,7 @@ TRANSFILETRIGGERSCRIPTPROG
TRANSFILETRIGGERSCRIPTS
TRANSFILETRIGGERTYPE
TRANSFILETRIGGERVERSION
+TRANSLATIONURL
TRIGGERCONDS
TRIGGERFLAGS
TRIGGERINDEX