Use a template system for tree scrubbing

This commit is contained in:
Martin Gracik 2009-10-21 13:56:46 +02:00
parent 69c69d0e13
commit b028a210a5
10 changed files with 39 additions and 2 deletions

1
etc/tree/scrubs.alpha Symbolic link
View File

@ -0,0 +1 @@
scrubs.i386

5
etc/tree/scrubs.i386 Normal file
View File

@ -0,0 +1,5 @@
# remove unnecessary directories from root
remove @instroot@/boot
remove @instroot@/home
remove @instroot@/root
remove @instroot@/tmp

1
etc/tree/scrubs.ia64 Symbolic link
View File

@ -0,0 +1 @@
scrubs.i386

1
etc/tree/scrubs.ppc Symbolic link
View File

@ -0,0 +1 @@
scrubs.i386

1
etc/tree/scrubs.ppc64 Symbolic link
View File

@ -0,0 +1 @@
scrubs.ppc

1
etc/tree/scrubs.s390 Symbolic link
View File

@ -0,0 +1 @@
scrubs.i386

1
etc/tree/scrubs.s390x Symbolic link
View File

@ -0,0 +1 @@
scrubs.s390

1
etc/tree/scrubs.sparc Symbolic link
View File

@ -0,0 +1 @@
scrubs.i386

1
etc/tree/scrubs.x86_64 Symbolic link
View File

@ -0,0 +1 @@
scrubs.i386

View File

@ -28,6 +28,10 @@ import re
from utils.fileutils import copy, move, remove, replace, touch
import actions
import actions.base
from template import Template
class InstallTree(object):
@ -505,6 +509,25 @@ class InstallTree(object):
os.unlink(link)
os.symlink(newtarget, link)
def process_scrubs_from_template(self):
# get supported actions
supported_actions = actions.getActions(verbose=self.conf.debug)
# variables supported in templates
vars = { "instroot": self.conf.treedir }
# parse the template file
scrubs = os.path.join(self.conf.confdir, "tree",
"scrubs.%s" % (self.conf.buildarch,))
if os.path.exists(scrubs):
self.template = Template()
self.template.preparse(scrubs)
self.template.parse(supported_actions, vars)
for action in self.template.actions:
action.execute()
def scrub(self):
self.copy_stubs()
self.create_dogtail_conf()
@ -526,7 +549,8 @@ class InstallTree(object):
self.remove_locales()
self.remove_unnecessary_files()
self.remove_python_stuff()
self.remove_unnecessary_directories()
#self.remove_unnecessary_directories()
self.move_bins()
self.process_scrubs_from_template()