mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-24 01:31:46 +00:00
[upstream_utils] Use "git am" instead of "git apply" for patches (#4248)
This creates actual commits in the thirdparty repo, which makes rebasing them onto new versions much easier.
This commit is contained in:
@@ -1,64 +0,0 @@
|
||||
diff --git b/wpimath/src/main/native/include/drake/common/is_approx_equal_abstol.h a/wpimath/src/main/native/include/drake/common/is_approx_equal_abstol.h
|
||||
index 9af0c4525..b3f369ca0 100644
|
||||
--- b/wpimath/src/main/native/include/drake/common/is_approx_equal_abstol.h
|
||||
+++ a/wpimath/src/main/native/include/drake/common/is_approx_equal_abstol.h
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
-#include <Eigen/Dense>
|
||||
+#include <Eigen/Core>
|
||||
|
||||
namespace drake {
|
||||
|
||||
diff --git a/wpimath/src/main/native/cpp/drake/math/discrete_algebraic_riccati_equation.cpp b/wpimath/src/main/native/cpp/drake/math/discrete_algebraic_riccati_equation.cpp
|
||||
index 9585c4dae..49c2fefe7 100644
|
||||
--- a/wpimath/src/main/native/cpp/drake/math/discrete_algebraic_riccati_equation.cpp
|
||||
+++ b/wpimath/src/main/native/cpp/drake/math/discrete_algebraic_riccati_equation.cpp
|
||||
@@ -1,5 +1,8 @@
|
||||
#include "drake/math/discrete_algebraic_riccati_equation.h"
|
||||
|
||||
+#include <Eigen/Eigenvalues>
|
||||
+#include <Eigen/QR>
|
||||
+
|
||||
#include "drake/common/drake_assert.h"
|
||||
#include "drake/common/drake_throw.h"
|
||||
#include "drake/common/is_approx_equal_abstol.h"
|
||||
diff --git b/wpimath/src/main/native/include/drake/math/discrete_algebraic_riccati_equation.h a/wpimath/src/main/native/include/drake/math/discrete_algebraic_riccati_equation.h
|
||||
index b64bfe75e..fc5efb313 100644
|
||||
--- b/wpimath/src/main/native/include/drake/math/discrete_algebraic_riccati_equation.h
|
||||
+++ a/wpimath/src/main/native/include/drake/math/discrete_algebraic_riccati_equation.h
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <cmath>
|
||||
#include <cstdlib>
|
||||
|
||||
-#include <Eigen/Dense>
|
||||
+#include <Eigen/Core>
|
||||
|
||||
namespace drake {
|
||||
namespace math {
|
||||
|
||||
diff --git b/wpimath/src/test/native/cpp/drake/discrete_algebraic_riccati_equation_test.cpp a/wpimath/src/test/native/cpp/drake/discrete_algebraic_riccati_equation_test.cpp
|
||||
index 74aa4b23d..2deb039a0 100644
|
||||
--- b/wpimath/src/test/native/cpp/drake/discrete_algebraic_riccati_equation_test.cpp
|
||||
+++ a/wpimath/src/test/native/cpp/drake/discrete_algebraic_riccati_equation_test.cpp
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "drake/math/discrete_algebraic_riccati_equation.h"
|
||||
|
||||
+#include <Eigen/Eigenvalues>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "drake/common/test_utilities/eigen_matrix_compare.h"
|
||||
diff --git b/wpimath/src/test/native/include/drake/common/test_utilities/eigen_matrix_compare.h a/wpimath/src/test/native/include/drake/common/test_utilities/eigen_matrix_compare.h
|
||||
index e3bd85349..d6bcbb8ec 100644
|
||||
--- b/wpimath/src/test/native/include/drake/common/test_utilities/eigen_matrix_compare.h
|
||||
+++ a/wpimath/src/test/native/include/drake/common/test_utilities/eigen_matrix_compare.h
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <cmath>
|
||||
#include <limits>
|
||||
|
||||
-#include <Eigen/Dense>
|
||||
+#include <Eigen/Core>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
// #include "drake/common/text_logging.h"
|
||||
@@ -0,0 +1,79 @@
|
||||
From ef037207c433f16721d1f0574bde984b4bdea1f8 Mon Sep 17 00:00:00 2001
|
||||
From: Tyler Veness <calcmogul@gmail.com>
|
||||
Date: Wed, 18 May 2022 11:13:21 -0700
|
||||
Subject: [PATCH 1/2] Replace <Eigen/Dense> with <Eigen/Core>
|
||||
|
||||
---
|
||||
common/is_approx_equal_abstol.h | 2 +-
|
||||
common/test_utilities/eigen_matrix_compare.h | 2 +-
|
||||
math/discrete_algebraic_riccati_equation.cc | 3 +++
|
||||
math/discrete_algebraic_riccati_equation.h | 2 +-
|
||||
math/test/discrete_algebraic_riccati_equation_test.cc | 1 +
|
||||
5 files changed, 7 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/common/is_approx_equal_abstol.h b/common/is_approx_equal_abstol.h
|
||||
index 9af0c45252..b3f369ca01 100644
|
||||
--- a/common/is_approx_equal_abstol.h
|
||||
+++ b/common/is_approx_equal_abstol.h
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
-#include <Eigen/Dense>
|
||||
+#include <Eigen/Core>
|
||||
|
||||
namespace drake {
|
||||
|
||||
diff --git a/common/test_utilities/eigen_matrix_compare.h b/common/test_utilities/eigen_matrix_compare.h
|
||||
index a595da9510..c22567d32c 100644
|
||||
--- a/common/test_utilities/eigen_matrix_compare.h
|
||||
+++ b/common/test_utilities/eigen_matrix_compare.h
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <cmath>
|
||||
#include <limits>
|
||||
|
||||
-#include <Eigen/Dense>
|
||||
+#include <Eigen/Core>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "drake/common/text_logging.h"
|
||||
diff --git a/math/discrete_algebraic_riccati_equation.cc b/math/discrete_algebraic_riccati_equation.cc
|
||||
index 901f2ef240..20ea2b7bbe 100644
|
||||
--- a/math/discrete_algebraic_riccati_equation.cc
|
||||
+++ b/math/discrete_algebraic_riccati_equation.cc
|
||||
@@ -1,5 +1,8 @@
|
||||
#include "drake/math/discrete_algebraic_riccati_equation.h"
|
||||
|
||||
+#include <Eigen/Eigenvalues>
|
||||
+#include <Eigen/QR>
|
||||
+
|
||||
#include "drake/common/drake_assert.h"
|
||||
#include "drake/common/drake_throw.h"
|
||||
#include "drake/common/is_approx_equal_abstol.h"
|
||||
diff --git a/math/discrete_algebraic_riccati_equation.h b/math/discrete_algebraic_riccati_equation.h
|
||||
index 891373ff9d..df7a58b2b8 100644
|
||||
--- a/math/discrete_algebraic_riccati_equation.h
|
||||
+++ b/math/discrete_algebraic_riccati_equation.h
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <cmath>
|
||||
#include <cstdlib>
|
||||
|
||||
-#include <Eigen/Dense>
|
||||
+#include <Eigen/Core>
|
||||
|
||||
namespace drake {
|
||||
namespace math {
|
||||
diff --git a/math/test/discrete_algebraic_riccati_equation_test.cc b/math/test/discrete_algebraic_riccati_equation_test.cc
|
||||
index 533ced151d..e4ecfd2eb5 100644
|
||||
--- a/math/test/discrete_algebraic_riccati_equation_test.cc
|
||||
+++ b/math/test/discrete_algebraic_riccati_equation_test.cc
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "drake/math/discrete_algebraic_riccati_equation.h"
|
||||
|
||||
+#include <Eigen/Eigenvalues>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "drake/common/test_utilities/eigen_matrix_compare.h"
|
||||
--
|
||||
2.36.1
|
||||
|
||||
@@ -1,7 +1,16 @@
|
||||
diff --git b/wpimath/src/main/native/include/drake/math/discrete_algebraic_riccati_equation.h a/wpimath/src/main/native/include/drake/math/discrete_algebraic_riccati_equation.h
|
||||
index df7a58b2b..55b8442bf 100644
|
||||
--- b/wpimath/src/main/native/include/drake/math/discrete_algebraic_riccati_equation.h
|
||||
+++ a/wpimath/src/main/native/include/drake/math/discrete_algebraic_riccati_equation.h
|
||||
From 7dfb527524f42488a00cf156ada36c51d5e13b3f Mon Sep 17 00:00:00 2001
|
||||
From: Tyler Veness <calcmogul@gmail.com>
|
||||
Date: Wed, 18 May 2022 11:15:27 -0700
|
||||
Subject: [PATCH 2/2] Add WPILIB_DLLEXPORT to DARE function declarations
|
||||
|
||||
---
|
||||
math/discrete_algebraic_riccati_equation.h | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/math/discrete_algebraic_riccati_equation.h b/math/discrete_algebraic_riccati_equation.h
|
||||
index df7a58b2b8..55b8442bf4 100644
|
||||
--- a/math/discrete_algebraic_riccati_equation.h
|
||||
+++ b/math/discrete_algebraic_riccati_equation.h
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <cstdlib>
|
||||
|
||||
@@ -26,3 +35,6 @@ index df7a58b2b..55b8442bf 100644
|
||||
Eigen::MatrixXd DiscreteAlgebraicRiccatiEquation(
|
||||
const Eigen::Ref<const Eigen::MatrixXd>& A,
|
||||
const Eigen::Ref<const Eigen::MatrixXd>& B,
|
||||
--
|
||||
2.36.1
|
||||
|
||||
@@ -1,7 +1,18 @@
|
||||
diff --git a/wpiutil/src/main/native/fmtlib/include/fmt/format-inl.h b/wpiutil/src/main/native/fmtlib/include/fmt/format-inl.h
|
||||
index 2c51c50ae..cc89abdd3 100644
|
||||
--- a/wpiutil/src/main/native/fmtlib/include/fmt/format-inl.h
|
||||
+++ b/wpiutil/src/main/native/fmtlib/include/fmt/format-inl.h
|
||||
From e92e91d28f2475b38f32f92d24b65eec195254a6 Mon Sep 17 00:00:00 2001
|
||||
From: Tyler Veness <calcmogul@gmail.com>
|
||||
Date: Wed, 18 May 2022 10:21:49 -0700
|
||||
Subject: [PATCH] Don't throw on write failure
|
||||
|
||||
---
|
||||
include/fmt/format-inl.h | 3 +--
|
||||
include/fmt/xchar.h | 3 +--
|
||||
src/os.cc | 3 +--
|
||||
3 files changed, 3 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/include/fmt/format-inl.h b/include/fmt/format-inl.h
|
||||
index 2c51c50a..cc89abdd 100644
|
||||
--- a/include/fmt/format-inl.h
|
||||
+++ b/include/fmt/format-inl.h
|
||||
@@ -92,8 +92,7 @@ FMT_FUNC void report_error(format_func func, int error_code,
|
||||
// A wrapper around fwrite that throws on error.
|
||||
inline void fwrite_fully(const void* ptr, size_t size, size_t count,
|
||||
@@ -12,10 +23,10 @@ index 2c51c50ae..cc89abdd3 100644
|
||||
}
|
||||
|
||||
#ifndef FMT_STATIC_THOUSANDS_SEPARATOR
|
||||
diff --git a/wpiutil/src/main/native/fmtlib/include/fmt/xchar.h b/wpiutil/src/main/native/fmtlib/include/fmt/xchar.h
|
||||
index 55825077f..9acb893fa 100644
|
||||
--- a/wpiutil/src/main/native/fmtlib/include/fmt/xchar.h
|
||||
+++ b/wpiutil/src/main/native/fmtlib/include/fmt/xchar.h
|
||||
diff --git a/include/fmt/xchar.h b/include/fmt/xchar.h
|
||||
index 55825077..9acb893f 100644
|
||||
--- a/include/fmt/xchar.h
|
||||
+++ b/include/fmt/xchar.h
|
||||
@@ -207,8 +207,7 @@ inline void vprint(std::FILE* f, wstring_view fmt, wformat_args args) {
|
||||
wmemory_buffer buffer;
|
||||
detail::vformat_to(buffer, fmt, args);
|
||||
@@ -26,10 +37,10 @@ index 55825077f..9acb893fa 100644
|
||||
}
|
||||
|
||||
inline void vprint(wstring_view fmt, wformat_args args) {
|
||||
diff --git a/wpiutil/src/main/native/fmtlib/src/os.cpp b/wpiutil/src/main/native/fmtlib/src/os.cpp
|
||||
index 04b4dc506..4eb3e1fdd 100644
|
||||
--- a/wpiutil/src/main/native/fmtlib/src/os.cpp
|
||||
+++ b/wpiutil/src/main/native/fmtlib/src/os.cpp
|
||||
diff --git a/src/os.cc b/src/os.cc
|
||||
index 04b4dc50..4eb3e1fd 100644
|
||||
--- a/src/os.cc
|
||||
+++ b/src/os.cc
|
||||
@@ -277,8 +277,7 @@ std::size_t file::read(void* buffer, std::size_t count) {
|
||||
std::size_t file::write(const void* buffer, std::size_t count) {
|
||||
rwresult result = 0;
|
||||
@@ -40,3 +51,6 @@ index 04b4dc506..4eb3e1fdd 100644
|
||||
}
|
||||
|
||||
file file::dup(int fd) {
|
||||
--
|
||||
2.36.1
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import os
|
||||
import shutil
|
||||
|
||||
from upstream_utils import setup_upstream_repo, comment_out_invalid_includes, walk_cwd_and_copy_if, apply_patches
|
||||
from upstream_utils import setup_upstream_repo, comment_out_invalid_includes, walk_cwd_and_copy_if, am_patches
|
||||
|
||||
|
||||
def main():
|
||||
@@ -11,6 +11,14 @@ def main():
|
||||
"v0.37.0")
|
||||
wpimath = os.path.join(root, "wpimath")
|
||||
|
||||
prefix = os.path.join(root, "upstream_utils/drake_patches")
|
||||
am_patches(repo, [
|
||||
os.path.join(prefix, "0001-Replace-Eigen-Dense-with-Eigen-Core.patch"),
|
||||
os.path.join(
|
||||
prefix,
|
||||
"0002-Add-WPILIB_DLLEXPORT-to-DARE-function-declarations.patch")
|
||||
])
|
||||
|
||||
# Delete old install
|
||||
for d in [
|
||||
"src/main/native/cpp/drake", "src/main/native/include/drake",
|
||||
@@ -61,11 +69,6 @@ def main():
|
||||
os.path.join(wpimath, "src/test/native/include")
|
||||
])
|
||||
|
||||
apply_patches(root, [
|
||||
"upstream_utils/drake-replace-dense-with-core.patch",
|
||||
"upstream_utils/drake-dllexport-dare.patch"
|
||||
])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
@@ -3,13 +3,18 @@
|
||||
import os
|
||||
import shutil
|
||||
|
||||
from upstream_utils import setup_upstream_repo, comment_out_invalid_includes, walk_cwd_and_copy_if, apply_patches
|
||||
from upstream_utils import setup_upstream_repo, comment_out_invalid_includes, walk_cwd_and_copy_if, am_patches
|
||||
|
||||
|
||||
def main():
|
||||
root, repo = setup_upstream_repo("https://github.com/fmtlib/fmt", "8.1.1")
|
||||
wpiutil = os.path.join(root, "wpiutil")
|
||||
|
||||
# Apply patches to original git repo
|
||||
prefix = os.path.join(root, "upstream_utils/fmt_patches")
|
||||
am_patches(
|
||||
repo, [os.path.join(prefix, "0001-Don-t-throw-on-write-failure.patch")])
|
||||
|
||||
# Delete old install
|
||||
for d in ["src/main/native/fmtlib/src", "src/main/native/fmtlib/include"]:
|
||||
shutil.rmtree(os.path.join(wpiutil, d), ignore_errors=True)
|
||||
@@ -31,9 +36,6 @@ def main():
|
||||
comment_out_invalid_includes(
|
||||
f, [os.path.join(wpiutil, "src/main/native/fmtlib/include")])
|
||||
|
||||
apply_patches(root,
|
||||
["upstream_utils/fmt-dont-throw-on-write-failure.patch"])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user