Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always copy PHP and legacy CLI files if they have changed #94

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

pjcdawkins
Copy link
Contributor

@pjcdawkins pjcdawkins commented Aug 4, 2023

This checks the existing PHP and legacy CLI files on every run, and re-copies them if necessary.

On Linux it compares the file content (chunk by chunk).

On Windows it compares against a known hash of the Zip file, and if that has changed, it unzips the file again. It also checks that hash during build against the remote sha256sum.txt file, to confirm that the curl download succeeded.

Original description:

Saves static hashes for each file and checks their size / hash on each run

Suggestion for #92

@pjcdawkins pjcdawkins force-pushed the compare-file-hashes branch 2 times, most recently from 042e5b7 to f19ce9d Compare August 4, 2023 08:38
@pjcdawkins
Copy link
Contributor Author

@akalipetis this will conflict with the vendorization work - but I was playing with it anyway, to find an efficient way to check the files

@akalipetis akalipetis self-requested a review August 7, 2023 13:39
Copy link
Member

@akalipetis akalipetis left a comment

Choose a reason for hiding this comment

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

The main issues in here are:

  1. There's no need to include a new library (afero) for abstracting the filesystem, we can use fs.FS instead
  2. The hash should be computed from the actual file, not from a file containing the hash value - this beats the purpose of checking hashes in the first place

Makefile Outdated Show resolved Hide resolved
internal/file/file.go Outdated Show resolved Hide resolved
internal/file/file.go Outdated Show resolved Hide resolved
internal/file/file.go Outdated Show resolved Hide resolved
internal/file/file.go Outdated Show resolved Hide resolved
@pjcdawkins pjcdawkins force-pushed the compare-file-hashes branch from 1209f44 to f0a1218 Compare August 23, 2023 19:00
@pjcdawkins pjcdawkins force-pushed the compare-file-hashes branch 3 times, most recently from e16a11a to 437f559 Compare December 10, 2024 10:48
@pjcdawkins
Copy link
Contributor Author

pjcdawkins commented Dec 10, 2024

Re.

There's no need to include a new library (afero) for abstracting the filesystem, we can use fs.FS instead

fs.FS is read only, and ideally we would test writing files, which afero would support.

But, we could drop all of the testable FS stuff and just write real temporary files with os.

@pjcdawkins pjcdawkins force-pushed the compare-file-hashes branch 20 times, most recently from 8bef9a8 to a8aa93c Compare December 10, 2024 23:54
@pjcdawkins pjcdawkins force-pushed the compare-file-hashes branch from 3bd3c31 to 97b5258 Compare January 3, 2025 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants