IRC logs for #buildstream for Tuesday, 2017-09-26

*** tristan has quit IRC02:33
*** tristan has joined #buildstream02:45
*** adds68 has quit IRC03:22
*** adds68 has joined #buildstream03:22
*** bochecha has joined #buildstream05:30
*** uajain has joined #buildstream05:55
bochechaoik, so I just figured out why Python feels the need to recompile all bytecode at startup inside of a BuildStream shell (or after a checkout, ...)06:31
bochechawhen building Python modules, the first 4 bytes of the generated bytecode file are a magic number corresponding to the Python version, the next 4 bytes are the timestamp of **the source .py file**06:32
bochechaafter building and committing to ostree, ostree resets the timestamp of all files to 006:32
bochechaas a result, in a bst shell, the source .py file has a 0 timestamp, but the .pyc file still contains the timestamp of the .py file before it was committed to ostree06:33
bochechaI see two possibilities to get out of this:06:34
bochecha1. as pre-configure-commands, reset the timestamp of everything to 006:34
bochecha2. as post-install-commands, set those 4 bytes in all .pyc files to 006:34
bochechaanybody can think of a better way?06:34
*** tristan has quit IRC06:45
gitlab-br-botbuildstream: issue #94 ("BuildStream could be more helpful when build Python code") changed state ("opened") https://gitlab.com/BuildStream/buildstream/issues/9407:19
*** jonathanmaw has joined #buildstream08:19
*** ssam2 has joined #buildstream08:30
adds68Sorry i messaged your messages last night tristan08:30
adds68missed*08:31
adds68I shall recompile and check to see if configure writes to that directory08:31
adds68If i do need to re-compile with gir1-1.2, where do i get the source for that?08:31
*** laurenceurhegyi has left #buildstream08:32
*** tlater has joined #buildstream08:35
*** laurenceurhegyi has joined #buildstream08:50
adds68*sigh* OSTree documentation is poor09:23
ssam2which parts ?09:41
adds68ssam2, any form of installation information09:43
adds68ssam2, i'm trying to install the latest ostree from source, but buildstream is still saying my ostree version is out of date09:44
adds68even though introspection is enabled in ./configure09:44
tlateradds68: Did you follow tristan's advice from yesterday?09:44
tlater:(09:44
adds68tlater, i've re-run and checked for introspection yes, but still no luck09:45
ssam2buildstream's setup.py is complaining about the version, you mean ?09:45
adds68ssam2, yea, which tristan said is do with gir1.2-ostree being out dated09:45
ssam2the setup.py seems to be doing `from gi.repository import OSTree; if OSTree.YEAR_VERSION < REQUIRED_OSTREE_YEAR: ...`09:46
ssam2you can try running that code manually in `python3` to debug it.09:46
adds68ssam2, that's where the issue lies, my OSTree Gobject isnt showing the YEAR_VERSION09:46
ssam2hmm09:46
adds68when i import it via python309:46
ssam2what prefix is it in? you might need to set GI_TYPELIB_PATH09:46
ssam2if it's not installed in /usr09:46
adds68ssam2, it installs it to /usr/local/lib09:47
tlaterSpecify that path anyway, /usr/local is sometimes (usually) not included09:48
tlaterAlso, remove the gir1.2-ostree you installed with apt to avoid loading the old version by accident - will help sorting out issues like these.09:49
adds68tlater, specify that where sorry?09:49
tlaterGI_TYPELIB_PATH09:49
ssam2distros aren't really consistent on whether /usr/local works or not, in my experience09:49
ssam2so yeah, GI_TYPELIB_PATH=/usr/local/lib64/girepository-1.0 may be needed09:50
tlaterDebian doesn't like it ;)09:51
ssam2(double check that path actually has files in, it might install somewhere else like lib/)09:51
adds68that location is set on my .bashrc09:52
adds68just checked and it contains buildstream files09:53
adds68but still no luck when i install09:53
adds68:(09:53
ssam2buildstream files? that directory should contain .typelib files09:53
adds68oops sorry yea, .typelib09:53
adds68*tab completion confused me *09:54
ssam2hmm... this still sounds like a gobject introspection issue09:54
tlaterAsking the obvious, but have you sourced your .bashrc since?09:54
adds68tlater, yea, still no luck09:58
tlaterDid you accidentally build the same 2 year old version of ostree or something? x)09:59
adds68my ostree is version 2017.1209:59
adds68wehn i do ostree --version10:00
adds68But it seems the GObject files are not compiled for the newer version10:00
tlateradds68: Have you removed the debian package since? If you have, you shouldn't be able to import the ostree things in the first place.10:12
adds68tlater, yea ostree is removed from apt10:13
adds68So ostree works only when i run the make install10:13
tlaterHm, shot in the dark (you'll have to recompile after), but can you still run those imports if you remove the ostree stuff you installed to /usr/local?10:15
tlater^ Not sure it's worth trying10:15
adds68tlater, yep removing those removes ostree10:18
tlater...10:18
* tlater is dumbfounded10:18
adds68heh, i feel lost now10:18
tlaterWait, did you run the setup.py code?10:18
adds68tlater, as i try and install buildstream via pip again?10:19
tlateradds68: Nah, just run the bit of setup.py that tries to import ostree in a shell10:20
adds68tlater, yea and it still gives me the same error, which is shouldnt right? Shouldn't it detect ostree isnt installed?10:20
tlater^10:20
tlaterDo you still run it in the same virtualenv?10:20
adds68tlater, yea10:21
tlaterCreate a new one and see if that changes things :)10:21
* tlater hopes adds68 kept the build directories10:24
adds68tlater, yea it reports OSTree not found now10:24
tlaterWhoo! So it was all virtualenv's fault in the first place. Just make install again and it should work10:24
tlater(And probably make a new virtualenv again)10:24
adds68tlater, OSTree can't be found?10:25
adds68Processing /home/adamjones/buildstream10:26
adds68    Complete output from command python setup.py egg_info:10:26
adds68    OSTree not found10:26
adds68    BuildStream requires OSTree >= v2017.8 with Python bindings. Install it using your package manager (usually ostree or gir1.2-ostree-1.0).10:26
tlaterAfter reinstalling and creating a new virtualenv?10:26
adds68Yea =/10:28
adds68fresh env with site-packages10:28
tlaterWhat happens if you run that outside of any virtualenv?10:29
adds68tlater, weirdly the same thing10:29
adds68even though OSTree is there10:29
tlaterecho $GI_TYPELIB_PATH, see if that's perhaps wrong10:30
adds68tlater, /usr/local/lib/girepository-1.010:30
tlaterAnd there are files in that dir?10:32
adds68yea .typelib10:32
* tlater is pretty sure it's just that env variable not being correct/enough10:32
tlaterIf you're willing to mess with things, try installing it to /usr instead of /usr/local.10:33
ssam2this is super weird, it really sounds like a g-i issue still10:34
ssam2i can come look in person in a little while if you like10:34
adds68ssam2, that would be a great relief! :D10:35
ssam2ok, give me a few minutes10:36
adds68solved! I'm a .rc noob10:45
tlateradds68: Did you actually forget to source it in the end or simply set it weirdly?10:46
adds68tlater, i forgot to export it :(10:47
tlaterAh, right, and because you ran things in a subshell that didn't work x)10:49
*** tristan has joined #buildstream12:14
tristanbochecha, strip-commands I think is where that really belongs12:15
tristanbochecha, thats where by default we do the stripping of debug symbols, seems appropriate12:16
bochechatristan: the pyc stuff?12:18
tristanI guess yeah12:19
tristanseems like post processing of installed stuff, maybe shouldnt be called strip commands12:19
tristaneh12:19
bochechawould we put it globally for every modules?12:19
tristanbut generally the post- stuff is not meant to be declared by plugins (it's really there so that users can append something without overriding)12:20
bochechaI talked with Alex in #flatpak, I need to write down the details in the ticket, because there are some corner cases I hadn't thought about12:20
tristanI'm thinking of removing the post- commands in favor of a declarative way for appending/prepending/overriding arrays/lists12:20
bochechabeing able to prepend/append would be nice, not just for this by the way12:20
bochechaI've been wanting to add more split-rules in my project;conf, and had to copy-paste the default ones12:21
tristanand nah, we can define the strip-commands in both python elements (I think it's pip and a setuptools element also exists)12:21
bochechathat's not enough, though12:21
bochechaI'm building Python itself, which is an autotools element12:21
bochechaand many python modules are built without pip/distutils, some use the autotools12:22
tristanright so there is this huge thread on buildstream-list https://mail.gnome.org/archives/buildstream-list/2017-September/msg00000.html12:22
bochechaoh, I didn't even know there was a mailing-list12:22
tristanwhich discusses some last minute changes we want to make (we changed a lot from the initial proposal)12:23
tristanbefore declaring stable 1.012:23
tristanyeah, we haz mail :)12:23
tristanok so; we do have the same issue with building python itself I guess ?12:23
tristani.e. it will install C compiled stuff from cpython (which we'll also want to strip debug symbols), and it will install python files12:24
bochechayes12:24
bochechain fact, most of the startup penalty I'm getting is from the .py/.pyc files coming with Python itself12:24
tristanright now in the base project.conf defaults (in data/projectconfig.yaml), we declare the strip commands as a variable12:25
tristan(which is pretty C library specific I guess), and then we reuse that variable in various build elements as the strip-commands12:25
tristanI suppose something similar could be done12:25
tristanwhere we declare that thing; as a variable (kind of like a macro)... and use it in the python elements12:26
tristanAnd then an autotools element which wanted to install python files, like when building cpython, could additionally append that macro12:26
tristanto its own strip commands, and then it's defined in one place but used where needed ?12:27
bochechathat would work, yes12:27
bochechawe could even go further, and make the current strip-commands be variables as well, so that it's easier to reuse and compose with the new pyc one12:28
tristanI suppose I should be worried about an uncontrollable accumulation of stuff being pre-defined, but we already have it for strip-commands and this does seem sensible12:28
tristanright, so we have %{strip-binaries} defined as a variable12:29
tristanand then autotools uses it http://buildstream.gitlab.io/buildstream/elements/autotools.html#module-elements.autotools12:29
tristanto implement strip-commands12:29
tristanbochecha, I think that means it's already a variable, if that's what you mean ?12:30
bochechathat's what I meant, I had just missed that strip-binaries existed :)12:30
bochechaso yes, we could define a fix-pyc-timestamps variable, add it to strip-commands for the distutils/pip elements, and let people add it themselves to other types of elements12:31
bochechaor just add it to the default project.conf, dunno12:31
tristanbochecha, well yeah that's the thing; the variable itself would have to be defined in the project.conf defaults (data/projectconfig.yaml)12:33
tristanwhich is where %{strip-binaries} is defined12:33
tristanthere's not really another venue to make variables accessible to all element types12:33
bochechayes, I meant **add** it to strip-commands by default in project.conf, or just in the distutils/pip elements12:33
tristan(hence my reference above, that maybe I should worry about that... but then, I dont feel like worrying about that right now :-/)12:34
tristanAhhh12:34
tristanNah lets not do that12:34
tristanalso it's not possible :)12:34
bochechawhy not?12:35
tristanbochecha, the fact that there exists a 'strip-commands' is the domain of BuildElement classes, actually the base project configuration has no knowledge of that12:35
tristanwhile it's possible to do overrides of element specific configuration (i.e. composite this dictionary against all 'config' sections of 'autotools' elements), what that config might be, is not known12:36
*** jude has quit IRC12:37
bochechatristan: is it expected that when a strip-commands fail, the build still succeeds?13:19
tristanbochecha, nope, the command should exit 0 itself if it's okay to fail13:31
bochechahmm, it's the `find ... -exec ...`13:31
bochechathe command being executed for each file failed on the first file13:32
tristanyeah, that doesnt have a history of every failing13:32
bochechaso it didn't get run on the other files13:32
tristanoh does that happen ?13:32
tristaninteresting13:32
bochechaand then BuildStream happily moved along and reported SUCCESS13:32
tristanright, the strip commands -exec sh -ec ... also13:33
tristanbochecha, do you suspect this is an issue with %{strip-binaries} ?13:34
tristanI dont think so13:34
bochechadunno, I only had it with my new command (the pyc one)13:34
tristanbochecha, notice that %{strip-binaries} has an explicit exit 0 clause13:34
tristanin a given if about en ELF binary13:34
bochechaI had made a typo in the python code being run, so it failed with a SyntaxError13:34
bochechawhich failed the whole `find ...`13:35
bochechabut not the build13:35
tristanAh well, theres nothing really to do about this I think; if you mean buildstream should have caught the problem13:35
bochechayeah, I'm surprised it didn't13:35
tristanThe BuildElement has a policy of running shell commands with -e13:35
tristanwhich means the first command to fail in that shell will abort further processing immediately13:36
tristanbut this is find happily reporting 0 exit status I suppose13:36
bochechaindeed, it reports 013:38
bochechathank you, find!13:38
tristan:)13:39
bochechahahahahahahaha14:10
bochechaof course after 30 minutes of build Python, the .pyc files don't have their timestamp fixed14:10
bochechabecause the fix-pyc-timestamps variable calls the `python` command, which isn't in the buildroot when I'm building Python itself -_-14:10
tristanheh15:19
tristanmaybe redefine %{python} for that case... or: PATH=%{install-root}/%{prefix}/bin:${PATH} %{funky-python-timestamp-thingy}15:21
* tristan assumes bochecha came to some conclusion for that anyway :)15:22
bochechaPATH isn't enough15:22
gitlab-br-botpush on buildstream@cross_platform (by Tristan Maat): 20 commits (last: Simplify a bit of code) https://gitlab.com/BuildStream/buildstream/commit/f40ae33b52197241880d7e6399bfd0e28c4ee46815:22
bochechabecause running /buildstream/install/usr/bin/python means Python won't find its own libpython.so15:22
bochechait will search in /usr/lib, not in /buildstream/install/usr/lib15:23
bochechamy conclusion is that I either need to set LD_LIBRARY_PATH, or do the timestamp mangling in another element coming after the one building Python15:23
bochechaand then I started doing something else :P15:24
*** semanticdesign has joined #buildstream15:27
jonathanmawhas there been a change to the way host-arches are handled? I'm getting a surprising new backtrace15:29
jonathanmawhttps://pastebin.com/1VejnNxK15:30
*** semanticdesign has quit IRC15:34
bochechaalthough I wonder if it's really a good idea to have Python modify its own bytecode which it has already loaded (in order to be able to do that modification)15:36
*** semanticdesign has joined #buildstream15:37
*** semanticdesign has quit IRC15:53
*** semanticdesign has joined #buildstream15:53
*** semanticdesign has quit IRC15:54
*** semanticdesign has joined #buildstream15:55
gitlab-br-botbuildstream: merge request (cross_platform->master: Cross platform) #81 changed state ("opened"): https://gitlab.com/BuildStream/buildstream/merge_requests/8116:06
*** semanticdesign has quit IRC16:29
*** adds68 has quit IRC16:42
*** adds68 has joined #buildstream16:46
*** jonathanmaw has quit IRC16:48
tristanbochecha, myeah I see the concern16:49
tristanbochecha, actually; I think you could do better with just something like `dd`16:49
tristanavoid loading everything in memory and rewriting the whole file, just to zero out a few bytes16:50
tristanand also avoid invoking python to do it16:50
bochechaI'm not sure how to use dd to do that, right now I've changed the thing to only write the 4 bytes with Python and also not load the pyc files when starting the interpreter16:52
bochechaI'll look at dd16:52
tristanwe do some pretty off the wall stuff with dd here: http://buildstream.gitlab.io/buildstream/elements/x86image.html#module-elements.x86image16:53
tristanheh16:53
tristanbut yeah it'll let you write x bytes of value y at position z16:54
tristanor, no, an input stream, so you could use if=/dev/zero16:55
bochechayeah, I just found out about conv=notrunc and seek=N/skip=N16:55
bochechaso basically, `dd if=/dev/zero of=/path/to/foo.py ibs=1 count=4 seek=4 conv=notrunc` should do it16:57
tristanI think so, I'm not sure if you also need obs=116:58
tristanIt looks inferable though :)16:58
tristanI think bs=116:58
tristanfor when ibs = obs16:59
*** ssam2 has quit IRC17:00
*** tlater has quit IRC17:00
bochechatristan: by the way, did you see I had added some more thoughts to the ticket after talking with Alex?17:04
tristanbochecha, yeah I didnt want to get too deep into really thinking something through (it's now 2am so probably not much more from me...)17:06
tristanat face value, it does look like we would want to avoid such hackeries17:06
tristanbut it would be worth knowing what the original specific cases triggered those hacks to occur17:06
tristanseems strange that mulitple packages install the same file; buildstream raises a warning for such overlaps17:07
tristan(although the warning will happen *a lot* when building a stack of stuff, on top of another existing stack, like building GNOME on a debian base)17:08
tristanshould be reducible to nothing when building a full clean os from the bootstraps up17:08
bochechaoh, I thought you were in a European timezone... I'll make sure to ping you earlier from now on :)17:09
tristan:)17:13
gitlab-br-botpush on buildstream@fix-pyc-timestamps (by Mathieu Bridon): 1 commit (last: Fix timestamps in Python bytecode) https://gitlab.com/BuildStream/buildstream/commit/10541c428f8feb923f80566baf7ce8b13cdbdb3717:43
gitlab-br-botbuildstream: merge request (fix-pyc-timestamps->master: WIP: Fix timestamps in Python bytecode) #98 changed state ("opened"): https://gitlab.com/BuildStream/buildstream/merge_requests/9817:44
*** semanticdesign has joined #buildstream18:26
*** jude has joined #buildstream19:39
*** semanticdesign has quit IRC19:40
*** bochecha_ has joined #buildstream21:01
*** bochecha has quit IRC21:02
*** bochecha_ is now known as bochecha21:02
*** jude has quit IRC21:13
*** tristan has quit IRC22:13
*** tristan has joined #buildstream22:14
*** bochecha has quit IRC22:15
*** tristan has quit IRC22:30
*** tristan has joined #buildstream22:34

Generated by irclog2html.py 2.14.0 by Marius Gedminas - find it at mg.pov.lt!