[3.0] Adds support for diffs in the package manager#8620
[3.0] Adds support for diffs in the package manager#8620Sesquipedalian merged 2 commits intoSimpleMachines:release-3.0from
Conversation
36690db to
1554b4d
Compare
|
I will add more info and some testing instructions soon. But right now it is very late here, so I am going to sleep. |
|
I want to review this when I get time to do so. I was thinking. Is there any difficulty splitting up boardmod, XML and diff logic into 3 classes that can then be used for parsing install/uninstall? |
3847272 to
29e9fd3
Compare
How to test:
Regarding the content of the package file
Here's the list of files inside the package archive: Here is the content of the test package's package-info.xml file: Here's a screenshot showing the expected install actions for the test package: Note how the package will create ./Sources/DummyClass.php even though there is no DummyClass.php file inside the archive. Also note the skipped changes to Config.php and derp.php. Those are the two diff blobs that have |
We could, but I don't see much reason to do so. With this change, I fully expect the XML and boardmod formats to rapidly fall into disuse, because why would anyone want to bother with those labour-intensive formats when they can just run a diff command and be done? That means that there's not much point in putting more work into Meanwhile,
We won't need to generate diffs for packages from within SMF, nor will we need to convert them into XML. The diffs will be created on developers' computers and then included in the package archives. We do already have code for generating a diff between two strings. We do it by feeding the two strings to |
We had discussed years ago about removing boardmod and ultimately kept it as it took no effort to maintain it. We have removed references to it in various places, and I don't think any mode since 1.x has used it. Its still around. The idea of classes was to make it easier to maintain them, and also we can easily drop support or add support for other methods. Not that I expect any new support, really, since diff is widely popular and supported by version control software. |
jdarwood007
left a comment
There was a problem hiding this comment.
All I had time to peak at.
29e9fd3 to
3d457eb
Compare
|
The only downside I see to this is manual installation. The XML format is relatively easy to read and is what people are used to. Reading diffs isn't that difficult once you know how, but everyone is used to the XML format, so we'll need to either implement our own diff parser on the mod site or point users to an option (Diffchecker, Online Diff or a similar option) so we can still support easy manual installation in the few instances where we still run into a conflict somewhere. |
|
The xml format could arguably be less readable than boardmod. I imagine
this was brought up whenever xml was introduced presumably in 1.1.
…On Thu, May 1, 2025 at 4:00 PM Michael Eshom ***@***.***> wrote:
*Oldiesmann* left a comment (SimpleMachines/SMF#8620)
<#8620 (comment)>
The only downside I see to this is manual installation. The XML format is
relatively easy to read and is what people are used to. Reading diffs isn't
that difficult once you know how, but everyone is used to the XML format,
so we'll need to either implement our own diff parser on the mod site or
point users to an option (Diffchecker, Online Diff or a similar option) so
we can still support easy manual installation in the few instances where we
still run into a conflict somewhere.
—
Reply to this email directly, view it on GitHub
<#8620 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADJNNYR7HVJ5WVA43KAY3324KRSVAVCNFSM6AAAAAB4E6EAG6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQNBVHE2TGNBRGM>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
|
The mod site can easily be extended to support diffs. The core logic of the mod site already uses the SMF logic to parse out the changes. That would have to happen after we upgrade the main site to SMF 3.0. |
0e94442 to
e7622d7
Compare
Signed-off-by: Jon Stovell <jonstovell@gmail.com>
Signed-off-by: Jon Stovell <jonstovell@gmail.com>
e7622d7 to
a16b5d3
Compare

These changes add support in the Package Manager for diff files as an alternative to modification.xml files.
The exciting part that you came here for:
This means, among other things, that creating patch files for SMF 3.0 will be as simple as running
git diffand putting the output directly into our patch packages. We will no longer need to laboriously craft a modification.xml, nor monkey around with scripts that try to convert a diff into a modification.xml. We'll just use the diff directly. This will be both incredibly easier and infinitely more reliable.Modification developers can also benefit greatly from this. For example, when a mod developer is ready to create an install package for their mod, they could simply run
diff -uon the command line to compare an unmodified copy of SMF with their modified copy, and then use the output directly in their package.Here is the documentation for PackageManager::parseDiff() and FullDiff::createFromRaw(), which explain how to generate diffs for use in the Package Manager:
A further benefit of using diffs in our packages is that packages will no longer need to include separate copies of any new files added to SMF by the package. One of the limitations of the modification.xml format is that it can only apply changes to existing files; in order to add a new file, we had to instead use
<require-file>in package-info.xml. But when using diffs, any and all new text-based files are included in the diff content and do not need to be handled separately. (Unfortunately, new or updated binary files cannot be handled by diffs and still need to be handled using<require-file>in package-info.xml.)"But wait," you say, "it looks like more is going on here..."
Why, yes. Yes, there is. The observant will notice that the first commit implements not only (1) the abstract SMF\Diff class and (2) the SMF\FullDiff class that is used for the Package Manager, but also (3) the SMF\EditDiff class which doesn't appear to be used for anything. What's going on here?
SMF\EditDiff is unused in this PR, but a future PR will use it to add support for tracking the edit history of posts, the registration agreement, and the privacy policy. The code for all of that is already written (it has been for a while now, actually). However, database changes are required in order to use this new edit history feature. That in turn means that before anyone besides me can start testing this edit history feature, we need to finish dealing with the upgrader rewrite. Then the rest of you will be able to run the upgrader in order to make the necessary database changes so you can test.