Hi,
Le 09/08/2018 à 09:19, Julien Puydt a écrit :
Le 08/08/2018 à 23:35, Julien Puydt a écrit :
I'm not convinced it's the best way to handle the situation, but here
is a simple script I wrote to toy with the idea...
(my checkout of upstream DefinitelyTyped is in /tmp, so you might want
to adapt the script to your own situation)
Another toy script, this time in Python, and smarter since it creates
only packages for what we clearly have in Debian (the test is rough!).
(The final control file is 4k lines instead of 42k for the naive js
version)
No comment, still toying around ; another Python script, this time a
single binary package is built, but for each node-foo in Debian where
DefinitelyTyped has foo, a virtual node-types-foo is provided.
That looks quite neat, in fact :
- just one node-types-definitelytyped real package would provide all
necessary node-types-foo ones, so if a package needs the @types/foo, it
can depend on node-types-foo and the right one is pulled in ;
- when foo upstream includes the type declarations, then node-foo will
be able to also provide node-types-foo itself, and later on when
DefinitelyTyped stops shipping it, the newer node-types-definitelytyped
won't provide node-types-foo anymore so the transition will be quite smooth.
What are your opinions?
jpuydt on irc.debian.org
import apt
import os
controlin = """Source: definitelytyped
Section: javascript
Priority: optional
Maintainer: Debian Javascript Maintainers <pkg-javascript-de...@lists.alioth.debian.org>
Uploaders: Julien Puydt <jpu...@debian.org>
Build-Depends: debhelper (>= 11), nodejs
Standards-Version: 4.2.0
Homepage: http://github.com/DefinitelyTyped/DefinitelyTyped
Vcs-Git: https://salsa.debian.org/js-team/definitelytyped
Vcs-Browser: https://salsa.debian.org/js-team/definitelytyped
Package: node-types-definitelytyped
Architecture: all
Multi-Arch: foreign
Depends: nodejs, ${{misc:Depends}}
Provides: {provides}
Description: TypeScript definitions from the DefinitelyTyped project
TypeScript is a language with optional types in JavaScript, which
means many NodeJS packages need additional type information.
.
This package provides such type informations for many packages.
"""
# find all packages with type annotation
tspkgs = set(os.listdir('/tmp/DefinitelyTyped/types'))
# find all node-* packages in Debian
debpkgs = set()
cache = apt.cache.Cache()
cache.open()
for pkg in cache:
if pkg.name.startswith('node-'):
debpkgs.add(pkg.name[5:])
# only package type annotations of existing packages!
pkgs = debpkgs.intersection(tspkgs)
print('Providing {0:d} virtual packages'.format(len(pkgs)))
with open('control', 'w') as control:
provides = ',\n '.join(map(lambda name: 'node-types-'+name, pkgs))
control.writelines(controlin.format (provides = provides))
with open('install', 'w') as install:
for name in pkgs:
print('types/{name}/index.d.ts /usr/lib/nodejs/{name}'.format(name=name), file=install)
--
Pkg-javascript-devel mailing list
Pkg-javascript-devel@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/pkg-javascript-devel