Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#24433 closed update (fixed)

kmymoney : updated port file + starter .app

Reported by: mkae (Marko Käning) Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version:
Keywords: haspatch maintainer Cc: pixilla (Bradley Giesbrecht)
Port: kmymoney

Description

Hi,

attached you'll find a tar including an updated port file which brings kmymoney's latest version 1.0.4 to MacPorts.

Bradley Giesbrecht and me also tried to make the kmymoney port a bit more user-friendly. He initiated the development of a little starter .app which is accessible from "Applications/MacPorts".

This little .app doesn't only show kmymoney's fancy icon, but also checks for correct settings of permissions of .kde folder as well as files .ICEauthority and .Xauthority. Unfortunately these are candidates to have root ownership in a normal user's home directory if the latter used "sudo port install" for installation of KDE ports https://bugs.kde.org/show_bug.cgi?id=233892. The .app will offer to fix them for the user on each kmymoney start-up.

This portfile actually uses (configure|build).env directives to avoid creation of folders/files with root permissions in the user's dir, but probably most other KDE ports would still show this unwanted behavior.

Also KDE dependencies have been stripped down to kdelibs3.

Since kdelibs-3.10.5, however, there is the issue that the program complains about a not running dcopserver at startup, but clicking the warning away doesn't stop the kmymoney from working properly.

Greets, Marko

Attachments (16)

kmymoney-1.0.4+.app.tar.gz (261.6 KB) - added by mkae (Marko Käning) 15 years ago.
tar archive containing updated port file as well as the starter .app as a tar.gz
kmymoney-1.0.4.app.tar.gz (261.6 KB) - added by mkae (Marko Käning) 15 years ago.
Another updated tar archive containing updated port file as well as the starter .app as a tar.gz (now using stat to determine state of directory and files)
main.applescript (1.8 KB) - added by mkae (Marko Käning) 15 years ago.
Apple script being main component of KMyMoney.app
kmymoney_takanori.diff (1.8 KB) - added by takanori@… 15 years ago.
kmymoney_1.0.4_1_takanori.diff (6.6 KB) - added by takanori@… 15 years ago.
kmymoney_1.0.4_1_takanori_2.tar.gz (2.8 KB) - added by takanori@… 15 years ago.
kmymoney_1.0.4_1_takanori_2.diff (6.7 KB) - added by takanori@… 15 years ago.
Here is a diff file. Just in case.
main.2.applescript (3.2 KB) - added by mkae (Marko Käning) 15 years ago.
apple script w/o line breaks to avoid UTF-8/ISO-8859 issues with AS editor
kmymoney-1.0.4.tar.gz (252.7 KB) - added by mkae (Marko Käning) 15 years ago.
Sorry, there was an error with undefined variable kmymoney. Now fixed.
main.3.applescript (3.5 KB) - added by mkae (Marko Käning) 15 years ago.
This version uses 'tell application "X11"' instead of a shell command and uses the correct way to check for existence of kmm's executable.
main.4.applescript (3.5 KB) - added by mkae (Marko Käning) 15 years ago.
Ooops, there were still 2 line-breaks in it. (Now "file main.applescript" returns "ASCII with very long lines".)
kmymoney-1.0.4_3.tar.gz (33.5 KB) - added by mkae (Marko Käning) 15 years ago.
This port version has applet.icns without the 2 biggest icons (reducing it's size to only 50 kB). [Uploaded using Firefox.]
kmymoney-1.0.4_3.tar.2.gz (33.5 KB) - added by mkae (Marko Käning) 15 years ago.
Dito. [Uploaded using Safari]
kmymoney-1.0.4_4.tar.gz (33.3 KB) - added by mkae (Marko Käning) 15 years ago.
Rename apple script from main.applescript to KMyMoney.applescript [Firefox upload]
kmymoney-1.0.4_5.tar.gz (33.5 KB) - added by mkae (Marko Käning) 15 years ago.
OK, couldn't withstand to deliver the fix concerning X11's shell window. (Now we again use a shell call instead of "tell application 'X11'".)
Portfile (2.7 KB) - added by mkae (Marko Käning) 15 years ago.
Portfile for 1.0.4_6 (now using xinstall instead of system for file copying)

Download all attachments as: .zip

Change History (54)

Changed 15 years ago by mkae (Marko Käning)

Attachment: kmymoney-1.0.4+.app.tar.gz added

tar archive containing updated port file as well as the starter .app as a tar.gz

comment:1 Changed 15 years ago by mf2k (Frank Schima)

Keywords: haspatch maintainer added

I am not able to download the attachment. Can you upload again without the '+' sign?

comment:2 Changed 15 years ago by takanori@…

Hi,

Replying to MK-MacPorts@…:

Since kdelibs-3.10.5, however, there is the issue that the program complains about a not running dcopserver at startup, but clicking the warning away doesn't stop the kmymoney from working properly.

I tried to fix this problem in kdelibs3 @3.5.10_6. For more detailed instructions, please see #15208. Thanks.

comment:3 Changed 15 years ago by mkae (Marko Käning)

Hi Takanori,

I uploaded the tar without the plus - as you probably noticed already.

Right now I am building your revision 6 of kdelibs3 port...

Hope your fix will solve my problem.

I'll let you know how it worked out.

Greets, Marko

comment:4 Changed 15 years ago by mkae (Marko Käning)

Your fix worked for me fine! :)

No error message box anymore!

Thanks a lot!

Changed 15 years ago by mkae (Marko Käning)

Attachment: kmymoney-1.0.4.app.tar.gz added

Another updated tar archive containing updated port file as well as the starter .app as a tar.gz (now using stat to determine state of directory and files)

comment:5 Changed 15 years ago by takanori@…

A few thoughts about your patch:

  • Creating 'home_temp' directory is not necessary. HOME=${workpath} would be enough.
  • The source code of KMyMoney.app is not included. This is not permitted because KDE and its related programs should be released under the GPL. And basically, providing a program in binary form only is not a good idea.

comment:6 Changed 15 years ago by mkae (Marko Käning)

  • Creating 'home_temp' directory is not necessary. HOME=${workpath} would be enough.

This was deliberately made to have a defined location for creation of the .kde directory. But I'll consult Brad, since I guess you are right.

  • The source code of KMyMoney.app is not included. This is not permitted because KDE and its related programs should be released under the GPL. And basically, providing a program in binary form only is not a good idea.

The KMyMoney.app is a package and its contents can be viewed the Finder whereas the calling script is openend with Apple's Script Editor. If you think this is not enough, I'll submit the script separately as simple ascii text.

Changed 15 years ago by mkae (Marko Käning)

Attachment: main.applescript added

Apple script being main component of KMyMoney.app

comment:7 Changed 15 years ago by mkae (Marko Käning)

The KMyMoney icon contained in the package is GPL.

Takanori, please let me know what the rules of the game are in this case.

  • How to proceed now?
  • How shall I bundle the package, the script and the KMyMoney icon copyright statement together?
  • It seems to be necessary to have a GPL comment in main.applescript as well...

comment:8 Changed 15 years ago by takanori@…

Marko, I'd like to commit your patch without KMyMoney.app for now, like the following. Can I commit this patch? Thanks in advance.

Changed 15 years ago by takanori@…

Attachment: kmymoney_takanori.diff added

comment:9 Changed 15 years ago by mkae (Marko Käning)

Yep, Takanori, that's fine with me, please commit the patch w/o the .app until we've clarified together how we have to bundle the GPL'ed icon as well as our own script code inside the application package in such a way that do not violate the GPL.

comment:10 Changed 15 years ago by takanori@…

Resolution: fixed
Status: newclosed

committed in 66409 - thanks!

comment:11 Changed 15 years ago by mkae (Marko Käning)

Takanori, please also have a look at port kmm_banking, since kmymoney is as a dependency closely related:

http://trac.macports.org/ticket/24442

Please keep me posted about how to proceed with the .app package. (Mentioning it, since I saw you closed this ticket.)

comment:12 Changed 15 years ago by pixilla (Bradley Giesbrecht)

I chose home_temp as a safe to avoid collisions.

KMyMoney.app does not change the source code nor extend kde or kmymoney, it simply checks the owner of some files and issues the a shell command to start kmm. KMyMoney.app is a shell script wrapped in an applescript app. The source is included in the KMyMoney.app. Remove the picture although I thought we had permission to use it. Done. It's a script.

takanori: "This is not permitted because KDE and its related programs should be released under the GPL". Which is it, "not permitted" or "should"?

I have never thought of a script, like rc scripts, cron job scripts or launchd plists as needing to be GPL'ed because they touch a GPL file.

comment:13 in reply to:  12 Changed 15 years ago by takanori@…

Resolution: fixed
Status: closedreopened

Replying to brad@…:

The source is included in the KMyMoney.app.

Okay, I confirmed it. I tried "open KMyMoney.app/Contents/Resources/Scripts/main.scpt" and I could open the source code. # Sorry I am not familiar with AppleScript.

By the way, I have some new questions:

  • Is "KMyMoney.app/Contents/MacOS/applet" an interpreter? If so, is it redistributable?
  • I found some hard-coded '/opt/local/' in the script. If MacPorts is installed outside of /opt/local, this script won't work well. Is there any way to fix/avoid this issue?

Replying to brad@…:

KMyMoney.app does not change the source code nor extend kde or kmymoney

I know, but KMyMoney.app may be considered as a part of the program even if it is a script. Please consider to distribute your code under the GPL (or GPL-compatible Software license, such as New BSD.)

Unless your script is released under the FLOSS license, someone who want to modify and redistribute your program can't do it, as you know.

Regards,

comment:14 Changed 15 years ago by mkae (Marko Käning)

I see the point you make concerning the icon we use courtesy of KMyMoney developers.

I did ask the developers and they said it's fine to use the icon as long as we keep it GPL, if licensed at all.

It's close to pointless to license our short script, since it contains almost less lines than the short version of the GPL. :)

Well, I included it now in a clear-text apple-script file, which gets converted on the fly into an .app package on the system installing the port. Additionally the icon set from the .icns file gets copied into the right place inside that .app package.

Also I removed the hard-coded paths. I understood that a properly installed MacPorts wouldn't need the path to the kmymoney binary after all. (If the user wants to override something there is still .profile in case of need.)

So, that's all for now. (I'll overwrite the tar file!)

Except the images no binaries involved anymore!

comment:15 Changed 15 years ago by mkae (Marko Käning)

Hi Takanori,

this is our final version for now.

I think the current version should satisfy all needs.

Greets, Marko

comment:16 Changed 15 years ago by takanori@…

Hi Marko,

Your final version looks OK except only 3 points.

1) I had to convert the encoding of the apple script from larin1 to utf8, since it failed to compile on my Mac due to the following error:

--->  Staging kmymoney into destroot
Error: Target org.macports.destroot returned: shell command "osacompile -o /opt/local/var/macports/build/_Users_takanori_Sources_macports-trunk_dports_kde_kmymoney/work/destroot/Applications/MacPorts/KMyMoney.app /opt/local/var/macports/build/_Users_takanori_Sources_macports-trunk_dports_kde_kmymoney/work/kmymoney2-1.0.4/main.applescript" returned error 1
Command output: /opt/local/var/macports/build/_Users_takanori_Sources_macports-trunk_dports_kde_kmymoney/work/kmymoney2-1.0.4/main.applescript:69: error: Expected expression but found unknown token. (-2741)

Error: Status 1 encountered during processing.
Before reporting a bug, first run the command again with the -d flag to get complete output.

2) The icon file should be downloaded on demand since it is a bit large.

3) ${prefix}/bin/kmymoney should be called via login shell like the following. Without this change, I couldn't call kmm_banking plugin from KMyMoney.app.

from:
    do shell script "__PREFIX__/bin/kmymoney > /dev/null 2>&1"
to:
    do shell script "$SHELL -l -c __PREFIX__/bin/kmymoney > /dev/null 2>&1"

I fixed these problems in kmymoney_1.0.4_1_takanori.diff so could you please test it? If there is no problem, I'll commit it later.

Thanks.

Changed 15 years ago by takanori@…

comment:17 Changed 15 years ago by pixilla (Bradley Giesbrecht)

Hi Takanori,

Applescripts by default use sh for a shell.

Do your -l and -c switches work with any shell the user may have in their env for $SHELL?

Just asking because I have very little knowledge of non-sh based shells. I don't see -l in man zsh for example.

The following fails on my system. do shell script "csh -l -c /opt/local/bin/kmymoney > /dev/null 2>&1"

How about the following? Every mac is pretty much guaranteed to have sh (bash). do shell script "sh -l -c /opt/local/bin/kmymoney > /dev/null 2>&1"

-- Brad

comment:18 in reply to:  17 Changed 15 years ago by takanori@…

Hi Brad,

Replying to brad@…:

The following fails on my system. do shell script "csh -l -c /opt/local/bin/kmymoney > /dev/null 2>&1"

Oops, sorry! You're right. I didn't notice about that. :-(

Replying to brad@…:

How about the following? Every mac is pretty much guaranteed to have sh (bash). do shell script "sh -l -c /opt/local/bin/kmymoney > /dev/null 2>&1"

Well, if a user is using tcsh or something, and he/she haven't configured $PATH in ~/.bash_profile, this command may not work as expected.

I think

do shell script "PATH=__PREFIX__/bin:$PATH; export PATH; __PREFIX__/bin/kmymoney > /dev/null 2>&1"

would be better.

I confirmed that I could call kmm_banking plugin from kmymoney.app by using this command. (please check kmymoney_1.0.4_1_takanori_2.tar.gz)

Regards,

Changed 15 years ago by takanori@…

Changed 15 years ago by takanori@…

Here is a diff file. Just in case.

comment:19 Changed 15 years ago by mkae (Marko Käning)

Hi Takanori,

I am using kmm_banking regularly with the portfile I submitted without the problem you described.

I do not see why this

do shell script "PATH=__PREFIX__/bin:$PATH; export PATH;
__PREFIX__/bin/kmymoney > /dev/null 2>&1"

should change anything for kmymoney, since it is called with a hard-coded path and the kmm_banking plugin would not need the PATH env var anymore...

I suggest, you try this one here:

do shell script "__PREFIX__/bin/kmymoney"

watch the output in the shell window.

I wonder whether this gives you additional info about what's actually going on.

Greets, Marko

comment:20 Changed 15 years ago by mkae (Marko Käning)

After your conversion to UTF-8 now I CAN NOT compile anymore... Same error message on my side now.

For some reason the file needs to have ISO-8859 charset, since that's the way my Apple Script Editor saved it!

I am surprised myself that my ASE saved it in this charset, since all other files are in UTF-8 here.

I guess this can be avoided - as a hot-fix - by simply removing some line breaks... Will do that and repost the port proposal.

Changed 15 years ago by mkae (Marko Käning)

Attachment: main.2.applescript added

apple script w/o line breaks to avoid UTF-8/ISO-8859 issues with AS editor

comment:21 Changed 15 years ago by mkae (Marko Käning)

Takanori, please test whether the newly attached main.2.applescript has still trouble to compile in your editor.

comment:22 Changed 15 years ago by mkae (Marko Käning)

Takanori, you wrote this:

2) The icon file should be downloaded on demand since it is a bit large.

and I wonder what it actually means. 300kB I wouldn't call "large". :) But anyway, what do you mean by on demand? Does your portfile version actually support what you meant?

I think so, because you defined "applet.icns:icon" and later grab the stuff from distpath.

I just wonder how I would have to set this up locally during port file testing... since you defined further up "master_sites ... macports::icon"...

comment:23 Changed 15 years ago by pixilla (Bradley Giesbrecht)

The icon is in the kmymoney src so it can be copied from there during destroot.

comment:24 Changed 15 years ago by mkae (Marko Käning)

Brad, the icon is where? But it is probably not in icns format. How to automagically convert it into it?

comment:25 Changed 15 years ago by mkae (Marko Käning)

Disregard my question concerning "master_sited ... macports::icon".

I think I understood that I could modify my current portfile according to this and it would still work locally. (I mean, that's what my sources.conf is all about here...)

:)

comment:26 Changed 15 years ago by mkae (Marko Käning)

BTW, to tell you the truth guys, I haven't really understood the difference between filespath and distpath, but I guess only the latter allows to access files in a cached way. Am I right?

If so, I guess, also main.applescript could be addressed like this. Correct?

Changed 15 years ago by mkae (Marko Käning)

Attachment: kmymoney-1.0.4.tar.gz added

Sorry, there was an error with undefined variable kmymoney. Now fixed.

comment:27 Changed 15 years ago by mkae (Marko Käning)

Brad, could you have a look at the main.applescript

set executable to "__PREFIX__/bin/kmymoney" as string

try
	set kmymoney to (POSIX path of (path to executable) as string)
on error
	display alert "There was an error locating KMyMoney's executable." & return & return & "Try 'port installed kmymoney' to verify that port 'kmymoney' is installed." & return & return & "The file we tried to find was:" & return & return & "'" & executable & "'" as warning
	return
end try

and tell me why this DOES NOT correctly test for existence of kmymoney's executable?

Have no clue right now and finally need to go to bed.

---

Takanori, please be patient until we've figured this last one out.

comment:28 Changed 15 years ago by pixilla (Bradley Giesbrecht)

Use something like "get alias" to test if file exists.

set kmymoney to POSIX file "/opt/local/bin/kmymoneyyyyyyy"
-- whoops, sticky y key
try
	get alias kmymoney
on error
	display alert "There was an error locating KMyMoney's executable." & return & return & "Try 'port installed kmymoney' to verify that port 'kmymoney' is installed." & return & return & "The file we tried to find was:" & return & return & "'" & kmymoney & "'" as warning
	return
end try

comment:29 in reply to:  19 Changed 15 years ago by takanori@…

Hi Marko,

Replying to MK-MacPorts@…:

I suggest, you try this one here:

do shell script "__PREFIX__/bin/kmymoney"

I tried it again and found that it works well! I wonder why it failed at the first time, but it works now.

Replying to MK-MacPorts@…:

After your conversion to UTF-8 now I CAN NOT compile anymore... Same error message on my side now.

Hmm, FYI, I am using my Mac under Japanese language environment. I suppose the behavior of osascript may depend on what users' language environment is..

Replying to MK-MacPorts@…:

I guess this can be avoided - as a hot-fix - by simply removing some line breaks... Will do that and repost the port proposal.

I hope so. Thanks.

comment:30 in reply to:  21 Changed 15 years ago by takanori@…

Replying to MK-MacPorts@…:

Takanori, please test whether the newly attached main.2.applescript has still trouble to compile in your editor.

Unfortunately, it failed.

$ osacompile -o test.app main.2.applescript
main.2.applescript:69: error: Expected expression but found unknown token. (-2741)

comment:31 Changed 15 years ago by takanori@…

Marko,

How about converting it into UTF-16?

$ cat main.2.applescript | iconv -f MAC -t UTF-16 > main.3.applescript
$ osacompile -o test.app main.3.applescript

I found that UTF-16 encoded scropt also works well on my Mac.

Changed 15 years ago by mkae (Marko Käning)

Attachment: main.3.applescript added

This version uses 'tell application "X11"' instead of a shell command and uses the correct way to check for existence of kmm's executable.

comment:32 Changed 15 years ago by mkae (Marko Käning)

Hi Takanori,

the newly attached main.3.applescript now doesn't require a shell call anymore.

Please give it a try!

ALSO, I hope it would NOT need a charset conversion anymore, since it should be plain ASCII.

Greets, Marko

P.S.: This is an intermediate version. An updated version of the portfile is still going to come some time later this weekend.

P.P.S.: Did you also have problems opening my tar.gz on?

Changed 15 years ago by mkae (Marko Käning)

Attachment: main.4.applescript added

Ooops, there were still 2 line-breaks in it. (Now "file main.applescript" returns "ASCII with very long lines".)

Changed 15 years ago by mkae (Marko Käning)

Attachment: kmymoney-1.0.4_3.tar.gz added

This port version has applet.icns without the 2 biggest icons (reducing it's size to only 50 kB). [Uploaded using Firefox.]

Changed 15 years ago by mkae (Marko Käning)

Attachment: kmymoney-1.0.4_3.tar.2.gz added

Dito. [Uploaded using Safari]

comment:33 Changed 15 years ago by mkae (Marko Käning)

Hi Takanori,

I uploaded my latest version of the port just now (using Firefox as well as Safari) and wonder whether you are able to access the two files now.

The icns has shrunken sufficiently to just 50 kB now.

The apple script is pure ASCII by now.

The port should work fine now.

Please let me know whether it works for you.

Best wishes, Marko

Changed 15 years ago by mkae (Marko Käning)

Attachment: kmymoney-1.0.4_4.tar.gz added

Rename apple script from main.applescript to KMyMoney.applescript [Firefox upload]

comment:34 Changed 15 years ago by mkae (Marko Käning)

Now I noticed that the X11 application starts a shell on first start up.

Seems to be needed by kmm for some reason.

So, I guess I should go back to my original approach to run kmm via a shell call.

Not tonight though.

Will proceed tomorrow...

Changed 15 years ago by mkae (Marko Käning)

Attachment: kmymoney-1.0.4_5.tar.gz added

OK, couldn't withstand to deliver the fix concerning X11's shell window. (Now we again use a shell call instead of "tell application 'X11'".)

comment:35 Changed 15 years ago by takanori@…

Resolution: fixed
Status: reopenedclosed

Marko-san, Brad-san,

Sorry for the late reply. I didn't notice that you had updated the latest version.

I tried kmymoney-1.0.4_5.tar.gz and found that it works perfectly. :-)

So I committed it in r66784. Thank you for your great work!!

comment:36 Changed 15 years ago by ryandesign (Ryan Carsten Schmidt)

  • r66803: use ${applications_dir} instead of hardcoding /Applications/MacPorts; don't use "system" just to copy files

Changed 15 years ago by mkae (Marko Käning)

Attachment: Portfile added

Portfile for 1.0.4_6 (now using xinstall instead of system for file copying)

comment:37 Changed 15 years ago by mkae (Marko Käning)

Hi Ryan,

only after I had updated my local port (according to your remarks concerning the use of system) I saw that you had already committed your change to MacPorts. I wonder whether xinstall is the way to go of your "copy" or "file copy -force" is the better choice.

I guess there is no other way to call "osacompile" then to use "system", right?

Greets, Marko

comment:38 Changed 15 years ago by ryandesign (Ryan Carsten Schmidt)

I wasn't sure if xinstall overwrites an existing file but I knew file copy -force does so I just used that. It probably doesn't particularly matter which you use. xinstall is great if you need to set the ownership or permissions of the installed file since you can do so right there in the xinstall command and don't need a separate file attributes command.

The two ways to run external commands are

system "somecommand"

and

set somevar [exec somecommand]

We tend to use "exec" when we want to get the output of the command and "system" when we just want to run it.

Note: See TracTickets for help on using tickets.