Commit a0000542 authored by Viktor Horvath's avatar Viktor Horvath

Makefile separation: instantiation

parent 37670e11
......@@ -53,15 +53,27 @@ class Recipe(GenericBaseRecipe):
def update(self):
self.instantiate(False)
def rsync_dir(self, src, target):
if os.path.isdir(src) and not src.endswith('/'):
src += '/'
cmd = subprocess.Popen(self.options['rsync_bin'] + '/rsync -a --specials '
+ src + ' ' + target,
env=os.environ, shell=True)
cmd.communicate()
def instantiate(self, isNewInstall):
# Copy the build/ and var/lib/Mioga2 folders into the instance
mioga_location = self.options['mioga_location']
var_dir = self.options['var_directory']
if not os.path.exists(var_dir):
shutil.copytree(os.path.join(mioga_location, 'var'), var_dir, True)
self.rsync_dir(os.path.join(mioga_location, 'var'), var_dir)
buildinst_dir = self.options['buildinst_directory']
self.rsync_dir(self.options['mioga_buildinst'], buildinst_dir)
former_directory = os.getcwd()
os.chdir(self.options['mioga_buildinst'])
os.chdir(buildinst_dir)
vardir = self.options['var_directory']
mioga_base = os.path.join(vardir, 'lib', 'Mioga2')
......@@ -87,11 +99,8 @@ class Recipe(GenericBaseRecipe):
fm.save()
# Ensure no old data is kept
self.removeIfExisting('config.mk')
if os.path.isdir('web/conf/apache'):
shutil.rmtree('web/conf/apache')
for key in self.options.keys():
print "Found option: "+key
# if os.path.isdir('web/conf/apache'):
# shutil.rmtree('web/conf/apache')
environ = os.environ
environ['PATH'] = ':'.join([self.options['perl_bin'], # priority!
......@@ -100,6 +109,7 @@ class Recipe(GenericBaseRecipe):
self.options['libxslt_bin'],
self.options['libxml2_bin'],
self.options['postgres_bin'],
self.options['rsync_bin'],
environ['PATH'] ])
environ['MIOGA_SITEPERL'] = self.options['mioga_siteperl']
......@@ -115,9 +125,6 @@ class Recipe(GenericBaseRecipe):
os.chmod(pgpassfilepath, stat.S_IRUSR | stat.S_IWUSR)
environ['PGPASSFILE'] = pgpassfilepath
# environ = self.options['mioga_compile_env']
print pprint.pformat(environ)
# We must call "make" in the SAME environment that
# "perl Makefile.PL" left!
......
......@@ -16,6 +16,8 @@ bin = $${buildout:directory}/bin
etc = $${buildout:directory}/etc
srv = $${buildout:directory}/srv
log = $${buildout:directory}/log
var = $${buildout:directory}/var
buildinst = $${buildout:directory}/buildinst
[basedirectory]
recipe = slapos.cookbook:mkdirectory
......@@ -86,7 +88,9 @@ mioga_location = ${mioga:location}
mioga_buildinst = ${mioga:buildinst}
libxslt_bin = ${libxslt:location}/bin
libxml2_bin = ${libxml2:location}/bin
var_directory = $${buildout:directory}/var
rsync_bin = ${rsync:location}/bin
var_directory = $${rootdirectory:var}
buildinst_directory = $${rootdirectory:buildinst}
instance_root = $${buildout:directory}
perl_bin = ${perl:location}/bin
postgres_bin = ${postgresql:location}/bin
......
......@@ -12,7 +12,7 @@ index ef0f369..b275a48 100644
This script must be run by cron in a day basis with apache user (www-data for Debian)
diff --git a/Makefile.PL b/Makefile.PL
index 3582d20..46608ca 100644
index 3582d20..80ea444 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -20,8 +20,10 @@
......@@ -87,7 +87,7 @@ index 3582d20..46608ca 100644
+ "$(MIOGA_BUILDINST)"
+
+slapos-instantiation ::
+ for i in web/conf conf sql ; \
+ for i in web/conf conf web/skel sql ; \
+ do \
+ (cd $$i && $(MAKE) install) || exit 1;\
+ done
......@@ -97,27 +97,19 @@ index 3582d20..46608ca 100644
doc:
for i in ' . $docsubdirs . ' ; \
do \
@@ -176,9 +202,26 @@ installall: install install-all
@@ -176,9 +202,18 @@ installall: install install-all
#
# ----------------------------------------------------------------------------
+my $Mioga2_pm = 'lib/Mioga2.pm';
+foreach my $envkey (keys %ENV) {
+ print "VHH DEBUG: found envvar $envkey\n";
+}
+if ((not -e $Mioga2_pm) and exists($ENV{MIOGA_SITEPERL})) {
+ print "VHH DEBUG: looking into SITEPERL\n";
+ my $findfile = sub {
+ if ($_ eq 'Mioga2.pm') {
+ $Mioga2_pm = $File::Find::name;
+ print "VHH DEBUG: Found Mioga2.pm in $Mioga2_pm\n";
+ }
+ };
+ find($findfile, $ENV{MIOGA_SITEPERL});
+};
+print "VHH DEBUG: Found finally: $Mioga2_pm\n";
+print 'VHH DEBUG: SIZE = ' . ( stat($Mioga2_pm) )[8] . "\n";
+print "VHH DEBUG: Current directory is ".getcwd."\n";
WriteMakefile(
'NAME' => 'Mioga',
'DIR' => ['bin', 'web', 'locales', 'docs', 'sql'],
......@@ -649,6 +641,17 @@ index 66af45f..9649a02 100644
mkdir -p $(TMP_DIR)
mkdir -p $(DESTDIR)$(INSTALL_DIR)/$(INSTANCE_IDENT)/$(MIOGA_FILES)
diff --git a/web/conf/Makefile b/web/conf/Makefile
index 1573e5c..189f2fd 100644
--- a/web/conf/Makefile
+++ b/web/conf/Makefile
@@ -14,5 +14,6 @@ install:
# is done in ../Makefile
clean:
+ echo "VHH DEBUG: web/conf make clean, deleting apache/ !"
rm -Rf apache Mioga.conf .memdump
diff --git a/web/conf/startup.pl b/web/conf/startup.pl
index a9dc968..6558061 100644
--- a/web/conf/startup.pl
......
......@@ -4,6 +4,7 @@ develop =
/opt/slapdev_build
extends =
../../component/rsync/buildout.cfg
../../component/apache-perl/buildout.cfg
../../component/perl-Crypt-SSLeay/buildout.cfg
../../component/perl-XML-Parser/buildout.cfg
......@@ -35,6 +36,7 @@ parts =
perl-String-Checker-mioga
perl-Search-Xapian
cpan-simple-modules
rsync
mioga
template
template-apacheperl
......@@ -103,7 +105,7 @@ environment =
MIOGA_BUILDINST=${mioga:buildinst}
MIOGA_STATIC=${mioga:static}
MIOGA_SITEPERL=${perl:siteprefix}
PATH=${libxslt:location}/bin:${libxml2:location}/bin:${perl:location}/bin:${perl:siteprefix}/bin:%(PATH)s
PATH=${libxslt:location}/bin:${libxml2:location}/bin:${perl:location}/bin:${perl:siteprefix}/bin:${rsync:location}/bin:%(PATH)s
patch-options = -p1
patches =
${mioga-patch:location}/${mioga-patch:filename}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment