potiuk commented on code in PR #36591:
URL: https://github.com/apache/airflow/pull/36591#discussion_r1441724225


##########
docs/build_docs.py:
##########
@@ -495,31 +495,50 @@ def main():
 
     if not args.one_pass_only:
         # Build documentation for some packages again if it can help them.
-        package_build_errors, package_spelling_errors = 
retry_building_docs_if_needed(
-            all_build_errors,
-            all_spelling_errors,
-            args,
-            docs_only,
-            jobs,
-            package_build_errors,
-            package_spelling_errors,
-            current_packages,
-            spellcheck_only,
+        package_build_errors = retry_building_docs_if_needed(
+            all_build_errors=all_build_errors,
+            all_spelling_errors=all_spelling_errors,
+            args=args,
+            docs_only=docs_only,
+            jobs=jobs,
+            package_build_errors=package_build_errors,
+            originally_built_packages=packages_to_build,
+            # If spellchecking fails, we need to rebuild all packages first in 
case some references
+            # are broken between packages
+            rebuild_all_packages=spellcheck_only,
         )
 
-        # And try again in case one change spans across three-level 
dependencies
-        retry_building_docs_if_needed(
-            all_build_errors,
-            all_spelling_errors,
-            args,
-            docs_only,
-            jobs,
-            package_build_errors,
-            package_spelling_errors,
-            current_packages,
-            spellcheck_only,
+        # And try again in case one change spans across three-level 
dependencies.
+        package_build_errors = retry_building_docs_if_needed(
+            all_build_errors=all_build_errors,
+            all_spelling_errors=all_spelling_errors,
+            args=args,
+            docs_only=docs_only,
+            jobs=jobs,
+            package_build_errors=package_build_errors,
+            originally_built_packages=packages_to_build,
+            # In the 3rd pass we only rebuild packages that failed in the 2nd 
pass
+            # no matter if we do spellcheck-only build
+            rebuild_all_packages=False,
         )
 
+        if spellcheck_only:
+            # And in case of spellcheck-only, we add a 4th pass to account for 
A->B-C case
+            # For spellcheck-only build, the first pass does not solve any of 
the dependency
+            # Issues, they only start getting solved and the 2nd pass so we 
might need to do one more pass
+            package_build_errors = retry_building_docs_if_needed(
+                all_build_errors=all_build_errors,
+                all_spelling_errors=all_spelling_errors,
+                args=args,
+                docs_only=docs_only,
+                jobs=jobs,
+                package_build_errors=package_build_errors,
+                originally_built_packages=packages_to_build,
+                # In the 3rd pass we only rebuild packages that failed in the 
3rd pass

Review Comment:
   ```suggestion
                   # In the 3rd pass we only rebuild packages that failed in 
the 2nd pass
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to