Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Script to 'emerge sync' a specific package category
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
shiznix
Guru
Guru


Joined: 29 Jun 2003
Posts: 367
Location: Adelaide, Australia

PostPosted: Thu Dec 25, 2003 1:02 pm    Post subject: Script to 'emerge sync' a specific package category Reply with quote

Here is a small shell script to query specific 'package-category/package' in the current portage tree & sync just that specific package or package-category if you so wish.

The Script
Code:
#!/bin/sh
# specsync - A small script to query & sync specific package-category/package
#             in the current Gentoo portage tree.
# Usage: specsync (--pretend) <package-category>

if [ `/usr/bin/whoami` != 'root' ]
        then
echo "You must be root"
exit
fi

RSYNC="rsync.gentoo.org"
SRC="gentoo-portage"
DEST="/usr/portage"
CAT=$1
PCAT=$2

if [ -z "$1" ]
        then
echo "Usage -> $0 (--pretend) <package-category>"

elif [ $CAT = "--pretend" ]
        then
/usr/bin/rsync $RSYNC::$SRC/$PCAT/

else

if [ ! -d $DEST/$CAT ]
        then
mkdir -p $DEST/$CAT
fi

/usr/bin/rsync -rlptDvz --progress --stats --delete --delete-after $RSYNC::$SRC/$CAT/ $DEST/$CAT/
fi


Usage examples:
Code:
specsync --pretend x11-base

Lists current packages contained in the x11-base category.

Code:
specsync --pretend x11-base/xdirectfb

Lists current ebuilds contained in x11-base/xdirectfb.

Code:
specsync x11-base

Syncs your portage tree to the current x11-base category.

Code:
specsync x11-base/xdirectfb

Syncs your portage tree to the current x11-base/xdirectfb package.

Note:
Use with caution. The portage tree is a highly integrated set of ebuilds. Upgrading specific parts & not the whole, may upset the emerging of other packages, by it looking for ebuilds that are not in your portage tree.
Which is probably why this 'feature' is not present in the emerge command. :roll:
If this should ever happen, just 'emerge sync'.
Back to top
View user's profile Send private message
GentooBox
Veteran
Veteran


Joined: 22 Jun 2003
Posts: 1168
Location: Denmark

PostPosted: Thu Dec 25, 2003 4:41 pm    Post subject: Reply with quote

You can upgrade the script with some colors.

Code:
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"


thats my SYNC.
you could upgrade the scipt like this:

#What mirror do you want to use ?
#europe
#other
#gentoo
PART="europe"

RSYNC="rsync.$PART.gentoo.org"

or something like that.
i cant remember other mirrors like "europe".

:)
_________________
Encrypt, lock up everything and duct tape the rest
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum