Only ./bootstrap should glob build/pkgs
mkoeppe opened this issue · 61 comments
Right now both ./bootstrap and ./configure (via m4/sage_spkg_collect.m4) glob build/pkgs.
In this ticket, we move this code into bootstrap, making the generated configure script more static, more straightforward to read and debug, and slightly faster because less work (and file system accesses) is done at the run time of configure.
Before:
$ time ./configure -q --without-system-ntl
real 0m40.860s
user 0m24.260s
sys 0m16.266s
After:
real 0m32.485s
user 0m20.773s
sys 0m10.462s
There are no changes in functionality.
We make a cosmetic fix to the ./configure --help output, fixing #33345 comment:20.
Even after this ticket, package-version.txt and dependencies are processed at configure run time, not at bootstrap time. So simple package upgrades can still be done by developers without having to run ./bootstrap.
CC: @dimpase @embray @orlitzky @jhpalmieri
Component: build: configure
Author: Matthias Koeppe
Branch/Commit: e7b8c3b
Reviewer: Michael Orlitzky
Issue created by migration from https://trac.sagemath.org/ticket/29114
Description changed:
---
+++
@@ -1,3 +1,6 @@
Right now both `./bootstrap` and `./configure` (via `m4/sage_spkg_collect.m4`) glob.
This should be streamlined.
+Currently `./configure` is too sensitive to stray files/subdirectories in `build/pkgs` (such as those that are `.gitignore`'d in another branch), as noted in https://groups.google.com/d/msg/sage-release/eVvjvJ6Iii8/W51ouUKpDwAJ (thread).
+
+Author: Matthias Koeppe
Branch is on top of #28095.
New commits:
cf5607e | Add configure options '--enable-SPKG', --disable-SPKG' for optional/experimental SPKG |
e4675d1 | Actually implement --enable-SPKG and --disable-SPKG |
a3e0e47 | Change type of gmp, mpir to 'standard' (they are mutually exclusive standard packages) |
4ed7b05 | Fix indentation of '--with-mp=' options in configure --help |
82ee84d | sage_spkg_enable.m4: Popdef what wass pushdef-ed |
f7a84e0 | Enumerate packages in ./bootstrap; only warn about missing 'type' files; use the generated list in m4/sage_spkg_collect.m4 instead of globbing |
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
6ec6413 | Merge branch 'develop' of git://trac.sagemath.org/sage into t/29114/no-spkg-globbing-in-configure |
9295a74 | sage_spkg_enable.m4: Popdef what wass pushdef-ed |
355d147 | Enumerate packages in ./bootstrap; only warn about missing 'type' files; use the generated list in m4/sage_spkg_collect.m4 instead of globbing |
Branch pushed to git repo; I updated commit sha1. New commits:
bbd6521 | Makefile [configure]: also depend on build/pkgs/type |
Could you explain what "glob" means here?
I think we should progress, even if the route is not optimal, and Matthias has a lot of time for working on the build system now.
I hate to see ./configure running many times as I launch make, it really slows working on build system down, and I hope #29113 will happen soon.
Replying to @dimpase:
I think we should progress, even if the route is not optimal, and Matthias has a lot of time for working on the build system now.
Progress on what though? I don't think you can "progress" on unsolid footing. I should note that part of the motivation behind #29038 is to enable the approach in #27824 which I also think is overcomplicated.
I don't think we should be making complicated changes on top of complicated changes to enable even more complicated changes. I hate to sound like Jeroen here because I've been on the other side of disagreements like this with him. But he'd probably be saying the same if he were here and I'd agree this time.
I would like to know what the bigger picture is to all this before making changes that don't seem well-motivated. Don't commit a sunk cost fallacy especially when it's relatively early...
If you want to talk about simplification, why don't we just drop sage -i/-f instead of trying to keep this awful hack - something I proposed a year ago, and Jeroen objected...
Description changed:
---
+++
@@ -1,6 +1,8 @@
Right now both `./bootstrap` and `./configure` (via `m4/sage_spkg_collect.m4`) glob.
This should be streamlined.
-Currently `./configure` is too sensitive to stray files/subdirectories in `build/pkgs` (such as those that are `.gitignore`'d in another branch), as noted in https://groups.google.com/d/msg/sage-release/eVvjvJ6Iii8/W51ouUKpDwAJ (thread).
+Currently `./configure` is too sensitive to stray files/subdirectories in `build/pkgs` (such as those that are `.gitignore`'d in another branch), as noted in https://groups.google.com/d/msg/sage-release/eVvjvJ6Iii8/W51ouUKpDwAJ (thread).
+While #29120 provides a quick workaround, the present ticket has the proper fix.
+Description changed:
---
+++
@@ -1,4 +1,4 @@
-Right now both `./bootstrap` and `./configure` (via `m4/sage_spkg_collect.m4`) glob.
+Right now both `./bootstrap` and `./configure` (via `m4/sage_spkg_collect.m4`) [glob](https://en.wikipedia.org/wiki/Glob_(programming)) `build/pkgs`.
This should be streamlined.
Currently `./configure` is too sensitive to stray files/subdirectories in `build/pkgs` (such as those that are `.gitignore`'d in another branch), as noted in https://groups.google.com/d/msg/sage-release/eVvjvJ6Iii8/W51ouUKpDwAJ (thread). Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
1f193bf | Issue only a warning, not an error, if there are stray files in build/pkgs |
a04733a | Merge branch 't/29120/one-line-fix-configure-too-sensitive-to-stray-files-in-build-pkgs' into t/29114/no-spkg-globbing-in-configure |
25a55e0 | Enumerate packages in ./bootstrap; only warn about missing 'type' files; use the generated list in m4/sage_spkg_collect.m4 instead of globbing |
7214ed7 | Makefile [configure]: also depend on build/pkgs/type |
Since this list changes maybe once a year, we could just write it into configure.ac and avoid that part of the bootstrap process.
I think that may be too radical a change (although I am personally in favor of it - agreeing with the autotools policies) - Sage has traditionally used source discovery instead of listing files explicitly. That's why in this ticket I just want to put the source discovery for build/pkgs into 1 script
Setting new milestone based on a cursory review of ticket status, priority, and last modification date.
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
0f59e29 | Enumerate packages in ./bootstrap; only warn about missing 'type' files; use the generated list in m4/sage_spkg_collect.m4 instead of globbing |
Description changed:
---
+++
@@ -1,8 +1,3 @@
Right now both `./bootstrap` and `./configure` (via `m4/sage_spkg_collect.m4`) [glob](https://en.wikipedia.org/wiki/Glob_(programming)) `build/pkgs`.
This should be streamlined.
-Currently `./configure` is too sensitive to stray files/subdirectories in `build/pkgs` (such as those that are `.gitignore`'d in another branch), as noted in https://groups.google.com/d/msg/sage-release/eVvjvJ6Iii8/W51ouUKpDwAJ (thread).
-While #29120 provides a quick workaround, the present ticket has the proper fix.
-
-
-Branch pushed to git repo; I updated commit sha1. New commits:
a34f10b | bootstrap, m4/sage_spkg_collect.m4: Pass SPKG_TYPE to SAGE_SPKG |
025eb95 | bootstrap: Improve the SPKG.rst title parser |
5813473 | bootstrap: First SAGE_SPKG_CONFIGURE, then SAGE_SPKG_FINALIZE |
c5c6caa | m4/sage_spkg_collect.m4 (SAGE_SPKG_COLLECT_INIT): Rename from SAGE_SPKG_INIT |
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
54974a3 | m4/sage_spkg_collect.m4 (SAGE_SPKG_COLLECT_INIT): Rename from SAGE_SPKG_INIT |
Branch pushed to git repo; I updated commit sha1. New commits:
2eba1f4 | m4/sage_spkg_collect.m4 (SAGE_SPKG_FINALIZE): Make SPKG_NAME, SPKG_TYPE m4 definitions, not shell variables |
1e9c638 | m4/sage_spkg_collect.m4: Distinguish cases of SPKG_TYPE at macroexpansion time, not runtime |
7310bd5 | bootstrap: First SAGE_SPKG_CONFIGURE, then SAGE_SPKG_FINALIZE (fixup) |
Branch pushed to git repo; I updated commit sha1. New commits:
1eceb52 | bootstrap: Determine SPKG_SOURCE here, pass it as a macro argument to SAGE_SPKG_FINALIZE |
Branch pushed to git repo; I updated commit sha1. New commits:
35fa89f | bootstrap: Determine SPKG_TREE_VAR here, pass it as a macro argument to SAGE_SPKG_FINALIZE |
8070dd9 | m4/sage_spkg_collect.m4: Make want_spkg a macro definition only |
be824d6 | m4/sage_spkg_collect.m4: Replace read from requirements.txt by use of macro argument |
Branch pushed to git repo; I updated commit sha1. New commits:
e796fcf | m4/sage_spkg_enable.m4: Do not AC_REQUIRE([SAGE_SPKG_COLLECT_INIT]) here |
Description changed:
---
+++
@@ -1,3 +1,23 @@
Right now both `./bootstrap` and `./configure` (via `m4/sage_spkg_collect.m4`) [glob](https://en.wikipedia.org/wiki/Glob_(programming)) `build/pkgs`.
-This should be streamlined.
+In this ticket, we move this code into `bootstrap`, making the generated `configure` script more static, more straightforward to read and debug, and slightly faster because less work (and file system accesses) is done at the run time of `configure`.
+
+Before:
+
+```
+$ time ./configure -q --without-system-ntl
+real 0m40.860s
+user 0m24.260s
+sys 0m16.266s
+```
+
+After:
+
+```
+real 0m32.485s
+user 0m20.773s
+sys 0m10.462s
+```
+
+There are no changes in functionality.
+Branch pushed to git repo; I updated commit sha1. New commits:
a6d70c1 | m4/sage_spkg_collect.m4: Make SAGE_NEED_SYSTEM_PACKAGES_VAR a macro |
./configure -q is a useful command. I see this output:
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named lzma
./configure: line 39392: ,: command not found
The first is probably coming from the line if "$SAGE_BOOTSTRAP_PYTHON" -c "import lzma"; then :, no big deal. The other error is from a comma all by itself on line 39392 (that's with develop; it's line 42361 with this branch). Maybe an extra comma in build/pkgs/qhull/spkg-configure.m4?
Description changed:
---
+++
@@ -21,3 +21,5 @@
There are no changes in functionality.
+Even after this ticket, `package-version.txt` and `dependencies` are processed at `configure` run time, not at `bootstrap` time. So simple package upgrades can still be done by developers without having to run `./bootstrap`.
+Description changed:
---
+++
@@ -21,5 +21,7 @@
There are no changes in functionality.
+We make a cosmetic fix to the `./configure --help` output, fixing [#33345 comment:20](https://github.com/sagemath/sage/issues/33345#comment:20).
+
Even after this ticket, `package-version.txt` and `dependencies` are processed at `configure` run time, not at `bootstrap` time. So simple package upgrades can still be done by developers without having to run `./bootstrap`.
In principle this looks good to me, and Sage builds. It would be great if someone more familiar with .m4 code could check the details.
I looked through it all and don't see anything too scary. My one question is about the grep -v ^= that was added to bootstrap. It looks like that only affects the sagemath_categories, sagemath_objects, and sage_docbuild packages. Why do those have ======... headers in their SPKG.rst to begin with?
Replying to @orlitzky:
It looks like that only affects the sagemath_categories, sagemath_objects, and sage_docbuild packages. Why do those have
======...headers in their SPKG.rst to begin with?
These files double as README.rst for these distributions, so this affects how it displays on PyPI.
Reviewer: Michael Orlitzky
Ok, I don't believe in parsing SPKG.rst for package information anyway, so I don't mind the hack. (In the futue, I would rather we quit parsing that file than try to make them all nice and consistent.)
Everything else looks reasonable. Nothing broke in my sage build and there aren't any new subtle ./configure errors logged to the console.
John, don't forget to add yourself as a reviewer if you want to.
Thanks.
Changed branch from u/mkoeppe/no-spkg-globbing-in-configure to e7b8c3b