Skip to content

Add a Version_ module which does not depend on install dirs #3909

Closed

Description

@sophie-h

I am using Paths_ (version) to output the version number in my project. However, the

bindir, libdir, datadir, libexecdir, sysconfdir :: FilePath

is making the binary non-reproducible. If this section can't be changed due to compatibility issues, there should be a new reproducible Buildconstants_ or what ever API.

By the way: It would be useful to export name and synopsis too, since they often appear in --version or --help.

Activity

  1. ezyang commented on Sep 28, 2016

    @ezyang
    Contributor

    Well, we certainly can't delete it. What if we added a new Version_ module which contained the information you asked for?

  2. sophie-h commented on Sep 28, 2016

    @sophie-h
    Author

    That would be great and totally do the job.

  3. added this to the ⊥ milestone on Sep 29, 2016
  4. dcoutts commented on Oct 1, 2016

    @dcoutts
    Contributor

    is making the binary non-reproducible.

    @qua-bla sorry if it's an obvious question, but why does that make it non-reproducible? Surely these install paths would be the same each time, if you're using the same configuration.

  5. sophie-h commented on Oct 1, 2016

    @sophie-h
    Author

    On Sat, Oct 1, 2016 at 2:26 AM, Duncan Coutts
    [email protected] wrote:

    Surely these install paths would be the same each time, if you're
    using the same configuration.

    Sure, but why should the config be the same? I don't want force the
    build server to do stuff outside the sandbox.

    The idea of reproducible builds is not that I can build it twice on
    /my/ computer ;)

  6. ezyang commented on Oct 1, 2016

    @ezyang
    Contributor

    I think we'd be happy to take a PR on this. But before working on it, it would be worth to write the putative docs; i.e., what would the API of this module be.

  7. changed the title [-]autogen/Paths_ is not reproducible[/-] [+]Add a Version_ module which does not depend on install dirs[/+] on Oct 1, 2016
  8. sophie-h commented on Oct 1, 2016

    @sophie-h
    Author

    It would be also possible to fix this via a CPP #ifdef in Paths_ that can be controlled via a cabal option (something like "enable-reproducibility"). The advantage would be that package maintainers can fix reproducibility issues without touching code and no new API would be introduced.

    On the other hand the name Paths_ is odd anyways and replacing Paths_ with Version_ as a package maintainer is doable.

    Any thoughts?

  9. ezyang commented on Oct 1, 2016

    @ezyang
    Contributor

    I'm aesthetically opposed to putting CPP in Paths but I don't have any technical reasons for it (besides, I guess, CPP is bad).

  10. hvr commented on Oct 2, 2016

    @hvr
    Member

    but if we had a Paths_ w/o installdirs, then how would a package find where cabal installed its package data and other stuff?

  11. ezyang commented on Oct 2, 2016

    @ezyang
    Contributor

    Well, the point is anyone who would disable the install paths bits wouldn't actually use it (it can't be disabled by default.)

  12. hvr commented on Oct 2, 2016

    @hvr
    Member

    maybe we should have a new field/setting in .cabal to declare whether a package needs any paths, as then we could automatically leave them off for all packages inside an install-plan which don't need them.

  13. sophie-h commented on Oct 2, 2016

    @sophie-h
    Author

    I'm aesthetically opposed to putting CPP in Paths

    totally

    but I don't have any technical reasons for it (besides, I guess, CPP is bad).

    There would be a new config options or something that would have to be carried around for ever. Sound like higher support cost to me. Also changing the flags in my small test implementation required a strange build-clean-build sequence to get the "actual" reproducible result. (There will be a good reason, but who wants to deal with that.)

    How about

    module ProgramInfo_test
      ( ProgramInfo
      , programInfo
      , programName
      , programSynopsis
      , programVersion
      , programCopyright
      , programHomepage
      ) where
    
    import Data.Version (Version, makeVersion)
    
    data ProgramInfo = ProgramInfo
      { programName :: String
      , programVersion :: Version
      , programSynopsis :: String
      , programCopyright :: String
      , programHomepage :: String
      }
    
    programInfo :: ProgramInfo
    programInfo =
      ProgramInfo
      { programName = "test"
      , programVersion = makeVersion [0, 1, 0, 0]
      , programSynopsis = "Example project"
      , programCopyright = "(c) 2016 Me"
      , programHomepage = "https://example.org"
      }
  14. 27 remaining items

  15. added a commit that references this issue on Oct 29, 2022
  16. added a commit that references this issue on Dec 29, 2022
  17. added a commit that references this issue on Dec 31, 2022
  18. added a commit that references this issue on Dec 31, 2022
  19. blackheaven commented on Dec 31, 2022

    @blackheaven
    Collaborator

    Fixed by #8534

  20. wismill commented on Jan 13, 2023

    @wismill
    Collaborator

    If fixed completely, can this issue be closed?

  21. andreabedini commented on May 22, 2023

    @andreabedini
    Collaborator

    As fas as I can tell, #8534 implemented everything requested here. Feel free to reopen if you think otherwise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions