bin/xbps-create: add sourcepkg metadata variable

This can be used similar to source-revisions, it should be set to the
pkgver of the template. This then allows to find removed subpackages by
looking for packages with outdated sourcepkg versions.
This commit is contained in:
Duncan Overbruck 2023-02-15 17:31:44 +01:00 committed by Duncan Overbruck
parent 305404744b
commit e0144062a4

View File

@ -827,33 +827,34 @@ main(int argc, char **argv)
{ {
const char *shortopts = "A:B:C:c:D:F:G:H:hl:M:m:n:P:pqr:R:S:s:t:V"; const char *shortopts = "A:B:C:c:D:F:G:H:hl:M:m:n:P:pqr:R:S:s:t:V";
const struct option longopts[] = { const struct option longopts[] = {
{ "alternatives", required_argument, NULL, '4' },
{ "architecture", required_argument, NULL, 'A' }, { "architecture", required_argument, NULL, 'A' },
{ "build-options", required_argument, NULL, '2' },
{ "built-with", required_argument, NULL, 'B' }, { "built-with", required_argument, NULL, 'B' },
{ "source-revisions", required_argument, NULL, 'G' }, { "changelog", required_argument, NULL, 'c'},
{ "compression", required_argument, NULL, '3' },
{ "config-files", required_argument, NULL, 'F' },
{ "conflicts", required_argument, NULL, 'C' }, { "conflicts", required_argument, NULL, 'C' },
{ "dependencies", required_argument, NULL, 'D' }, { "dependencies", required_argument, NULL, 'D' },
{ "config-files", required_argument, NULL, 'F' }, { "desc", required_argument, NULL, 's' },
{ "homepage", required_argument, NULL, 'H' },
{ "help", no_argument, NULL, 'h' }, { "help", no_argument, NULL, 'h' },
{ "homepage", required_argument, NULL, 'H' },
{ "license", required_argument, NULL, 'l' }, { "license", required_argument, NULL, 'l' },
{ "mutable-files", required_argument, NULL, 'M' }, { "long-desc", required_argument, NULL, 'S' },
{ "maintainer", required_argument, NULL, 'm' }, { "maintainer", required_argument, NULL, 'm' },
{ "mutable-files", required_argument, NULL, 'M' },
{ "pkgver", required_argument, NULL, 'n' }, { "pkgver", required_argument, NULL, 'n' },
{ "provides", required_argument, NULL, 'P' },
{ "preserve", no_argument, NULL, 'p' }, { "preserve", no_argument, NULL, 'p' },
{ "provides", required_argument, NULL, 'P' },
{ "quiet", no_argument, NULL, 'q' }, { "quiet", no_argument, NULL, 'q' },
{ "replaces", required_argument, NULL, 'R' }, { "replaces", required_argument, NULL, 'R' },
{ "reverts", required_argument, NULL, 'r' }, { "reverts", required_argument, NULL, 'r' },
{ "long-desc", required_argument, NULL, 'S' },
{ "desc", required_argument, NULL, 's' },
{ "tags", required_argument, NULL, 't' },
{ "version", no_argument, NULL, 'V' },
{ "shlib-provides", required_argument, NULL, '0' }, { "shlib-provides", required_argument, NULL, '0' },
{ "shlib-requires", required_argument, NULL, '1' }, { "shlib-requires", required_argument, NULL, '1' },
{ "build-options", required_argument, NULL, '2' }, { "source-revisions", required_argument, NULL, 'G' },
{ "compression", required_argument, NULL, '3' }, { "sourcepkg", required_argument, NULL, '5'},
{ "alternatives", required_argument, NULL, '4' }, { "tags", required_argument, NULL, 't' },
{ "changelog", required_argument, NULL, 'c'}, { "version", no_argument, NULL, 'V' },
{ NULL, 0, NULL, 0 } { NULL, 0, NULL, 0 }
}; };
struct archive *ar; struct archive *ar;
@ -864,7 +865,7 @@ main(int argc, char **argv)
const char *provides, *pkgver, *replaces, *reverts, *desc, *ldesc; const char *provides, *pkgver, *replaces, *reverts, *desc, *ldesc;
const char *arch, *config_files, *mutable_files, *version, *changelog; const char *arch, *config_files, *mutable_files, *version, *changelog;
const char *buildopts, *shlib_provides, *shlib_requires, *alternatives; const char *buildopts, *shlib_provides, *shlib_requires, *alternatives;
const char *compression, *tags = NULL, *srcrevs = NULL; const char *compression, *tags = NULL, *srcrevs = NULL, *sourcepkg = NULL;
char pkgname[XBPS_NAME_SIZE], *binpkg, *tname, *p, cwd[PATH_MAX-1]; char pkgname[XBPS_NAME_SIZE], *binpkg, *tname, *p, cwd[PATH_MAX-1];
bool quiet = false, preserve = false; bool quiet = false, preserve = false;
int c, pkg_fd; int c, pkg_fd;
@ -961,6 +962,9 @@ main(int argc, char **argv)
case '4': case '4':
alternatives = optarg; alternatives = optarg;
break; break;
case '5':
sourcepkg = optarg;
break;
case '?': case '?':
default: default:
usage(true); usage(true);
@ -1028,6 +1032,9 @@ main(int argc, char **argv)
if (srcrevs) if (srcrevs)
xbps_dictionary_set_cstring_nocopy(pkg_propsd, xbps_dictionary_set_cstring_nocopy(pkg_propsd,
"source-revisions", srcrevs); "source-revisions", srcrevs);
if (sourcepkg)
xbps_dictionary_set_cstring_nocopy(pkg_propsd,
"sourcepkg", sourcepkg);
if (tags) if (tags)
xbps_dictionary_set_cstring_nocopy(pkg_propsd, xbps_dictionary_set_cstring_nocopy(pkg_propsd,
"tags", tags); "tags", tags);