Skip to content

lazarus: Refactor installation logic, add file associations#17765

Merged
z-Fng merged 2 commits into
ScoopInstaller:masterfrom
SorYoshino:lazarus
May 5, 2026
Merged

lazarus: Refactor installation logic, add file associations#17765
z-Fng merged 2 commits into
ScoopInstaller:masterfrom
SorYoshino:lazarus

Conversation

@SorYoshino

Copy link
Copy Markdown
Contributor

Summary

Refactors the lazarus manifest to improve FPC configuration reliability and introduces automatic registry generation for file associations.

Related issues or pull requests

Changes

  • Refactor: Replace hardcoded path parsing in post_install with a dynamic search for fpcmkcfg.exe. This ensures the compiler configuration (fpc.cfg) is generated correctly regardless of version-specific subfolder naming.
  • Feature: Add template-based registry integration for file associations (.pas, .inc, .lpr, .lpi, etc.).
  • Uninstaller: Add a script to automate the removal of registry entries upon uninstallation.
  • Environment: Include lazarus.exe in the bin array.

Testing

The test results are as follows:
┏[ D:\Temporary\Software\Microsoft\Windows Sandbox\Repositories\Scoop\Buckets\Extras][ lazarus ≡  ~1]
└─> scoop install Unofficial/lazarus
Installing 'lazarus' (4.6) [64bit] from 'Unofficial' bucket
Loading lazarus-4.6-fpc-3.2.2-win64.exe from cache.
Checking hash of lazarus-4.6-fpc-3.2.2-win64.exe... OK.
Extracting lazarus-4.6-fpc-3.2.2-win64.exe... Done.
Running installer script... Done.
Linking D:\Software\Scoop\Local\apps\lazarus\current => D:\Software\Scoop\Local\apps\lazarus\4.6
Creating shim for 'lazarus'.
Making D:\Software\Scoop\Local\shims\lazarus.exe a GUI binary.
Creating shim for 'lazbuild'.
Creating shortcut for Lazarus (lazarus.exe)
Creating shortcut for Lazarus (debug) (startlazarus.exe)
Setting user environment variable: LazarusDir = D:\Software\Scoop\Local\apps\lazarus\current
Setting user environment variable: LazDir = D:\Software\Scoop\Local\apps\lazarus\current
Running post_install script... Done.
'lazarus' (4.6) was installed successfully!
Notes
-----
To register file associations, please execute the following command:
reg import "D:\Software\Scoop\Local\apps\lazarus\current\install-associations.reg"
-----

┏[ D:\Temporary\Software\Microsoft\Windows Sandbox\Repositories\Scoop\Buckets\Extras][ lazarus ≡  ~1]
└─> reg import "D:\Software\Scoop\Local\apps\lazarus\current\install-associations.reg"
The operation completed successfully.

┏[ D:\Temporary\Software\Microsoft\Windows Sandbox\Repositories\Scoop\Buckets\Extras][ lazarus ≡  ~1]
└─> scoop uninstall lazarus -p
Uninstalling 'lazarus' (4.6).
Running uninstaller script... Done.
Removing shim 'lazarus.shim'.
Removing shim 'lazarus.exe'.
Removing shim 'lazbuild.shim'.
Removing shim 'lazbuild.exe'.
Removing shortcut ~\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Scoop Apps\Lazarus.lnk
Removing shortcut ~\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Scoop Apps\Lazarus (debug).lnk
Unlinking D:\Software\Scoop\Local\apps\lazarus\current
Removing user environment variable: LazarusDir
Removing user environment variable: LazDir
Removing persisted data.                                                                                                
'lazarus' was uninstalled.
  • Use conventional PR title: <manifest-name[@version]|chore>: <general summary of the pull request>
  • I have read the Contributing Guide

@coderabbitai

coderabbitai Bot commented May 5, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 9d64c93c-1f16-4d8e-8cb6-fa80ef5199d8

📥 Commits

Reviewing files that changed from the base of the PR and between e00ceff and e366dae.

📒 Files selected for processing (1)
  • scripts/lazarus/uninstall-associations.reg
✅ Files skipped from review due to trivial changes (1)
  • scripts/lazarus/uninstall-associations.reg

📝 Walkthrough

Walkthrough

The PR updates the lazarus bucket manifest and adds two registry scripts. The manifest switches license/checksum URLs to HTTPS, replaces inline PowerShell FPC config generation with an installer.script, refactors post_install to generate/import bucket *.reg files with {{lazarus_dir}} substitution and optional HKCU→HKLM mapping, adds an uninstaller.script to import un*.reg on uninstall, expands bin to include both lazarus.exe and lazbuild.exe, and converts checkver to an object with tightened regex. Two .reg files were added: install-associations.reg (creates per-user file associations for seven extensions) and uninstall-associations.reg (removes them).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

  • ScoopInstaller/Extras#17676: Adds per-package install/uninstall .reg templates and manifest wiring including {{*_dir}} substitution and HKCU↔HKLM mapping.
  • ScoopInstaller/Extras#17533: Implements post_install/uninstaller logic to generate and register per-user .reg files with path substitution and optional hive rewriting.
  • ScoopInstaller/Extras#17728: Modifies a bucket manifest to add per-user .reg association scripts and corresponding post_install/uninstaller handling.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main changes: refactoring installation logic and adding file associations, which aligns with the primary objectives in the changeset.
Description check ✅ Passed The PR description includes all required elements: summary, related issue reference (Closes #16866), detailed changes, testing results, and completed checklist items.
Linked Issues check ✅ Passed The PR successfully implements all coding objectives from #16866: dynamic FPC configuration via fpcmkcfg.exe search [lazarus.json], template-based registry file associations [install-associations.reg], uninstaller script [uninstall-associations.reg], and lazarus.exe in bin array.
Out of Scope Changes check ✅ Passed All changes are scoped to the stated objectives: manifest refactoring for FPC config, registry scripts for file associations, uninstaller automation, and bin array expansion. No unrelated modifications detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (1)
bucket/lazarus.json (1)

69-85: Please run the standard Scoop checks before merge.

For this manifest, I’d verify with:

scoop config debug true
.\bin\checkver.ps1 -App lazarus -f
.\bin\formatjson.ps1 -App lazarus
scoop install .\bucket\lazarus.json -a 64bit
scoop install .\bucket\lazarus.json -a 32bit

The contribution guide and manifest wiki are also worth a quick pass if you have not already. As per coding guidelines Provide clear instructions for testing the manifest locally before submission: ... .\bin\checkver.ps1 -App <manifest-name> -f ... .\bin\formatjson.ps1 -App <manifest-name> ... scoop install <manifest-path> -a <architecture>.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@bucket/lazarus.json` around lines 69 - 85, Run the standard Scoop validation
steps for the lazarus.json manifest: execute checkver against the "checkver"
block (use .\bin\checkver.ps1 -App lazarus -f with debug enabled), run
.\bin\formatjson.ps1 -App lazarus to ensure the autoupdate/architecture and hash
sections are well-formed, and verify installation for both architectures by
installing the manifest for 64bit and 32bit to confirm the
"autoupdate.architecture.64bit.url" and "autoupdate.architecture.32bit.url"
templates and the "hash.regex" work as expected; fix any formatting, regex or
URL template issues flagged by these tools before merging.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@bucket/lazarus.json`:
- Around line 9-12: Update the notes entry so users know they must run the reg
import command from an elevated/admin shell when the package was installed with
-g (global), because post_install rewrites the association file to
HKEY_LOCAL_MACHINE when $global is true and a non-elevated reg import will fail;
locate the notes array in bucket/lazarus.json and modify the string "reg import
\"$dir\\install-associations.reg\"" to explicitly mention running as
administrator (or using an elevated shell) when installing with -g.
- Around line 24-30: The installer script must abort when fpcmkcfg.exe is
missing or when it returns non‑zero: after the Get-ChildItem ... | Select-Object
-First 1 pipeline, check that $executable_dir is not null/empty and throw a
clear error (or call exit) if it is; when invoking Start-Process for
"$executable_dir\\fpcmkcfg.exe" use -PassThru to capture the process object and
after Wait verify the process.ExitCode and throw/exit with a descriptive message
if ExitCode is non‑zero so the install fails properly; update references to
$executable_dir, $fpc_dir and $process_args accordingly so downstream code does
not run on a missing executable or failed command.

In `@scripts/lazarus/uninstall-associations.reg`:
- Around line 5-11: The uninstall script currently deletes registry keys it
never created (specifically -HKEY_CURRENT_USER\Software\Lazarus and removing
"Lazarus" under [HKEY_CURRENT_USER\Software\RegisteredApplications]); change it
to only remove keys that this package created during install (the
Software\Classes\... entries or any capability keys you explicitly add). Update
the install step to create explicit capability keys if you need Default Programs
cleanup, and modify uninstall to remove exactly those capability keys (and the
specific Software\Classes subkeys) rather than wiping HKCU\Software\Lazarus or
the generic RegisteredApplications "Lazarus" value.

---

Nitpick comments:
In `@bucket/lazarus.json`:
- Around line 69-85: Run the standard Scoop validation steps for the
lazarus.json manifest: execute checkver against the "checkver" block (use
.\bin\checkver.ps1 -App lazarus -f with debug enabled), run .\bin\formatjson.ps1
-App lazarus to ensure the autoupdate/architecture and hash sections are
well-formed, and verify installation for both architectures by installing the
manifest for 64bit and 32bit to confirm the "autoupdate.architecture.64bit.url"
and "autoupdate.architecture.32bit.url" templates and the "hash.regex" work as
expected; fix any formatting, regex or URL template issues flagged by these
tools before merging.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4b66d8f0-4605-49fb-ab0e-52e507e72bed

📥 Commits

Reviewing files that changed from the base of the PR and between 52c7d83 and e00ceff.

📒 Files selected for processing (3)
  • bucket/lazarus.json
  • scripts/lazarus/install-associations.reg
  • scripts/lazarus/uninstall-associations.reg

Comment thread bucket/lazarus.json
Comment thread bucket/lazarus.json
Comment thread scripts/lazarus/uninstall-associations.reg
@SorYoshino

Copy link
Copy Markdown
Contributor Author

/verify

@github-actions

github-actions Bot commented May 5, 2026

Copy link
Copy Markdown
Contributor

All changes look good.

Wait for review from human collaborators.

lazarus

  • Lint
  • Description
  • License
  • Hashes
  • Checkver
  • Autoupdate
  • Autoupdate Hash Extraction

Check the full log for details.

@z-Fng z-Fng left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution!

@z-Fng z-Fng merged commit 95bd6f3 into ScoopInstaller:master May 5, 2026
3 checks passed
@SorYoshino SorYoshino deleted the lazarus branch May 5, 2026 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Improve]: Lazarus: Add file associations

2 participants