diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2023-01-16 13:53:43 +0200 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2023-01-16 16:22:15 +0300 |
commit | 8e20c1ed163be60cb576b5ad8f5d27b6320154a6 (patch) | |
tree | bde57b0b18400d37f87df53d6889838ab592e4cd /bpkg/host-os-release.test.cxx | |
parent | c7e76c23b49c423f352b283c7afba248b4ce77e9 (diff) |
Add 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); +} |