View previous topic :: View next topic |
Author |
Message |
robert99 n00b
Joined: 12 Jan 2006 Posts: 5 Location: Munich/Germany
|
Posted: Thu Sep 25, 2008 12:49 pm Post subject: canonical way to emerge a package with private patch? |
|
|
Hi,
What is the suggested way to apply a private/self-made/not-official patch, if I want to emerge some application with this patch?
In my case, I use noteedit, which has an error, which I corrected for myself, but this correction did not make it until now to some official release (who wonders, the correction is now 2 hours old ).
I did:
create the patch (diff -Naur etc)
copied the patch to /usr/portage/media-sound/noteedit/files/
edited noteedit-2.8.1.ebuild, added my patch to the line "PaATCHES = ( ....)"
did an "ebuild noteedit-2.8.1.ebuild manifest"
emerge noteedit
But, of course: after the next "emerge --sync", my patch will be gone.
Regards, Robert |
|
Back to top |
|
|
DtZ Tux's lil' helper
Joined: 09 Sep 2005 Posts: 124
|
Posted: Thu Sep 25, 2008 1:50 pm Post subject: |
|
|
You could move your modified ebuild to local overlay. This way it'll be preserved after next portage sync. That's how I deal with my custom ebuilds. |
|
Back to top |
|
|
zyko l33t
Joined: 01 Jun 2008 Posts: 620 Location: Munich, Germany
|
|
Back to top |
|
|
robert99 n00b
Joined: 12 Jan 2006 Posts: 5 Location: Munich/Germany
|
Posted: Sat Sep 27, 2008 1:33 pm Post subject: |
|
|
Hm, that describes only, how to patch within an ebuild file. I thought more of a method, where I would not need to patch the ebuild
something like "ebuld <ebuild-file> unpack --additional-patch mypatch" or something like that. But this seems not to be intended?
So I think, the overlay portage tree is the best way to handle with private patches.
Thank you, Robert |
|
Back to top |
|
|
zyko l33t
Joined: 01 Jun 2008 Posts: 620 Location: Munich, Germany
|
Posted: Sat Sep 27, 2008 2:52 pm Post subject: |
|
|
You could issue ebuild <package> unpack, patch the source manually and then continue with ebuild <package> compile, ebuild <package> install, etc.
This change will however not be remembered by Portage if you reinstall the package, so you'd have to do it again (in case). Putting a modified ebuild in you local overlay allows consistent behaviour, even if you forget about your patch or if you do unattended emerging. |
|
Back to top |
|
|
yngwin Retired Dev
Joined: 19 Dec 2002 Posts: 4572 Location: Suzhou, China
|
Posted: Sat Sep 27, 2008 8:40 pm Post subject: |
|
|
zyko wrote: | Putting a modified ebuild in you local overlay allows consistent behaviour |
++
That is the "canonical" way. _________________ "Those who deny freedom to others deserve it not for themselves." - Abraham Lincoln
Free Culture | Defective by Design | EFF |
|
Back to top |
|
|
robert99 n00b
Joined: 12 Jan 2006 Posts: 5 Location: Munich/Germany
|
Posted: Sun Sep 28, 2008 12:17 pm Post subject: |
|
|
yngwin wrote: | zyko wrote: | Putting a modified ebuild in you local overlay allows consistent behaviour |
++
That is the "canonical" way. |
Ok, understood. This is, what I have done now.
Many thanks, Robert |
|
Back to top |
|
|
tarpman Veteran
Joined: 04 Nov 2004 Posts: 1083 Location: Victoria, BC, Canada
|
Posted: Mon Sep 29, 2008 1:32 am Post subject: |
|
|
While it's not the "correct" way, I use this code in /etc/portage/bashrc:
Code: | #!/bin/sh
PATCHDIR_BASE="/usr/local/portage/patches"
PATCHDIRS=" \
${PATCHDIR_BASE}/${P}
${PATCHDIR_BASE}/${CATEGORY}/${PN}
${PATCHDIR_BASE}/${CATEGORY}/${PN}:${SLOT}"
PATCHED="${PORTAGE_BUILDDIR}/.patched"
UNPACKED="${PORTAGE_BUILDDIR}/.unpacked"
case "$EBUILD_PHASE" in
compile)
# apply local patches if any exist
if has_local_patches && needs_local_patches; then
apply_local_patches
fi
;;
postinst)
# run localepurge after install into live fs
[ -x /usr/bin/localepurge ] && /usr/bin/localepurge
;;
esac
has_local_patches() {
for patchdir in $PATCHDIRS ; do
if [ -d "$patchdir" ] ; then
return 0
fi
done
return 1
}
needs_local_patches() {
if [ -f "$PATCHED" -a "$PATCHED" -nt "$UNPACKED" ] ; then
return 1
else
return 0
fi
}
apply_local_patches() {
einfo "Applying local patches to $P..."
# pull in eutils and shut up QA messages
if ! hasq "eutils" $INHERITED ; then
INHERITED="$INHERITED eutils multilib portability toolchain-funcs"
inherit eutils
fi
# apply all patches
cd "$S"
for patchdir in $PATCHDIRS ; do
if [ -d "$patchdir" ] ; then
EPATCH_SOURCE="$patchdir" EPATCH_SUFFIX="patch" epatch
fi
done
# mark as done patching
/bin/touch "$PATCHED"
} |
Then I put my patches in one of the PATCHDIRs following the epatch naming convention. If you search the forums a bit you'll find other code that does more than this does, such as regenerating autotools build systems if autotools scripts are changed. _________________ Saving the world, one kilobyte at a time. |
|
Back to top |
|
|
|