build: Finish up out-of-tree changes #8133

pull theuni wants to merge 7 commits into bitcoin:master from theuni:out-of-tree-clean changing 9 files +80 −25
  1. theuni commented at 11:46 pm on June 1, 2016: member

    This fixes the remaining out-of-tree issues:

    • The entire leveldb dir was copied out
    • Python caches were left hanging around
    • A qt file was left dangling in the build-dir
    • The rpc tests couldn’t be run
    • OSX’s make deploy was broken

    make distcheck now passes, and Travis has been switched to an out-of-tree build for dogfooding purposes. Fingers-crossed that it works.

  2. theuni force-pushed on Jun 2, 2016
  3. build: out-of-tree fixups
    Don't glob the leveldb for dist. That means we need to enumerate the headers.
    0cb0f2626e
  4. build: more out-of-tree fixups
    - clear the __pycache__ during 'make clean'
    - Copy the qrc locale file to a temp location and remove it when finished
      (rcc expects everything to be in the same path)
    fc4ad0c7fc
  5. build: a few ugly hacks to get the rpc tests working out-of-tree
    - Link pull-tester/rpc-tests.py to the build dir
    - Add the build-dir's config to the python path so that tests can find it
    - The tests themselves are in srcdir
    - Clean up __pycache__ in 'make clean'
    ab95d5df3d
  6. theuni force-pushed on Jun 2, 2016
  7. theuni force-pushed on Jun 2, 2016
  8. build: fix out-of-tree 'make deploy' for osx
    The plist is generated, lives in builddir.
    92e37a3689
  9. travis: use out-of-tree build 142ffc7e61
  10. jonasschnelli added the label Build system on Jun 2, 2016
  11. in qa/pull-tester/rpc-tests.py: in 142ffc7e61 outdated
    37@@ -37,7 +38,7 @@
    38     # terminal via ANSI escape sequences:
    39     BOLD = ('\033[0m', '\033[1m')
    40 
    41-RPC_TESTS_DIR = BUILDDIR + '/qa/rpc-tests/'
    42+RPC_TESTS_DIR = SRCDIR + '/qa/rpc-tests/'
    


    MarcoFalke commented at 5:11 pm on June 2, 2016:
    Note to myself: Does the cache (from create_cache.py et al.) end up in SRCDIR now?

    laanwj commented at 1:49 pm on June 3, 2016:
    Wasn’t it always (and still is) the case that the cache ends up in the current directory when the tests are launched?

    MarcoFalke commented at 2:45 pm on June 3, 2016:

    Correct.

    Though, this should be changed. Having different caches lying around in folders that happen to be your working dir right then is misleading at best.

    Anyway, this is unrelated to this pull.


    theuni commented at 3:25 pm on June 3, 2016:
    I’m having a hard time answering that question because of the symlink interaction with Python. builddir/rpc-tests.py is now a symlink to sourcedir/rpc-tests.py because it needs to be writable. But that makes the definition of “current dir” hazy. @MarcoFalke I suppose it would be best to make the location explicit.

    MarcoFalke commented at 3:38 pm on June 3, 2016:
    Sure, this is on my list of cleanups. If no one beats me to it, you can expect it some time after feature freeze. ;)
  12. MarcoFalke commented at 5:11 pm on June 2, 2016: member
    Concept ACK
  13. theuni commented at 5:57 pm on June 2, 2016: member

    Generally speaking, if it’s used as-is from git, it’s srcdir. If it’s generated or pre-processed, it’s builddir.

    Put another way: after checkout, think of srcdir as read-only. If anything is modified, it must happen in builddir.

  14. laanwj commented at 1:24 pm on June 3, 2016: member
    utACK 142ffc7
  15. MarcoFalke commented at 3:39 pm on June 3, 2016: member

    make check fails with:

    0Running test/bitcoin-util-test.py...
    1Traceback (most recent call last):
    2  File "../../src/test/bitcoin-util-test.py", line 8, in <module>
    3    import buildenv
    4ImportError: bad magic number in 'buildenv': b'\x03\xf3\r\n'
    
  16. theuni commented at 3:44 pm on June 3, 2016: member

    @MarcoFalke Yes, I just saw that as well while trying to answer the question above. I’m not sure why Travis passes.

    I’ll fix that one up.

  17. theuni commented at 6:16 pm on June 3, 2016: member

    Pushed a quick fix for @MarcoFalke’s problem. I’m not sure if we really need that or not, but it’s probably better than each dev running into the problem and googling for themselves.

    The issue is this: previous invocations of python2 in an in-tree build would leave a buildenv.pyc hanging around in srcdir. We prepend python’s search path with builddir, but for some reason it ends up finding the srcdir/buildenv.pyc (and missing .py) before the builddir/buildenv.py. python3 refuses to load the old python2 .pyc, and errors because it can’t find a .py at the same path for recompilation.

    With python3, pyc’s are organized into a pycache dir, and tagged like: pycache/buildenv.cpython-35.pyc. So it should not be possible to hit this case anymore.

  18. theuni force-pushed on Jun 3, 2016
  19. build: add temporary fix for "bad magic number" error in out-of-tree builds
    This was caused by an pyc files hanging around from previous
    python2 invocations, when the matching .py missing from that path.
    
    This should not be a problem with python3's tagged caches.
    340012d9c9
  20. MarcoFalke commented at 6:48 pm on June 3, 2016: member
    Tested ACK 340012d
  21. in qa/pull-tester/rpc-tests.py: in 340012d9c9 outdated
    28@@ -29,6 +29,7 @@
    29 import tempfile
    30 import re
    31 
    32+sys.path.append("qa/pull-tester/")
    


    MarcoFalke commented at 6:53 pm on June 3, 2016:
    Is it safe to assume everyone runs the tests from the root of buildir?

    luke-jr commented at 8:38 pm on June 3, 2016:
    Probably not, but FWIW at least I do…

    btcdrak commented at 9:33 pm on June 3, 2016:
    I do too.

    sipa commented at 9:38 pm on June 3, 2016:
    Heh, I run them from qa/pull-tester. I had no idea you could run them from the root…

    MarcoFalke commented at 5:57 am on June 4, 2016:

    Not sure how to fix this…

    What about byte-compiling the rpc-tests.py instead of linking?


    laanwj commented at 10:29 am on June 13, 2016:

    Heh, I run them from qa/pull-tester. I had no idea you could run them from the root…

    Same here. But running from the root is ok with me.

  22. luke-jr commented at 5:38 pm on June 5, 2016: member

    Extensively-tested, with the following results:

    I built, make check’d, and confirmed the reported version numbers for:

    1. Before this PR (plus #7522), built in a clean git clone: v0.12.99.0-fd89d8e
    2. Before this PR (plus #7522), built in a clean dist dir: v0.12.99.0-gfd89d8e
    3. Before this PR (plus #7522), built in a clean dist dir under a foreign git checkout: v0.12.99.0-6862d12
    4. With this PR (plus #7522), built in a clean git clone: v0.12.99.0-08cb06e
    5. With this PR (plus #7522), built in a subdirectory of a clean git clone owned by another user: v0.12.99.0-08cb06e-dirty
    6. With this PR (plus #7522), built in a parallel directory of a clean git clone owned by another user, under a foreign git checkout: v0.12.99.0-08cb06e-dirty
    7. With this PR (plus #7522), built in a clean dist dir under a foreign git checkout: v0.12.99.0-6862d12
    8. With this PR (plus #7522), built in a clean dist dir: v0.12.99.0-g08cb06e
    9. With this PR (plus #7522), built in a subdirectory of a clean dist dir owned by another user: v0.12.99.0-g08cb06e
    10. With this PR (plus #7522), built in a parallel directory of a clean dist dir owned by another user: v0.12.99.0-g08cb06e

    Note that:

    • 08cb06e = With this PR (plus #7522)
    • fd89d8e = Before this PR (plus #7522)
    • 6862d12 = Commit in empty foreign git repo

    Observations:

    1. No change to previously-supported build scenarios.
    2. Dist dir builds within a foreign git repository incorrectly use the foreign git repo’s commit hash in the version. This is already a problem (even with #7522 apparently!), so not a blocker for this PR.
    3. Dist dir builds prefix the commit hash with ‘g’, while git builds do not. This is already a problem, so also not a regression in this PR.
    4. Clean git builds using a different build dir incorrectly tag the version as “-dirty”. This should probably be fixed in this PR.
  23. laanwj commented at 8:17 am on June 6, 2016: member
    BTW seems make translate also needs changes to work out-of-tree. Not necessarily in this pull.
  24. laanwj commented at 8:23 am on June 6, 2016: member

    Looks like this is enough:

     0diff --git a/src/Makefile.qt.include b/src/Makefile.qt.include
     1index 3b39919..327a3d1 100644
     2--- a/src/Makefile.qt.include
     3+++ b/src/Makefile.qt.include
     4@@ -390,13 +390,13 @@ QT_QM=$(QT_TS:.ts=.qm)
     5
     6 SECONDARY: $(QT_QM)
     7
     8-qt/bitcoinstrings.cpp: $(libbitcoin_server_a_SOURCES) $(libbitcoin_wallet_a_SOURCES)
     9+$(srcdir)/qt/bitcoinstrings.cpp: $(libbitcoin_server_a_SOURCES) $(libbitcoin_wallet_a_SOURCES) [@test](/bitcoin-bitcoin/contributor/test/) -n $(XGETTEXT) || echo "xgettext is required for updating translations"
    10        $(AM_V_GEN) cd $(srcdir); XGETTEXT=$(XGETTEXT) PACKAGE_NAME="$(PACKAGE_NAME)" COPYRIGHT_HOLDERS="$(COPYRIGHT_HOLDERS)" COPYRIGHT_HOLDERS_SUBSTITUTION="$(COPYRIGHT_HOLDERS_SUBSTITUTION)" $(PYTHON) ../share/qt/extract_strings_qt.py $^
    11
    12-translate: qt/bitcoinstrings.cpp $(QT_FORMS_UI) $(QT_FORMS_UI) $(BITCOIN_QT_CPP) $(BITCOIN_QT_H) $(BITCOIN_MM)
    13+translate: $(srcdir)/qt/bitcoinstrings.cpp $(QT_FORMS_UI) $(QT_FORMS_UI) $(BITCOIN_QT_CPP) $(BITCOIN_QT_H) $(BITCOIN_MM) [@test](/bitcoin-bitcoin/contributor/test/) -n $(LUPDATE) || echo "lupdate is required for updating translations"
    14-       $(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(LUPDATE) $^ -locations relative -no-obsolete -ts qt/locale/bitcoin_en.ts
    15+       $(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(LUPDATE) $^ -locations relative -no-obsolete -ts $(srcdir)/qt/locale/bitcoin_en.ts
    16
    17 $(QT_QRC_LOCALE_CPP): $(QT_QRC_LOCALE) $(QT_QM) [@test](/bitcoin-bitcoin/contributor/test/) -f $(RCC)
    

    Updated: bitcoin_en.ts was written to the build directory instead of the source directory, now fixed.

    Also available at: https://github.com/laanwj/bitcoin/tree/2016_06_translate_out_of_tree

  25. theuni commented at 1:34 pm on June 6, 2016: member
    @luke-jr Whoa, that’s great feedback! Thanks for the testing. I’m having a look at the “-dirty” issue. @laanwj Thanks, I’ll add that here.
  26. laanwj commented at 5:25 am on June 9, 2016: member
    Let’s try to get this merged soon. I can PR the make translate change separately if that’s mroe convenient.
  27. laanwj added this to the milestone 0.13.0 on Jun 9, 2016
  28. theuni commented at 8:50 pm on June 9, 2016: member

    @luke-jr I believe I’ve found the issue here. When you “chown -R root:root .”, you’re setting the git index to read-only. That makes “git diff” fail to update the index, which makes the diff-index fail.

    For the sake of this PR, I’m ok with that not working correctly, since git is in a pretty bad state.

  29. bulid: fix "make translate" when out-of-tree d1a3d570e5
  30. laanwj commented at 8:01 am on June 10, 2016: member

    since git is in a pretty bad state

    That sounds ominous. Time to switch to mercurial or bzr? :-)

  31. laanwj commented at 8:04 am on June 10, 2016: member
  32. laanwj merged this on Jun 10, 2016
  33. laanwj closed this on Jun 10, 2016

  34. laanwj referenced this in commit fde0ac403c on Jun 10, 2016
  35. theuni commented at 8:41 am on June 10, 2016: member

    Haha. That was a half-complete thought as usual.

    Should read: “I’m ok with that not working correctly, since if you’re hitting this case, your git repo is already unreliable”.

  36. theuni deleted the branch on Jun 10, 2016
  37. codablock referenced this in commit adb8e80cba on Sep 16, 2017
  38. codablock referenced this in commit adf59fda92 on Sep 19, 2017
  39. codablock referenced this in commit b95a338b30 on Dec 22, 2017
  40. andvgal referenced this in commit 57f9b2c40e on Jan 6, 2019
  41. zkbot referenced this in commit 59d6a92e7d on Sep 22, 2020
  42. zkbot referenced this in commit 514d868179 on Sep 25, 2020
  43. zkbot referenced this in commit 025bd44543 on Nov 21, 2020
  44. zkbot referenced this in commit 7a0a268054 on Dec 2, 2020
  45. zkbot referenced this in commit c8896f9907 on Dec 2, 2020
  46. MarcoFalke locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-17 09:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me