Skip to contentSkip to conversation

relocate-sdk: Allow relocating to any location

PATCH In review Gleb Mazovetskiy 3 participants 6 messages Mar 28, 2020 – Jan 6, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 relocate-sdk: Allow relocating to any location

Previously, the script could only relocate to the current location.

This caused issues for SDK maintainers, as the default target location (e.g. /opt/my-sdk) would need to be created and the content copied to it during the build process, which is error-prone.

With this change you can now pass a target location argument to ./relocate-sdk.sh (this does not move the directory).

---
 support/misc/relocate-sdk.sh | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)
support/misc/relocate-sdk.sh +12 -7
index caabeaa6f6..981d272425 100755
@@ -1,15 +1,20 @@
 #!/bin/sh
-#
-if [ "$#" -ne 0 ]; then
-    echo "Run this script to relocate the buildroot SDK at that location"
+
+if [ "$#" -gt 1 ]; then
+    echo "Usage: $0 [path]"
+    echo "Run this script to relocate the buildroot SDK to the current location"
+    echo "If [path] is given, sets the location to [path] (without moving it)"
     exit 1
 fi
 
-LOCFILE="share/buildroot/sdk-location"
-FILEPATH="$(readlink -f "$0")"
-NEWPATH="$(dirname "${FILEPATH}")"
+cd "$(dirname "$(readlink -f "$0")")"
+if [ "$#" -eq 1 ]; then
+    NEWPATH="$1"
+else
+    NEWPATH="${PWD}"
+fi
 
-cd "${NEWPATH}"
+LOCFILE="share/buildroot/sdk-location"
 if [ ! -r "${LOCFILE}" ]; then
     echo "Previous location of the buildroot SDK not found!"
     exit 1
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/1 relocate-sdk: Allow relocating to any location

Gleb, All,

On 2020-03-28 23:49 +0000, Gleb Mazovetskiy spake thusly:

Quoted 1 line

Previously, the script could only relocate to the current location.

I am not sure to understand what you mean...

The SDK can already be relocated to any location:

    $ cd /path/to/anywhere
    $ tar xf /path/to/sdk.tar
    $ ./relocate-sdk
Quoted 6 lines

This caused issues for SDK maintainers, as the default target location (e.g. /opt/my-sdk) would need to be created and the content copied to it during the build process, which is error-prone.

With this change you can now pass a target location argument to ./relocate-sdk.sh (this does not move the directory).

I fail to see the purpose for that... If the SDK is not there, what is the point of relocating to a location where the SDK is not?

Eventually, the user will have to either extract the SDK in the proper location, or move it there, so whether they are able to run the script prior to the move does not seem very interesting...

So, I am far from convinced by this change... :-(

Additionally, last time I had to touch on the SDK topic, I got seriously burnt, so I'd like that people that have a better grasp, the history, and some beliefs, in the SDK, look at that patch, please...

Regards,
Yann E. MORIN.

Quoted 43 lines
---
 support/misc/relocate-sdk.sh | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)
support/misc/relocate-sdk.sh +12 -7
index caabeaa6f6..981d272425 100755
@@ -1,15 +1,20 @@
 #!/bin/sh
-#
-if [ "$#" -ne 0 ]; then
-    echo "Run this script to relocate the buildroot SDK at that location"
+
+if [ "$#" -gt 1 ]; then
+    echo "Usage: $0 [path]"
+    echo "Run this script to relocate the buildroot SDK to the current location"
+    echo "If [path] is given, sets the location to [path] (without moving it)"
     exit 1
 fi
 
-LOCFILE="share/buildroot/sdk-location"
-FILEPATH="$(readlink -f "$0")"
-NEWPATH="$(dirname "${FILEPATH}")"
+cd "$(dirname "$(readlink -f "$0")")"
+if [ "$#" -eq 1 ]; then
+    NEWPATH="$1"
+else
+    NEWPATH="${PWD}"
+fi
 
-cd "${NEWPATH}"
+LOCFILE="share/buildroot/sdk-location"
 if [ ! -r "${LOCFILE}" ]; then
     echo "Previous location of the buildroot SDK not found!"
     exit 1
Signature · 6 lines
2.20.1

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  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.  |
'------------------------------^-------^------------------^--------------------'
#2 lore raw

PATCH 1/1 relocate-sdk: Allow relocating to any location

This fixes a minor frustrating issue. It addresses the following scenario:

1. I'm the SDK maintainer. I tell users to unpack to a specific directory. E.g. /opt/mysdk.
2. I build the SDK in such a way that the users do not need to run relocate-sdk.sh if they unpack to /opt/mysdk.

The problem is with step 2: currently it requires the build process to move the SDK to /opt/mysdk, then run relocate-sdk.sh, before producing the final tarball.
This is often problematic because on the SDK maintainer's machine, /opt/mysdk usually already exists and contains the latest stable release.

With this new argument, the build process can be simplified for the SDK maintainer.

Quoted 95 lines · Yann E. MORIN

Gleb, All,

On 2020-03-28 23:49 +0000, Gleb Mazovetskiy spake thusly:

Quoted 1 line

Previously, the script could only relocate to the current location.

I am not sure to understand what you mean...

The SDK can already be relocated to any location:

    $ cd /path/to/anywhere
    $ tar xf /path/to/sdk.tar
    $ ./relocate-sdk
Quoted 6 lines

This caused issues for SDK maintainers, as the default target location (e.g. /opt/my-sdk) would need to be created and the content copied to it during the build process, which is error-prone.

With this change you can now pass a target location argument to ./relocate-sdk.sh (this does not move the directory).

I fail to see the purpose for that... If the SDK is not there, what is the point of relocating to a location where the SDK is not?

Eventually, the user will have to either extract the SDK in the proper location, or move it there, so whether they are able to run the script prior to the move does not seem very interesting...

So, I am far from convinced by this change... :-(

Additionally, last time I had to touch on the SDK topic, I got seriously burnt, so I'd like that people that have a better grasp, the history, and some beliefs, in the SDK, look at that patch, please...

Regards,
Yann E. MORIN.

support/misc/relocate-sdk.sh line 4

Quoted 13 lines
---
 support/misc/relocate-sdk.sh | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)
support/misc/relocate-sdk.sh +0 -3
index caabeaa6f6..981d272425 100755
@@ -1,15 +1,20 @@
 #!/bin/sh
-#
-if [ "$#" -ne 0 ]; then
-    echo "Run this script to relocate the buildroot SDK at that

location"

support/misc/relocate-sdk.sh

Quoted 4 lines
support/misc/relocate-sdk.sh +4 -0
+
+if [ "$#" -gt 1 ]; then
+    echo "Usage: $0 [path]"
+    echo "Run this script to relocate the buildroot SDK to the current

location"

support/misc/relocate-sdk.sh line 6

Quoted 1 line
support/misc/relocate-sdk.sh +1 -0
+    echo "If [path] is given, sets the location to [path] (without

moving it)"

Quoted 21 lines
support/misc/relocate-sdk.sh +7 -5
     exit 1
 fi
 
-LOCFILE="share/buildroot/sdk-location"
-FILEPATH="$(readlink -f "$0")"
-NEWPATH="$(dirname "${FILEPATH}")"
+cd "$(dirname "$(readlink -f "$0")")"
+if [ "$#" -eq 1 ]; then
+    NEWPATH="$1"
+else
+    NEWPATH="${PWD}"
+fi
 
-cd "${NEWPATH}"
+LOCFILE="share/buildroot/sdk-location"
 if [ ! -r "${LOCFILE}" ]; then
     echo "Previous location of the buildroot SDK not found!"
     exit 1
--

2.20.1

Quoted 4 lines

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

--

.-----------------.--------------------.------------------.--------------------.

|  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.  |
Quoted 2 lines

'------------------------------^-------^------------------^--------------------'

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20210717/ecb3eb19/attachment-0001.html>

#3 lore raw

PATCH 1/1 relocate-sdk: Allow relocating to any location

Gleb, All,

Thanks for the feedback.

On 2021-07-17 11:08 +0100, Gleb Mazovetskiy spake thusly:

Quoted 8 lines

This fixes a minor frustrating issue. It addresses the following scenario:
1. I'm the SDK maintainer. I tell users to unpack to a specific directory. E.g. /opt/mysdk.
2. I build the SDK in such a way that the users do not need to run relocate-sdk.sh if they unpack to /opt/mysdk. The problem is with step 2: currently it requires the build process to move the SDK to /opt/mysdk, then run relocate-sdk.sh, before producing the final tarball.
This is often problematic because on the SDK maintainer's machine, /opt/mysdk usually already exists and contains the latest stable release.
With this new argument, the build process can be simplified for the SDK maintainer.

The problem with that, is that users are not free to have the SDK where they want.

That would prevents them from having multiple versions of the SDK installed at once (e.g. when they have to work on a maintenance branch to fix bugs in an older releae for example), without removing an SDK before they install a new one.

And as a consequence, that also prevents the person responsible for the SDK, to work on older SDK to pinpoint issues without removing the "latest" SDK first...

I don't think this is a good way to use the SDK... I think the relocation step should really be run by the person extracting and using the SDK, on their machine.

I'm still leaving this patch pending, because I still feel the burn from last time, so if another maintainer is interested in this, they will have to apply it (and expand the commit log to carry the explanations you provided in this reply, thanks!).

Regards,
Yann E. MORIN.

Quoted 96 lines · Yann E. MORIN

Gleb, All,

On 2020-03-28 23:49 +0000, Gleb Mazovetskiy spake thusly:

Quoted 1 line

Previously, the script could only relocate to the current location.

I am not sure to understand what you mean...

The SDK can already be relocated to any location:

? ? $ cd /path/to/anywhere
? ? $ tar xf /path/to/sdk.tar
? ? $ ./relocate-sdk

Quoted 6 lines

This caused issues for SDK maintainers, as the default target location (e.g. /opt/my-sdk) would need to be created and the content copied to it during the build process, which is error-prone.

With this change you can now pass a target location argument to ./relocate-sdk.sh (this does not move the directory).

I fail to see the purpose for that... If the SDK is not there, what is the point of relocating to a location where the SDK is not?

Eventually, the user will have to either extract the SDK in the proper location, or move it there, so whether they are able to run the script prior to the move does not seem very interesting...

So, I am far from convinced by this change... :-(

Additionally, last time I had to touch on the SDK topic, I got seriously burnt, so I'd like that people that have a better grasp, the history, and some beliefs, in the SDK, look at that patch, please...

Regards,
Yann E. MORIN.

Quoted 39 lines

---
? support/misc/relocate-sdk.sh | 19 ++++++++++++------- ? 1 file changed, 12 insertions(+), 7 deletions(-)

support/misc/relocate-sdk.sh +0 -0
index caabeaa6f6..981d272425 100755
@@ -1,15 +1,20 @@

? #!/bin/sh

support/misc/relocate-sdk.sh +5 -3
-#
-if [ "$#" -ne 0 ]; then
-? ? echo "Run this script to relocate the buildroot SDK at that location"
+
+if [ "$#" -gt 1 ]; then
+? ? echo "Usage: $0 [path]"
+? ? echo "Run this script to relocate the buildroot SDK to the current location"
+? ? echo "If [path] is given, sets the location to [path] (without moving it)"

? ? ? exit 1
? fi
?

support/misc/relocate-sdk.sh +6 -3
-LOCFILE="share/buildroot/sdk-location"
-FILEPATH="$(readlink -f "$0")"
-NEWPATH="$(dirname "${FILEPATH}")"
+cd "$(dirname "$(readlink -f "$0")")"
+if [ "$#" -eq 1 ]; then
+? ? NEWPATH="$1"
+else
+? ? NEWPATH="${PWD}"
+fi

?

support/misc/relocate-sdk.sh +1 -1
-cd "${NEWPATH}"
+LOCFILE="share/buildroot/sdk-location"

? if [ ! -r "${LOCFILE}" ]; then
? ? ? echo "Previous location of the buildroot SDK not found!" ? ? ? exit 1
--
2.20.1

Quoted 4 lines

_______________________________________________
buildroot mailing list
[2]buildroot at busybox.net [3]http://lists.busybox.net/mailman/listinfo/buildroot

--
.-----------------.--------------------.------------------.--------------------.

  |? 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? |
  | [4]http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL? ? |? ?v? ?conspiracy.? |

'------------------------------^-------^------------------^--------------------'

Links:
1. mailto:yann.morin.1998 at free.fr
2. mailto:buildroot at busybox.net
3. http://lists.busybox.net/mailman/listinfo/buildroot
4. http://ymorin.is-a-geek.org/

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  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.  |
'------------------------------^-------^------------------^--------------------'
#4 lore raw

PATCH 1/1 relocate-sdk: Allow relocating to any location

Quoted 1 line

The problem with that, is that users are not free to have the SDK where

they want.

The users are still free to have the SDK wherever they want! They just need to run relocate-sdk.sh if using the non-default location, exactly as before.

This approach also does not leak the SDK maintainer's build directory path. It's basically just a sensible default, instead of no default.

Quoted 1 line

I don't think this is a good way to use the SDK... I think the relocation

step should really be run by the person extracting and using the SDK, on their machine.

The vast majority of our users install a single version into the default location. Many of them are beginners.

Quoted 1 line

I'm still leaving this patch pending, because I still feel the burn from

last time [...]

I don't know the history behind this but thanks for having a look at these, and I hope the other SDK maintainers will chip in here.

Quoted 167 lines · Yann E. MORIN

Gleb, All,

Thanks for the feedback.

On 2021-07-17 11:08 +0100, Gleb Mazovetskiy spake thusly:

Quoted 1 line

This fixes a minor frustrating issue. It addresses the following

scenario:

Quoted 1 line

1. I'm the SDK maintainer. I tell users to unpack to a specific

directory. E.g. /opt/mysdk.

Quoted 1 line

2. I build the SDK in such a way that the users do not need to run

relocate-sdk.sh if they unpack to /opt/mysdk.

Quoted 1 line

The problem is with step 2: currently it requires the build process to

move the SDK to /opt/mysdk, then run relocate-sdk.sh, before

Quoted 2 lines

producing the final tarball.
This is often problematic because on the SDK maintainer's machine,

/opt/mysdk usually already exists and contains the latest

Quoted 2 lines

stable release.
With this new argument, the build process can be simplified for the SDK

maintainer.

The problem with that, is that users are not free to have the SDK where they want.

That would prevents them from having multiple versions of the SDK installed at once (e.g. when they have to work on a maintenance branch to fix bugs in an older releae for example), without removing an SDK before they install a new one.

And as a consequence, that also prevents the person responsible for the SDK, to work on older SDK to pinpoint issues without removing the "latest" SDK first...

I don't think this is a good way to use the SDK... I think the relocation step should really be run by the person extracting and using the SDK, on their machine.

I'm still leaving this patch pending, because I still feel the burn from last time, so if another maintainer is interested in this, they will have to apply it (and expand the commit log to carry the explanations you provided in this reply, thanks!).

Regards,
Yann E. MORIN.

Quoted 1 line

On Sat, Jul 17, 2021 at 10:39 AM Yann E. MORIN < [1]

Quoted 6 lines · yann.morin.1998 at free.fr> wrote:

Gleb, All,

On 2020-03-28 23:49 +0000, Gleb Mazovetskiy spake thusly:

Quoted 1 line

Previously, the script could only relocate to the current location.

Quoted 9 lines

I am not sure to understand what you mean...

The SDK can already be relocated to any location:

      $ cd /path/to/anywhere
      $ tar xf /path/to/sdk.tar
      $ ./relocate-sdk
Quoted 1 line

This caused issues for SDK maintainers, as the default target

location

Quoted 9 lines
Quoted 5 lines

(e.g. /opt/my-sdk) would need to be created and the content copied to it during the build process, which is error-prone.

With this change you can now pass a target location argument to ./relocate-sdk.sh (this does not move the directory).

I fail to see the purpose for that... If the SDK is not there, what is the point of relocating to a location where the SDK is not?

Quoted 7 lines

Eventually, the user will have to either extract the SDK in the proper location, or move it there, so whether they are able to run the script prior to the move does not seem very interesting...

So, I am far from convinced by this change... :-(

Additionally, last time I had to touch on the SDK topic, I got

seriously

Quoted 1 line

burnt, so I'd like that people that have a better grasp, the history,

and

Quoted 10 lines

some beliefs, in the SDK, look at that patch, please...

Regards,
Yann E. MORIN.

Review

Quoted 5 lines
---
 support/misc/relocate-sdk.sh | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)
(quoted diff) +0 -0

b/support/misc/relocate-sdk.sh

Quoted 8 lines

support/misc/relocate-sdk.sh line 4

Quoted 8 lines

index caabeaa6f6..981d272425 100755

support/misc/relocate-sdk.sh +0 -3
@@ -1,15 +1,20 @@
 #!/bin/sh
-#
-if [ "$#" -ne 0 ]; then
-    echo "Run this script to relocate the buildroot SDK at that

location"

Quoted 4 lines

support/misc/relocate-sdk.sh

Quoted 4 lines
support/misc/relocate-sdk.sh +4 -0
+
+if [ "$#" -gt 1 ]; then
+    echo "Usage: $0 [path]"
+    echo "Run this script to relocate the buildroot SDK to the

current location"

Quoted 1 line

support/misc/relocate-sdk.sh line 6

Quoted 1 line
support/misc/relocate-sdk.sh +1 -0
+    echo "If [path] is given, sets the location to [path] (without

moving it)"

Quoted 21 lines
Quoted 21 lines
support/misc/relocate-sdk.sh +7 -5
     exit 1
 fi
 
-LOCFILE="share/buildroot/sdk-location"
-FILEPATH="$(readlink -f "$0")"
-NEWPATH="$(dirname "${FILEPATH}")"
+cd "$(dirname "$(readlink -f "$0")")"
+if [ "$#" -eq 1 ]; then
+    NEWPATH="$1"
+else
+    NEWPATH="${PWD}"
+fi
 
-cd "${NEWPATH}"
+LOCFILE="share/buildroot/sdk-location"
 if [ ! -r "${LOCFILE}" ]; then
     echo "Previous location of the buildroot SDK not found!"
     exit 1
--

2.20.1

Quoted 7 lines
Quoted 4 lines

_______________________________________________
buildroot mailing list
[2]buildroot at busybox.net [3]http://lists.busybox.net/mailman/listinfo/buildroot

--

.-----------------.--------------------.------------------.--------------------.

Quoted 1 line

| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics'

conspiracy: |

Quoted 4 lines

| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___

     |

| +33 561 099 427 `------------.-------: X AGAINST | \e/

There is no |

Quoted 1 line

| [4]http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v

conspiracy. |

Quoted 1 line

'------------------------------^-------^------------------^--------------------'

Quoted 6 lines

Links:
1. mailto:yann.morin.1998 at free.fr
2. mailto:buildroot at busybox.net
3. http://lists.busybox.net/mailman/listinfo/buildroot
4. http://ymorin.is-a-geek.org/

--

.-----------------.--------------------.------------------.--------------------.

|  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.  |
Quoted 2 lines

'------------------------------^-------^------------------^--------------------'

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20210717/b9820fcc/attachment-0001.html>

#5 lore raw
In reply to Gleb Mazovetskiy
Quoted 8 lines · Gleb Mazovetskiy

Previously, the script could only relocate to the current location.

This caused issues for SDK maintainers, as the default target location (e.g. /opt/my-sdk) would need to be created and the content copied to it during the build process, which is error-prone.

With this change you can now pass a target location argument to ./relocate-sdk.sh (this does not move the directory).

Even though, as Yann indicated, the use case is a bit iffy, the patch is
simple enough. So I applied to master, thanks.

Your Signed-off-by was missing, so I added that.

Regards,
Arnout

Quoted 27 lines
---
  support/misc/relocate-sdk.sh | 19 ++++++++++++-------
  1 file changed, 12 insertions(+), 7 deletions(-)
support/misc/relocate-sdk.sh +7 -6
index caabeaa6f6..981d272425 100755
@@ -1,15 +1,20 @@
  #!/bin/sh
-#
-if [ "$#" -ne 0 ]; then
-    echo "Run this script to relocate the buildroot SDK at that location"
+
+if [ "$#" -gt 1 ]; then
+    echo "Usage: $0 [path]"
+    echo "Run this script to relocate the buildroot SDK to the current location"
+    echo "If [path] is given, sets the location to [path] (without moving it)"
      exit 1
  fi
 
-LOCFILE="share/buildroot/sdk-location"
-FILEPATH="$(readlink -f "$0")"
-NEWPATH="$(dirname "${FILEPATH}")"
+cd "$(dirname "$(readlink -f "$0")")"
+if [ "$#" -eq 1 ]; then

support/misc/relocate-sdk.sh line 20

Quoted 10 lines
support/misc/relocate-sdk.sh +5 -1
+    NEWPATH="$1"
+else
+    NEWPATH="${PWD}"
+fi
 
-cd "${NEWPATH}"
+LOCFILE="share/buildroot/sdk-location"
  if [ ! -r "${LOCFILE}" ]; then
      echo "Previous location of the buildroot SDK not found!"
      exit 1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot