fpm icon indicating copy to clipboard operation
fpm copied to clipboard

`fpm update` does not resolve changes in the package name

Open perazz opened this issue 3 years ago • 3 comments

Description

If I change the package name in fpm.toml, for example from

name = "package_name"
version = "0.1.0"

to

name = "package_name2"
version = "0.1.0"

some commands stop working. For example:

federico@Federicos-MBP collision_test % fpm update 
<ERROR>Dependency name 'package_name2' found, but expected 'package_name' instead
STOP 1

Running fpm clean before updating also does not help:

federico@Federicos-MBP collision_test % ./fpm clean
Delete build, excluding dependencies (y/n)? y
 + rm -rf build/gfortran_2A42023B310FA28D
federico@Federicos-MBP collision_test % ./fpm update
<ERROR>Dependency name 'package_name2' found, but expected 'package_name' instead
STOP 1

Possible Solution

Treat the "package name" dependency in the same way that the package version number does, printing some additional output

Additional Information

No response

perazz avatar Nov 22 '22 08:11 perazz

I believe the change I'm proposing at #800 makes sense: when the user requests an update, and it crashes because the cached dependency tree refers to a different project name, just rebuild the whole tree from scratch. I would not extend this to the build command cause I think it makes sense there that the package name must already be in sync. Also please discard this PR if you think it's not a useful one

perazz avatar Nov 22 '22 09:11 perazz

We use fpm update --clean to update dependencies and their names.

However, there is indeed such a problem. When the new data does not match the cache, we will tend to use fpm clean or fpm update, and we will not remember that there are options such as fpm update --clean.

That's okay, it might be a problem, it might not be.

zoziha avatar Nov 22 '22 10:11 zoziha

I think some further commits were pulled into the pull request, so now I've reverted some of them so the pull request is only about this issue

perazz avatar Nov 22 '22 11:11 perazz