glog, bump version (#11667)

This commit is contained in:
Schrijvers Luc
2025-01-21 15:45:46 +01:00
committed by GitHub
parent 7ad722d209
commit b2e26e9e4c
3 changed files with 211 additions and 54 deletions

View File

@@ -7,7 +7,7 @@ COPYRIGHT="1999-2017 Google Inc.
LICENSE="BSD (3-clause)"
REVISION="1"
SOURCE_URI="https://github.com/google/glog/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="8a83bf982f37bb70825df71a9709fa90ea9f4447fb3c099e1d720a439d88bad6"
CHECKSUM_SHA256="00e4a87e87b7e7612f519a41e491f16623b12423620006f59f5688bfd8d13b08"
SOURCE_FILENAME="glog-v$portVersion.tar.gz"
PATCHES="glog-$portVersion.patchset"
@@ -23,6 +23,7 @@ PROVIDES="
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libgflags$secondaryArchSuffix
"
PROVIDES_devel="
@@ -35,6 +36,7 @@ REQUIRES_devel="
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:libgflags$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:cmake
@@ -43,13 +45,11 @@ BUILD_PREREQUIRES="
cmd:pkg_config$secondaryArchSuffix
"
defineDebugInfoPackage glog$secondaryArchSuffix \
$libDir/libglog.so.$libVersion
BUILD()
{
cmake -Bbuild -S. -DCMAKE_BUILD_TYPE=Release \
cmake -B build -S . -DCMAKE_BUILD_TYPE=Release \
$cmakeDirArgs
make -C build $jobArgs
}
@@ -57,9 +57,8 @@ INSTALL()
{
make -C build install
# rm $libDir/libglog.la
prepareInstalledDevelLib libglog
prepareInstalledDevelLib \
libglog
fixPkgconfig
# devel package
@@ -70,5 +69,5 @@ INSTALL()
TEST()
{
make -C build test
ctest --test-dir build --output-on-failure
}

View File

@@ -1,45 +0,0 @@
From d5f36e8fc4f110ecf1b43972b492dc614a56899f Mon Sep 17 00:00:00 2001
From: Begasus <begasus@gmail.com>
Date: Sat, 2 Sep 2023 18:12:29 +0200
Subject: Add Haiku to supported platforms
diff --git a/src/glog/platform.h b/src/glog/platform.h
index e614411..a97b9f2 100644
--- a/src/glog/platform.h
+++ b/src/glog/platform.h
@@ -50,6 +50,8 @@
#define GLOG_OS_NETBSD
#elif defined(__OpenBSD__)
#define GLOG_OS_OPENBSD
+#elif defined(__HAIKU__)
+#define GLOG_OS_HAIKU
#else
// TODO(hamaji): Add other platforms.
#error Platform not supported by glog. Please consider to contribute platform information by submitting a pull request on Github.
--
2.37.3
From aa7460fd9969e09df9e98bdd71ed73da5a002359 Mon Sep 17 00:00:00 2001
From: Begasus <begasus@gmail.com>
Date: Sat, 2 Sep 2023 18:37:03 +0200
Subject: Don't set CMAKE_POSITION_INDEPENDENT_CODE to ON
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 846b444..08bb9c8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -62,7 +62,7 @@ endif (NOT WITH_THREADS)
set (CMAKE_C_VISIBILITY_PRESET hidden)
set (CMAKE_CXX_VISIBILITY_PRESET hidden)
-set (CMAKE_POSITION_INDEPENDENT_CODE ON)
+set (CMAKE_POSITION_INDEPENDENT_CODE OFF)
set (CMAKE_VISIBILITY_INLINES_HIDDEN ON)
set (CMAKE_DEBUG_POSTFIX d)
--
2.37.3

View File

@@ -0,0 +1,203 @@
From 488568eded70567e5ac0f81f2bd8da434bccd5ff Mon Sep 17 00:00:00 2001
From: Begasus <begasus@gmail.com>
Date: Sat, 2 Sep 2023 18:12:29 +0200
Subject: Add Haiku to supported platforms
diff --git a/src/glog/platform.h b/src/glog/platform.h
index efb6ff9..0efadfa 100644
--- a/src/glog/platform.h
+++ b/src/glog/platform.h
@@ -53,6 +53,8 @@
# define GLOG_OS_OPENBSD
#elif defined(__EMSCRIPTEN__)
# define GLOG_OS_EMSCRIPTEN
+#elif defined(__HAIKU__)
+#define GLOG_OS_HAIKU
#else
// TODO(hamaji): Add other platforms.
#error Platform not supported by glog. Please consider to contribute platform information by submitting a pull request on Github.
--
2.45.2
From e0f2e27615af1f99b262c97c6813d0fc8d9c4a73 Mon Sep 17 00:00:00 2001
From: Begasus <begasus@gmail.com>
Date: Sat, 2 Sep 2023 18:37:03 +0200
Subject: Don't set CMAKE_POSITION_INDEPENDENT_CODE to ON
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 45064ab..4c17072 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -58,7 +58,7 @@ endif (NOT WITH_GTEST)
set (CMAKE_C_VISIBILITY_PRESET hidden)
set (CMAKE_CXX_VISIBILITY_PRESET hidden)
-set (CMAKE_POSITION_INDEPENDENT_CODE ON)
+set (CMAKE_POSITION_INDEPENDENT_CODE OFF)
set (CMAKE_VISIBILITY_INLINES_HIDDEN ON)
set (CMAKE_DEBUG_POSTFIX d)
--
2.45.2
From 3885d43515369541edc5a909cc23fb89781c6fe3 Mon Sep 17 00:00:00 2001
From: Schrijvers Luc <begasus@gmail.com>
Date: Sun, 19 Jan 2025 09:14:20 +0100
Subject: Fix path for cmd:true
diff --git a/src/logging_unittest.cc b/src/logging_unittest.cc
index 321f38f..69d166a 100644
--- a/src/logging_unittest.cc
+++ b/src/logging_unittest.cc
@@ -1544,7 +1544,7 @@ TEST(LogMsgTime, gmtoff) {
TEST(EmailLogging, ValidAddress) {
FlagSaver saver;
- FLAGS_logmailer = "/usr/bin/true";
+ FLAGS_logmailer = "/bin/true";
EXPECT_TRUE(
SendEmail("example@example.com", "Example subject", "Example body"));
@@ -1552,7 +1552,7 @@ TEST(EmailLogging, ValidAddress) {
TEST(EmailLogging, MultipleAddresses) {
FlagSaver saver;
- FLAGS_logmailer = "/usr/bin/true";
+ FLAGS_logmailer = "/bin/true";
EXPECT_TRUE(SendEmail("example@example.com,foo@bar.com", "Example subject",
"Example body"));
@@ -1560,14 +1560,14 @@ TEST(EmailLogging, MultipleAddresses) {
TEST(EmailLogging, InvalidAddress) {
FlagSaver saver;
- FLAGS_logmailer = "/usr/bin/true";
+ FLAGS_logmailer = "/bin/true";
EXPECT_FALSE(SendEmail("hello world@foo", "Example subject", "Example body"));
}
TEST(EmailLogging, MaliciousAddress) {
FlagSaver saver;
- FLAGS_logmailer = "/usr/bin/true";
+ FLAGS_logmailer = "/bin/true";
EXPECT_FALSE(
SendEmail("!/bin/true@example.com", "Example subject", "Example body"));
--
2.45.2
From 5a7faf382ddea8465f383348496bcafda624d283 Mon Sep 17 00:00:00 2001
From: Schrijvers Luc <begasus@gmail.com>
Date: Sun, 19 Jan 2025 09:37:01 +0100
Subject: Fix test, kudos to Debian
https://sources.debian.org/patches/google-glog/0.7.1-1/20120621_errnos.diff/
diff --git a/src/googletest.h b/src/googletest.h
index 33af3fe..1f69a19 100644
--- a/src/googletest.h
+++ b/src/googletest.h
@@ -480,6 +480,18 @@ static inline void StringReplace(string* str, const string& oldsub,
}
}
+static inline void IntReplace(string* str,
+ const string& oldsub,
+ int newsub) {
+ size_t pos = str->find(oldsub);
+ if (pos != string::npos) {
+ std::ostringstream ss;
+ ss << newsub;
+ const std::string x = ss.str();
+ str->replace(pos, oldsub.size(), x.c_str());
+ }
+}
+
static inline string Munge(const string& filename) {
std::unique_ptr<FILE> fp{fopen(filename.c_str(), "rb")};
CHECK(fp != nullptr) << filename << ": couldn't open";
@@ -499,9 +511,13 @@ static inline string Munge(const string& filename) {
StringReplace(&line, "__SUCCESS__", StrError(0));
StringReplace(&line, "__ENOENT__", StrError(ENOENT));
+ IntReplace(&line, "__ENOENT_NUM__", ENOENT);
StringReplace(&line, "__EINTR__", StrError(EINTR));
+ IntReplace(&line, "__EINTR_NUM__", EINTR);
StringReplace(&line, "__ENXIO__", StrError(ENXIO));
+ IntReplace(&line, "__ENXIO_NUM__", ENXIO);
StringReplace(&line, "__ENOEXEC__", StrError(ENOEXEC));
+ IntReplace(&line, "__ENOEXEC_NUM__", ENOEXEC);
result += line + "\n";
}
return result;
diff --git a/src/logging_unittest.cc b/src/logging_unittest.cc
index 69d166a..5b11679 100644
--- a/src/logging_unittest.cc
+++ b/src/logging_unittest.cc
@@ -98,6 +98,17 @@ void SetExitOnDFatal(bool value);
} // namespace base
} // namespace google
+static int errnoForIteration(int i) {
+ switch (i) {
+ case 0: return 0;
+ case 2: return ENOENT;
+ case 4: return EINTR;
+ case 6: return ENXIO;
+ case 8: return ENOEXEC;
+ }
+ return -1;
+}
+
static void TestLogging(bool check_counts);
static void TestRawLogging();
static void LogWithLevels(int v, int severity, bool err, bool alsoerr);
@@ -311,7 +322,7 @@ void TestLogging(bool check_counts) {
LOG(INFO) << string("foo ") << "bar " << 10 << ' ' << 3.4;
for (int i = 0; i < 10; ++i) {
int old_errno = errno;
- errno = i;
+ errno = errnoForIteration(i);
PLOG_EVERY_N(ERROR, 2) << "Plog every 2, iteration " << COUNTER;
errno = old_errno;
diff --git a/src/logging_unittest.err b/src/logging_unittest.err
index 21517cb..6eef6dd 100644
--- a/src/logging_unittest.err
+++ b/src/logging_unittest.err
@@ -51,21 +51,21 @@ WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log if every 5, iteration 1
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log if every 1, iteration 1
EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log if less than 3 every 2, iteration 1
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log if every 1, iteration 2
-EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Plog every 2, iteration 3: __ENOENT__ [2]
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Plog every 2, iteration 3: ENOENT [ENOENT_NUM]
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log if every 1, iteration 3
EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log if less than 3 every 2, iteration 3
EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log every 3, iteration 4
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log if every 1, iteration 4
-EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Plog every 2, iteration 5: __EINTR__ [4]
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Plog every 2, iteration 5: __EINTR__ [ENOENT_NUM]
EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log every 4, iteration 5
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log if every 1, iteration 5
WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log if every 5, iteration 6
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log if every 1, iteration 6
-EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Plog every 2, iteration 7: __ENXIO__ [6]
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Plog every 2, iteration 7: __ENXIO__ [ENOENT_NUM]
EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log every 3, iteration 7
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log if every 1, iteration 7
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log if every 1, iteration 8
-EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Plog every 2, iteration 9: __ENOEXEC__ [8]
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Plog every 2, iteration 9: __ENOEXEC__ [ENOENT_NUM]
EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log every 4, iteration 9
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log if every 1, iteration 9
EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log every 3, iteration 10
--
2.45.2