autopkg / hjuutilainen-recipes

Recipes for AutoPkg
MIT License
49 stars 74 forks source link

LibreOffice Download recipe getting an error on download #272

Open jpiperberg opened 8 months ago

jpiperberg commented 8 months ago

This worked last week, but today I got a 404 for both architectures for "fresh". It does not appear as though the releases page is not being updated properly and the 7.6.1 version is missing from download.documentfoundation.org.

Proposed fix:

add URLTextSearcherArray URL/Regex:

url: http://downloadarchive.documentfoundation.org/libreoffice/old/ re_pattern: href="(%version%[\d.]+)\/"

add https://github.com/jgstew/jgstew-recipes/blob/main/SharedProcessors/VersionMaximumArray.py

Change URLDownloader url: http://downloadarchive.documentfoundation.org/libreoffice/old/%version_maximum%/mac/%ARCH%/LibreOffice_%version_maximum%_MacOS_%aux_arch_name%.dmg

I didn't have the ability to fork, but I have tested this recipe with x86_64 and aarch64 with both fresh and still


<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Description</key>
    <string>Downloads the latest LibreOffice. Set RELEASE to either "fresh" or "still".

LibreOffice Still is the stable version that has undergone more testing (over a longer time). It is usually recommended for more conservative use.
LibreOffice Fresh is the stable version with the most recent features. Users interested in taking advantage of our most innovative features should download and use our fresh version.
The architecture (ARCH) can be 'x86-64' or 'aarch64'
</string>
    <key>Identifier</key>
    <string>io.github.hjuutilainen.download.LibreOffice</string>
    <key>Input</key>
    <dict>
        <key>NAME</key>
        <string>LibreOffice</string>
        <key>RELEASE</key>
        <string>fresh</string>
        <key>ARCH</key>
        <string>x86_64</string>
    </dict>
    <key>MinimumVersion</key>
    <string>0.2.0</string>
    <key>Process</key>
    <array>
        <dict>
            <key>Comment</key>
            <string>LibreOffice uses both x86_64 AND x86-64 in the download path. Here we build the x86-64 or aarch64 part.</string>
            <key>Processor</key>
            <string>CreateLibreOfficeAuxArchName</string>
            <key>Arguments</key>
            <dict>
                <key>arch_name</key>
                <string>%ARCH%</string>
            </dict>
        </dict>
        <dict>
            <key>Comment</key>
            <string>Try to parse the the latest fresh or still version from current release notes</string>
            <key>Processor</key>
            <string>URLTextSearcher</string>
            <key>Arguments</key>
            <dict>
                <key>re_pattern</key>
                <string>LibreOffice (?P&lt;version&gt;[\d\.]+) \([\d-]+\) - (?i)%RELEASE% Branch</string>
                <key>url</key>
                <string>https://www.libreoffice.org/download/release-notes/</string>
            </dict>
        </dict>
    <dict>
      <key>Processor</key>
      <string>com.github.jgstew.SharedProcessors/SharedUtilityMethods</string>
    </dict>
    <dict>
        <key>Processor</key>
        <string>com.github.jgstew.SharedProcessors/URLTextSearcherArray</string>
        <key>Arguments</key>
        <dict>
            <key>url</key>
            <string>http://downloadarchive.documentfoundation.org/libreoffice/old/</string>
            <key>result_output_var_name</key>
            <string>match</string>
            <key>re_pattern</key>
        <string>href="(?P&lt;fullversion&gt;%version%[\d\.]+)\/"</string>
        <key>full_results</key>
        <true/>
        </dict>
    </dict>
    <dict>
      <key>Processor</key>
      <string>com.github.jgstew.SharedProcessors/VersionMaximumArray</string>
    </dict>
        <dict>
            <key>Comment</key>
            <string>
                The current (late June 2021) dmg download URL at
                https://www.libreoffice.org/download/download/?type=mac-x86_64
                takes us to a JavaScript-heavy page that eventually redirects to
                the download, but the download is at a predictable URL once we
                know the version. So we just assemble that URL.
            </string>
            <key>Processor</key>
            <string>URLDownloader</string>
            <key>Arguments</key>
            <dict>
                <key>url</key>
                <string>http://downloadarchive.documentfoundation.org/libreoffice/old/%version_maximum%/mac/%ARCH%/LibreOffice_%version_maximum%_MacOS_%aux_arch_name%.dmg</string>
                <key>filename</key>
                <string>%NAME%-%ARCH%.dmg</string>
            </dict>
        </dict>
        <dict>
            <key>Processor</key>
            <string>EndOfCheckPhase</string>
        </dict>
        <dict>
            <key>Processor</key>
            <string>CodeSignatureVerifier</string>
            <key>Arguments</key>
            <dict>
                <key>input_path</key>
                <string>%pathname%/LibreOffice.app</string>
                <key>requirement</key>
                <string>(identifier "org.libreoffice.script.LibreOffice" or identifier "org.libreoffice.script") and anchor apple generic and certificate 1[field.1.2.840.113635.100.6.2.6] /* exists */ and certificate leaf[field.1.2.840.113635.100.6.1.13] /* exists */ and certificate leaf[subject.OU] = "7P5S3ZLCN7"</string>
                <key>strict_verification</key>
                <true />
            </dict>
        </dict>
    </array>
</dict>
</plist>
juloski commented 4 months ago

Joining to the issue.

The following recipes failed: LibreOffice.munki.recipe Error in local.munki.LibreOffice: Processor: URLTextSearcher: Error: No match found on URL: https://www.libreoffice.org/download/release-notes/

Download link is not valid. Please correct it.

Have a nice day. Juliusz

gregneagle commented 4 months ago

@juloski this would be a new, different issue.

juloski commented 4 months ago

Thx for advise. Just created a new issue :-)