develooper Front page | perl.perl5.porters | Postings from September 1999

Possible skeletal structure for searching multiple versions

From:
Andy Dougherty
Date:
September 30, 1999 08:48
Subject:
Possible skeletal structure for searching multiple versions
Message ID:
Pine.SOL.4.10.9909301139320.3343-100000@maxwell.phys.lafayette.edu
In the section 
    =head1 Coexistence with earlier versions of perl5
the INSTALL file currently informs you that perl.c:incpush() (used by
perl -I) and lib.pm will search across previous versions of perl, if you
have a suitably-structured site_perl library tree.  Unless someone else
has implemented it, however, that doesn't work yet.

This patch doesn't make it work either.  What this patch does do,
however, is at least provide the set of variables that could be used 
to define the limits over which such searching will take place.

I'd welcome comments or alternative suggestions for how to do this or for
what to name things.

(I'll send the appropriate metaconfig units separately to just Jarkko,
since they are unlikely to be of general interest.)

The relevant parts of the patch to read are patchlevel.h and
Porting/Glossary, where the variables are defined.

P.S.  There is at least one bug -- you can't override Configure's guesses
with a command-line argument.  I'll fix that, but don't have time to do so
today.

-- 
    Andy Dougherty		doughera@lafayette.edu
    Dept. of Physics
    Lafayette College, Easton PA 18042

Index: perl-andy/patchlevel.h
--- perl/patchlevel.h	Tue Sep 21 12:42:51 1999
+++ perl-andy/patchlevel.h	Thu Sep 30 10:12:48 1999
@@ -7,6 +7,19 @@
 #define PERL_VERSION	5		/* epoch */
 #define PERL_SUBVERSION	61		/* generation */
 
+/* Compatibility across versions:  MakeMaker will install add-on
+   modules in a directory with the PERL_APIVERSION version number.  
+   Normally this should not change across maintenance releases.
+   perl.c:incpush() and lib/lib.pm will automatically search older 
+   directories across major versions back to to PERL_XS_APIVERSION
+   for XS modules and back to PERL_PM_APIVERSION for pure PERL modules.
+   (Since the versioned directory layout didn't start until 5.005,
+   that's the earliest these can go back.
+
+   See INSTALL for how this works.
+*/
+#define PERL_APIVERSION 5.00561		/* Adjust manually as needed.  */
+
 #define __PATCHLEVEL_H_INCLUDED__
 #endif
 
Index: perl-andy/Configure
Prereq:  3.0.1.9 
--- perl/Configure	Tue Sep 28 13:52:25 1999
+++ perl-andy/Configure	Thu Sep 30 10:18:56 1999
@@ -842,6 +844,8 @@
 vendorprefixexp=''
 defvoidused=''
 voidflags=''
+pm_apiversion=''
+xs_apiversion=''
 CONFIG=''
 
 define='define'
@@ -3576,9 +3584,11 @@
 if $test -r $rsrc/patchlevel.h;then
 	patchlevel=`awk '/define[ 	]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
 	subversion=`awk '/define[ 	]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
+	apiversion=`awk '/define[ 	]+PERL_APIVERSION/ {print $3}' $rsrc/patchlevel.h`
 else
 	patchlevel=0
 	subversion=0
+	apiversion=0
 fi
 $echo $n "(You have $package" $c
 case "$package" in
@@ -3598,15 +3608,6 @@
 		 echo $baserev $patchlevel $subversion | \
 		 $awk '{ printf "%.5f\n", $1 + $2/1000.0 + $3/100000.0 }'`
 fi
-: Figure out perl API version.  Perhaps this should be in patchlevel.h
-if test "$subversion" -lt 50; then
-	apiversion=`LC_ALL=C; export LC_ALL; \
-		 LANGUAGE=C; export LANGUAGE; \
-		 echo $baserev $patchlevel | \
-		 $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
-else
-	apiversion="$version"
-fi
 
 : determine installation style
 : For now, try to deduce it from prefix unless it is already set.
@@ -11945,6 +11964,15 @@
 set pid_t pidtype int stdio.h sys/types.h
 eval $typedef_ask
 
+: Find earliest binary compatible site_perl subdirectory perl can use.
+case "$bincompat5005" in
+"$define") xs_apiversion='5.005' ;;
+*) xs_apiversion=$apiversion ;;   # The current site_perl version.
+esac
+: Find earliest pure perl site_perl subdirectory perl can use.
+: The versioned directories started at 5.005.
+pm_apiversion='5.005'
+
 : check for length of pointer
 echo " "
 case "$ptrsize" in
@@ -13908,6 +13938,7 @@
 phostname='$phostname'
 pidtype='$pidtype'
 plibpth='$plibpth'
+pm_apiversion='$pm_apiversion'
 pmake='$pmake'
 pr='$pr'
 prefix='$prefix'
@@ -14031,6 +14062,7 @@
 vi='$vi'
 voidflags='$voidflags'
 xlibpth='$xlibpth'
+xs_apiversion='$xs_apiversion'
 zcat='$zcat'
 zip='$zip'
 EOT
Index: perl-andy/Porting/Glossary
--- perl/Porting/Glossary	Tue Sep 21 12:26:27 1999
+++ perl-andy/Porting/Glossary	Thu Sep 30 11:15:59 1999
@@ -38,16 +43,18 @@
 	it safe when used by a process with super-user privileges.
 
 apiversion (patchlevel.U):
-	This is a number which identifies the lowest version of perl
-	to have an API (for XS extensions) compatible with the present
-	version.  For example, for 5.005_01, the apiversion should be
-	5.005, since 5.005_01 should be binary compatible with 5.005.
-	This should probably be incremented manually somehow, perhaps
-	from patchlevel.h.  For now, we'll guess maintenance subversions
-	will retain binary compatibility.
+	MakeMaker will install add-on modules in a directory with the
+	PERL_APIVERSION version number.  The value is set manually in
+	patchlevel.h.  Normally, for maintenance releases, this is
+	just something like 5.005 or 5.6 or 5.7.  That is, it does not
+	include the subversion number and does not change across
+	maintenance releases.  This is so that add-on extensions can
+	be shared across maintenance versions.  It is unclear how this
+	ought to work for developer versions.  If a release breaks
+	binary compatibility, this number should be increased.
 
 ar (Loc.U):
-	This variable is be used internally by Configure to determine the
+	This variable is used internally by Configure to determine the
 	full pathname (if any) of the ar program.  After Configure runs,
 	the value is reset to a plain "ar" and is not useful.
 
@@ -2558,6 +2573,21 @@
 	Its value is prepend to libpth. This variable takes care of special
 	machines, like the mips.  Usually, it should be empty.
 
+pm_apiversion (xs_apiversion.U):
+	This variable contains the version of the oldest perl
+	compatible with the present perl.  (That is, pure perl modules
+	written for $pm_apiversion will still work for the current
+	version).  perl.c:incpush() and lib/lib.pm will automatically
+	search in $sitelib for older directories across major versions
+	back to pm_apiversion.  This is only useful if you have a perl
+	library directory tree structured like the default one.  The
+	versioned site_perl library was introduced in 5.005, so that's
+	the default setting for this variable.  It's hard to imagine
+	it changing before Perl6.  It is included here for symmetry
+	with xs_apiveprsion -- the searching algorithms will
+	(presumably) be similar.
+	See the INSTALL file for how this works.
+
 pmake (Loc.U):
 	This variable is defined but not used by Configure.
 	The value is a plain '' and is not useful.
@@ -3156,12 +3187,29 @@
 	libraries on this platform, for example CPU-specific libraries
 	(on multi-CPU platforms) may be listed here.
 
+xs_apiversion (xs_apiversion.U):
+	This variable contains the version of the oldest perl binary
+	compatible with the present perl.  perl.c:incpush() and
+	lib/lib.pm will automatically search in $sitearch for older
+	directories across major versions back to xs_apiversion.
+	This is only useful if you have a perl library directory tree
+	structured like the default one.
+	See INSTALL for how this works.
+	The versioned site_perl directory was introduced in 5.005,
+	so that is the lowest possible value.
+	Since this can depend on compile time options (such as
+	bincompat) it is set by Configure.  Other non-default sources
+	of potential incompatibility, such as multiplicity, threads,
+	debugging, 64bits, sfio, etc., are not checked for currently,
+	though in principle we could go snooping around in old
+	Config.pm files.
+
 zcat (Loc.U):
 	This variable is defined but not used by Configure.
 	The value is a plain '' and is not useful.
 
 zip (Loc.U):
-	This variable is be used internally by Configure to determine the
+	This variable is used internally by Configure to determine the
 	full pathname (if any) of the zip program.  After Configure runs,
 	the value is reset to a plain "zip" and is not useful.
 
Index: perl-andy/config_h.SH
Prereq:  3.0.1.5 
--- perl/config_h.SH	Tue Sep 28 13:52:56 1999
+++ perl-andy/config_h.SH	Thu Sep 30 10:18:56 1999
@@ -2506,6 +2506,41 @@
  *	be built to use socks.
  */
 #$usesocks	USE_SOCKS		/**/
+
+/* PERL_XS_APIVERSION:
+ *	This variable contains the version of the oldest perl binary
+ *	compatible with the present perl.  perl.c:incpush() and
+ *	lib/lib.pm will automatically search in $sitearch for older
+ *	directories across major versions back to xs_apiversion.
+ *	This is only useful if you have a perl library directory tree
+ *	structured like the default one.
+ *	See INSTALL for how this works.
+ *	The versioned site_perl directory was introduced in 5.005,
+ *	so that is the lowest possible value.
+ *	Since this can depend on compile time options (such as
+ *	bincompat) it is set by Configure.  Other non-default sources
+ *	of potential incompatibility, such as multiplicity, threads,
+ *	debugging, 64bits, sfio, etc., are not checked for currently,
+ *	though in principle we could go snooping around in old
+ *	Config.pm files.
+ */
+/* PERL_PM_APIVERSION:
+ *	This variable contains the version of the oldest perl
+ *	compatible with the present perl.  (That is, pure perl modules
+ *	written for pm_apiversion will still work for the current
+ *	version).  perl.c:incpush() and lib/lib.pm will automatically
+ *	search in $sitelib for older directories across major versions
+ *	back to pm_apiversion.  This is only useful if you have a perl
+ *	library directory tree structured like the default one.  The
+ *	versioned site_perl library was introduced in 5.005, so that's
+ *	the default setting for this variable.  It's hard to imagine
+ *	it changing before Perl6.  It is included here for symmetry
+ *	with xs_apiveprsion -- the searching algorithms will
+ *	(presumably) be similar.
+ *	See the INSTALL file for how this works.
+ */
+#define PERL_XS_APIVERSION $xs_apiversion /* Change to string for tuples?*/
+#define PERL_PM_APIVERSION $pm_apiversion /* Change to string for tuples?*/
 
 /* HAS_DRAND48_PROTO:
  *	This symbol, if defined, indicates that the system provides


End of patch.




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About