All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Graydon, Tracy" <tracy.graydon@intel.com>
To: yocto@yoctoproject.org
Subject: [yocto-autobuilder][PATCH] bin/release_scripts/release.py: Add some basic logging
Date: Wed, 29 Jun 2016 16:08:42 -0700	[thread overview]
Message-ID: <1467241722-307-1-git-send-email-tracy.graydon@intel.com> (raw)

This patch adds some basic logging to help find failure point should the script
barf due to lost ssh session, etc. Without it, finding where to resume is not
particularly entertaining.

Signed-off-by: Graydon, Tracy <tracy.graydon@intel.com>
---
 bin/release_scripts/release.py | 43 +++++++++++++++++++++++++++++++++++++++---
 1 file changed, 40 insertions(+), 3 deletions(-)

diff --git a/bin/release_scripts/release.py b/bin/release_scripts/release.py
index 89f68be..b62b48c 100755
--- a/bin/release_scripts/release.py
+++ b/bin/release_scripts/release.py
@@ -10,6 +10,7 @@ __maintainer__ = "Tracy Graydon"
 __email__ = "tracy.graydon@intel.com"
 '''
 
+import logging
 import os
 import optparse
 import sys
@@ -82,6 +83,7 @@ def rejoin_thing(thing, marker):
 def fix_tarballs():
     print
     print "Repackaging poky and eclipse tarballs...."
+    logging.info('Repackaging poky and eclipse tarballs.')
     os.chdir(RELEASE_DIR)
     os.mkdir(TARBALL_DIR)
     os.system("mv %s/*.tar.bz2 %s" %(RELEASE_DIR, TARBALL_DIR))
@@ -90,6 +92,7 @@ def fix_tarballs():
     dirlist = get_list(TARBALL_DIR)
     for blob in dirlist:
         print "Original Tarball: %s" %blob
+        logging.info('Repackaging %s' %blob)
         chunks = split_thing(blob, ".")
         filename = chunks[0]
         basename = split_thing(filename, "-")
@@ -99,6 +102,7 @@ def fix_tarballs():
         chunks[0] = new_name
         new_blob = rejoin_thing(chunks, ".")
         print "New Tarball: %s" %new_blob
+        logging.info('New blob is %s' %new_blob)
         os.system("tar jxf %s" %blob)
         os.system("mv %s %s" %(filename, new_name))
         os.system("rm -rf %s/.git*" %new_name)
@@ -107,10 +111,13 @@ def fix_tarballs():
         rmtree(new_name)
         os.symlink(new_blob, blob)
         os.system("md5sum %s > %s.md5sum" %(new_blob, new_blob))
+        logging.info('Successful.')
         print
+    logging.info('Moving new blobs to release diri and cleaning up.')
     os.system("mv * %s" %RELEASE_DIR)
     os.chdir(RELEASE_DIR)
     os.rmdir(TARBALL_DIR)
+    logging.info('Successful.')
     print
     return
 
@@ -348,9 +355,18 @@ if __name__ == '__main__':
     os.system("clear")
     print
    
+    logfile = 'staging.log'
+    try:
+        os.remove(logfile)
+    except OSError:
+        pass    
+
+    logging.basicConfig(format='%(levelname)s:%(message)s',filename=logfile,level=logging.INFO)
+    
     VHOSTS = "/srv/www/vhosts"
     AB_BASE = os.path.join(VHOSTS, "autobuilder.yoctoproject.org/pub/releases")
     DL_DIR = os.path.join(VHOSTS, "downloads.yoctoproject.org/releases")
+    DL_BASE = os.path.join(DL_DIR, "/releases/yocto")
     ADT_BASE = os.path.join(VHOSTS, "adtrepo.yoctoproject.org")
 
     # List of the directories we delete from all releases
@@ -453,40 +469,59 @@ if __name__ == '__main__':
 
     # For all releases:
     # 1) Rsync the rc candidate to a staging dir where all work happens
+    logging.info('Start rsync.')
+    print "Doing the rsync for the staging directory."
     sync_it(RC_SOURCE, RELEASE_DIR, UNLOVED)
-    
+    logging.info('Successful.')   
+ 
     # 2) Convert the symlinks in build-appliance dir.
     print "Converting the build-appliance symlink."
+    logging.info('Converting build-appliance symlink.')
     convert_symlinks(BUILD_APP_DIR)
+    logging.info('Successful.')
 
     # 3) In machines dir, convert the symlinks, delete the cruft
     print "Cleaning up the machines dirs, converting symlinks."
+    logging.info('Machines dir cleanup started.')
     dirlist = get_list(MACHINES)
     for dirname in dirlist:
         dirname = os.path.join(MACHINES, dirname)
+        logging.info('Converting symlinks in %s' %dirname)
         convert_symlinks(dirname)
+        logging.info('Successful.')
+        logging.info('Nuking cruft in %s' %dirname)
         nuke_cruft(dirname, CRUFT_LIST)
+        logging.info('Successful.')
     print "Generating fresh md5sums."
+    logging.info('Generating fresh md5sums.')
     gen_md5sum(MACHINES)
+    logging.info('Successful.')
     
     # For major and point releases
     if REL_TYPE == "major" or REL_TYPE == "point":
         # 4) Fix up the eclipse and poky tarballs
         print "Cleaning up the eclipse, poky and other tarballs."
+        logging.info('Fixing tarballs.')
         fix_tarballs()
-
+        
         # 5) Publish the eclipse stuff
         print "Publishing the eclipse plugins."
+        logging.info('Publishing eclipse plugins.')
         pub_eclipse(ECLIPSE_DIR, PLUGIN_DIR)
+        logging.info('Successful.')
 
         # 6) Make the bsps
         print "Generating the BSP tarballs."
+        logging.info('Generating BSP tarballs.')
         make_bsps(BSP_LIST, BSP_DIR)
+        logging.info('Successful.')
 
         # 7) Generate the master md5sum file for the release (for all releases)
         print "Generating the master md5sum table."
+        logging.info('Generating the master md5sum table.')
         gen_rel_md5(RELEASE_DIR, REL_MD5_FILE)
-    
+        logging.info('Successful.')
+
     # 8) Publish the ADT repo. The default is NOT to publish the ADT. The ADT
     # is deprecated as of 2.1_M1. However, we need to retain backward
     # compatability for point releases, etc. We do this step after all the other
@@ -494,9 +529,11 @@ if __name__ == '__main__':
     # files deleted, and md5sums generated.
     #
     if options.pub_adt:
+        logging.info('Publishing the ADT repo.')
         if options.adt_dir:
             print "Publishing the ADT repo using custom dir %s" %options.adt_dir
             publish_adt(REL_ID, REL_TYPE, options.adt_dir)
         else:
             print "Publishing ADT repo."
             publish_adt(REL_ID, REL_TYPE, "")
+        logging.info('Successful.')
-- 
2.7.0



             reply	other threads:[~2016-06-29 23:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-29 23:08 Graydon, Tracy [this message]
2016-07-01 16:18 ` [yocto-autobuilder][PATCH] bin/release_scripts/release.py: Add some basic logging Joshua G Lock
  -- strict thread matches above, loose matches on Subject: below --
2016-06-29 22:58 Graydon, Tracy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1467241722-307-1-git-send-email-tracy.graydon@intel.com \
    --to=tracy.graydon@intel.com \
    --cc=yocto@yoctoproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.