diff mbox series

[isar-cip-core,1/2] scripts: Add automated recipe updates for LTP

Message ID 1740727183-24538-1-git-send-email-nobuhiro1.iwamatsu@toshiba.co.jp (mailing list archive)
State Changes Requested
Headers show
Series [isar-cip-core,1/2] scripts: Add automated recipe updates for LTP | expand

Commit Message

Nobuhiro Iwamatsu Feb. 28, 2025, 7:19 a.m. UTC
Signed-off-by: Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>
---
 scripts/update-ltp.sh | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100755 scripts/update-ltp.sh

Comments

Jan Kiszka Feb. 28, 2025, 3:43 p.m. UTC | #1
On 28.02.25 08:19, Nobuhiro Iwamatsu wrote:
> Signed-off-by: Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>
> ---
>  scripts/update-ltp.sh | 29 +++++++++++++++++++++++++++++
>  1 file changed, 29 insertions(+)
>  create mode 100755 scripts/update-ltp.sh
> 
> diff --git a/scripts/update-ltp.sh b/scripts/update-ltp.sh
> new file mode 100755
> index 0000000..99b75b0
> --- /dev/null
> +++ b/scripts/update-ltp.sh
> @@ -0,0 +1,29 @@
> +#!/bin/bash
> +
> +REPO_ROOT=$(git rev-parse --show-toplevel)
> +pushd ${REPO_ROOT}/recipes-core/ltp > /dev/null
> +
> +LATEST_VER=$(git ls-remote --refs --tags  https://github.com/linux-test-project/ltp.git | \
> +	cut --delimiter='/' --fields=3 | \
> +	sort --version-sort | tail --lines=1)
> +
> +SHA256FILE="ltp-full-${LATEST_VER}.tar.xz.sha256"
> +rm -rf ${SHA256FILE}
> +
> +wget -q https://github.com/linux-test-project/ltp/releases/download/${LATEST_VER}/${SHA256FILE}
> +
> +SHA256SUM=$(cut -f 1 -d " " ${SHA256FILE})
> +RECIPE="ltp-full_${LATEST_VER}.bb"
> +
> +if [ ! -f ${RECIPE} ]; then
> +	git mv ltp-full*.bb ${RECIPE}
> +
> +	sed -i 's/\(SRC_URI\[sha256sum\] = "\).*/\1'${SHA256SUM}'"'/ ${RECIPE}
> +	git add ${RECIPE}
> +
> +	git commit -asm "recipes-core: ltp: Update to ${LATEST_VER}"
> +fi
> +
> +rm -rf ${SHA256FILE}
> +
> +popd > /dev/null

Please have a look at what shellcheck is finding. Seems it's mostly
quoting, but if we don't go to zero warnings, the next change with a
real issue will not be easy to spot.

Thanks,
Jan
Nobuhiro Iwamatsu March 5, 2025, 4:24 a.m. UTC | #2
Hi Jan,

> -----Original Message-----
> From: Jan Kiszka <jan.kiszka@siemens.com>
> Sent: Saturday, March 1, 2025 12:44 AM
> To: iwamatsu nobuhiro(岩松 信洋 ○DITC□DIT○OST)
> <nobuhiro1.iwamatsu@toshiba.co.jp>; cip-dev@lists.cip-project.org
> Subject: Re: [isar-cip-core][PATCH 1/2] scripts: Add automated recipe
> updates for LTP
> 
> On 28.02.25 08:19, Nobuhiro Iwamatsu wrote:
> > Signed-off-by: Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>
> > ---
> >  scripts/update-ltp.sh | 29 +++++++++++++++++++++++++++++
> >  1 file changed, 29 insertions(+)
> >  create mode 100755 scripts/update-ltp.sh
> >
> > diff --git a/scripts/update-ltp.sh b/scripts/update-ltp.sh new file
> > mode 100755 index 0000000..99b75b0
> > --- /dev/null
> > +++ b/scripts/update-ltp.sh
> > @@ -0,0 +1,29 @@
> > +#!/bin/bash
> > +
> > +REPO_ROOT=$(git rev-parse --show-toplevel) pushd
> > +${REPO_ROOT}/recipes-core/ltp > /dev/null
> > +
> > +LATEST_VER=$(git ls-remote --refs --tags
> https://github.com/linux-test-project/ltp.git | \
> > +	cut --delimiter='/' --fields=3 | \
> > +	sort --version-sort | tail --lines=1)
> > +
> > +SHA256FILE="ltp-full-${LATEST_VER}.tar.xz.sha256"
> > +rm -rf ${SHA256FILE}
> > +
> > +wget -q
> > +https://github.com/linux-test-project/ltp/releases/download/${LATEST_
> > +VER}/${SHA256FILE}
> > +
> > +SHA256SUM=$(cut -f 1 -d " " ${SHA256FILE})
> > +RECIPE="ltp-full_${LATEST_VER}.bb"
> > +
> > +if [ ! -f ${RECIPE} ]; then
> > +	git mv ltp-full*.bb ${RECIPE}
> > +
> > +	sed -i 's/\(SRC_URI\[sha256sum\] = "\).*/\1'${SHA256SUM}'"'/
> ${RECIPE}
> > +	git add ${RECIPE}
> > +
> > +	git commit -asm "recipes-core: ltp: Update to ${LATEST_VER}"
> > +fi
> > +
> > +rm -rf ${SHA256FILE}
> > +
> > +popd > /dev/null
> 
> Please have a look at what shellcheck is finding. Seems it's mostly quoting, but
> if we don't go to zero warnings, the next change with a real issue will not be
> easy to spot.

OK, I will check with shellcheck.
> 
> Thanks,
> Jan

Best regards,
  Nobuhiro
diff mbox series

Patch

diff --git a/scripts/update-ltp.sh b/scripts/update-ltp.sh
new file mode 100755
index 0000000..99b75b0
--- /dev/null
+++ b/scripts/update-ltp.sh
@@ -0,0 +1,29 @@ 
+#!/bin/bash
+
+REPO_ROOT=$(git rev-parse --show-toplevel)
+pushd ${REPO_ROOT}/recipes-core/ltp > /dev/null
+
+LATEST_VER=$(git ls-remote --refs --tags  https://github.com/linux-test-project/ltp.git | \
+	cut --delimiter='/' --fields=3 | \
+	sort --version-sort | tail --lines=1)
+
+SHA256FILE="ltp-full-${LATEST_VER}.tar.xz.sha256"
+rm -rf ${SHA256FILE}
+
+wget -q https://github.com/linux-test-project/ltp/releases/download/${LATEST_VER}/${SHA256FILE}
+
+SHA256SUM=$(cut -f 1 -d " " ${SHA256FILE})
+RECIPE="ltp-full_${LATEST_VER}.bb"
+
+if [ ! -f ${RECIPE} ]; then
+	git mv ltp-full*.bb ${RECIPE}
+
+	sed -i 's/\(SRC_URI\[sha256sum\] = "\).*/\1'${SHA256SUM}'"'/ ${RECIPE}
+	git add ${RECIPE}
+
+	git commit -asm "recipes-core: ltp: Update to ${LATEST_VER}"
+fi
+
+rm -rf ${SHA256FILE}
+
+popd > /dev/null