# Portmaster doesn't detect installed openldap



## SirDice (Jul 30, 2010)

When I install sudo with LDAP support portmaster doesn't notice openldap24-client is already installed.


```
===>   openldap-sasl-client-2.4.23 is already installed
      You may wish to ``make deinstall'' and install this port again
      by ``make reinstall'' to upgrade it properly.
      If you really wish to overwrite the old port of net/openldap24-sasl-client
      without deleting it first, set the variable "FORCE_PKG_REGISTER"
      in your environment or the "make install" command line.
*** Error code 1

Stop in /usr/ports/net/openldap24-sasl-client.
*** Error code 1

Stop in /usr/ports/net/openldap24-sasl-client.

===>>> Installation of openldap-sasl-client-2.4.23 (net/openldap24-sasl-client) failed
===>>> Aborting update

===>>> Update for net/openldap24-sasl-client failed
===>>> Aborting update
```

Just doing a *make package* in /usr/ports/security/sudo/ works as expected. 

I had a similar issue with devel/gconf2 which I also build with LDAP support. It seems like the *USE_OPENLDAP* in a port's Makefile confuses portmaster.

Anyone else have similar issues?


----------



## SirDice (Jan 5, 2011)

Bumper-di-bump...

Just tried to build net/samba35 with LDAP support, same issue. I also noticed that doing a *make package* results in a package with LDAP support but doesn't depend on openldap.

Something tells me that /usr/ports/Mk/bsd.ldap.mk doesn't work as expected.

I'll see if removing SASL support from openldap makes any difference as that's the last thing that changed in the Mk file.


----------



## SirDice (Jan 5, 2011)

(I'm using my own thread to keep track of it, feel free to jump in, if I can put my finger on it I'll submit a PR)

Reproducing, on a clean system, no ports installed. Ports tree was updated on January 4.

```
# cd /usr/ports/security/sudo
# make package-recursive
[select LDAP support for sudo, leave openldap options as default]
# pkg_version -vI 
libtool-2.2.10                      =   up-to-date with index
openldap-client-2.4.23              =   up-to-date with index
sudo-1.7.4.4_1                      =   up-to-date with index
# pkg_delete -x sudo
# make package-recursive
# pkg_info -r /usr/ports/packages/All/sudo-1.7.4.4_1.tbz 
Information for /usr/ports/packages/All/sudo-1.7.4.4_1.tbz:

Depends on:
Dependency: openldap-client-2.4.23
```

Perfect. Start again, clean system without any ports.


```
# pwd
/usr/ports/security/sudo/
# make package-recursive
[select LDAP support for sudo, select SASL support for openldap, default options cyrus-sasl]
# pkg_version -vI
cyrus-sasl-2.1.23_1                 =   up-to-date with index
libtool-2.2.10                      =   up-to-date with index
openldap-sasl-client-2.4.23         =   up-to-date with index
sudo-1.7.4.4_1                      =   up-to-date with index
# pkg_info -r /usr/ports/packages/All/sudo-1.7.4.4_1.tbz
Information for /usr/ports/packages/All/sudo-1.7.4.4_1.tbz:

Depends on:
```

Errrrhm  :q


----------



## SirDice (Jan 12, 2011)

Right, I think I have a solution. The trick is to build net/openldap24-sasl-client _first_. Then build sudo or any other port that needs to depend on openldap.


```
#pkg_info -r sudo-1.7.4.4_1.tbz 
Information for sudo-1.7.4.4_1.tbz:

Depends on:
Dependency: cyrus-sasl-2.1.23_1
Dependency: openldap-sasl-client-2.4.23
```

As far as I can tell portmaster has nothing to do with it. The problem also exists when using the normal '*make install*' on a port. I have a feeling it's because of the OPTION system. That seems to break or at least doesn't find the correct dependencies. After a '*make install*' the port's /var/db/pkg/<pkg_name>/+CONTENT file lacks a needed @pkgdep line. Because of this '*make package*' doesn't record the dependency.

Trying to debug the ports system is a real PITA. I have tried various *-d* options for make which makes it somewhat readable. I'd love something that would allow me to single-step through a Makefile. Especially because of the interaction with the various bsd.*.mk files that get included.

Anyway, solved. Sort of. If anybody has any bright ideas on how to debug FreeBSD's make and their Makefiles I'd love to hear them. One day I might get to the bottom of this :e


----------



## dougb@ (Jan 16, 2011)

This happens because if you choose the SASL option in the ldap port it changes the port's name. You've hit upon the right workaround, which is to install the ldap port first. 

The better solution would be for portmaster to use the same technique that the ports infrastructure uses to detect dependencies. However coding that would be time-intensive however (due to the cleverness with which the various types of dependencies are recorded and detected) and I haven't found anyone willing to support that work. 


hth,

Doug


----------



## SirDice (Jan 17, 2011)

dougb@ said:
			
		

> The better solution would be for portmaster to use the same technique that the ports infrastructure uses to detect dependencies. However coding that would be time-intensive however (due to the cleverness with which the various types of dependencies are recorded and detected) and I haven't found anyone willing to support that work.


As far as I can tell it's the ports system itself that seems to screw up. The last tests I did were without portmaster. I just used the build system itself.

Just a plain [cmd=]make install[/cmd] in security/sudo builds, installs and packages openldap-sals-client-2.4.x correctly. It just doesn't record it as a dependency of sudo. If you build openldap without sasl support it does get added as a dependency.


----------



## Zeleni_Obad (Mar 14, 2011)

SirDice said:
			
		

> As far as I can tell it's the ports system itself that seems to screw up.



Apparently, ports do mess things up with openldap; here:

```
ldap# pkg_info | grep ldap
apr-ipv6-devrandom-gdbm-db46-ndbm-ldap24-0.9.18.0.9.17_1 Apache Portability Library
ldapvi-1.7_2        A tool to update LDAP entries with a text editor
openldap-client-2.4.23 Open source LDAP client implementation
openldap-server-2.4.23 Open source LDAP server implementation
php5-ldap-5.3.3_2   The ldap shared extension for php
phpldapadmin-suphp-1.2.0.5,1 A set of PHP-scripts to administer LDAP over the web
ldap# cd /usr/ports/net/openldap24-client/
ldap# make deinstall
===>  Deinstalling for net/openldap24-client
ldap# cd /usr/ports/net/openldap24-server/
ldap# make deinstall
===>  Deinstalling for net/openldap24-server
ldap# pkg_info | grep ldap
apr-ipv6-devrandom-gdbm-db46-ndbm-ldap24-0.9.18.0.9.17_1 Apache Portability Library
ldapvi-1.7_2        A tool to update LDAP entries with a text editor
openldap-client-2.4.23 Open source LDAP client implementation
openldap-server-2.4.23 Open source LDAP server implementation
php5-ldap-5.3.3_2   The ldap shared extension for php
phpldapadmin-suphp-1.2.0.5,1 A set of PHP-scripts to administer LDAP over the web
ldap#
```


----------

