Re: install_packages and 'hold' in the PACKAGES

2010-10-10 Thread michael log
Hello Michael.
The erroneous extra "hold" at the end of the string piped as a command
to "dpkg --set-selections" results in the rejection to perform the
whole command by the "dpkg".

E.g. we have the following "perl" packages "installed" and "selected
for installation":

debian:~# dpkg -l | grep "^perl"
ii  perl  5.10.1-14
Larry Wall's Practical Extraction and Report Language
ii  perl-base 5.10.1-14
minimal Perl system
ii  perl-modules  5.10.1-14   Core
Perl modules
debian:~#

And then we would like to mark those packages to be "on hold" (e.g.
not to be upgraded by the "dpkg", "aptitude", ...):

debian:~# echo -en "perl hold\nperl-base hold\nperl-modules hold\n" |
dpkg --set-selections

Everything is correct:

debian:~# dpkg -l | grep "^perl"
hi  perl  5.10.1-14
Larry Wall's Practical Extraction and Report Language
hi  perl-base 5.10.1-14
minimal Perl system
hi  perl-modules  5.10.1-14   Core
Perl modules
debian:~#

Let's revert to the initial state:

debian:~# echo -en "perl install\nperl-base install\nperl-modules
install\n" | dpkg --set-selections
debian:~# dpkg -l | grep "^perl"
ii  perl  5.10.1-14
Larry Wall's Practical Extraction and Report Language
ii  perl-base 5.10.1-14
minimal Perl system
ii  perl-modules  5.10.1-14   Core
Perl modules
debian:~#

Now if we added the erroneous extra "hold" at the end of the command,
the "dpkg" refuses the whole command:

debian:~# echo -en "perl hold\nperl-base hold\nperl-modules hold\n
hold\n" | dpkg --set-selections
dpkg: unexpected end of line in package name at line 4
debian:~# dpkg -l | grep "^perl"
ii  perl  5.10.1-14
Larry Wall's Practical Extraction and Report Language
ii  perl-base 5.10.1-14
minimal Perl system
ii  perl-modules  5.10.1-14   Core
Perl modules
debian:~#

It means that packages configured as "PACKAGES hold" in package_config
files are not processed correctly.
In general it breaks the following statement from "man install_packages":
"install_packages is a Perl script written for FAI to selectively
install, hold, remove, or purge packages or tasks."

Thanks,
Michael.

On Sun, Oct 10, 2010 at 12:08 PM, Michael Tautschnig  wrote:
> Hi Michael,
>
>> Hello,
>> Is it possible that the following is valid:
>>
>> Index: bin/install_packages
>> ...
>
> Thanks a lot for providing this patch and the additional info in further
> responses in this thread. Could you also describe which problems this is
> causing?
>
> Anyway, I have added your patch to the experimental series; it's included in
> 4.0~beta2+experimental26. But I guess receiving further information on the
> problems caused by this bug will increase the likelihood of the patch making 
> it
> into trunk.
>
> Thanks again,
> Michael


Re: install_packages and 'hold' in the PACKAGES

2010-10-10 Thread Michael Tautschnig
Hi Michael,

> Hello,
> Is it possible that the following is valid:
> 
> Index: bin/install_packages
> ===
> --- bin/install_packages(revision 6118)
> +++ bin/install_packages(working copy)
> @@ -184,7 +184,7 @@
>my $packlist = join(' ',@{$list{$atype}});
> 
>if ($atype eq "hold") {
> -my $hold = join " hold\n", @{$list{hold}}, " hold\n";
> +my $hold = join " hold\n", @{$list{hold}}, "";
>  execute("echo \"$hold\" | $rootcmd $command{hold}");
>  next;
>}
> 
> According to the "man dpkg" it seems that the last " hold\n" is unnecessary:
> 
> --set-selections
> Set package selections using file read from stdin. This file should be
> in the  format  ’  ’,
> where  state  is  one of install, hold, deinstall or purge. Blank
> lines and comment lines beginning with ’#’
> are also permitted.
> 

Thanks a lot for providing this patch and the additional info in further
responses in this thread. Could you also describe which problems this is
causing?

Anyway, I have added your patch to the experimental series; it's included in
4.0~beta2+experimental26. But I guess receiving further information on the
problems caused by this bug will increase the likelihood of the patch making it
into trunk.

Thanks again,
Michael



pgpTDJbD7W7xd.pgp
Description: PGP signature


Re: install_packages and 'hold' in the PACKAGES

2010-10-07 Thread Edgar Fuß
Sorry, I misread that as join ... . " hold\n", not as join ... , " hold\n".


Re: install_packages and 'hold' in the PACKAGES

2010-10-07 Thread michael log
Agree...

However,
join "x", @a, "x";
does produce "1x2x3xx".

But
join "x", @a, "";
gives "1x2x3x", like the below:

#!/usr/bin/perl
my $o, @a = ( "1", "2", "3" );

$o = join "x", @a;
print "$o\n";
$o = join "x", @a, "x";
print "$o\n";
$o = join "x", @a, "";
print "$o\n";

where the output:

1x2x3
1x2x3xx
1x2x3x


Re: install_packages and 'hold' in the PACKAGES

2010-10-07 Thread Edgar Fuß
With @a = ( "1", "2", "3" ), join "x",@a gives "1x2x3", not "1x2x3x".


install_packages and 'hold' in the PACKAGES

2010-10-07 Thread michael
Hello,
Is it possible that the following is valid:

Index: bin/install_packages
===
--- bin/install_packages(revision 6118)
+++ bin/install_packages(working copy)
@@ -184,7 +184,7 @@
   my $packlist = join(' ',@{$list{$atype}});

   if ($atype eq "hold") {
-my $hold = join " hold\n", @{$list{hold}}, " hold\n";
+my $hold = join " hold\n", @{$list{hold}}, "";
 execute("echo \"$hold\" | $rootcmd $command{hold}");
 next;
   }

According to the "man dpkg" it seems that the last " hold\n" is unnecessary:

--set-selections
Set package selections using file read from stdin. This file should be
in the  format  ’  ’,
where  state  is  one of install, hold, deinstall or purge. Blank
lines and comment lines beginning with ’#’
are also permitted.

Michael

mmlo...@gmail.com