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

WIP/RFC: stdenv: deprecate passing a string for configureFlags #15799

Closed

Commits on May 29, 2016

  1. WIP: stdenv: deprecate passing a string for configureFlags

    Currently, configureFlags can be passed as a string or a list.
    Passing a string works OK for small cases but it becomes hard to manage
    interspersing spaces between the flags with many options, and doesn't
    match the semantics of each flag being a separate item.
    Passing a list (of strings) is a better fit for the type of data, but
    it currently relies on Nix's regular conversion to an environment
    variable, which simply concatenates the contents with spaces.
    This breaks if any of the configure flags themselves contain spaces.
    configureFlagsArray was added as a way to get around this limitation,
    but is unsatisfactory to use because items must be appended via bash
    in a preConfigure hook.
    
    So, update configureFlags to be more ergonomic:
      - Deprecate passing a string for configureFlags (require a list),
        and include helpful trace/abort messages.
      - Pass the list to the builder in a smarter way: instead of relying
        on Nix's conversion to a string, perform our own conversion by
        interspersing tabs. Tabs should be fairly rare in configureFlags;
        in case a literal tab needs to be passed, it must be given extra
        escapes:
        configureFlags = [ "--with-some-arg-with-a-\\\t-character" ]
        (The only alternative would require usage of eval.)
        This also fixes passing flags that contain spaces.
      - Make the list available during preConfigure as a bash array, so any
        dynamic modifications to the configure flags can be done there.
    
    There are roughly 1500 uses of configureFlags at present, which is too
    many to change all at one time, and it is a commonly used flag (e.g.
    in packages outside of nixpkgs). So, use a generous deprecation
    timetable: start warning in the next release (16.09), and convert to a
    hard error in the release after that (17.03). Since we are mid-way
    between releases, this gives 9 months and 1.5 releases for users to
    upgrade; switching from strings to lists is not too hard.
    
    These changes make also configureFlagsArray redundant. There are roughly
    70 uses of configureFlagsArray at present, which is enough to remove all
    at once (in a future patchset).
    
    This is a WIP that I'm posting as an RFC; I've updated enough files
    to be able to build bash successfully. More to come if this is
    welcomed, but I'd like to get help with converting all the uses.
    I'd also like to know which docs need to be updated.
    aneeshusa committed May 29, 2016
    Configuration menu
    Copy the full SHA
    9e7f629 View commit details
    Browse the repository at this point in the history