Re: How to use @preexec to test for installed packages

2019-04-19 Thread Mathieu Arnold
On Fri, Apr 19, 2019 at 02:36:38PM +0200, Matthias Fechner wrote:
> Am 06.04.2019 um 20:59 schrieb Adam Weinberger:
> > Especially since www/gitea does the same thing (and probably a number
> > of others as well).
> 
> I did now a lot of tests and came to the conclusion that I will add
> these checks into the startup script of gitlab-ce.
> 
> Maybe this problem will be fixed in a future version of pkg to be able
> to use the CONFLICTS_ definition from the Makefile.

Please do not.

Let the admin decide what they want to use. 

-- 
Mathieu Arnold


signature.asc
Description: PGP signature


Re: How to use @preexec to test for installed packages

2019-04-19 Thread Baptiste Daroussin
On Sat, Apr 06, 2019 at 03:58:48PM +0200, Matthias Fechner wrote:
> Dear all,
> 
> as pkg cannot handle CONFLICTS_INSTALL I tried now to implement this as
> a preinstall command using @preexec in pkg-plist.
> 
> The command should check if a package is installed and stop the
> installation or continue if the package is not installed.
> 
> I tried it with the following command:
> @preexec `/usr/sbin/pkg -N info -e gogs`; if [ $? -eq 0 ]; then echo
> "Gitlab cannot be installed together with gogs as both of them modify
> .ssh/authorized_keys" && exit 1; else echo "Gogs not installed,
> continue."; fi
> 
There is no reason at all to prevent gitlab to be installed along side with gogs
or even gitea because they both play with .ssh/authrized_keys.

It is up to the admin to be careful about it. As an admin I may want to be able
to install both to transition from one to another.

I can also have both on the same machine, but started with different users (I
already did that in the past with gitea and gogs and they both run fine
together.

My 2cts is admins should know what they are doing here and there is no reason to
register a conflict here. It is on purpose that pkg only check for conflicting
files, until now no cases justified yet any other case of conflict to be handled
by pkg. (If that ever happen then we will implement a conflict handling
solution).

Best regards,
Bapt


signature.asc
Description: PGP signature


Re: How to use @preexec to test for installed packages

2019-04-19 Thread Matthias Fechner
Am 06.04.2019 um 20:59 schrieb Adam Weinberger:
> Especially since www/gitea does the same thing (and probably a number
> of others as well).

I did now a lot of tests and came to the conclusion that I will add
these checks into the startup script of gitlab-ce.

Maybe this problem will be fixed in a future version of pkg to be able
to use the CONFLICTS_ definition from the Makefile.


Gruß
Matthias

-- 

"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the universe trying to
produce bigger and better idiots. So far, the universe is winning." --
Rich Cook

___
freebsd-ports@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscr...@freebsd.org"


Re: How to use @preexec to test for installed packages

2019-04-06 Thread Adam Weinberger
On Sat, Apr 6, 2019 at 12:49 PM Miroslav Lachman <000.f...@quip.cz> wrote:
>
> Matthew Seaman wrote on 2019/04/06 19:00:
> > On 06/04/2019 14:58, Matthias Fechner wrote:
> >
> >> as pkg cannot handle CONFLICTS_INSTALL I tried now to implement this as
> >> a preinstall command using @preexec in pkg-plist.
> >>
> >> The command should check if a package is installed and stop the
> >> installation or continue if the package is not installed.
> >>
> >> I tried it with the following command:
> >> @preexec `/usr/sbin/pkg -N info -e gogs`; if [ $? -eq 0 ]; then echo
> >> "Gitlab cannot be installed together with gogs as both of them modify
> >> .ssh/authorized_keys" && exit 1; else echo "Gogs not installed,
> >> continue."; fi
> >>
> >> But it does not work.
> >> Now matter if gogs is installed or not.
> >> If I execute the same line in a shell script, it works fine.
> >>
> >> Anyone an idea?
> >
> > pkg(8) does handle the most common reason for packages conflicting at
> > install time -- file name clashes.  Indeed, it does this automatically
> > with no need of input from porters or maintainers, although it is usual
> > to add CONFLICTS_INSTALL lines to port Makefiles to document clashes
> > discovered this way.
> >
> > However, where there are other reasons for packages to conflict at
> > install time, then you are correct that pkg doesn't handle this.
> > There's simply no mechanism to include information about package
> > conflicts into pkg metadata.
>
> Then you can add some fake (empty) file to the plist of package A which
> will conflict with package B and then pkg conflict will work as expected.
> But I am not sure we should prevent installation of some package just
> because it uses authorized_keys too.

Especially since www/gitea does the same thing (and probably a number
of others as well).

# Adam


-- 
Adam Weinberger
ad...@adamw.org
https://www.adamw.org
___
freebsd-ports@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscr...@freebsd.org"


Re: How to use @preexec to test for installed packages

2019-04-06 Thread Miroslav Lachman

Matthew Seaman wrote on 2019/04/06 19:00:

On 06/04/2019 14:58, Matthias Fechner wrote:


as pkg cannot handle CONFLICTS_INSTALL I tried now to implement this as
a preinstall command using @preexec in pkg-plist.

The command should check if a package is installed and stop the
installation or continue if the package is not installed.

I tried it with the following command:
@preexec `/usr/sbin/pkg -N info -e gogs`; if [ $? -eq 0 ]; then echo
"Gitlab cannot be installed together with gogs as both of them modify
.ssh/authorized_keys" && exit 1; else echo "Gogs not installed,
continue."; fi

But it does not work.
Now matter if gogs is installed or not.
If I execute the same line in a shell script, it works fine.

Anyone an idea?


pkg(8) does handle the most common reason for packages conflicting at
install time -- file name clashes.  Indeed, it does this automatically
with no need of input from porters or maintainers, although it is usual
to add CONFLICTS_INSTALL lines to port Makefiles to document clashes
discovered this way.

However, where there are other reasons for packages to conflict at
install time, then you are correct that pkg doesn't handle this.
There's simply no mechanism to include information about package
conflicts into pkg metadata.


Then you can add some fake (empty) file to the plist of package A which 
will conflict with package B and then pkg conflict will work as expected.
But I am not sure we should prevent installation of some package just 
because it uses authorized_keys too.


Miroslav Lachman
___
freebsd-ports@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscr...@freebsd.org"


Re: How to use @preexec to test for installed packages

2019-04-06 Thread Matthew Seaman
On 06/04/2019 14:58, Matthias Fechner wrote:

> as pkg cannot handle CONFLICTS_INSTALL I tried now to implement this as
> a preinstall command using @preexec in pkg-plist.
> 
> The command should check if a package is installed and stop the
> installation or continue if the package is not installed.
> 
> I tried it with the following command:
> @preexec `/usr/sbin/pkg -N info -e gogs`; if [ $? -eq 0 ]; then echo
> "Gitlab cannot be installed together with gogs as both of them modify
> .ssh/authorized_keys" && exit 1; else echo "Gogs not installed,
> continue."; fi
> 
> But it does not work.
> Now matter if gogs is installed or not.
> If I execute the same line in a shell script, it works fine.
> 
> Anyone an idea?

pkg(8) does handle the most common reason for packages conflicting at
install time -- file name clashes.  Indeed, it does this automatically
with no need of input from porters or maintainers, although it is usual
to add CONFLICTS_INSTALL lines to port Makefiles to document clashes
discovered this way.

However, where there are other reasons for packages to conflict at
install time, then you are correct that pkg doesn't handle this.
There's simply no mechanism to include information about package
conflicts into pkg metadata.

Now, it shouldn't be beyond the bounds of possibility to include this as
input that the pkg solver could use, but it may require quite a deep
dive into the bowels of pkg code.  I doubt that using @preexec commands
in the pkg-plist is going to be very satisfactory -- the end result is
that pkg will end up trying to install conflicting packages and then
abort in the middle of installation, which could well result in an
inconsistent pkg database and user frustration.

Cheers,

Matthew



signature.asc
Description: OpenPGP digital signature


Re: How to use @preexec to test for installed packages

2019-04-06 Thread Matthias Fechner
Am 06.04.2019 um 18:01 schrieb Adam Weinberger:
> What you're describing is
> Makefile:
>   CONFLICTS_INSTALL= gogs

does not work, please see here:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=234807

Gruß
Matthias

-- 

"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the universe trying to
produce bigger and better idiots. So far, the universe is winning." --
Rich Cook

___
freebsd-ports@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscr...@freebsd.org"


Re: How to use @preexec to test for installed packages

2019-04-06 Thread Adam Weinberger
On Sat, Apr 6, 2019 at 7:59 AM Matthias Fechner  wrote:
>
> Dear all,
>
> as pkg cannot handle CONFLICTS_INSTALL I tried now to implement this as
> a preinstall command using @preexec in pkg-plist.
>
> The command should check if a package is installed and stop the
> installation or continue if the package is not installed.
>
> I tried it with the following command:
> @preexec `/usr/sbin/pkg -N info -e gogs`; if [ $? -eq 0 ]; then echo
> "Gitlab cannot be installed together with gogs as both of them modify
> .ssh/authorized_keys" && exit 1; else echo "Gogs not installed,
> continue."; fi
>
> But it does not work.
> Now matter if gogs is installed or not.
> If I execute the same line in a shell script, it works fine.
>
> Anyone an idea?

What you're describing is
Makefile:
  CONFLICTS_INSTALL= gogs



-- 
Adam Weinberger
ad...@adamw.org
https://www.adamw.org
___
freebsd-ports@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscr...@freebsd.org"


Re: How to use @preexec to test for installed packages

2019-04-06 Thread Bob Eager
On Sat, 6 Apr 2019 15:58:48 +0200
Matthias Fechner  wrote:

> Dear all,
> 
> as pkg cannot handle CONFLICTS_INSTALL I tried now to implement this
> as a preinstall command using @preexec in pkg-plist.
> 
> The command should check if a package is installed and stop the
> installation or continue if the package is not installed.
> 
> I tried it with the following command:
> @preexec `/usr/sbin/pkg -N info -e gogs`; if [ $? -eq 0 ]; then echo
> "Gitlab cannot be installed together with gogs as both of them modify
> .ssh/authorized_keys" && exit 1; else echo "Gogs not installed,
> continue."; fi
> 
> But it does not work.
> Now matter if gogs is installed or not.
> If I execute the same line in a shell script, it works fine.
> 
> Anyone an idea?

I think you'll find it has to be ONE command. So use && instead of the
first semicolon.
___
freebsd-ports@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscr...@freebsd.org"