# Trying to port Catfish. Need Help!



## sk8harddiefast (Mar 7, 2014)

I managed to build Catfish on my own computer. So I want to create a port for Catfish. I just have a little problem. The first thing is to fetch the file. But is not fetching. Here is my very basic Makefile:

```
# $FreeBSD$​
PORTNAME= Catfish
PORTVERSION= 1.0.1
CATEGORIES= deskutils
MASTER_SITES= https://launchpad.net/catfish-search/1.0/1.0.1/+download/
MAINTAINER= sk8harddiefast@gmail.com	
COMMENT= Very known gtk search application ​
.include <bsd.port.mk>
```

And I get this error:

```
[ember@Unix ~/Desktop/Catfish]$ sudo make
===>   Catfish-1.0.1 depends on file: /usr/local/sbin/pkg - found
=> Catfish-1.0.1.tar.gz doesn't seem to exist in /usr/ports/distfiles/.
=> Attempting to fetch https://launchpad.net/catfish-search/1.0/1.0.1/+download/Catfish-1.0.1.tar.gz
fetch: https://launchpad.net/catfish-search/1.0/1.0.1/+download/Catfish-1.0.1.tar.gz: Not Found
=> Attempting to fetch ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/distfiles/Catfish-1.0.1.tar.gz
fetch: ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/distfiles/Catfish-1.0.1.tar.gz: File unavailable (e.g., file not found, no access)
=> Couldn't fetch it - please try to retrieve this
=> port manually into /usr/ports/distfiles/ and try again.
*** Error code 1

Stop.
make: stopped in /usr/home/ember/Desktop/Catfish
```

But the URL is correct: https://launchpad.net/catfish-search/1.0/1.0.1/+download/catfish-1.0.1.tar.bz2. Any porter who knows where the mistake is?

PS: The original source is on .bz2 and not tar.gz. But even when I give all the path, I get the same error.


----------



## SirDice (Mar 7, 2014)

*Re: Trying to port Catfish. Cannot fetch file.*



			
				sk8harddiefast said:
			
		

> But the url is correct:
> https://launchpad.net/catfish-search/1.0/1.0.1/+download/catfish-1.0.1.tar.bz2
> 
> Any porter who knows where is the mistake?
> Ps: The original source is on .bz2 and not tar.gz. But even when I give all the path, I get the same error.


You need to set USE_BZIP2:

```
USE_BZIP2= YES
```

Then it'll correctly fetch catfish-1.0.1.tar.bz2 instead of catfish-1.0.1.tar.gz.

http://www.freebsd.org/doc/en/books/por ... -distfiles (section 5.4.3)


----------



## sk8harddiefast (Mar 7, 2014)

*Re: Trying to port Catfish. Cannot fetch file.*

Yes. Now it gets fetched  Catfish asks for dependencies pygtk and some others. Is this x11-toolkits/py-gtk2? I add to the Makefile:

```
BUILD_DEPENDS= py27-gtk2:${PORTSDIR}/x11-toolkits/py-gtk2
```
It also asks for sysutils/zeitgeist which cannot be compiled and devel/py-gobject3 which I installed and now I don't get Git errors during `configure`. Finally it tries to rebuild the installed ports and stack with the message that is already installed. How can I do it to just go to the next dependency if a dependency is already installed?


----------



## olivierd (Mar 7, 2014)

*Re: Trying to port Catfish. Cannot fetch file.*



			
				sk8harddiefast said:
			
		

> Yes. Now it gets fetched  Catfish asks for dependencies pygtk and some others. Is this x11-toolkits/py-gtk2? I add to the Makefile:
> 
> ```
> BUILD_DEPENDS= py27-gtk2:${PORTSDIR}/x11-toolkits/py-gtk2
> ...



The latest version of Catfish depends o_n_ G_TK_3 through _I_ntrospection. In your Makefile add these lines:

```
[...]
RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}pexpect:${PORTSDIR}/misc/py-pexpect

MAINTAINER= sk8harddiefast@gmail.com
COMMENT= Very known gtk search application

LICENSE= GPLv2

HAS_CONFIGURE= yes
USE_BZIP2= yes
USES= gettext gmake
USE_GNOME= gtk30 pygobject3 introspection:build
USE_PYTHON= 2
INSTALLS_ICONS= yes

CONFIGURE_ARGS= --python=${PYTHON_CMD}

.include <bsd.port.mk>
```

Zeitgeist is optional (see catfish/CatfishSearchEngine.py), in this file, you should check locate's options (if they are identical on FreeBSD).

In catfish/CatfishWindow.py, you need to downgrade the G_O_bject version (perhaps it's not necessary).

In catfish_lib/Window.py _a_ symbolic icon is used, perhaps you need to replace this one (in another file, I don't know which one, there's function which replace symbolic icons when they don't exist on _the_ system).

In bin/catfish.in.in bash is used. You can turn off this dependency,  if you use sh().

I hope this will help you.


----------



## olivierd (Mar 7, 2014)

I forgot to mention: before running `make install`, first launch `make build`, if everything is ok, you can try `make stage`, then `make makeplist > pkg-plist` (in order to create a pkg-plist file). You need to change this file. And finally `make check-orphans`.

When `make check-orphans` is happy, you can install your port.


----------



## sk8harddiefast (Mar 8, 2014)

Ok. Here we are. This is my Makefile now:

```
# $FreeBSD$​
PORTNAME= catfish
PORTVERSION= 1.0.1
CATEGORIES= deskutils
MASTER_SITES= https://launchpad.net/catfish-search/1.0/1.0.1/+download/
MAINTAINER= sk8harddiefast@gmail.com
COMMENT= Very known gtk search application

LICENSE= GPLv2
HAS_CONFIGURE= yes
USE_BZIP2= yes
USES= gettext gmake
USE_GNOME= gtk30 pygobject3 introspection:build
USE_PYTHON= 2

RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}pexpect:${PORTSDIR}/misc/py-pexpect \
	  py27-gtk2:${PORTSDIR}/x11-toolkits/py-gtk2 \
	  dbus:${PORTSDIR}/devel/dbus \
	  py-xdg:${PORTSDIR}/devel/py-xdg \
	  py-gobject3:${PORTSDIR}/devel/py-gobject3
#	  zeitgeist:${PORTSDIR}/sysutils/zeitgeist
		
.include <bsd.port.mk>
```

And my `make`


```
[ember@Unix ~/Desktop/Catfish]$ sudo make      
===>  License GPLv2 accepted by the user
===>   catfish-1.0.1 depends on file: /usr/local/sbin/pkg - found
===> Fetching all distfiles required by catfish-1.0.1 for building
===>  Extracting for catfish-1.0.1
=> No checksum file (/usr/home/ember/Desktop/Catfish/distinfo).
===>  Patching for catfish-1.0.1
===>   catfish-1.0.1 depends on file: /usr/local/bin/python2.7 - found
===>   catfish-1.0.1 depends on executable: python2 - found
===>   catfish-1.0.1 depends on executable: gmake - found
===>   catfish-1.0.1 depends on file: /usr/local/bin/intltool-extract - found
===>   catfish-1.0.1 depends on executable: g-ir-scanner - found
===>   catfish-1.0.1 depends on file: /usr/local/libdata/pkgconfig/pygobject-3.0.pc - found
===>   catfish-1.0.1 depends on shared library: libintl.so - found
===>   catfish-1.0.1 depends on shared library: libatk-1.0.so - found
===>   catfish-1.0.1 depends on shared library: libglib-2.0.so - found
===>   catfish-1.0.1 depends on shared library: libpcre.so - found
===>   catfish-1.0.1 depends on shared library: libgtk-3.so - found
===>   catfish-1.0.1 depends on shared library: libpango-1.0.so - found
===>  Configuring for catfish-1.0.1
===>   FreeBSD 10 autotools fix applied to /usr/home/ember/Desktop/Catfish/work/catfish-1.0.1/configure
Checking module dependencies...
No module named zeitgeist
...Warning: The optional module zeitgeist is missing.
...OK
Creating Makefile...
Creating package data...
Installation prefix is /usr/local
===>  Building for catfish-1.0.1
gmake[1]: Entering directory `/usr/home/ember/Desktop/Catfish/work/catfish-1.0.1'
mkdir -p locale/el/LC_MESSAGES/
mkdir -p locale/zh_TW/LC_MESSAGES/
msgfmt po/el.po -o locale/el/LC_MESSAGES/catfish.mo
msgfmt po/zh_TW.po -o locale/zh_TW/LC_MESSAGES/catfish.mo
mkdir -p locale/de/LC_MESSAGES/
msgfmt po/de.po -o locale/de/LC_MESSAGES/catfish.mo
mkdir -p locale/sk/LC_MESSAGES/
mkdir -p locale/ru/LC_MESSAGES/
msgfmt po/sk.po -o locale/sk/LC_MESSAGES/catfish.mo
msgfmt po/ru.po -o locale/ru/LC_MESSAGES/catfish.mo
mkdir -p locale/nl/LC_MESSAGES/
msgfmt po/nl.po -o locale/nl/LC_MESSAGES/catfish.mo
mkdir -p locale/hu/LC_MESSAGES/
msgfmt po/hu.po -o locale/hu/LC_MESSAGES/catfish.mo
mkdir -p locale/pt_BR/LC_MESSAGES/
msgfmt po/pt_BR.po -o locale/pt_BR/LC_MESSAGES/catfish.mo
mkdir -p locale/uk/LC_MESSAGES/
msgfmt po/uk.po -o locale/uk/LC_MESSAGES/catfish.mo
mkdir -p locale/cs/LC_MESSAGES/
msgfmt po/cs.po -o locale/cs/LC_MESSAGES/catfish.mo
mkdir -p locale/id/LC_MESSAGES/
mkdir -p locale/be/LC_MESSAGES/
msgfmt po/id.po -o locale/id/LC_MESSAGES/catfish.mo
msgfmt po/be.po -o locale/be/LC_MESSAGES/catfish.mo
mkdir -p locale/fr/LC_MESSAGES/
msgfmt po/fr.po -o locale/fr/LC_MESSAGES/catfish.mo
mkdir -p locale/pl/LC_MESSAGES/
mkdir -p locale/eu/LC_MESSAGES/
msgfmt po/eu.po -o locale/eu/LC_MESSAGES/catfish.mo
msgfmt po/pl.po -o locale/pl/LC_MESSAGES/catfish.mo
mkdir -p locale/es/LC_MESSAGES/
msgfmt po/es.po -o locale/es/LC_MESSAGES/catfish.mo
mkdir -p locale/fi/LC_MESSAGES/
msgfmt po/fi.po -o locale/fi/LC_MESSAGES/catfish.mo
mkdir -p locale/lv/LC_MESSAGES/
msgfmt po/lv.po -o locale/lv/LC_MESSAGES/catfish.mo
mkdir -p locale/bg/LC_MESSAGES/
msgfmt po/bg.po -o locale/bg/LC_MESSAGES/catfish.mo
mkdir -p locale/it/LC_MESSAGES/
msgfmt po/it.po -o locale/it/LC_MESSAGES/catfish.mo
mkdir -p locale/ca/LC_MESSAGES/
msgfmt po/ca.po -o locale/ca/LC_MESSAGES/catfish.mo
mkdir -p locale/sr/LC_MESSAGES/
msgfmt po/sr.po -o locale/sr/LC_MESSAGES/catfish.mo
mkdir -p locale/tr/LC_MESSAGES/
msgfmt po/tr.po -o locale/tr/LC_MESSAGES/catfish.mo
mkdir -p locale/ja/LC_MESSAGES/
msgfmt po/ja.po -o locale/ja/LC_MESSAGES/catfish.mo
mkdir -p locale/pt/LC_MESSAGES/
msgfmt po/pt.po -o locale/pt/LC_MESSAGES/catfish.mo
mkdir -p locale/ko/LC_MESSAGES/
msgfmt po/ko.po -o locale/ko/LC_MESSAGES/catfish.mo
mkdir -p locale/en_AU/LC_MESSAGES/
msgfmt po/en_AU.po -o locale/en_AU/LC_MESSAGES/catfish.mo
intltool-merge -d po catfish.desktop.in catfish.desktop
Merging translations into catfish.desktop.
chmod +x catfish.desktop
sed -e s,%prefix%,/usr/local, bin/catfish.in.in > bin/catfish.in
sed -e s,%python%,python, bin/catfish.in > bin/catfish
chmod +x bin/catfish
gmake[1]: Leaving directory `/usr/home/ember/Desktop/Catfish/work/catfish-1.0.1'
```

I removed sysutils/zeitgeist from the moment is not compiled and is optional.
But I have 2 questions. Didn't build the dependencies (I removed them to check if catfish will build them itself) and the second one is that make stage fails with this error:


```
writing manifest file 'setuptools.egg-info/SOURCES.txt'
Copying setuptools.egg-info to /usr/ports/devel/py-setuptools27/work/stage/usr/local/lib/python2.7/site-packages/setuptools-2.0.1-py2.7.egg-info
running install_scripts
Installing easy_install script to /usr/ports/devel/py-setuptools27/work/stage/usr/local/bin
Installing easy_install-2.7 script to /usr/ports/devel/py-setuptools27/work/stage/usr/local/bin
writing list of installed files to '/usr/ports/devel/py-setuptools27/work/.PLIST.pymodtmp'
install  -o root -g wheel -m 444 /usr/ports/devel/py-setuptools27/../py-setuptools/files/easy-install.pth.dist /usr/ports/devel/py-setuptools27/work/stage/usr/local/lib/python2.7/site-packages/
====> Compressing man pages (compress-man)
====> Running Q/A tests (stage-qa)
===>  Installing for py27-setuptools27-2.0.1
===>  Checking if devel/py-setuptools27 already installed
===>   Registering installation for py27-setuptools27-2.0.1 as automatic
Installing py27-setuptools27-2.0.1...pkg-static: py27-setuptools27-2.0.1 conflicts with py27-setuptools-2.0.1 (installs files into the same place).  Problematic file: /usr/local/lib/python2.7/site-packages/easy-install.pth.dist
*** Error code 70

Stop.
make[2]: stopped in /usr/ports/devel/py-setuptools27
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/misc/py-pexpect
*** Error code 1

Stop.
make: stopped in /usr/home/ember/Desktop/Catfish
```

So I cannot continue on pkg-plist.


----------



## trh411 (Mar 8, 2014)

A conflict error (installs files into the same place) usually means there has been a change to the port structure. Check the 20140307 entry in /usr/ports/UPDATING for devel/py-setuptools.


----------



## acheron (Mar 8, 2014)

You shouldn't hardcode the port version in MASTER_SITES, use something like:

```
MASTER_SITES= https://launchpad.net/catfish-search/1.0/${PORTVERSION}/+download/
```

edit:
This MASTER_SITES is even more correct:

```
MASTER_SITES= https://launchpad.net/catfish-search/${PORTVERSION:R}/${PORTVERSION}/+download/
```


----------



## fonz (Mar 8, 2014)

On a related note: I'd correct COMMENT as follows:

```
Very well-known GTK search application
```


----------



## olivierd (Mar 8, 2014)

sk8harddiefast said:
			
		

> Ok. Here we are. This is my Makefile now:
> 
> ```
> # $FreeBSD$​
> ...



Your Makefile is not correct. Catfish needs PyGObject (devel/py-gobject3, in your Makefile, you can find it in USE_GNOME). It works only with GTK3 (bindings is build with GObject Introspection).

x11-toolkits/py-gtk2 works only with GTK2.

You can remove devel/dbus, it installed automatically (some GNOME libraries need it).

If you keep devel/py-xdg, you need to add ${PYTHON_PKGNAMEPREFIX} because it's a Python module.

So replace your previous code:

```
[...]
RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}pexpect:${PORTSDIR}/misc/py-pexpect \
     py27-gtk2:${PORTSDIR}/x11-toolkits/py-gtk2 \
     dbus:${PORTSDIR}/devel/dbus \
     py-xdg:${PORTSDIR}/devel/py-xdg \
     py-gobject3:${PORTSDIR}/devel/py-gobject3
#     zeitgeist:${PORTSDIR}/sysutils/zeitgeist

[...]
```
with

```
[...]
RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}pexpect>=3.1:${PORTSDIR}/misc/py-pexpect \
     ${PYTHON_PKGNAMEPREFIX}xdg>=0.25:${PORTSDIR}/devel/py-xdg
```

As Zeitgeist is optional, you can follow the FreeBSD Porter's Handbook.

You should also add a real URL in MASTER_SITES, because currently your link is redirection, try `fetch -v [url=https://launchpad.net/catfish-search/1.0/1.0.1/+download/catfish-1.0.1.tar.bz2]https://launchpad.net/catfish-search/1. ... .1.tar.bz2[/url]`.


----------



## sk8harddiefast (Mar 10, 2014)

Ok. Τoday morning I have some time to work on the port. First of all I tried to find the real path using `fetch -v`. So I found it and I added it. But I see that does not always download the source, so I added a second one to be more sure. I also tried to see what's going on with devel/py-setuptools. I removed this. I had it on my system (emulators/virtualbox-ose-legacy need this but it's ok for now) and when I run `make makeplist > pkg-plist` I get this error now:

```
[ember@Unix ~/Desktop/Catfish]$ sudo make makeplist > pkg-plist
install: illegal option -- -
usage: install [-bCcpSsUv] [-f flags] [-g group] [-m mode] [-o owner]
               [-M log] [-D dest] [-h hash] [-T tags]
               [-B suffix] [-l linkflags] [-N dbdir]
               file1 file2
       install [-bCcpSsUv] [-f flags] [-g group] [-m mode] [-o owner]
               [-M log] [-D dest] [-h hash] [-T tags]
               [-B suffix] [-l linkflags] [-N dbdir]
               file1 ... fileN directory
       install -dU [-vU] [-g group] [-m mode] [-N dbdir] [-o owner]
               [-M log] [-D dest] [-h hash] [-T tags]
               directory ...
gmake[1]: *** [install] Error 64
```

My `pkg-info`:

```
[ember@Unix ~]$ pkg info | grep py27
py27-cairo-1.10.0_1            Python 2 bindings for Cairo
py27-dbus-1.1.1                Python bindings for the D-BUS messaging system
py27-gimp-2.8.10               GNU Image Manipulation Program
py27-gobject-2.28.6_3          Python bindings for GObject
py27-gobject3-3.8.1            Python bindings for GObject
py27-gtk2-2.24.0_2             Set of Python bindings for GTK+
py27-gtksourceview-2.10.1_1    A python bindings for the version 2 of the GtkSourceView library
py27-imaging-1.1.7_2           The Python Imaging Library
py27-libxml2-2.8.0             Python interface for XML parser library for GNOME
py27-pexpect-3.1               Pure Python Expect-like module
py27-qt4-core-4.10.3,1         Python bindings for the Qt4 toolkit, QtCore module
py27-qt4-dbussupport-4.10.3    Python bindings for the Qt4 toolkit, D-BUS module
py27-qt4-gui-4.10.3,1          Python bindings for the Qt4 toolkit, QtGui module
py27-setuptools27-2.0.1        Python packages installer
py27-sip-4.15.2,1              Python to C and C++ bindings generator
py27-tkinter-2.7.6_4           Python bindings to the Tk widget set
py27-xdg-0.25                  Python 2 library to access freedesktop.org standards
```

And my Makefile now:

```
# $FreeBSD$​
PORTNAME= catfish
PORTVERSION= 1.0.1
CATEGORIES= deskutils
#MASTER_SITES= https://launchpad.net/catfish-search/1.0/1.0.1/+download/
MASTER_SITES= https://launchpadlibrarian.net/167947107/catfish-1.0.1.tar.bz2 \
	 https://launchpad.net/catfish-search/${PORTVERSION:R}/${PORTVERSION}/+download/

MAINTAINER= sk8harddiefast@gmail.com
COMMENT= Very well-known GTK search application

LICENSE= GPLv2
HAS_CONFIGURE= yes
USE_BZIP2= yes
USES= gettext gmake
USE_GNOME= gtk30 pygobject3 introspection:build
USE_PYTHON= 2
INSTALLS_ICONS= yes

CONFIGURE_ARGS= --python=${PYTHON_CMD}

RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}pexpect>=3.1:${PORTSDIR}/misc/py-pexpect \
     ${PYTHON_PKGNAMEPREFIX}xdg>=0.25:${PORTSDIR}/devel/py-xdg

.include <bsd.port.mk>
```

So I am still stuck and I cannot create pkg-plist file 

Finally I created pkg-descr by copy-pasting from the official site:

```
Catfish is a search GUI powered by locate and find behind the scenes, with autocompletion from Zeitgeist and locate. The advanced options allow filtering by date and file type. The interface is intentionally lightweight and simple, using only GTK+.

WWW: http://www.twotoasts.de/index.php/catfish/
```


----------



## acheron (Mar 10, 2014)

Remove the name of the distfile in the MASTER_SITES:
	
	



```
MASTER_SITES= https://launchpadlibrarian.net/167947107/
```
sudo is not needed to create the pkg-plist.


----------



## sk8harddiefast (Mar 10, 2014)

Without sudo I get "permission denied". Also I removed the distfile*.*


----------



## acheron (Mar 10, 2014)

sk8harddiefast said:
			
		

> Without `sudo` permission denied. Also I removed the distfile


You need to have read/write/execute permissions on the directory where your port resides.


----------



## acheron (Mar 10, 2014)

There is an "error" in the Catfish Makefile, put the following content in files/patch-Makefile (substitute the spaces before "install" with one tabulation):

```
--- ./Makefile.orig     2014-03-10 13:10:33.373025709 +0000
+++ ./Makefile  2014-03-10 13:11:18.042042309 +0000
@@ -58,7 +58,7 @@
        install README $(DESTDIR)/$(PREFIX)/share/doc/$(APPNAME)
 
        install -d $(DESTDIR)/$(PREFIX)/share/applications
-       install --mode=644 $(APPNAME).desktop $(DESTDIR)/$(PREFIX)/share/applications
+       install -m 644 $(APPNAME).desktop $(DESTDIR)/$(PREFIX)/share/applications
 
        cp -rf locale $(DESTDIR)/$(PREFIX)/share
        ln -sf $(PREFIX)/share/locale $(DESTDIR)/$(PREFIX)/share/$(APPNAME)/locale
```


----------

