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

Standardize package names: lower-case, not Mixed_CASE #2475

Merged
merged 15 commits into from
Jan 5, 2017

Conversation

citibeth
Copy link
Member

@citibeth citibeth commented Dec 4, 2016

@adamjstewart
This PR converts all package names to lower case. Benefits:

  1. Conforms to previously-discussed Spack standard.
  2. Make it easier for users to "guess" the right name of a package. (Is it "Python" or "python"? "R" or "r"?)
  3. Works better on macOS

@adamjstewart
Copy link
Member

Can you elaborate on point 3: "Works better on macOS"?

@citibeth
Copy link
Member Author

citibeth commented Dec 4, 2016

Can you elaborate on point 3: "Works better on macOS"?

Running things like git mv R r can produce strange results on macOS. Also, macOS will have problems if we were to create multiple packages that differ only in their case.

@hartzell
Copy link
Contributor

hartzell commented Dec 4, 2016

The mac file system, by default, is "case-insensitive but case-preserving", it remembers how you created a file but doesn't use the info for anything. The Google has more info, e.g. here.

I learned this back in the day when I was working with a project in svn that had both a makefile and Makefile, checking them out on an OS X machine led to much hilarity.

@adamjstewart
Copy link
Member

By the way, I made a few changes to how spack create chooses a default name in #2351 that should help make things more uniform. @citibeth If you haven't already, can you convert packages like the_silver_searcher to the-silver-searcher? It goes along the same lines of not knowing whether it is uppercase or lowercase.

@citibeth citibeth changed the title Convert all package names to lower case Standardize package names: lower-case, not Mixed_CASE Dec 5, 2016
@alalazo
Copy link
Member

alalazo commented Dec 5, 2016

@glennpj @JavierCVilla Pinging the two guys that contributed most to r packaging.

Copy link
Member

@adamjstewart adamjstewart left a comment

Choose a reason for hiding this comment

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

I think the change from R to r is the only thing particularly controversial about this PR, but I'm in favor of it.

@citibeth
Copy link
Member Author

citibeth commented Dec 5, 2016 via email

@tgamblin
Copy link
Member

tgamblin commented Dec 5, 2016

How strongly do people feel about this? I would be ok with merging this right before the 0.10 release, as this just brings all the packages inline with the convention we're using for spack create. I wonder if this is a big disruption for R users, though.

@davydden @alalazo @glennpj

@davydden
Copy link
Member

davydden commented Dec 5, 2016

I wonder if this is a big disruption for R users, though.

i never used R, but i like the fact that everything is named consistently and there is no difference between py-foo and r-foo.

@tgamblin
Copy link
Member

tgamblin commented Dec 5, 2016

I like the consistency. Mostly looking for @glennpj's feedback as I believe he has R users.

@glennpj
Copy link
Contributor

glennpj commented Dec 5, 2016

@tgamblin That change should be fine.

@alalazo
Copy link
Member

alalazo commented Dec 5, 2016

@tgamblin also fine with me

@tgamblin
Copy link
Member

tgamblin commented Dec 5, 2016

@citibeth Ok people are ok with this. Let's get this merged quickly, as it is a lot of changes. Can you rebase on current develop and make sure there are no more mixed-case packages?

@citibeth citibeth force-pushed the 161204-efischer/DowncasePackages branch from 17bc1f6 to e76e9a3 Compare December 5, 2016 23:29
@citibeth
Copy link
Member Author

citibeth commented Dec 5, 2016

OK, done.

@tgamblin
Copy link
Member

tgamblin commented Dec 6, 2016

I added a test to enforce the convention, so Travis will fail if new, nonconforming packages appear.

While I was doing that, I encountered an issue. The updates in this branch do NOT naturally take effect for Mac OS X users, because git doesn't correct the directory names. This causes tests like package_sanity to fail. It's similar to the issue mentioned above where mv works in funny ways on Mac OS X. This may be because I use GNU mv from coreutils and not the builtin Mac OS X mv but I don't know what git uses to change names on checkout.

How do we make this not immediately break for Mac OS X users? It would be nice if we could easily check the branch out and switch to a new one without getting case errors, but I dunno the best way to do it without calling git ls-tree and correcting the builtin package repo.

@davydden: can you check this branch out without getting test errors on your mac due to uncorrected directory names in var/spack/repos/builtin/packages?

@citibeth
Copy link
Member Author

citibeth commented Dec 6, 2016 via email

@JavierCVilla
Copy link
Contributor

@citibeth I'm not sure about this but just in case, shouldn't affect the change to lower-case also to these parts of the current R/package.py file?

    @property
    def r_lib_dir(self):
        return join_path('rlib', 'R', 'library')
        run_env.prepend_path('LIBRARY_PATH',
                             join_path(self.prefix, 'rlib', 'R', 'lib'))
        run_env.prepend_path('LD_LIBRARY_PATH',
                             join_path(self.prefix, 'rlib', 'R', 'lib'))
        run_env.prepend_path('CPATH',
                             join_path(self.prefix, 'rlib', 'R', 'include'))
        # R extension builds can have a global R executable function
        module.R = Executable(join_path(self.spec.prefix.bin, 'R'))

I mean in the join_path where R is still appended in upper-case.

@citibeth
Copy link
Member Author

citibeth commented Dec 6, 2016 via email

@adamjstewart
Copy link
Member

@citibeth You'll also need to update this line so that spack create uses lowercase R.

@adamjstewart
Copy link
Member

There's also a lot of stuff in lib/spack/spack/util/naming.py (and possibly elsewhere) that allows packages to contain _ and A-Z values. If we really want to be thorough, changing these would completely disallow future packages from containing these characters.

@citibeth
Copy link
Member Author

citibeth commented Dec 7, 2016 via email

@adamjstewart
Copy link
Member

That just adds work for us to keep an eye out for that. At some point, a non-conforming package will slip in, and we will end up in the same mess of not being able to lowercase packages on macOS. Better to do it right the first time if you ask me.

@citibeth
Copy link
Member Author

citibeth commented Dec 7, 2016 via email

@adamjstewart
Copy link
Member

Not at the moment (probably not any time soon either).

@citibeth citibeth force-pushed the 161204-efischer/DowncasePackages branch from 4d22010 to f2bfe6f Compare December 30, 2016 22:55
@citibeth
Copy link
Member Author

citibeth commented Dec 30, 2016

@alalazo @tgamblin Are you able to help with the test failures I'm getting here? It's only failing on Python 2.6.

______________ PackageSanityTest.test_all_versions_are_lowercase _______________
self = <spack.test.package_sanity.PackageSanityTest testMethod=test_all_versions_are_lowercase>
    def test_all_versions_are_lowercase(self):
        """Spack package names must be lowercase, and use `-` instead of `_`.
            """
        errors = []
        for name in spack.repo.all_package_names():
            if re.search(r'[_A-Z]', name):
                errors.append(name)
    
>       self.assertEqual([], errors)
E       AssertionError: [] != ['direct_mpich', 'indirect_mpich', 'simple_inheritance', 'trivial_install_test_package']
../../../lib/spack/spack/test/package_sanity.py:70: AssertionError
=============== 1 failed, 481 passed, 1 xfailed in 75.12 seconds ===============

@alalazo
Copy link
Member

alalazo commented Dec 31, 2016

@citibeth I don't know if I'll have time later in the day to check the causes, but it seems it's failing because it checks builtin.mock instead of builtin.

@citibeth citibeth mentioned this pull request Jan 1, 2017
5 tasks
@citibeth
Copy link
Member Author

citibeth commented Jan 1, 2017

@adamjstewart I found the problem... unit tests were still using underscores in package names instead of dashes. But this yields a few questions:

  1. The tests that tripped me up were checking for underscores and capital letters in the test repo. That's all fine, but... are they ALSO doing this check in the main repo?

  2. It would still be nice to know why this is failing on Python 2.6 and Mac, but succeeding on other systems. My best guess is that in some cases, the unit test is checking the main repo; and in others, it is checking the test repo. That would seem to be wrong, are you able to look into that?

https://travis-ci.org/LLNL/spack/builds/187805917

Copy link
Member

@adamjstewart adamjstewart left a comment

Choose a reason for hiding this comment

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

Just took another look through this and everything looks solid. There may be other references to capitalized packages in the documentation, but we can fix those whenever. Btw, when I updated the documentation on spack create in #2707, I updated a couple sections that made it sound like capitalized packages or packages with underscores were fine.

I think at some point, we should update Spack's internals that make sure a package name is valid. These still allow packages with uppercase letters and underscores.

Ping @tgamblin, can we get this merged? It affects a lot of packages and will conflict with #2707 and #2709. I also want to get started on an RPackage class, which would heavily conflict with this PR since all of the R packages extend R. Although it would be deleting the extends directive in these packages.

@@ -367,14 +367,14 @@ and has similar effects on module file of dependees. Even in this case

with the following snippet:

.. literalinclude:: ../../../var/spack/repos/builtin/packages/R/package.py
.. literalinclude:: ../../../var/spack/repos/builtin/packages/r/package.py
:pyobject: R.setup_environment

The ``R`` package also knows which environment variable should be modified
Copy link
Member

Choose a reason for hiding this comment

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

@citibeth This should be r. You might want to look through the documentation to make sure there aren't other capitalized packages being reference. The documentation tests aren't foolproof.

@citibeth
Copy link
Member Author

citibeth commented Jan 3, 2017 via email

.. literalinclude:: ../../../var/spack/repos/builtin/packages/R/package.py
:pyobject: R.setup_environment
.. literalinclude:: ../../../var/spack/repos/builtin/packages/r/package.py
:pyobject: r.setup_environment
Copy link
Member

Choose a reason for hiding this comment

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

This isn't going to work. The class is still named R, just like python's class is named Python. You should remove this particular change.

@citibeth citibeth force-pushed the 161204-efischer/DowncasePackages branch from 976b364 to 16efdda Compare January 5, 2017 01:45
@citibeth
Copy link
Member Author

citibeth commented Jan 5, 2017

@tgamblin Can we please get this merged? It's been approved and re-approved. I just rebased again...

@tgamblin tgamblin merged commit 3dd4a01 into develop Jan 5, 2017
@citibeth citibeth deleted the 161204-efischer/DowncasePackages branch January 5, 2017 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants