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

versions of the package dependencies #4

Open
marjorieB opened this issue Jan 28, 2020 · 0 comments
Open

versions of the package dependencies #4

marjorieB opened this issue Jan 28, 2020 · 0 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@marjorieB
Copy link
Contributor

The dependencies (in struct mmpkg_dep) have two fields min_version and max_version. It is said that min_version is inclusive and max_version is exclusive. However, when min_version==max_version, max_version becomes inclusive.

Therefore the function mmpkg_dep_match_version should be transformed in something like this:

static
int mmpkg_dep_match_version(const struct mmpkg_dep* dep, const struct mmpkg* pkg)
{ 
        int rv;
        mmstr const* any_version = mmstr_malloc_copy("any", strlen("any") + 1); 

        rv = (pkg != NULL
              && (mmstrequal(dep->max_version, any_version) == 0
                  || (mmstrequal(dep->min_version, dep->max_version)
                      && pkg_version_compare(pkg->version, dep->max_version) == 0)
                  || pkg_version_compare(pkg->version, dep->max_version) < 0)
              && pkg_version_compare(dep->min_version, pkg->version) <= 0); 

        mmstr_free(any_version);
        return rv; 
}

First this function is not very good, since a lot of comparison are done.
Moreover, the tests do not pass anymore with this function. I think that we should rework the tests to make the versions of the package coherent with the specifications.

@GabrielGanne GabrielGanne added bug Something isn't working enhancement New feature or request labels Jan 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants