Skip to contentSkip to conversation

config-build-env: Switch to arago-project git

PATCH In review Nishanth Menon 2 participants 10 messages Jul 9, 2021 – Jul 13, 2021

lore
Share & tools
lore
#0 lore raw

cover config-build-env: Switch to arago-project git

Here are a series of patches that are meant to:
a) be more paranoid in checking the environment it runs in
b) additional cleanups in case of weird corner cases where build folder is left in weird state
c) Finally switch over to git.ti.com tree instead of arago-project.org tree for the new location of oe-layer-setup

Nishanth Menon (5):
config-build-env: Move the oe-layer-setup to a variable
config-build-env: Lets make sure we are really in a build folder
config-build-env: Refactor to cleanup messed up build folder
config-build-env: Make sure that the git url points correctly
config-build-env: Switch arago-project git repo to ti git repo

 lib/oesdk/config-build-env | 46 +++++++++++++++++++++++++++++---------
 1 file changed, 36 insertions(+), 10 deletions(-)
Signature · 1 line
2.32.0
#1 lore raw

PATCH 1/5 config-build-env: Move the oe-layer-setup to a variable

Lets first start preparing for cleanup by moving the git url to a variable.

---
 lib/oesdk/config-build-env | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
lib/oesdk/config-build-env +3 -1
index 8bbd0df28c63..11fab2de6097 100644
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+TI_SDK_OELAYER_SETUP="http://arago-project.org/git/projects/oe-layersetup.git"
+
 # This script is intended to be called only from the top-level build-oesdk.sh
 # script which parses the configuration file and sets necessary variables.
 # So check if it is being called from any other context and if so exit.
@@ -21,7 +23,7 @@ checkout_layer_scripts() {
 
     if [ ! -d $name ]
     then
-        git clone http://arago-project.org/git/projects/oe-layersetup.git $name
+        git clone "$TI_SDK_OELAYER_SETUP" $name
     elif [ -d $name/.git ]
     then
         #This looks to be a git repo.  Hopefully it is the right one :)
Signature · 1 line
2.32.0
#2 lore raw

PATCH 2/5 config-build-env: Lets make sure we are really in a build folder

In reply to Nishanth Menon

Lets make sure that we are really in a build folder if for some reason we end up at a top layer script issue and we mess up the build machine.

---
 lib/oesdk/config-build-env | 7 +++++++
 1 file changed, 7 insertions(+)
lib/oesdk/config-build-env +7 -0
index 11fab2de6097..058823562693 100644
@@ -21,6 +21,13 @@ checkout_layer_scripts() {
 
     name=`basename $BUILD_ROOT`
 
+    # Paranoid check: Am I really a build folder?
+    amibuild=`echo $BUILD_ROOT|grep "build$"`
+    if [ -z "$amibuild" ]; then
+        echo "Something horrible has happened.. BUILD_ROOT=$BUILD_ROOT does'nt end with 'build'. maynot be build folder. Aborting!"
+        exit 1
+    fi
+
     if [ ! -d $name ]
     then
         git clone "$TI_SDK_OELAYER_SETUP" $name
Signature · 1 line
2.32.0
#3 lore raw

PATCH 3/5 config-build-env: Refactor to cleanup messed up build folder

In reply to Nishanth Menon

In some weird, yet unknown cases, the build folder might be messed up. Lets make sure we clean that up first prior to cloning or updating the folder. This seems to happen when we force via jenkins to abort a running job, leaving the system in a weird state on the remote build machine. It is not clear what specifically is going on in the sequence, but lets add some diagnostics on if any errant processes are sticking around in the previous process (VM cleanup etc) that prevented a proper system cleanup.

---
 lib/oesdk/config-build-env | 27 ++++++++++++++++++---------
 1 file changed, 18 insertions(+), 9 deletions(-)
lib/oesdk/config-build-env +18 -9
index 058823562693..885fbcfb50d9 100644
@@ -15,7 +15,7 @@ fi
 # conditions apply:
 #   1. The checkout creates the final directory of BUILD_ROOT
 #   2. If a git repo already exists then do a git pull
-#   3. If the directory is not empty and is not a git repo then bail
+#   3. If the directory is not empty and is not a git repo, then cleanup if unused
 checkout_layer_scripts() {
     cd `dirname $BUILD_ROOT`
 
@@ -28,18 +28,27 @@ checkout_layer_scripts() {
         exit 1
     fi
 
-    if [ ! -d $name ]
-    then
+    # If the scripts folder exists and is not a git repo, cleanup.
+    if [ -e $name -a ! -d $name/.git ]; then
+        echo "The $BUILD_ROOT directory is present and is not a git repo - attempting to wipe it off"
+        users=`lsof "$BUILD_ROOT"|wc -l`
+        if [ $users -gt 0 ]; then
+           echo "ERROR:: We have users for $BUILD_ROOT folder: Aborting!!!"
+           lsof $BUILD_ROOT
+           pstree -aplG
+           exit 1
+        fi
+        rm -rvf "$BUILD_ROOT" || exit 1
+    fi
+
+
+    if [ ! -d $name ]; then
         git clone "$TI_SDK_OELAYER_SETUP" $name
-    elif [ -d $name/.git ]
-    then
-        #This looks to be a git repo.  Hopefully it is the right one :)
+    else
+        # This looks to be a git repo.  Hopefully it is the right one :)
         cd $BUILD_ROOT
         git fetch
         git reset --hard origin
-    else
-        echo "The $BUILD_ROOT directory is not empty and is not a git repo"
-        exit 1
     fi
 }
 
Signature · 1 line
2.32.0
#4 lore raw

PATCH 4/5 config-build-env: Make sure that the git url points correctly

In reply to Nishanth Menon

Make sure that the build scripts git url points to the correct location.

---
 lib/oesdk/config-build-env | 8 ++++++++
 1 file changed, 8 insertions(+)
lib/oesdk/config-build-env +8 -0
index 885fbcfb50d9..cdfa6830eb51 100644
@@ -47,6 +47,14 @@ checkout_layer_scripts() {
     else
         # This looks to be a git repo.  Hopefully it is the right one :)
         cd $BUILD_ROOT
+	# In case we have changed the location of our build scripts
+	# we should change our git url towards it.
+        mygit='git remote get-url  origin'
+        if [ "$mygit" != "$TI_SDK_OELAYER_SETUP"]; then
+            echo "$TI_SDK_OELAYER_SETUP Mismatch in git URL: $mygit vs $TI_SDK_OELAYER_SETUP. Force resetting the origin!"
+            git remote set-url origin $TI_SDK_OELAYER_SETUP
+        fi
+
         git fetch
         git reset --hard origin
     fi
Signature · 1 line
2.32.0
#5 lore raw

Re: [tisdk-build-scripts PATCH 4/5] config-build-env: Make sure that the git url points correctly

Quoted 12 lines · Nishanth Menon

Make sure that the build scripts git url points to the correct location.

---
 lib/oesdk/config-build-env | 8 ++++++++
 1 file changed, 8 insertions(+)
lib/oesdk/config-build-env +0 -0
index 885fbcfb50d9..cdfa6830eb51 100644

lib/oesdk/config-build-env checkout_layer_scripts() { · line 53

Quoted 7 lines
lib/oesdk/config-build-env +4 -0
@@ -47,6 +47,14 @@ checkout_layer_scripts() {
     else
         # This looks to be a git repo.  Hopefully it is the right one :)
         cd $BUILD_ROOT
+	# In case we have changed the location of our build scripts
+	# we should change our git url towards it.
+        mygit='git remote get-url  origin'
+        if [ "$mygit" != "$TI_SDK_OELAYER_SETUP"]; then

There needs to be a space between "$TI_SDK_OELAYER_SETUP" and ]

if there are no further comments, and you can fix it when applying, please do. Else, do comment so that I can send an updated version.

Quoted 10 lines
lib/oesdk/config-build-env +4 -0
+            echo "$TI_SDK_OELAYER_SETUP Mismatch in git URL: $mygit vs $TI_SDK_OELAYER_SETUP. Force resetting the origin!"
+            git remote set-url origin $TI_SDK_OELAYER_SETUP
+        fi
+
         git fetch
         git reset --hard origin
     fi
Signature · 1 line
2.32.0
Signature · 3 lines
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D)/Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 849D 1736 249D
#6 lore raw

PATCH 5/5 config-build-env: Switch arago-project git repo to ti git repo

In reply to Nishanth Menon

Arago-project is on the way down, so flip over to git.ti.com repo

---
 lib/oesdk/config-build-env | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/oesdk/config-build-env +1 -1
index cdfa6830eb51..2514acbe6b38 100644
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-TI_SDK_OELAYER_SETUP="http://arago-project.org/git/projects/oe-layersetup.git"
+TI_SDK_OELAYER_SETUP="http://git.ti.com/git/arago-project/oe-layersetup.git"
 
 # This script is intended to be called only from the top-level build-oesdk.sh
 # script which parses the configuration file and sets necessary variables.
Signature · 1 line
2.32.0
#7 lore raw

Re: [tisdk-build-scripts PATCH 5/5] config-build-env: Switch arago-project git repo to ti git repo

Quoted 12 lines · Nishanth Menon

Arago-project is on the way down, so flip over to git.ti.com repo

---
 lib/oesdk/config-build-env | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/oesdk/config-build-env +0 -0
index cdfa6830eb51..2514acbe6b38 100644

lib/oesdk/config-build-env line 3

Quoted 4 lines
lib/oesdk/config-build-env +1 -1
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-TI_SDK_OELAYER_SETUP="http://arago-project.org/git/projects/oe-layersetup.git"
+TI_SDK_OELAYER_SETUP="http://git.ti.com/git/arago-project/oe-layersetup.git"

What's the preferred clone method on git.ti.com? I see Web UI shows these:

Clone
https://git.ti.com/git/arago-project/oe-layersetup.git
https://git.ti.com/cgit/arago-project/oe-layersetup
git://git.ti.com/arago-project/oe-layersetup.git
http://git.ti.com/git/arago-project/oe-layersetup.git

Quoted 5 lines
lib/oesdk/config-build-env +0 -0
 # This script is intended to be called only from the top-level build-oesdk.sh
 # script which parses the configuration file and sets necessary variables.
Signature · 1 line
2.32.0
Signature · 4 lines
Regards,
Denys Dmytriyenko <[email protected]>
PGP: 0x420902729A92C964 - https://denix.org/0x420902729A92C964
Fingerprint: 25FC E4A5 8A72 2F69 1186  6D76 4209 0272 9A92 C964
#8 lore raw

Re: [tisdk-build-scripts PATCH 5/5] config-build-env: Switch arago-project git repo to ti git repo

Quoted 20 lines · Denys Dmytriyenko
Quoted 12 lines · Nishanth Menon

Arago-project is on the way down, so flip over to git.ti.com repo

---
 lib/oesdk/config-build-env | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/oesdk/config-build-env +0 -0
index cdfa6830eb51..2514acbe6b38 100644

lib/oesdk/config-build-env line 3

Quoted 4 lines
lib/oesdk/config-build-env +1 -1
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-TI_SDK_OELAYER_SETUP="http://arago-project.org/git/projects/oe-layersetup.git"
+TI_SDK_OELAYER_SETUP="http://git.ti.com/git/arago-project/oe-layersetup.git"

What's the preferred clone method on git.ti.com? I see Web UI shows these:

Quoted 5 lines

Clone
https://git.ti.com/git/arago-project/oe-layersetup.git
https://git.ti.com/cgit/arago-project/oe-layersetup
git://git.ti.com/arago-project/oe-layersetup.git
http://git.ti.com/git/arago-project/oe-layersetup.git

Have'nt heard of any specific preference.

Signature · 3 lines
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 849D 1736 249D
#9 lore raw
In reply to Nishanth Menon
Quoted 6 lines · Nishanth Menon

Here are a series of patches that are meant to:
a) be more paranoid in checking the environment it runs in
b) additional cleanups in case of weird corner cases where build folder is left in weird state
c) Finally switch over to git.ti.com tree instead of arago-project.org tree for the new location of oe-layer-setup

Overall, changes look sane to me. Thanks.

Quoted 13 lines

Nishanth Menon (5):
config-build-env: Move the oe-layer-setup to a variable
config-build-env: Lets make sure we are really in a build folder
config-build-env: Refactor to cleanup messed up build folder
config-build-env: Make sure that the git url points correctly
config-build-env: Switch arago-project git repo to ti git repo

 lib/oesdk/config-build-env | 46 +++++++++++++++++++++++++++++---------
 1 file changed, 36 insertions(+), 10 deletions(-)
Signature · 1 line
2.32.0
Signature · 4 lines
Regards,
Denys Dmytriyenko <[email protected]>
PGP: 0x420902729A92C964 - https://denix.org/0x420902729A92C964
Fingerprint: 25FC E4A5 8A72 2F69 1186  6D76 4209 0272 9A92 C964