.configurations/admin_java_and_deps.dsc.yaml |  100 +++++++++++
 .configurations/user_steps.dsc.yaml          |  229 +++++++++++++++++++++++++++
 2 files changed, 329 insertions(+)

New commits:
commit 9739e57e1029f48295079afe82aca0cb4db94854
Author:     Christian Lohmaier <[email protected]>
AuthorDate: Thu Sep 19 16:11:49 2024 +0200
Commit:     Christian Lohmaier <[email protected]>
CommitDate: Thu Oct 10 23:49:36 2024 +0200

    further winget configuration files to complete the setup
    
    this is still a chicken-and-egg situation, since the steps are meant to
    run before the repository is cloned, however it makes some sense to
    have that in the repo since deps and similar are tied to the code after
    all.
    
    The user-side makes use of all script resources, which of course is not
    ideal, but still better than nothing.
    
    Unfortunately the admin side uses hardcoded paths - can be switched to
    also using script resources instead of the xRemoteFile DSC, but that is
    trading one bad thing for another…
    
    Future tweaks might include setting up a Dev Drive and/or whitelisting
    directories to be excluded from AV-checks
    
    Change-Id: Ide1f0efb94264a6c72a9e87c2c212aa527d7d330
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173676
    Reviewed-by: Christian Lohmaier <[email protected]>
    Tested-by: Jenkins

diff --git a/.configurations/admin_java_and_deps.dsc.yaml 
b/.configurations/admin_java_and_deps.dsc.yaml
new file mode 100644
index 000000000000..2d1f0b7eac77
--- /dev/null
+++ b/.configurations/admin_java_and_deps.dsc.yaml
@@ -0,0 +1,100 @@
+# yaml-language-server: $schema=https://aka.ms/configuration-dsc-schema/0.2
+
+# download additional dependencies used for the build to 
C:/Users/Public/Downloads (unfortunately
+# xRemoteFile doesn't accept $env:PUBLIC or similar, so using hardcoded paths 
for now),
+# install the 32bit and 64bit JDKs & make sure wsl is installed
+# (this configuration needs to be applied with administrator privileges)
+
+properties:
+  resources:
+    - resource: xPSDesiredStateConfiguration/xRemoteFile
+      id: jom
+      directives:
+        description: download jom (parallel nmake)
+      settings:
+        DestinationPath: C:/Users/Public/Downloads
+        Uri: http://download.qt.io/official_releases/jom/jom_1_1_4.zip
+        ChecksumType: SHA256
+        Checksum: 
d533c1ef49214229681e90196ed2094691e8c4a0a0bef0b2c901debcb562682b
+    - resource: xPSDesiredStateConfiguration/xRemoteFile
+      id: make
+      directives:
+        description: download make
+      settings:
+        DestinationPath: C:/Users/Public/Downloads
+        Uri: https://dev-www.libreoffice.org/bin/cygwin/make-4.2.1-msvc.exe
+        ChecksumType: SHA256
+        Checksum: 
146d6f2b0ea57647b11b506a95048a7be73232e1feeeccbc1013651f992423d8
+    - resource: xPSDesiredStateConfiguration/xRemoteFile
+      id: clang-format
+      directives:
+        description: download clang-format
+      settings:
+        DestinationPath: C:/Users/Public/Downloads
+        Uri: https://dev-www.libreoffice.org/bin/clang-format-5.0.0-win.exe
+        ChecksumType: SHA256
+        Checksum: 
a25d5c4b451ec4fba466807e9239d0bcbafcfeb7f35834f2db87448968a73ccb
+    - resource: xPSDesiredStateConfiguration/xRemoteFile
+      id: spp
+      directives:
+        description: download strawberry perl portable
+      settings:
+        DestinationPath: C:/Users/Public/Downloads
+        Uri: 
https://github.com/StrawberryPerl/Perl-Dist-Strawberry/releases/download/SP_54001_64bit_UCRT/strawberry-perl-5.40.0.1-64bit-portable.zip
+        ChecksumType: SHA256
+        Checksum: 
754f3e2a8e473dc68d1540c7802fb166a025f35ef18960c4564a31f8b5933907
+    - resource: xPSDesiredStateConfiguration/xRemoteFile
+      id: ant
+      directives:
+        description: download ant
+      settings:
+        DestinationPath: C:/Users/Public/Downloads
+        Uri: https://dlcdn.apache.org/ant/binaries/apache-ant-1.10.15-bin.zip
+        ChecksumType: SHA256
+        Checksum: 
e59baf898dc5b6d1aa6cd57544715f7e0060b1fdc9e56f24f9898d56612a9e0b
+    - resource: xPSDesiredStateConfiguration/xRemoteFile
+      id: junit
+      directives:
+        description: download junit
+      settings:
+        DestinationPath: C:/Users/Public/Downloads
+        Uri: https://repo1.maven.org/maven2/junit/junit/4.10/junit-4.10.jar
+        ChecksumType: SHA256
+        Checksum: 
36a747ca1e0b86f6ea88055b8723bb87030d627766da6288bf077afdeeb0f75a
+    - resource: xPSDesiredStateConfiguration/xRemoteFile
+      id: ucrt
+      directives:
+        description: download ucrts
+      settings:
+        DestinationPath: C:/Users/Public/Downloads
+        Uri: 
https://download.microsoft.com/download/C/5/D/C5D68AA1-F62E-422A-9084-4AD85CEB8D4D/WindowsUCRT.zip
+        ChecksumType: SHA256
+        Checksum: 
3c9fff1e102adbab55e588ce58b4291db885a530b2ae3bcca851c2721c8be3e1
+    - resource: xPSDesiredStateConfiguration/xMsiPackage
+      id: JDK_x64
+      directives:
+        description: install the 64bit JDK
+      settings:
+        Path: 
https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.12%2B7/OpenJDK17U-jdk_x64_windows_hotspot_17.0.12_7.msi
+        ProductId: '{20108BEF-FA49-47AE-9551-495BED430689}'
+        Arguments: ADDLOCAL=FeatureMain,FeatureOracleJavaSoft
+        FileHash: 
1e6df6b445d9e995e86fd8225c658df1411d3abab86b540ce4d2063c8a889835
+    - resource: xPSDesiredStateConfiguration/xMsiPackage
+      id: JDK_x86
+      directives:
+        description: install the 32bit JDK
+      settings:
+        Path: 
https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.12%2B7/OpenJDK17U-jdk_x86-32_windows_hotspot_17.0.12_7.msi
+        ProductId: '{E0CAD1B6-6CF5-4E33-9F85-18AAE8CDD8EE}'
+        Arguments: ADDLOCAL=FeatureMain,FeatureOracleJavaSoft
+        FileHash: 
84e94caa3fac04a173d8cebb80ae77727eaedd766d5bf4f66900aa64aa0b4f11
+    - resource: xPSDesiredStateConfiguration/xScript
+      id: wsl
+      directives:
+        description: make sure that wsl utility is available/working - i.e. 
that wsl is installed
+      settings:
+        # no idea why the whole test fails when not redirecting stderr
+        TestScript: wsl.exe --status 2>$null; return ![bool]$LASTEXITCODE
+        GetScript:  wsl.exe --status 2>$null; return ![bool]$LASTEXITCODE
+        SetScript: wsl.exe --install --no-distribution
+  configurationVersion: 0.2.0
diff --git a/.configurations/user_steps.dsc.yaml 
b/.configurations/user_steps.dsc.yaml
new file mode 100644
index 000000000000..8f9cf83e5b1a
--- /dev/null
+++ b/.configurations/user_steps.dsc.yaml
@@ -0,0 +1,229 @@
+# yaml-language-server: $schema=https://aka.ms/configuration-dsc-schema/0.2
+
+# configuration to setup the dependencies in ~/lo and add make, jom and 
clang-format to ~/bin
+# and install a wsl distro with the required packages
+# this configuration is meant to be applied as the build user, and after the 
admin_java_and_deps one
+# has been applied. It also creates a ~/lo/autogen.input with some sensible 
defaults that can be
+# used as a template for own modifications
+
+properties:
+  assertions:
+    - resource: xPSDesiredStateConfiguration/xScript
+      id: prerequisitecheck
+      directives:
+        description: check that everything had been downloaded by the 
admin-step
+      settings:
+        GetScript: return $false
+        SetSCript: return $false
+        # the empty string element is so that each file can be specified with 
trailing comma
+        TestScript: |
+          $files = @(
+              "WindowsUCRT.zip",
+              "apache-ant-1.10.15-bin.zip",
+              "clang-format-5.0.0-win.exe",
+              "jom_1_1_4.zip",
+              "junit-4.10.jar",
+              "make-4.2.1-msvc.exe",
+              "strawberry-perl-5.40.0.1-64bit-portable.zip",
+          "")
+          !(($files | foreach {Test-Path "$env:PUBLIC/Downloads/$_"}) 
-contains $false)
+    - resource: xPSDesiredStateConfiguration/xScript
+      id: wsl-check
+      directives:
+        description: check that wsl utility is avilable/working - i.e. whehter 
wsl is installed
+      settings:
+        TestScript: wsl.exe --status ; return ![bool]$LASTEXITCODE
+        GetScript: return $false
+        SetScript: return $false
+  resources:
+    - resource: xPSDesiredStateConfiguration/xScript
+      id: bindir
+      directives:
+        description: create the ~/bin directory
+      settings:
+        TestScript: Test-Path -Path "$env:UserProfile/bin" -PathType 
"Container"
+        GetScript:  Test-Path -Path "$env:UserProfile/bin" -PathType 
"Container"
+        SetScript: New-Item -ItemType "directory" -Path "$env:UserProfile" 
-Name "bin"
+    - resource: xPSDesiredStateConfiguration/xScript
+      id: lodir
+      directives:
+        description: create the ~/lo directory
+      settings:
+        TestScript: Test-Path -Path "$env:UserProfile/lo" -PathType "Container"
+        GetScript:  Test-Path -Path "$env:UserProfile/lo" -PathType "Container"
+        SetScript: New-Item -ItemType "directory" -Path "$env:UserProfile" 
-Name "lo"
+    - resource: xPSDesiredStateConfiguration/xScript
+      id: make
+      dependsOn:
+        - bindir
+      directives:
+        description: copy make.exe to the ~/bin directory
+      settings:
+        TestScript: Test-Path -Path "$env:USERPROFILE/bin/make.exe"
+        GetScript:  Test-Path -Path "$env:USERPROFILE/bin/make.exe"
+        SetScript: Copy-Item -Path "$env:PUBLIC/Downloads/make-4.2.1-msvc.exe" 
-Destination "$env:USERPROFILE/bin/make.exe"
+    - resource: xPSDesiredStateConfiguration/xScript
+      id: clang-format
+      dependsOn:
+        - bindir
+      directives:
+        description: copy clang-format.exe to the ~/bin directory
+      settings:
+        TestScript: Test-Path -Path "$env:USERPROFILE/bin/clang-format.exe"
+        GetScript:  Test-Path -Path "$env:USERPROFILE/bin/clang-format.exe"
+        SetScript: Copy-Item -LiteralPath 
"$env:PUBLIC/Downloads/clang-format-5.0.0-win.exe" -Destination 
"$env:USERPROFILE/bin/clang-format.exe"
+    - resource: xPSDesiredStateConfiguration/xScript
+      id: junit
+      dependsOn:
+        - lodir
+      directives:
+        description: copy junit to the ~/lo directory
+      settings:
+        TestScript: Test-Path -Path "$env:USERPROFILE/lo/junit-4.10.jar"
+        GetScript:  Test-Path -Path "$env:USERPROFILE/lo/junit-4.10.jar"
+        SetScript: Copy-Item -LiteralPath 
"$env:PUBLIC/Downloads/junit-4.10.jar" -Destination 
"$env:USERPROFILE/lo/junit-4.10.jar"
+    # the DSC Archive module doesn't operate with $env:FOO / would need 
hardcoded paths
+    - resource: xPSDesiredStateConfiguration/xScript
+      id: ant-extract
+      dependsOn:
+        - lodir
+      directives:
+        description: extract ant to the ~/lo directory
+      settings:
+        TestScript: Test-Path -Path 
"$env:USERPROFILE/lo/apache-ant-1.10.15/bin/ant"
+        GetScript:  Test-Path -Path 
"$env:USERPROFILE/lo/apache-ant-1.10.15/bin/ant"
+        SetScript: Expand-Archive -LiteralPath 
"$env:PUBLIC/Downloads/apache-ant-1.10.15-bin.zip" -Destination 
"$env:USERPROFILE/lo/"
+    - resource: xPSDesiredStateConfiguration/xScript
+      id: ucrt-extract
+      dependsOn:
+        - lodir
+      directives:
+        description: extract ucrts to the ~/lo directory
+      settings:
+        TestScript: Test-Path -Path 
"$env:USERPROFILE/lo/ucrt/Windows8.1-KB2999226-x64.msu"
+        GetScript:  Test-Path -Path 
"$env:USERPROFILE/lo/ucrt/Windows8.1-KB2999226-x64.msu"
+        SetScript: Expand-Archive -LiteralPath 
"$env:PUBLIC/Downloads/WindowsUCRT.zip" -Destination "$env:USERPROFILE/lo/ucrt"
+    - resource: xPSDesiredStateConfiguration/xScript
+      id: spp-extract
+      dependsOn:
+        - lodir
+      directives:
+        description: extract strawberry-perl-portable to the ~/lo directory
+      settings:
+        TestScript: Test-Path -Path "$env:USERPROFILE/lo/spp/perl/bin/perl.exe"
+        GetScript:  Test-Path -Path "$env:USERPROFILE/lo/spp/perl/bin/perl.exe"
+        SetScript: Expand-Archive -LiteralPath 
"$env:PUBLIC/Downloads/strawberry-perl-5.40.0.1-64bit-portable.zip" 
-Destination "$env:USERPROFILE/lo/spp"
+    - resource: xPSDesiredStateConfiguration/xScript
+      id: spp-install-font-ttf
+      dependsOn:
+        - spp-extract
+      directives:
+        description: install perl-font-TTF to spp via cpan
+      settings:
+        TestScript: Test-Path -Path 
"$env:USERPROFILE/lo/spp/perl/site/lib/Font/TTF.pm"
+        GetScript:  Test-Path -Path 
"$env:USERPROFILE/lo/spp/perl/site/lib/Font/TTF.pm"
+        SetScript: |
+          $env:Path = 
"$env:USERPROFILE/lo/spp/c/bin;$env:USERPROFILE/lo/spp/perl/bin;$env:path"
+          cpanm Font::TTF
+    - resource: xPSDesiredStateConfiguration/xScript
+      id: jom
+      dependsOn:
+        - bindir
+        - lodir
+      directives:
+        description: extract and copy jom to the ~/bin directory
+      settings:
+        TestScript: Test-Path -Path "$env:USERPROFILE/bin/jom.exe"
+        GetScript:  Test-Path -Path "$env:USERPROFILE/bin/jom.exe"
+        SetScript: |
+          Expand-Archive -LiteralPath "$env:PUBLIC/Downloads/jom_1_1_4.zip" 
-Destination "$env:USERPROFILE/lo/jom_unpack"
+          Copy-Item -LiteralPath "$env:USERPROFILE/lo/jom_unpack/jom.exe" 
-Destination "$env:USERPROFILE/bin/jom.exe"
+          Remove-Item -LiteralPath "$env:USERPROFILE/lo/jom_unpack" -Recurse
+    - resource: xPSDesiredStateConfiguration/xScript
+      id: gitsettings
+      directives:
+        description: configure git to use protocol.version 2 and core.autocrlf 
false
+      settings:
+        TestScript: return $false
+        GetScript:  return $false
+        SetScript: |
+          git config --global core.autocrlf false
+          git config --global protocol.version 2
+    - resource: xPSDesiredStateConfiguration/xScript
+      id: autogensnippet
+      dependsOn:
+        - lodir
+      directives:
+        description: create an autogen.input snippet with some sensible 
defaults
+      settings:
+        TestScript: Test-Path -Path "$env:USERPROFILE/lo/autogen.input"
+        GetScript:  Test-Path -Path "$env:USERPROFILE/lo/autogen.input"
+        SetScript: |
+          New-Item -Path "$env:USERPROFILE/lo" -Name "autogen.input" -ItemType 
"file" -Value "# adjust to your needs
+          --host=x86_64-pc-cygwin
+          #--host=i686-pc-cygwin
+          --disable-ccache
+          --with-visual-studio=2022
+          --enable-python=fully-internal
+          --without-lxml
+          --disable-online-update
+          --with-external-tar=$env:USERPROFILE\lo\lo-externaltar
+          --with-strawberry-perl-portable=$env:USERPROFILE\lo\spp
+          --with-ant-home=$env:USERPROFILE\lopache-ant-1.10.15
+          --with-junit=$env:USERPROFILE\lo\junit-4.10.jar
+          --with-doxygen=$env:USERPROFILE\lo\spp+          
--with-ucrt-dir=$env:USERPROFILE\lo\ucrt
+          #--enable-odk
+          #--disable-dependency-tracking
+          #--enable-dbgutil
+          #--with-lang=fr ja
+          "
+    - resource: xPSDesiredStateConfiguration/xScript
+      id: cloud-init-dir
+      directives:
+        description: create the ~/.cloud-init directory
+      settings:
+        TestScript: Test-Path -Path "$env:UserProfile/.cloud-init" -PathType 
"Container"
+        GetScript:  Test-Path -Path "$env:UserProfile/.cloud-init" -PathType 
"Container"
+        SetScript: New-Item -ItemType "directory" -Path "$env:UserProfile" 
-Name ".cloud-init"
+    - resource: xPSDesiredStateConfiguration/xScript
+      id: cloud-init-config
+      dependsOn:
+        - cloud-init-dir
+      directives:
+        description: create a cloud-init configuration to automate the 
installation of Ubuntu 24.04
+      settings:
+        TestScript: Test-Path -Path 
"$env:USERPROFILE/.cloud-init/Ubuntu-24.04.user-data"
+        GetScript:  Test-Path -Path 
"$env:USERPROFILE/.cloud-init/Ubuntu-24.04.user-data"
+        SetScript: |
+          New-Item -Path "$env:USERPROFILE/.cloud-init" -Name 
"Ubuntu-24.04.user-data" -ItemType "file" -Value '#cloud-config
+          users:
+            - name: ubuntu
+              # ubuntu
+              password: 
"$6$exDY1mhS4KUYCE/2$zmn9ToZwTKLhCw.b4/b.ZRTIZM30JZ4QrOQ2aOXJ8yk96xpcCof0kxKwuX1kqLG/ygbJ1f8wxED22bTL4F46P0"
+              groups: [user, adm, dialout, cdrom, floppy, sudo, audio, dip, 
video, plugdev, netdev]
+              shell: /bin/bash
+
+          write_files:
+          - path: /etc/wsl.conf
+            append: true
+            content: |
+              [user]
+              default=ubuntu
+
+          packages: [pkg-config, automake, make, gperf, bison, nasm, flex, 
zip, libfont-ttf-perl]
+          '
+    - resource: xPSDesiredStateConfiguration/xScript
+      id: install-Ubuntu
+      dependsOn:
+        - cloud-init-config
+      directives:
+        description: installs Ubuntu with help of the cloud-init file
+      settings:
+        TestScript: wsl.exe --list ; return ![bool]$LASTEXITCODE
+        GetScript:  wsl.exe --list ; return ![bool]$LASTEXITCODE
+        SetScript: |
+          wsl.exe --install --no-launch --distribution Ubuntu-24.04
+          ubuntu2404.exe install --root
+          ubuntu2404.exe run cloud-init status --wait
+  configurationVersion: 0.2.0

Reply via email to