Hi,
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)
jpuydt on irc.debian.org
import apt
import os
# 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)
with open('control', 'w') as control:
with open('control.in', 'r') as preamble:
control.writelines(preamble.readlines())
for name in pkgs:
# take care of the control chunk
print('', file=control)
print('Package: node-types-' + name, file=control)
print('Architecture: all', file=control)
print('Multi-Arch: foreign', file=control)
print('Description: TypeScript definitions for the ' + name + ' package', file=control)
print(' TypeScript is a language with optional types in JavaScript, which', file=control)
print(' means many NodeJS packages need additional type information.', file=control)
print(' .', file=control)
print(' This package provides such type informations for ' + name + '.', file=control)
# now take care of the install file
with open('node-types-' + name + '.install', 'w') as install:
print('types/' + name + '/index.d.ts /usr/lib/whatever/is/correct', file=install)
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
--
Pkg-javascript-devel mailing list
Pkg-javascript-devel@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/pkg-javascript-devel