Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Unsupported Software
  • Search

To have a fast look at ebuilds

This forum covers all Gentoo-related software not officially supported by Gentoo. Ebuilds/software posted here might harm the health and stability of your system(s), and are not supported by Gentoo developers. Bugs/errors caused by ebuilds from overlays.gentoo.org are covered by this forum, too.
Post Reply
Advanced search
17 posts • Page 1 of 1
Author
Message
kKDu
Apprentice
Apprentice
User avatar
Posts: 187
Joined: Mon Aug 18, 2003 7:56 pm

To have a fast look at ebuilds

  • Quote

Post by kKDu » Fri Oct 03, 2003 3:05 pm

[NOTE]: The same result of these script you can get now with esearch.

Code: Select all

esearch -e sylpheed-claws
[ U] sylpheed-claws (0.9.7):  Bleeding edge version of Sylpheed
 Portage [1] sylpheed-claws-0.9.5-r1
 Portage [2] sylpheed-claws-0.9.7
 Portage [3] sylpheed-claws-0.9.8
 Overlay [4] sylpheed-claws-0.9.5-r2
 
Show Ebuild:
Only the lookout is little different.
[/NOTE]

Often I would like to have a fast look in a ebuild. So I have created a short script, called ecat, that is doing this.

Now I must only write

Code: Select all

ecat sylpheed-claws
in any directory and I see a list in which I can choose the sylpheed-claws-ebuild I want to see.

Code: Select all

evim sylpheed-claws
The last stable version is:
  [ U] sylpheed-claws (0.9.7): Bleeding edge version of Sylpheed
  
Choose a ebuild...:
[ 1 ]   sylpheed-claws-0.9.5-r1
[ 2 ]   sylpheed-claws-0.9.7
[ 3 ]   sylpheed-claws-0.9.8
[ 4 O]   sylpheed-claws-0.9.5-r2
...by entering a number:
Here is the script:
NOTE: You must have emerged esearch

Code: Select all

#!/bin/bash

# here you can put an editor of your choice, if you
# don't want to use the global $EDITOR
LOCAL_EDITOR=""  

if [ "$LOCAL_EDITOR" ]; then
  ECAT="$LOCAL_EDITOR"
elif [ "$EDITOR" ]; then
  ECAT="$EDITOR"
else 
  ECAT="cat"
fi

PORTDIR="/usr/portage"
#Looks for ${PORTDIR} and ${PORTDIR_OVERLAY}
source /etc/make.conf

#Set up colors
NO="\x1b[0;0m"
BR="\x1b[0;01m"
CY="\x1b[36;01m"
GR="\x1b[32;01m"

#Use ${PORTDIR} if it exists
if [ -d ${PORTDIR}"/"`esearch -n ^$1\$ | awk 'NR==4 { print $2 }'` ]; then
  edir=${PORTDIR}"/"`esearch -n ^$1\$ | awk 'NR==4 { print $2 }'`
fi
#Use ${PORTDIR_OVERLAY} if it exists, too.
if [ -d ${PORTDIR_OVERLAY}"/"`esearch -n ^$1\$ | awk 'NR==4 { print $2 }'` ]; then
  edir_overlay=${PORTDIR_OVERLAY}"/"`esearch -n ^$1\$ | awk 'NR==4 { print $2 }'`
fi

echo -e $GR"The last stable version is:"$NO
echo "  "`esearch -c ^$1\$`
echo " "
echo -e $GR"Choose a ebuild...:"$NO
#List the ebuilds. Ebuilds, that are in ${PORTDIR_OVERLAY} are listen at
#the end with a O next to their number
declare -a ebuild
for i in `ls $edir | awk '/ebuild$/ { print }'`;do
  z=$[$z+1]
  echo -e "["$CY $z $NO"]  "$BR $i $NO | sed 's/\.ebuild//g'
  ebuild[$z]=$i
done
for i in `ls $edir_overlay | awk '/ebuild$/ { print }'`; do
  z=$[$z+1]
  echo -e "["$CY $z" O"$NO"]  "$BR $i $NO | sed 's/\.ebuild//g'
  ebuild[$z]=$i
done
echo -ne $GR"...by entering a number: "$NO
read number
if [ $number ]; then
  echo " "
  echo "   * * * "$ECAT" "${ebuild[$number]}" * * *"
  echo " "
  if [ -e $edir/${ebuild[$number]} ]; then
    $ECAT $edir/${ebuild[$number]} #| less
  else
    $ECAT $edir_overlay/${ebuild[$number]} #| less
  fi 
fi


Changelog
2003-10-03 if you press enter instead of a number, you are leaving the script
2003-10-21 change the editor choosing dialog
2004-01-21 now overlay works correct and I have change the EDITOR dialog again
Last edited by kKDu on Wed Jan 21, 2004 7:42 pm, edited 10 times in total.
Top
Pythonhead
Developer
Developer
User avatar
Posts: 1801
Joined: Mon Dec 16, 2002 6:30 pm
Location: Redondo Beach, Republic of Calif.
Contact:
Contact Pythonhead
Website

  • Quote

Post by Pythonhead » Fri Oct 03, 2003 3:39 pm

Very handy.

It would be nice if you could have it also check the overlay directory.
You could grab those values pretty easily with:

Code: Select all

source /etc/make.conf
Then reference ${PORTDIR} and ${PORTDIR_OVERLAY}
Top
kKDu
Apprentice
Apprentice
User avatar
Posts: 187
Joined: Mon Aug 18, 2003 7:56 pm

  • Quote

Post by kKDu » Fri Oct 03, 2003 4:08 pm

Nice trick.

I have added it :D

:oops: But not enough, now only /usr/portage, ${PORTDIR} or {PORTDIR_OVERLAY} are avaiable. But if you have some ebuilds in /usr/portage for mozilla and some in ${PORTDIR_OVERLAY}, only ebuilds in /usr/portage will be avaiable.

I'm going to change this
Top
kKDu
Apprentice
Apprentice
User avatar
Posts: 187
Joined: Mon Aug 18, 2003 7:56 pm

  • Quote

Post by kKDu » Fri Oct 03, 2003 5:54 pm

Now it works for me with all, ${PORTDIR} and ${PORTDIR_OVERLAY} ebuilds. Ebuilds from ${PORTDIR_OVERLAY} are identified with a O next to their number:

Code: Select all

root #ecat freevo
The last stable version is:
  [MN] freevo (1.3.4): Digital video jukebox (PVR, DVR). [ N] freevo (1.3.1): Freevo
  
Choose a ebuild...:
[ 1 ]   freevo-1.3.4
[ 2 O]   freevo-1.3.1
[ 3 O]   freevo-1.3.2_pre2-r2
[ 4 O]   freevo-1.3.2_pre3
[ 5 O]   freevo-1.3.2_pre4
...by entering a number:
Have fun with it :twisted:
Top
kKDu
Apprentice
Apprentice
User avatar
Posts: 187
Joined: Mon Aug 18, 2003 7:56 pm

  • Quote

Post by kKDu » Sat Oct 04, 2003 5:14 pm

Important change (see change-log)
Top
saskatchewan46
n00b
n00b
User avatar
Posts: 57
Joined: Tue Jul 08, 2003 11:49 pm
Location: Saskatchewan

  • Quote

Post by saskatchewan46 » Sat Oct 18, 2003 4:24 am

This is very useful and fast script. I edited it slightly and renamed it "enano" as I nano the ebuild rather than cat. Thanks muchly for this...
Top
BitJam
Advocate
Advocate
Posts: 2513
Joined: Tue Aug 12, 2003 4:15 pm
Location: Silver City, NM

  • Quote

Post by BitJam » Sat Oct 18, 2003 4:40 am

Kudos kKDu for a great script. It deserves a place in gentoolkit.
Top
haceye
Apprentice
Apprentice
User avatar
Posts: 187
Joined: Thu May 22, 2003 5:37 pm
Location: Stuttgart, Germany
Contact:
Contact haceye
Website

  • Quote

Post by haceye » Mon Oct 20, 2003 3:26 pm

Hi,

I have talked to kKDu and he allowed me to add a similar function to directly into esearch.

You can use it like this:

Code: Select all

$ emerge ">=esearch-0.5" # You need the current version
$ esearch -e gentoolkit
[ U] gentoolkit (0.1.33):  Collection of unofficial administration scripts for Gentoo
 Portage [1] gentoolkit-0.1.32
 Portage [2] gentoolkit-0.1.33
 Portage [3] gentoolkit-0.1.32-r1

Show Ebuild: 2
# ...
David
faster 'emerge -s'? emerge esearch
Top
BitJam
Advocate
Advocate
Posts: 2513
Joined: Tue Aug 12, 2003 4:15 pm
Location: Silver City, NM

  • Quote

Post by BitJam » Mon Oct 20, 2003 4:13 pm

haceye wrote:I have talked to kKDu and he allowed me to add a similar function to directly into esearch.
It works great! I have one suggestion. After I am done looking at an ebuild I would prefer to be taken back to the list of ebuilds instead of exiting. Maybe the choice of zero could be used to exit.
Top
kKDu
Apprentice
Apprentice
User avatar
Posts: 187
Joined: Mon Aug 18, 2003 7:56 pm

  • Quote

Post by kKDu » Mon Oct 20, 2003 5:11 pm

Oh yes, it works :D

The only thing, I'm missing is a sort list of output:

Code: Select all

 esearch -e mozilla
...
[ U] mozilla (1.4-r3):  The Mozilla Web Browser
 Portage [7] mozilla-1.5
 Portage [8] mozilla-1.4-r3
 Portage [9] mozilla-1.0.1-r3
 Portage [10] mozilla-1.1-r1
 Portage [11] mozilla-1.4-r4
 Portage [12] mozilla-1.3-r2
 Portage [13] mozilla-1.2.1-r5
like this :wink:

Code: Select all

ecat mozilla
The last stable version is:
  [ U] mozilla (1.4-r3): The Mozilla Web Browser
  
Choose a ebuild...:
[ 1 ]   mozilla-1.0.1-r3
[ 2 ]   mozilla-1.1-r1
[ 3 ]   mozilla-1.2.1-r5
[ 4 ]   mozilla-1.3-r2
[ 5 ]   mozilla-1.4-r3
[ 6 ]   mozilla-1.4-r4
[ 7 ]   mozilla-1.5
...by entering a number:
Top
haceye
Apprentice
Apprentice
User avatar
Posts: 187
Joined: Thu May 22, 2003 5:37 pm
Location: Stuttgart, Germany
Contact:
Contact haceye
Website

  • Quote

Post by haceye » Mon Oct 20, 2003 8:22 pm

Hi kKDu (I hope I spelled it right ;-)),

I noticed this error, too. It occurs because listdir() doesn't sort it's output. Here's a little patch to fix this.
Will be part of esearch-0.5.1, of course.

Code: Select all

54c54,56
<         for file in listdir(path):
---
>         list = listdir(path)
>         list.sort()
>         for file in list:
David
faster 'emerge -s'? emerge esearch
Top
meowsqueak
Veteran
Veteran
User avatar
Posts: 1549
Joined: Tue Aug 26, 2003 6:46 am
Location: New Zealand

  • Quote

Post by meowsqueak » Mon Oct 20, 2003 10:43 pm

Why not have a variable defined at the top that you can easily change to support nano, vi, etc. Then you don't have to worry about searching and replacing through the script.
Top
BitJam
Advocate
Advocate
Posts: 2513
Joined: Tue Aug 12, 2003 4:15 pm
Location: Silver City, NM

  • Quote

Post by BitJam » Wed Oct 29, 2003 4:16 pm

meowsqueak wrote:Why not have a variable defined at the top that you can easily change to support nano, vi, etc. Then you don't have to worry about searching and replacing through the script.
The $PAGER variable might be a good choice. This should already be set to the pager of choice for most people and can be overrriden via:

Code: Select all

PAGER=wacky_pager ecat ebuild
Top
meowsqueak
Veteran
Veteran
User avatar
Posts: 1549
Joined: Tue Aug 26, 2003 6:46 am
Location: New Zealand

  • Quote

Post by meowsqueak » Wed Oct 29, 2003 7:29 pm

No, do not use $PAGER throughout the script - that would not improve anything. Instead, use an internal variable everywhere in the script, and at the start, set this variable to $PAGER. Some people use this script with nano or vi, which is usually not in $PAGER, and may be in $EDITOR. Having to replace all instances of PAGER with EDITOR defeats the purpose of my original idea, but if there's a single line that you can change to, e.g. 'local PROG=$EDITOR' then it becomes easier to change. This is something that should be considered in ALL scripts - hardcoded program locations are bad too.

Define everything at the start, then use those internal variables throughout the script. That's part of what makes a script well-written.
Top
Genone
Retired Dev
Retired Dev
User avatar
Posts: 9656
Joined: Fri Mar 14, 2003 6:02 pm
Location: beyond the rim

  • Quote

Post by Genone » Sun Nov 16, 2003 5:39 am

We also have now ewhich in gentoolkit which will give you the ebuild filename portage would use for a given package name.
Top
kKDu
Apprentice
Apprentice
User avatar
Posts: 187
Joined: Mon Aug 18, 2003 7:56 pm

  • Quote

Post by kKDu » Wed Jan 21, 2004 7:48 pm

For all that have had problems with the overlay-directory and the sort of the ebuilds, this is now fixed.

NOTE: you don't need this script, if you are happy with esearch -e, which does the same.
Top
razamatan
Apprentice
Apprentice
User avatar
Posts: 160
Joined: Fri Feb 28, 2003 8:51 am
Contact:
Contact razamatan
Website

  • Quote

Post by razamatan » Thu Jan 22, 2004 3:39 am

Genone wrote:We also have now ewhich in gentoolkit which will give you the ebuild filename portage would use for a given package name.
thanks for the heads up...

Code: Select all

vi `ewhich [pkgname]`
lovely.
a razamatan doth speaketh,
"Never attribute to malice, that which can be adequately explained by stupidity"
Top
Post Reply

17 posts • Page 1 of 1

Return to “Unsupported Software”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic