[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Features Missing in Debian's Package Management System



"Andrew O. Shadoura" <bugzilla@tut.by> writes:

> On Tue, 14 Jun 2011 00:25:29 +0200
> Peter De Wachter <pdewacht@gmail.com> wrote:
>
>> You can do something like this using apt pinning. If you assign a
>> negative priority to a package, it will still be listed but apt will
>> refuse to install it.
>
>> For example, with the following stanza apt will refuse to install
>> libfoo:
>>   Package: libfoo
>>   Pin: version *
>>   Pin-Priority: -1
>
> Possibly, there should be some kind of automagical interface for this,
> so one can type apt-... ... libfoo and get that stanza generated?

It's actually very easy to write such a tool:

~# cat >/usr/local/sbin/apt-ignore
#! /bin/sh
set -e

ai_usage ()
{
	cat <<EOF
Usage: apt-ignore PACKAGES...

Creates a new file in /etc/apt/preferences.d/ to ignore all of the
packages specified on the command-line.
EOF
}

if [ $# -lt 1 ]; then
	ai_usage
	exit 1
fi

for pkg in $@; do
	cat <<EOF
Package: ${pkg}
Pin: version *
Pin-Priority: -1

EOF
done >$(tempfile -d /etc/apt/preferences.d/ -p ign-)
^D
~# chmod +x /usr/local/sbin/apt-ignore

There's little error handling, one could add support for --help, write a
manual page and probably a whole lot of other things (like using more
sensible filenames, and warning the user if trying to ignore a package
that does not exist (possibly only when a flag is specified - so one can
ignore packages that are not in the archive yet, but will be)), but I'll
leave that to someone who'd actually use the program.

-- 
|8]


Reply to: