refactor code a bit to make release images easier

This just refactors a bit of code so that it will be easier
to generate release images in the future.
diff --git a/build-images.py b/build-images.py
index 1def1c0..a16da69 100755
--- a/build-images.py
+++ b/build-images.py
@@ -120,13 +120,28 @@
         os.makedirs(path)
     return path
 
+def get_snapshot_binaries(binaries, platform):
+    binaryf = {}
+    for binary in binaries:
+        url = 'http://snapshots.linaro.org/%s/%s' % (platform, binary)
+        (date, url) = crawler.latest_rfs(url)
+        binaryf[binary] = url
+
+    return binaryf
+
+def get_snapshot_hwpack(date, hwpack, platform):
+    ''' returns the url to the hwpack on snapshots.l.o if it exists'''
+    hwpackname = "%s-%s" % (hwpack, platform)
+    return hwpack_available(date, hwpack, platform)
+
 def main():
     day = today()
     hwpacks = HWPACKS.keys()
     binaries = BINARIES.keys()
 
     p = argparse.ArgumentParser(description=
-        'Builds a matrix of builds from the latest build on snapshots.linaro.org')
+        'Builds a matrix of builds from the latest build on '
+        'snapshots.linaro.org or release images on releases.linaro.org')
 
     p.add_argument('-o', dest='out_dir', default='./out',
                    help='The out directory for downloaded and built files, default=./')
@@ -142,6 +157,7 @@
                    help='The platform, default=oneiric')
 
     args = p.parse_args()
+
     if args.hwpacks:
         hwpacks = args.hwpacks
     if args.binaries:
@@ -149,18 +165,13 @@
 
     dm = fetch_image.DownloadManager(args.out_dir)
 
-    binaryf = {}
-    for binary in binaries:
-        url = 'http://snapshots.linaro.org/%s/%s' % (args.platform, binary)
-        (date, url) = crawler.latest_rfs(url)
-        binaryf[binary] = url
+    binaryf = get_snapshot_binaries(binaries, args.platform)
 
     lmc = '%s/linaro-image-tools/linaro-media-create' % args.out_dir
     odir_root = '%s/pre-built' % args.out_dir
 
     for hwpack in hwpacks:
-        hwpackname = "%s-%s" % (hwpack, args.platform)
-        url = hwpack_available(args.date, hwpack, args.platform)
+        url = get_snapshot_hwpack(args.date, hwpack, args.platform)
 
         if url is not None and url is not False:
             odir = get_image_dir(odir_root, url)