Hey,

On Mar 29 2019, at 3:26 am, Mojca Miklavec <mo...@macports.org> wrote:
>
> > 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 ...

yeah the link was wrong and I had my doubts, now its fixed in the updated 
script.(more on this below)

> > 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.
>
>
Yeah previously I had created a local repository (without cloning) and it 
worked so far but now for perl branches I guess cloning will be needed.

> > 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.
>
Ok so as of now I have kept it to latest version, we can work this out later I 
guess
> > 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?
>
>
>
>
>
>
>

By manual testing I meant port builds.

So now macports backend for npm and perl is mostly completed, I might have 
missed a few things but that can be solved/added later on.
Updated npm Example:
upt package -f npm -b macports request
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.88.0
categories npm
maintainers nomaintainer
description Simplified HTTP request client.
long_description ${description}

platforms darwin
license Apache-2.0
homepage https://github.com/request/request#readme

distname request-2.88.0
distfiles request-2.88.0.tgz
master_sites https://registry.npmjs.org/request/-/request-2.88.0.tgz

checksums md5 d2f4658aa40c2abdca764aa40c6fca07 \
sha256 61af775fd5eb513dfac1569edb60518a65c10a47009abd8d5074ba6b434adaa4 \
rmd160 1d9313e896203695be177c82d63ed200bf0bf20f \
size 58023
Example for perl:
upt package -f cpan -b macports Amazon-S3

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
PortGroup perl5 1.0

perl5.branches 5.26 5.28
perl5.setup Amazon-S3 0.45

license Artistic-1.0-Perl
maintainers nomaintainer
description A portable client library for working with and managing Amazon S3 
buckets and keys.
long_description ${description}

platforms darwin
supported_archs noarch

checksums md5 a055ab8fd27d86ddc65a216145391793 \
sha256 77c313d9517026cdccd5ff4e19d302cd7aa2df1f3870e31f0e9f43f69628d908 \
rmd160 19e74c57191bed5ff7c3367b65f3b0961fdea05a \
size 16585

if {${perl5.major} != ""} {
depends_lib-append \
port:p${perl5.major}-xml-simple \
port:p${perl5.major}-mime-base64 \
port:p${perl5.major}-http-date \
port:p${perl5.major}-class-accessor-fast \
port:p${perl5.major}-digest-md5-file \
port:p${perl5.major}-digest-hmac_sha1 \
port:p${perl5.major}-uri-escape \
port:p${perl5.major}-lwp-useragent-determined \
port:p${perl5.major}-io-file \
port:p${perl5.major}-test-more
}

Note: perl5.branches is static and although the dependencies are dynamic the if 
statement is static.
I tried installing port using this Portfile and it worked perfectly.(perl only)
Now I guess this would be the things that should be worked on:
For now upt gives output to terminal so it would be good if a Portfile is 
created at appropriate location

Automating port fetch and check test

POC for updating the perl files

Recurrsively generating packages

I had to update a bit of upt-cpan as it was not parsing description properly.
Thanks,
Karan Sheth

-- 

 <https://www.somaiya.edu>        <http://www.somaiya-ayurvihar.org>  
<http://nareshwadi.org>  <http://somaiya.com>  <http://www.helpachild.in>  
<http://nareshwadi.org>

Reply via email to