patches and low-level development discussion
 help / color / mirror / code / Atom feed
* [PATCH v2 1/2] Documentation/scripts: fix shellcheck issues
@ 2022-11-18 10:09 Alyssa Ross
  2022-11-18 10:09 ` [PATCH v2 2/2] nix/checks.nix: shellcheck more files Alyssa Ross
  2022-11-18 16:38 ` [PATCH v2 1/2] Documentation/scripts: fix shellcheck issues Alyssa Ross
  0 siblings, 2 replies; 5+ messages in thread
From: Alyssa Ross @ 2022-11-18 10:09 UTC (permalink / raw)
  To: devel; +Cc: Henri Rosten

There's an open issue about teaching shellcheck to automatically
recognize nix-shell shebangs:
https://github.com/koalaman/shellcheck/issues/1210

Signed-off-by: Alyssa Ross <alyssa.ross@unikie.com>
---
v2: no changes

 Documentation/scripts/build.sh       | 2 +-
 Documentation/scripts/update-gems.sh | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/Documentation/scripts/build.sh b/Documentation/scripts/build.sh
index 85bd5a5..e6a2cd8 100755
--- a/Documentation/scripts/build.sh
+++ b/Documentation/scripts/build.sh
@@ -4,7 +4,7 @@
 
 cd "$(dirname "$0")/.."
 
-if [ ! -w . -a ! -w .jekyll-cache ]; then
+if [ ! -w . ] && [ ! -w .jekyll-cache ]; then
 	JEKYLLFLAGS=--disable-disk-cache
 fi
 
diff --git a/Documentation/scripts/update-gems.sh b/Documentation/scripts/update-gems.sh
index 7ba98d8..d70f55f 100755
--- a/Documentation/scripts/update-gems.sh
+++ b/Documentation/scripts/update-gems.sh
@@ -1,8 +1,11 @@
 #! /usr/bin/env nix-shell
 #! nix-shell -i bash -p bundler bundix
+
 # SPDX-FileCopyrightText: 2022 Unikie
 # SPDX-License-Identifier: EUPL-1.2+
 
+# shellcheck shell=bash
+
 set -euo pipefail
 
 bundle lock --update
-- 
2.35.1



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 2/2] nix/checks.nix: shellcheck more files
  2022-11-18 10:09 [PATCH v2 1/2] Documentation/scripts: fix shellcheck issues Alyssa Ross
@ 2022-11-18 10:09 ` Alyssa Ross
  2022-11-18 11:00   ` Henri Rosten
  2022-11-18 16:38   ` Alyssa Ross
  2022-11-18 16:38 ` [PATCH v2 1/2] Documentation/scripts: fix shellcheck issues Alyssa Ross
  1 sibling, 2 replies; 5+ messages in thread
From: Alyssa Ross @ 2022-11-18 10:09 UTC (permalink / raw)
  To: devel; +Cc: Henri Rosten

I didn't realise that bash's ** feature (which matches any depth of
directories) wasn't enabled by default, because it appeared to work,
just didn't find all scripts.

Signed-off-by: Alyssa Ross <alyssa.ross@unikie.com>
Fixes: 169fdd6 ("release.nix: run shellcheck on build scripts")
---
v2: exclude build directories

 nix/checks.nix | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/nix/checks.nix b/nix/checks.nix
index 9eb261f..9ffdc0a 100644
--- a/nix/checks.nix
+++ b/nix/checks.nix
@@ -11,12 +11,14 @@
     runCommand "spectrum-shellcheck" {
       src = lib.cleanSourceWith {
         filter = path: type:
-          type == "directory" || builtins.match ''.*[^/]\.sh'' path != null;
+          (builtins.baseNameOf path != "build" && type == "directory")
+          || builtins.match ''.*[^/]\.sh'' path != null;
         src = lib.cleanSource ../.;
       };
 
       nativeBuildInputs = [ shellcheck ];
     } ''
+      shopt -s globstar
       shellcheck $src/**/*.sh
       touch $out
     ''
-- 
2.35.1



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 2/2] nix/checks.nix: shellcheck more files
  2022-11-18 10:09 ` [PATCH v2 2/2] nix/checks.nix: shellcheck more files Alyssa Ross
@ 2022-11-18 11:00   ` Henri Rosten
  2022-11-18 16:38   ` Alyssa Ross
  1 sibling, 0 replies; 5+ messages in thread
From: Henri Rosten @ 2022-11-18 11:00 UTC (permalink / raw)
  To: Alyssa Ross; +Cc: devel

On Fri, Nov 18, 2022 at 10:09:47AM +0000, Alyssa Ross wrote:
> I didn't realise that bash's ** feature (which matches any depth of
> directories) wasn't enabled by default, because it appeared to work,
> just didn't find all scripts.
> 
> Signed-off-by: Alyssa Ross <alyssa.ross@unikie.com>
> Fixes: 169fdd6 ("release.nix: run shellcheck on build scripts")
> ---
> v2: exclude build directories

Thanks for fixing this.

Reviewed-by: Henri Rosten <henri.rosten@unikie.com>

> 
>  nix/checks.nix | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/nix/checks.nix b/nix/checks.nix
> index 9eb261f..9ffdc0a 100644
> --- a/nix/checks.nix
> +++ b/nix/checks.nix
> @@ -11,12 +11,14 @@
>      runCommand "spectrum-shellcheck" {
>        src = lib.cleanSourceWith {
>          filter = path: type:
> -          type == "directory" || builtins.match ''.*[^/]\.sh'' path != null;
> +          (builtins.baseNameOf path != "build" && type == "directory")
> +          || builtins.match ''.*[^/]\.sh'' path != null;
>          src = lib.cleanSource ../.;
>        };
>  
>        nativeBuildInputs = [ shellcheck ];
>      } ''
> +      shopt -s globstar
>        shellcheck $src/**/*.sh
>        touch $out
>      ''
> -- 
> 2.35.1
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 2/2] nix/checks.nix: shellcheck more files
  2022-11-18 10:09 ` [PATCH v2 2/2] nix/checks.nix: shellcheck more files Alyssa Ross
  2022-11-18 11:00   ` Henri Rosten
@ 2022-11-18 16:38   ` Alyssa Ross
  1 sibling, 0 replies; 5+ messages in thread
From: Alyssa Ross @ 2022-11-18 16:38 UTC (permalink / raw)
  To: Alyssa Ross, devel; +Cc: Henri Rosten

This patch has been committed as e2cdde0af4cebd13ceacf4ce7ce70e689bbe9dbc,
which can be viewed online at
https://spectrum-os.org/git/spectrum/commit/?id=e2cdde0af4cebd13ceacf4ce7ce70e689bbe9dbc.

This is an automated message.  Send comments/questions/requests to:
Alyssa Ross <hi@alyssa.is>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 1/2] Documentation/scripts: fix shellcheck issues
  2022-11-18 10:09 [PATCH v2 1/2] Documentation/scripts: fix shellcheck issues Alyssa Ross
  2022-11-18 10:09 ` [PATCH v2 2/2] nix/checks.nix: shellcheck more files Alyssa Ross
@ 2022-11-18 16:38 ` Alyssa Ross
  1 sibling, 0 replies; 5+ messages in thread
From: Alyssa Ross @ 2022-11-18 16:38 UTC (permalink / raw)
  To: Alyssa Ross, devel; +Cc: Henri Rosten

This patch has been committed as 9f3671abc5512e8d625d92957d3b2d0d4c2ae8b7,
which can be viewed online at
https://spectrum-os.org/git/spectrum/commit/?id=9f3671abc5512e8d625d92957d3b2d0d4c2ae8b7.

This is an automated message.  Send comments/questions/requests to:
Alyssa Ross <hi@alyssa.is>


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-11-18 16:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-18 10:09 [PATCH v2 1/2] Documentation/scripts: fix shellcheck issues Alyssa Ross
2022-11-18 10:09 ` [PATCH v2 2/2] nix/checks.nix: shellcheck more files Alyssa Ross
2022-11-18 11:00   ` Henri Rosten
2022-11-18 16:38   ` Alyssa Ross
2022-11-18 16:38 ` [PATCH v2 1/2] Documentation/scripts: fix shellcheck issues Alyssa Ross

Code repositories for project(s) associated with this public inbox

	https://spectrum-os.org/git/crosvm
	https://spectrum-os.org/git/doc
	https://spectrum-os.org/git/mktuntap
	https://spectrum-os.org/git/nixpkgs
	https://spectrum-os.org/git/spectrum
	https://spectrum-os.org/git/ucspi-vsock
	https://spectrum-os.org/git/www

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).