ScoopInstaller / Scoop

A command-line installer for Windows.
https://scoop.sh
Other
20.41k stars 1.37k forks source link

Print changelog when updating #2067

Open alejandro5042 opened 6 years ago

alejandro5042 commented 6 years ago

Would be great to print changelog notes for the apps you're updating! Perhaps as a --changelog, -c option. Many projects publish a changelog.txt or GitHub release notes or similar.

dsbert commented 6 years ago

Maybe there could be a manifest option for a CHANGELOG url?

r15ch13 commented 6 years ago

@alejandro5042 Do you mean the changelog of a program or a changelog of updated manifest files? Scoop is updating itself, so the only way to show a changelog for manifest files is by passing the output of git pull to the console. Showing the changelog of a program is out of scope, I think. Adding a property to the manifest with a link to the programs changelog would be okay I guess.

alejandro5042 commented 6 years ago

I did mean the changelog of the programs being updated.

Adding a property to the manifest with a link to the programs changelog would be okay I guess.

I can imagine parsing changelogs is out of scope. How about a --changelog option that opens a browser to the changelog URL if the program updated? That way you can scan what's new very easily.

This is what I'm doing, but by hand, today.

harvastum commented 2 years ago

It would be nice to see the shortened version of the changelog of each item (or a link to the changelog) in the output of scoop status command. This is the command I use to see what has updates pending, so it would make it easier to decide whether I should update or skip the currently version of each program.

rashil2000 commented 2 years ago

The changelog for applications is usually a single HTML page or a file, I'm not sure how you would extract the changes for the most recent release, for each different app.

dsbert commented 2 years ago

I think the changelog/release notes link is a great start.

Projects like https://github.com/renovatebot/renovate/ do changelog parsing, but I'm guessing there's a whole set of tools built up around changelog parsing for them.

harvastum commented 2 years ago

A link to the changelog would indeed make things much more smooth. Also, maybe it's an opportunity to encourage developers to start using some standardized form of changelogs? A quick google search yields this: https://keepachangelog.com/en/1.0.0/

rashil2000 commented 2 years ago

Adding a "changelog": "https://link/to/changelog" property in the manifest seems like a doable idea

hgkamath commented 2 years ago

I second this feature -> Adding a "changelog": "https://link/to/changelog" property in the manifest seems like a doable idea Also, printing out a line with the link to the conole-log during scoop-install/update is also a good idea. For the interested user, it saves time/effort involved with google search and a few clicks. Scoop doesn't have to webcrawl/extract/store any changelog info itself.

Example:

Updating 'ventoy' (1.0.76 -> 1.0.77)
Downloading new version
ventoy-1.0.77-windows.zip (15.2 MB) [=========================================================================] 100%
Checking hash of ventoy-1.0.77-windows.zip ... ok.
Uninstalling 'ventoy' (1.0.76)
Unlinking C:\vol\scoop_01\SCOOPG\apps\ventoy\current
Installing 'ventoy' (1.0.77) [64bit]
Loading ventoy-1.0.77-windows.zip from cache
Extracting ventoy-1.0.77-windows.zip ... done.
Running pre_install script...
Linking C:\vol\scoop_01\SCOOPG\apps\ventoy\current => C:\vol\scoop_01\SCOOPG\apps\ventoy\1.0.77
Creating shortcut for Ventoy2Disk (Ventoy2Disk_X64.exe)
Creating shortcut for VentoyPlugson (VentoyPlugson.exe)
Creating shortcut for VentoyVlnk (VentoyVlnk.exe)
Persisting log.txt
Persisting Ventoy2Disk.ini
See changelog at https://github.com/ventoy/Ventoy/releases/
ventoy' (1.0.77) was installed successfully!

There doesn't always have to be a changelog file, a link that opens in a browser that is close-enough for a user to click/scroll and find whatever info a user wants. For those softwares that don't have a CHANGELOG file or release-changes page, the next nearest thing like an official-webpage describing version updates would do.

rashil2000 commented 2 years ago

A message displaying "See what's new in this update: https://link/to/changelog" when the update happens seems to be a nice idea.

Would you like to work on this feature? It will mostly require a change in the JSON schema.

dsbert commented 2 years ago

I like the idea, but sometimes I want to know what I'm getting before I actually perform an update. Please also consider adding the ability to view the changelog links without updating. For example, to scoop status, possibly behind a flag if you don't want to change the default output.

Thanks

cesaryuan commented 1 year ago

I'd like to work on this, but I can't guarantee the quality of the code, so anyone else who wants to work on this can do it in sync.

YDX-2147483647 commented 6 months ago

I write a simple script to Get-Changelog by leveraging gh and glow. It does not solve this issue, but can be used as a workaround.

https://gist.github.com/YDX-2147483647/f8c11c3355f0e9d2aaa8c63926edde08

<#
.SYNOPSIS
    Get changelog of an app in scoop
.NOTES
    Prerequisites:
    - [scoop](https://scoop.sh).
    - [gh](https://cli.github.com) to interact with GitHub API.
    - [glow](https://github.com/charmbracelet/glow) to render markdown.
.EXAMPLE
    Get-Changelog gh

    Get changelog of gh.
.EXAMPLE
    Get-Changelog gh -Verbose

    Get changelog of gh and show the specific source.
.EXAMPLE
    Get-Changelog just -From File

    Get changelog of just from the `CHANGELOG.md` file in its repo.
.EXAMPLE
    Get-Changelog main/glow

    Get changelog of glow in the main bucket.
.LINK
    https://github.com/ScoopInstaller/Scoop/issues/2067
.LINK
    https://gist.github.com/YDX-2147483647/f8c11c3355f0e9d2aaa8c63926edde08
#>
function Get-Changelog {
    param (
        # An app in scoop. It will be passed to `scoop cat` directly.
        [Parameter(Mandatory = $true)]
        [string] $App,
        # Where to fetch the changelog.
        # - Release: From the GitHub release. (default)
        # - File: From the `CHANGELOG.md` in its repo.
        [ValidateSet("Release", "File")]
        [string] $From = "Release"
    )

    $manifest = scoop cat $App | ConvertFrom-Json

    $github_url = if ($manifest.checkver -eq 'github') {
        [string]$manifest.homepage
    }
    elseif ($null -ne $manifest.checkver.github) {
        [string]$manifest.checkver.github
    }
    else {
        throw "Cannot find GitHub URL for `“$App`”. You can ``scoop home $App`` to open its homepage for changelog, or ``scoop cat $App`` to debug."
    }

    switch ($From) {
        "Release" {
            Write-Verbose "Fetching changelog of $App v$($manifest.version) from the release of ${github_url}."
            gh release view --repo $github_url
        }
        "File" {
            Write-Verbose "Fetching changelog of $App v$($manifest.version) from CHANGELOG.md in ${github_url}."

            $owner_repo = $github_url.Replace('https://github.com/', '')

            $changelog = gh api -H "Accept: application/vnd.github.raw" -H "X-GitHub-Api-Version: 2022-11-28" /repos/${owner_repo}/contents/CHANGELOG.md
            $changelog | glow -
        }
        Default {
            throw "Fetching changelog from `“$From`” is not supported."
        }
    }
}
hgkamath commented 6 months ago

just a scoop user here.
YDX-2147483647, thanks for the script, will note it and it will be useful someday.

Just fyi, the git log of the scoop manifest file for a given software, may contain info on what changed in the manifest file itself like file-name, file-version, file-download-location, etc, provided the scoop package manifest maintainer considers it not trivial enough to note. It may not necessarily contain information of what software features have changed/improved in the installed software itself, unless the scoop package manifest maintainer went out of the way to include the software-changes changelog as part of the commit log for the manifest update. The changelog info-link, desire for which is expressed in issuecomment-1160539800, refers to the URL location/webpage that has the changelog information that is maintained and announced by the developers of the software itself.

[EDIT] I was re-reading your script, and I came to understand that your script fetches the CHANGELOG.md file from the software's actual git repo itself or its associated github-release page. That's good. However, it still does require the software developers to use a publicly available git repo and also, within the repo have and maintain a CHANGELOG.md file. Not all do.
Some just maintain the changelog externally :
in a webpage. ex: https://bugs.kde.org/show_bug.cgi?id=471162
in the github release description. ex: https://github.com/Zettlr/Zettlr/releases (for which you have a option)
Some use different changelog filename: CHANGELOG.txt vs CHANGELOG.md
May use a different git repo provider like gitlab, cgit, launchpad etc

nevertheless, thankyou for your contribution.