codema.in

Python Packaging at Kochi Python follow up

PP Pirate Praveen Public Seen by 453

Follow up activities for the packaging workshop

Setup aliases and environment variables for packaging: https://wiki.debian.org/Diaspora/Packaging/gem2deb#Setup_your_environment

Steps for packaging Node.js modules: https://wiki.debian.org/Javascript/Nodejs/Npm2Deb

Some node modules available for packaging are listed below. Please reply with your selection.

is-fullwidth-code-point - @suhail
lcid - @renjiththankachan

PP

Pirate Praveen Sun 9 Oct 2016 8:50AM

@sadiq can you try to fix http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=840174 ? npm2deb is written in python and its source is available at https://anonscm.debian.org/cgit/pkg-javascript/npm2deb.git

MS

Mohammed Sadiq Sun 9 Oct 2016 8:58AM

@suhail have contacted me regarding this bug. Hope he shall fix this. :)

PP

Pirate Praveen Sun 9 Oct 2016 9:05AM

There are many bugs, I asked him about another bug :) Can you generate dependency list for livescript? This is going like a chain reaction :(

MS

Mohammed Sadiq Sun 9 Oct 2016 10:01AM

I can't reproduce the bug you sent to @suhail [0].

I get the right result. I'm on Debian Stretch with no packges from sid. Let me know how to contact you via IRC. Or else, contact me at freenode (nick: pksadiq)

[0] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=840167

PP

Pirate Praveen Mon 10 Oct 2016 4:31AM

What is the output of apt-cache policy node-nomnom? node-nomnom was added to stretch only on 2016-08-03. Try again after you run apt-get update. I'm j4v4m4n on freenode.

PP

Pirate Praveen Mon 10 Oct 2016 5:29AM

I have contacted some folks and asked them to try fixing some bugs in npm2deb (its written in python). Please comment on the bugs if you have started working on any bugs.

Others please take one from http://bugs.debian.org/npm2deb and comment here before starting.

Already taken: #840167 (@suhail ) #840169 (Rahul Krishnan) # 840170 (@bobyaloysiusjohnso ) #840174 (@sadiq )

Available: #840213 #840207 #840226

KVS

K V Sreeram Tue 11 Oct 2016 1:11AM

Hi praveen ji,I am currently looking into the source code of npm2deb
https://github.com/LeoIannacone/npm2deb
to try and modify it to the pi to deb format as we had discussed that day.

BC

Balasankar C Tue 11 Oct 2016 2:49AM

If you can read Ruby code, please go through the source code of gem2deb also. From my experience, it automates more stuff than npm2deb.

It would be good to know the workflow gem2deb is following too.

RT

Renjith Thankachan Wed 12 Oct 2016 4:39AM

@kvsreeram need a standard setup.py file i think :)

DU

[deactivated account] Wed 12 Oct 2016 6:44AM

@sadiq Could you please update dependencies for browserify as well?

MS

Mohammed Sadiq Wed 12 Oct 2016 7:22AM

Done[0]. I shall try to upload the updated script soon. I have already updated the Template page.

[0] https://wiki.debian.org/Javascript/Nodejs/Tasks/Browserify

MS

Mohammed Sadiq Wed 12 Oct 2016 7:27AM

Please note that I'm running Debian testing (and not sid). So the dependency pasted in the wiki may not be up to date. Please inform me if you find any errors.

Thanks

PP

Pirate Praveen Wed 12 Oct 2016 10:11AM

If you need ssh access to a debian sid box, I can share our test machine.

MS

Mohammed Sadiq Wed 12 Oct 2016 7:50AM

Ranjith did not get his wiki account activated. So, I have updated the dependency creation script[0] and the template page[1]. Anyone interested may now help update the dependency wiki pages.

How to run:
1. download the script[0]
2. Install tree and npm: sudo apt install tree npm
3. run ./js_task_create.py module -o out-page
replace 'module' with the 'module' you wish. Eg: grunt
4. The file generated is saved to out-page (you can give any name for output file). Copy the complete file content. Edit the wiki page of the module, and replace the complete text.

Please note that the previous Template was dumb and listed the build dependencies under dependencies. I have fixed the template page. Please update the wiki pages.

Thanks

[0] https://wiki.debian.org/Javascript/Nodejs/Tasks?action=AttachFile&do=view&target=js_task_create.py
[1] https://wiki.debian.org/Javascript/Nodejs/Tasks/Template

PP

Pirate Praveen Sun 16 Oct 2016 6:50PM

Alignment needs manual fixing. Can you try to fix the script?

SM

Shanavas M Wed 12 Oct 2016 8:36AM

Is debian stretch or sid mandatory ?
Is jessie too old to get started ?

PP

Pirate Praveen Wed 12 Oct 2016 10:08AM

@shanavasm some tools (like npm2deb, dh-make, licensecheck) will be missing some features, but it is enough to get the concept. If you are willing to search and find workarounds for those issues go ahead. But I suggest you create an lxc container or virtual machine of sid inside jessie for packaging.

PP

Pirate Praveen Wed 12 Oct 2016 10:10AM

@suhail since we are not able to reproduce the bug you were working on, we can drop it for now. Can you try packaging string-width?

S

Suhail Wed 12 Oct 2016 3:04PM

ok. I will try

PP

Pirate Praveen Wed 12 Oct 2016 10:15AM

@renjiththankachan can you try packaging lcid?

RT

Renjith Thankachan Wed 12 Oct 2016 2:09PM

@praveenarimbrathod can you share a test debian box ?

PP

Pirate Praveen Thu 13 Oct 2016 7:12AM

Sure. We maintain ssh keys in https://gitlab.com/debian-ruby/pxq.in (private repo). Share your gitlab.com id and I'll give you access to this repo. Then you can add your ssh key there. If anyone else want a test box, follow the same steps.

Though a local sid environment can easily be created from any GNU/Linux distro by this command lxc-create -n debian -t debian -- -r sid. Once created, use lxc-attach -n debian. Create a normal user with adduser <username> and use su - to switch. See https://linuxcontainers.org/lxc/getting-started/ for more.

RT

Renjith Thankachan Thu 13 Oct 2016 8:40AM

lxc done the job !

SM

Shanavas M Thu 13 Oct 2016 2:02PM

Have created a task page for lcid [1]. Debian package details of invert-kv (dependency of lcid) node-invert-kv (1.0.0-1) is missing from the generated output.
Is is need to be added manually or am I miss something ?

PP

Pirate Praveen Fri 14 Oct 2016 8:26AM

@shanavasm you need a task page only if the dependency list is big. Are you running the script from sid?

We can create the dependency tree locally with npm2deb like npm2deb depends -b -r lcid. If there is more than 10 unpackaged dependencies then only we need to create a task page.

SM

Shanavas M Sat 15 Oct 2016 7:00AM

@praveenarimbrathod yeah, I am running from sid. I shall try is-arrayish.

PP

Pirate Praveen Fri 14 Oct 2016 8:32AM

@shanavasm can you try is-arrayish?

PP

Pirate Praveen Fri 14 Oct 2016 8:34AM

@kvsreeram I think it would be better to package one lib before you try pypi2deb so you get a better idea of what you want to achive. Can you try packaging path-exists?

KVS

K V Sreeram Fri 14 Oct 2016 8:37AM

Will do from next week on praveenji

SM

Shanavas M Sat 15 Oct 2016 7:06AM

@praveenarimbrathod It seems there is a bug in js_task_create.py script. It gets the debian package details from the output of apt-cache madison <package> | grep Source (line no:46). But the Sources entry is included in the output only if there is a deb-src entry in sources.list. So the command should be apt-cache madison <package> | grep Packages. WDYT ?

PP

Pirate Praveen Sat 15 Oct 2016 6:06PM

Btw is-arrayish is a leaf package without any dependencies.

BC

Balasankar C Sat 15 Oct 2016 7:10AM

@shanavasm Haven't gone through code, but will rmadison solve the issue?

SM

Shanavas M Sat 15 Oct 2016 7:46AM

@balasankarchelamat rmadison lists details of package for all dists like stable, testing etc... . That makes parsing more complex.

BC

Balasankar C Sat 15 Oct 2016 8:00AM

@shanavasm So, you need info about a single distribution. You can use -s flag.

Am on mobile data, so can't look at the code now. What's it you are trying to achieve using the result? To check which version is available on sid?

SM

Shanavas M Sat 15 Oct 2016 10:43AM

@balasankarchelamat Yeah, it checks the corresponding debian package for node module.
apt-cache madison <package> | grep Packages fixes the issue. Just want to make sure it doesn't break anything else, so that the script in wiki can be updated.

PP

Pirate Praveen Sat 15 Oct 2016 4:04PM

Just consider the case of source and binary package having different names.

For example,
source package: node-mocha, binary package: mocha

@suhail @sadiq found root cause for #836182. I was missing deb-src line in my apt sources. Can you try changing it to look for binary packages or show a message asking user to enable deb-src instead of 'None'?

SM

Shanavas M Sat 15 Oct 2016 6:27PM

@praveenarimbrathod Checking for binary packages seems more reasonable. A hacky solution would be to use apt-cache madison <module> node-<module> | grep Packages. I have created a patch (attached) for npm2deb. I unable to test it because of #840811 [1].
Could you please verify if this patch works.
[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=840811

SM

Shanavas M Sat 15 Oct 2016 6:39PM

Have updated js_task_create.py too.

@praveen, I will try is-arrayish

PP

Pirate Praveen Sun 16 Oct 2016 6:16AM

@shanavasm use like 'rmadison -s sid node-jison'. You can test it with other packages which don't have utf-8 in description like jison. Submit the patch directly on https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=836182 and may be send a pull request to upstream github repo.

SM

Shanavas M Sun 16 Oct 2016 8:05AM

@praveenarimbrathod I have generated package and source files for is-arrayish as described in [1]. Files are at gitlab [2]. What next ?.
Shall I send an ITP ?

[1] https://wiki.debian.org/Javascript/Nodejs/Npm2Deb
[2] https://gitlab.com/shanavasm/debian-packaging/tree/master/is-arrayish

PP

Pirate Praveen Sun 16 Oct 2016 10:36AM

@shanavasm You should use gbp import-dsc command to import the package as a git repo. See https://wiki.debian.org/Diaspora/Packaging/gitlab#gbp_import-dsc

Unlike gem2deb, you'll have to download orig.tar.gz, run uupdate, and dpkg-source -b . to get the dsc file.

Go ahead with the ITP.

PP

Pirate Praveen Mon 17 Oct 2016 8:15AM

@sadiq I had to run these command in vim to clean the outfile.

1,$g/^node.*$/d
1,$g/^und.*$/d
1,$g/^colo.*$/d
1,$s/)$/) || || ||/

Can you check for packages in NEW and which has ITP bugs? npm2deb search does these already so you can refer its code.

PP

Pirate Praveen Fri 21 Oct 2016 3:02AM

There is only one branch there. You should push all branches (git push --all) and all tags (git push --tags), but remove the debian/ only when it is ready for upload.

PP

Pirate Praveen Fri 21 Oct 2016 3:05AM

For node-strip-bom pristine-tar branch is missing. You should run gbp import-dsc --pristine-tar so we have pristine-tar data as well. pristine-tar branch is used to create exact orig.tar ball from upstream branch.

SM

Shanavas M Sun 23 Oct 2016 8:51AM

@praveenarimbrathod Thanks, Done :)

PP

Pirate Praveen Tue 25 Oct 2016 2:57AM

Once a package is ready for upload, you should change UNRELEASED to unstable (you can use dch -r command).

Also you should remove the line * New upstream release from debian/changelog. This was added by uupdate, since this is the initial release, we don't need that line. (uupdate is usually run only when we update the upstream release).

PP

Pirate Praveen Tue 25 Oct 2016 3:05AM

Also request membership to https://alioth.debian.org/projects/pkg-javascript group after signing up. We keep all our nodejs packages there so everyone in the team can update these packages.

It would also be a good idea to use a new dedicated email account for debian work as some of the mailing lists are high volume and also the email address becomes public. I suggest a community run email service like disroot.org, autistici.org, or riseup.net

PP

Pirate Praveen Tue 25 Oct 2016 11:48AM

@shanavasm Congratulations! Both packages are uploaded to debian! Now it will be reviewed by ftp masters before it is added to debian. They may ask you to change something, usually if you missed any copyright notices.

Also your request to join pkg-javascript on alioth is accepted. So next time, push your packages to alioth. See https://wiki.debian.org/Alioth/SSH for using ssh with alioth.

To create a new git repo you can follow these steps:

ssh git.debian.org
cd /git/pkg-javascript
./setup-repository node-is-arrayish 'Packaging for node-is-arrayish'

You can try is-equal-shallow next. You can take any leaf module from https://wiki.debian.org/Javascript/Nodejs/Tasks/grunt but just let me know before you start working so we don't duplicate work.

SM

Shanavas M Tue 25 Oct 2016 2:45PM

@praveenarimbrathod Thanks :):) !!.

I'll try is-equal-shallow next

PP

Pirate Praveen Tue 25 Oct 2016 5:22PM

Update https://wiki.debian.org/Javascript/Nodejs/Npm2Deb with more details so it becomes easy for others. Add the things you learned but missing from the wiki like requesting alioth membership, final update to debian/changelog, pushing all branches etc.

SM

Shanavas M Wed 26 Oct 2016 2:15PM

@praveenarimbrathod

npm2deb create is-equal-shallow throws the following error

Warnings occured:
[error] is-primitive: dependency node-is-primitive not in debian

How to handle dependencies not added to debian ?

PP

Pirate Praveen Wed 26 Oct 2016 4:01PM

It is recently packaged by @sruthi (https://tracker.debian.org/pkg/node-is-primitive). You get this error because your apt cache is not updated. If you use rmadison -s sid instead of apt-cache madison we can always get the latest info. Can you try to fix this in npm2deb https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=836182 ? Send a pull request to npm2deb github repo and send forwarded 836182 <pr link> to control at bugs.debian.org

SM

Shanavas M Thu 27 Oct 2016 6:46AM

My apt-cache was up to date. A little investigation shows that npm2deb searches only for 'source' packages and I don't have a source entry in my sources.list.

However rmadison seems to be perfect solution. I will try to fix it.

BC

Balasankar C Thu 27 Oct 2016 9:09AM

However rmadison seems to be perfect solution. I will try to fix it.

👍

SM

Shanavas M Thu 27 Oct 2016 4:30PM

I have fixed the package search issue [#836182]. Fix is available at https://github.com/shanavas786/npm2deb/tree/fix-package-search.

PP

Pirate Praveen Thu 27 Oct 2016 4:46PM

PP

Pirate Praveen Thu 27 Oct 2016 4:55PM

#840929 was a local issue. Can you try https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=840226 ?

SM

Shanavas M Fri 28 Oct 2016 12:41PM

PP

Pirate Praveen Fri 28 Oct 2016 3:13PM

Looks good! Thanks :)

SM

Shanavas M Sat 29 Oct 2016 12:57PM

S

Suhail Wed 26 Oct 2016 2:42PM

@praveenarimbrathod - same doubt as mentioned above

$ npm2deb create string-width
Warnings occured:
[error] is-fullwidth-code-point: dependency node-is-fullwidth-code-point not in debian
[error] strip-ansi: dependency node-strip-ansi not in debian

$ npm2deb depends -b -r string-width
Dependencies:
NPM

string-width (2.0.0)

├─ is-fullwidth-code-point (2.0.0)

└─ strip-ansi (3.0.0)

└─ ansi-regex (2.0.0)

PP

Pirate Praveen Wed 26 Oct 2016 4:07PM

You have the same issue like @shanavasm , you have to update your apt cache with apt-get update.

$ npm2deb depends -b -r string-width
Dependencies:
NPM                                               Debian
string-width (2.0.0)                              None
├─ is-fullwidth-code-point (^2.0.0)               None
└─ strip-ansi (^3.0.0)                            node-strip-ansi (3.0.1-1)

Since is-fullwidth-code-point is not packaged, you have to do that first.

PP

Pirate Praveen Thu 27 Oct 2016 10:05AM

Seems is-fullwidth-code-point is very buggy https://lists.debian.org/debian-devel/2016/10/msg00743.html We have to use wcwidth.js instead. So please package that.

S

Suhail Thu 27 Oct 2016 10:19AM

It has another dependency, defaults (1.0.3), which is not packaged!

PP

Pirate Praveen Thu 27 Oct 2016 10:22AM

ok, start with defaults then.

S

Suhail Thu 27 Oct 2016 10:46AM

dpkg-buildpackage is throwing following errors. node-clone (1.0.2) is already packaged.

dpkg-gencontrol: warning: can't parse dependency node-clone (1.0.2)
dpkg-gencontrol: error: error occurred while parsing Depends field:
, nodejs
, node-clone (1.0.2)

PP

Pirate Praveen Thu 27 Oct 2016 10:49AM

You need to convert ^ to >=. See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=840207 after you complete this package, try fixing it in npm2deb so its converted automatically.

S

Suhail Fri 28 Oct 2016 12:40PM

Trying to fix this[0]. Could you please check this[1]?

Testing on defaults package
CONTROL file before - [2]
CONTROL file now - [3]

[0] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=840207

[1] https://github.com/psuhailp/npm2deb/commit/4dc756ef5849bf51ee41938f33ca4680d6a0829b

[2] http://paste.debian.net/hidden/222a6fd2/

[3] http://paste.debian.net/hidden/dbe071e2/

PP

Pirate Praveen Fri 28 Oct 2016 3:20PM

Give a space after '>=', like '>= '.

You also need to look for n.x and ~. if version is '1.x', it should be '>= 1.0'.

~1.0.0 means >= 1.0.0, << 1.1. ~1.0, means >= 1.0, << 2. You'll have to add two lines.

node-jju (~1.1.0) becomes
, node-jju (>= 1.1.0)
, node-jju (<< 1.2)

S

Suhail Fri 28 Oct 2016 7:29PM

ok, i will change it.

S

Suhail Sat 29 Oct 2016 3:37PM

isn't '1.x' like '>= 1.0' & '<< 2'. I am confused :confused: . Is there any documentation on that?

PP

Pirate Praveen Thu 27 Oct 2016 5:02PM

Congratulations @suhail . Your package node-defaults is uploaded to debian.

S

Suhail Thu 27 Oct 2016 5:26PM

Thanks :smiley:

PP

Pirate Praveen Fri 28 Oct 2016 4:31AM

node-defaults is accepted into unstable, so you can package wcwidth.js now.

S

Suhail Fri 28 Oct 2016 8:51AM

Ok Praveen. I shall do wcwidth.js packaging next.

PP

Pirate Praveen Sun 25 Dec 2016 1:33PM

@sadiq @shanavasm @suhail @balasankarchelamat @bhe shall we do another packaging session in Kochi?

S

Suhail Mon 26 Dec 2016 6:09AM

ya, sure