darcs

Patch 141 Include the exact package versions darcs was compiled

Title Include the exact package versions darcs was compiled
Superseder Nosy List darcs-users, ganesh, kowey, mornfall
Related Issues
Status accepted Assigned To
Milestone

Created on 2010-01-12.21:02:23 by mornfall, last changed 2011-05-10.21:05:38 by darcswatch. Tracked on DarcsWatch.

Files
File name Status Uploaded Type Edit Remove
fix-our-version-mechanism-to-make-non_clean-rebuilds-pick-up-right-version_.dpatch mornfall, 2010-01-12.21:02:22 text/x-darcs-patch
unnamed mornfall, 2010-01-12.21:02:22 text/plain
See mailing list archives for discussion on individual patches.
Messages
msg9799 (view) Author: mornfall Date: 2010-01-12.21:02:22
This might be useful and didn't seem to be too hard. I haven't tested this too
much, but I used Cabal 1.6 docs (but tried only with 1.8, apparently).

2 patches for repository darcs-unstable@darcs.net:darcs:

Tue Jan 12 21:33:26 CET 2010  Petr Rockai <me@mornfall.net>
  * Fix our version mechanism to make non-clean rebuilds pick up right version.
  
  Since Cabal relies on ghc --make, changes in -D flags are not noticed in
  dependency analysis and things do not get rebuild, which translates into stale
  version numbers in produced darcs binaries (only --exact-version was correct in
  the old system). We now tack the version information into a generated module
  instead (header file changes are not noticed by ghc --make either). This
  involves an ugly hack, since autogenerated modules cannot be listed in
  other-modules, since this breaks sdist while at the same time, libraries have
  to have all their modules listed to work. And the version information is part
  of darcslib. The workaround involves tricking the sdist implementation into not
  seeing the other-modules clause in the cabal file. This seems to work.

Tue Jan 12 21:58:41 CET 2010  Petr Rockai <me@mornfall.net>
  * Include the exact package versions darcs was compiled with in --exact-version.
Attachments
msg9847 (view) Author: kowey Date: 2010-01-18.09:29:59
Applied, thanks!  This bundle dumps a list of package versions at the end of
exact-version, which is a very good thing.

I was pleasantly surprised to find out that this still preserves the property
that darcs --exact-version is a working context file, so you can still do
  darcs --exact-version > /tmp/ctx
  darcs get --lazy http://darcs.net --context /tmp/ctx
to get the bug reporter's darcs.

Also note that this brings us a step closer to http://bugs.darcs.net/issue849
being resolved.  It would still be good to dump the flags in there.

Fix our version mechanism to make non-clean rebuilds pick up right version.
---------------------------------------------------------------------------
Thanks to Reinier for reviewing the hard part of this bundle (a
different patch)

Include the exact package versions darcs was compiled with in --exact-version.
------------------------------------------------------------------------------

>      ,"version = \"" ++ version ++ " (" ++ state ++ ")\""
> +    ,"builddeps = " ++ (show $ formatdeps (packageDeps lbi))
>      ,"context = " ++ case ctx of
>                         Just x -> show x
>                         Nothing -> show "context not available"


> +  where formatdeps = unlines . map formatone
> +        formatone p = case packageName p of PackageName n -> n ++ "-" ++ showVersion (packageVersion p)

This looks fine to me.  Just dumps a string like
  builddeps = "HTTP-4000.0.8\narray-0.2.0.0\nbase-3.0.3.1\nbytestring-0.9.1.4\ncontainers-0.2.0.1\ndirectory-1.0.0.3\nfilepath-1.1.0.2\nhashed-storage-0.4.5\nhaskeline-0.6.2.2\nhtml-1.0.1.2\nmmap-0.4.1\nmtl-1.1.0.2\nnetwork-2.2.1.4\nold-time-1.0.0.2\nparsec-2.1.0.1\nprocess-1.0.1.1\nrandom-1.0.0.1\nregex-compat-0.92\nterminfo-0.3.1.1\ntext-0.4\nunix-2.3.2.0\nzlib-0.5.2.0\n"
in Version

Note the use of show on a String so we get things like the newlines.

> hunk ./src/darcs.hs 68
>      ["--exact-version"] -> do
>                putStrLn $ "darcs compiled on "++__DATE__++", at "++__TIME__
>                putStrLn context
> +              putStrLn $ "Compiled with:\n"
> +              putStr builddeps

No surprises there.

-- 
Eric Kow <http://www.nltg.brighton.ac.uk/home/Eric.Kow>
PGP Key ID: 08AC04F9
msg9849 (view) Author: darcswatch Date: 2010-01-18.11:45:39
This patch bundle (with 2 patches) was just applied to the repository http://darcs.net/.
This message was brought to you by DarcsWatch
http://darcswatch.nomeata.de/repo_http:__darcs.net_.html#bundle-d5fb69bc5165a92a55e0c56ea59c44f91d2f2ba1
msg9853 (view) Author: ganesh Date: 2010-01-18.21:19:05
This breaks the build for me with GHC 6.12.1, cabal-install 0.8.0, Cabal
1.8.0.2. Haven't investigated further yet:

Setup.lhs:225:43: Not in scope: `packageDeps'
cabal: Error: some packages failed to install:
darcs-2.3.1 failed during the configure step. The exception was:
ExitFailure 1
msg9855 (view) Author: mornfall Date: 2010-01-19.00:22:03
Ganesh Sittampalam <bugs@darcs.net> writes:
> This breaks the build for me with GHC 6.12.1, cabal-install 0.8.0, Cabal
> 1.8.0.2. Haven't investigated further yet:
>
> Setup.lhs:225:43: Not in scope: `packageDeps'
> cabal: Error: some packages failed to install:
> darcs-2.3.1 failed during the configure step. The exception was:
> ExitFailure 1
Ugh.

It seems that cabal-install picks the system-wide Cabal for compiling
Setup, so even though I have 1.8 installed, I am using 1.6. That's why
this didn't get caught in my testing. Anyway, I have checked, and
packageDeps is now gone and replaced with componentPackageDeps, which is
however not available in 1.6.

My proposed course of action would be this:
- roll this back for 2.4 (probably on the release branch)
- on HEAD, bump required cabal version to 1.8
- fix HEAD to compile with 1.8 (breaking 1.6 here)
- fix HEAD to only compile libdarcs once (using the new 1.8 feature)

I can cabal-install Cabal 1.8 on GHC 6.8, although it will probably take
some persuasion to make cabal-install use it for Setup, actually. Maybe
it is smart enough to figure this out from the required cabal version in
the .cabal file. I'll look into this later...

Yours,
   Petr.
msg9860 (view) Author: kowey Date: 2010-01-19.10:03:29
On Tue, Jan 19, 2010 at 01:22:02 +0100, Petr Rockai wrote:
> My proposed course of action would be this:
> - roll this back for 2.4 (probably on the release branch)

Just making a note that Reinier could just not pull the patch
(or its rollback).

> - on HEAD, bump required cabal version to 1.8
> - fix HEAD to compile with 1.8 (breaking 1.6 here)
> - fix HEAD to only compile libdarcs once (using the new 1.8 feature)

Thanks,

-- 
Eric Kow <http://www.nltg.brighton.ac.uk/home/Eric.Kow>
PGP Key ID: 08AC04F9
msg14297 (view) Author: darcswatch Date: 2011-05-10.21:05:38
This patch bundle (with 2 patches) was just applied to the repository http://darcs.net/reviewed.
This message was brought to you by DarcsWatch
http://darcswatch.nomeata.de/repo_http:__darcs.net_reviewed.html#bundle-d5fb69bc5165a92a55e0c56ea59c44f91d2f2ba1
History
Date User Action Args
2010-01-12 21:02:23mornfallcreate
2010-01-12 21:03:22darcswatchsetdarcswatchurl: http://darcswatch.nomeata.de/repo_http:__darcs.net_.html#bundle-d5fb69bc5165a92a55e0c56ea59c44f91d2f2ba1
2010-01-18 09:30:03koweysetnosy: + kowey
messages: + msg9847
2010-01-18 11:45:39darcswatchsetstatus: needs-review -> accepted
messages: + msg9849
2010-01-18 21:19:06ganeshsetnosy: + ganesh
messages: + msg9853
2010-01-19 00:22:04mornfallsetmessages: + msg9855
2010-01-19 10:03:31koweysetmessages: + msg9860
2011-05-10 21:05:38darcswatchsetmessages: + msg14297