Skip to content

digikam: improvements - #10219

Merged
zimbatm merged 1 commit into
NixOS:masterfrom
jraygauthier:jrg/digikam_improvement_rebased_head
Mar 13, 2016
Merged

zimbatm merged 1 commit into
NixOS:masterfrom
jraygauthier:jrg/digikam_improvement_rebased_head

Conversation

@jraygauthier

Copy link
Copy Markdown
Member
  • Now usable in non kde desktop environments.

Build a immutable sycoca database and use
wrappers to tie programs to this
database and avoid interference from the
outside by specifying a fixed KDELIBS
and fixed/empty XDG_DATA_DIRS.

Added missing dependencies to syscoca
database so that the program is complete.

Added all build time optional packages.

Kipi-plugins now properly detected. Added
almost all optional dependencies so that
almost all plugins are usable.

Now with vlc phonon backend for video playback.

Now with ffmpeg thumbnailer for video items
thumbnail creation.

Now run without any error log.

Tests:

  • Ran most features of the standard program. Everything
    work perfectly without error logs.
  • Ran some of the kipi plugins. Work fine there too.
  • Ran face detection and fingerprint generation
    successfully.
  • Oxygen icons are now displayed properly.
  • Ran other wrapped executable successfully.

@jraygauthier

Copy link
Copy Markdown
Member Author

@goibhniu @viric @urkud

@jraygauthier
jraygauthier force-pushed the jrg/digikam_improvement_rebased_head branch 2 times, most recently from 7c5b7ce to e1a919a Compare October 5, 2015 12:25
@jraygauthier
jraygauthier force-pushed the jrg/digikam_improvement_rebased_head branch from e1a919a to 8048fa0 Compare October 5, 2015 17:22
@jraygauthier

Copy link
Copy Markdown
Member Author

I just tested the build at work using nix on top of ubuntu 14.04.

The application runs same as on top of nixos.

Only glitch/impurity it flushed out is the following:

building path(s) ‘/nix/store/a9rfxa0hryy9zsa2zdadhgk3i6a30hf2-digikam-sycoca-4.12.0’
kbuildsycoca4 running...
kbuildsycoca4(373)/kdecore (services) KServicePrivate::init: The desktop entry file  "/usr/share/applications/unity-scope-gdrive.desktop"  has Type= "Application"  but no Exec line 

kbuildsycoca4(373) KBuildServiceFactory::createEntry: Invalid Service :  "/usr/share/applications/unity-scope-gdrive.desktop" 
kbuildsycoca4(373)/kdecore (services) KServicePrivate::init: The desktop entry file  "/usr/share/applications/unity-lens-photos.desktop"  has Type= "Application"  but no Exec line 

kbuildsycoca4(373) KBuildServiceFactory::createEntry: Invalid Service :  "/usr/share/applications/unity-lens-photos.desktop" 
kbuildsycoca4(373)/kdecore (services) KServicePrivate::init: The desktop entry file  "/usr/share/applications/evolution-data-server-uoa.desktop"  has Type= "Application"  but no Exec line 

kbuildsycoca4(373) KBuildServiceFactory::createEntry: Invalid Service :  "/usr/share/applications/evolution-data-server-uoa.desktop" 
building path(s) ‘/nix/store/8lx2g1w4g5sm2ka94wzq7jpcq0q7zc0s-digikam-4.12.0’
building path(s) ‘/nix/store/c02ar6kqs9b3yhc51frpa3v4hadcqd21-user-environment’

We should definitly patch this kbuildsycoca4 program so that it does not search in /usr/share unless this directory is part of KDELIBS.

Addenda: Fixed by #10266.

@vcunat

vcunat commented Oct 7, 2015

Copy link
Copy Markdown
Member

As a general strategy, emptying $XDG_DATA_DIRS doesn't seem good. We use it on quite a few places, moreover the freedesktop standard says:

If $XDG_DATA_DIRS is either not set or empty, a value equal to /usr/local/share/:/usr/share/ should be used.

... so to get purity we should better set it to something fixed (and nixos already defines it by default, but there you typically don't have the /usr/{local,share} paths anyway).

@jraygauthier

Copy link
Copy Markdown
Member Author

I did some testing and it is possible to remove the wrapper's XDG_DATA_DIRS="" and digikam would run successfully. What I did like with the wrapper's nullification of XDG_DATA_DIRS is
that it would guarantee the soft would run the same way in one context or another. It also
removed a free variable when trying to debug what goes wrong with KDELIBS env.

The XDG_DATA_DIRS="" from the sycoca build merely guarantee to get the same build in
non pure nix-shell as you get in pure (as XDG_DATA_DIRS is not set in pure env).

Specifying only XDG_DATA_DIRS in the sycoca build result in the following runtime error:

digikam(13183)/kdecore (trader) KServiceTypeTrader::defaultOffers: KServiceTypeTrader: serviceType  "PhononBackend"  not found 
digikam(13183)/kdecore (trader) KServiceTypeTrader::defaultOffers: KServiceTypeTrader: serviceType  "KIPI/Plugin"  not found 
digikam(13183)/kdecore (trader) KServiceTypeTrader::defaultOffers: KServiceTypeTrader: serviceType  "Digikam/ImagePlugin"  not found

Specifying only XDG_DATA_DIRS in the wrapper and build result in the following runtime error:

digikam(14217)/digikam (core): The bundled profile "libkdcraw/profiles/srgb-d65.icm" cannot be found. Check your installation. 
digikam(14217)/digikam (core): The bundled profile "libkdcraw/profiles/srgb-d65.icm" cannot be found. Check your installation. 
digikam(14217)/digikam (core): The bundled profile "libkdcraw/profiles/widegamut.icm" cannot be found. Check your installation. 
digikam(14217)/digikam (core): The bundled profile "libkdcraw/profiles/prophoto.icm" cannot be found. Check your installation. 
digikam(14217)/digikam (core): The bundled profile "libkdcraw/profiles/srgb-d65.icm" cannot be found. Check your installation. 
digikam(14217)/digikam (core): The bundled profile "libkdcraw/profiles/srgb-d65.icm" cannot be found. Check your installation. 
digikam(14217)/digikam (core): The bundled profile "libkdcraw/profiles/srgb-d65.icm" cannot be found. Check your installation. 
WARNING: bool Phonon::FactoryPrivate::createBackend() phonon backend plugin could not be loaded 
WARNING: bool Phonon::FactoryPrivate::createBackend() phonon backend plugin could not be loaded 
WARNING: bool Phonon::FactoryPrivate::createBackend() phonon backend plugin could not be loaded 
WARNING: bool Phonon::FactoryPrivate::createBackend() phonon backend plugin could not be loaded 
WARNING: bool Phonon::FactoryPrivate::createBackend() phonon backend plugin could not be loaded 
WARNING: Phonon::createPath: Cannot connect  Phonon::MediaObject ( no objectName ) to  Phonon::AudioOutput ( no objectName ). 
WARNING: bool Phonon::FactoryPrivate::createBackend() phonon backend plugin could not be loaded 
WARNING: Phonon::createPath: Cannot connect  Phonon::MediaObject ( no objectName ) to  Phonon::VideoWidget ( no objectName ). 
WARNING: bool Phonon::FactoryPrivate::createBackend() phonon backend plugin could not be loaded 
digikam(14217)/kdecore (trader) KServiceTypeTrader::defaultOffers: KServiceTypeTrader: serviceType  "KIPI/Plugin"  not found 
digikam(14217)/kdecore (trader) KServiceTypeTrader::defaultOffers: KServiceTypeTrader: serviceType  "Digikam/ImagePlugin"  not found 
digikam(14217)/digikam (core) Digikam::DNotificationWrapper: parent is null 

Specifying both XDG_DATA_DIRS at sycoca build to same location (/share for xdg) seem fine.
However, this is redundant information and as such complicates debug.

@jraygauthier

Copy link
Copy Markdown
Member Author

Also specifying both to same locations at both place also work fine. Same redundancy argument hold.

@jraygauthier

Copy link
Copy Markdown
Member Author

Could be improve with #10308.

@cpages

cpages commented Oct 29, 2015

Copy link
Copy Markdown
Contributor

I think someone had changes in the pipe to make kde apps able to run without kde, in a more generic way. @ttuegel I think it was you?

@ttuegel

ttuegel commented Oct 29, 2015

Copy link
Copy Markdown
Member

@cpages I have nothing for KDE 4.

@jraygauthier

Copy link
Copy Markdown
Member Author

Hi @cpages, yes I drew my inspiration from @ttuegel work (immutable syscoca db). However,
to generalize to all kde4 packages in the same way as he did would take far more build time,
test time and nix fu that I actually can offer (which would be really great to do by the way)
so I tried to limit damage to this single package so as to avoid breaking any other.

One thing that this brings tough is that it proves the immutable sycoca database technique
is applicable to kde4 pakages (this is most likely one of the most complex kde4 package) as
well if anyone is ready to take the time required and as a bonus (which is what I needed in
the first place), a fully functional digikam application.

@ttuegel

ttuegel commented Oct 29, 2015

Copy link
Copy Markdown
Member

One thing that this brings tough is that it proves the immutable sycoca database technique
is applicable to kde4 pakages (this is most likely one of the most complex kde4 package) as
well if anyone is ready to take the time required and as a bonus (which is what I needed in
the first place), a fully functional digikam application.

I actually had to abandon the immutable-sycoca part of my project (for now). It seems most applications want to update the sycoca database at startup; maybe because the timestamp is so far in the past? This may not be a problem for KDE 4, YMMV.

@vcunat

vcunat commented Oct 29, 2015

Copy link
Copy Markdown
Member

It seems most applications want to update the sycoca database at startup

That shouldn't be hard to patch out, should it? AFAIK it's kded who's responsible for keeping it up to date.

@ttuegel

ttuegel commented Oct 29, 2015

Copy link
Copy Markdown
Member

@vcunat It's probably not hard to patch out, but it also doesn't matter as much for KDE 5. In KDE 4, the sycoca database tracks available plugins and services; there are many more of the former than the latter. In KDE 5, it only seems to track services; plugins are resolved by looking at QT_PLUGIN_PATH (automated through a setupHook). As long as the required services are in propagatedUserEnvPkgs and kbuildsycoca5 is available (again, automated through a setupHook), everything will work at runtime. Yes, immutable-sycoca would be ideal, but as long as everything actually works, it's not a priority for me.

@vcunat

vcunat commented Oct 29, 2015

Copy link
Copy Markdown
Member

I see.

@jraygauthier

Copy link
Copy Markdown
Member Author

@ttuegel: When launched from cli, the program indeed report an error in attempting at creating the
sycoca db when no other kde4 program have been started on the machine (i.e: no pre-existing kdeinit4 process). The error is:

kbuildsycoca4 running...
kbuildsycoca4: ERROR creating database '/nix/store/8b317fl841x6wfws9pzdy6wdlgdaymzp-digikam-sycoca-4.12.0/var/lib/kdesycoca/digikam-4.12.0.sycoca'! Insufficient permissions in target directory.

but seem harmless.

When I quit the application and start it again, I get no error.

I dug a little deeper at first and found out that this is an error thrown by the kdeinit4: kded4 [kdeinit] service launched by kdeinit4. This error can't be observed by launching the application
in the following way:

kdeinit4 --no-kded +digikam

which prevent the launch of the kded4 service.

I tried to patch the kded service in the following way:

diff --git a/kded/kded.cpp b/kded/kded.cpp
index e76b614..510bd07 100644
--- a/kded/kded.cpp
+++ b/kded/kded.cpp
@@ -84,6 +84,10 @@ extern QDBUS_EXPORT void qDBusAddSpyHook(void (*)(const QDBusMessage&));

 static void runBuildSycoca(QObject *callBackObj=0, const char *callBackSlot=0, const char *callBackErrorSlot=0)
 {
+   const bool skipSycocaBuild = true;
+   if (skipSycocaBuild)
+      return;
+
    const QString exe = KStandardDirs::findExe(KBUILDSYCOCA_EXENAME);
    Q_ASSERT(!exe.isEmpty());
    QStringList args;

to no avail (had the same problem).

@jraygauthier
jraygauthier force-pushed the jrg/digikam_improvement_rebased_head branch from 8048fa0 to 611b260 Compare March 6, 2016 03:53
 -  Now usable in non kde desktop environments.

    Build a immutable sycoca database and use
    wrappers to tie programs to this
    database and avoid interference from the
    outside by specifying a fixed `KDELIBS`
    and fixed/empty `XDG_DATA_DIRS`.

    Added missing dependencies to syscoca
    database so that the program is complete.

    Added all build time optional packages.

    Kipi-plugins now properly detected. Added
    almost all optional dependencies so that
    almost all plugins are usable.

    Now with vlc phonon backend for video playback.

    Now with ffmpeg thumbnailer for video items
    thumbnail creation.

    Now run without any error log.

Tests:

 -  Ran most features of the standard program. Everything
    work perfectly without error logs.
 -  Ran some of the kipi plugins. Work fine there too.
 -  Ran face detection and fingerprint generation
    successfully.
 -  Oxygen icons are now displayed properly.
 -  Ran other wrapped executable successfully.
@jraygauthier
jraygauthier force-pushed the jrg/digikam_improvement_rebased_head branch from 611b260 to d2c8919 Compare March 6, 2016 03:55
@jraygauthier

Copy link
Copy Markdown
Member Author

Rebased on top of latest master branch.

Now that kde applications for kde4 are no longer available, libkface and libkgeomap dependencies
could no longer be retrieved. Made those two optional via flags. When requested and
dependencies null, provide proper flags to cmake so that they are built by the digikam package.

Built and used. Everything still work fine.

@zimbatm

zimbatm commented Mar 12, 2016

Copy link
Copy Markdown
Member

@jraygauthier are you happy to merge ? There are still some possible improvements but it seems to be working and better than before so that could be done in another round of development.

@jraygauthier

Copy link
Copy Markdown
Member Author

@zimbatm, I think it would be nice if it was merged now and as you suggest improve it further with
other round of dev.

zimbatm added a commit that referenced this pull request Mar 13, 2016
@zimbatm
zimbatm merged commit 3472128 into NixOS:master Mar 13, 2016
@jraygauthier

Copy link
Copy Markdown
Member Author

Thanks a lot :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants