Commit a742ea9d authored by Mike Hibler's avatar Mike Hibler

Avoid dynamic use (unpacking) of Python M2Crypto .egg file.

The FreeBSD port just installs the zipped .egg file for M2Crypto and there
is no option to make or install an unzipped version.  Unfortunately, the
zipped version gets unpacked, per-user when it is first used and the
directory it is unpacked to is not always writable.  To avoid unsightly
"permission denied" failures, we run a post-package-install phase to
manually unpack the .egg in the python site-library directory.  This is
wicked ugly and I really should be flogged for doing this...
parent 17d29399
......@@ -155,6 +155,8 @@ my $TFTPD_PKG = "emulab-tftp-hpa-0.48";
my $P5DBD_PKG = "p5-DBD-mysql50-3.0002";
# XXX temporary until fix dependencies in emulab-boss package
my $PYM2_PKG = "py25-m2crypto-0.19.1";
# XXX temporary until someone extracts their head from the dark regions
my $EASYINSTALL = "/usr/local/bin/easy_install";
#
# Named pid file.
......@@ -603,6 +605,44 @@ Phase "portfixup", "Fixing up packages", sub {
ExecQuietFatal("$ENV PKG_PATH=$packagedir $PKG_ADD $pname");
};
}
if ($FBSD_MAJOR > 6) {
#
# What a crock! First, that the FreeBSD ports system
# defaults to installing the zipped .egg files that have
# to be unzipped per-user before use. Second, that it
# offers no easy way at package creation to override this.
# Third, that there is no easy way that I could find in
# the python eggs system to set a global cache directory
# into which to unpack all eggs; you have to set
# PYTHON_EGG_CACHE in the environment of every script.
# Fourth, that the per-user default value might be in an
# unwritable location.
#
# So, I am reduced to manually unpacking all .egg files
# into the corresponding .egg directories after the
# install! Since this would totally screw any attempt
# to update those packages, I just do it to the one
# package that I know will fail otherwise.
#
Phase "m2crypto-egg", "Unpacking python m2crypto .egg", sub {
my $pydir = "/usr/local/lib/python2.5/site-packages";
my $egg = `ls -d $pydir/M2Crypto-0.19.1-py2.5-*.egg 2>/dev/null`;
chomp($egg);
if (! -x $EASYINSTALL) {
PhaseSkip("python easy_install missing");
}
if ($egg eq "") {
PhaseSkip("py25-m2crypto egg not found");
}
if (-d "$egg") {
PhaseSkip("py25-m2crypto egg already unpacked");
}
ExecQuietFatal("mv $egg /var/tmp/");
$egg =~ s/$pydir//;
ExecQuietFatal("$EASYINSTALL -Z /var/tmp$egg");
ExecQuietFatal("mv /var/tmp$egg $pydir/$egg.bak");
};
}
};
Phase "patches", "Applying patches", sub {
......@@ -760,7 +800,7 @@ Phase "syslog", "Setting up syslog", sub {
"!tftpd", "*.*\t\t\t\t\t\t$LOGDIR/tftpd.log",
"!capserver", "*.*\t\t\t\t\t\t$LOGDIR/capserver.log",
"!frisbeed", "*.*\t\t\t\t\t\t$LOGDIR/frisbeed.log",
"!pubsubd", "*.*\t\t\t\t\t\t$LOGDIR/pubsubd.log",
"!pubsubd", "*.*\t\t\t\t\t\t$LOGDIR/pubsubd.log",
"!osselect", "*.*\t\t\t\t\t\t$LOGDIR/osselect.log",
"!genlastlog","*.*\t\t\t\t\t\t$LOGDIR/genlastlog.log",
"!sdcollectd","*.*\t\t\t\t\t\t$LOGDIR/sdcollectd.log",
......@@ -997,7 +1037,8 @@ Phase "rc.conf", "Adding testbed content to $RCCONF", sub {
qq|xntpd_enable="YES"|,
qq|syslogd_flags=""|,
qq|tftpd_flags="-lvvvv -C 40 -s /tftpboot"|,
qq|apache_enable="YES"|);
qq|apache_enable="YES"|,
qq|pubsubd_flags="-T 10"|);
# Starting at FreeBSD 6 we use the default version of bind, not the port.
if ($FBSD_MAJOR < 6) {
......
......@@ -74,6 +74,8 @@ my $TBADMINGID = 101;
my $P5DBD_PKG = "p5-DBD-mysql50-3.0002";
# XXX temporary until fix dependencies in emulab-ops package
my $PYM2_PKG = "py25-m2crypto-0.19.1";
# XXX temporary until someone extracts their head from the dark regions
my $EASYINSTALL = "/usr/local/bin/easy_install";
#
# Allow this to work if the library is left in the source directory
......@@ -544,6 +546,44 @@ Phase "portfixup", "Fixing up packages", sub {
ExecQuietFatal("$ENV PKG_PATH=$packagedir $PKG_ADD $pname");
};
}
if ($FBSD_MAJOR > 6) {
#
# What a crock! First, that the FreeBSD ports system
# defaults to installing the zipped .egg files that have
# to be unzipped per-user before use. Second, that it
# offers no easy way at package creation to override this.
# Third, that there is no easy way that I could find in
# the python eggs system to set a global cache directory
# into which to unpack all eggs; you have to set
# PYTHON_EGG_CACHE in the environment of every script.
# Fourth, that the per-user default value might be in an
# unwritable location.
#
# So, I am reduced to manually unpacking all .egg files
# into the corresponding .egg directories after the
# install! Since this would totally screw any attempt
# to update those packages, I just do it to the one
# package that I know will fail otherwise.
#
Phase "m2crypto-egg", "Unpacking python m2crypto .egg", sub {
my $pydir = "/usr/local/lib/python2.5/site-packages";
my $egg = `ls -d $pydir/M2Crypto-0.19.1-py2.5-*.egg 2>/dev/null`;
chomp($egg);
if (! -x $EASYINSTALL) {
PhaseSkip("python easy_install missing");
}
if ($egg eq "") {
PhaseSkip("py25-m2crypto egg not found");
}
if (-d "$egg") {
PhaseSkip("py25-m2crypto egg already unpacked");
}
ExecQuietFatal("mv $egg /var/tmp/");
$egg =~ s/$pydir//;
ExecQuietFatal("$EASYINSTALL -Z /var/tmp$egg");
ExecQuietFatal("mv /var/tmp$egg $pydir/$egg.bak");
};
}
};
Phase "patches", "Applying patches", sub {
......@@ -587,7 +627,8 @@ Phase "rc.conf", "Adding testbed content to rc.conf", sub {
(($ISFS && $WINSUPPORT) ? qq|smbd_enable="YES"| : ()),
qq|apache_enable="YES"|,
qq|syslogd_flags=""|,
($CVSSUPPORT ? qq|cvsd_enable="YES"| : ()));
($CVSSUPPORT ? qq|cvsd_enable="YES"| : ()),
qq|pubsubd_flags="-T 10"|);
};
Phase "hosts", "Adding boss/ops/fs IP addresses to $HOSTS", sub {
......
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