All of lore.kernel.org
 help / color / mirror / Atom feed
* Jacob Stiffler : ti-eula-unpack: Add support for general binary installers.
@ 2015-02-20 17:28 Arago Project git
  0 siblings, 0 replies; 2+ messages in thread
From: Arago Project git @ 2015-02-20 17:28 UTC (permalink / raw)
  To: meta-ti

Module: meta-ti
Branch: master
Commit: b06623fa2a2245f7914a120b99edf4152ec7aea5
URL:    http://arago-project.org/git/meta-ti.git?a=commit;h=b06623fa2a2245f7914a120b99edf4152ec7aea5

Author: Jacob Stiffler <j-stiffler@ti.com>
Date:   Thu Feb  5 21:28:28 2015 +0000

ti-eula-unpack: Add support for general binary installers.

* ti-unpack.inc has been created to allow support for general binary
  installers by creating a variable which is used to pass arbitrary
  arguments to the executable.
* ti-eula-unpack.inc sets the default arguments to retain support for
  recipes which still use this feature.

Signed-off-by: Jacob Stiffler <j-stiffler@ti.com>
Signed-off-by: Denys Dmytriyenko <denys@ti.com>

---

 recipes-ti/includes/ti-eula-unpack.inc |   67 +-------------------------
 recipes-ti/includes/ti-unpack.inc      |   83 ++++++++++++++++++++++++++++++++
 2 files changed, 85 insertions(+), 65 deletions(-)

diff --git a/recipes-ti/includes/ti-eula-unpack.inc b/recipes-ti/includes/ti-eula-unpack.inc
index aee88f1..912cd18 100644
--- a/recipes-ti/includes/ti-eula-unpack.inc
+++ b/recipes-ti/includes/ti-eula-unpack.inc
@@ -9,70 +9,7 @@
 #  TI_BIN_UNPK_WDEXT  - This variable extends workdir path, if user wants to put
 #                       the output in some internal directory
 
-python do_unpack () {
-    bb.build.exec_func('base_do_unpack', d)
-    bb.build.exec_func('ti_bin_do_unpack', d)
-}
+require ../includes/ti-unpack.inc
 
-TI_BIN_UNPK_WDEXT ?= ""
-python ti_bin_do_unpack() {
-
-    import os
-
-    # InstallJammer requires 32bit version of glibc
-    lib32path = '/lib'
-    if os.path.exists('/lib64') and (os.path.islink('/lib64') or os.path.islink('/lib') or os.path.exists('/lib32')):
-        lib32path = '/lib32'
-    if not os.path.exists('%s/libc.so.6' % lib32path):
-        bb.warn("TI installer requires 32bit glibc libraries for proper operation\nrun 'yum install glibc.i686' on Fedora or 'apt-get install ia32-libs' on Ubuntu/Debian")
-
-    localdata = bb.data.createCopy(d)
-    bb.data.update_data(localdata)
-
-    binfile  = bb.data.getVar('BINFILE', localdata)
-    binfile  = bb.data.expand(binfile, localdata)
-
-    # Change to the working directory
-    save_cwd = os.getcwd()
-    workdir  = bb.data.getVar('WORKDIR', localdata)
-    workdir  = bb.data.expand(workdir, localdata)
-    os.chdir(workdir)
-
-    # Get unpack commands
-    cmd_string = bb.data.getVar('TI_BIN_UNPK_CMDS', localdata)
-    cmd_list = cmd_string.split( ":" )
-
-    # Make the InstallJammer binary executable so we can run it
-    os.chmod(binfile, 0755)
-
-    # Run the InstallJammer binary and accept the EULA
-    filename = "HOME=%s ./%s --mode console" % (workdir, binfile)
-    
-    # Test executable by printing installer version or help screen (--version currently broken for some installers) 
-    # - this is currently broken in some IJ installers - comment out for now
-    #if os.system(filename + " --version") != 0:
-    #   print "ERROR: ti-eula-unpack: failed to execute binary installer"
-    #   raise bb.build.FuncFailed()
- 
-    f = os.popen(filename,'w')
-    for cmd in cmd_list:
-        if cmd == "workdir":
-            wdext = bb.data.getVar('TI_BIN_UNPK_WDEXT', localdata)
-            wdext = bb.data.expand(wdext, localdata)
-            cmd = workdir+wdext
-        f.write(cmd+'\n');
-    f.close()
-
-    # Expand the tarball that was created if required
-    tarfile  = bb.data.getVar('TARFILE', localdata)    
-    if bool(tarfile) == True:
-        tarfile  = bb.data.expand(tarfile, localdata)
-        tcmd = 'tar x --no-same-owner -f %s -C %s' % (tarfile, workdir)
-        if os.system(tcmd) != 0:
-            print "ERROR: ti-eula-unpack: failed to extract tarfile"
-            raise bb.build.FuncFailed()
-
-    # Return to the previous directory
-    os.chdir(save_cwd)
-}
+TI_BIN_UNPK_ARGS = "--mode console"
 
diff --git a/recipes-ti/includes/ti-unpack.inc b/recipes-ti/includes/ti-unpack.inc
new file mode 100644
index 0000000..c19c78c
--- /dev/null
+++ b/recipes-ti/includes/ti-unpack.inc
@@ -0,0 +1,83 @@
+# This file defines function used for unpacking the .bin file downloaded over
+# the http.
+#  BINFILE - name of the install jammer .bin file
+#  TARFILE - name of the tar file inside the install jammer
+#  TI_BIN_UNPK_ARGS   - contains the arguments to be passed to the bin file.
+#  TI_BIN_UNPK_CMDS   - contains list of commands separated with colon to be 
+#                       passed while unpacking the bin file. The keyword 
+#                       workdir expands to WORKDIR and commands are appendded
+#                       with '\n'. Eg. TI_BIN_UNPK_CMDS="Y:Y: qY:workdir"
+#  TI_BIN_UNPK_WDEXT  - This variable extends workdir path, if user wants to put
+#                       the output in some internal directory
+
+python do_unpack () {
+    bb.build.exec_func('base_do_unpack', d)
+    bb.build.exec_func('ti_bin_do_unpack', d)
+}
+
+TI_BIN_UNPK_WDEXT ?= ""
+python ti_bin_do_unpack() {
+
+    import os
+
+    # InstallJammer requires 32bit version of glibc
+    lib32path = '/lib'
+    if os.path.exists('/lib64') and (os.path.islink('/lib64') or os.path.islink('/lib') or os.path.exists('/lib32')):
+        lib32path = '/lib32'
+    if not os.path.exists('%s/libc.so.6' % lib32path):
+        bb.warn("TI installer requires 32bit glibc libraries for proper operation\nrun 'yum install glibc.i686' on Fedora or 'apt-get install ia32-libs' on Ubuntu/Debian")
+
+    localdata = bb.data.createCopy(d)
+    bb.data.update_data(localdata)
+
+    binfile  = bb.data.getVar('BINFILE', localdata)
+    binfile  = bb.data.expand(binfile, localdata)
+
+    # Change to the working directory
+    save_cwd = os.getcwd()
+    workdir  = bb.data.getVar('WORKDIR', localdata)
+    workdir  = bb.data.expand(workdir, localdata)
+    os.chdir(workdir)
+
+    # Get unpack args
+    arg_string = bb.data.getVar('TI_BIN_UNPK_ARGS', localdata)
+    arg_string = bb.data.expand(arg_string, localdata)
+
+    # Get unpack commands
+    cmd_string = bb.data.getVar('TI_BIN_UNPK_CMDS', localdata)
+    cmd_list = cmd_string.split( ":" )
+
+    # Make the InstallJammer binary executable so we can run it
+    os.chmod(binfile, 0755)
+
+    # Run the InstallJammer binary and accept the EULA
+    filename = "HOME=%s ./%s %s" % (workdir, binfile, arg_string)
+    
+    # Test executable by printing installer version or help screen (--version currently broken for some installers) 
+    # - this is currently broken in some IJ installers - comment out for now
+    #if os.system(filename + " --version") != 0:
+    #   print "ERROR: ti-eula-unpack: failed to execute binary installer"
+    #   raise bb.build.FuncFailed()
+ 
+    f = os.popen(filename,'w')
+    for cmd in cmd_list:
+        if cmd == "workdir":
+            wdext = bb.data.getVar('TI_BIN_UNPK_WDEXT', localdata)
+            wdext = bb.data.expand(wdext, localdata)
+            cmd = workdir+wdext
+        f.write(cmd+'\n');
+    f.close()
+
+    # Expand the tarball that was created if required
+    tarfile  = bb.data.getVar('TARFILE', localdata)    
+    if bool(tarfile) == True:
+        tarfile  = bb.data.expand(tarfile, localdata)
+        tcmd = 'tar x --no-same-owner -f %s -C %s' % (tarfile, workdir)
+        if os.system(tcmd) != 0:
+            print "ERROR: ti-eula-unpack: failed to extract tarfile"
+            raise bb.build.FuncFailed()
+
+    # Return to the previous directory
+    os.chdir(save_cwd)
+}
+



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

* Jacob Stiffler : ti-eula-unpack: Add support for general binary installers.
@ 2015-02-20 17:29 Arago Project git
  0 siblings, 0 replies; 2+ messages in thread
From: Arago Project git @ 2015-02-20 17:29 UTC (permalink / raw)
  To: meta-ti

Module: meta-ti
Branch: daisy
Commit: d992571ccd35b08357104dada6e1a09375fe11e9
URL:    http://arago-project.org/git/meta-ti.git?a=commit;h=d992571ccd35b08357104dada6e1a09375fe11e9

Author: Jacob Stiffler <j-stiffler@ti.com>
Date:   Thu Feb  5 21:28:28 2015 +0000

ti-eula-unpack: Add support for general binary installers.

* ti-unpack.inc has been created to allow support for general binary
  installers by creating a variable which is used to pass arbitrary
  arguments to the executable.
* ti-eula-unpack.inc sets the default arguments to retain support for
  recipes which still use this feature.

Signed-off-by: Jacob Stiffler <j-stiffler@ti.com>
Signed-off-by: Denys Dmytriyenko <denys@ti.com>

---

 recipes-ti/includes/ti-eula-unpack.inc |   67 +-------------------------
 recipes-ti/includes/ti-unpack.inc      |   83 ++++++++++++++++++++++++++++++++
 2 files changed, 85 insertions(+), 65 deletions(-)

diff --git a/recipes-ti/includes/ti-eula-unpack.inc b/recipes-ti/includes/ti-eula-unpack.inc
index aee88f1..912cd18 100644
--- a/recipes-ti/includes/ti-eula-unpack.inc
+++ b/recipes-ti/includes/ti-eula-unpack.inc
@@ -9,70 +9,7 @@
 #  TI_BIN_UNPK_WDEXT  - This variable extends workdir path, if user wants to put
 #                       the output in some internal directory
 
-python do_unpack () {
-    bb.build.exec_func('base_do_unpack', d)
-    bb.build.exec_func('ti_bin_do_unpack', d)
-}
+require ../includes/ti-unpack.inc
 
-TI_BIN_UNPK_WDEXT ?= ""
-python ti_bin_do_unpack() {
-
-    import os
-
-    # InstallJammer requires 32bit version of glibc
-    lib32path = '/lib'
-    if os.path.exists('/lib64') and (os.path.islink('/lib64') or os.path.islink('/lib') or os.path.exists('/lib32')):
-        lib32path = '/lib32'
-    if not os.path.exists('%s/libc.so.6' % lib32path):
-        bb.warn("TI installer requires 32bit glibc libraries for proper operation\nrun 'yum install glibc.i686' on Fedora or 'apt-get install ia32-libs' on Ubuntu/Debian")
-
-    localdata = bb.data.createCopy(d)
-    bb.data.update_data(localdata)
-
-    binfile  = bb.data.getVar('BINFILE', localdata)
-    binfile  = bb.data.expand(binfile, localdata)
-
-    # Change to the working directory
-    save_cwd = os.getcwd()
-    workdir  = bb.data.getVar('WORKDIR', localdata)
-    workdir  = bb.data.expand(workdir, localdata)
-    os.chdir(workdir)
-
-    # Get unpack commands
-    cmd_string = bb.data.getVar('TI_BIN_UNPK_CMDS', localdata)
-    cmd_list = cmd_string.split( ":" )
-
-    # Make the InstallJammer binary executable so we can run it
-    os.chmod(binfile, 0755)
-
-    # Run the InstallJammer binary and accept the EULA
-    filename = "HOME=%s ./%s --mode console" % (workdir, binfile)
-    
-    # Test executable by printing installer version or help screen (--version currently broken for some installers) 
-    # - this is currently broken in some IJ installers - comment out for now
-    #if os.system(filename + " --version") != 0:
-    #   print "ERROR: ti-eula-unpack: failed to execute binary installer"
-    #   raise bb.build.FuncFailed()
- 
-    f = os.popen(filename,'w')
-    for cmd in cmd_list:
-        if cmd == "workdir":
-            wdext = bb.data.getVar('TI_BIN_UNPK_WDEXT', localdata)
-            wdext = bb.data.expand(wdext, localdata)
-            cmd = workdir+wdext
-        f.write(cmd+'\n');
-    f.close()
-
-    # Expand the tarball that was created if required
-    tarfile  = bb.data.getVar('TARFILE', localdata)    
-    if bool(tarfile) == True:
-        tarfile  = bb.data.expand(tarfile, localdata)
-        tcmd = 'tar x --no-same-owner -f %s -C %s' % (tarfile, workdir)
-        if os.system(tcmd) != 0:
-            print "ERROR: ti-eula-unpack: failed to extract tarfile"
-            raise bb.build.FuncFailed()
-
-    # Return to the previous directory
-    os.chdir(save_cwd)
-}
+TI_BIN_UNPK_ARGS = "--mode console"
 
diff --git a/recipes-ti/includes/ti-unpack.inc b/recipes-ti/includes/ti-unpack.inc
new file mode 100644
index 0000000..c19c78c
--- /dev/null
+++ b/recipes-ti/includes/ti-unpack.inc
@@ -0,0 +1,83 @@
+# This file defines function used for unpacking the .bin file downloaded over
+# the http.
+#  BINFILE - name of the install jammer .bin file
+#  TARFILE - name of the tar file inside the install jammer
+#  TI_BIN_UNPK_ARGS   - contains the arguments to be passed to the bin file.
+#  TI_BIN_UNPK_CMDS   - contains list of commands separated with colon to be 
+#                       passed while unpacking the bin file. The keyword 
+#                       workdir expands to WORKDIR and commands are appendded
+#                       with '\n'. Eg. TI_BIN_UNPK_CMDS="Y:Y: qY:workdir"
+#  TI_BIN_UNPK_WDEXT  - This variable extends workdir path, if user wants to put
+#                       the output in some internal directory
+
+python do_unpack () {
+    bb.build.exec_func('base_do_unpack', d)
+    bb.build.exec_func('ti_bin_do_unpack', d)
+}
+
+TI_BIN_UNPK_WDEXT ?= ""
+python ti_bin_do_unpack() {
+
+    import os
+
+    # InstallJammer requires 32bit version of glibc
+    lib32path = '/lib'
+    if os.path.exists('/lib64') and (os.path.islink('/lib64') or os.path.islink('/lib') or os.path.exists('/lib32')):
+        lib32path = '/lib32'
+    if not os.path.exists('%s/libc.so.6' % lib32path):
+        bb.warn("TI installer requires 32bit glibc libraries for proper operation\nrun 'yum install glibc.i686' on Fedora or 'apt-get install ia32-libs' on Ubuntu/Debian")
+
+    localdata = bb.data.createCopy(d)
+    bb.data.update_data(localdata)
+
+    binfile  = bb.data.getVar('BINFILE', localdata)
+    binfile  = bb.data.expand(binfile, localdata)
+
+    # Change to the working directory
+    save_cwd = os.getcwd()
+    workdir  = bb.data.getVar('WORKDIR', localdata)
+    workdir  = bb.data.expand(workdir, localdata)
+    os.chdir(workdir)
+
+    # Get unpack args
+    arg_string = bb.data.getVar('TI_BIN_UNPK_ARGS', localdata)
+    arg_string = bb.data.expand(arg_string, localdata)
+
+    # Get unpack commands
+    cmd_string = bb.data.getVar('TI_BIN_UNPK_CMDS', localdata)
+    cmd_list = cmd_string.split( ":" )
+
+    # Make the InstallJammer binary executable so we can run it
+    os.chmod(binfile, 0755)
+
+    # Run the InstallJammer binary and accept the EULA
+    filename = "HOME=%s ./%s %s" % (workdir, binfile, arg_string)
+    
+    # Test executable by printing installer version or help screen (--version currently broken for some installers) 
+    # - this is currently broken in some IJ installers - comment out for now
+    #if os.system(filename + " --version") != 0:
+    #   print "ERROR: ti-eula-unpack: failed to execute binary installer"
+    #   raise bb.build.FuncFailed()
+ 
+    f = os.popen(filename,'w')
+    for cmd in cmd_list:
+        if cmd == "workdir":
+            wdext = bb.data.getVar('TI_BIN_UNPK_WDEXT', localdata)
+            wdext = bb.data.expand(wdext, localdata)
+            cmd = workdir+wdext
+        f.write(cmd+'\n');
+    f.close()
+
+    # Expand the tarball that was created if required
+    tarfile  = bb.data.getVar('TARFILE', localdata)    
+    if bool(tarfile) == True:
+        tarfile  = bb.data.expand(tarfile, localdata)
+        tcmd = 'tar x --no-same-owner -f %s -C %s' % (tarfile, workdir)
+        if os.system(tcmd) != 0:
+            print "ERROR: ti-eula-unpack: failed to extract tarfile"
+            raise bb.build.FuncFailed()
+
+    # Return to the previous directory
+    os.chdir(save_cwd)
+}
+



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

end of thread, other threads:[~2015-02-20 17:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-20 17:28 Jacob Stiffler : ti-eula-unpack: Add support for general binary installers Arago Project git
2015-02-20 17:29 Arago Project git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.