whyrusleeping / gx

A package management tool
MIT License
1.88k stars 110 forks source link

Detect modifications in an installed package #161

Open schomatis opened 6 years ago

schomatis commented 6 years ago

Is there a way to detect if a package installed with gx was modified (e.g., by checking its hash) to fetch it again?

While working on IPFS, I sometimes modify code belonging to another package, a dependency installed with gx, without noticing it. This other package is not tracked by git (unlike IPFS itself when downloaded with go get) and that modification can go unnoticed (until the package version is updated).

From what I understand reading the code, the way to decide to fetch or not a package is to check for its package.json file, would it be possible to extend this logic to check the entire package for modifications? How complicated would that be to implement (for a new user)?

There's another issue (#77) which mentions the inclusion of a gx status tool, but I'm not sure if it would have the same purpose as this use case.

djdv commented 6 years ago

I was wondering this as well, since packages are hashed and reside in a directory of their own hash, I'd imagine you could just rehash the directory, if the hashes match you're not likely modified, if they don't, refetch.

schomatis commented 6 years ago

@whyrusleeping Sorry to bother you again with this but it would be really useful for my workflow as IPFS is a very repo-distributed project. I'm ok with working on the PR, I would just need some advice on how to approach it.

whyrusleeping commented 6 years ago

@schomatis the general way we try to work on dependencies in gx is to use gx-go link which links the normal github repo of the code over the top of the hash. That way you can modify the code in git.

Does that solve your issue? If not, we can look at a new command here.

schomatis commented 6 years ago

@whyrusleeping Thanks, I'll give that a try and let you know.