From 15b27549a81dcfd0e4518f433e6d74a78ecbea80 Mon Sep 17 00:00:00 2001 From: Joey Parrish Date: Fri, 9 Feb 2024 20:57:12 -0800 Subject: [PATCH] chore: Upgrade absl and protobuf (#1337) protobuf depends on absl, so both needed an update. Updating absl fixes issues on Alpine 3.19 (see PR #1327), and also removes the need for hacks around vlog flags. --- packager/CMakeLists.txt | 4 -- packager/app/mpd_generator.cc | 3 - packager/app/packager_main.cc | 3 - packager/app/vlog_flags.cc | 72 ------------------- packager/app/vlog_flags.h | 17 ----- packager/macros/logging.h | 16 ----- .../third_party/abseil-cpp/CMakeLists.txt | 3 + packager/third_party/abseil-cpp/source | 2 +- packager/third_party/protobuf/CMakeLists.txt | 3 +- packager/third_party/protobuf/source | 2 +- 10 files changed, 6 insertions(+), 119 deletions(-) delete mode 100644 packager/app/vlog_flags.cc delete mode 100644 packager/app/vlog_flags.h diff --git a/packager/CMakeLists.txt b/packager/CMakeLists.txt index 1381bb65e1..42a6cec21c 100644 --- a/packager/CMakeLists.txt +++ b/packager/CMakeLists.txt @@ -170,8 +170,6 @@ add_executable(packager app/stream_descriptor.h app/validate_flag.cc app/validate_flag.h - app/vlog_flags.cc - app/vlog_flags.h app/widevine_encryption_flags.cc app/widevine_encryption_flags.h ) @@ -190,8 +188,6 @@ target_link_libraries(packager add_executable(mpd_generator app/mpd_generator.cc app/mpd_generator_flags.h - app/vlog_flags.cc - app/vlog_flags.h ) target_link_libraries(mpd_generator absl::flags diff --git a/packager/app/mpd_generator.cc b/packager/app/mpd_generator.cc index 757a62c4f2..ee9de0f810 100644 --- a/packager/app/mpd_generator.cc +++ b/packager/app/mpd_generator.cc @@ -21,7 +21,6 @@ #include #include -#include #include #include #include @@ -124,8 +123,6 @@ int MpdMain(int argc, char** argv) { return status; } - handle_vlog_flags(); - absl::InitializeLog(); if (!absl::GetFlag(FLAGS_test_packager_version).empty()) diff --git a/packager/app/packager_main.cc b/packager/app/packager_main.cc index 9e12798d60..99ad69e84c 100644 --- a/packager/app/packager_main.cc +++ b/packager/app/packager_main.cc @@ -34,7 +34,6 @@ #include #include #include -#include #include #include #include @@ -564,8 +563,6 @@ int PackagerMain(int argc, char** argv) { absl::SetMinLogLevel(absl::LogSeverityAtLeast::kWarning); } - handle_vlog_flags(); - absl::InitializeLog(); if (!ValidateWidevineCryptoFlags() || !ValidateRawKeyCryptoFlags() || diff --git a/packager/app/vlog_flags.cc b/packager/app/vlog_flags.cc deleted file mode 100644 index fe1b82b966..0000000000 --- a/packager/app/vlog_flags.cc +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2015 Google LLC. All rights reserved. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file or at -// https://developers.google.com/open-source/licenses/bsd -// -// Defines verbose logging flags. - -#include - -#include -#include -#include - -#include -#include - -ABSL_FLAG(int, - v, - 0, - "Show all VLOG(m) or DVLOG(m) messages for m <= this. " - "Overridable by --vmodule."); - -ABSL_FLAG( - std::string, - vmodule, - "", - "Per-module verbose level. THIS FLAG IS DEPRECATED. " - "Argument is a comma-separated list of =. " - "The logging system no longer supports different levels for different " - "modules, so the verbosity level will be set to the maximum specified for " - "any module or given by --v."); - -ABSL_DECLARE_FLAG(int, minloglevel); - -namespace shaka { - -void handle_vlog_flags() { - // Reference the log level flag to keep the absl::log flags from getting - // stripped from the executable. - int log_level = absl::GetFlag(FLAGS_minloglevel); - (void)log_level; - - int vlog_level = absl::GetFlag(FLAGS_v); - std::string vmodule_patterns = absl::GetFlag(FLAGS_vmodule); - - if (!vmodule_patterns.empty()) { - std::vector patterns = - SplitStringIntoKeyValuePairs(vmodule_patterns, '=', ','); - int pattern_vlevel; - bool warning_shown = false; - - for (const auto& pattern : patterns) { - if (!warning_shown) { - LOG(WARNING) << "--vmodule ignored, combined with --v!"; - warning_shown = true; - } - - if (!::absl::SimpleAtoi(pattern.second, &pattern_vlevel)) { - LOG(ERROR) << "Error parsing log level for '" << pattern.first - << "' from '" << pattern.second << "'"; - continue; - } - } - } - - if (vlog_level != 0) { - absl::SetMinLogLevel(static_cast(-vlog_level)); - } -} - -} // namespace shaka diff --git a/packager/app/vlog_flags.h b/packager/app/vlog_flags.h deleted file mode 100644 index 59365bdf1c..0000000000 --- a/packager/app/vlog_flags.h +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015 Google LLC. All rights reserved. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file or at -// https://developers.google.com/open-source/licenses/bsd - -#ifndef APP_VLOG_FLAGS_H_ -#define APP_VLOG_FLAGS_H_ - -#include -#include - -namespace shaka { -void handle_vlog_flags(); -} - -#endif // APP_VLOG_FLAGS_H_ diff --git a/packager/macros/logging.h b/packager/macros/logging.h index 00be3041b4..ebec01bf46 100644 --- a/packager/macros/logging.h +++ b/packager/macros/logging.h @@ -14,20 +14,4 @@ /// You can use the insertion operator to add specific logs to this. #define NOTIMPLEMENTED() LOG(ERROR) << "NOTIMPLEMENTED: " -#define VLOG(verboselevel) \ - LOG(LEVEL(static_cast(-verboselevel))) - -#define VLOG_IS_ON(verboselevel) \ - (static_cast(absl::MinLogLevel()) <= -verboselevel) - -#ifndef NDEBUG -#define DVLOG(verboselevel) VLOG(verboselevel) -#else -// We need this expression to work with << after it, so this is a simple way to -// turn DVLOG into a no-op in release builds. -#define DVLOG(verboselevel) \ - if (false) \ - VLOG(verboselevel) -#endif - #endif // PACKAGER_MACROS_LOGGING_H_ diff --git a/packager/third_party/abseil-cpp/CMakeLists.txt b/packager/third_party/abseil-cpp/CMakeLists.txt index e3bdc48859..b13a168386 100644 --- a/packager/third_party/abseil-cpp/CMakeLists.txt +++ b/packager/third_party/abseil-cpp/CMakeLists.txt @@ -13,5 +13,8 @@ set(ABSL_PROPAGATE_CXX_STD ON) # for one in the system. set(ABSL_USE_EXTERNAL_GOOGLETEST ON) +# Disable internal debugging features. +add_definitions(-DNDEBUG) + # With these set in scope of this folder, load the library's own CMakeLists.txt. add_subdirectory(source) diff --git a/packager/third_party/abseil-cpp/source b/packager/third_party/abseil-cpp/source index c2435f8342..4a2c63365e 160000 --- a/packager/third_party/abseil-cpp/source +++ b/packager/third_party/abseil-cpp/source @@ -1 +1 @@ -Subproject commit c2435f8342c2d0ed8101cb43adfd605fdc52dca2 +Subproject commit 4a2c63365eff8823a5221db86ef490e828306f9d diff --git a/packager/third_party/protobuf/CMakeLists.txt b/packager/third_party/protobuf/CMakeLists.txt index 1fd52d4b9f..0e7e4d511b 100644 --- a/packager/third_party/protobuf/CMakeLists.txt +++ b/packager/third_party/protobuf/CMakeLists.txt @@ -25,8 +25,7 @@ set(ABSL_ROOT_DIR get_filename_component(ABSOLUTE_PATH ../abseil-cpp/source ABSO # Make sure protoc links against the same MSVC runtime as internal libs. set(protobuf_MSVC_STATIC_RUNTIME OFF) -# Disable internal debugging features, which end up triggering further compiler -# errors. +# Disable internal debugging features. add_definitions(-DNDEBUG) # With these set in scope of this folder, load the library's own CMakeLists.txt. diff --git a/packager/third_party/protobuf/source b/packager/third_party/protobuf/source index 2c5fa078d8..a9b006bddd 160000 --- a/packager/third_party/protobuf/source +++ b/packager/third_party/protobuf/source @@ -1 +1 @@ -Subproject commit 2c5fa078d8e86e5f4bd34e6f4c9ea9e8d7d4d44a +Subproject commit a9b006bddd52e289029f16aa77b77e8e0033d9ee