diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2023-02-01 11:42:00 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2023-02-01 11:42:00 +0200 |
commit | 724131b7e03934664621f86df2dc2285ff43dba8 (patch) | |
tree | 90902315be4120f2f328782e4aaa6188ec90da55 /bpkg/host-os-release.test.cxx | |
parent | f5bda2db551e38d62a49fa8c579e750060b60d59 (diff) |
Add host os_release facility
Diffstat (limited to 'bpkg/host-os-release.test.cxx')
-rw-r--r-- | bpkg/host-os-release.test.cxx | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/bpkg/host-os-release.test.cxx b/bpkg/host-os-release.test.cxx new file mode 100644 index 0000000..e65c3ca --- /dev/null +++ b/bpkg/host-os-release.test.cxx @@ -0,0 +1,55 @@ +// file : bpkg/host-os-release.test.cxx -*- C++ -*- +// license : MIT; see accompanying LICENSE file + +#include <bpkg/host-os-release.hxx> + +#include <bpkg/types.hxx> +#include <bpkg/utility.hxx> + +#include <iostream> + +#undef NDEBUG +#include <cassert> + +using namespace std; + +namespace bpkg +{ + extern os_release + host_os_release_linux (path f = {}); + + int + main (int argc, char* argv[]) + { + assert (argc >= 2); // <host-target-triplet> + + target_triplet host (argv[1]); + + os_release r; + if (host.class_ == "linux") + { + assert (argc == 3); // <host-target-triplet> <file-path> + r = host_os_release_linux (path (argv[2])); + } + else + assert (false); + + cout << r.name_id << '\n'; + for (auto b (r.like_ids.begin ()), i (b); i != r.like_ids.end (); ++i) + cout << (i != b ? "|" : "") << *i; + cout << '\n' + << r.version_id << '\n' + << r.variant_id << '\n' + << r.name << '\n' + << r.version_codename << '\n' + << r.variant << '\n'; + + return 0; + } +} + +int +main (int argc, char* argv[]) +{ + return bpkg::main (argc, argv); +} |