1)filterdiff 程序在 patchutils 包中,可以使用 yum install patchutils 或 apt install patchutils 进行安装,使用效果如下所示:
$ filterdiff -i "*/common/Makefile" 0001-vdpa-mlx5-introduce-Mellanox-vDPA-driver.patch
diff --git a/drivers/common/Makefile b/drivers/common/Makefile
index 4775d4b70f..96bd7ac6ef 100644
--- a/drivers/common/Makefile
+++ b/drivers/common/Makefile
@@ -35,7 +35,7 @@ ifneq (,$(findstring y,$(IAVF-y)))
DIRS-y += iavf
endif
-ifeq ($(CONFIG_RTE_LIBRTE_MLX5_PMD),y)
+ifeq ($(findstring y,$(CONFIG_RTE_LIBRTE_MLX5_PMD)$(CONFIG_RTE_LIBRTE_MLX5_VDPA_PMD)),y)
DIRS-y += mlx5
endif
2)如果处理的不是 patch 文件,而是 commit 的话,可以使用 git diff pre-commit-id commit-id -- file_path 来实现类似的功能,使用效果如下所示:
$ git diff 26f1bae837eb 95276abaaf0a -- drivers/common/Makefile
diff --git a/drivers/common/Makefile b/drivers/common/Makefile
index 4775d4b70f..96bd7ac6ef 100644
--- a/drivers/common/Makefile
+++ b/drivers/common/Makefile
@@ -35,7 +35,7 @@ ifneq (,$(findstring y,$(IAVF-y)))
DIRS-y += iavf
endif
-ifeq ($(CONFIG_RTE_LIBRTE_MLX5_PMD),y)
+ifeq ($(findstring y,$(CONFIG_RTE_LIBRTE_MLX5_PMD)$(CONFIG_RTE_LIBRTE_MLX5_VDPA_PMD)),y)
DIRS-y += mlx5
endif
|