Rewriting binary_includes in python.
authorDaniel Baumann <mail@daniel-baumann.ch>
Mon, 4 Nov 2013 17:33:48 +0000 (18:33 +0100)
committerDaniel Baumann <mail@daniel-baumann.ch>
Mon, 4 Nov 2013 17:33:48 +0000 (18:33 +0100)
components/binary-includes [copied from components/chroot-includes with 67% similarity]
scripts/build/binary
scripts/build/binary_includes [deleted file]

similarity index 67%
copy from components/chroot-includes
copy to components/binary-includes
index ebf9fb5..dfac8c7 100755 (executable)
@@ -21,15 +21,16 @@ import sys
 #   * logfile output
 #   * lockfile handling
 #   * use gettext for i18n
+#   * derefence or remove symlinks if binary filesystem does not support them
 
 def main():
        ## Parsing Arguments
        arguments = argparse.ArgumentParser(
-               prog            = 'lb chroot-includes',
+               prog            = 'lb binary-includes',
                usage           = '%(prog)s [arguments]',
                description     = '''live-build contains the components to build a live system from a configuration directory.
-                                    The chroot-includes command copies include files into the chroot stage.''',
-               epilog          = 'See \'man lb-chroot-includes\' for more information.',
+                                    The binary-includes command copies include files into the binary stage.''',
+               epilog          = 'See \'man lb-binary-includes\' for more information.',
                formatter_class = argparse.ArgumentDefaultsHelpFormatter
        )
 
@@ -41,12 +42,12 @@ def main():
        # --verbose
        verbose = args.verbose
 
-       ## Copying chroot includes
+       ## Copying binary includes
 
        # stagefile
-       if os.path.isfile('.build/chroot-includes'):
+       if os.path.isfile('.build/binary-includes'):
                if verbose:
-                       print('I: chroot-includes already done - nothing to do')
+                       print('I: binary-includes already done - nothing to do')
 
                sys.exit(0)
 
@@ -72,9 +73,9 @@ def main():
                sys.exit(1)
 
        # includes
-       if not glob.glob('config/includes/*') and not glob.glob('config/includes/.*') and not glob.glob('config/includes.chroot/*') and not glob.glob('config/includes.chroot/.*'):
+       if not glob.glob('config/includes/*') and not glob.glob('config/includes/.*') and not glob.glob('config/includes.binary/*') and not glob.glob('config/includes.binary/.*'):
                if verbose:
-                       print ('I: no chroot includes found at config/includes.chroot - nothing to do')
+                       print ('I: no binary includes found at config/includes.binary - nothing to do')
 
                sys.exit(0)
 
@@ -83,21 +84,21 @@ def main():
                hooks = glob.glob('config/includes/*') + glob.glob('config/includes/.*')
 
                if verbose:
-                       print('I: Copying config/includes to chroot')
+                       print('I: Copying config/includes to binary')
 
-               cpio = subprocess.call('cd config/includes && find . | cpio -dmpu --no-preserve-owner ../../chroot', shell=True)
+               cpio = subprocess.call('cd config/includes && find . | cpio -dmpu --no-preserve-owner ../../binary', shell=True)
 
-       if glob.glob('config/includes.chroot/*') and not glob.glob('config/includes.chroot/.*'):
-               hooks = glob.glob('config/includes.chroot/*') + glob.glob('config/includes.chroot/.*')
+       if glob.glob('config/includes.binary/*') and not glob.glob('config/includes.binary/.*'):
+               hooks = glob.glob('config/includes.binary/*') + glob.glob('config/includes.binary/.*')
 
                if verbose:
-                       print('I: Copying config/includes.chroot to chroot')
+                       print('I: Copying config/includes.binary to binary')
 
-               cpio = subprocess.call('cd config/includes.chroot && find . | cpio -dmpu --no-preserve-owner ../../chroot', shell=True)
+               cpio = subprocess.call('cd config/includes.binary && find . | cpio -dmpu --no-preserve-owner ../../binary', shell=True)
 
        # stagefile
        os.makedirs('.build', exist_ok=True)
-       open('.build/chroot-includes', 'w').close()
+       open('.build/binary-includes', 'w').close()
 
 
 if __name__ == '__main__':
index 4ecf387..62d20d6 100755 (executable)
@@ -67,7 +67,7 @@ lb binary_syslinux ${@}
 lb binary_disk ${@}
 lb binary_loadlin ${@}
 lb binary_win32-loader ${@}
-lb binary_includes ${@}
+lb binary-includes ${@}
 lb binary-hooks ${@}
 lb binary_checksums ${@}
 
diff --git a/scripts/build/binary_includes b/scripts/build/binary_includes
deleted file mode 100755 (executable)
index e9c57b1..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-#!/bin/sh
-
-## live-build(7) - System Build Scripts
-## Copyright (C) 2006-2013 Daniel Baumann <mail@daniel-baumann.ch>
-##
-## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
-## This is free software, and you are welcome to redistribute it
-## under certain conditions; see COPYING for details.
-
-
-set -e
-
-# Including common functions
-[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh
-
-# Setting static variables
-DESCRIPTION="$(Echo 'copy files into binary')"
-HELP=""
-USAGE="${PROGRAM} [--force]"
-
-Arguments "${@}"
-
-# Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source
-Set_defaults
-
-Echo_message "Begin copying binary includes..."
-
-# Requiring stage file
-Require_stagefile .build/config .build/bootstrap
-
-# Checking stage file
-Check_stagefile .build/includes.binary
-
-# Checking lock file
-Check_lockfile .lock
-
-# Creating lock file
-Create_lockfile .lock
-
-if Find_files config/includes.binary/
-then
-       # Copying includes
-       cd config/includes.binary
-       find . | cpio -dmpu --no-preserve-owner "${OLDPWD}"/binary
-       cd "${OLDPWD}"
-
-       # Removing symlinks
-       case "${LIVE_IMAGE_TYPE}" in
-               hdd*)
-                       find binary -type l | xargs rm -f
-                       ;;
-       esac
-
-       # Creating stage file
-       Create_stagefile .build/binary_includes
-fi