Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | From 6c6cf14e204f3c031372bfd9604ad524d5691186 Mon Sep 17 00:00:00 2001 |
| 2 | From: Brendan O'Dea <bod@debian.org> |
| 3 | Date: Fri, 18 Mar 2005 22:22:25 +1100 |
| 4 | Subject: Tweak @INC ordering for Debian |
| 5 | |
| 6 | Our order is: |
| 7 | |
| 8 | etc (for config files) |
| 9 | site (5.8.1) |
| 10 | vendor (all) |
| 11 | core (5.8.1) |
| 12 | site (version-indep) |
| 13 | site (pre-5.8.1) |
| 14 | |
| 15 | The rationale being that an admin (via site), or module packager |
| 16 | (vendor) can chose to shadow core modules when there is a newer |
| 17 | version than is included in core. |
| 18 | |
| 19 | Patch-Name: debian/mod_paths.diff |
| 20 | --- |
| 21 | perl.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 22 | 1 file changed, 58 insertions(+) |
| 23 | |
| 24 | diff --git a/perl.c b/perl.c |
| 25 | index 086645b..e64f1f4 100644 |
| 26 | --- a/perl.c |
| 27 | +++ b/perl.c |
| 28 | @@ -4373,6 +4373,11 @@ S_init_perllib(pTHX) |
| 29 | INCPUSH_ADD_SUB_DIRS|INCPUSH_CAN_RELOCATE); |
| 30 | #endif |
| 31 | |
| 32 | +#ifdef DEBIAN |
| 33 | + /* for configuration where /usr is mounted ro (CPAN::Config, Net::Config) */ |
| 34 | + S_incpush_use_sep(aTHX_ STR_WITH_LEN("/etc/perl"), 0x0); |
| 35 | +#endif |
| 36 | + |
| 37 | #ifdef SITEARCH_EXP |
| 38 | /* sitearch is always relative to sitelib on Windows for |
| 39 | * DLL-based path intuition to work correctly */ |
| 40 | @@ -4490,6 +4495,59 @@ S_init_perllib(pTHX) |
| 41 | INCPUSH_ADD_OLD_VERS|INCPUSH_CAN_RELOCATE); |
| 42 | #endif |
| 43 | |
| 44 | +#ifdef DEBIAN |
| 45 | + /* Non-versioned site directory for local modules and for |
| 46 | + compatability with the previous packages' site dirs */ |
| 47 | + S_incpush_use_sep(aTHX_ STR_WITH_LEN("/usr/local/lib/site_perl"), |
| 48 | + INCPUSH_ADD_SUB_DIRS); |
| 49 | + |
| 50 | +#ifdef PERL_INC_VERSION_LIST |
| 51 | + { |
| 52 | + struct stat s; |
| 53 | + |
| 54 | + /* add small buffer in case old versions are longer than the |
| 55 | + current version */ |
| 56 | + char sitearch[sizeof(SITEARCH_EXP)+16] = SITEARCH_EXP; |
| 57 | + char sitelib[sizeof(SITELIB_EXP)+16] = SITELIB_EXP; |
| 58 | + char const *vers[] = { PERL_INC_VERSION_LIST }; |
| 59 | + char const **p; |
| 60 | + |
| 61 | + char *arch_vers = strrchr(sitearch, '/'); |
| 62 | + char *lib_vers = strrchr(sitelib, '/'); |
| 63 | + |
| 64 | + if (arch_vers && isdigit(*++arch_vers)) |
| 65 | + *arch_vers = 0; |
| 66 | + else |
| 67 | + arch_vers = 0; |
| 68 | + |
| 69 | + if (lib_vers && isdigit(*++lib_vers)) |
| 70 | + *lib_vers = 0; |
| 71 | + else |
| 72 | + lib_vers = 0; |
| 73 | + |
| 74 | + /* there is some duplication here as incpush does something |
| 75 | + similar internally, but required as sitearch is not a |
| 76 | + subdirectory of sitelib */ |
| 77 | + for (p = vers; *p; p++) |
| 78 | + { |
| 79 | + if (arch_vers) |
| 80 | + { |
| 81 | + strcpy(arch_vers, *p); |
| 82 | + if (PerlLIO_stat(sitearch, &s) >= 0 && S_ISDIR(s.st_mode)) |
| 83 | + S_incpush_use_sep(aTHX_ sitearch, strlen(sitearch), 0x0); |
| 84 | + } |
| 85 | + |
| 86 | + if (lib_vers) |
| 87 | + { |
| 88 | + strcpy(lib_vers, *p); |
| 89 | + if (PerlLIO_stat(sitelib, &s) >= 0 && S_ISDIR(s.st_mode)) |
| 90 | + S_incpush_use_sep(aTHX_ sitelib, strlen(sitelib), 0x0); |
| 91 | + } |
| 92 | + } |
| 93 | + } |
| 94 | +#endif |
| 95 | +#endif |
| 96 | + |
| 97 | #ifdef PERL_OTHERLIBDIRS |
| 98 | S_incpush_use_sep(aTHX_ STR_WITH_LEN(PERL_OTHERLIBDIRS), |
| 99 | INCPUSH_ADD_OLD_VERS|INCPUSH_ADD_ARCHONLY_SUB_DIRS |