diff --git a/Makefile b/Makefile index 54a9382f610..f17f0364645 100644 --- a/Makefile +++ b/Makefile @@ -515,6 +515,7 @@ $(eval $(call build-package,libmilter,1.0.2-r0)) $(eval $(call build-package,telegraf,1.26.0-r0)) $(eval $(call build-package,dotnet-7,7.0.104-r0)) $(eval $(call build-package,gtest,1.13.0-r0)) +$(eval $(call build-package,libpsl-native,7.3.1-r0)) .build-packages: ${PACKAGES} diff --git a/libpsl-native.yaml b/libpsl-native.yaml new file mode 100644 index 00000000000..25160f286ee --- /dev/null +++ b/libpsl-native.yaml @@ -0,0 +1,35 @@ +package: + name: libpsl-native + version: 7.3.1 + epoch: 0 + description: this library provides functionality missing from .NET Core via system calls + copyright: + - license: MIT + +environment: + contents: + packages: + - wolfi-base + - build-base + - cmake + - gtest-dev + +pipeline: + - uses: fetch + with: + expected-sha256: e91d2b38eab73bac957f71c9acd96cf74dab98e4f0fafbfa1491854272b770fc + uri: https://github.com/PowerShell/PowerShell-Native/archive/refs/tags/v${{package.version}}.tar.gz + - working-directory: /home/build/src/libpsl-native + pipeline: + - uses: patch + with: + patches: /home/build/fix-testing-suite.patch + - uses: cmake/configure + with: + # Force use of C++17 because the build system defaults to using C++11, which is too + # old for modern GTest. + opts: -DCMAKE_CXX_STANDARD=17 -DCMAKE_CXX_STANDARD_REQUIRED=ON + - uses: cmake/build + - working-directory: /home/build/src/powershell-unix + runs: | + install -Dm755 libpsl-native.so "${{targets.destdir}}"/usr/lib/libpsl-native.so diff --git a/libpsl-native/fix-testing-suite.patch b/libpsl-native/fix-testing-suite.patch new file mode 100644 index 00000000000..a39844f2c22 --- /dev/null +++ b/libpsl-native/fix-testing-suite.patch @@ -0,0 +1,311 @@ +From cd97fc1211e5332b9f15a7027d5dcdd0d88b4c10 Mon Sep 17 00:00:00 2001 +From: Antoine Martin +Date: Sat, 13 Aug 2022 23:38:11 -0400 +Subject: [PATCH 1/1] fix-check + +Various fixes for testing suite to work within aport context + +--- + src/libpsl-native/test/CMakeLists.txt | 2 - + .../test/test-getcommonlstat.cpp | 44 ++++++++--------- + src/libpsl-native/test/test-getcommonstat.cpp | 48 +++++++++---------- + 3 files changed, 46 insertions(+), 48 deletions(-) + +diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt +index 9d3f4f5..70f526b 100644 +--- a/test/CMakeLists.txt ++++ b/test/CMakeLists.txt +@@ -1,5 +1,3 @@ +-add_subdirectory(googletest) +- + add_executable(psl-native-test + test-getfileowner.cpp + test-locale.cpp +diff --git a/test/test-getcommonlstat.cpp b/test/test-getcommonlstat.cpp +index ad73e9a..872bc58 100644 +--- a/test/test-getcommonlstat.cpp ++++ b/test/test-getcommonlstat.cpp +@@ -40,9 +40,9 @@ TEST(GetCommonLStat, GetOwnerIdOfRoot) + FILE *p; + CommonStat cs; + #if defined (__APPLE__) +- p = popen("/usr/bin/stat -f %u /", "r"); ++ p = popen("/bin/stat -f %u /", "r"); + #else +- p = popen("/usr/bin/stat -c %u /", "r"); ++ p = popen("/bin/stat -c %u /", "r"); + #endif + int uid = -1; + int result = fscanf(p, "%d", &uid); +@@ -57,9 +57,9 @@ TEST(GetCommonLStat, GetGroupId) + FILE *p; + CommonStat cs; + #if defined (__APPLE__) +- p = popen("/usr/bin/stat -f %g /", "r"); ++ p = popen("/bin/stat -f %g /", "r"); + #else +- p = popen("/usr/bin/stat -c %g /", "r"); ++ p = popen("/bin/stat -c %g /", "r"); + #endif + int gid = -1; + int result = fscanf(p, "%d", &gid); +@@ -74,9 +74,9 @@ TEST(GetCommonLStat, GetInodeNumber) + FILE *p; + CommonStat cs; + #if defined (__APPLE__) +- p = popen("/usr/bin/stat -f %i /", "r"); ++ p = popen("/bin/stat -f %i /", "r"); + #else +- p = popen("/usr/bin/stat -c %i /", "r"); ++ p = popen("/bin/stat -c %i /", "r"); + #endif + long inode = -1; + int result = fscanf(p, "%ld", &inode); +@@ -91,9 +91,9 @@ TEST(GetCommonLStat, GetSize) + FILE *p; + CommonStat cs; + #if defined (__APPLE__) +- p = popen("/usr/bin/stat -f %z /", "r"); ++ p = popen("/bin/stat -f %z /", "r"); + #else +- p = popen("/usr/bin/stat -c %s /", "r"); ++ p = popen("/bin/stat -c %s /", "r"); + #endif + long size = -1; + int result = fscanf(p, "%ld", &size); +@@ -108,9 +108,9 @@ TEST(GetCommonLStat, GetBlockSize) + FILE *p; + CommonStat cs; + #if defined (__APPLE__) +- p = popen("/usr/bin/stat -f %k /", "r"); ++ p = popen("/bin/stat -f %k /", "r"); + #else +- p = popen("/usr/bin/stat -c %o /", "r"); ++ p = popen("/bin/stat -c %o /", "r"); + #endif + long bSize = -1; + int result = fscanf(p, "%ld", &bSize); +@@ -125,9 +125,9 @@ TEST(GetCommonLStat, GetBlockCount) + FILE *p; + CommonStat cs; + #if defined (__APPLE__) +- p = popen("/usr/bin/stat -f %b /", "r"); ++ p = popen("/bin/stat -f %b /", "r"); + #else +- p = popen("/usr/bin/stat -c %b /", "r"); ++ p = popen("/bin/stat -c %b /", "r"); + #endif + int bSize = -1; + int result = fscanf(p, "%d", &bSize); +@@ -142,9 +142,9 @@ TEST(GetCommonLStat, GetLinkCount) + FILE *p; + CommonStat cs; + #if defined (__APPLE__) +- p = popen("/usr/bin/stat -f %l /", "r"); ++ p = popen("/bin/stat -f %l /", "r"); + #else +- p = popen("/usr/bin/stat -c %h /", "r"); ++ p = popen("/bin/stat -c %h /", "r"); + #endif + int linkcount = -1; + int result = fscanf(p, "%d", &linkcount); +@@ -159,9 +159,9 @@ TEST(GetCommonLStat, GetDeviceId) + FILE *p; + CommonStat cs; + #if defined (__APPLE__) +- p = popen("/usr/bin/stat -f %d /", "r"); ++ p = popen("/bin/stat -f %d /", "r"); + #else +- p = popen("/usr/bin/stat -c %d /", "r"); ++ p = popen("/bin/stat -c %d /", "r"); + #endif + int deviceId = -1; + int result = fscanf(p, "%d", &deviceId); +@@ -176,9 +176,9 @@ TEST(GetCommonLStat, GetATime) + FILE *p; + CommonStat cs; + #if defined (__APPLE__) +- p = popen("/usr/bin/stat -f %a /", "r"); ++ p = popen("/bin/stat -f %a /", "r"); + #else +- p = popen("/usr/bin/stat -c %X /", "r"); ++ p = popen("/bin/stat -c %X /", "r"); + #endif + long aTime = -1; + int result = fscanf(p, "%ld", &aTime); +@@ -193,9 +193,9 @@ TEST(GetCommonLStat, GetMTime) + FILE *p; + CommonStat cs; + #if defined (__APPLE__) +- p = popen("/usr/bin/stat -f %m /", "r"); ++ p = popen("/bin/stat -f %m /", "r"); + #else +- p = popen("/usr/bin/stat -c %Y /", "r"); ++ p = popen("/bin/stat -c %Y /", "r"); + #endif + long mTime = -1; + int result = fscanf(p, "%ld", &mTime); +@@ -210,9 +210,9 @@ TEST(GetCommonLStat, GetCTime) + FILE *p; + CommonStat cs; + #if defined (__APPLE__) +- p = popen("/usr/bin/stat -f %c /", "r"); ++ p = popen("/bin/stat -f %c /", "r"); + #else +- p = popen("/usr/bin/stat -c %Z /", "r"); ++ p = popen("/bin/stat -c %Z /", "r"); + #endif + long cTime = -1; + int result = fscanf(p, "%ld", &cTime); +diff --git a/test/test-getcommonstat.cpp b/test/test-getcommonstat.cpp +index 7407fc3..5d7f6d0 100644 +--- a/test/test-getcommonstat.cpp ++++ b/test/test-getcommonstat.cpp +@@ -42,9 +42,9 @@ TEST(GetCommonStat, GetOwnerIdOfRoot) + FILE *p; + CommonStat cs; + #if defined (__APPLE__) +- p = popen("/usr/bin/stat -f %u /", "r"); ++ p = popen("/bin/stat -f %u /", "r"); + #else +- p = popen("/usr/bin/stat -c %u /", "r"); ++ p = popen("/bin/stat -c %u /", "r"); + #endif + int uid = -1; + int result = fscanf(p, "%d", &uid); +@@ -59,9 +59,9 @@ TEST(GetCommonStat, GetGroupId) + FILE *p; + CommonStat cs; + #if defined (__APPLE__) +- p = popen("/usr/bin/stat -f %g /", "r"); ++ p = popen("/bin/stat -f %g /", "r"); + #else +- p = popen("/usr/bin/stat -c %g /", "r"); ++ p = popen("/bin/stat -c %g /", "r"); + #endif + int gid = -1; + int result = fscanf(p, "%d", &gid); +@@ -76,9 +76,9 @@ TEST(GetCommonStat, GetInodeNumber) + FILE *p; + CommonStat cs; + #if defined (__APPLE__) +- p = popen("/usr/bin/stat -f %i /", "r"); ++ p = popen("/bin/stat -f %i /", "r"); + #else +- p = popen("/usr/bin/stat -c %i /", "r"); ++ p = popen("/bin/stat -c %i /", "r"); + #endif + long inode = -1; + int result = fscanf(p, "%ld", &inode); +@@ -94,10 +94,10 @@ TEST(GetCommonStat, GetMode) + CommonStat cs; + unsigned int mode = -1; + #if defined (__APPLE__) +- p = popen("/usr/bin/stat -f %p /", "r"); ++ p = popen("/bin/stat -f %p /", "r"); + int result = fscanf(p, "%o", &mode); + #else +- p = popen("/usr/bin/stat -c %f /", "r"); ++ p = popen("/bin/stat -c %f /", "r"); + int result = fscanf(p, "%x", &mode); + #endif + pclose(p); +@@ -111,9 +111,9 @@ TEST(GetCommonStat, GetSize) + FILE *p; + CommonStat cs; + #if defined (__APPLE__) +- p = popen("/usr/bin/stat -f %z /", "r"); ++ p = popen("/bin/stat -f %z /", "r"); + #else +- p = popen("/usr/bin/stat -c %s /", "r"); ++ p = popen("/bin/stat -c %s /", "r"); + #endif + long size = -1; + int result = fscanf(p, "%ld", &size); +@@ -128,9 +128,9 @@ TEST(GetCommonStat, GetBlockSize) + FILE *p; + CommonStat cs; + #if defined (__APPLE__) +- p = popen("/usr/bin/stat -f %k /", "r"); ++ p = popen("/bin/stat -f %k /", "r"); + #else +- p = popen("/usr/bin/stat -c %o /", "r"); ++ p = popen("/bin/stat -c %o /", "r"); + #endif + long bSize = -1; + int result = fscanf(p, "%ld", &bSize); +@@ -145,9 +145,9 @@ TEST(GetCommonStat, GetBlockCount) + FILE *p; + CommonStat cs; + #if defined (__APPLE__) +- p = popen("/usr/bin/stat -f %b /", "r"); ++ p = popen("/bin/stat -f %b /", "r"); + #else +- p = popen("/usr/bin/stat -c %b /", "r"); ++ p = popen("/bin/stat -c %b /", "r"); + #endif + int bSize = -1; + int result = fscanf(p, "%d", &bSize); +@@ -162,9 +162,9 @@ TEST(GetCommonStat, GetLinkCount) + FILE *p; + CommonStat cs; + #if defined (__APPLE__) +- p = popen("/usr/bin/stat -f %l /", "r"); ++ p = popen("/bin/stat -f %l /", "r"); + #else +- p = popen("/usr/bin/stat -c %h /", "r"); ++ p = popen("/bin/stat -c %h /", "r"); + #endif + int linkcount = -1; + int result = fscanf(p, "%d", &linkcount); +@@ -179,9 +179,9 @@ TEST(GetCommonStat, GetDeviceId) + FILE *p; + CommonStat cs; + #if defined (__APPLE__) +- p = popen("/usr/bin/stat -f %d /", "r"); ++ p = popen("/bin/stat -f %d /", "r"); + #else +- p = popen("/usr/bin/stat -c %d /", "r"); ++ p = popen("/bin/stat -c %d /", "r"); + #endif + int deviceId = -1; + int result = fscanf(p, "%d", &deviceId); +@@ -196,9 +196,9 @@ TEST(GetCommonStat, GetATime) + FILE *p; + CommonStat cs; + #if defined (__APPLE__) +- p = popen("/usr/bin/stat -f %a /", "r"); ++ p = popen("/bin/stat -f %a /", "r"); + #else +- p = popen("/usr/bin/stat -c %X /", "r"); ++ p = popen("/bin/stat -c %X /", "r"); + #endif + long aTime = -1; + int result = fscanf(p, "%ld", &aTime); +@@ -213,9 +213,9 @@ TEST(GetCommonStat, GetMTime) + FILE *p; + CommonStat cs; + #if defined (__APPLE__) +- p = popen("/usr/bin/stat -f %m /", "r"); ++ p = popen("/bin/stat -f %m /", "r"); + #else +- p = popen("/usr/bin/stat -c %Y /", "r"); ++ p = popen("/bin/stat -c %Y /", "r"); + #endif + long mTime = -1; + int result = fscanf(p, "%ld", &mTime); +@@ -230,9 +230,9 @@ TEST(GetCommonStat, GetCTime) + FILE *p; + CommonStat cs; + #if defined (__APPLE__) +- p = popen("/usr/bin/stat -f %c /", "r"); ++ p = popen("/bin/stat -f %c /", "r"); + #else +- p = popen("/usr/bin/stat -c %Z /", "r"); ++ p = popen("/bin/stat -c %Z /", "r"); + #endif + long cTime = -1; + int result = fscanf(p, "%ld", &cTime); +-- +2.36.2 +