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

[Cache] Add integrity check using checksums. #10064

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

Conversation

codiophile
Copy link
Contributor

Relates to #10053, but adds built in integrity checking instead of adding a separate command.

This is a first version intended to show the effect. Will probably have to do some refactoring, to make sure that we have a lock while performing integrity checks.

Relates to CocoaPods#10053, but adds built in integrity checking instead of adding a separate command.

This is a first version intended to show the effect. Will probably have to do some refactoring, to make sure that we have a lock while performing integrity checks.
@CocoaPodsBarista
Copy link

1 Warning
⚠️ Please include a CHANGELOG entry to credit yourself!
You can find it at CHANGELOG.md.

Here's an example of your CHANGELOG entry:

* [Cache] Add integrity check using checksums.  
  [codiophile](https://github.com/codiophile)
  [#issue_number](https://github.com/CocoaPods/CocoaPods/issues/issue_number)

note: There are two invisible spaces after the entry's text.

Generated by 🚫 Danger

@dnkoutso dnkoutso added this to the 1.11.0 milestone Sep 21, 2020
@@ -156,6 +157,34 @@ def self.valid_lock?(file, filename)

private

def checksum_for_directory(directory)
Copy link
Contributor

Choose a reason for hiding this comment

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

how "expensive" (slow) can this get? should we provide a cache keyed by directory?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

how "expensive" (slow) can this get?

Well, it didn't have any noticeable impact on test execution time, so it seems fairly cheap. I would assume that the main bottleneck for MD5 is the I/O and not CPU. Considering that we are already doing other I/O operations (like downloading and copying) in connection with this, I think it is fair to assume that the files being checked are already cached in RAM. I suppose, in theory, you could have a problem with pods that are too big to fit in RAM, but pods are generally small and RAM is generally plentiful, so in practice, that should never be a problem.

should we provide a cache keyed by directory?

I'm afraid I don't understand the question. :)

@dnkoutso
Copy link
Contributor

dnkoutso commented Oct 2, 2020

@codiophile can you rebase? we actually converted to GH actions on latest master.

@codiophile
Copy link
Contributor Author

@codiophile can you rebase? we actually converted to GH actions on latest master.

Hi @dnkoutso, I just saw this. I've been swamped with work lately. I will have a look when I find some time.

@dnkoutso
Copy link
Contributor

@codiophile friendly ping if you'd like to rebase this one just to ensure everything still passes.

@dnkoutso
Copy link
Contributor

@igor-makarov does this look good to you?

md5.hexdigest
end

def validate_cache(path)
Copy link
Contributor

Choose a reason for hiding this comment

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

this seems to be returning a bool, perhaps rename to cache_valid? instead?

@@ -281,12 +310,14 @@ def in_tmpdir(&blk)
#
def copy_and_clean(source, destination, spec)
specs_by_platform = group_subspecs_by_platform(spec)
Pod::Installer::PodSourcePreparer.new(spec, source).prepare!
Copy link
Contributor

Choose a reason for hiding this comment

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

what is the reason to move those out of the lock file block?

@dnkoutso dnkoutso removed this from the 1.11.0 milestone Aug 14, 2021
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.

None yet

3 participants