From: Benno Schulenberg <benno.schulenberg@gmail.com>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] working with overlays
Date: Mon, 01 Jan 2007 21:52:21 +0100 [thread overview]
Message-ID: <200701012152.21114.benno.schulenberg@gmail.com> (raw)
In-Reply-To: <200701011831.36066.bo.andresen@zlin.dk>
Bo Ørsted Andresen wrote:
> On Friday 22 December 2006 20:09, Benno Schulenberg wrote:
> > Bo once said (or was it someone else?) he
> > had such a script. If so, Bo, please post the script.
>
> You may be referring to this post:
>
> http://thread.gmane.org/gmane.linux.gentoo.user/164432/focus=164437
Ah, yes. Thanks.
Meanwhile my own script evolved a little further:
-----8<------------------------------------------
#!/bin/bash
# ovlay.sh version 0.2
OVERLAY=/usr/local/portage
unset BUMP DELETE EDIT HELP NEWVERSION RENUMBER REST
if [[ -z $EDITOR ]]; then
EDITOR="vim"
fi
for ARGUMENT in $*; do
if [[ "$BUMP" == "take" ]]; then
NEWVERSION="$ARGUMENT"
BUMP="yes"
continue
fi
case "$ARGUMENT" in
"-b"|"--bump") BUMP="take";;
"-d"|"--delete") DELETE="yes";;
"-e"|"--edit") EDIT="yes";;
"-h"|"--help") HELP="yes";;
"-r"|"--renumber") RENUMBER="yes";;
*) REST="$REST $ARGUMENT";;
esac
done
# Redefine positional arguments:
set -- $REST
if [[ $HELP || -z "$1" ]]; then
PROGRAM=${0##/[a-z]*/}
echo "Usage: $PROGRAM [-e|--edit] package_name [patch_name...]"
echo " $PROGRAM -d|--delete package_name..."
echo " $PROGRAM -b|--bump new_version_number [-r|--renumber] package_name"
echo ""
echo "Copies the latest ebuild of the specified package to the local overlay,"
echo "and optionally allows you to bump it, insert patches, and edit it."
exit 0
elif [[ "$BUMP" == "take" ]]; then
echo "Specify a new version number."
exit 2
elif [[ $RENUMBER && -z $BUMP ]]; then
echo "Renumbering is only possible with version bumping."
exit 2
fi
if [[ $DELETE ]]; then
if [[ $BUMP || $EDIT || $RENUMBER ]]; then
echo "Deletion does not go together with other options."
exit 2
fi
while [[ "$1" ]]; do
if ls -d /${OVERLAY}/*/$1 &>/dev/null; then
rm -r /${OVERLAY}/*/$1
else
echo "There is no overlay for '$1'."
exit 2
fi
shift
done
# Remove empty dirs (there must be a better way):
ls -dl /${OVERLAY}/* | grep "x 2 root" | sed 's/.* //' |
while read dir; do rmdir $dir; done
exit 0
fi
##shopt -s -o xtrace
EMERGEOUT="$(emerge -qOp $1 2>/dev/null)"
if [[ $? != 0 ]]; then
EMERGEOUT="$(emerge -qOp =$1 2>/dev/null)"
if [[ $? != 0 ]]; then
echo "Package '$1' not found."
exit 2
fi
fi
NAMENUMBER=$(echo $EMERGEOUT | sed -e 's:^[^/]*\]::' -e 's:\[.*$::' -e 's: ::g')
CATPACK=${NAMENUMBER%%-[0-9]*}
PACKAGE=${NAMENUMBER##[a-z]*/}
FULLPATH=${OVERLAY}/${CATPACK}
NAME=${PACKAGE%%-[0-9]*}
VERSION=${PACKAGE##[a-z]*-}
if [[ $NAME != $1 && $PACKAGE != $1 ]]; then
echo "*Internal error*: determination of package name is wrong."
exit 4
fi
# When wanting to edit an already existing ebuild and not giving any further
# arguments, do not first recreate the ebuild, but just allow editting it:
if [[ $EDIT && -f /$FULLPATH/${PACKAGE}.ebuild && -z "$2" ]]; then
vim /$FULLPATH/${PACKAGE}.ebuild
ebuild ${FULLPATH}/${PACKAGE}.ebuild digest >/dev/null
emerge -pqv =${PACKAGE}
exit 0
fi
mkdir -p /${FULLPATH}
cp /usr/portage/${CATPACK}/${PACKAGE}.ebuild /${FULLPATH}/
cp -a /usr/portage/${CATPACK}/files /${FULLPATH}/
if [[ $BUMP ]]; then
mv /${FULLPATH}/${PACKAGE}.ebuild /${FULLPATH}/${NAME}-${NEWVERSION}.ebuild
if [[ $RENUMBER ]]; then
# Renumber versioned patches:
rename "${VERSION}" "${NEWVERSION}" /${FULLPATH}/files/*${VERSION}*
fi
PACKAGE=${NAME}-${NEWVERSION}
fi
# Insert any trailing arguments as patches:
if [[ "$2" ]]; then
echo -e '\n\npost_src_unpack() { cd ${S}' >>/${FULLPATH}/${PACKAGE}.ebuild
while [[ "$2" ]]; do
if [[ ! -f $2 ]]; then
echo "Patch file '$2' not found."
exit 2
fi
cp $2 /${FULLPATH}/files/
echo -e '\tepatch ${FILESDIR}/'$2 >>/${FULLPATH}/${PACKAGE}.ebuild
shift
done
echo -e "}\n" >>/${FULLPATH}/${PACKAGE}.ebuild
fi
if [[ $EDIT ]]; then
vim /$FULLPATH/${PACKAGE}.ebuild
fi
rm /$FULLPATH/files/digest-*
# Strangely this does not allow a double leading slash:
ebuild ${FULLPATH}/${PACKAGE}.ebuild digest >/dev/null
emerge -pqv =${PACKAGE}
-----8<------------------------------------------
Benno
--
Cetere mi opinias ke ne ĉio tradukenda estas.
--
gentoo-user@gentoo.org mailing list
next prev parent reply other threads:[~2007-01-01 20:56 UTC|newest]
Thread overview: 123+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-18 14:47 [gentoo-user] Is Gentoo healthy? Grant
2006-12-18 16:25 ` Mrugesh Karnik
2006-12-18 16:36 ` Grant
2006-12-18 17:50 ` Bo Ørsted Andresen
2006-12-18 18:28 ` Grant
2006-12-18 17:07 ` Richard Broersma Jr
2006-12-18 17:17 ` Danyelle Gragsone
2006-12-18 17:49 ` Alan McKinnon
2006-12-18 18:35 ` Grant
2006-12-18 23:15 ` Iain Buchanan
2006-12-19 7:10 ` Alan McKinnon
2006-12-18 23:14 ` Iain Buchanan
2006-12-20 1:58 ` Grant
2006-12-20 2:23 ` Colleen Beamer
2006-12-20 4:43 ` Dale
2006-12-20 9:16 ` Andrey Gerasimenko
2006-12-20 14:33 ` Jeff Rollin
2006-12-20 23:03 ` Bryan Østergaard
2006-12-21 4:43 ` Grant
2006-12-21 9:00 ` Andrey Gerasimenko
2006-12-21 19:51 ` Bryan Østergaard
2006-12-20 6:18 ` Uwe Thiem
2006-12-20 9:43 ` Neil Bothwick
2006-12-20 10:46 ` Uwe Thiem
2006-12-20 11:14 ` Boyd Stephen Smith Jr.
2006-12-20 11:11 ` Boyd Stephen Smith Jr.
2006-12-20 11:37 ` Bo Ørsted Andresen
2006-12-20 11:54 ` Neil Bothwick
2006-12-20 19:18 ` Steve Dibb
2006-12-20 23:12 ` Dale
2006-12-21 8:54 ` Neil Bothwick
2006-12-22 1:10 ` Bo Ørsted Andresen
2006-12-22 9:08 ` Neil Bothwick
2006-12-22 10:40 ` Jeff Rollin
2006-12-22 11:31 ` Hemmann, Volker Armin
2006-12-22 11:36 ` Jeff Rollin
2006-12-22 11:45 ` Hemmann, Volker Armin
2006-12-20 9:50 ` Neil Bothwick
2006-12-20 14:07 ` Grant
2006-12-20 14:36 ` Hans-Werner Hilse
2006-12-18 17:27 ` Hemmann, Volker Armin
2006-12-18 18:54 ` Grant
2006-12-18 19:12 ` Mrugesh Karnik
2006-12-18 19:33 ` Andrew Gaydenko
2006-12-18 20:29 ` Philip Webb
2006-12-18 21:07 ` Roman Naumann
2006-12-18 22:00 ` Neil Walker
2006-12-18 22:26 ` Neil Bothwick
2006-12-18 19:18 ` Daniel da Veiga
2006-12-18 19:58 ` Grant
2006-12-18 20:26 ` Brandon Edens
2006-12-18 22:23 ` Neil Bothwick
2006-12-19 2:22 ` Bo Ørsted Andresen
2006-12-19 11:21 ` Neil Bothwick
2006-12-18 22:37 ` Neil Bothwick
2006-12-18 23:03 ` John J. Foster
2006-12-18 23:18 ` Jeff Rollin
2006-12-19 10:05 ` Neil Bothwick
2006-12-20 14:35 ` Jeff Rollin
2006-12-18 21:27 ` Hemmann, Volker Armin
2006-12-18 23:45 ` Iain Buchanan
2006-12-18 22:23 ` Bryan Østergaard
2006-12-19 6:42 ` Uwe Thiem
2006-12-18 22:34 ` Neil Bothwick
2006-12-19 0:01 ` Philip Webb
2006-12-19 1:13 ` Daryl Mathison
2006-12-20 14:56 ` Mark Knecht
2006-12-20 16:13 ` Alan McKinnon
2006-12-20 16:54 ` Daniel da Veiga
2006-12-20 17:16 ` Mark Knecht
2006-12-20 17:28 ` Nelson, David (ED, PAR&D)
2006-12-20 17:42 ` Mark Knecht
2006-12-20 17:58 ` Jeff Rollin
2006-12-20 18:05 ` Bo Ørsted Andresen
2006-12-21 7:20 ` Alan McKinnon
2006-12-21 15:55 ` Jeff Rollin
2006-12-21 16:07 ` Dale
2006-12-21 16:12 ` Jeff Rollin
2006-12-21 16:48 ` Nelson, David (ED, PAR&D)
2006-12-21 16:56 ` Jeff Rollin
2006-12-20 17:53 ` Bo Ørsted Andresen
2006-12-20 17:39 ` Bo Ørsted Andresen
2006-12-21 8:00 ` [gentoo-user] OT: " Andrey Gerasimenko
2006-12-21 8:33 ` Alan McKinnon
2006-12-21 8:47 ` Nelson, David (ED, PAR&D)
2006-12-21 9:25 ` Neil Bothwick
2006-12-21 9:43 ` Andrey Gerasimenko
2006-12-21 9:52 ` Bo Ørsted Andresen
2006-12-21 11:23 ` Andrey Gerasimenko
2006-12-21 13:28 ` Danyelle Gragsone
2006-12-20 19:09 ` [gentoo-user] " Benno Schulenberg
2006-12-20 19:39 ` Mark Knecht
2006-12-20 20:49 ` Uwe Thiem
2006-12-21 8:52 ` Neil Bothwick
2006-12-21 7:15 ` Alan McKinnon
2006-12-21 21:28 ` Benno Schulenberg
2006-12-21 22:38 ` Bo Ørsted Andresen
2006-12-22 0:26 ` Mark Knecht
2006-12-22 1:02 ` Bo Ørsted Andresen
2006-12-22 15:45 ` Benno Schulenberg
2006-12-22 16:55 ` Neil Bothwick
2006-12-22 7:16 ` Alan McKinnon
2006-12-22 9:06 ` Neil Bothwick
2006-12-22 9:35 ` Alan McKinnon
2006-12-22 10:42 ` Neil Bothwick
2006-12-22 19:09 ` [gentoo-user] working with overlays Benno Schulenberg
2006-12-23 0:04 ` Neil Bothwick
2006-12-24 11:53 ` Benno Schulenberg
2007-01-01 17:31 ` Bo Ørsted Andresen
2007-01-01 20:52 ` Benno Schulenberg [this message]
2006-12-23 11:47 ` [gentoo-user] Is Gentoo healthy? Bo Ørsted Andresen
2006-12-23 14:44 ` Neil Bothwick
2006-12-23 16:11 ` Boyd Stephen Smith Jr.
2006-12-23 16:11 ` Hemmann, Volker Armin
2006-12-22 16:02 ` Benno Schulenberg
2006-12-20 21:25 ` Hemmann, Volker Armin
2006-12-19 7:22 ` Alan McKinnon
2006-12-19 8:27 ` Andrey Gerasimenko
2006-12-19 13:48 ` Bryan Østergaard
2006-12-19 23:27 ` Iain Buchanan
2006-12-19 17:23 ` [gentoo-user] " Grant Edwards
2006-12-19 17:36 ` Justin Findlay
2006-12-20 2:00 ` Grant
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200701012152.21114.benno.schulenberg@gmail.com \
--to=benno.schulenberg@gmail.com \
--cc=gentoo-user@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox