Xavier Guimard: > Niels Thykier: >> Xavier Guimard: >>> Package: debhelper >>> Version: 12.9 >>> Severity: wishlist >>> >>> Hi, >>> >>> I'm maintaining pkg-js-tools which provides a nodejs-module >>> auto-installer. I'd like to automatically `chmod +x` files declared as >>> "bin" in package.json. >>> * I don't want to automatically install them to /usr/bin because: >>> * `require` command is related to current directory, then nodejs >>> binaries must be installed in nodejs dirs and linked to /usr/bin >>> * I don't want to automatically link them all to /usr/bin since this >>> will change packages during rebuild and can create conflicts (same >>> binary names) >>> * I don't want to "remove_command" dh_fixperms since it is not safe >>> * I don't want to "insert_after" dh_fixperms since it will be launched >>> even if maintainer sets a "overrides_dh_fixperms' >>> >>> For now, maintainers are using "override_dh_fixperms" but I think we can >>> use more automatisation. Is it possible to write a dh_auto_fixperms >>> target or giving values using environment variables ? >>> >>> Cheers, >>> Xavier >>> >>> NB: sorry for my poor English, tell me if my query is not clear ;-) >>> >> >> Would it be solved by dh_fixperms leaving the exec bit alone in some >> directory and rely on pkg-js-tools's auto-installer to set that correctly? >> >> If not, is there a trivial way to determine which file should have exec >> bit and which should not (as a "new" general rule to replace #953638)? >> Or will this require nodejs knowledge (like parsing an upstream file)? >> >> >> ~Niels > Hi, > > sorry for the delay (I lost previous message). Generally Node.js > binaries can be found in package.json ("bin" field). Usually they are > in /node/path/foo/bin where node-path is one of: > * /usr/share/nodejs > * /usr/lib/<gnu-arch>/nodejs > * /usr/lib/nodejs (deprecated) > > But it's not always so...
Hi, For a better answer: >> Would it be solved by dh_fixperms leaving the exec bit alone in some >> directory and rely on pkg-js-tools's auto-installer to set that >> correctly? Generally, these files are installed in bin/, lib/ or dist/ (and translated to /usr/share/nodejs/<dir> or /usr/lib/<gnu-arch/nodejs/<dir> during auto install). When bin/ is used, it contains generally only executable files but when upstream uses dist/ or lib/, the executable file is installed between other js files. Leaving +x might be bad since not all nodejs packages are managed by pkg-js-tools (DD choice). I think dh_fixperms should remove +x bit anywhere except bin/ >> If not, is there a trivial way to determine which file should have >> exec bit and which should not (as a "new" general rule to replace >> #953638)? No, this require to parse package.json >> Or will this require nodejs knowledge (like parsing an upstream >> file)? Yes, +x bit has to be set to all files mentioned in "bin" field and no other files. Like other package.json fields, it can be an expression (or an array of expressions) which is different than shell expressions. You can take a look at this test file ([1]) to see some expressions used in package.json ("/**/" is the main difference). That's why I suggested a sort of dh_auto_fixperms (but which overrides dh_fixperms because of dh_fixperms specificities) Cheers, Xavier [1]: https://salsa.debian.org/js-team/pkg-js-tools/-/blob/master/t/pattern.t