question about portage capabilities

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

question about portage capabilities

Denis-7
Hello all,

I am using a package called Rasmol, which is used for visualization of
molecular structures.  This software uses a certain table for atomic
sizes, and I need to change some values in that table - it is stored
in a header file within Rasmol source code.  There is an ebuild for
Rasmol, and it works fine - but what I'm wondering is how I can tell
portage to STOP once it unpacks Rasmol in the temporary work directory
- so I can tweak some things in the source code - and then resume the
build, using what's already in the work directory.  Looking at a
manpage for emerge, I didn't immediately get any creative ideas, but
might someone offer some advice for how to accomplish this?

Many thanks,
Denis

Reply | Threaded
Open this post in threaded view
|

Re: question about portage capabilities

Paul Hartman-3
On Sat, Apr 18, 2009 at 8:33 PM, Denis <[hidden email]> wrote:

> Hello all,
>
> I am using a package called Rasmol, which is used for visualization of
> molecular structures.  This software uses a certain table for atomic
> sizes, and I need to change some values in that table - it is stored
> in a header file within Rasmol source code.  There is an ebuild for
> Rasmol, and it works fine - but what I'm wondering is how I can tell
> portage to STOP once it unpacks Rasmol in the temporary work directory
> - so I can tweak some things in the source code - and then resume the
> build, using what's already in the work directory.  Looking at a
> manpage for emerge, I didn't immediately get any creative ideas, but
> might someone offer some advice for how to accomplish this?

Hi Denis,

Use the "ebuild" command to execute the steps of emerging
separately... read the manpage for the available options, but for
example you can do something like:

ebuild /usr/portage/foo-bar/yourpkg-1.2.3.ebuild unpack
ebuild /usr/portage/foo-bar/yourpkg-1.2.3.ebuild prepare
ebuild /usr/portage/foo-bar/yourpkg-1.2.3.ebuild configure
ebuild /usr/portage/foo-bar/yourpkg-1.2.3.ebuild compile
ebuild /usr/portage/foo-bar/yourpkg-1.2.3.ebuild preinst
ebuild /usr/portage/foo-bar/yourpkg-1.2.3.ebuild install
ebuild /usr/portage/foo-bar/yourpkg-1.2.3.ebuild postinst

and in-between those steps you can change to your portage tmpdir and
edit the unpacked source files and do whatever you need to do to them.

Reply | Threaded
Open this post in threaded view
|

Re: question about portage capabilities

Mike Kazantsev
In reply to this post by Denis-7
On Sat, 18 Apr 2009 21:33:18 -0400
Denis <[hidden email]> wrote:

> I am using a package called Rasmol, which is used for visualization of
> molecular structures.  This software uses a certain table for atomic
> sizes, and I need to change some values in that table - it is stored
> in a header file within Rasmol source code.  There is an ebuild for
> Rasmol, and it works fine - but what I'm wondering is how I can tell
> portage to STOP once it unpacks Rasmol in the temporary work directory
> - so I can tweak some things in the source code - and then resume the
> build, using what's already in the work directory.  Looking at a
> manpage for emerge, I didn't immediately get any creative ideas, but
> might someone offer some advice for how to accomplish this?
That's what 'ebuild' command is for.
Try this:

  cd /usr/portage/some/package
  ebuild package-ver.ebuild help

That command allows you to execute all the ebuild steps separately.

--
Mike Kazantsev // fraggod.net

signature.asc (205 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: question about portage capabilities

Jorge Morais-3
In reply to this post by Denis-7
On Sat, 18 Apr 2009 21:33:18 -0400
Denis <[hidden email]> wrote:

> Hello all,
>
> I am using a package called Rasmol, which is used for visualization of
> molecular structures.  This software uses a certain table for atomic
> sizes, and I need to change some values in that table - it is stored
> in a header file within Rasmol source code.  There is an ebuild for
> Rasmol, and it works fine - but what I'm wondering is how I can tell
> portage to STOP once it unpacks Rasmol in the temporary work directory
> - so I can tweak some things in the source code - and then resume the
> build, using what's already in the work directory.  Looking at a
> manpage for emerge, I didn't immediately get any creative ideas, but
> might someone offer some advice for how to accomplish this?

man ebuild.

I assume you are talking of sci-chemistry/rasmol.
Then you can accomplish your hack with
ebuild /usr/portage/sci-chemistry/rasmol/rasmol-2.7.2.1.1-r1.ebuild unpack
<tweak>
ebuild /usr/portage/sci-chemistry/rasmol/rasmol-2.7.2.1.1-r1.ebuild install

But I am not sure this is a clean way to achieve your goal.
The standard way would be to write a patch, and modify the ebuild
to apply your patch. Alternatively, you can apply the patch to the distfile,
and modify the ebuild to use the new distfile.

Do you know how to write a patch?

Note: if you are going to modify your ebuild, it is a good idea to
put it in an overlay
It would be something like this
mkdir --parents /usr/local/denisoverlay/sci-chemistry/rasmol
cp -rv /usr/portage/sci-chemistry/rasmol/* /usr/local/denisoverlay/sci-chemistry/rasmol/
tweak files in /usr/portage/sci-chemistry/rasmol to your heart's content.
Add "/usr/local/denisoverlay" to the variable PORTDIR_OVERLAY in /etc/make.conf
For example:

PORTDIR_OVERLAY="/usr/local/denisoverlay"

--
Software is like sex: it is better when it is free. --Linus Torvalds

Reply | Threaded
Open this post in threaded view
|

Re: question about portage capabilities

Jorge Morais-3
In reply to this post by Paul Hartman-3
On Sat, 18 Apr 2009 21:23:24 -0500
Paul Hartman <[hidden email]> wrote:

> ebuild /usr/portage/foo-bar/yourpkg-1.2.3.ebuild unpack
> ebuild /usr/portage/foo-bar/yourpkg-1.2.3.ebuild prepare
> ebuild /usr/portage/foo-bar/yourpkg-1.2.3.ebuild configure
> ebuild /usr/portage/foo-bar/yourpkg-1.2.3.ebuild compile
> ebuild /usr/portage/foo-bar/yourpkg-1.2.3.ebuild preinst
> ebuild /usr/portage/foo-bar/yourpkg-1.2.3.ebuild install
> ebuild /usr/portage/foo-bar/yourpkg-1.2.3.ebuild postinst

One doesn't need to perform these steps explicitly; when one performs
a command like merge, ebuild also performs all commands that
normally precede merge.

So I think that if he wants to tweak the source code before compiling,
the easier way would be to issue a unpack command, tweak the source,
then issue a merge command.

But I think it would be much better to write a patch,
or simply modify the distfile and create a new ebuild that
uses the modified distfile.

--
Software is like sex: it is better when it is free. --Linus Torvalds

Reply | Threaded
Open this post in threaded view
|

Re: question about portage capabilities

Alan McKinnon-2
In reply to this post by Denis-7
On Sunday 19 April 2009 03:33:18 Denis wrote:

> Hello all,
>
> I am using a package called Rasmol, which is used for visualization of
> molecular structures.  This software uses a certain table for atomic
> sizes, and I need to change some values in that table - it is stored
> in a header file within Rasmol source code.  There is an ebuild for
> Rasmol, and it works fine - but what I'm wondering is how I can tell
> portage to STOP once it unpacks Rasmol in the temporary work directory
> - so I can tweak some things in the source code - and then resume the
> build, using what's already in the work directory.  Looking at a
> manpage for emerge, I didn't immediately get any creative ideas, but
> might someone offer some advice for how to accomplish this?

Doing this manually is a pain. Copy the ebuild to your personal overlay and
modify it to do what you want.

Full detials are in man 5 ebuild, including a full list of all functions
available to you and the various stages with hooks that portage provides.

You will be wanting to perform a sed in src_prepare, methinks.
Or manipulate ECONF in src_compile if the package provides a way to adjust the
values you are interested in.


--
alan dot mckinnon at gmail dot com

Reply | Threaded
Open this post in threaded view
|

Re: question about portage capabilities

Denis-7
I would like to thank everyone who responded for taking the time and
explaining ways how my goal can be accomplished.

I did look into how a patch may be written, but basically, in my case,
I just needed to tweak a couple constants in the Rasmol source code.
I haven't educated myself on how to patch or deal with patches yet,
and I'm sort of pressed for time, so I just tweaked the source code
and installed the package by performing ebuild steps manually.

While that may not be a satisfying method in general, my task was very
simple, and this did the job quickly.  If I had a more massive task,
or series of tasks, then I'd certainly look into how to deal with
patches and overlays.

Again, thanks to this wonderful community :-)

-Denis