[BL training-materials-updates] labs: remove obsolete script

Michael Opdenacker michael.opdenacker at bootlin.com
Fri Nov 16 17:16:09 CET 2018


Repository : git://git.free-electrons.com/training-materials.git
On branch  : master
Link       : http://git.free-electrons.com/training-materials/commit/?id=c543e8be27b8bf4b2f60cde68244de196e13224e

>---------------------------------------------------------------

commit c543e8be27b8bf4b2f60cde68244de196e13224e
Author: Michael Opdenacker <michael.opdenacker at bootlin.com>
Date:   Fri Nov 16 17:16:09 2018 +0100

    labs: remove obsolete script
    
    Signed-off-by: Michael Opdenacker <michael.opdenacker at bootlin.com>


>---------------------------------------------------------------

c543e8be27b8bf4b2f60cde68244de196e13224e
 lab-data/clean-labs | 103 ----------------------------------------------------
 1 file changed, 103 deletions(-)

diff --git a/lab-data/clean-labs b/lab-data/clean-labs
deleted file mode 100755
index 47fcc46..0000000
--- a/lab-data/clean-labs
+++ /dev/null
@@ -1,103 +0,0 @@
-#!/usr/bin/env python
-########################################################################################
-# Utility to clean up a Bootlin training lab directory
-#
-# Just run it in the main labs directory:
-# ./cleanlabs
-#
-# Copyright 2008, Bootlin https://bootlin.com
-# License: Public Domain
-########################################################################################
-
-import glob, os, os.path, shutil, sys, fnmatch, re
-
-########################################################################################
-# Remove all the files in a list of directories, except the specified ones
-# Don't complain if the specified files no longer exist (manual cleanup by the user)
-########################################################################################
-
-def find_file_pattern (top, filepat):
-    for path, dirlist, filelist in os.walk(top):
-        for name in fnmatch.filter(filelist,filepat):
-            yield os.path.join(path,name)
-
-def find_dir_pattern (top, dirpat):
-    for path, dirlist, filelist in os.walk(top):
-        for name in fnmatch.filter(dirlist,dirpat):
-            yield os.path.join(path,name)
-
-def clean_dirs(remove_patterns, keep_patterns):
-
-	for pattern in remove_patterns:
-		for dir in find_dir_pattern('.', pattern):
-			clean_dir(dir, keep_patterns)
-
-def clean_files(remove_patterns):
-	for pattern in remove_patterns:
-		for file in find_file_pattern('.', pattern):
-			if os.path.exists(file) and not(os.path.islink(file)):
-				# We ignore links... this way the user
-				# sees that he used a link
-				os.remove(file)
-
-def clean_dir(dir, keep_patterns):
-
-        curdir = os.getcwd()
-	os.chdir(dir)
-	kept = []
-	
-	for pattern in keep_patterns:
-		for match in glob.glob(pattern):
-			kept.append(match)
-	
-	newdir = os.path.join(curdir, 'cleanuplab.tmp-' + os.path.basename(dir))
-	os.makedirs(newdir)
-		
-	for file in kept:
-		filedir = os.path.dirname(file)
-
-		newsubdir = os.path.join(newdir, filedir)
-
-		if filedir != '' and not(os.path.exists(newsubdir)):
-			os.makedirs(newsubdir)
-
-		shutil.move(file, os.path.join(newdir, file))
-
-	os.chdir(curdir)
-	shutil.rmtree(dir, True)
-	shutil.move(newdir, dir)
-
-########################################################################################
-# Main commands
-########################################################################################
-		
-# Remove Linux source directories
-# except the most important user defined or generated files
-# Some people have already put their linux sources in the root lab directory,
-# or in the data/ subdirectory.
-
-clean_dirs(['linux-2.6*', 'linux-3.*'], ['Makefile', 'arch/*/boot/*zImage', '.config', '*.config'])
-
-# Remove BusyBox source directories
-# except the most important user defined or generated files
-
-clean_dirs(['busybox-*'], ['Makefile', '.config', '*.config'])
-
-# Remove source archives and patches
-# Not exactly sure where the user left them
-
-clean_files(['*.bz2', '*.gz', '*.zip', '*.lzma', '*.7z', '*.tar', '*.xz'])
-
-# Remove misc files
-
-clean_files(['core', 'cscope.out'])
-
-# Clean misc lab directories
-
-clean_dirs(['crosstool-ng-*'], ['.config'])
-clean_dirs(['buildroot-*'], ['.config', 'binaries'])
-clean_dirs(['u-boot-*'], [])
-clean_dirs(['freetype-*'], [])
-clean_dirs(['jpeg-*'], [])
-clean_dirs(['libpng-*'], [])
-clean_dirs(['zlib-*'], [])




More information about the training-materials-updates mailing list