1
0
Fork 0
cl-sites/asdf.common-lisp.dev/asdf/Pitfalls-of-the-upgrade-to-ASDF-3.html
2023-11-12 11:34:18 +01:00

192 lines
9.6 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Created by GNU Texinfo 6.8, https://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- This manual describes ASDF, a system definition facility
for Common Lisp programs and libraries.
You can find the latest version of this manual at
https://common-lisp.net/project/asdf/asdf.html.
ASDF Copyright (C) 2001-2019 Daniel Barlow and contributors.
This manual Copyright (C) 2001-2019 Daniel Barlow and contributors.
This manual revised (C) 2009-2019 Robert P. Goldman and Francois-Rene Rideau.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-->
<title>Pitfalls of the upgrade to ASDF 3 (ASDF Manual)</title>
<meta name="description" content="Pitfalls of the upgrade to ASDF 3 (ASDF Manual)">
<meta name="keywords" content="Pitfalls of the upgrade to ASDF 3 (ASDF Manual)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link href="index.html" rel="start" title="Top">
<link href="Concept-Index.html" rel="index" title="Concept Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="What-has-changed-between-ASDF-1-ASDF-2-and-ASDF-3_003f.html" rel="up" title="What has changed between ASDF 1 ASDF 2 and ASDF 3?">
<link href="What-happened-to-the-bundle-operations.html" rel="next" title="What happened to the bundle operations">
<link href="Pitfalls-of-the-transition-to-ASDF-2.html" rel="prev" title="Pitfalls of the transition to ASDF 2">
<style type="text/css">
<!--
a.copiable-anchor {visibility: hidden; text-decoration: none; line-height: 0em}
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
span:hover a.copiable-anchor {visibility: visible}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en">
<div class="subsection" id="Pitfalls-of-the-upgrade-to-ASDF-3">
<div class="header">
<p>
Next: <a href="What-happened-to-the-bundle-operations.html" accesskey="n" rel="next">What happened to the bundle operations?</a>, Previous: <a href="Pitfalls-of-the-transition-to-ASDF-2.html" accesskey="p" rel="prev">Pitfalls of the transition to ASDF 2</a>, Up: <a href="What-has-changed-between-ASDF-1-ASDF-2-and-ASDF-3_003f.html" accesskey="u" rel="up">&ldquo;What has changed between ASDF 1, ASDF 2, and ASDF 3?&rdquo;</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<span id="Pitfalls-of-the-upgrade-to-ASDF-3-1"></span><h4 class="subsection">13.3.12 Pitfalls of the upgrade to ASDF 3</h4>
<p>While ASDF 3 is largely compatible with ASDF 2,
there are a few pitfalls when upgrading from ASDF 2,
due to limitations in ASDF 2.
</p>
<ul>
<li> ASDF 2 was designed so it could be upgraded;
but upgrading it required a special setup at the beginning of your build files.
Failure to upgrade it early could result in catastrophic attempt to self-upgrade in mid-build.
</li><li> Starting with ASDF 3 (2.27 or later),
ASDF will automatically attempt to upgrade itself
as the first step before any system operation,
to avoid any possibility of such catastrophic mid-build self-upgrade.
But that doesn&rsquo;t help if your old implementation still provides ASDF 2.
</li><li> It was unsafe in ASDF 2 for a system definition to declare a dependency on ASDF,
since it could trigger such catastrophe for users who were not carefully configured.
If you declare a dependency on a recent enough ASDF,
yet want to be nice with these potentially misconfigured users,
we recommend that you not only specify a recent ASDF in your dependencies with
<code>:depends-on ((:version &quot;asdf&quot; &quot;3.1.2&quot;))</code>,
but that you <em>also</em> check that ASDF 3 is installed,
or else the upgrade catastrophe might happen before that specification is checked,
by starting your <samp>.asd</samp> file with a version check as follows:
<div class="example">
<pre class="example">#-asdf3 (error &quot;<var>MY-SYSTEM</var> requires ASDF 3.1.2&quot;)
</pre></div>
</li><li> When you upgrade from too old a version of ASDF,
previously loaded ASDF extensions become invalid, and will need to be reloaded.
Example extensions include CFFI-Grovel, hacks used by ironclad, etc.
Since it isn&rsquo;t possible to automatically detect what extensions
need to be invalidated and what systems use them,
ASDF will invalidate <em>all</em> previously loaded systems
when it is loaded on top of a forward-incompatible ASDF version.
<a id="DOCF17" href="Pitfalls-of-the-upgrade-to-ASDF-3.html#FOOT17"><sup>17</sup></a>
</li><li> To write a portable build script, you need to rely on a recent version of UIOP,
but until you have ensured a recent ASDF is loaded,
you can&rsquo;t rely on UIOP being present,
and thus must manually avoid all the pathname pitfalls when loading ASDF itself.
</li><li> Bugs in CMUCL and XCL prevent upgrade of ASDF from an old forward-incompatible version.
Happily, CMUCL comes with a recent ASDF,
and XCL is more of a working demo than something you&rsquo;d use seriously anyway.
</li><li> For the above reasons, your build and startup scripts
should load ASDF 3, configure it, and upgrade it,
among the very first things they do.
They should ensure that only ASDF 3 or later is used indeed,
and error out if ASDF 2 or earlier was used.
</li><li> Now that (since May 2016) all maintained implementations
(i.e. having had at least one release since 2014,
or a commit on their public source code repository)
provide ASDF 3.1 or later,
the simple solution is just to use code as below in your setup,
and when it fails, upgrade your implementation or replace its ASDF.
(see <a href="Replacing-your-implementation_0027s-ASDF.html">Replacing your implementation&rsquo;s ASDF</a>):
<div class="example">
<pre class="example">(require &quot;asdf&quot;)
#-asdf3.1 (error &quot;ASDF 3.1 or bust&quot;)
</pre></div>
</li><li> For scripts that try to use ASDF simply via <code>require</code> at first, and
make heroic attempts to load it the hard way if at first they don&rsquo;t succeed,
see <samp>tools/load-asdf.lisp</samp> distributed with the ASDF source repository,
or the code of <a href="https://cliki.net/cl-launch"><code>cl-launch</code></a>.
</li><li> <span id="reinitializeASDFAfterUpgrade"></span>Note that in addition to the pitfalls and constraints above,
these heroic scripts (should you wish to write or modify one),
must take care to configure ASDF <em>twice</em>.
A first time, right after you load the old ASDF 2 (or 1!)
and before you upgrade to the new ASDF 3,
so it may find where you put ASDF 3.
A second time, because most implementations can&rsquo;t handle a smooth upgrade from ASDF 2 to ASDF 3,
so ASDF 3 doesn&rsquo;t try (anymore) and loses any configuration from ASDF 2.
<div class="example lisp">
<pre class="lisp">(ignore-errors (funcall 'require &quot;asdf&quot;)) ;; &lt;--- try real hard
;; &lt;--- insert heroics here, if that failed to provide ASDF 2 or 3
;; &lt;--- insert configuration here, if that succeeded
(asdf:load-system &quot;asdf&quot;)
;; &lt;--- re-configure here, too, in case at first you got ASDF 2
</pre></div>
</li></ul>
</div>
<div class="footnote">
<hr>
<h4 class="footnotes-heading">Footnotes</h4>
<h5><a id="FOOT17" href="Pitfalls-of-the-upgrade-to-ASDF-3.html#DOCF17">(17)</a></h5>
<span id="index-_002aoldest_002dforward_002dcompatible_002dasdf_002dversion_002a"></span>
<p>Forward incompatibility can be determined using the variable
<code>asdf/upgrade::*oldest-forward-compatible-asdf-version*</code>,
which is 2.33 at the time of this writing.</p>
</div>
<hr>
<div class="header">
<p>
Next: <a href="What-happened-to-the-bundle-operations.html">What happened to the bundle operations?</a>, Previous: <a href="Pitfalls-of-the-transition-to-ASDF-2.html">Pitfalls of the transition to ASDF 2</a>, Up: <a href="What-has-changed-between-ASDF-1-ASDF-2-and-ASDF-3_003f.html">&ldquo;What has changed between ASDF 1, ASDF 2, and ASDF 3?&rdquo;</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
</div>
</body>
</html>