Skip to content

Commit

Permalink
root: enabled research paper pipeline (srcRESEARCH)
Browse files Browse the repository at this point in the history
Since we want this library to be reliably good, we should enable
the research paper pipeline and place all our details and data in
it. That way, interested folks and code auditors can review the
materials without needing to ping-pong with the maintainers that
often.

This patch enables research paper pipeline (srcRESEARCH) in
root repository.

Co-authored-by: Shuralyov, Jean <[email protected]>
Co-authored-by: Galyna, Cory <[email protected]>
Co-authored-by: (Holloway) Chew, Kean Ho <[email protected]>
Signed-off-by: (Holloway) Chew, Kean Ho <[email protected]>
  • Loading branch information
3 people committed Jun 10, 2024
1 parent 30de314 commit 034f918
Show file tree
Hide file tree
Showing 6 changed files with 491 additions and 181 deletions.
31 changes: 26 additions & 5 deletions CONFIG.toml
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,10 @@ GOOGLEAI_BLOCK_HARASSMENT = 'BLOCK_NONE'
# notify the CI provider to setup a localized virtual environment for
# development automatically.
#
# Do note that should the following technologies are enabled, LibreOffice shall
# be installed regardless of this control variable:
# (1) PROJECT_RESEARCH - using Libreoffice by default.
#
# To enable it: simply supply the path (e.g. default is 'srcLIBREOFFICE').
# To disable it: simply supply an empty path (e.g. default is '').
PROJECT_LIBREOFFICE = ''
Expand All @@ -462,17 +466,22 @@ PROJECT_LIBREOFFICE = ''
#
# Refer to the following mirror list for value selection:
# (1) https://download.documentfoundation.org/mirmon/allmirrors.html
PROJECT_LIBREOFFICE_MIRROR = "https://ftp.osuosl.org/pub/tdf/libreoffice"

PROJECT_LIBREOFFICE_MIRROR = "https://download.documentfoundation.org/libreoffice"

# PROJECT_LIBREOFFICE_VERSION
# This is for defining the LibreOffice version to install into the local OS.
#
# Refer the the following list for value selection:
# (1) https://www.libreoffice.org/download/download-libreoffice/
#
# Example: '24.2.1' for 'LibreOffice 24.2.1'
PROJECT_LIBREOFFICE_VERSION = "24.2.1"
# Example: '24.4.3' for 'LibreOffice 24.4.3'
PROJECT_LIBREOFFICE_VERSION = "24.2.3"


# PROJECT_PATH_LIBREOFFICE_ENGINE
# This is a relative pathing to PROJECT_PATH_ROOT + PROJECT_PATH_TOOLS for
# setting up localized environment.
PROJECT_PATH_LIBREOFFICE_ENGINE = "libreoffice-engine"



Expand Down Expand Up @@ -646,7 +655,19 @@ PROJECT_PYPI_README_MIME = "text/markdown"
#
# To enable it: simply supply the path (e.g. default is 'srcRESEARCH').
# To disable it: simply supply an empty path (e.g. default is '').
PROJECT_RESEARCH = ''
PROJECT_RESEARCH = 'srcRESEARCH'


# PROJECT_RESEARCH_IDENTIFIER
# The file identifier for the compiled output paper file from its peers with the
# same formats (e.g. a bunch of PDFs). This is suffix-ed within the filename
# itself like:
#
# pattern: '${PROJECT_SKU}-${PROJECT_RESEARCH_IDENTIFIER}_v${PROJECT_VERSION}_any-any.pdf'
# example: 'automataci-RESEARCH_v100.00.100_any-any.pdf'
#
# default is: 'RESEARCH'
PROJECT_RESEARCH_IDENTIFIER = 'RESEARCH'



Expand Down
197 changes: 112 additions & 85 deletions automataCI/services/compilers/libreoffice.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,40 @@ function LIBREOFFICE-Get {



function LIBREOFFICE-Get-Path-Local {
$___path = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TOOLS}\${env:PROJECT_PATH_LIBREOFFICE_ENGINE}\bin\soffice"

switch ("${env:PROJECT_OS}") {
"windows" {
$___path = "${___path}.exe"
} default {
# do nothing
}}


# report status
return $___path
}




function LIBREOFFICE-Get-Path {
switch ("$(OS-Get)") {
$___path = LIBREOFFICE-Get-Path-Local
if ($(FS-Is-File "${___path}") -eq 0) {
return $___path
}

switch ("${env:PROJECT_OS}") {
"darwin" {
$___path = "/Applications/LibreOffice.app/Contents/MacOS/soffice"
} "windows" {
$___path = "C:\Program Files\LibreOffice\program\soffice.exe"
$___path = "${___path}.exe"
if ($(FS-Is-File "${___path}") -ne 0) {
$___path = "C:\Program Files\LibreOffice\program\soffice.exe"
}
} default {
$___path = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TOOLS}\libreoffice\bin\libreoffice"
# do nothing
}}


Expand All @@ -68,8 +94,6 @@ function LIBREOFFICE-Get-Path {

function LIBREOFFICE-Is-Available {
# execute
$null = OS-Sync

$___process = OS-Is-Command-Available "libreoffice"
if ($___process -eq 0) {
return 0
Expand Down Expand Up @@ -110,87 +134,70 @@ function LIBREOFFICE-Setup {


# execute
if ($(OS-Get) -eq "darwin") {
$___dest = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TEMP}\libreoffice\instal.dmg"
$null = FS-Make-Housing-Directory "${___dest}"
$null = FS-Remove-Silently "${___dest}"


## Download directly from provider
$___url = "${env:PROJECT_LIBREOFFICE_MIRROR}/stable/${env:PROJECT_LIBREOFFICE_VERSION}"
$___dest = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TOOLS}\${env:PROJECT_PATH_LIBREOFFICE_ENGINE}"
$___url = "${env:PROJECT_LIBREOFFICE_MIRROR}/stable/${env:PROJECT_LIBREOFFICE_VERSION}"
switch ("${env:PROJECT_OS}") {
"darwin" {
$___dest = "${___dest}\install.dmg"
$___url = "${___url}/mac"
if ($(OS-Get-Arch) -eq "amd64") {
switch ("${env:PROJECT_ARCH}") {
"amd64" {
$___url = "${___url}/x86_64"
$___url = "${___url}/LibreOffice_${env:PROJECT_LIBREOFFICE_VERSION}_MacOS_x86-64.dmg"
} elseif ($(OS-Get-Arch) -eq "arm64") {
} "arm64" {
$___url = "${___url}/aarch64"
$___url = "${___url}/LibreOffice_${env:PROJECT_LIBREOFFICE_VERSION}_MacOS_aarch64.dmg"
} else {
return 1
}


# download from provider
$___process = HTTP-Download "GET" "${___url}" "${___dest}"
if ($___process -ne 0) {
return 1
}


## silently install
$___process = Apple-Install-DMG "${___dest}"
if ($___process -ne 0) {
return 1
}


## clean up
$null = FS-Remove-Silently "${___dest}"
} elseif ($(OS-Get) -eq "windows") {
## Attempt to use directly from the provider
$___dest = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TEMP}\libreoffice\install.msi"
$null = FS-Make-Housing-Directory "${___dest}"
$null = FS-Remove-Silently "${___dest}"

} default {
$___url = ""
}}

$___url = "${env:PROJECT_LIBREOFFICE_MIRROR}/stable/${env:PROJECT_LIBREOFFICE_VERSION}"
$___url = "${___url}/win"
if ($(OS-Get-Arch) -eq "amd64") {
$___url = "${___url}/x86_64"
$___url = "${___url}/LibreOffice_${env:PROJECT_LIBREOFFICE_VERSION}_Win_x86-64.msi"
} elseif ($(OS-Get-Arch) -eq "arm64") {
$___url = "${___url}/aarch64"
$___url = "${___url}/LibreOffice_${env:PROJECT_LIBREOFFICE_VERSION}_Win_aarch64.msi"
} else {
## fallback to choco as the last resort
$___process = OS-Is-Command-Available "choco"
## attempt to download from vendor directly
if ($(STRINGS-Is-Empty "${___url}") -ne 0) {
$null = FS-Make-Housing-Directory "${___dest}"
$null = FS-Remove-Silently "${___dest}"
$___process = HTTP-Download "GET" "${___url}" "${___dest}"
if ($___process -ne 0) {
return 1
}

$___process = OS-Exec "choco" "install libreoffice-fresh -y"
$___process = Apple-Install-DMG "${___dest}"
if ($___process -ne 0) {
return 1
}

return 0
$null = FS-Remove-Silently "${___dest}"
}
} "windows" {
switch ("${env:PROJECT_ARCH}") {
"amd64" {
$___dest = LIBREOFFICE-Get-Path-Local
$___url = "${env:PROJECT_LIBREOFFICE_MIRROR}/portable/${env:PROJECT_LIBREOFFICE_VERSION}"
$___url = "${___url}/LibreOfficePortable_${env:PROJECT_LIBREOFFICE_VERSION}_MultilingualAll.paf.exe"

$___process = HTTP-Download "GET" "${___url}" "${___dest}"
if ($___process -ne 0) {
return 1
}
$null = FS-Make-Housing-Directory "${___dest}"
$null = FS-Remove-Silently "${___dest}"
$___process = HTTP-Download "GET" "${___url}" "${___dest}"
if ($___process -ne 0) {
$null = FS-Remove-Silently "${___dest}"
}
} "arm64" {
$___dest = "${___dest}\install.msi"
$___url = "${___url}/win/aarch64"
$___url = "${___url}/LibreOffice_${env:PROJECT_LIBREOFFICE_VERSION}_Win_aarch64.msi"

$___process = FS-Is-File "${___dest}"
if ($___process -ne 0) {
return 1
}
$null = FS-Make-Housing-Directory "${___dest}"
$null = FS-Remove-Silently "${___dest}"
$___process = HTTP-Download "GET" "${___url}" "${___dest}"
if ($___process -eq 0) {
$___process = MSI-Install-Silent "${___dest}"
$null = FS-Remove-Silently "${___dest}"
}
} default {
$___url = ""
}}

$___process = MSI-Install-Silent "${___dest}"
$null = FS-Remove-Silently "${___dest}"
$null = OS-Sync
if ($___process -ne 0) {
## fallback to choco as the last resort
## fallback to choco as the last resort
if (($(STRINGS-Is-Empty "${___url}") -eq 0) -or ($___process -ne 0)) {
$___process = OS-Is-Command-Available "choco"
if ($___process -ne 0) {
return 1
Expand All @@ -202,27 +209,47 @@ function LIBREOFFICE-Setup {
}

$null = OS-Sync
return 0
}
} else {
## check compatible platform version
$___url = "https://appimages.libreitalia.org"
switch ("$(OS-Get-Arch)") {
"amd64" {
$___url = "${___url}/LibreOffice-fresh.full-x86_64.AppImage"
} default {
return 1
}}

} "linux" {
$___process = OS-Is-Command-Available "flatpak"
if ($___process -eq 0) {
$___process = OS-Exec "flatpak" "--user install org.libreoffice.LibreOffice"
}

## download appimage portable version
$___dest = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TOOLS}\libreoffice\bin\libreoffice"
$null = FS-Make-Housing-Directory "${___dest}"
$null = FS-Remove-Silently "${___dest}"
$___process = HTTP-Download "GET" "${___url}" "${___dest}"
## download appimage as last resort
if ($___process -ne 0) {
return 1
$___dest = LIBREOFFICE-Get-Path-Local
$___url = "https://appimages.libreitalia.org"
switch ("${env:PROJECT_ARCH}") {
"amd64" {
$___url = "${___url}/LibreOffice-fresh.full-x86_64.AppImage"
} default {
return 1
}}

if ($(STRINGS-Is-Empty "${___url}") -ne 0) {
$null = FS-Make-Housing-Directory "${___dest}"
$null = FS-Remove-Silently "${___dest}"
$___process = HTTP-Download "GET" "${___url}" "${___dest}"
if ($___process -ne 0) {
return 1
}

$___process = FS-Is-File "${___dest}"
if ($___process -ne 0) {
return 1
}
}
}
} default {
return 1 # unsupported
}}


# test the output
$___process = LIBREOFFICE-Is-Available
if ($___process -ne 0) {
return 1
}


Expand Down
Loading

0 comments on commit 034f918

Please sign in to comment.