Since the 0.21 upgrade, the host `$PATH` is not forwarded anymore by
default to the sandboxes in charge to realize Bazel actions. This
default change broke the `py_binary` rule among other things.
Every python binary is wrapped in a stub in charge to setup the
execution environment. Currently, this stub's shebang points to a
`/usr/bin/env python` which cannot be resolved with the current
`$PATH`.
This results in breaking any build pipeline requiring the use of
python at some point. On top of the incorrect shebang, the stub
template is unable to find the actual python binary using
`SearchPath`.
This PR fixes those two things by re-writing the stub template shebang
to the actual python binary and by substituting the faulty default
python binary lookup to the right one.
Update to the latest revision, don't replace `which` anymore as all
`which` references are eliminated previously, enable support for at
least one database type (otherwise this scrpit is unusable and needs to
be built manually with support for on of these packages).
Tested functionality with a simple SQLite database.
With the previous PyPy3 change, this reduces the compile time from
~1m30s to roughly 36s (compared to the original, serial, Python 3 build
time of 2:30s).
Signed-off-by: Austin Seipp <aseipp@pobox.com>
PyPy3 offers tremendous speedups for IceStorm tools written in Python,
including tools used at compile-time to generate the chip databases, and
runtime tools distributed to users, such as icebox_vlog.
For example, on my ThreadRipper 1950X, build times for IceStorm
consistently go from 2m30s -> 1m30s with this change, a 40% improvement,
simply due to improvements in raw CPU efficiency. (This is also worsened
by the fact the build is currently serial, but that can easily be fixed
anyway.)
On top of that, tools distributed to users are also now run using PyPy.
Utilities such as icebox_vlog are useful for post-bitstream testing, for
instance, and also are improved due to improved CPU efficiency as well.
For example, when "decompiling" an ICE40 bitstream for HX8K devices,
containing a synthesized copy of PicoRV32 (from the NextPNR demos), the
runtime of icebox_vlog is cut from 25 seconds to 9 seconds consistently
with this change alone.
Normally, picking a Python interpreter outright for Python-based code is
a "bad idea", but in the case of IceStorm it should be perfectly safe,
and an excellent improvement for users. There are a few reasons for
this:
- IceStorm uses pure Python 3 and nothing else. There are no
requirements for any 3rd party packages, which might cause annoying
incompatibilities, and PyPy has historically shown very strong core
Python compatibility.
- IceStorm is NOT a set of Python libraries, it is a set of tools,
some of which, coincidentally, are written in Python. It is (normally)
bad form to fix libraries to certain interpreters versions if the reason
strictly isn't "it doesn't work/isn't compatible". That is not the case
here. These tools may later be used by other programs, such as NextPNR,
but the Python interpreter is ultimately not that important in quesion
for the user. In this sense, there is almost no downside to picking
PyPy explicitly if it offers far better performance.
(Point 2 is not actually strictly true; there are some distributed .py
files that you can import from but they are basically just static
classes that are imported by tools like nextpnr; this is expected.)
Because of this, users should see very little change except better
performance for IceStorm tools on their machines.
Note that PyPy is not supported on aarch64 -- this only applies to
x86_64 machines.
Signed-off-by: Austin Seipp <aseipp@pobox.com>
0.21 removed the bundled openjdk-distribution. Instead, tries to fetch
the “right” distribution on-the-fly when building.
So we need to provide our own openjdk.
According to
https://github.com/bazelbuild/bazel/issues/6865#issuecomment-447261288
we should set `--host_javabase="@local_jdk//:jdk` if we want to do
that. This uses the jdk that is currently in the environment, which is
openjdk 8 in our case. 0.21 defaulted to a toolchain for JDK9, which
we don’t package in nixpkgs, so we use the JDK8 toolchain.
This commit also replaces the line-number-based sed invocations with
something more stable.
scons: 3.0.2 -> 3.0.3
"This release should be used instead of 3.0.2. This release fixes
several issues. This release supports Python versions 2.7.* as well as
3.5+." [0]
Details can be found in the changelog [1].
"NOTE: 3.0.2 release was dropped because there was a packaging bug. Please
consider all 3.0.2 content."
There where no regressions and no deprecations in this release (at least it does
not break any builds in nixpkgs).
[0]: https://scons.org/scons-303-is-available.html
[1]: https://raw.githubusercontent.com/SConsProject/scons/rel_3.0.3/src/CHANGES.txt
A few packages broke due to the SCons upgrade (they depended on
deprecated options that got removed), I've kept them on version 3.0.1
for now. The rest of the rebuilds seems fine (the failing ones where
already in a broken state before this change).