crash_reporter: Update to use the os-release.d configs
The product_id and product_version has been moved into the /etc/os-release.d key-value store, update crash_reporter to use these values. Bug: 22874192 Change-Id: I71886574d1aa4e0a3ac18e1c361ec65684af9b49
This commit is contained in:
parent
7d85a6a568
commit
72e3c828dc
2 changed files with 23 additions and 36 deletions
|
@ -298,8 +298,8 @@ send_crash() {
|
|||
local log="$(get_key_value "${meta_path}" "log")"
|
||||
local sig="$(get_key_value "${meta_path}" "sig")"
|
||||
local send_payload_size="$(stat -c "%s" "${report_payload}" 2>/dev/null)"
|
||||
local product="$(get_key_value "${meta_path}" "upload_var_prod")"
|
||||
local version="$(get_key_value "${meta_path}" "upload_var_ver")"
|
||||
local product="$(get_key_value "${meta_path}" "product_id")"
|
||||
local version="$(get_key_value "${meta_path}" "product_version")"
|
||||
local upload_prefix="$(get_key_value "${meta_path}" "upload_prefix")"
|
||||
local guid
|
||||
local model_manifest_id="$(get_key_value "${WEAVE_CONF_FILE}" "model_id")"
|
||||
|
@ -350,25 +350,6 @@ send_crash() {
|
|||
esac
|
||||
done
|
||||
|
||||
# When uploading Chrome reports we need to report the right product and
|
||||
# version. If the meta file does not specify it, use GOOGLE_CRASH_ID
|
||||
# as the product and GOOGLE_CRASH_VERSION_ID as the version.
|
||||
if [ "${product}" = "undefined" ]; then
|
||||
product="$(get_key_value /etc/os-release 'GOOGLE_CRASH_ID')"
|
||||
fi
|
||||
if [ "${version}" = "undefined" ]; then
|
||||
version="$(get_key_value /etc/os-release 'GOOGLE_CRASH_VERSION_ID')"
|
||||
fi
|
||||
|
||||
# If GOOGLE_CRASH_* is undefined, we look for ID and VERSION_ID in
|
||||
# /etc/os-release.
|
||||
if [ "${product}" = "undefined" ]; then
|
||||
product="$(get_key_value /etc/os-release 'ID')"
|
||||
fi
|
||||
if [ "${version}" = "undefined" ]; then
|
||||
version="$(get_key_value /etc/os-release 'VERSION_ID')"
|
||||
fi
|
||||
|
||||
# If ID or VERSION_ID is undefined, we use the default product name
|
||||
# and bdk_version from /etc/os-release.d.
|
||||
if [ "${product}" = "undefined" ]; then
|
||||
|
@ -408,6 +389,7 @@ send_crash() {
|
|||
lecho " Metadata: ${meta_path} (${kind})"
|
||||
lecho " Payload: ${report_payload}"
|
||||
lecho " Version: ${version}"
|
||||
lecho " Bdk Version: ${bdk_version}"
|
||||
[ -n "${image_type}" ] && lecho " Image type: ${image_type}"
|
||||
[ -n "${boot_mode}" ] && lecho " Boot mode: ${boot_mode}"
|
||||
if is_mock; then
|
||||
|
|
|
@ -59,13 +59,10 @@ static const gid_t kUnknownGid = -1;
|
|||
const char *UserCollector::kUserId = "Uid:\t";
|
||||
const char *UserCollector::kGroupId = "Gid:\t";
|
||||
|
||||
// The property containing the OS version.
|
||||
const char kVersionProperty[] = "ro.build.id";
|
||||
|
||||
// The property containing the product id.
|
||||
const char kProductIDProperty[] = "ro.product.product_id";
|
||||
|
||||
// Product information keys in the /etc/os-release.d folder.
|
||||
static const char kBdkVersionKey[] = "bdk_version";
|
||||
static const char kProductIDKey[] = "product_id";
|
||||
static const char kProductVersionKey[] = "product_version";
|
||||
|
||||
|
||||
using base::FilePath;
|
||||
|
@ -508,20 +505,28 @@ UserCollector::ErrorType UserCollector::ConvertAndEnqueueCrash(
|
|||
if (GetLogContents(FilePath(log_config_path_), exec, log_path))
|
||||
AddCrashMetaData("log", log_path.value());
|
||||
|
||||
char value[PROPERTY_VALUE_MAX];
|
||||
property_get(kVersionProperty, value, "undefined");
|
||||
AddCrashMetaUploadData("ver", value);
|
||||
property_get(kProductIDProperty, value, "undefined");
|
||||
AddCrashMetaUploadData("prod", value);
|
||||
|
||||
brillo::OsReleaseReader reader;
|
||||
reader.Load();
|
||||
std::string bdk_version = "undefined";
|
||||
if (!reader.GetString(kBdkVersionKey, &bdk_version)) {
|
||||
std::string value = "undefined";
|
||||
if (!reader.GetString(kBdkVersionKey, &value)) {
|
||||
LOG(ERROR) << "Could not read " << kBdkVersionKey
|
||||
<< " from /etc/os-release.d/";
|
||||
}
|
||||
AddCrashMetaData(kBdkVersionKey, bdk_version);
|
||||
AddCrashMetaData(kBdkVersionKey, value);
|
||||
|
||||
value = "undefined";
|
||||
if (!reader.GetString(kProductIDKey, &value)) {
|
||||
LOG(ERROR) << "Could not read " << kProductIDKey
|
||||
<< " from /etc/os-release.d/";
|
||||
}
|
||||
AddCrashMetaData(kProductIDKey, value);
|
||||
|
||||
value = "undefined";
|
||||
if (!reader.GetString(kProductVersionKey, &value)) {
|
||||
LOG(ERROR) << "Could not read " << kProductVersionKey
|
||||
<< " from /etc/os-release.d/";
|
||||
}
|
||||
AddCrashMetaData(kProductVersionKey, value);
|
||||
|
||||
ErrorType error_type =
|
||||
ConvertCoreToMinidump(pid, container_dir, core_path, minidump_path);
|
||||
|
|
Loading…
Reference in a new issue