darcs patch: Clean .hi and .o files when recompiling

Hi,
I’d like to see this in the next release, to reduce the delta between xmonad as
shipped by debian and as it is on hackage:
Wed Sep 9 10:15:57 CEST 2009 Joachim Breitner

Interesting! Under what conditions do the .hi and .o files get removed? mail: > Hi, > > Iâd like to see this in the next release, to reduce the delta between xmonad as > shipped by debian and as it is on hackage: > > > Wed Sep 9 10:15:57 CEST 2009 Joachim Breitner> * Clean .hi and .o files when recompiling > This patch is applied to the Debian packages since a few months. During the > last ghc upgrade in Debian, people had to this manually to get their xmonad > compilable again. This patch should mitigate this a bit. > > > Greetings, > Joachim > > Content-Description: A darcs patch for your repository! > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > > New patches: > > [Clean .hi and .o files when recompiling > Joachim Breitner **20090909081557 > Ignore-this: 68d85e6dbe0368debfca83c512006a70 > This patch is applied to the Debian packages since a few months. During the > last ghc upgrade in Debian, people had to this manually to get their xmonad > compilable again. This patch should mitigate this a bit. > ] { > hunk ./XMonad/Core.hs 414 > base = dir > "xmonad" > err = base ++ ".errors" > src = base ++ ".hs" > + hi = base ++ ".hi" > + o = base ++ ".o" > lib = dir > "lib" > libTs <- mapM getModTime . Prelude.filter isSource =<< allFiles lib > srcT <- getModTime src > hunk ./XMonad/Core.hs 424 > then do > -- temporarily disable SIGCHLD ignoring: > uninstallSignalHandlers > + -- remove old interface files, just in case ghc6 was upgraded and does not > + -- like the new ones. Ignore any errors while doing so. > + try $ removeFile hi > + try $ removeFile o > status <- bracket (openFile err WriteMode) hClose $ \h -> do > waitForProcess =<< runProcess "ghc" ["--make", "xmonad.hs", "-i", "-ilib", "-fforce-recomp", "-v0", "-o",binn] (Just dir) > Nothing Nothing Nothing (Just h) > } > > Context: > > [man_xmonad.hs: import Data.Monoid for mempty, keybinding edits > wirtwolff@gmail.com**20090320024624 > Ignore-this: dc8477ffcfdd404f4f60d2cdaf3812d9 > Bring mempty into scope. Add commented ToggleStruts binding. > Replace shadowed modMask in keybindings with modm instead. > ] > [Only watch mtime for .hs, .lhs, .hsc for ~/.xmonad/lib > Adam Vogt **20090503235415 > Ignore-this: e3b1847edf3e07a8182f7fcfc23b00c8 > > Previously xmonad would force a recompile due to the object files being too > new, so only look at files which may contain haskell code. > ] > [Add lib to ghc searchpath with recompilation check > Adam Vogt **20090321232907 > Ignore-this: 8827fb02fe1101d7b66f05d363bef038 > ] > [Remove tabs from ManageHook.hs > Adam Vogt **20090710011424 > Ignore-this: 13903f39b052c025a7bfa50fb701959c > ] > [Set infix 0 --> to reduce parentheses in ManageHooks > Adam Vogt **20090710011308 > Ignore-this: 75804147fffeceddd328869cbca0d20f > > What was previously: > > (appName ?= x <&&> classname ?= y) --> (doFloat <+> doIgnore) > > Can now be: > > appName ?= x <&&> classname ?= y --> doFloat <+> doIgnore > ] > [Pester the user with one (not two) xmessages on config errors > Adam Vogt **20090321233736 > Ignore-this: f481f7d3ba5fca5c53a0b3a87daa32bb > ] > [Minor bugfix in the creation of new StackSets. > Wouter Swierstra **20090503154321] > [Avoid deadly cycle in man/xmonad.hs > Spencer Janssen **20090319081918 > Ignore-this: adcba110caad465a2cbb4b9dca7cb612 > ] > [X.Config.hs, ./man/xmonad.hs: update Event Hook doc > wirtwolff@gmail.com**20090209183837 > Ignore-this: 3792043278932e371e3e2858913a2b17 > ] > [Use records to document Tall's arguments > Spencer Janssen **20090221230628 > Ignore-this: 253c09de793715c18a029406795a42fd > ] > [Fix possible head [] > Joachim Breitner **20090106192026 > This seems to be a rare case, but I just got hit by it. > ] > [ManageHook.doShift: use shiftWin instead of shift > Spencer Janssen **20090219041458 > Ignore-this: 4d7f348d6d394c581ab2809bbc45a2c6 > ] > [Express shift in terms of shiftWin > Spencer Janssen **20090217235343 > Ignore-this: 8f213bca20065a39e7c16027f7b398cf > ] > [Use standard -fforce-recomp instead of undocumented -no-recomp > Don Stewart **20090208165518] > [Support for custom event hooks > Daniel Schoepe **20090203155536 > Ignore-this: f22f1a7ae2d958ba1b3625aa923b7efd > ] > [Make X an instance of Typeable > Daniel Schoepe **20090128215406 > Ignore-this: bb155e62ea4e451460e3b94508dc49d2 > ] > [Add uninstallSignalHandlers, use in spawn > Spencer Janssen **20090122002643 > Ignore-this: d91bde6f965341a2619fe2dde83cc099 > ] > [Create a new session for forked processes > Spencer Janssen **20090122000423 > Ignore-this: f5d9cf254a0b07ddbf204457b7783880 > ] > [TAG 0.8.1 > Spencer Janssen **20090118083910] > [Close stdin in spawned processes > Spencer Janssen **20090117040024 > Ignore-this: 2e372ed6215160adae8da1c44cdede3d > ] > [Document spawnPID > Spencer Janssen **20090117035907 > Ignore-this: 1641bdcf5055b2ec7b9455265f5b1d52 > ] > [Asynchronously recompile/restart xmonad on mod-q > Spencer Janssen **20090117035300 > Ignore-this: 753d8746034f818b81df79003ae5ee0d > ] > [Add --restart, a command line flag to cause a running xmonad process to restart > Spencer Janssen **20090117034959 > Ignore-this: 45c8c8aba7cc7391b95c7e3fb01e5bf9 > ] > [Bump version to 0.8.1 > Spencer Janssen **20090116223621 > Ignore-this: 2e8e9dc7b6ca725542f4afe04253dc57 > ] > [Remove doubleFork, handle SIGCHLD > Spencer Janssen **20090116204742 > Ignore-this: f9b1a65b4f0622922f80ad2ab6c5a52f > This is a rather big change. Rather than make spawned processes become > children of init, we handle them in xmonad. As a side effect of this change, > we never need to use waitForProcess in any contrib module -- in fact, doing so > will raise an exception. The main benefit to handling SIGCHLD is that xmonad > can now be started with 'exec', and will correctly clean up after inherited > child processes. > ] > [Main.hs: escape / in Haddocks > gwern0@gmail.com**20081207020915 > Ignore-this: 2c4525280fbe73c46f3abd8fc13628e9 > This lets haddocks for Main.hs, at least, to build with 2.3.0. > ] > [More flexible userCode function > Daniel Schoepe **20090110221852] > [Call logHook as the very last action in windows > Spencer Janssen **20081209233700 > Ignore-this: 4396ad891b607780f8e4b3b6bbce87e > ] > [Accept inferior crossing events. This patch enables fmouse-focus-follows-screen > Spencer Janssen **20081205045130 > Ignore-this: 3ac329fb92839827aed0a4370784cabd > ] > [Tile all windows at once > Spencer Janssen **20081118074447] > [Factor rational rect scaling into a separate function > Spencer Janssen **20081118072849] > [Change screen focus by clicking on the root window. > Spencer Janssen **20081106224031 > This is a modification of a patch from Joachim Breitner. > ] > [Fix #192. > Spencer Janssen **20081021220059] > [select base < 4 for building on ghc 6.10 > Adam Vogt **20081013214509] > [add killWindow function > Joachim Breitner **20081005001804 > This is required to kill anything that is not focused, without > having to focus it first. > ] > [add'l documentation > Devin Mullins **20080927234639] > [Regression: ungrab buttons on *non* root windows > Spencer Janssen **20081007214351] > [Partial fix for #40 > Spencer Janssen **20081007212053 > Improvements: > - clicking on the root will change focus to that screen > - moving the mouse from a window on a screen to an empty screen changes focus > to that screen > The only remaining issue is that moving the mouse between two empty screens > does not change focus. In order to solve this, we'd have to select motion events > on the root window, which is potentially expensive. > ] > [Track mouse position via events received > Spencer Janssen **20081007203953] > [Fix haddock > Spencer Janssen **20081007094641] > [Move screen locating code into pointScreen > Spencer Janssen **20081007094207] > [Make pointWithin a top-level binding > Spencer Janssen **20081007090229] > [sp README, CONFIG, STYLE, TODO > gwern0@gmail.com**20080913024457] > [Use the same X11 dependency as xmonad-contrib > Spencer Janssen **20080921061508] > [Export focusUp' and focusDown' -- work entirely on stacks > Spencer Janssen **20080911214803] > [add W.shiftMaster, fix float/tile-reordering bug > Devin Mullins **20080911053909] > [TAG 0.8 > Spencer Janssen **20080905195412] > Patch bundle hash: > 1171cd8083331a46701a0426c1f36fbef2f05d41 > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.10 (GNU/Linux) > > iEYEARECAAYFAkqnZLcACgkQ9ijrk0dDIGzR4wCfSq8bA2JT1RlpJTtx25MA/UqI > MS4AoMOG7QjQM6SMVJwiKqTEky9Lxzlc > =loJT > -----END PGP SIGNATURE----- > _______________________________________________ > xmonad mailing list > xmonad@haskell.org > http://www.haskell.org/mailman/listinfo/xmonad

Hi, Am Mittwoch, den 09.09.2009, 06:05 -0700 schrieb Don Stewart:
Interesting!
Under what conditions do the .hi and .o files get removed?
exactly whenever ghc --make xmonad.hs -i -no-recomp -v0... is called, which is upon forced restart or when the source is older than the binary. Greetings, Joachim -- Joachim Breitner e-Mail: mail@joachim-breitner.de Homepage: http://www.joachim-breitner.de ICQ#: 74513189 Jabber-ID: nomeata@joachim-breitner.de

On Wed, Sep 09, 2009 at 10:18:39AM +0200, Joachim Breitner wrote:
Hi,
I???d like to see this in the next release, to reduce the delta between xmonad as shipped by debian and as it is on hackage:
Maybe I missed the original patch (I haven't paid much attention to xmonad in the past two months), but I would really appreciate seeing patches when/before they're applied downstream. If the fix is important enough to apply in Debian, it is probably important enough to at least consider upstream. Speaking of "delta", are there any other non-integration patches that Debian applies?
Wed Sep 9 10:15:57 CEST 2009 Joachim Breitner
* Clean .hi and .o files when recompiling This patch is applied to the Debian packages since a few months. During the last ghc upgrade in Debian, people had to this manually to get their xmonad compilable again. This patch should mitigate this a bit.
Regarding this specific change, perhaps we can delete interface and object files immediately after compiling? We already instruct GHC to ignore them, so they're just taking up disk space. Even better, can we tell GHC to put those files in /tmp and clean them up when compilation is done? Also, core has just added support for modular configs, so any patch will need to clean up the files in .xmonad/lib as well. Cheers, Spencer Janssen

Hi, Am Mittwoch, den 09.09.2009, 17:51 -0500 schrieb Spencer Janssen:
On Wed, Sep 09, 2009 at 10:18:39AM +0200, Joachim Breitner wrote:
I???d like to see this in the next release, to reduce the delta between xmonad as shipped by debian and as it is on hackage:
Maybe I missed the original patch (I haven't paid much attention to xmonad in the past two months), but I would really appreciate seeing patches when/before they're applied downstream. If the fix is important enough to apply in Debian, it is probably important enough to at least consider upstream.
sorry for the late submission, I had planned to bring it up much earlier, but forgot about it.
Speaking of "delta", are there any other non-integration patches that Debian applies?
The delta can be checked here: http://patch-tracker.debian.org/package/xmonad At the moment, it only contains the change of the default terminal from xterm to x-terminal-emulator, so nothing interesting for upstream.
Wed Sep 9 10:15:57 CEST 2009 Joachim Breitner
* Clean .hi and .o files when recompiling This patch is applied to the Debian packages since a few months. During the last ghc upgrade in Debian, people had to this manually to get their xmonad compilable again. This patch should mitigate this a bit. Regarding this specific change, perhaps we can delete interface and object files immediately after compiling? We already instruct GHC to ignore them, so they're just taking up disk space. Even better, can we tell GHC to put those files in /tmp and clean them up when compilation is done?
I’d be more than fine with that as well. Greetings, Joachim -- Joachim "nomeata" Breitner Debian Developer nomeata@debian.org | ICQ# 74513189 | GPG-Keyid: 4743206C JID: nomeata@joachim-breitner.de | http://people.debian.org/~nomeata

On Thu, Sep 10, 2009 at 10:18:26AM +0200, Joachim Breitner wrote:
Speaking of "delta", are there any other non-integration patches that Debian applies?
The delta can be checked here: http://patch-tracker.debian.org/package/xmonad
At the moment, it only contains the change of the default terminal from xterm to x-terminal-emulator, so nothing interesting for upstream.
I took a peek at this and noticed xmonad-session.desktop has the typo "Leightweight". By the way, perhaps we ought to get these .desktop files into upstream? We probably won't install them in the Cabal system, but it might be handy for other distros, or for those users that want to manually cp that file to /usr/. Cheers, Spencer Janssen

Excerpts from Spencer Janssen's message of Thu Sep 17 20:59:17 -0600 2009:
I took a peek at this and noticed xmonad-session.desktop has the typo "Leightweight". By the way, perhaps we ought to get these .desktop files into upstream? We probably won't install them in the Cabal system, but it might be handy for other distros, or for those users that want to manually cp that file to /usr/.
fwiw here's gentoo's: [Desktop Entry] Encoding=UTF-8 Name=xmonad Comment=A lightweight window manager Exec=/etc/X11/Sessions/xmonad TryExec=xmonad Icon= Type=Application Let buyer beware. Have never tried it out, so can't vouch for how well it works with various DE setups. -- wmw

Hi, Am Donnerstag, den 17.09.2009, 21:59 -0500 schrieb Spencer Janssen:
On Thu, Sep 10, 2009 at 10:18:26AM +0200, Joachim Breitner wrote:
Speaking of "delta", are there any other non-integration patches that Debian applies?
The delta can be checked here: http://patch-tracker.debian.org/package/xmonad
At the moment, it only contains the change of the default terminal from xterm to x-terminal-emulator, so nothing interesting for upstream.
I took a peek at this and noticed xmonad-session.desktop has the typo "Leightweight". By the way, perhaps we ought to get these .desktop files into upstream? We probably won't install them in the Cabal system, but it might be handy for other distros, or for those users that want to manually cp that file to /usr/.
thanks for the spotted typo, I’ll fix it with the next upload. If you want to ship it in the xmonad tarball, I’d welcome that! Greetings, Joachim -- Joachim "nomeata" Breitner Debian Developer nomeata@debian.org | ICQ# 74513189 | GPG-Keyid: 4743206C JID: nomeata@joachim-breitner.de | http://people.debian.org/~nomeata

On Wed, Sep 9, 2009 at 6:51 PM, Spencer Janssen
On Wed, Sep 09, 2009 at 10:18:39AM +0200, Joachim Breitner wrote:
Hi,
I???d like to see this in the next release, to reduce the delta between xmonad as shipped by debian and as it is on hackage:
Maybe I missed the original patch (I haven't paid much attention to xmonad in the past two months), but I would really appreciate seeing patches when/before they're applied downstream. If the fix is important enough to apply in Debian, it is probably important enough to at least consider upstream.
Speaking of "delta", are there any other non-integration patches that Debian applies?
Wed Sep 9 10:15:57 CEST 2009 Joachim Breitner
* Clean .hi and .o files when recompiling This patch is applied to the Debian packages since a few months. During the last ghc upgrade in Debian, people had to this manually to get their xmonad compilable again. This patch should mitigate this a bit. Regarding this specific change, perhaps we can delete interface and object files immediately after compiling? We already instruct GHC to ignore them, so they're just taking up disk space. Even better, can we tell GHC to put those files in /tmp and clean them up when compilation is done?
We might be able to. Looking at http://www.haskell.org/ghc/docs/latest/html/users_guide/separate-compilation... I see that what it calls 'temporary files' are already going into /tmp; what we want is to redirect the interface and object files, which would be done with "-odir" and "-hidir". So maybe hunk ./XMonad/Core.hs 460 - waitForProcess =<< runProcess "ghc" ["--make", "xmonad.hs", "-i", "-ilib", "-fforce-recomp", "-v0", "-o",binn] (Just dir) + waitForProcess =<< runProcess "ghc" ["--make", "xmonad.hs", "-i", "-ilib", "-fforce-recomp", "-hidir", "/tmp", "-odir", "/tmp", "-v0", "-o",binn] (Just dir) ? (Can we hardcode /tmp?) If I understand the docs right, this ought to redirect all interface & object files, including anything in .xmonad/lib. -- gwern

On Mon, Mar 22, 2010 at 6:53 PM, Daniel Schoepe
Excerpts from Gwern Branwen's message of Mon Mar 22 21:37:24 +0100 2010:
? (Can we hardcode /tmp?)
We could use System.Directory.getTemporaryDirectory just to be on the safe side.
Sure. So: hunk ./XMonad/Core.hs 446 + tmp <- getTemporaryDirectory hunk ./XMonad/Core.hs 461 - waitForProcess =<< runProcess "ghc" ["--make", "xmonad.hs", "-i", "-ilib", "-fforce-recomp", "-v0", "-o",binn] (Just dir) + waitForProcess =<< runProcess "ghc" ["--make", "xmonad.hs", "-i", "-ilib", "-fforce-recomp", "-hidir", tmp, "-odir", "/tmp", "-v0", "-o",binn] (Just dir) Note that this compiles and leaves in my /tmp a Main.o and a Main.hi, with no intermediates in ~/.xmonad, but xmonad --restart doesn't seem to work for me; I am unsure whether the failure of --restart is part of my general bugginess or related to this edit. Other people trying it out would be good. -- gwern

On Mon, Apr 5, 2010 at 2:17 PM, Gwern Branwen
On Mon, Mar 22, 2010 at 6:53 PM, Daniel Schoepe
wrote: Excerpts from Gwern Branwen's message of Mon Mar 22 21:37:24 +0100 2010:
? (Can we hardcode /tmp?)
We could use System.Directory.getTemporaryDirectory just to be on the safe side.
Sure. So:
hunk ./XMonad/Core.hs 446 + tmp <- getTemporaryDirectory hunk ./XMonad/Core.hs 461 - waitForProcess =<< runProcess "ghc" ["--make", "xmonad.hs", "-i", "-ilib", "-fforce-recomp", "-v0", "-o",binn] (Just dir) + waitForProcess =<< runProcess "ghc" ["--make", "xmonad.hs", "-i", "-ilib", "-fforce-recomp", "-hidir", tmp, "-odir", "/tmp", "-v0", "-o",binn] (Just dir)
Note that this compiles and leaves in my /tmp a Main.o and a Main.hi, with no intermediates in ~/.xmonad, but xmonad --restart doesn't seem to work for me; I am unsure whether the failure of --restart is part of my general bugginess or related to this edit. Other people trying it out would be good.
Since no one has tried this, or tried it and complained, I'm sending in a patch to do this. -- gwern
participants (7)
-
Daniel Schoepe
-
Don Stewart
-
Gwern Branwen
-
Joachim Breitner
-
Joachim Breitner
-
Spencer Janssen
-
Wirt Wolff