<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, 28 Mar 2019 at 19:28, KARAN SHETH <<a href="mailto:karan.sheth@somaiya.edu">karan.sheth@somaiya.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div><div>Hey,</div><div><br><img class="gmail-m_-1662127336644807626mailspring-open" alt="Sent from Mailspring" width="0" height="0" style="border: 0px; width: 0px; height: 0px;" src="https://link.getmailspring.com/open/CAKssJT+tJZ7feO5p4vh0jmz=S_42gHD-2quh2DAT8xswsih9Dw@mail.gmail.com?recipient=bW9qY2FAbWFjcG9ydHMub3Jn"><div class="gmail_quote"><div class="gmail_attr"><div>On Thu, Mar 28, 2019 at 8:48 PM Mojca Miklavec <<a href="mailto:mojca@macports.org" title="mailto:mojca@macports.org" target="_blank">mojca@macports.org</a>> wrote:</div></div><blockquote><div><br></div><div><div><div class="gmail_quote"><div>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 :).</div></div></div></div></blockquote><br><div><font style="font-size:13px"><span style="color:rgb(33,33,33)">I've written a basic npm frontend and macports backend for it so if we do something like:</span></font></div><div><font style="font-size:13px"><span style="color:rgb(33,33,33)">upt package -f npm -b macports request</span></font></div><br><div>this is the output:</div><br><div># -*- 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</div><div>PortSystem          1.0</div><br><br><div>name                npm-request</div><div>version             2.9.3</div><br><div>maintainers         nomaintainer</div><div>description         Simplified HTTP request client.</div><div>long_description    ${description}</div><br><div>platforms           darwin</div><div>license             Apache-2.0</div><div>homepage            <a href="https://github.com/request/request#readme" target="_blank">https://github.com/request/request#readme</a></div><br><div><div>master_sites        git+<a href="https://github.com/request/request.git" title="https://github.com/request/request.git" target="_blank">https://github.com/request/request.git</a></div></div></div></div></div></blockquote><div><br></div><div>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 ...</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div><div class="gmail_quote">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?<br></div></div></blockquote><div><br></div><div>Yes.</div><div><br></div><div>Support for checksums has been implemented recently:</div><div><div>    <a href="https://framagit.org/upt/upt/commit/3f634370bbb80904411ff298d2b79e35c7591d23">https://framagit.org/upt/upt/commit/3f634370bbb80904411ff298d2b79e35c7591d23</a><br></div></div><div><br></div><div>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).</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div class="gmail_quote">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)<br></div></blockquote><div><br></div><div>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.</div><div><br></div><div>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.</div><div><br></div><div>Probably the easiest way is to do a full git clone of the macports-ports repository and then configure macports to look into it:</div><div>    <a href="https://guide.macports.org/chunked/development.local-repositories.html">https://guide.macports.org/chunked/development.local-repositories.html</a><br></div><div><br></div><div>Then just add a file, for example</div><div>    macports-ports/npm/npm-request/Portfile</div><div>with that contents, run "portindex" inside macports-ports and then keep playing with installation.</div><div><br></div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div><div class="gmail_quote">Also for every npm package multiple versions are available so should the script ask which version to use or by-default newest version.<br></div></div></blockquote><div><br></div><div>This is a million dollar question. We usually package just the latest version of everything (except for exceptions ... :)</div><div><br></div><div>We could package multiple versions, where you have two options:</div><div>- install all at the same time</div><div>- allow installing just one version at a time, others may not be installed</div><div><br></div><div>I suspect that the first approach won't work. The second one is often problematic.</div><div><br></div><div>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.</div><div><br></div><div>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.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div><div class="gmail_quote"><div><div class="gmail_quote"><div class="gmail_quote"><div class="gmail_quote">I was thinking that it would make sense to create a portgroup for npm and other such frontends.<br></div></div></div></div></div></div></blockquote><div><br></div><div>Definitely.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div><div class="gmail_quote"><div><div class="gmail_quote"><div class="gmail_quote"><div class="gmail_quote"></div></div></div></div><div>Here my doubt is by autoupdate it means that if the package is updated then the corresponding portfile should be updated, right?</div></div></div></blockquote><div><br></div><div>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.)</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div><div class="gmail_quote"><div> but while updating, the manual edits should be taken care of I guess.</div></div></div></blockquote><div><br></div><div>Yes.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div><div class="gmail_quote">After this I would move on to automating the test, but for that I need help first with manual testing for npm.<br></div></div></blockquote><div><br></div><div>Do you mean manually testing whether the port builds at all, or running the unit tests?</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div><div class="gmail_quote">I am still not fully clear with the exact path of stuff, is this the correct flow?<br></div></div></blockquote><div><br></div><div>I believe you mostly got it right.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div><div class="gmail_quote"><div>upt will be used to generate portfile from npm,cpan,etc.. including distfiles and checksums</div></div></div></blockquote><div><br></div><div>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)?</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div><div class="gmail_quote"><div>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.</div></div></div></blockquote><div><br></div><div>Yes.</div><div><br></div><div>The challenge would be: after you manually edited the Portfile the first time, can you avoid manually editing it after some upgrade?</div><div><br></div><div>Mojca</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div></div></blockquote></div></div></div></div></div>