Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 408149 - net-misc/nut-monitor-1.3 should install PNG files in /usr/share/pixmaps
Summary: net-misc/nut-monitor-1.3 should install PNG files in /usr/share/pixmaps
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: No maintainer - Look at https://wiki.gentoo.org/wiki/Project:Proxy_Maintainers if you want to take care of it
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-14 10:36 UTC by FSW
Modified: 2012-04-03 16:29 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info of my system (file_408149.txt,7.12 KB, text/plain)
2012-03-14 10:36 UTC, FSW
Details

Note You need to log in before you can comment on or make changes to this bug.
Description FSW 2012-03-14 10:36:38 UTC
Created attachment 305289 [details]
emerge --info of my system

Hi,
after having successfuly configured a NUT server , I wanted to try nut-monitor
on Sabayon 8 Xfce x86_64 edition, but it failed to start.

I opened a complete bug report there:
http://bugs.sabayon.org/show_bug.cgi?id=3119
to check if it's coming from their packaging, but it is not, uninstalling their package and then emerge -av nut-monitor giving the same error.

To resume it, some files disappears between the source package (http://www.lestat.st/_media/informatique/projets/nut-monitor/nut-monitor-1.3.tar.gz) and the ebuild, giving 2 problems:

1) The Big Problem:
The files on_battery.png, on_line.png, var-ro.png, var-rw.png and warning.png are not installed to /usr/share/pixmaps, thus the program can't start normally.

Steps to reproduce:
- Install and configure NUT for your UPS.
- Install nut-monitor (with emerge).
- Try to start it from the Menu > Internet > Moniteur NUT = nothing happens!
- Try to start it from Terminal = doesn't start either, but complains about  «
/usr/bin/pixmaps/var-ro.png » not found!

Error log from the original installed nut-monitor:
fsw@mir ~ $ nut-monitor 
Traceback (most recent call last):
  File "/usr/bin/nut-monitor", line 901, in <module>
    gui = interface()
  File "/usr/bin/nut-monitor", line 216, in __init__
    self.connect_to_ups()
  File "/usr/bin/nut-monitor", line 699, in connect_to_ups
    self.__gui_update_ups_vars_view()
  File "/usr/bin/nut-monitor", line 726, in __gui_update_ups_vars_view
    icon = gtk.gdk.pixbuf_new_from_file( icon_file )
glib.GError: Impossible d'ouvrir le fichier « /usr/bin/pixmaps/var-ro.png » :
Aucun fichier ou dossier de ce type (means "impossible to open file ... no file or directory of this type")

Searching on my system didn't find it either, so I had to look in the source package, and there it is!

2) The Small Problem:
The file NUT-Monitor.mo isn't also installed in /usr/share/locale/fr/LC_MESSAGES/ so no french translation, even if it's available in the source package.

Note 1:
This source package works as expected from an user directory once extracted (it's a Python script + icons  + a Glade GUI).

Note 2:
Once installed, the program seems to search its files in /usr/bin/ because it's not enough just to copy the missing *.PNG for it to find them, you still need to
make a symbolic link named "pixmaps" from /usr/bin/ to /usr/share/pixmaps to get it working.

Note 3: (This has nothing to do with the bug, it's just to report it):
In the ebuild (http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/net-misc/nut-monitor/nut-monitor-1.3.ebuild?diff_format=l&view=markup) the HOMEPAGE URL http://www.lestat.st/informatique/projets/nut-monitor-en/ is wrong, the correct one being now http://www.lestat.st/en/informatique/projets/nut-monitor.

So I'm adding my emerge --info as an attachement, please ask if I can do anything else to help solving this issue.
Comment 1 Pacho Ramos gentoo-dev 2012-03-20 09:58:18 UTC
(In reply to comment #0)
> Note 2:
> Once installed, the program seems to search its files in /usr/bin/ because
> it's not enough just to copy the missing *.PNG for it to find them, you
> still need to
> make a symbolic link named "pixmaps" from /usr/bin/ to /usr/share/pixmaps to
> get it working.

I doubt we are "allowed" install that links to non binaries inside /usr/bin, would be nice to try to patch nut-monitor to find things in pixmaps if possible. If you could provide a patch it would be even better :)

Thanks a lot
Comment 2 FSW 2012-03-22 08:56:40 UTC
(In reply to comment #1)
> (In reply to comment #0)
> > Note 2:
> > Once installed, the program seems to search its files in /usr/bin/ because
> > it's not enough just to copy the missing *.PNG for it to find them, you
> > still need to
> > make a symbolic link named "pixmaps" from /usr/bin/ to /usr/share/pixmaps to
> > get it working.
> 
> I doubt we are "allowed" install that links to non binaries inside /usr/bin,
> would be nice to try to patch nut-monitor to find things in pixmaps if
> possible. If you could provide a patch it would be even better :)
> 
> Thanks a lot

I also found this behaviour (searching pixmaps in /usr/bin ? Really ?) quite strange! Outside of some shell scripting, I know nothing of programming, but it's Python, I may have some luck (or not) =;)

But I also need to be sure if the problem is in the Python code or comes from the ebuild code (as I'm used with almost every distros out there, but still a Gentoo newbie).

Anyway, in case, the author of nut-monitor being french like me, I can still contact him and explain the problem.
I see what I can do and keep you people updated.
Comment 3 Pacho Ramos gentoo-dev 2012-03-22 09:21:53 UTC
If you can contact to upstream, even better, please try it :-)
Comment 4 FSW 2012-03-23 08:25:58 UTC
(In reply to comment #3)
> If you can contact to upstream, even better, please try it :-)

OK, will do this week-end & keep you posted about the results.
Comment 5 FSW 2012-03-26 12:59:50 UTC
I've send a message to the author, let's wait & see. But, I've no hope that there will any other way than a patch on Gentoo's side (more on why later in this comment)!

So, in between, i've worked on a "fix" that solve the issue (for me, it has to be confirmed by others).

Basically, copying all the needed *.png in /usr/share/pixmaps and the translation file (NUT-Monitor.mo) in /usr/share/locale/fr/LC_MESSAGES, then replacing in the main Python script (NUT-Monitor) all the "pixmaps" by "/usr/share/pixmaps" (7 times) and, at the the end, DIR = "locale" by DIR = "/usr/share/locale" does the trick !!!

Now that I know what to do (and that it works (TM) =;) I really need help HOW to do it... I dived into the ebuild How-To, the scripts in /usr/lib/portage/bin and so and that's well documented, but far from easy =;)

So I will be very glad & thankful if any ebuild / coding Master was to have a look here and wish to help with the following steps in the actual ebuild:

First, in the part (as I think it's the right place, but might be wrong):

23	src_prepare() {
24	        epatch "${FILESDIR}"/${P}-glade.patch
25	}

we need to add some magick (grep / sed / a file path.patch ?) that replaces all "pixmaps" and the "locale" with the correct paths in the main Python script (NUT-Monitor). 	

Second, in the part:

src_install() {
28	        dobin NUT-Monitor
29	        insinto /usr/share/nut-monitor
30	        doins gui-${PV}.glade
31	        dosym NUT-Monitor /usr/bin/${PN}
32	        doicon ${PN}.png
33	        domenu ${PN}.desktop
34	        dodoc README

as doicon ${PN}.png seems to install the program icon, perhaps just adding:

doicon .png

is enough to copy the missing *.png in /usr/share/pixmaps ???

But I still didn't find any command /script about installing the locale (there's no "dolocale" =;), so I don' t know what magick here can copy the translation file (NUT-Monitor.mo) in /usr/share/locale/fr/LC_MESSAGES ???

After this, I think I can get it to test the result locally with the help of "Storing your own ebuilds locally" from the Gentoo How-To.

A last word about why patching might be the only solution: I've found that Debian is getting eveything almost in place (as they choose rather to install the *.png in /usr/share/nut-monitor/pixmaps/) because they ARE patching the upstream sources!!!

If you look in their packages (nut_2.6.3-1.debian.tar.gz) here: http://packages.debian.org/sid/all/nut-monitor
there's a file named 0002-nut-monitor-paths.patch wich replaces all paths of the icons, as for exemple:

-        self.__widgets["status_icon"].set_from_file( os.path.join( os.path.dirname( sys.argv[0] ), "pixmaps", "on_line.png" ) )
+        self.__widgets["status_icon"].set_from_file( "/usr/share/nut-monitor/pixmaps/on_line.png" )

and so on... 

So that might be the easiest way and I think I can rework this patch file (if somebody being so kind to control /correct it =;) but then, what? 
Something like this (?):

23	src_prepare() {
24	        epatch "${FILESDIR}"/${P}-glade.patch
25		epatch "${FILESDIR}"/${P}-path.patch
26	}

So, has anybody an advice or perhaps, should I open a thread in the Gentoo forum to get more tips?
Comment 6 Pacho Ramos gentoo-dev 2012-04-02 19:42:20 UTC
+*nut-monitor-1.3-r1 (02 Apr 2012)
+
+  02 Apr 2012; Pacho Ramos <pacho@gentoo.org>
+  +files/nut-monitor-1.3-paths.patch, +nut-monitor-1.3-r1.ebuild,
+  -files/nut-monitor-1.3-glade.patch, -nut-monitor-1.1.ebuild,
+  -nut-monitor-1.3.ebuild:
+  Install pixmaps at proper paths, install fr translations when needed, let it
+  work when python3 is main interpreter (bug #408149 by FSW). Remove old.
+
Comment 7 FSW 2012-04-03 08:53:22 UTC
Dear Mr. Pacho Ramos, you've made my day & simply are my hero =;)

I've manually cleaned all of my testing modified NUT-Monitor files, did an "emerge --sync" and "emerge -av nut-monitor" and the old version is erased, your new version is put in /usr/portage/net-misc/ and everything is installed now where it belongs, meaning it works!!!

But there's is still 2 issues:

Issue 1) 
The french locale, even if copied now in the right place, is still not used by NUT-Monitor. 
I've got it working in my test by replacing (at the end of the Python script NUT-Monitor):

#-----------------------------------------------------------------------
# The main program starts here :-)
if __name__ == "__main__" :

    # Init the localisation
    APP = "NUT-Monitor"
    DIR = "locale"
by this:

#-----------------------------------------------------------------------
# The main program starts here :-)
if __name__ == "__main__" :

    # Init the localisation
    APP = "NUT-Monitor"
    DIR = "/usr/share/locale"

So I think you have to add this path modification too in the file nut-monitor-1.3-paths.patch to close this problem one for all.

Issue 2)
The HOMEPAGE URL in the ebuild is still wrong, the correct one being "http://www.lestat.st/en/informatique/projets/nut-monitor".

For those interested:
The author of NUT-Monitor (very kindly) explained me that the .deb version is the installable one and the .tar version is a "stand-alone", thus the trouble whe're having with it. In a new version, he will perhaps include some kind of auto-detection to solve these issues.

Thanks again for having taking care of this, I've tried desperatly to learn quickly, but your ebuild skillz are lightyears from mine =;)
Comment 8 Pacho Ramos gentoo-dev 2012-04-03 10:11:26 UTC
+*nut-monitor-1.3-r2 (03 Apr 2012)
+
+  03 Apr 2012; Pacho Ramos <pacho@gentoo.org>
+  +files/nut-monitor-1.3-paths2.patch, +nut-monitor-1.3-r2.ebuild,
+  -nut-monitor-1.3-r1.ebuild:
+  Fix locales, thanks a lot to FSW in bug #408149 for his investigation.
+

Regarding ebuild skills, they are got with the time, time ago I started reading ebuilds in the tree (that is really helpful) and, finally, http://devmanual.gentoo.org/ to know how to do things properly (as some ebuilds don't follow QA rules completely but, for starting, reading ebuilds will be nice :))
Comment 9 FSW 2012-04-03 16:29:40 UTC
I've just tested it and it works also "en français" now =;)

Thanks again for your work and for the great link: that's a real dev "Bible" that I will study carefully!

Take care.