Ever since the new release system has gone in, we've had the notion of the "Drupal core compatibility" version for each module (e.g. "5.x", "6.x", etc). This is the first part of the version string, a vocabulary of taxonomy terms on d.o, etc, etc. As we all know and love, one major version of core is never compatible with another, and modules have to be ported. However, people often foolishly try to install older versions of a module with a newer version of core, and much confusion and support grief ensues...
Merlinofchaos and I have been thinking about this problem, and wished we could have solved it for D5, but the timing was wrong. So, while we still can, let's just make it so D6+ core refuses to ever enable a version of a module that doesn't explicitly state in its .info file that it's compatible with the same core API version.
Attached patch does the following:
- Introduces a new DRUPAL_CORE_COMPATIBLITY constant in system.module (currently with the value "6.x").
- Adds a
drupal = 6.xline to all core module and theme .info files. - Modifies the admin/build/modules page to check for this line in each .info file (much like it checks dependencies), and alters table rows for incompatible modules. The checkbox for the enabled/disabled status is completely removed, and replaced with the watchdog-error.png icon. The module's description has the text "This version is incompatible with the !core_version version of Drupal core" appended (where !core_version is actually the real VERSION, e.g. "6.0-dev", not "6.x", though that's easy to change).
screenshot coming in a follow-up.
TODO:
- themes?
- upgrade path? what about sites that already have some contribs installed, upgrade core, but forget to upgrade their contrib source? should we disable stuff from {system} in a db update if the .info file doesn't say we're upto 6.x source for that module yet?
- any other UI tweaks when something is incompatible?
even though there are these known TODO items, i'm starting this "needs review", to get feedback on the general approach, and the specific implementation so far, before i spend any more time on this.
| Comment | File | Size | Author |
|---|---|---|---|
| #32 | package-release-set-core-compatibility.patch.txt | 1.08 KB | dww |
| #31 | drupal_core_compatibility.patch_7.txt | 25.83 KB | dww |
| #28 | drupal_core_compatibility.patch_6.txt | 24.29 KB | dww |
| #25 | drupal_core_compatibility.patch_5.txt | 24.07 KB | dww |
| #19 | drupal_core_compatibility.patch_4.txt | 24.3 KB | dww |
Comments
Comment #1
dwwscreenshot
Comment #2
merlinofchaos commentedI think this is the right direction.
We *could* parse the drupal version out of the version = string, but using CVS without a proper tag will shoot that down; at that point, the version isn't guaranteed. However, this change would require all module authors to put drupal = 6.x into the .info file. This is very straightforward and easy to do.
To address the TODO items:
1) themes can use basically the same code quite easily.
2) a system_update_XX for Drupal 6 can scan module .info files and immediately deactivate modules that aren't compatbile with 6.x
3) I like this UI very much.
Comment #3
chx commentedyes, yes, YES! We can do more in later patches. Drupal support folks should raise Derek on their shoulders and carry him around.
Comment #4
dwwhehe, thanks for the encouraging words, chx. ;)
here's a new patch that includes the aforementioned DB update to automatically disable every module or theme in {system} that either:
- has no code installed at all (no .info present)
- doesn't define its drupal version (no 'drupal' in the .info)
- defines the wrong 'drupal' in the .info
tested it pretty thoroughly, but i'm setting this back to needs review, since this could use some independent testing and review. thanks.
Comment #5
kbahey commented+1.
Comment #6
dries commentedI think this is an important patch.
A couple of things:
1. Wasn't the idea to derive this from the existing version field that is part of the .info files?
2. The update stuff that merlinofchaos added should probably be a generic function that can be re-used in future releases. Something that always runs at the end of the update process. It might also be useful to have the function generate a status message.
3. What would be best? Using the error-icon or just graying out the checkbox? Not that it matters that much.
Comment #7
Stefan Nagtegaal commentedNOt displaying the checkbox at all, and giving the module description an error message suffixed, that says something like "This module is currently not compatible with you drupal version. Please update the module to be compatible with drupal $drupal_version."
Comment #8
merlinofchaos commentedDries, I already commented on why we're not parsing it out of the version string:
We *could* parse the drupal version out of the version = string, but using CVS without a proper tag will shoot that down; at that point, the version isn't guaranteed. However, this change would require all module authors to put drupal = 6.x into the .info file. This is very straightforward and easy to do.
The point being, we're trying to maintain the highest compatibility possible for people checking out via CVS. (Also, we're on a very good path for people being able to check out released versions from CVS, and the update status system being able to give them a list of CVS commands to do the update.)
Comment #9
dww@Stefan: please try the patch, or at least look at the screenshot: that's exactly what it does already.
@Dries: i don't quite follow your point #2, can you elaborate? re: #3 - i don't like greying out the checkbox, since we use that regarding dependencies. it's not just that you could install this module if you installed something else. the problem is that you need to completely replace the code before you could enable it.
@merlinofchaos, Dries: actually, parsing from the version string would be better. To best support CVS deployments via update_status in core, i think we're going to want to modify module_rebuild_cache() and system_theme_data() [1] to update the version info in the array each one returns, based on the goodness from http://drupal.org/node/146027 and http://drupal.org/node/146352. then, no matter *what* happens, we'll have the canonical human-readable name, and that's all we'd ever be parsing. the only place this goes wrong is pure HEAD checkouts, but i really don't care about that.
re: themes -- .info files for themes are new in D6, so even if we were incredibly lame and didn't do anything else with themes, the functionality in this issue would still work for themes in D6. it'd be just like the .info files for D5 modules: any theme without a .info obviously couldn't load in D6 core. but, it'd be easy enough to expand this functionality to the themes page as a separate patch after this lands.
attached patch is just the changes in in modules/system/*, and operates on parsing human-readable version strings. once update_status moves into core, we'll have even better support for CVS deployments, and things will still work fine regarding this patch, without the need for this new attribute in all .info files.
thanks,
-derek
[1] side note: it'd be great to unify those 2 into a consistently named API. see http://drupal.org/node/147000
Comment #10
dwwupon further consideration, patch from #4 might be better, after all. while the CVS stuff can be solved as i explained above, i had another thought on why a separate .info attribute might be better: non-drupal.org contributions. while it's easy for us to parse our own version strings that follow the d.o conventions, what about other modules that might have their own version strings, conventions, etc? seems a little lame to force them to start their versions "6.x-*", regardless of what their existing naming/numbering convention is. although, maybe that's a feature, not a bug. ;) anyway, by using a separate
drupal = 6.x, we solve this problem, since folks can add that to their own .info files, and we don't force their version numbers to match our expectations.honestly, i can see both sides of this (and have already provided patches for each), so i'll let Dries and others decide which approach they prefer.
cheers,
-derek
Comment #11
david straussI would rather the variable be named something more semantic than "drupal." How about "core"?
Comment #12
dries commented"actually, parsing from the version string would be better."
If the only problem is pure HEAD checkouts, then maybe we need to fix that instead? Not sure how it could be fixed. Might be as simple as falling back to a global define in the code. We'd just assume that VERSION means the "latest version" and therefore is always compatible with everything else VERSION. :)
Comment #13
merlinofchaos commentedThere are two problems:
Pure HEAD checkouts and modules that don't put a default version = string in their .info file. Technically the latter is incorrect. But the pure HEAD checkout problem is worse than that, because HEAD is by definition moving in compatibility.
I think it'd be better for all concerned to go with a specific core compatibility string.
I wouldn't want to go with just 'core' and I think 'core compatibility' is too long. 'core version = 6.x' might work instead of 'drupal = 6.x'. That's ok too.
Comment #14
david strauss@merlinofchaos If you're looking for short, how about "system"?
There's also the opportunity to offer a more general solution here. We could allow dependencies to specify version numbers. Because Drupal has a System module, we could use that in dependencies to link the module to a specific core version.
Possible syntax:
dependencies = system:6 views:2
And in Drupal 11:
sudo apt-drupal install views panels ecommerce
(That last thing is only a half-joke. There's a team here in Austin that's going to manage Drupal installations on their web server appliances through Aptitude.)
Comment #15
dwwi don't think "system" is any more clear or semantic than "drupal". i'd vote for "drupal core" since on d.o, this taxonomy is refered to as the "Drupal core compatibility", and i think everyone will understand what "drupal core = 6.x" means in a .info file.
re: a separate attribute vs. parsing version string. HEAD checkouts is one problem. the more difficult to solve problem is what about versions for external things? for example, see the whole thread on the devel list about 3rd party libraries and plugins. what if someone wants to either:
a) host a module elsewhere, and use their own version numbering scheme that makes more sense for them? they'd have to prepend "6.x-" to their version strings if we're just parsing that directly, which could be lame.
b) include a drupal "module" that really just provides a given 3rd party plugin, which is then shared among many actual drupal contribs? in that case, the version of the thing should really be the version of the given plugin, and it's a separate attribute about whatever version of core this plugin is targetted for (e.g. jQuery 1.0.x == drupal 5.x, vs. jQuery 1.1.x == drupal 6.x, etc).
re: version-specific dependencies -- that's a nice idea, but a huge can of worms that's already been discussed at length before. don't have time right now to track down the nids and threads of interest. i think that's way too ambitious for D6, so i'd rather just see this patch (or something like it) go in now, and if we want to try to do version-specific dependencies in D7, fine with me.
if there's agreement on "drupal core" or "core version", i think those are my 2 favorites. i'd roll patches, but i'd rather just decide a name first and then do the work. the logic is trivial based on my existing patches above.
Comment #16
dwwoh, i should add: i'd rather completely break things for pure HEAD checkouts, than make assumptions like "HEAD must mean the latest drupal core, whatever that is". that assumption was the root of much evil in drupal's history, and destroying it was a goal of mine all along with the release system and now this issue. please don't drag us back into the dark ages with this assumption. ;)
seriously, please read comment #4 at http://drupal.org/node/124661 about how to best support CVS deployments.
Comment #17
dries commentedThanks for the clarifications dww and merlinofchaos -- I trust your judgement to get this right. Your explanation seems to make sense, so if you truly think this is the way to go, feel free to mark this RTBC. :-) The variable name 'core = ' or 'drupal =' works fine for me.
Comment #18
dwwre-roll for system.install conflicts. retains "drupal = 6.x", since Dries, merlin and myself all agree that's fairly self-explainatory, and i think overall, a separate attribute is better than parsing the version string.
Comment #19
dwwanother re-roll to avoid fuzz. can someone else please RTBC this so it gets in ASAP? thanks!
Comment #20
david straussI can't RTBC the patch as is for a very non-technical reason: I don't think it's a good to use the Drupal name in an intrinsic, functional part of the code. Drupal is a trademark that represents the CMS as released by the quality team of people here, but Drupal is also GPL software, and maintaining the "right to fork" is part of that licensing model. If we integrate trademarked terms into the functional code, we hinder that.
I understand that the name Drupal should be part of the distributed software, but there's a big difference between putting it in strings destined for the UI and making it a hard-coded part of functionality.
I realize this wouldn't be the first time "Drupal" is used in some intrinsic way in core, but I'd like to prevent further proliferation.
I don't have any intention of forking; this is just the free software advocate in me speaking out.
Comment #21
kbahey commenteddww
Any reason for using 6.x and not just 6?
Comment #22
merlinofchaos commentedkbahey: Only consistency. It's 6.x most everywhere else.
Comment #23
dwwok, after a brief discussion in IRC, we converged on "core". 1 second and i'll re-roll this.
Comment #24
webchickAlso, users have been confused before about whether or not "4.6" modules worked with "4.6.11". The ".x" makes it clear that it works with any.
Comment #25
dwwnew patch that uses "core" and fixes the conflict in system.install.
(this is now properly back to needs review now, after the collision with webchick's previous comment).
Comment #26
david straussI like this patch. :-)
Comment #27
dries commentedshould probably be:
Shouldn't system_update_6024() be a generic function? Do we have to write a similar version when going from Drupal 6 to Drupal 7? It looks like something that should run after every upgrade?
Not something to do with this patch, but this looks like an inconsistency in the APIs:
Comment #28
dwwre: incompatible: fixed.
re: Shouldn't system_update_6024() be a generic function? Do we have to write a similar version when going from Drupal 6 to Drupal 7? It looks like something that should run after every upgrade?
great point. new patch moves it into update_fix_core_compatiblity() in update.php, which is called on *every* visit to update.php from here on out. ;) why not? better safe than sorry, right?
re: inconsistency in the APIs: see my comment #9 above and http://drupal.org/node/147000 ;)
Comment #29
dries commentedThanks for making the recommended changes. The updated patch looks good. I have no further comments.
Comment #30
dwwin that case...
Comment #31
dwwnote: as soon as this lands, i'll add code to the packaging script to automatically set this attribute when it's adding the proper version string to the .info files. i'll also update the upgrade docs to mention this as part of the changes to .info files in D6. however, do you think this is CHANGELOG.txt worthy? if so, attached patch adds the following line to the "Usabilty" section of the changelog:
* Only allow modules and themes to be enabled that have explicitly been ported to the right core API version.
feel free to modify when you commit if you don't like that wording. ;) the patch also fixes a minor typo in CHANGELOG.txt i noticed while adding this new entry.
Comment #32
dwwFYI: here's the patch for package-release-nodes.php for once this feature hits core. already tested on s.d.o and it works fine.
note: unlike core itself, the d.o packaging script is free to just parse the version string to find this info, since it knows that all projects on d.o have consistently formatted version strings. we could also query the DB for the "Drupal core compatibility" taxonomy term for each release node, but that doesn't seem necessary. also, note that this would add the core = "5.x" line to newer 5.x packages, too, but there's no harm there, since 5.x core just ignores this attribute.
Comment #33
dries commentedCommitted to CVS HEAD. Thanks.
Comment #34
dwwExcellent, thanks!
Now pending:
- Upgrade docs for modules and themes
- The .info file docs
- Committing that patch to the packaging script and installing it on d.o
Stay tuned. ;)
Comment #35
dww6.x module upgrade docs done: http://drupal.org/node/114774#info-core
6.x theme .info file docs done: http://drupal.org/node/137062
Not sure what to do about 6.x module .info file docs, since it seems like we either need to fork http://drupal.org/node/101009 or split it up into subsections for each core version or something. However, there's already a doc issue about this: http://drupal.org/node/137069
Modified version of the above patch commited to the packaging script: http://drupal.org/cvs?commit=69766
I decided to not include the
core = 5.xline on 5.x modules. I'll see if anyone actually would prefer we started doing that. However, there are tons of existing 5.x .info files that don't have it, so I think it's cleaner to just treat this line like the existance of the .info files for 5.x -- if it's not there, it must not be 6.x yet.Yay, all fixed. ;)
Comment #36
(not verified) commented