From: Thomas Rasmussen on
Hello,

I've been wondering about something: When I write a script or webapp that
needs some port to run, like a perl module, I install the needed port and
life is good (tm). A year later when I've completely forgotten about the
script I go do some spring-cleaning of the ports on the server, and I see
some perl module that doesn't have any dependencies, and delete it. Fast
forward a few days when I discover the script doesn't work anymore, cue
face-palm, remove bullet from foot, etc.

Is there some way I can register a dependency to prevent this ? Like
adding a flag to an installed port to say "something outside of the ports
system depends on this" along with a user specified comment string. A
system like that could result in something like this:

pkg_delete -x p5-something
pkg_delete: p5-something cant be uninstalled because: "somescript.pl uses
this module, for the love of everything good do not delete it"

Is something like this already implemented, or does anyone have suggestions
to where I might begin if I want to make this ? Am I the only FreeBSD
admin absent-minded enough to have this problem ? :)

Best regards

Thomas Steen Rasmussen

PS: I know that this kind of hand-holding is uncommon in FreeBSD. We
allow all kinds of foot-shooting, but a safeguard like this would be a nice
improvement to an (IMO) already excellent ports system.

_______________________________________________
freebsd-ports(a)freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscribe(a)freebsd.org"

From: Doug Barton on
On 06/06/10 16:53, Thomas Rasmussen wrote:
> Hello,
>
> I've been wondering about something: When I write a script or webapp that
> needs some port to run, like a perl module, I install the needed port and
> life is good (tm). A year later when I've completely forgotten about the
> script I go do some spring-cleaning of the ports on the server, and I see
> some perl module that doesn't have any dependencies, and delete it. Fast
> forward a few days when I discover the script doesn't work anymore, cue
> face-palm, remove bullet from foot, etc.
>
> Is there some way I can register a dependency to prevent this ? Like
> adding a flag to an installed port to say "something outside of the ports
> system depends on this" along with a user specified comment string. A
> system like that could result in something like this:
>
> pkg_delete -x p5-something
> pkg_delete: p5-something cant be uninstalled because: "somescript.pl uses
> this module, for the love of everything good do not delete it"
>
> Is something like this already implemented,

No, although I agree it's a good idea.

You can create a +REQUIRED_BY file in that port's /var/db/pkg directory
that names something else that is already installed on the system, but
you can't do user-defined strings.

> or does anyone have suggestions to where I might begin if I want to make this ?

/usr/src/usr.sbin/pkg_install/delete


hth,

Doug

--

... and that's just a little bit of history repeating.
-- Propellerheads

Improve the effectiveness of your Internet presence with
a domain name makeover! http://SupersetSolutions.com/

_______________________________________________
freebsd-ports(a)freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscribe(a)freebsd.org"

From: Doug Barton on
On 06/06/10 17:41, Stephen Montgomery-Smith wrote:
>
> Well, in my mind, when I sent the message, I was somewhat sure it would
> work, at least that it would pass some kind of quick test.

In other words, you guessed, and your guess was wrong.

FWIW, I had the same thought in mind when I got ready to reply to the
OP, but when I tested it, I found out that it didn't work, which is why
I posted what I did.

> Furthermore, I really don't see the harm in sending out suggestions

I explained that. If you don't agree with my explanation, and/or you
feel that your time is so much more valuable than all of the other
thousands of people on the list that you can't be bothered to test your
"suggestions" before you send them out, so be it.


Doug

--

... and that's just a little bit of history repeating.
-- Propellerheads

Improve the effectiveness of your Internet presence with
a domain name makeover! http://SupersetSolutions.com/

_______________________________________________
freebsd-ports(a)freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscribe(a)freebsd.org"

From: Stephen Montgomery-Smith on
Doug Barton wrote:
> On 06/06/10 17:41, Stephen Montgomery-Smith wrote:
>>
>> Well, in my mind, when I sent the message, I was somewhat sure it would
>> work, at least that it would pass some kind of quick test.
>
> In other words, you guessed, and your guess was wrong.

I did guess, and it seems that I was wrong. This completely surprised
me. My apologies. You are right and I was wrong.

>
> FWIW, I had the same thought in mind when I got ready to reply to the
> OP, but when I tested it, I found out that it didn't work, which is why
> I posted what I did.
>
>> Furthermore, I really don't see the harm in sending out suggestions
>
> I explained that. If you don't agree with my explanation, and/or you
> feel that your time is so much more valuable than all of the other
> thousands of people on the list that you can't be bothered to test your
> "suggestions" before you send them out, so be it.
>
>
> Doug
>

_______________________________________________
freebsd-ports(a)freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscribe(a)freebsd.org"

From: "b. f." on
>Hello,
>
>I've been wondering about something: When I write a script or webapp that
>needs some port to run, like a perl module, I install the needed port and
>life is good (tm). A year later when I've completely forgotten about the
>script I go do some spring-cleaning of the ports on the server, and I see
>some perl module that doesn't have any dependencies, and delete it. Fast
>forward a few days when I discover the script doesn't work anymore, cue
>face-palm, remove bullet from foot, etc.
>
>Is there some way I can register a dependency to prevent this ? Like
>adding a flag to an installed port to say "something outside of the ports
>system depends on this" along with a user specified comment string. A
>system like that could result in something like this:
>
>pkg_delete -x p5-something
>pkg_delete: p5-something cant be uninstalled because: "somescript.pl uses
>this module, for the love of everything good do not delete it"

Yeah, there is. If you don't want to make a local port for your
script/program with the module listed as a dependency, then don't muck
about +REQUIRED_BY and friends -- that's a pain. Instead, you can use
a "package requirements procedure" -- a script or program that is
executed before installation/deinstallation, and if it returns
non-zero exit status, the installation/deinstallation aborts. You can
read about it in pkg_create(1) (look at the -r flag), and
pkg_delete(1), of course. For example, say you have a script called
/home/foo that requires a port /usr/ports/devel/bar. Add something
like the following script as /usr/ports/devel/bar/pkg-req:


#!/bin/sh

if [ "x$1" = "x" ]; then
exit 1;
fi

if [ "x$2" = "xINSTALL" ]; then
exit 0;
elif [ "x$2" = "xDEINSTALL" ]; then
if [ -f /home/foo ] ; then
echo "/home/foo requires this package; aborting deinstallation; use
-f to override"
exit 1
else
exit 0
fi
else
exit 1
fi

When you rebuild and reinstall devel/bar, this script will be added as
/var/db/pkg/bar-1.0/+REQUIRE, for example. You can add it manually if
bar-1.0 is already installed, and it will take effect when pkg_delete
acts on bar-1.0, even without rebuilding.
Obviously, you can make this more elaborate: it could examine a list
of dependent programs contained in a file that you can edit, and check
for each one of them in your PATH, or in specified places. You could
edit this list at any time, and the +REQUIRE script would still work.
You can keep the script in a location other than
/usr/ports/devel/bar/pkg-req, just by using something like:

..if${.CURDIR:M*/usr/ports/devel/bar*}
PKGREQ="insert full path to script here"
..endif

in /etc/make.conf, because /usr/ports/Mk/bsd.port.mk will use PKGREQ
along with the -r flag in the "do-package" target.

You are always free to tie a string around your finger. Just don't
tie it too tightly.


Regards,
b.
_______________________________________________
freebsd-ports(a)freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscribe(a)freebsd.org"