Hi,

This will shut up the annoying warnings on hs-* packages during
pkg_add -u.

It's ugly, but IMHO it doesn't cause any harm for normal users of
ghc-pkg, because no sane person would ever run something like

        ghc-pkg unregister bytestring -v0 --force

manually (where both -v0 and --force are given). Heck, nobody is
supposed to use the register/unregister subcommands of ghc-pkg at
all, except when fiddling with an already broken hs-* package
repository. So, if anyone runs this manually, he should know what
he's doing.

And the "warning" message is wrong anyway, because with --force,
it should read "unregistering blah *will* break the following
packages:"

Comments, or any suggestions for better solutions?

Ciao,
        Kili


Index: Makefile
===================================================================
RCS file: /cvs/ports/lang/ghc/Makefile,v
retrieving revision 1.84
diff -u -p -r1.84 Makefile
--- Makefile    11 Oct 2012 11:05:02 -0000      1.84
+++ Makefile    4 Nov 2012 20:18:28 -0000
@@ -11,7 +11,7 @@ COMMENT-doc =         documentation for GHC
 
 DISTNAME =             ghc-${MODGHC_VER}
 PKGNAME-main =         ghc-${MODGHC_VER}
-REVISION-main =                1
+REVISION-main =                2
 PKGNAME-doc =          ghc-doc-${MODGHC_VER}
 CATEGORIES =           lang devel
 HOMEPAGE =             http://www.haskell.org/ghc/
Index: patches/patch-utils_ghc-pkg_Main_hs
===================================================================
RCS file: patches/patch-utils_ghc-pkg_Main_hs
diff -N patches/patch-utils_ghc-pkg_Main_hs
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-utils_ghc-pkg_Main_hs 4 Nov 2012 20:18:28 -0000
@@ -0,0 +1,17 @@
+$OpenBSD$
+
+Horrible hack to get rid of the annoying warnings when running
+pkg_add -u. This means that you do NOT get any such warning when
+running ghc-pkg unregister ... -v0 --force.
+
+--- utils/ghc-pkg/Main.hs.orig Wed Jun  6 19:10:25 2012
++++ utils/ghc-pkg/Main.hs      Sun Nov  4 20:45:43 2012
+@@ -915,7 +915,7 @@ modifyPackage fn pkgid verbosity my_flags force = do
+       new_broken = map sourcePackageId (brokenPackages (allPackagesInStack 
new_stack))
+       newly_broken = filter (`notElem` map sourcePackageId old_broken) 
new_broken
+   --
+-  when (not (null newly_broken)) $
++  when (not (null newly_broken || (force == ForceAll && verbosity <= 
Silent))) $
+       dieOrForceAll force ("unregistering " ++ display pkgid ++
+            " would break the following packages: "
+               ++ unwords (map display newly_broken))

Reply via email to