diff options
author | Markus Duft <mduft@gentoo.org> | 2008-12-09 08:30:18 +0000 |
---|---|---|
committer | Markus Duft <mduft@gentoo.org> | 2008-12-09 08:30:18 +0000 |
commit | f5531c453b243c12897509cfa050d8ef8c4c2e89 (patch) | |
tree | 6338f281dce13ac3af2768f62eb36b8a73e3ad58 /dev-util/confix/files | |
parent | Update PIC patch (#250335) (diff) | |
download | historical-f5531c453b243c12897509cfa050d8ef8c4c2e89.tar.gz historical-f5531c453b243c12897509cfa050d8ef8c4c2e89.tar.bz2 historical-f5531c453b243c12897509cfa050d8ef8c4c2e89.zip |
added patch to enable faster installation rules in generated makefiles
Package-Manager: portage-2.1.4.5
Diffstat (limited to 'dev-util/confix/files')
-rw-r--r-- | dev-util/confix/files/2.1.0/fast-install.patch | 307 |
1 files changed, 307 insertions, 0 deletions
diff --git a/dev-util/confix/files/2.1.0/fast-install.patch b/dev-util/confix/files/2.1.0/fast-install.patch new file mode 100644 index 000000000000..aaec4d86f0d8 --- /dev/null +++ b/dev-util/confix/files/2.1.0/fast-install.patch @@ -0,0 +1,307 @@ +diff -ru Confix-2.1.0.orig/libconfix/core/automake/file_installer.py Confix-2.1.0/libconfix/core/automake/file_installer.py +--- Confix-2.1.0.orig/libconfix/core/automake/file_installer.py 2008-10-21 11:17:30 +0200 ++++ Confix-2.1.0/libconfix/core/automake/file_installer.py 2008-11-05 13:17:14 +0100 +@@ -22,6 +22,11 @@ + from libconfix.core.utils.paragraph import Paragraph + from libconfix.core.utils import const + ++try: ++ from hashlib import md5 as my_md5 ++except ImportError: ++ from md5 import new as my_md5 ++ + import helper_automake + from rule import Rule + +@@ -55,10 +60,17 @@ + ## FILENAME_BULK_INSTALL_PUBLIC = '.bulk-install-public' + ## FILENAME_BULK_INSTALL_LOCAL = '.bulk-install-local' + +-## TARGET_INSTALL_PUBLIC = 'confix-install-public' ++ TARGET_INSTALL_PUBLIC = 'confix-install-public' ++ TARGET_INSTALL_DATA_PUBLIC = 'confix-install-data-public' ++ TARGET_INSTALL_PREFIX_PUBLIC = 'confix-install-prefix-public' ++ TARGET_UNINSTALL_PUBLIC = 'confix-uninstall-public' ++ TARGET_UNINSTALL_DATA_PUBLIC = 'confix-uninstall-data-public' ++ TARGET_UNINSTALL_PREFIX_PUBLIC = 'confix-uninstall-prefix-public' + TARGET_INSTALL_LOCAL = 'confix-install-local' + TARGET_CLEAN_LOCAL = 'confix-clean-local' + ++ MAX_SIMULTANOUS_INSTALL = 20 ++ + ## VAR_SRCDIR = 'srcdir' + ## VAR_BUILDDIR = 'builddir' + ## VAR_INCLUDEDIR = 'includedir' +@@ -190,10 +202,13 @@ + ## buildmod.makefile_am().add_lines(['if !BULK_INSTALL', '']) + ## pass + +- self.automake_install_public_headers_(makefile_am=makefile_am) +- self.automake_install_datafiles_(makefile_am=makefile_am) +- self.automake_install_prefixfiles_(makefile_am=makefile_am) +- self.automake_install_private_headers_(makefile_am=makefile_am) ++ #self.automake_install_public_headers_(makefile_am=makefile_am) ++ #self.automake_install_datafiles_(makefile_am=makefile_am) ++ #self.automake_install_prefixfiles_(makefile_am=makefile_am) ++ self.fast_install_public_headers_(makefile_am=makefile_am) ++ self.fast_install_datafiles_(makefile_am=makefile_am) ++ self.fast_install_prefixfiles_(makefile_am=makefile_am) ++ self.fast_install_private_headers_(makefile_am=makefile_am) + ## buildmod.makefile_am().add_lines(helper_automake.format_rule( + ## targets=[FileInstaller.TARGET_INSTALL_PUBLIC])) + +@@ -264,6 +279,55 @@ + files=filelist) + pass + pass ++ ++ def fast_install_public_headers_(self, makefile_am): ++ makefile_am.add_install_data_local(FileInstaller.TARGET_INSTALL_PUBLIC) ++ # this rule should be provided by makefile_am, much like the above install-data-local ++ makefile_am.add_element(Rule(targets=['uninstall-local'], prerequisites=[FileInstaller.TARGET_UNINSTALL_PUBLIC], commands=[])) ++ ++ install_public_rule = Rule(targets=[FileInstaller.TARGET_INSTALL_PUBLIC], prerequisites=[], commands=[]) ++ uninstall_public_rule = Rule(targets=[FileInstaller.TARGET_UNINSTALL_PUBLIC], prerequisites=[], commands=[]) ++ ++ makefile_am.add_element(install_public_rule) ++ makefile_am.add_element(uninstall_public_rule) ++ ++ dir2file_dict = self.dir2filedict_(self.public_headers_) ++ ++ for (installpath, files) in dir2file_dict.iteritems(): ++ if len(installpath): ++ targetdir = '/'.join(['$(includedir)', installpath]) ++ ++ # define symbol for backwards compatability in handwritten rules. ++ symbolicname = self.compute_install_dirname_('publicheader_'+installpath) ++ makefile_am.define_install_directory(symbolicname=symbolicname, ++ dirname='$(includedir)/'+installpath) ++ else: ++ targetdir = '$(includedir)' ++ pass ++ ++ # add mkdir rules for every subdirectory ++ makefile_am.add_element( ++ Rule(targets=[targetdir], ++ prerequisites=[], ++ commands=['-$(mkinstalldirs) '+targetdir])) ++ ++ _i=0 ++ _f=[] ++ for f in files: ++ _f.append(f) ++ _i+=1 ++ if len(_f) >= FileInstaller.MAX_SIMULTANOUS_INSTALL or _i >= len(files): ++ # is this rule name unique enough? ++ rulename='.installstamp.public_' + my_md5(str(hash(self)) + targetdir + str(_i)).hexdigest() ++ self.fast_general_install(makefile_am, rulename, targetdir, _f, '0644') ++ install_public_rule.add_prerequisite(rulename) ++ uninstall_public_rule.add_prerequisite(rulename + '_clean') ++ _f=[] ++ pass ++ pass ++ pass ++ pass ++ + + def automake_install_datafiles_(self, makefile_am): + for dirname, filelist in self.dir2filedict_(file2dirdict=self.datafiles_).iteritems(): +@@ -278,6 +342,50 @@ + pass + pass + ++ def fast_install_datafiles_(self, makefile_am): ++ makefile_am.add_install_data_local(FileInstaller.TARGET_INSTALL_DATA_PUBLIC) ++ # this rule should be provided by makefile_am, much like the above install-data-local ++ makefile_am.add_element(Rule(targets=['uninstall-local'], prerequisites=[FileInstaller.TARGET_UNINSTALL_DATA_PUBLIC], commands=[])) ++ ++ install_public_data_rule = Rule(targets=[FileInstaller.TARGET_INSTALL_DATA_PUBLIC], prerequisites=[], commands=[]) ++ uninstall_public_data_rule = Rule(targets=[FileInstaller.TARGET_UNINSTALL_DATA_PUBLIC], prerequisites=[], commands=[]) ++ ++ makefile_am.add_element(install_public_data_rule) ++ makefile_am.add_element(uninstall_public_data_rule) ++ ++ dir2file_dict = self.dir2filedict_(self.datafiles_) ++ ++ for (installpath, files) in dir2file_dict.iteritems(): ++ targetdir = '/'.join(['$(datadir)', installpath]) ++ ++ # define symbol for backwards compatability in handwritten rules. ++ symbolicname = self.compute_install_dirname_('data_'+installpath) ++ makefile_am.define_install_directory(symbolicname=symbolicname, ++ dirname='$(datadir)/'+installpath) ++ ++ # add mkdir rules for every subdirectory ++ makefile_am.add_element( ++ Rule(targets=[targetdir], ++ prerequisites=[], ++ commands=['-$(mkinstalldirs) '+targetdir])) ++ ++ _i=0 ++ _f=[] ++ for f in files: ++ _f.append(f) ++ _i+=1 ++ if len(_f) >= FileInstaller.MAX_SIMULTANOUS_INSTALL or _i >= len(files): ++ # is this rule name unique enough? ++ rulename='.installstamp.public_data_' + my_md5(str(hash(self)) + targetdir + str(_i)).hexdigest() ++ self.fast_general_install(makefile_am, rulename, targetdir, _f, '0644') ++ install_public_data_rule.add_prerequisite(rulename) ++ uninstall_public_data_rule.add_prerequisite(rulename + '_clean') ++ _f=[] ++ pass ++ pass ++ pass ++ pass ++ + def automake_install_prefixfiles_(self, makefile_am): + for dirname, filelist in self.dir2filedict_(file2dirdict=self.prefixfiles_).iteritems(): + # define directory +@@ -291,17 +399,92 @@ + pass + pass + +- def automake_install_private_headers_(self, makefile_am): ++ def fast_install_prefixfiles_(self, makefile_am): ++ makefile_am.add_install_data_local(FileInstaller.TARGET_INSTALL_PREFIX_PUBLIC) ++ # this rule should be provided by makefile_am, much like the above install-data-local ++ makefile_am.add_element(Rule(targets=['uninstall-local'], prerequisites=[FileInstaller.TARGET_UNINSTALL_PREFIX_PUBLIC], commands=[])) ++ ++ install_public_prefix_rule = Rule(targets=[FileInstaller.TARGET_INSTALL_PREFIX_PUBLIC], prerequisites=[], commands=[]) ++ uninstall_public_prefix_rule = Rule(targets=[FileInstaller.TARGET_UNINSTALL_PREFIX_PUBLIC], prerequisites=[], commands=[]) ++ ++ makefile_am.add_element(install_public_prefix_rule) ++ makefile_am.add_element(uninstall_public_prefix_rule) ++ ++ dir2file_dict = self.dir2filedict_(self.prefixfiles_) ++ ++ for (installpath, files) in dir2file_dict.iteritems(): ++ targetdir = '/'.join(['$(prefix)', installpath]) ++ ++ # define symbol for backwards compatability in handwritten rules. ++ symbolicname = self.compute_install_dirname_('prefix_'+installpath) ++ makefile_am.define_install_directory(symbolicname=symbolicname, ++ dirname='$(prefix)/'+installpath) ++ ++ # add mkdir rules for every subdirectory ++ makefile_am.add_element( ++ Rule(targets=[targetdir], ++ prerequisites=[], ++ commands=['-$(mkinstalldirs) '+targetdir])) ++ ++ _i=0 ++ _f=[] ++ for f in files: ++ _f.append(f) ++ _i+=1 ++ if len(_f) >= FileInstaller.MAX_SIMULTANOUS_INSTALL or _i >= len(files): ++ # is this rule name unique enough? ++ rulename='.installstamp.public_prefix_' + my_md5(str(hash(self)) + targetdir + str(_i)).hexdigest() ++ self.fast_general_install(makefile_am, rulename, targetdir, _f, '0644') ++ install_public_prefix_rule.add_prerequisite(rulename) ++ uninstall_public_prefix_rule.add_prerequisite(rulename + '_clean') ++ _f=[] ++ pass ++ pass ++ pass ++ pass ++ ++ ++ ++ def fast_general_install(self, makefile_am, rulename, targetdir, files, mode): ++ # WARNING: be _very_ carefull about what you change ++ # below, since this is a double-loop, one for'ing over ++ # all paths, and one shift'ing over all basenames. If ++ # for some reason those run apart, files may be copied ++ # to wrong destination names! ++ makefile_am.add_element( ++ Rule(targets=[rulename], ++ prerequisites=[' '.join(files)], ++ commands=['-@$(mkinstalldirs) ' + targetdir, ++ '@test -z "$?" && exit 0; \\', ++ 'set dummy $(?F); \\', ++ 'for f in $?; do \\', ++ ' shift; \\', ++ ' bf=$${1}; \\', ++ ' echo "fast install $${f} -> ' + targetdir + '/$${bf}"; \\', ++ ' __f="$${__f} $${f}"; \\', ++ ' __tf="$${__tf} ' + targetdir + '/$${bf}"; \\', ++ 'done; \\', ++ 'test -z "$${__f}" && exit 0; \\', ++ 'cp -fp $${__f} ' + targetdir + ' || exit 1; \\', ++ 'chmod ' + mode + ' $${__tf} || exit 1; \\', ++ 'touch ' + rulename + ';'])) ++ makefile_am.add_element( ++ Rule(targets=[rulename + '_clean'], ++ prerequisites=[], ++ commands=['rm -f ' + rulename + ' ' + str(' ' + targetdir + '/').join([''] + files) + ';'])) ++ pass ++ ++ def fast_install_private_headers_(self, makefile_am): + + # now for the private header files. this is a bit more + # complicated as we have to do it by hand, using the all-local + # hook. + +- makefile_am.add_all_local('confix-install-local') +- makefile_am.add_clean_local('confix-clean-local') ++ makefile_am.add_all_local(FileInstaller.TARGET_INSTALL_LOCAL) ++ makefile_am.add_clean_local(FileInstaller.TARGET_CLEAN_LOCAL) + +- install_local_rule = Rule(targets=['confix-install-local'], prerequisites=[], commands=[]) +- clean_local_rule = Rule(targets=['confix-clean-local'], prerequisites=[], commands=[]) ++ install_local_rule = Rule(targets=[FileInstaller.TARGET_INSTALL_LOCAL], prerequisites=[], commands=[]) ++ clean_local_rule = Rule(targets=[FileInstaller.TARGET_CLEAN_LOCAL], prerequisites=[], commands=[]) + makefile_am.add_element(install_local_rule) + makefile_am.add_element(clean_local_rule) + +@@ -321,20 +504,36 @@ + commands=['-$(mkinstalldirs) '+targetdir])) + + # copy files ++# for f in files: ++# targetfile = '/'.join([targetdir, f]) ++# makefile_am.add_element( ++# Rule(targets=[targetfile], ++# prerequisites=[f], ++# commands=['-@$(mkinstalldirs) '+targetdir, ++# 'cp -fp $? '+' '+targetdir, ++# 'chmod 0444 '+targetfile])) ++# makefile_am.add_element( ++# Rule(targets=[targetfile+'-clean'], ++# prerequisites=[], ++# commands=['rm -f '+targetfile])) ++# install_local_rule.add_prerequisite(targetfile) ++# clean_local_rule.add_prerequisite(targetfile+'-clean') ++# pass ++# pass ++ ++ _i=0 ++ _f=[] + for f in files: +- targetfile = '/'.join([targetdir, f]) +- makefile_am.add_element( +- Rule(targets=[targetfile], +- prerequisites=[f], +- commands=['-@$(mkinstalldirs) '+targetdir, +- 'cp -fp $? '+' '+targetdir, +- 'chmod 0444 '+targetfile])) +- makefile_am.add_element( +- Rule(targets=[targetfile+'-clean'], +- prerequisites=[], +- commands=['rm -f '+targetfile])) +- install_local_rule.add_prerequisite(targetfile) +- clean_local_rule.add_prerequisite(targetfile+'-clean') ++ _f.append(f) ++ _i+=1 ++ if len(_f) >= FileInstaller.MAX_SIMULTANOUS_INSTALL or _i >= len(files): ++ # is this rule name unique enough? ++ rulename='.installstamp.private_' + my_md5(str(hash(self)) + targetdir + str(_i)).hexdigest() ++ self.fast_general_install(makefile_am, rulename, targetdir, _f, '0444') ++ install_local_rule.add_prerequisite(rulename) ++ clean_local_rule.add_prerequisite(rulename + '_clean') ++ _f=[] ++ pass + pass + pass + pass |