# hatop broken



## nedry (Oct 14, 2016)

Hello in FreeBSD 11.0-Release-P1 I have tried to compile /usr/ports/sysutils/hatop unfortunately it is marked as broken. Does anyone know if this port will become available again?
nedry


----------



## SirDice (Oct 14, 2016)

Nope, apparently the upstream source disappeared.


----------



## jrm@ (Oct 14, 2016)

It will hopefully be fixed soon.  You can apply the patch attached to this PR if you want it sooner.
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=213477


----------



## nedry (Oct 14, 2016)

Hello sorry a very newbie question, what do i type to patch /usr/ports/sysutils/hatop port? Many thanks, Nedry


----------



## Phishfry (Oct 14, 2016)

Save the attachment in the PR to the /usr/ports/sysutils/hatop directory and run this from that directory.

`patch -u < hatop-0.7.7.diff`

Then `make install clean`

https://www.freebsd.org/cgi/man.cgi?patch(1)


----------



## nedry (Oct 14, 2016)

Hi just patched sysutils/hatop after patching it with `patch -u < hatop-0.7.7.diff` The patch applied without any errors so i then compiled with `make install clean` this completed without errors. However when running hatop i get the following errors: 
	
	



```
env: python No such file or directory
```
nedry


----------



## nedry (Oct 14, 2016)

Hi the solution was to manually install python-2.7_2,2 and then try hatop again, this worked. So unfortunately the patch does not build and install python as part of the dependencies.
nedry


----------



## Phishfry (Oct 14, 2016)

The ports makefile has uses= python so maybe just needs uses=python27 or similar. This would be an additional fixup. It should install. The freshports page shows it as a dependency.
www.freshports.org/sysutils/hatop


----------



## Phishfry (Oct 14, 2016)

So it needs to have python added to RUN_DEPENDS= in the makefile. It is missing.
That is my best guess.


----------



## Phishfry (Oct 14, 2016)

The proper python entry needed I believe.
${LOCALBASE}/usr/local/bin/python:lang/python27

Maybe this:
RUN_DEPENDS=
${LOCALBASE}/usr/local/bin/python:lang/python27
${LOCALBASE}/sbin/haproxy:net/haproxy


----------



## Phishfry (Oct 14, 2016)

I might be wrong about it all. I was looking at the astro/gpsd makefile and it requires python27 but only shows up as "USES=python"


----------



## jrm@ (Oct 14, 2016)

Including USES=python without arguments in the makefile adds Python to BUILD_DEPENDS, RUN_DEPENDS, and TEST_DEPENDS.  Something is up with your userland.


----------



## Remington (Oct 14, 2016)

I already patched the file and it works if you install lang/python.  Anyway, I still consider this broken and unmaintained since it hasn't been updated for 6 years.

I edited the first line in /usr/local/bin/hatop to `#!/usr/bin/env python3.5` and tested to see if it'll work with python3.x but it doesn't as it threw an error:


```
File "/usr/local/bin/hatop", line 1090
    except RuntimeWarning, x:
                         ^
SyntaxError: invalid syntax
```


----------



## jrm@ (Oct 14, 2016)

Remington said:


> Anyway, it's broken as it hasn't been updated for 6 years.


There were upstream changes about a year ago: https://github.com/feurix/hatop/commit/64e0f26d2e392d1f2535f1b0229e45798c7514e8.



Remington said:


> I edited /usr/local/bin/hatop and changed the following line from:
> 
> ```
> #!/usr/bin/env python
> ...


Upstream's INSTALL says "no Python 3 support planned yet".  https://github.com/feurix/hatop/blob/master/INSTALL

I already updated the patch to explicitly require python 2.  https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=213477


----------



## Phishfry (Oct 15, 2016)

jrm@ said:


> Including USES=python without arguments in the makefile adds Python to BUILD_DEPENDS, RUN_DEPENDS, and TEST_DEPENDS.


The porters handbook is not exactly clear on the subject. Thanks for clarifying. I am trying to learn.
https://www.freebsd.org/doc/en/books/porters-handbook/makefile-depend.html

It brings perspective to this:
https://www.freebsd.org/doc/en/books/porters-handbook/uses-python.html


----------



## jrm@ (Oct 15, 2016)

Sometimes the source itself has useful documentation.  See the comments at the top of Mk/Uses/python.mk.


----------



## Phishfry (Oct 15, 2016)

That was what I was missing. I was wondering how to specify a version broadly. Like python:2.7


----------



## Remington (Oct 16, 2016)

Phishfry said:


> That was what I was missing. I was wondering how to specify a version broadly. Like python:2.7



You would add this to your /etc/make.conf but it will only work if you build from ports:

`DEFAULT_VERSIONS += python=2.7 python2=2.7`


----------



## nedry (Oct 18, 2016)

On a new system I tried a `make install` on sysutils/hatop. It downloaded and installed it without needing the patch. Great!! but after `make install` still had 
	
	



```
env: python No such file or directory
```
 will the port be configured by default to ask for lang/python27?

nedry


----------



## kpa (Oct 18, 2016)

The port needs to depend directly on lang/python which will install the correct /usr/local/bin/python symlink. I can't check now if Uses += python can set up that dependency but maybe someone else can.


----------



## nedry (Oct 18, 2016)

OK Great, i installed python35 still gave 
	
	



```
env: python No such file or directory
```
 so I did a `make deinstall` and then a `make install` in port python27 unfortunately i sill get: 
	
	



```
env: python No such file or directory
```
 I read it needs python27 unfortunately it looks like when I installed python27 it did not set automatically the
environment variables.
nedry


----------



## kpa (Oct 18, 2016)

I said lang/python, this is sort of a wrapper/metaport that only installs the symbolic link /usr/local/bin to the version of python it's set to depend on.


----------

