GSoC Proposal

Mojca Miklavec mojca at macports.org
Thu Mar 28 21:56:52 UTC 2019


On Thu, 28 Mar 2019 at 19:28, KARAN SHETH <karan.sheth at somaiya.edu> wrote:

> Hey,
>
> [image: Sent from Mailspring]
> On Thu, Mar 28, 2019 at 8:48 PM Mojca Miklavec <mojca at macports.org> wrote:
>
>
> We are looking forward. I hope that Cyril will also help with the process
> (my encounter with UPM so far was for the full two hours while hacking on
> it :).
>
>
> I've written a basic npm frontend and macports backend for it so if we do
> something like:
> upt package -f npm -b macports request
>
> this is the output:
>
> # -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil;
> c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
> PortSystem          1.0
>
>
> name                npm-request
> version             2.9.3
>
> maintainers         nomaintainer
> description         Simplified HTTP request client.
> long_description    ${description}
>
> platforms           darwin
> license             Apache-2.0
> homepage            https://github.com/request/request#readme
>
> master_sites        git+https://github.com/request/request.git
>

This line looks a bit suspicious. If the files live on github, we might
want to use the github PortGroup anyway, but let's leave that detail for
later ...


> I still have to add checksum and have a bit of doubt in it - to calculate
> checksum it will have to download distfiles from npm and calculate
> checksums for that right?
>

Yes.

Support for checksums has been implemented recently:

https://framagit.org/upt/upt/commit/3f634370bbb80904411ff298d2b79e35c7591d23

Yes, the file would be downloaded and the checksum would be calculated, but
this would be done by upt (if some piece of functionality is missing, then
upt needs to be improved).


> Another doubt that I have is how to test the Portfiles generated,because
> if I try to directly to install this files then it tries to get distfiles
> from the macport server I guess(I have never done this so have no clue on
> how to test it)
>

If you try to install the port, MacPorts will first try to fetch the binary
package from the server. Of course the binary package will not exist, so it
will try to build it locally (which is what you want). While building
locally, it will first check the macports mirrors for the source, which
will again not be there, so it will (after three tries or so) turn to the
original source. You can also run "sudo port -v fetch npm-request
--no-mirror" to download directly. But the above URL (master_sites) seems
wrong, so it won't work like that.

Here's a version that would fetch the correct file (you can run "sudo port
-v extract npm-request" on it), but it won't install just yet.

Probably the easiest way is to do a full git clone of the macports-ports
repository and then configure macports to look into it:
    https://guide.macports.org/chunked/development.local-repositories.html

Then just add a file, for example
    macports-ports/npm/npm-request/Portfile
with that contents, run "portindex" inside macports-ports and then keep
playing with installation.



> Also for every npm package multiple versions are available so should the
> script ask which version to use or by-default newest version.
>

This is a million dollar question. We usually package just the latest
version of everything (except for exceptions ... :)

We could package multiple versions, where you have two options:
- install all at the same time
- allow installing just one version at a time, others may not be installed

I suspect that the first approach won't work. The second one is often
problematic.

With python or perl we ship multiple versions of python / perl, but for
each of them either only a single version of any python package, or
exceptionally multiple versions, but then they conflict with each other
which is highly suboptimal.

In all honesty, if there are too many cases where the latest version of a
package doesn't work (another package requires an older version), it's
questionable whether we can achieve anything useful with npm at all.

I was thinking that it would make sense to create a portgroup for npm and
> other such frontends.
>

Definitely.


> Here my doubt is by autoupdate it means that if the package is updated
> then the corresponding portfile should be updated, right?
>

Yes. (I don't care if for the start you would manually call some update
routine on each file, but getting that to work is tricky enough in itself.)


> but while updating, the manual edits should be taken care of I guess.
>

Yes.


> After this I would move on to automating the test, but for that I need
> help first with manual testing for npm.
>

Do you mean manually testing whether the port builds at all, or running the
unit tests?


> I am still not fully clear with the exact path of stuff, is this the
> correct flow?
>

I believe you mostly got it right.


> upt will be used to generate portfile from npm,cpan,etc.. including
> distfiles and checksums
>

Distfiles are just source files fetches automatically by macports. Usually
you would need to specify checksums, but distfiles would likely be
populated properly by the portgroup (that needs to be written)?


> then this portfiles should be tested and if its not working manual editing
> will be done after which it will be retested and if there are dependencies
> then that needs to be ported and build too.
>

Yes.

The challenge would be: after you manually edited the Portfile the first
time, can you avoid manually editing it after some upgrade?

Mojca
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macports.org/pipermail/macports-dev/attachments/20190328/a18a8b48/attachment.html>


More information about the macports-dev mailing list