FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux Pacman Development

 
 
LinkBack Thread Tools
 
Old 06-18-2010, 11:51 PM
Andres P
 
Default makepkg: remove unnecessary use of sort(1)

pacman -Qq output is always sorted!

$ diff -s <(pacman -Qq) <(pacman -Qq | sort)
Files /dev/fd/63 and /dev/fd/62 are identical

Signed-off-by: Andres P <aepd87@gmail.com>
---
scripts/makepkg.sh.in | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 29b5664..e78bcb1 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1872,7 +1872,7 @@ if (( NODEPS || ( (NOBUILD || REPKG) && !DEP_BIN ) )); then
fi
elif type -p "${PACMAN%% *}" >/dev/null; then
if (( RMDEPS )); then
- original_pkglist=($(run_pacman -Qq | sort)) # required by remove_dep
+ original_pkglist=($(run_pacman -Qq)) # required by remove_dep
fi
deperr=0

@@ -1883,7 +1883,7 @@ elif type -p "${PACMAN%% *}" >/dev/null; then
resolve_deps ${makedepends[@]} || deperr=1

if (( RMDEPS )); then
- current_pkglist=($(run_pacman -Qq | sort)) # required by remove_deps
+ current_pkglist=($(run_pacman -Qq)) # required by remove_deps
fi

if (( deperr )); then
--
1.7.1
 
Old 06-19-2010, 02:54 AM
Andres P
 
Default makepkg: remove unnecessary use of sort(1)

On Fri, Jun 18, 2010 at 9:37 PM, Allan McRae <allan@archlinux.org> wrote:
> On 19/06/10 09:51, Andres P wrote:
>>
>> pacman -Qq output is always sorted!
>>
>
> No it is not... * it depends on your locale whether the order is correct for
> inputting into comm.
>

You're wrong, pacman -Qq output *is* always sorted according to LC_COLLATE=C.

First I created a package called Kernel26, LC_COLLATE would put it untop since
it gives priority to uppercase. en_US does not.

$ exec 1>/dev/null

$ LC_COLLATE=C comm <(LC_COLLATE=C pacman -Qq)
<(LC_COLLATE=en_US.UTF-8 pacman -Qq)

No errors... but one you use a program that respects LC_COLLATE:

$ LC_COLLATE=C comm
<(LC_COLLATE=C sort <<<$'a
B
c')
<(LC_COLLATE=en_US.UTF-8 sort <<<$'a
B
c')

comm: file 2 is not in sorted order

$ LC_COLLATE=en_US.UTF-8 comm -3
<(LC_COLLATE=C sort <<<$'a
B
c')
<(LC_COLLATE=en_US.UTF-8 sort <<<$'a
B
c')
a
comm: file 1 is not in sorted order


So the solution is:
* Treat the pacman bug as what it is, a separate bug. Since it *does* sort,
just to the wrong LC_COLLATE. This is much cleaner than forking sort(1).

* Or, simply change comm to LC_COLLATE=C and speed it up since this collation
is always faster.

Andres P
 

Thread Tools




All times are GMT. The time now is 10:41 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org