* [Buildroot] [PATCH] utils/check-package: check ignored files exist
@ 2023-05-06 21:25 Yann E. MORIN
2023-05-13 10:10 ` Yann E. MORIN
2023-06-13 12:36 ` Peter Korsgaard
0 siblings, 2 replies; 3+ messages in thread
From: Yann E. MORIN @ 2023-05-06 21:25 UTC (permalink / raw)
To: buildroot; +Cc: Yann E. MORIN, Ricardo Martincoski
When an ignored file is removed (e.g. a package patch is no longer
needed after a version bump), the corresponding entry in the ignore list
is no longer needed.
However, we currently only validate that an ignored *test* still fails,
not that a ignore files is now missing.
Add a new test to check-package that does that check, and add a
test-case for that check.
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Cc: Ricardo Martincoski <ricardo.martincoski@gmail.com>
---
utils/check-package | 4 ++++
utils/checkpackagelib/lib_ignore.py | 14 ++++++++++++++
utils/checkpackagelib/test_lib_ignore.py | 18 ++++++++++++++++++
3 files changed, 36 insertions(+)
create mode 100644 utils/checkpackagelib/lib_ignore.py
create mode 100644 utils/checkpackagelib/test_lib_ignore.py
diff --git a/utils/check-package b/utils/check-package
index 83b9750f5a..3de3a72e0c 100755
--- a/utils/check-package
+++ b/utils/check-package
@@ -11,6 +11,7 @@ import sys
import checkpackagelib.base
import checkpackagelib.lib_config
import checkpackagelib.lib_hash
+import checkpackagelib.lib_ignore
import checkpackagelib.lib_mk
import checkpackagelib.lib_patch
import checkpackagelib.lib_python
@@ -107,6 +108,7 @@ def get_lib_from_filetype(fname):
CONFIG_IN_FILENAME = re.compile(r"Config\.\S*$")
DO_CHECK_INTREE = re.compile(r"|".join([
+ r".checkpackageignore",
r"Config.in",
r"arch/",
r"board/",
@@ -146,6 +148,8 @@ def get_lib_from_filename(fname):
if os.path.basename(fname) == "external.mk" and \
os.path.exists(fname[:-2] + "desc"):
return None
+ if fname == ".checkpackageignore":
+ return checkpackagelib.lib_ignore
if CONFIG_IN_FILENAME.search(fname):
return checkpackagelib.lib_config
if fname.endswith(".hash"):
diff --git a/utils/checkpackagelib/lib_ignore.py b/utils/checkpackagelib/lib_ignore.py
new file mode 100644
index 0000000000..f3698fc3b4
--- /dev/null
+++ b/utils/checkpackagelib/lib_ignore.py
@@ -0,0 +1,14 @@
+# See utils/checkpackagelib/readme.txt before editing this file.
+
+import os
+
+from checkpackagelib.base import _CheckFunction
+
+
+class IgnoreMissingFile(_CheckFunction):
+ def check_line(self, lineno, text):
+ fields = text.split()
+ if not os.path.exists(fields[0]):
+ return ["{}:{}: ignored file {} is missing"
+ .format(self.filename, lineno, fields[0]),
+ text]
diff --git a/utils/checkpackagelib/test_lib_ignore.py b/utils/checkpackagelib/test_lib_ignore.py
new file mode 100644
index 0000000000..6cd856d669
--- /dev/null
+++ b/utils/checkpackagelib/test_lib_ignore.py
@@ -0,0 +1,18 @@
+import pytest
+import checkpackagelib.test_util as util
+import checkpackagelib.lib_ignore as m
+
+
+IgnoreMissingFile = [
+ ('missing ignored file',
+ '.checkpackageignore',
+ 'this-file-does-not-exist SomeTest',
+ [['.checkpackageignore:1: ignored file this-file-does-not-exist is missing',
+ 'this-file-does-not-exist SomeTest']]),
+ ]
+
+
+@pytest.mark.parametrize('testname,filename,string,expected', IgnoreMissingFile)
+def test_IgnoreMissingFile(testname, filename, string, expected):
+ warnings = util.check_file(m.IgnoreMissingFile, filename, string)
+ assert warnings == expected
--
2.25.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Buildroot] [PATCH] utils/check-package: check ignored files exist
2023-05-06 21:25 [Buildroot] [PATCH] utils/check-package: check ignored files exist Yann E. MORIN
@ 2023-05-13 10:10 ` Yann E. MORIN
2023-06-13 12:36 ` Peter Korsgaard
1 sibling, 0 replies; 3+ messages in thread
From: Yann E. MORIN @ 2023-05-13 10:10 UTC (permalink / raw)
To: buildroot; +Cc: Ricardo Martincoski
All,
On 2023-05-06 23:25 +0200, Yann E. MORIN spake thusly:
> When an ignored file is removed (e.g. a package patch is no longer
> needed after a version bump), the corresponding entry in the ignore list
> is no longer needed.
>
> However, we currently only validate that an ignored *test* still fails,
> not that a ignore files is now missing.
>
> Add a new test to check-package that does that check, and add a
> test-case for that check.
>
> Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
> Cc: Ricardo Martincoski <ricardo.martincoski@gmail.com>
Applied to master, thanks.
Regards,
Yann E. MORIN.
> ---
> utils/check-package | 4 ++++
> utils/checkpackagelib/lib_ignore.py | 14 ++++++++++++++
> utils/checkpackagelib/test_lib_ignore.py | 18 ++++++++++++++++++
> 3 files changed, 36 insertions(+)
> create mode 100644 utils/checkpackagelib/lib_ignore.py
> create mode 100644 utils/checkpackagelib/test_lib_ignore.py
>
> diff --git a/utils/check-package b/utils/check-package
> index 83b9750f5a..3de3a72e0c 100755
> --- a/utils/check-package
> +++ b/utils/check-package
> @@ -11,6 +11,7 @@ import sys
> import checkpackagelib.base
> import checkpackagelib.lib_config
> import checkpackagelib.lib_hash
> +import checkpackagelib.lib_ignore
> import checkpackagelib.lib_mk
> import checkpackagelib.lib_patch
> import checkpackagelib.lib_python
> @@ -107,6 +108,7 @@ def get_lib_from_filetype(fname):
>
> CONFIG_IN_FILENAME = re.compile(r"Config\.\S*$")
> DO_CHECK_INTREE = re.compile(r"|".join([
> + r".checkpackageignore",
> r"Config.in",
> r"arch/",
> r"board/",
> @@ -146,6 +148,8 @@ def get_lib_from_filename(fname):
> if os.path.basename(fname) == "external.mk" and \
> os.path.exists(fname[:-2] + "desc"):
> return None
> + if fname == ".checkpackageignore":
> + return checkpackagelib.lib_ignore
> if CONFIG_IN_FILENAME.search(fname):
> return checkpackagelib.lib_config
> if fname.endswith(".hash"):
> diff --git a/utils/checkpackagelib/lib_ignore.py b/utils/checkpackagelib/lib_ignore.py
> new file mode 100644
> index 0000000000..f3698fc3b4
> --- /dev/null
> +++ b/utils/checkpackagelib/lib_ignore.py
> @@ -0,0 +1,14 @@
> +# See utils/checkpackagelib/readme.txt before editing this file.
> +
> +import os
> +
> +from checkpackagelib.base import _CheckFunction
> +
> +
> +class IgnoreMissingFile(_CheckFunction):
> + def check_line(self, lineno, text):
> + fields = text.split()
> + if not os.path.exists(fields[0]):
> + return ["{}:{}: ignored file {} is missing"
> + .format(self.filename, lineno, fields[0]),
> + text]
> diff --git a/utils/checkpackagelib/test_lib_ignore.py b/utils/checkpackagelib/test_lib_ignore.py
> new file mode 100644
> index 0000000000..6cd856d669
> --- /dev/null
> +++ b/utils/checkpackagelib/test_lib_ignore.py
> @@ -0,0 +1,18 @@
> +import pytest
> +import checkpackagelib.test_util as util
> +import checkpackagelib.lib_ignore as m
> +
> +
> +IgnoreMissingFile = [
> + ('missing ignored file',
> + '.checkpackageignore',
> + 'this-file-does-not-exist SomeTest',
> + [['.checkpackageignore:1: ignored file this-file-does-not-exist is missing',
> + 'this-file-does-not-exist SomeTest']]),
> + ]
> +
> +
> +@pytest.mark.parametrize('testname,filename,string,expected', IgnoreMissingFile)
> +def test_IgnoreMissingFile(testname, filename, string, expected):
> + warnings = util.check_file(m.IgnoreMissingFile, filename, string)
> + assert warnings == expected
> --
> 2.25.1
>
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Buildroot] [PATCH] utils/check-package: check ignored files exist
2023-05-06 21:25 [Buildroot] [PATCH] utils/check-package: check ignored files exist Yann E. MORIN
2023-05-13 10:10 ` Yann E. MORIN
@ 2023-06-13 12:36 ` Peter Korsgaard
1 sibling, 0 replies; 3+ messages in thread
From: Peter Korsgaard @ 2023-06-13 12:36 UTC (permalink / raw)
To: Yann E. MORIN; +Cc: Ricardo Martincoski, buildroot
>>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:
> When an ignored file is removed (e.g. a package patch is no longer
> needed after a version bump), the corresponding entry in the ignore list
> is no longer needed.
> However, we currently only validate that an ignored *test* still fails,
> not that a ignore files is now missing.
> Add a new test to check-package that does that check, and add a
> test-case for that check.
> Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
> Cc: Ricardo Martincoski <ricardo.martincoski@gmail.com>
Committed to 2023.02.x, thanks.
--
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-06-13 12:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-06 21:25 [Buildroot] [PATCH] utils/check-package: check ignored files exist Yann E. MORIN
2023-05-13 10:10 ` Yann E. MORIN
2023-06-13 12:36 ` Peter Korsgaard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox