diff mbox series

[RESEND,10/12] bringup: Use full path when creating custom_source file

Message ID 20250113-jag-bringup_fixes-v1-10-fb28030b1f26@kernel.org (mailing list archive)
State New
Headers show
Series kdevops: Various fixes | expand

Commit Message

Joel Granados Jan. 13, 2025, 11:53 a.m. UTC
Avoid "file not found" failures related to relative paths in
custom_source

Signed-off-by: Joel Granados <joel.granados@kernel.org>
---
 scripts/bringup_guestfs.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Daniel Gomez Jan. 30, 2025, 8:14 a.m. UTC | #1
On Mon, Jan 13, 2025 at 12:53:08PM +0100, Joel Granados wrote:
> Avoid "file not found" failures related to relative paths in
> custom_source
> 
> Signed-off-by: Joel Granados <joel.granados@kernel.org>
> ---
>  scripts/bringup_guestfs.sh | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/bringup_guestfs.sh b/scripts/bringup_guestfs.sh
> index 74eecea..f49fd12 100755
> --- a/scripts/bringup_guestfs.sh
> +++ b/scripts/bringup_guestfs.sh
> @@ -34,7 +34,7 @@ build_custom_source()
>  	SOURCE_TMP=$(mktemp)
>  	cat <<_EOT >$SOURCE_TMP
>  [local]
> -uri=file:///${CUSTOM_INDEX}
> +uri=file:///${REAL_CUSTOM_INDEX}
>  proxy=off
>  _EOT
>  	sudo mv $SOURCE_TMP $CUSTOM_SOURCE
> @@ -111,6 +111,7 @@ build_custom_image()
>  	CUSTOM_IMAGE_OK="${CUSTOM_IMAGE_DIR}.ok"
>  	CUSTOM_SOURCE="/etc/virt-builder/repos.d/kdevops-custom-images-${OS_VERSION}.conf"
>  	CUSTOM_INDEX="${CUSTOM_IMAGE_DIR}/index"
> +	REAL_CUSTOM_INDEX="$(realpath $CUSTOM_INDEX)"

Can we override the CUSTOM_INDEX variable here with realpath output?
I think we don't need both and we can simply avoid using the new var
added.

>  
>  	mkdir -p ${CUSTOM_IMAGE_DIR}
>  
> 
> -- 
> 2.44.2
> 
>
Joel Granados Jan. 31, 2025, 5:04 p.m. UTC | #2
On Thu, Jan 30, 2025 at 09:14:50AM +0100, Daniel Gomez wrote:
> On Mon, Jan 13, 2025 at 12:53:08PM +0100, Joel Granados wrote:
> > Avoid "file not found" failures related to relative paths in
> > custom_source
> > 
> > Signed-off-by: Joel Granados <joel.granados@kernel.org>
> > ---
> >  scripts/bringup_guestfs.sh | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/scripts/bringup_guestfs.sh b/scripts/bringup_guestfs.sh
> > index 74eecea..f49fd12 100755
> > --- a/scripts/bringup_guestfs.sh
> > +++ b/scripts/bringup_guestfs.sh
> > @@ -34,7 +34,7 @@ build_custom_source()
> >  	SOURCE_TMP=$(mktemp)
> >  	cat <<_EOT >$SOURCE_TMP
> >  [local]
> > -uri=file:///${CUSTOM_INDEX}
> > +uri=file:///${REAL_CUSTOM_INDEX}
> >  proxy=off
> >  _EOT
> >  	sudo mv $SOURCE_TMP $CUSTOM_SOURCE
> > @@ -111,6 +111,7 @@ build_custom_image()
> >  	CUSTOM_IMAGE_OK="${CUSTOM_IMAGE_DIR}.ok"
> >  	CUSTOM_SOURCE="/etc/virt-builder/repos.d/kdevops-custom-images-${OS_VERSION}.conf"
> >  	CUSTOM_INDEX="${CUSTOM_IMAGE_DIR}/index"
> > +	REAL_CUSTOM_INDEX="$(realpath $CUSTOM_INDEX)"
> 
> Can we override the CUSTOM_INDEX variable here with realpath output?
> I think we don't need both and we can simply avoid using the new var
> added.
This is a very good question. Did not have time to test.

> 
> >  
> >  	mkdir -p ${CUSTOM_IMAGE_DIR}
> >  
> > 
> > -- 
> > 2.44.2
> > 
> >
Joel Granados Feb. 5, 2025, 8:29 a.m. UTC | #3
On Fri, Jan 31, 2025 at 06:04:16PM +0100, Joel Granados wrote:
> On Thu, Jan 30, 2025 at 09:14:50AM +0100, Daniel Gomez wrote:
> > On Mon, Jan 13, 2025 at 12:53:08PM +0100, Joel Granados wrote:
> > > Avoid "file not found" failures related to relative paths in
> > > custom_source
> > > 
> > > Signed-off-by: Joel Granados <joel.granados@kernel.org>
> > > ---
> > >  scripts/bringup_guestfs.sh | 3 ++-
> > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/scripts/bringup_guestfs.sh b/scripts/bringup_guestfs.sh
> > > index 74eecea..f49fd12 100755
> > > --- a/scripts/bringup_guestfs.sh
> > > +++ b/scripts/bringup_guestfs.sh
> > > @@ -34,7 +34,7 @@ build_custom_source()
> > >  	SOURCE_TMP=$(mktemp)
> > >  	cat <<_EOT >$SOURCE_TMP
> > >  [local]
> > > -uri=file:///${CUSTOM_INDEX}
> > > +uri=file:///${REAL_CUSTOM_INDEX}
> > >  proxy=off
> > >  _EOT
> > >  	sudo mv $SOURCE_TMP $CUSTOM_SOURCE
> > > @@ -111,6 +111,7 @@ build_custom_image()
> > >  	CUSTOM_IMAGE_OK="${CUSTOM_IMAGE_DIR}.ok"
> > >  	CUSTOM_SOURCE="/etc/virt-builder/repos.d/kdevops-custom-images-${OS_VERSION}.conf"
> > >  	CUSTOM_INDEX="${CUSTOM_IMAGE_DIR}/index"
> > > +	REAL_CUSTOM_INDEX="$(realpath $CUSTOM_INDEX)"
> > 
> > Can we override the CUSTOM_INDEX variable here with realpath output?
> > I think we don't need both and we can simply avoid using the new var
> > added.
> This is a very good question. Did not have time to test.
I looked at the script a bit closer, and I think it is ok to do so. I'll
add this to my V2

Best
diff mbox series

Patch

diff --git a/scripts/bringup_guestfs.sh b/scripts/bringup_guestfs.sh
index 74eecea..f49fd12 100755
--- a/scripts/bringup_guestfs.sh
+++ b/scripts/bringup_guestfs.sh
@@ -34,7 +34,7 @@  build_custom_source()
 	SOURCE_TMP=$(mktemp)
 	cat <<_EOT >$SOURCE_TMP
 [local]
-uri=file:///${CUSTOM_INDEX}
+uri=file:///${REAL_CUSTOM_INDEX}
 proxy=off
 _EOT
 	sudo mv $SOURCE_TMP $CUSTOM_SOURCE
@@ -111,6 +111,7 @@  build_custom_image()
 	CUSTOM_IMAGE_OK="${CUSTOM_IMAGE_DIR}.ok"
 	CUSTOM_SOURCE="/etc/virt-builder/repos.d/kdevops-custom-images-${OS_VERSION}.conf"
 	CUSTOM_INDEX="${CUSTOM_IMAGE_DIR}/index"
+	REAL_CUSTOM_INDEX="$(realpath $CUSTOM_INDEX)"
 
 	mkdir -p ${CUSTOM_IMAGE_DIR}