<commit_before><?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project='Installer.RPM.props'/>

  <UsingTask TaskName="ReplaceFileContents" AssemblyFile="$(CLIBuildDll)"/>
  <UsingTask TaskName="BuildFPMToolPreReqs" AssemblyFile="$(CLIBuildDll)"/>

  <PropertyGroup>
    <BuildRpmPackage Condition=" '$(IsRPMBasedDistro)' == 'True' ">True</BuildRpmPackage>
  </PropertyGroup>

  <Target Name="GenerateRpms"
          DependsOnTargets="TestFPMTool;BuildRpms;TestSdkRpm"
          Condition=" '$(BuildRpmPackage)' == 'True' "
          Outputs="@(GeneratedInstallers)"/>

  <Target Name="BuildRpms"
          DependsOnTargets="GenerateSdkRpm"
          Condition=" '$(BuildRpmPackage)' == 'True' and '$(FPMPresent)' == 'True' "/>

  <Target Name="GenerateSdkRpm"
          DependsOnTargets="SetupRpmProps">

    <RemoveDir Condition="Exists('$(RpmIntermediatesDir)')" Directories="$(RpmIntermediatesDir)"/>
    <MakeDir Directories="$(RpmIntermediatesDir)"/>

    <!-- Create empty rpm layout -->
    <RemoveDir Condition="Exists('$(RpmLayoutDirectory)')" Directories="$(RpmLayoutDirectory)"/>
    <MakeDir Directories="$(RpmLayoutDirectory)"/>
    <MakeDir Directories="$(RpmLayoutPackageRoot)"/>
    <MakeDir Directories="$(RpmLayoutSDK)"/>
    <MakeDir Directories="$(RpmLayoutDocs)"/>
    <MakeDir Directories="$(RpmLayoutTemplates)"/>
    <MakeDir Directories="$(RpmLayoutScripts)"/>

    <!-- Copy files to rpm layout -->
    <ItemGroup>
      <SDKFiles Include="$(InputRoot)/**/*"/>
      <SDKManpages Include="$(ManPagesDir)/**/*"/>
      <SDKTemplatesFiles Include="$(TemplatesDir)/**/*"/>
      <SDKScriptsFiles Include="$(ScriptsDir)/after_remove_host.sh"/>
    </ItemGroup>

    <Copy SourceFiles="@(SDKFiles)"
          DestinationFiles="@(SDKFiles->'$(RpmLayoutSDK)/%(RecursiveDir)%(Filename)%(Extension)')"
          OverwriteReadOnlyFiles="True"
          SkipUnchangedFiles="False"
          UseHardlinksIfPossible="False"/>

    <Copy SourceFiles="@(SDKManpages)"
          DestinationFiles="@(SDKManpages->'$(RpmLayoutDocs)/%(RecursiveDir)%(Filename)%(Extension)')"
          OverwriteReadOnlyFiles="True"
          SkipUnchangedFiles="False"
          UseHardlinksIfPossible="False"/>

    <Copy SourceFiles="@(SDKTemplatesFiles)"
          DestinationFiles="@(SDKTemplatesFiles->'$(RpmLayoutTemplates)/%(RecursiveDir)%(Filename)%(Extension)')"
          OverwriteReadOnlyFiles="True"
          SkipUnchangedFiles="False"
          UseHardlinksIfPossible="False"/>

    <Copy SourceFiles="@(SDKScriptsFiles)"
          DestinationFiles="@(SDKScriptsFiles->'$(RpmLayoutScripts)/%(RecursiveDir)%(Filename)%(Extension)')"
          OverwriteReadOnlyFiles="True"
          SkipUnchangedFiles="False"
          UseHardlinksIfPossible="False"/>

    <!-- Replace config json variables -->
    <ItemGroup>
      <SDKTokenValue Include="%SHARED_HOST_RPM_VERSION%">
        <ReplacementString>$(MicrosoftNETCoreAppPackageVersion)</ReplacementString>
      </SDKTokenValue>
      <SDKTokenValue Include="%ASPNETCORE_SHAREDFX_RPM_PACKAGE_NAME%">
        <ReplacementString>$(AspNetCoreSharedFxRpmPackageName)</ReplacementString>
      </SDKTokenValue>
      <SDKTokenValue Include="%ASPNETCORE_SHAREDFX_RPM_PACKAGE_VERSION%">
        <ReplacementString>$(AspNetCoreVersion)</ReplacementString>
      </SDKTokenValue>
      <SDKTokenValue Include="%SHARED_HOST_RPM_NAME%">
        <ReplacementString>$(SharedFxRpmPackageName)</ReplacementString>
      </SDKTokenValue>
      <SDKTokenValue Include="%SDK_NUGET_VERSION%">
        <ReplacementString>$(SdkVersion)</ReplacementString>
      </SDKTokenValue>
      <SDKTokenValue Include="%CLI_SDK_BRAND_NAME%">
        <ReplacementString>$(SdkBrandName)</ReplacementString>
      </SDKTokenValue>
      <SDKTokenValue Include="%SDK_RPM_PACKAGE_NAME%">
        <ReplacementString>$(SdkRpmPackageName)</ReplacementString>
      </SDKTokenValue>

      <AfterInstallHostTokenValue  Include="%SDK_VERSION%">
        <ReplacementString>$(SdkVersion)</ReplacementString>
      </AfterInstallHostTokenValue>
    </ItemGroup>

    <ItemGroup>
      <TestSdkRpmTaskEnvironmentVariables Include="PATH=$(RpmInstalledDirectory)$(PathListSeparator)$(PATH)" />
      <TestSdkRpmTaskEnvironmentVariables Include="TEST_ARTIFACTS=$(TestArtifactsDir)" />
      <TestSdkRpmTaskEnvironmentVariables Include="TEST_PACKAGES=$(TestPackagesDir)" />
      <TestSdkRpmTaskEnvironmentVariables Include="PreviousStageProps=$(NextStagePropsPath)" />

      <!-- Consumed By Publish -->
      <GeneratedInstallers Include="$(SdkInstallerFile)" />
    </ItemGroup>

    <ReplaceFileContents InputFiles="$(AfterInstallHostScriptTemplateFile)"
                         DestinationFiles="$(AfterInstallHostScriptDestinationFile)"
                         ReplacementItems="@(AfterInstallHostTokenValue)"/>

    <Chmod
        Glob="$(AfterInstallHostScriptDestinationFile)"
        Mode="ugo+x" />

    <ReplaceFileContents InputFile="$(ConfigJsonFile)"
                         DestinationFile="$(RpmLayoutDirectory)$(RpmConfigJsonName)"
                         ReplacementItems="@(SDKTokenValue)"/>

    <!-- Call the task to build the pre-reqs (parameters, copyright, changelog) for calling the FPM tool -->
    <BuildFPMToolPreReqs InputDir="$(RpmLayoutDirectory)"
                         OutputDir="$(RpmIntermediatesDir)"
                         PackageVersion="$(RpmPackageVersion)"
                         ConfigJsonFile="$(RpmLayoutDirectory)$(RpmConfigJsonName)">
      <Output TaskParameter="FPMParameters" PropertyName="FPMCmdParameters"/>
    </BuildFPMToolPreReqs>

    <!-- Build the RPM package by calling the FPM tool and passing the parameter list -->
    <Exec Command="fpm $(FPMCmdParameters)" WorkingDirectory="$(RpmIntermediatesDir)"/>

    <!-- Copy package to output -->
    <ItemGroup><commit_msg>Fixing typos...<commit_after><?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project='Installer.RPM.props'/>

  <UsingTask TaskName="ReplaceFileContents" AssemblyFile="$(CLIBuildDll)"/>
  <UsingTask TaskName="BuildFPMToolPreReqs" AssemblyFile="$(CLIBuildDll)"/>

  <PropertyGroup>
    <BuildRpmPackage Condition=" '$(IsRPMBasedDistro)' == 'True' ">True</BuildRpmPackage>
  </PropertyGroup>

  <Target Name="GenerateRpms"
          DependsOnTargets="TestFPMTool;BuildRpms;TestSdkRpm"
          Condition=" '$(BuildRpmPackage)' == 'True' "
          Outputs="@(GeneratedInstallers)"/>

  <Target Name="BuildRpms"
          DependsOnTargets="GenerateSdkRpm"
          Condition=" '$(BuildRpmPackage)' == 'True' and '$(FPMPresent)' == 'True' "/>

  <Target Name="GenerateSdkRpm"
          DependsOnTargets="SetupRpmProps">

    <RemoveDir Condition="Exists('$(RpmIntermediatesDir)')" Directories="$(RpmIntermediatesDir)"/>
    <MakeDir Directories="$(RpmIntermediatesDir)"/>

    <!-- Create empty rpm layout -->
    <RemoveDir Condition="Exists('$(RpmLayoutDirectory)')" Directories="$(RpmLayoutDirectory)"/>
    <MakeDir Directories="$(RpmLayoutDirectory)"/>
    <MakeDir Directories="$(RpmLayoutPackageRoot)"/>
    <MakeDir Directories="$(RpmLayoutSDK)"/>
    <MakeDir Directories="$(RpmLayoutDocs)"/>
    <MakeDir Directories="$(RpmLayoutTemplates)"/>
    <MakeDir Directories="$(RpmLayoutScripts)"/>

    <!-- Copy files to rpm layout -->
    <ItemGroup>
      <SDKFiles Include="$(InputRoot)/**/*"/>
      <SDKManpages Include="$(ManPagesDir)/**/*"/>
      <SDKTemplatesFiles Include="$(TemplatesDir)/**/*"/>
      <SDKScriptsFiles Include="$(ScriptsDir)/after_remove_host.sh"/>
    </ItemGroup>

    <Copy SourceFiles="@(SDKFiles)"
          DestinationFiles="@(SDKFiles->'$(RpmLayoutSDK)/%(RecursiveDir)%(Filename)%(Extension)')"
          OverwriteReadOnlyFiles="True"
          SkipUnchangedFiles="False"
          UseHardlinksIfPossible="False"/>

    <Copy SourceFiles="@(SDKManpages)"
          DestinationFiles="@(SDKManpages->'$(RpmLayoutDocs)/%(RecursiveDir)%(Filename)%(Extension)')"
          OverwriteReadOnlyFiles="True"
          SkipUnchangedFiles="False"
          UseHardlinksIfPossible="False"/>

    <Copy SourceFiles="@(SDKTemplatesFiles)"
          DestinationFiles="@(SDKTemplatesFiles->'$(RpmLayoutTemplates)/%(RecursiveDir)%(Filename)%(Extension)')"
          OverwriteReadOnlyFiles="True"
          SkipUnchangedFiles="False"
          UseHardlinksIfPossible="False"/>

    <Copy SourceFiles="@(SDKScriptsFiles)"
          DestinationFiles="@(SDKScriptsFiles->'$(RpmLayoutScripts)/%(RecursiveDir)%(Filename)%(Extension)')"
          OverwriteReadOnlyFiles="True"
          SkipUnchangedFiles="False"
          UseHardlinksIfPossible="False"/>

    <!-- Replace config json variables -->
    <ItemGroup>
      <SDKTokenValue Include="%SHARED_HOST_RPM_VERSION%">
        <ReplacementString>$(MicrosoftNETCoreAppPackageVersion)</ReplacementString>
      </SDKTokenValue>
      <SDKTokenValue Include="%ASPNETCORE_SHAREDFX_RPM_PACKAGE_NAME%">
        <ReplacementString>$(AspNetCoreSharedFxRpmPackageName)</ReplacementString>
      </SDKTokenValue>
      <SDKTokenValue Include="%ASPNETCORE_SHAREDFX_RPM_PACKAGE_VERSION%">
        <ReplacementString>$(AspNetCoreVersion)</ReplacementString>
      </SDKTokenValue>
      <SDKTokenValue Include="%SHARED_HOST_RPM_NAME%">
        <ReplacementString>$(SharedFxRpmPackageName)</ReplacementString>
      </SDKTokenValue>
      <SDKTokenValue Include="%SDK_NUGET_VERSION%">
        <ReplacementString>$(SdkVersion)</ReplacementString>
      </SDKTokenValue>
      <SDKTokenValue Include="%CLI_SDK_BRAND_NAME%">
        <ReplacementString>$(SdkBrandName)</ReplacementString>
      </SDKTokenValue>
      <SDKTokenValue Include="%SDK_RPM_PACKAGE_NAME%">
        <ReplacementString>$(SdkRpmPackageName)</ReplacementString>
      </SDKTokenValue>

      <AfterInstallHostTokenValue  Include="%SDK_VERSION%">
        <ReplacementString>$(SdkVersion)</ReplacementString>
      </AfterInstallHostTokenValue>
    </ItemGroup>

    <ItemGroup>
      <TestSdkRpmTaskEnvironmentVariables Include="PATH=$(RpmInstalledDirectory)$(PathListSeparator)$(PATH)" />
      <TestSdkRpmTaskEnvironmentVariables Include="TEST_ARTIFACTS=$(TestArtifactsDir)" />
      <TestSdkRpmTaskEnvironmentVariables Include="TEST_PACKAGES=$(TestPackagesDir)" />
      <TestSdkRpmTaskEnvironmentVariables Include="PreviousStageProps=$(NextStagePropsPath)" />

      <!-- Consumed By Publish -->
      <GeneratedInstallers Include="$(SdkInstallerFile)" />
    </ItemGroup>

    <ReplaceFileContents InputFiles="$(AfterInstallHostScriptTemplateFile)"
                         DestinationFiles="$(AfterInstallHostScriptDestinationFile)"
                         ReplacementItems="@(AfterInstallHostTokenValue)"/>

    <Chmod
        Glob="$(AfterInstallHostScriptDestinationFile)"
        Mode="ugo+x" />

    <ReplaceFileContents InputFiles="$(ConfigJsonFile)"
                         DestinationFiles="$(RpmLayoutDirectory)$(RpmConfigJsonName)"
                         ReplacementItems="@(SDKTokenValue)"/>

    <!-- Call the task to build the pre-reqs (parameters, copyright, changelog) for calling the FPM tool -->
    <BuildFPMToolPreReqs InputDir="$(RpmLayoutDirectory)"
                         OutputDir="$(RpmIntermediatesDir)"
                         PackageVersion="$(RpmPackageVersion)"
                         ConfigJsonFile="$(RpmLayoutDirectory)$(RpmConfigJsonName)">
      <Output TaskParameter="FPMParameters" PropertyName="FPMCmdParameters"/>
    </BuildFPMToolPreReqs>

    <!-- Build the RPM package by calling the FPM tool and passing the parameter list -->
    <Exec Command="fpm $(FPMCmdParameters)" WorkingDirectory="$(RpmIntermediatesDir)"/>

    <!-- Copy package to output -->
    <ItemGroup>
{'fraction_non_alphanumeric': 0.1442404850117885, 'fraction_numerical': 0.001684068710003368, 'mean_word_length': 4.117190866006032, 'pattern_counts': {'":': 0, '<': 177, '<?xml version=': 2, '>': 185, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3086013', 'n_tokens_mistral': 3634, 'n_tokens_neox': 3335, 'n_words': 428}