Bug 25216 - mkboot in debianutils uses qpkg to search all packages
Bug#: 25216 Product:  Gentoo Linux Version: 1.4_rc4 Platform: All
OS/Version: Linux Status: RESOLVED Severity: minor Priority: P2
Resolution: FIXED Assigned To: azarah@gentoo.org Reported By: farcepest@gmail.com
Component: Core system
URL: 
Summary: mkboot in debianutils uses qpkg to search all packages
Keywords:  
Status Whiteboard: 
Opened: 2003-07-24 17:27 0000
Description:   Opened: 2003-07-24 17:27 0000
In /usr/sbin/mkboot grubcheck(), grub is tested for by the line:

[ "$(qpkg -nc sys-apps/grub)" = "sys-apps/grub *" ]

This is a big time-waster, because it crawls the entire portage tree. If your
portage tree is mounted via NFS, this is painful...

A better solution is:

[ "$(qpkg -I -nc sys-apps/grub)" = "sys-apps/grub" ]

An updated version of debianutils-1.16.7-gentoo.patch will be attached.

Reproducible: Always
Steps to Reproduce:
1. Use mkboot, usually via kernel's make install
2.
3.

Actual Results:  
It finds grub (slowly)

Expected Results:  
Find grub (quickly)

------- Comment #1 From Andy Dustman 2003-07-24 17:29:26 0000 -------
Created an attachment (id=14976) [details]
Make mkboot not read the whole portage tree

This is a modified version of debianutils-1.16.7-gentoo.patch in the current
portage tree which makes the grubcheck() function of mkboot much faster.

------- Comment #2 From Jon Riley 2003-08-12 07:38:25 0000 -------
I bumped up against this but in a worse form - It's not just slow, it doesn't
work.

The line
[ "$(qpkg -I -nc sys-apps/grub)" = "sys-apps/grub" ]
Fails to detect my grub because I also have grub-static installed, which causes
qpkg to return

sys-apps/grub *
sys-apps/grub-static

which fails the test.

------- Comment #3 From Jon Riley 2003-08-12 07:49:15 0000 -------
Quick correction - I typoed

[ "$(qpkg -nc sys-apps/grub)" = "sys-apps/grub *" ]

Is the line that doesn't work

[ "$(qpkg -I -nc sys-apps/grub)" = "sys-apps/grub" ]

does work.

------- Comment #4 From Gregorio Guidi (RETIRED) 2003-09-11 03:07:50 0000 -------
if [ -x /usr/bin/qpkg ] ; then 
  [ "$(qpkg -I -nc sys-apps/grub)" = "sys-apps/grub" ] 
else 
  return 1 
fi 
 
This never returns zero! 
At least it should be: 
 
if [ -x /usr/bin/qpkg ] ; then 
  [ "$(qpkg -I -nc sys-apps/grub)" = "sys-apps/grub" ] && return 0 
else 
  return 1 
fi 
 
But it cannot fail just because gentoolkit is not installed, and there's the 
grub-static problem... Summing up, why don't we simply have 
if [ -f /boot/grub/grub.conf ] ; then 
  return 0 
else 
  return 1 
fi 
 

------- Comment #5 From Martin Schlemmer (RETIRED) 2003-09-24 19:26:40 0000 -------
As /boot might not be mounted ...

------- Comment #6 From Martin Schlemmer (RETIRED) 2003-09-24 19:56:20 0000 -------
Anyhow, use portageq and not quickpkg.