diff --git a/bin/xbps-create/main.c b/bin/xbps-create/main.c index 1ff0640cf..7ff90df9c 100644 --- a/bin/xbps-create/main.c +++ b/bin/xbps-create/main.c @@ -784,7 +784,7 @@ process_archive(struct archive *ar, int 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:a:V"; const struct option longopts[] = { { "architecture", required_argument, NULL, 'A' }, { "built-with", required_argument, NULL, 'B' }, @@ -813,6 +813,7 @@ main(int argc, char **argv) { "compression", required_argument, NULL, '3' }, { "alternatives", required_argument, NULL, '4' }, { "changelog", required_argument, NULL, 'c'}, + { "abi", required_argument, NULL, 'a'}, { NULL, 0, NULL, 0 } }; struct archive *ar; @@ -823,7 +824,7 @@ main(int argc, char **argv) const char *provides, *pkgver, *replaces, *reverts, *desc, *ldesc; const char *arch, *config_files, *mutable_files, *version, *changelog; const char *buildopts, *shlib_provides, *shlib_requires, *alternatives; - const char *compression, *tags = NULL, *srcrevs = NULL; + const char *compression, *tags, *srcrevs, *abi; char pkgname[XBPS_NAME_SIZE], *binpkg, *tname, *p, cwd[PATH_MAX-1]; bool quiet = false, preserve = false; int c, pkg_fd; @@ -833,6 +834,7 @@ main(int argc, char **argv) provides = pkgver = replaces = reverts = desc = ldesc = bwith = NULL; buildopts = config_files = mutable_files = shlib_provides = NULL; alternatives = shlib_requires = changelog = NULL; + tags = srcrevs = abi = NULL; while ((c = getopt_long(argc, argv, shortopts, longopts, NULL)) != -1) { if (optarg && strcmp(optarg, "") == 0) @@ -920,6 +922,9 @@ main(int argc, char **argv) case '4': alternatives = optarg; break; + case 'a': + abi = optarg; + break; case '?': default: usage(true); @@ -997,6 +1002,9 @@ main(int argc, char **argv) if (changelog) xbps_dictionary_set_cstring_nocopy(pkg_propsd, "changelog", changelog); + if (abi) + xbps_dictionary_set_cstring_nocopy(pkg_propsd, + "abi", abi); /* Optional arrays */ process_array("run_depends", deps); diff --git a/tests/xbps/xbps-create/basic_test.sh b/tests/xbps/xbps-create/basic_test.sh index a98b21f37..c7880be98 100644 --- a/tests/xbps/xbps-create/basic_test.sh +++ b/tests/xbps/xbps-create/basic_test.sh @@ -179,6 +179,25 @@ reject_fifo_file_body() { atf_check_equal $? 1 } +atf_test_case set_abi + +set_abi_head() { + atf_set "descr" "xbps-create(1): create package with abi field" +} + +set_abi_body() { + mkdir -p repo pkg_A/usr/include/gsm + touch -f pkg_A/usr/include/gsm/gsm.h + cd repo + xbps-create -A noarch -n foo-1.0_1 -s "foo pkg" -a 1 ../pkg_A + atf_check_equal $? 0 + cd .. + xbps-rindex -d -a repo/*.xbps + atf_check_equal $? 0 + rv="$(xbps-query -r root --repository=repo -p abi foo)" + atf_check_equal $rv 1 +} + atf_init_test_cases() { atf_add_test_case hardlinks_size atf_add_test_case symlink_relative_target @@ -187,4 +206,5 @@ atf_init_test_cases() { atf_add_test_case restore_mtime atf_add_test_case reproducible_pkg atf_add_test_case reject_fifo_file + atf_add_test_case set_abi }