How do I add Mercurial patches before Sage built?

6 views
Skip to first unread message

Dr. David Kirkby

unread,
Mar 2, 2010, 3:03:32 PM3/2/10
to sage-...@googlegroups.com
I want to build Sage on 't2', and know I need to apply 3 Mercurial patches to
the Sage library - two fix numerical noise issues, the other replaces 'top' by
'prstat').

http://trac.sagemath.org/sage_trac/ticket/8374
http://trac.sagemath.org/sage_trac/ticket/8375
http://trac.sagemath.org/sage_trac/ticket/8391
(all 3 awaiting review by the way).

How can I apply those patches before starting to build Sage? At the point the
tar file is extracted, I've no 'mercurial' package built, but I do have 'hg'
installed on 't2'. There is no 'devel' directory.

I'd like to be able to apply the patches, type

$ make testlong

and go away and leave it to run.

I tried extracting the file spkg/standard/sage-4.3.3.spkg, but could not work
out how to apply the 3 Mercurial patches.

One day I'll get the hang of Mercurial !!

Dave

Robert Bradshaw

unread,
Mar 2, 2010, 3:17:17 PM3/2/10
to sage-...@googlegroups.com
On Mar 2, 2010, at 12:03 PM, Dr. David Kirkby wrote:

> I want to build Sage on 't2', and know I need to apply 3 Mercurial
> patches to the Sage library - two fix numerical noise issues, the
> other replaces 'top' by 'prstat').
>
> http://trac.sagemath.org/sage_trac/ticket/8374
> http://trac.sagemath.org/sage_trac/ticket/8375
> http://trac.sagemath.org/sage_trac/ticket/8391
> (all 3 awaiting review by the way).
>
> How can I apply those patches before starting to build Sage? At the
> point the tar file is extracted, I've no 'mercurial' package built,
> but I do have 'hg' installed on 't2'. There is no 'devel' directory.

When you have an install of sage, there's a devel directory right
under sage root. I don't think it's there until you build sage. The
developers guide should be enough to go from there.

> I'd like to be able to apply the patches, type
>
> $ make testlong
>
> and go away and leave it to run.
>
> I tried extracting the file spkg/standard/sage-4.3.3.spkg, but could
> not work out how to apply the 3 Mercurial patches.

It should be possible to unpack the spkg, cd into it, run "hg import /
path/to/patch" then re-tar the spkg, and then run a make testlong, but
I've never done that. I find it much easier to patch in place. (Then
again, I want to try it out, not just run tests...)

- Robert

Message has been deleted

David Kirkby

unread,
Mar 2, 2010, 5:49:57 PM3/2/10
to sage-...@googlegroups.com
On 2 March 2010 20:32, Minh Nguyen <nguye...@gmail.com> wrote:
> Hi David,
>
> On Wed, Mar 3, 2010 at 7:03 AM, Dr. David Kirkby
> <david....@onetel.net> wrote:
>
> <SNIP>

>
>> How can I apply those patches before starting to build Sage? At the point
>> the tar file is extracted, I've no 'mercurial' package built, but I do have
>> 'hg' installed on 't2'.
>
> Here, I assume you want to use the system-wide Mercurial installation
> on t2.math and that you have configured Mercurial to use the queues
> extension.

Yes, I've done that.

> In a Sage source tarball, the Sage library is wrapped up
> as the package
>
> SAGE_ROOT/spkg/standard/sage-x.y.z.spkg
>
> Uncompress that bzip2 compressed tarball to get a directory named
>
> SAGE_ROOT/spkg/standard/sage-x.y.z/
>
> Now delete
>
> SAGE_ROOT/spkg/standard/sage-x.y.z.spkg

I must admit, I always omit that step, as it will get overwritten
later, so there does not seem a lot of point in actually removing it
first.

> Next, patch the Sage library as if it had been built and found under
> SAGE_ROOT/devel:
>
> $ cd SAGE_ROOT/spkg/standard/sage-x.y.z/
> $ hg qimport /URL/or/path/to/patch.patch
> $ <repeat-previous-command-as-often-as-required>
>
> Once you're happy that you have applied all necessary patches, wrap up
> the patched Sage library:
>
> $ pwd
> SAGE_ROOT/spkg/standard/sage-x.y.z/
> $ hg qfinish -a
> $ cd ..
>
> And see this section
>
> http://www.sagemath.org/doc/developer/patching_spkgs.html#overview-of-patching-spkg-s
>
> of the Developer's Guide on find out how to package the newly patched
> Sage library, i.e. the directory
>
> SAGE_ROOT/spkg/standard/sage-x.y.z/
>
> Now you should have
>
> SAGE_ROOT/spkg/standard/sage-x.y.z.spkg
>
> so you could delete
>
> SAGE_ROOT/spkg/standard/sage-x.y.z/
>
> Finally, proceed to build Sage from source.
>
> --
> Regards
> Minh Van Nguyen

Thank you Minh. That was what I was looking for.

David Kirkby

unread,
Mar 2, 2010, 5:56:15 PM3/2/10
to sage-...@googlegroups.com
On 2 March 2010 20:17, Robert Bradshaw <robe...@math.washington.edu> wrote:
> On Mar 2, 2010, at 12:03 PM, Dr. David Kirkby wrote:
>
>> I want to build Sage on 't2', and know I need to apply 3 Mercurial patches
>> to the Sage library - two fix numerical noise issues, the other replaces
>> 'top' by 'prstat').
>>
>> http://trac.sagemath.org/sage_trac/ticket/8374
>> http://trac.sagemath.org/sage_trac/ticket/8375
>> http://trac.sagemath.org/sage_trac/ticket/8391
>> (all 3 awaiting review by the way).
>>
>> How can I apply those patches before starting to build Sage? At the point
>> the tar file is extracted, I've no 'mercurial' package built, but I do have
>> 'hg' installed on 't2'. There is no 'devel' directory.
>
> When you have an install of sage, there's a devel directory right under sage
> root. I don't think it's there until you build sage. The developers guide
> should be enough to go from there.

The point is though, if you know you need certain patches before Sage
will build, one might as well put them in now.

> It should be possible to unpack the spkg, cd into it, run "hg import

> /path/to/patch" then re-tar the spkg, and then run a make testlong, but I've


> never done that. I find it much easier to patch in place. (Then again, I
> want to try it out, not just run tests...)
>
> - Robert

I want to try it too, but I suspect the build will finish in the
middle of the night, so being able to run the tests immediately after
its built is useful.

I think this document I published

http://t2nb.math.washington.edu:8000/home/pub/7/

shows that even though that particular bit of the documentation passes
the test, the output viewed in a browser is rubbish. I'd love to see
some way of actually testing what the browser will display.

Dave

Dr. David Kirkby

unread,
Mar 2, 2010, 8:17:57 PM3/2/10
to sage-...@googlegroups.com
Minh Nguyen wrote:
> Hi David,
>
> On Wed, Mar 3, 2010 at 7:03 AM, Dr. David Kirkby
> <david....@onetel.net> wrote:
>
> <SNIP>
>
>> How can I apply those patches before starting to build Sage? At the point
>> the tar file is extracted, I've no 'mercurial' package built, but I do have
>> 'hg' installed on 't2'.
>
> Here, I assume you want to use the system-wide Mercurial installation
> on t2.math and that you have configured Mercurial to use the queues
> extension. In a Sage source tarball, the Sage library is wrapped up

> as the package
>
> SAGE_ROOT/spkg/standard/sage-x.y.z.spkg
>
> Uncompress that bzip2 compressed tarball to get a directory named
>
> SAGE_ROOT/spkg/standard/sage-x.y.z/
>
> Now delete
>
> SAGE_ROOT/spkg/standard/sage-x.y.z.spkg
>
> Next, patch the Sage library as if it had been built and found under
> SAGE_ROOT/devel:
>
> $ cd SAGE_ROOT/spkg/standard/sage-x.y.z/
> $ hg qimport /URL/or/path/to/patch.patch
> $ <repeat-previous-command-as-often-as-required>
>
> Once you're happy that you have applied all necessary patches, wrap up
> the patched Sage library:
>
> $ pwd
> SAGE_ROOT/spkg/standard/sage-x.y.z/
> $ hg qfinish -a
> $ cd ..
>
> And see this section
>
> http://www.sagemath.org/doc/developer/patching_spkgs.html#overview-of-patching-spkg-s

This is not working for me. I've put the patches in
/scratch/kirkby/sage-4.3.3/spkg/standard

'qimport' reports no issues, but 'qfinish -a' tells me there are no patches
applied. I've verified that indeed the patches are not applied.

kirkby@t2:[/scratch/kirkby/sage-4.3.3/spkg/standard] $ rm -rf sage-4.3.3
kirkby@t2:[/scratch/kirkby/sage-4.3.3/spkg/standard] $ tar xfj sage-4.3.3.spkg
kirkby@t2:[/scratch/kirkby/sage-4.3.3/spkg/standard] $ cd sage-4.3.3
kirkby@t2:[/scratch/kirkby/sage-4.3.3/spkg/standard/sage-4.3.3] $ hg qimport
../top-to-prstat.patch
adding top-to-prstat.patch to series file
kirkby@t2:[/scratch/kirkby/sage-4.3.3/spkg/standard/sage-4.3.3] $ hg qimport
../8374-numerical-noise.patch
adding 8374-numerical-noise.patch to series file
kirkby@t2:[/scratch/kirkby/sage-4.3.3/spkg/standard/sage-4.3.3] $ hg qimport
../numerical-noise-on-SPARC.patch
adding numerical-noise-on-SPARC.patch to series file
kirkby@t2:[/scratch/kirkby/sage-4.3.3/spkg/standard/sage-4.3.3] $ hg qfinish -a
no patches applied
kirkby@t2:[/scratch/kirkby/sage-4.3.3/spkg/standard/sage-4.3.3] $

Dave

Message has been deleted

Dr. David Kirkby

unread,
Mar 2, 2010, 8:50:15 PM3/2/10
to sage-...@googlegroups.com
Minh Nguyen wrote:
> Hi David,
>
> On Wed, Mar 3, 2010 at 12:17 PM, Dr. David Kirkby
> <david....@onetel.net> wrote:
>
> <SNIP>
>
>> 'qimport' reports no issues, but 'qfinish -a' tells me there are no patches
>> applied. I've verified that indeed the patches are not applied.
>
> Correction:
>
> (1) hg qimport /URL/or/patch/to/patch.path # get/download the patch
> (2) hg qpush # really apply the patch
>
> Repeat (1) and (2) as often as necessary. After that, do this
>
> $ hg qapplied
>
> This should return the list of patches you have applied using "hg
> qpush". Once you are ready, do
>
> $ hg qfinish -a
>
> Apology for missing the "hg qpush" part.
>

Thank you. That has worked (I've put it below for the record). Now I can
repackage it, start the build and go to bed.

PS, if you want to check anything, feel free to use:

http://redstart.drkirkby.co.uk:8000

It is not fast (only 900 MHz), has only 2 GB RAM, and a slowish network
connection, but all patches are included, with the exception of the numerical
noise ones, as I forgot to add them to that build.

Dave

kirkby@t2:[/scratch/kirkby/sage-4.3.3/spkg/standard] $ rm -rf sage-4.3.3
kirkby@t2:[/scratch/kirkby/sage-4.3.3/spkg/standard] $ tar xfj sage-4.3.3.spkg
kirkby@t2:[/scratch/kirkby/sage-4.3.3/spkg/standard] $ cd sage-4.3.3
kirkby@t2:[/scratch/kirkby/sage-4.3.3/spkg/standard/sage-4.3.3] $ hg qimport

../numerical-noise-on-SPARC.patch
adding numerical-noise-on-SPARC.patch to series file

kirkby@t2:[/scratch/kirkby/sage-4.3.3/spkg/standard/sage-4.3.3] $ hg qpush
applying numerical-noise-on-SPARC.patch
now at: numerical-noise-on-SPARC.patch


kirkby@t2:[/scratch/kirkby/sage-4.3.3/spkg/standard/sage-4.3.3] $ hg qimport
../8374-numerical-noise.patch
adding 8374-numerical-noise.patch to series file

kirkby@t2:[/scratch/kirkby/sage-4.3.3/spkg/standard/sage-4.3.3] $ hg qpush
applying 8374-numerical-noise.patch
now at: 8374-numerical-noise.patch


kirkby@t2:[/scratch/kirkby/sage-4.3.3/spkg/standard/sage-4.3.3] $ hg qimport
../top-to-prstat.patch
adding top-to-prstat.patch to series file

kirkby@t2:[/scratch/kirkby/sage-4.3.3/spkg/standard/sage-4.3.3] $ hg qpush
applying top-to-prstat.patch
now at: top-to-prstat.patch
kirkby@t2:[/scratch/kirkby/sage-4.3.3/spkg/standard/sage-4.3.3] $ hg qapplied
numerical-noise-on-SPARC.patch
8374-numerical-noise.patch
top-to-prstat.patch

Dima Pasechnik

unread,
Mar 2, 2010, 9:58:38 PM3/2/10
to sage-devel
perhaps it's a good idea to have these things added to
http://wiki.sagemath.org/MercurialQueues

On Mar 3, 9:24 am, Minh Nguyen <nguyenmi...@gmail.com> wrote:
> Hi David,
>

> On Wed, Mar 3, 2010 at 12:17 PM, Dr. David Kirkby
>

> <david.kir...@onetel.net> wrote:
>
> <SNIP>


>
> > 'qimport' reports no issues, but 'qfinish -a' tells me there are no patches
> > applied. I've verified that indeed the patches are not applied.
>

> Correction:
>
> (1) hg qimport /URL/or/patch/to/patch.path  # get/download the patch
> (2) hg qpush   # really apply the patch
>
> Repeat (1) and (2) as often as necessary. After that, do this
>
> $ hg qapplied
>
> This should return the list of patches you have applied using "hg
> qpush". Once you are ready, do
>
> $ hg qfinish -a
>
> Apology for missing the "hg qpush" part.
>

Reply all
Reply to author
Forward
Message has been deleted
0 new messages