commit:     e9606837f04d623e6d5b00d790dcb8e82b1d8e45
Author:     Maciej Barć <xgqt <AT> gentoo <DOT> org>
AuthorDate: Sat Dec 16 21:40:24 2023 +0000
Commit:     Maciej Barć <xgqt <AT> gentoo <DOT> org>
CommitDate: Sat Dec 16 21:44:59 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e9606837

app-shells/pwsh: no WarningLevel, switch to en_US, misc tweaks

Bug: https://bugs.gentoo.org/914292
Bug: https://github.com/PowerShell/PowerShell/issues/20941
Signed-off-by: Maciej Barć <xgqt <AT> gentoo.org>

 .../pwsh/files/pwsh-7.4.0-disable-telemetry.patch  | 47 ++++++++++++++++++++++
 app-shells/pwsh/pwsh-7.4.0.ebuild                  | 45 ++++++++++-----------
 2 files changed, 69 insertions(+), 23 deletions(-)

diff --git a/app-shells/pwsh/files/pwsh-7.4.0-disable-telemetry.patch 
b/app-shells/pwsh/files/pwsh-7.4.0-disable-telemetry.patch
new file mode 100644
index 000000000000..49fdc34be8a2
--- /dev/null
+++ b/app-shells/pwsh/files/pwsh-7.4.0-disable-telemetry.patch
@@ -0,0 +1,47 @@
+--- a/src/System.Management.Automation/utils/Telemetry.cs
++++ b/src/System.Management.Automation/utils/Telemetry.cs
+@@ -137,10 +137,10 @@ namespace Microsoft.PowerShell.Telemetry
+         private static TelemetryClient s_telemetryClient { get; }
+ 
+         // the unique identifier for the user, when we start we
+-        private static string s_uniqueUserIdentifier { get; }
++        private static string s_uniqueUserIdentifier { get; } = string.Empty;
+ 
+         // the session identifier
+-        private static string s_sessionId { get; }
++        private static string s_sessionId { get; } = string.Empty;
+ 
+         // private semaphore to determine whether we sent the startup 
telemetry event
+         private static int s_startupEventSent = 0;
+@@ -149,8 +149,8 @@ namespace Microsoft.PowerShell.Telemetry
+         /// We send telemetry only a known set of modules and tags.
+         /// If it's not in the list (initialized in the static constructor), 
then we report anonymous
+         /// or don't report anything (in the case of tags).
+-        private static readonly HashSet<string> s_knownModules;
+-        private static readonly HashSet<string> s_knownModuleTags;
++        private static readonly HashSet<string> s_knownModules = new(){};
++        private static readonly HashSet<string> s_knownModuleTags = new(){};
+ 
+         /// <summary>Gets a value indicating whether telemetry can be 
sent.</summary>
+         public static bool CanSendTelemetry { get; private set; } = false;
+--- a/src/System.Management.Automation/utils/Telemetry.cs
++++ b/src/System.Management.Automation/utils/Telemetry.cs
+@@ -165,7 +165,8 @@ namespace Microsoft.PowerShell.Telemetry
+         static ApplicationInsightsTelemetry()
+         {
+             // If we can't send telemetry, there's no reason to do any of this
+-            CanSendTelemetry = !GetEnvironmentVariableAsBool(name: 
_telemetryOptoutEnvVar, defaultValue: false);
++            CanSendTelemetry = false;
++           /*
+             if (CanSendTelemetry)
+             {
+                 s_sessionId = Guid.NewGuid().ToString();
+@@ -617,6 +618,7 @@ namespace Microsoft.PowerShell.Telemetry
+ 
+                 s_uniqueUserIdentifier = GetUniqueIdentifier().ToString();
+             }
++           */
+         }
+ 
+         /// <summary>
+

diff --git a/app-shells/pwsh/pwsh-7.4.0.ebuild 
b/app-shells/pwsh/pwsh-7.4.0.ebuild
index 85a198a23f5f..5c170e355644 100644
--- a/app-shells/pwsh/pwsh-7.4.0.ebuild
+++ b/app-shells/pwsh/pwsh-7.4.0.ebuild
@@ -252,22 +252,15 @@ inherit check-reqs desktop dotnet-pkg xdg
 DESCRIPTION="Cross-platform automation and configuration tool"
 HOMEPAGE="https://microsoft.com/powershell/
        https://github.com/PowerShell/PowerShell/";
-
-if [[ "${PV}" == *9999* ]] ; then
-       inherit git-r3
-
-       EGIT_REPO_URI="https://github.com/PowerShell/PowerShell.git";
-else
-       SRC_URI="https://dev.gentoo.org/~xgqt/distfiles/repackaged/${P}.tar.xz";
-
-       KEYWORDS="~amd64 ~arm ~arm64"
-fi
-
-SRC_URI+=" ${NUGET_URIS} "
+SRC_URI="
+       https://dev.gentoo.org/~xgqt/distfiles/repackaged/${P}.tar.xz
+       ${NUGET_URIS}
+"
 
 LICENSE="MIT"
 SLOT="$(ver_cut 1-2)"
-RESTRICT="test"  # TODO: "LibraryImports.g.cs" not found.
+KEYWORDS="~amd64 ~arm ~arm64"
+RESTRICT="test"                        # TODO: "LibraryImports.g.cs" not found.
 
 RDEPEND="
        >=dev-libs/libpsl-native-7.4.0:=
@@ -289,13 +282,9 @@ DOTNET_PKG_PROJECTS=(
        src/powershell-unix/powershell-unix.csproj
        src/Modules/PSGalleryModules.csproj
 )
-# Lower warning level to skip CS0162 error for the "disable-telemetry" patch.
-DOTNET_PKG_BUILD_EXTRA_ARGS=(
-       -p:WarningLevel=1
-)
 PATCHES=(
-       "${FILESDIR}/pwsh-7.3.3-disable-telemetry.patch"
        "${FILESDIR}/pwsh-7.3.3-disable-update-check.patch"
+       "${FILESDIR}/pwsh-7.4.0-disable-telemetry.patch"
 )
 
 DOCS=( CHANGELOG CHANGELOG.md CODE_OF_CONDUCT.md README.md docs )
@@ -303,13 +292,23 @@ DOCS=( CHANGELOG CHANGELOG.md CODE_OF_CONDUCT.md 
README.md docs )
 pkg_setup() {
        check-reqs_pkg_setup
        dotnet-pkg_pkg_setup
-}
 
-src_unpack() {
-       dotnet-pkg_src_unpack
+       if [[ "${MERGE_TYPE}" != binary ]] ; then
+               local locales="$(locale -a)"
+
+               if has en_US.utf8 ${locales} ; then
+                       LC_ALL=en_US.utf8
+               elif has en_US.UTF-8 ${locales} ; then
+                       LC_ALL=en_US.UTF-8
+               else
+                       eerror "The locale en_US.utf8 or en_US.UTF-8 is not 
available."
+                       eerror "Please generate en_US.UTF-8 before building 
${CATEGORY}/${P}."
+
+                       die "Could not switch to the en_US.UTF-8 locale."
+               fi
 
-       if [[ -n "${EGIT_REPO_URI}" ]] ; then
-               git-r3_src_unpack
+               export LC_ALL
+               einfo "Successfully switched to the ${LC_ALL} locale."
        fi
 }
 

Reply via email to