Differences between revisions 19 and 20
Revision 19 as of 2022-10-22 22:50:15
Size: 7301
Editor: ?SandraUwah
Comment:
Revision 20 as of 2022-11-03 22:38:41
Size: 7306
Editor: ?SandraUwah
Comment:
Deletions are marked like this. Additions are marked like this.
Line 108: Line 108:
 * node-jsonify - Sandra Uwah - rfs  * node-jsonify - Sandra Uwah - uploaded

Note: This page was originally created for Javascript/Nodejs/yarn-plugin-apt project so some references to this project may still be remaining in this page.

Aim of Debian (or Debian packaging):

- To have every free software available in an easy to install form and easy to configure, using just the default package manager, irrespective of which language/framework it is written in (node, ruby, python, etc)

- Many packages like gitlab, diaspora, etc have node modules as front-end dependencies and also have to be available in the same way.

But, gitlab, for example, has 1600+ dependencies.

- Till all these are packaged, we have been following a hybrid approach where when someone does apt install:

* If there is already a compatible version in debian software repositories, use that
* Otherwise, use the library from npmjs.com/yarnpkg (this option is undesirable)

- There is Javascript/Nodejs/yarn-plugin-apt to create a plugin for yarn (specifically yarn version >=2, nicknamed berry) package manager such that yarn when installing dependencies from package.json looks up the debian's package if available and compatible and only if not available goes to yarn registry and downloads the library.

- Ruby, similarly, already has a bundle install --local option which does the same.

Node/javascript development background:

- When you want to use a third party module/library in your node-javascript application, you specify the name and version of these libraries in a package called package.json
- If you share this package.json file with someone else, they will be able to download those third party libraries of the exact versions that you used on to their computer as well.
- These libraries are saved in the "node_modules" folder by default and the behaviour/features that are present in those third party libraries become available to use in your own code.

Real life example: Imagine you have a third party library called "lodash" in package.json which you might have installed with

  • yarn add lodash

or

  • npm install lodash

You can get that in your software (index.js file, say) with this:

  • const lodash = require("lodash");

or :

  • import lodash from "lodash";

- This helps you avoid handling third party/vendor libraries manually and you can quickly upgrade libraries, etc.
- Now, what if we could use a library that is already available on the computer instead of getting it from the internet? What if the same library has been installed as a dependency for another software?

Example: https://salsa.debian.org/ruby-team/gitlab/-/blob/master/debian/patches/0740-use-packaged-modules.patch#L120

The philosophy of Debian regarding shared dependencies:

- Whatever version of the library is available in Debian should be used by any software that depends on that library. This probably involves updating all software to work with the latest version of a library.
- Now, any software that needs this library should be able to use the Debian version of the library installed to /usr/share/nodejs - apt install node-lodash will put lodash in /usr/share/nodejs
- Now, with the yarn 2 plugin which we create in this project, I should be able to do something like this:

  • yarn apt-add lodash (or something similar)

And it should use the lodash from the /usr/share/nodejs instead of downloading from the internet

Q: Do we have a similar thing in npm/yarn1?
A: No. npm and yarn1 do not support plugins.

Debian and upstream projects

Debian is an operating system and therefore a lot of software that Debian offers its users are not built by people in the Debian community. The people who maintain software are called "upstream maintainers". Debian works closely with upstream to package and deliver these software on Debian.

The upstream developers of yarn, for example, aren't part of Outreachy. Please keep that in mind while communicating with upstream.

Setting up a Debian unstable environment

See Packaging/Pre-Requisites for various options available. Use https://join.jabber.network/#fsci-support@groups.poddery.com?join or https://matrix.to/#/#fsci-support:poddery.com for installation support.

NB: When installing the Docker as pre-requisite for the Debian unstable, you will need to add "sudo" before the command if you are not a root user. For example to pull the development image, you will run this command: sudo docker pull registry.gitlab.com/fsci/resources:debian-dev. https://wiki.debian.org/Packaging/Pre-Requisites#Docker If you omit the "sudo", you might get a message that access is denied. Just add sudo in front and it will run just fine. That's one way around.

However, on production servers, you would prefer to avoid running docker as root user (as that would mean that docker gets access to the entire computer and any insecurities in docker can lead to your server being compromised).

After running the command: "sudo docker run --privileged --name "sid" -it registry.gitlab.com/fsci/resources:debian-dev bash", you will be assigned a developer identity.

Next step is to run this command: "sudo apt-get update && sudo apt-get upgrade" You will be prompted to enter a password. The password is "developer". This will update the docker if it is not the current version and also upgrade if an upgrade is available.

Debian and Nodejs

See Javascript/Nodejs.

To install nodejs,

# apt install nodejs

Getting Started

You can follow Packaging/Learn for a detailed step by step guide to learn packaging.

Getting Live Support

If you are new to javascript packaging, you can contact Debian Javascript Mentors channel via one of the following options (they are bridged/interconnected so choosing any one method is enough)

  1. XMPP https://join.jabber.network/#debian-js-mentors@chat.disroot.org?join

  2. Matrix https://matrix.to/#/#debian-js-mentors:poddery.com

  3. IRC: #debian-browserify on irc.oftc.net network. If you are new to irc, you can join via browser https://webchat.oftc.net/?channels=debian-browserify

Easy node modules to update

Use the following format: Module name - name of the person working on it - status (in progress/need help/rfs/uploaded)

  • node-body-parser - Sandra Uwah - uploaded
  • node-d3-array - Sandra Uwah - uploaded
  • node-follow-redirects - Lydia Ojoawo - rfs
  • node-npm-package-arg - Lydia Ojoawo - uploaded
  • node-jsonify - Sandra Uwah - uploaded
  • node-sockjs-client Lydia Ojoawo - in progress

Signing git commits and emails

  1. You can follow https://docs.gitlab.com/ee/user/project/repository/gpg_signed_commits/ to have verified commits.

  2. You can follow https://emailselfdefense.fsf.org to configure your mail clients to send signed emails.

These steps will be useful later for your sponsors to endorse your key when you apply for Debian Maintainer or Debian Developer access (you will be able to upload packages without a sponsor when you are accepted as a Debian Maintainer or Debian Developer).