Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Patching source before emerge (Unpacking?)
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
Inaba
n00b
n00b


Joined: 18 Jun 2002
Posts: 16

PostPosted: Tue Jun 18, 2002 3:40 pm    Post subject: Patching source before emerge (Unpacking?) Reply with quote

Hi all,

I need to make a very small change to the source of one of the portage packages. I can't seem to find any documentation or posts about how to unpack the source, apply my change and then emerge the whole thing.

I know it's possible, but it's being difficult.

Currently, I changed one of the already existing patch files, and then changed the resulting MD5SUM in the verification file. This is a bad thing, and I'm not sure it even worked properly.

Any help would be appreciated.
Back to top
View user's profile Send private message
delta407
Bodhisattva
Bodhisattva


Joined: 23 Apr 2002
Posts: 2876
Location: Chicago, IL

PostPosted: Tue Jun 18, 2002 3:43 pm    Post subject: Reply with quote

Get the full filename for the ebuild, and do the following:

Code:
# ebuild myebuild fetch (if you don't have it in distfiles)
# ebuild myebuild unpack (unpacked to /var/tmp/portage/packagename/something)
# ebuild myebuild compile
# ebuild myebuild install
# ebuild myebuild qmerge
Back to top
View user's profile Send private message
arkane
l33t
l33t


Joined: 30 Apr 2002
Posts: 918
Location: Phoenix, AZ

PostPosted: Tue Jun 18, 2002 4:22 pm    Post subject: Reply with quote

delta407 wrote:
Get the full filename for the ebuild, and do the following:

Code:
# ebuild myebuild fetch (if you don't have it in distfiles)
# ebuild myebuild unpack (unpacked to /var/tmp/portage/packagename/something)
# ebuild myebuild compile
# ebuild myebuild install
# ebuild myebuild qmerge


neat tip...
maybe put that in tips and tricks?
Back to top
View user's profile Send private message
474
l33t
l33t


Joined: 19 Apr 2002
Posts: 714

PostPosted: Thu Jun 20, 2002 12:21 am    Post subject: Or roll your own ebuild Reply with quote

Another way is to modify the ebuild file itself and insert any commands as necessary to patch the source code at the end of the src_unpack subroutine. These auto-defined shell variables can be used:

${P} = Program name/source subdirectory name
${S} = Source working path (under /var/tmp/portage)

So the fully qualified path for where the source code is after unpacking is : ${S}/${P}

You can see numerous examples of this in various ebuilds (xfree, gentoo-sources, apache etc) usually using patch or sed. You won't need to modify the digest file, and you can re-emerge without having to manually do your patching. But your customised ebuild will get hosed the next time you emerge rsync unless you (a) backup or (b) use CVS instead to update the portage tree.
Back to top
View user's profile Send private message
Inaba
n00b
n00b


Joined: 18 Jun 2002
Posts: 16

PostPosted: Fri Jun 21, 2002 3:22 pm    Post subject: Reply with quote

Thanks for the info folks :)

However... I can't seem to get this to work. When I try to unpack (for example) php, it says it can't find it... even though I know the tar file is there (I went and untarr'd it myself manually just to be sure)

For example, if I do this:

cm php-4.2.1-r1 # ebuild php-4.2.1-r1.ebuild unpack
!!! No message digest file found. /var/db/pkg/dev-lang/php-4.2.1-r1/files/digest-php-4.2.1-r1
!!! Type "ebuild foo.ebuild digest" to generate a digest.

That's what I get.

If I try to use the name w/o the .ebuild, it can't find it. If I use the tgz file, says it can't find it. What am I doing wrong?
Back to top
View user's profile Send private message
AutoBot
l33t
l33t


Joined: 22 Apr 2002
Posts: 968
Location: Usually Out

PostPosted: Sat Jun 22, 2002 1:29 am    Post subject: Reply with quote

You must do it this way:

Code:

ebuild /usr/portage/dev-lang/php/php-4.2.1-r1.ebuild unpack

_________________
This message self destructed a long time ago.
Back to top
View user's profile Send private message
AutoBot
l33t
l33t


Joined: 22 Apr 2002
Posts: 968
Location: Usually Out

PostPosted: Sat Jun 22, 2002 1:35 am    Post subject: Reply with quote

Oh and for packages that are masked you can do this instead of unmasking it:
Code:

ebuild /usr/portage/dev-foo/foo-bar/foo-1.2-r2.ebuild merge


And for those packages that emerge foo-package unmerge won't work on you can do this:

Code:

ebuild /usr/portage/dev-foo/foo-bar/foo-1.2-r2.ebuild unmerge

_________________
This message self destructed a long time ago.
Back to top
View user's profile Send private message
scottro
Tux's lil' helper
Tux's lil' helper


Joined: 13 Apr 2002
Posts: 141
Location: New York City

PostPosted: Tue Sep 03, 2002 12:16 am    Post subject: Reply with quote

I wanted to thank you people for this thread. I was trying to add a patch to mutt that enables it to send to OE users with the gpg signature in the message, rather than attached. This thread clarified the procedure for me.

Thanks again

Scott
Back to top
View user's profile Send private message
Bigbeanpole
n00b
n00b


Joined: 24 Apr 2003
Posts: 12

PostPosted: Sat Nov 13, 2004 8:21 pm    Post subject: Reply with quote

Would this be similiar to using an overlay directory? I've been told the basics on the procedure, and having this thread helped to clarify the procedure, however, how would I incorporate that into creating a .patch to be used in the emerge procedure?

The reason I ask is because I've been having troubles emerging avifile.... I keep getting an error that ld cannot find -lXrender, but I don't think ld is looking in the right directory. I need to modify the makefile to include the missing directory(which is located in the /etc/ld.so.conf file...but isn't being picked up for some reason).

Thoughts/suggestions on this would be greatly appreciated.
Back to top
View user's profile Send private message
iTux
Guru
Guru


Joined: 07 Sep 2004
Posts: 586
Location: Toronto

PostPosted: Sat Nov 13, 2004 10:40 pm    Post subject: Reply with quote

Bigbeanpole wrote:
Would this be similiar to using an overlay directory? I've been told the basics on the procedure, and having this thread helped to clarify the procedure, however, how would I incorporate that into creating a .patch to be used in the emerge procedure?


Hi,

To have the change "permanent", a portage overlay must be used. Modifying ebuild in portage tree good if want to test. Note, it usually does not take much time to actually use a portage overlay and you keep the changes after emerge sync. Need to think that you might want to recompile it later...

iTux
Back to top
View user's profile Send private message
jupiter_
n00b
n00b


Joined: 08 May 2005
Posts: 1

PostPosted: Sun May 08, 2005 3:15 am    Post subject: I'm a lamer :) Reply with quote

Hi!

I can't patch an ebuild.
There is an error in an ebuild, and I've got to patch it, but if I change the .ebuild file, I get size and md5 problems, like the starter of this topic.

So I unpack the ebuild as you wrote to do. And what's next? If I change the file in the /var/tmp/portage/pack/build-info/xy.ebuild it doesn't take any effect at 'ebuild pkname compile'.

The bad ebuild I torture with is pvm-3.4.4-r2.ebuild, Bugzilla Bug 71682. Two rows is needed to insert to the file.
Back to top
View user's profile Send private message
rusty
Apprentice
Apprentice


Joined: 07 May 2004
Posts: 181
Location: St.Louis

PostPosted: Thu Jul 14, 2005 6:46 pm    Post subject: Reply with quote

To get rid of digest warnings in an ebuild:
Code:
# ebuild /path/something.ebuild digest
Back to top
View user's profile Send private message
ftwig
n00b
n00b


Joined: 04 Nov 2005
Posts: 32

PostPosted: Thu Nov 24, 2005 4:18 pm    Post subject: Reply with quote

This thread looks like what I want but I am totaly new to patching. I am trying to patch a .ccp file from http://svn.mythtv.org/trac/changeset/7583. Do I just find the file and replace it?
Back to top
View user's profile Send private message
davy_gravy
n00b
n00b


Joined: 18 Aug 2007
Posts: 26

PostPosted: Mon Aug 20, 2007 6:16 am    Post subject: Reply with quote

thanks to contributors who offered ideas here, and encouragement to those who need help patching source before emerging a package...

the overlay is the right way to go... :D

I needed to patch a single value in the source for gnome-nettool-2.18.0 (the port scanner in it only scans from port 1 to port 7000, and this was super easy to change in the source, just replace 7000 w/ 65535). I had actually posted this bug (original bug filed at Ubuntu and the upstreamed-bug at Gnome) more than a year back when I was working in Ubuntu, but since I needed to switch to Gentoo, I thought that now I could actually do something about it ! :P

Although I''ve been tinkering w/ OpenEmbedded/Bitbake for a couple of months, Portage seemed to have much more sophistication... and is picky... and stuff seems like it is "all over the place"... but it does make some sense now to me. Here's how I did it.

1. My regular portage stuff is in /var/db/pkg/<category>/<package-name-ver#>/ . I made a careful note of the directory structure there, and how things were named. In particular I looked to see the path of the ebuild I needed to use:
Code:
/var/db/pkg/net-analyzer/gnome-nettool-2.18.0/gnome-nettool-2.18.0.ebuild


2. As shown in this article about cruft-finder (right at the top, where the author explains how to emerge cruft-finder), I made an overlay directory at /usr/local/portage/ and added in the line
Code:
PORTDIR_OVERLAY="/usr/local/portage"
to /etc/make.conf .

3. Then I moved to that dir
Code:
cd /usr/local/portage
and created a directory structure that was identical to that of the regular portage stuff:
Code:
/usr/local/portage/net-analyzer/gnome-nettool/
. Then I cd'ed there.

4. I went to a Gentoo mirror got the ebuild file :
Code:
wget http://ftp.riken.go.jp/pub/Linux/gentoo/net-analyzer/gnome-nettool/gnome-nettool-2.18.0.ebuild


5. From within /usr/local/portage/net-analyzer/gnome-nettool/ I performed repoman scan to make sure everything was in it proper place.
Code:
gentooi686 gnome-nettool # repoman scan

Setting paths:
PORTDIR = "/usr/portage"
PORTDIR_OVERLAY = "/usr/local/portage"

RepoMan scours the neighborhood...
!!! Manifest file not found: '/usr/local/portage/net-analyzer/gnome-nettool/Manifest'

  SRC_URI.syntax                 1
   net-analyzer/gnome-nettool-2.18.0.ebuild SRC_URI: getfetchlist(): aux_get() error reading net-analyzer/gnome-nettool-2.18.0; aborting.
  changelog.missing              1
   net-analyzer/gnome-nettool/ChangeLog
  digest.missing                 1
   net-analyzer/gnome-nettool/files/digest-gnome-nettool-2.18.0
  ebuild.allmasked               1
   net-analyzer/gnome-nettool
  ebuild.syntax                  1
   net-analyzer/gnome-nettool/gnome-nettool-2.18.0.ebuild
  filedir.missing                1
   /usr/local/portage/net-analyzer/gnome-nettool
  metadata.missing               1
   net-analyzer/gnome-nettool/metadata.xml
Please fix these important QA issues first.
RepoMan sez: "Make your QA payment on time and you'll never see the likes of me."
This told me that I had an OK directory structure, and that I was still missing the manifest.

6. To generate the manifest & set things up, I cd'ed up to .../portage/... and then I used "digest"
Code:
gentooi686 gnome-nettool # ls
gnome-nettool-2.18.0.ebuild
gentooi686 gnome-nettool # cd ..
gentooi686 net-analyzer # cd ..
gentooi686 portage # ebuild /usr/local/portage/net-analyzer/gnome-nettool/gnome-nettool-2.18.0.ebuild digest

>>> Creating Manifest for /usr/local/portage/net-analyzer/gnome-nettool



7. I directed portage/ebuild to fetch the source, but not anything more...
Code:
gentooi686 portage # ebuild /usr/local/portage/net-analyzer/gnome-nettool/gnome-nettool-2.18.0.ebuild fetch
 * gnome-nettool-2.18.0.tar.bz2 MD5 ;-) ...                                                               [ ok ]
 * gnome-nettool-2.18.0.tar.bz2 RMD160 ;-) ...                                                            [ ok ]
 * gnome-nettool-2.18.0.tar.bz2 SHA1 ;-) ...                                                              [ ok ]
 * gnome-nettool-2.18.0.tar.bz2 SHA256 ;-) ...                                                            [ ok ]
 * gnome-nettool-2.18.0.tar.bz2 size ;-) ...                                                              [ ok ]
 * checking ebuild checksums ;-) ...                                                                      [ ok ]
 * checking auxfile checksums ;-) ...                                                                     [ ok ]
 * checking miscfile checksums ;-) ...                                                                    [ ok ]
 * checking gnome-nettool-2.18.0.tar.bz2 ;-) ...                                                          [ ok ]




8. Then a simple unpack of the source code...
Code:
gentooi686 portage # ebuild /usr/local/portage/net-analyzer/gnome-nettool/gnome-nettool-2.18.0.ebuild unpack
 * gnome-nettool-2.18.0.tar.bz2 MD5 ;-) ...                                                               [ ok ]
 * gnome-nettool-2.18.0.tar.bz2 RMD160 ;-) ...                                                            [ ok ]
 * gnome-nettool-2.18.0.tar.bz2 SHA1 ;-) ...                                                              [ ok ]
 * gnome-nettool-2.18.0.tar.bz2 SHA256 ;-) ...                                                            [ ok ]
 * gnome-nettool-2.18.0.tar.bz2 size ;-) ...                                                              [ ok ]
 * checking ebuild checksums ;-) ...                                                                      [ ok ]
 * checking auxfile checksums ;-) ...                                                                     [ ok ]
 * checking miscfile checksums ;-) ...                                                                    [ ok ]
 * checking gnome-nettool-2.18.0.tar.bz2 ;-) ...                                                          [ ok ]
>>> Checking gnome-nettool-2.18.0.tar.bz2's mtime...
>>> WORKDIR is up-to-date, keeping...


9. I did my simple edit of the source code, which is actually somewhere else:
Code:
 nano /var/tmp/portage/net-analyzer/gnome-nettool-2.18.0/work/gnome-nettool-2.18.0/src/scan.c


10. Almost done - compile it...
Code:

gentooi686 portage # ebuild /usr/local/portage/net-analyzer/gnome-nettool/gnome-nettool-2.18.0.ebuild compile
 * gnome-nettool-2.18.0.tar.bz2 MD5 ;-) ...                                                                [ ok ]
 * gnome-nettool-2.18.0.tar.bz2 RMD160 ;-) ...                                                             [ ok ]
 * gnome-nettool-2.18.0.tar.bz2 SHA1 ;-) ...                                                               [ ok ]
 * gnome-nettool-2.18.0.tar.bz2 SHA256 ;-) ...                                                             [ ok ]
 * gnome-nettool-2.18.0.tar.bz2 size ;-) ...                                                               [ ok ]
 * checking ebuild checksums ;-) ...                                                                       [ ok ]
 * checking auxfile checksums ;-) ...                                                                      [ ok ]
 * checking miscfile checksums ;-) ...                                                                     [ ok ]
 * checking gnome-nettool-2.18.0.tar.bz2 ;-) ...                                                           [ ok ]
>>> Checking gnome-nettool-2.18.0.tar.bz2's mtime...
>>> WORKDIR is up-to-date, keeping...
>>> Compiling source in /var/tmp/portage/net-analyzer/gnome-nettool-2.18.0/work/gnome-nettool-2.18.0 ...
 * econf: updating gnome-nettool-2.18.0/config.guess with /usr/share/gnuconfig/config.guess
 * econf: updating gnome-nettool-2.18.0/config.sub with /usr/share/gnuconfig/config.sub
./configure --prefix=/usr --host=i686-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --disable-debug --build=i686-pc-linux-gnu
checking for a BSD-compatible install... /bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk

checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for i686-pc-linux-gnu-gfortran option to produce PIC... -fPIC

...blahblahblah...

>>> Source compiled.


11. Install it...
Code:
gentooi686 portage # ebuild /usr/local/portage/net-analyzer/gnome-nettool/gnome-nettool-2.18.0.ebuild install


12. Merge it w/ qmerge:
Code:
ebuild /usr/local/portage/net-analyzer/gnome-nettool/gnome-nettool-2.18.0.ebuild qmerge

...voila...done! Now I have a properly working Nettool/PortScanner right now, even if the upstream fix takes another year! :P
Back to top
View user's profile Send private message
biocyberman
n00b
n00b


Joined: 22 Jun 2017
Posts: 1

PostPosted: Thu Jun 22, 2017 8:01 am    Post subject: added equery command Reply with quote

Year 2017. This trhead is old, but since this thread showed up when I search "ebuild unpack only", I add this title trick to help others:
One can use
Code:
equery which <package_name>
to get full path to the ebuild file.

For example:
Code:
equery w xorg-x11
/usr/portage/x11-base/xorg-x11/xorg-x11-7.4-r2.ebuild


So it can be used with ebuild command like so:

Code:
ebuild $(equery w xorg-x11) fetch unpack
Back to top
View user's profile Send private message
fedeliallalinea
Administrator
Administrator


Joined: 08 Mar 2003
Posts: 30905
Location: here

PostPosted: Thu Jun 22, 2017 8:12 am    Post subject: Reply with quote

Now for appling a patch/es to a ebuild you can use /etc/portage/patches.
_________________
Questions are guaranteed in life; Answers aren't.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming 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