GNOME Bugzilla – Bug 647834
Stop using deprecated API in plug-ins
Last modified: 2011-11-10 02:08:06 UTC
In the GIMP 2.8 development cycle some plug-in API was deprecated, but not all plug-ins are ported to the new API, causing runtime warnings. Run for example Filters -> Light and Shadow -> Drop Shadow to see some warnings. We need to fix this all of these before we can release 2.8. As a side note, it would be nice to get warnings during compile time rather than run-time...
Created attachment 186508 [details] Tar containing all patch files I checked all script-fu-files for deprecated function calls and ported them to 2.8 where necessary. Here's a list of my modificaions: Works in 2.7? (x=no modifications needed, p=patched) [x] font-map.scm [x] copy-visible.scm [x] select-to-image.scm [p] starscape-logo.scm [p] t-o-p-logo.scm [x] beveled-pattern-hrule.scm [p] chrome-logo.scm [x] difference-clouds.scm [x] distress-selection.scm [x] comic-logo.scm [x] guides-remove-all.scm [x] text-circle.scm [x] chrome-it.scm [x] swirltile.scm [p] predator.scm [p] truchet.scm [p] beveled-button.scm [p] alien-neon-logo.scm [p] perspective-shadow.scm [p] frosty-logo.scm [x] rendermap.scm [p] alien-glow-bullet.scm [p] news-text.scm [x] guides-from-selection.scm [x] grid-system.scm [p] reverse-layers.scm [x] blend-anim.scm [p] chip-away.scm [p] addborder.scm [x] spinning-globe.scm [x] circuit.scm [x] palette-export.scm [x] contactsheet.scm [p] selection-round.scm [x] ripply-anim.scm [p] mkbrush.scm [p] alien-glow-logo.scm [p] glowing-logo.scm [x] clothify.scm [x] paste-as-brush.scm [p] beveled-pattern-bullet.scm [x] script-fu-set-cmap.scm [x] gimp-online.scm [x] paste-as-pattern.scm [x] guides-new.scm [x] land.scm [x] add-bevel.scm [p] neon-logo.scm [p] sota-chrome-logo.scm [x] carved-logo.scm [p] swirly-pattern.scm [p] erase-rows.scm [x] unsharp-mask.scm [p] drop-shadow.scm [p] burn-in-anim.scm -> throws error using "PREPARE FOR GIF" [p] alien-glow-arrow.scm [x] camo.scm [p] lava.scm [x] spyrogimp.scm [x] flatland.scm [p] textured-logo.scm [p] coffee.scm [p] chalk.scm [p] script-fu-util.scm [p] beveled-pattern-button.scm [p] fuzzyborder.scm [p] basic2-logo.scm [p] gradient-bevel-logo.scm [p] speed-text.scm [p] weave.scm [x] waves-anim.scm [x] guides-new-percent.scm [p] beveled-pattern-arrow.scm [x] ts-helloworld.scm [p] i26-gunya2.scm [p] alien-glow-bar.scm [x] select-to-pattern.scm [x] tileblur.scm [p] blended-logo.scm [x] beveled-pattern-heading.scm [p] slide.scm [p] crystal-logo.scm [x] carve-it.scm [x] 3d-outline.scm [x] gradient-example.scm [x] bovinated-logo.scm [p] pupi-button.scm [p] 3dTruchet.scm [x] old-photo.scm [p] basic1-logo.scm [p] xach-effect.scm [p] round-corners.scm [p] coolmetal-logo.scm [x] script-fu-util-setpt.scm [p] line-nova.scm [p] title-header.scm [p] alien-glow-button.scm [p] select-to-brush.scm [p] glossy.scm [p] test-sphere.scm
Thanks a lot for help with this. Could you please create a single patch with git format-patch instead? It is a bit troublesome to apply the patches in the format you provided. Also, how did you look for deprecated API? Through some script analyzing the source code?
Created attachment 186532 [details] [review] Patch file containing all script-fu changes I finally figured out how to create a git patch (first time working with git) and hope that is what you was asking for. I found the deprecated scripts by simply manually executing them in GIMP. No script or the like.
Yep the patch format is correct, thanks. To make it easier to review though and more atomical and to the point, could you remove changes that are not necessary for the API update? For example changing order of parameters of center-ellipse in 3dTruchet.scm
Created attachment 186783 [details] [review] Patch file containing all script-fu changes Here you go, the patch without any unnecessary changes.
Thank, that looks excellent! :)
The patch looks good now that it doesn't change the parameter order for some procedures. It will take a while to review the changes in the 57 scripts modified by the patch. The scripts also need to be checked to ensure their behaviour won't be altered by changes in the global context now that some PDB procedures are affected by context settings.
I just made a commit so that we can list all remaining uses of deprecated APIs. After your patch is applied the number of uses of deprecated functions goes from 140 to 55 so it's a big improvement. Thanks! And many of the remaining uses of deprecated API is actually old and not newly introduced. IMO we should get your patch in and then close this bug as FIXED. The warnings we get in the development version won't show in the stable version anyway when the PDB compatibility mode becomes GIMP_PDB_COMPAT_ON rather than the current GIMP_PDB_COMPAT_WARN. commit 28983a5158196eb634050f8e22439cc7fc640b6a Author: Martin Nordholts <martinn@src.gnome.org> Date: Thu May 5 00:58:08 2011 +0200 app: Add a "check-for-deprecated-procedures-in-script-fu" make target Add a "check-for-deprecated-procedures-in-script-fu" make target that looks for usage of deprecated procedures in *.scm files. We currently use quite a bit of deprecated procedures. When we don't do that anymore, we should connect this to make check somehow so our nightly build fails if someone deprecated a procedures without also porting all clients. Run it like this from the source root: make -C plug-ins/script-fu check-for-deprecated-procedures-in-script-fu
Created attachment 200772 [details] [review] Another patch No, this script is wrong. grep treats - as a non-word character, so `grep -w gimp-text` finds gimp-text-font, for example. Moreover, some calls are commented out, so we should not worry about them. In fact, after applying br0cc0li's patch only 4 deprecated function calls remain. This patch fixes Martin's diagnostic script and the few remaining deprecated function calls. Also, I replaced the script's inner loop with a regexp, so now it is much faster. I did not test select-to-image.scm though, since I could not find how to run it.
commit ecd1cb09c410a23e014302ef94cbea6eeb8d0df5 Author: Kevin Cozens <kcozens@svn.gnome.org> Date: Sun Nov 6 15:55:45 2011 -0500 Second stage in removing use of deprecated functions in Script-Fu scripts Applied most of the mega patch from br0cc0li (see bug #647834) with additional de-tabbing and changes in whitespace.
Review of attachment 200772 [details] [review]: This patch mixed script updates with a change to a Makefile preventing the use of this patch as is. The script update portion of the patch can be extracted and used separately. The Makefile issue should be filed separately.
Review of attachment 186783 [details] [review]: This patch has been commited (see comment #10)
I removed the Makefile change from Alexis' patch and applied it with a different commit message. commit 150c274a7d8add0e9b8b68d43a9af6469b189cbc Author: Alexis Wilhelm <alexiswilhelm@gmail.com> Date: Sat Nov 5 20:13:02 2011 +0100 Removed use of deprecated functions in two Script-Fu scripts (bug #647834)
Created attachment 200901 [details] [review] Fix the few remaining deprecated function calls after br0cc0li's patch
Created attachment 201048 [details] [review] Fix remaining deprecated function calls While testing a patch for bug #663576 I noticed that some deprecated functions remained in slide.scm.
The list of commits which removed the use of deprecated functions are: commit 27bef34bd550320706b90a4fa29130c7022b2111 Author: Kevin Cozens <kcozens@svn.gnome.org> Date: Wed Nov 9 02:42:34 2011 -0500 Don't change global context and protect scripts from global context settings. commit 05d4e788300a3a796e4b1b85b5871bad91c1e6f7 Author: Alexis Wilhelm <alexiswilhelm@gmail.com> Date: Sat Nov 5 20:13:02 2011 +0100 Removed use of deprecated functions in two Script-Fu scripts (bug #647834) commit 176773dcfe07e15c38d8a7802353d4603d75c9c6 Author: Kevin Cozens <kcozens@svn.gnome.org> Date: Sun Nov 6 15:55:45 2011 -0500 Second stage in removing use of deprecated functions in Script-Fu scripts Applied most of the mega patch from br0cc0li (see bug #647834) with additional de-tabbing and changes in whitespace. commit 0bd1c2f09f54359d192e190467b06bb6deea8e66 Author: Kevin Cozens <kcozens@svn.gnome.org> Date: Thu Nov 3 22:29:49 2011 -0400 Fix previous script-fu deprecation commit due to overzealous update script. commit 5e015aebbaaa663d03cc6f47a58cbeaf56b08418 Author: Kevin Cozens <kcozens@svn.gnome.org> Date: Sun Oct 30 02:37:26 2011 -0400 First stage in removing use of deprecated functions in Script-Fu scripts This commit replaces the names of deprecated procedures with the name of the new procedure where the new procedure takes the same argument list.
Created attachment 201103 [details] [review] Fix remaining deprecated function calls How embarrassing, I attached the wrong patch to my previous comment :'( I just rebased, and there is still gimp-rect-select in slide.scm.
Indeed.
Review of attachment 201103 [details] [review]: Thanks for spotting this, Alexis. There's often one that slips through the cracks when dealing with a lot of changes in many files.
commit dc25d699a9f0e5ebc8ca861f1e8b3c1611f7b6a9 Author: Kevin Cozens <kcozens@svn.gnome.org> Date: Wed Nov 9 19:14:10 2011 -0500 slide.scm: Don't use deprecated procedures (Fixes bug #647834) Spotted by, and patch from, Alexis Wilhelm with white space changes and a missing context-set added.