@@ -82,15 +82,16 @@ export async function update (channels: string | Array<string> = [], last: boole
82
82
83
83
let channel = channels
84
84
85
- // Get list of avalaible packages in the nixster channel and put them in the database
85
+ // Get list of available packages in the channel and put them in the database
86
86
console . log ( `Querying channel ${ channel } for available packages` )
87
87
let pkgs : any = { }
88
88
const args = [ '--query' , `--file` , `channel:${ channel } ` , '--available' , '--meta' , '--json' ]
89
89
// For some reason, in order to get R packages it is necessary to explicitly use --attr rPackages
90
90
// so we have a loop for that case and potential others
91
91
for ( let extraArgs of [
92
92
[ ] ,
93
- [ '--attr' , 'rPackages' ]
93
+ [ '--attr' , 'rPackages' ] ,
94
+ [ '--attr' , 'haskellPackages' ]
94
95
] ) {
95
96
let allArgs = args . concat ( extraArgs )
96
97
let json = await spawn ( 'nix-env' , allArgs )
@@ -136,12 +137,21 @@ export async function update (channels: string | Array<string> = [], last: boole
136
137
}
137
138
138
139
// Rename language packages to provide consistency and
139
- // prevent versioned names.
140
+ // across languages
141
+
142
+ const haskellPackage = attr . match ( / ^ h a s k e l l P a c k a g e s \. / )
143
+ if ( haskellPackage ) {
144
+ type = 'haskell-package'
145
+ // Prefix package names with `haskell`
146
+ name = 'haskell-' + name
147
+ }
140
148
141
149
const pythonPackage = attr . match ( / ^ p y t h o n ( \d + ) P a c k a g e s \. / )
142
150
if ( pythonPackage ) {
143
151
type = 'python-package'
144
152
runtime = 'python' + pythonPackage [ 1 ]
153
+ // Prefix package names with `python`
154
+ // removing the Python version if necessary
145
155
if ( name . startsWith ( 'python' ) ) {
146
156
name = name . replace ( / ^ p y t h o n [ \d \. ] + / , 'python' )
147
157
} else {
@@ -153,6 +163,8 @@ export async function update (channels: string | Array<string> = [], last: boole
153
163
if ( perlPackage ) {
154
164
type = 'perl-package'
155
165
runtime = 'perl' + ( perlPackage [ 1 ] ? perlPackage [ 1 ] : '' )
166
+ // Prefix package names with `perl`
167
+ // removing the Perl version if necessary
156
168
if ( name . startsWith ( 'perl' ) ) {
157
169
name = name . replace ( / ^ p e r l [ \d \. ] + / , 'perl' )
158
170
}
@@ -161,9 +173,10 @@ export async function update (channels: string | Array<string> = [], last: boole
161
173
const rPackage = attr . match ( / ^ r P a c k a g e s \. / )
162
174
if ( rPackage ) {
163
175
type = 'r-package'
176
+ // R packages are already prefixed with `r-`
164
177
}
165
178
166
- // Normalise name
179
+ // Normalize name
167
180
name = name . toLowerCase ( ) . replace ( / [ . _ - ] + / gi, '-' )
168
181
169
182
// Insert row into table
0 commit comments