[Pkg-javascript-commits] [npm2deb] 01/01: install files section

Praveen Arimbrathodiyil praveen at moszumanska.debian.org
Wed Nov 2 17:25:00 UTC 2016


This is an automated email from the git hooks/post-receive script.

praveen pushed a commit to branch master
in repository npm2deb.

commit a3c40e112dc1b8bed444cc8df38801f7120271b3
Author: Praveen Arimbrathodiyil <praveen at debian.org>
Date:   Wed Nov 2 22:54:41 2016 +0530

    install files section
---
 debian/changelog                                   |   4 +
 ...007-install-files-section-of-package-json.patch | 105 +++++++++++++++++++++
 debian/patches/series                              |   1 +
 3 files changed, 110 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 65f52fe..56c46a1 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,6 @@
 npm2deb (0.2.5-4) UNRELEASED; urgency=medium
 
+  * Team upload
   * Bump standards version of generated packages to 3.9.8
   * Fix vcs url (Closes: #842741), typo in copyright (Closes: #842742)
     (thanks to Evgeni Golov)
@@ -9,6 +10,9 @@ npm2deb (0.2.5-4) UNRELEASED; urgency=medium
   * Automate upto deb file creation (add uscan, uupdate and dpkg-buildpackage)
     (Closes: #840174)
 
+  [ Shanavas M ]
+  * When package.json has a files section, install them (Closes: #841995)
+
  -- Pirate Praveen <praveen at debian.org>  Sat, 29 Oct 2016 19:45:20 +0530
 
 npm2deb (0.2.5-3) unstable; urgency=medium
diff --git a/debian/patches/0007-install-files-section-of-package-json.patch b/debian/patches/0007-install-files-section-of-package-json.patch
new file mode 100644
index 0000000..4e3d5b1
--- /dev/null
+++ b/debian/patches/0007-install-files-section-of-package-json.patch
@@ -0,0 +1,105 @@
+From 6e2827d31e34237c1b5edb9274fd1ebc97e227f6 Mon Sep 17 00:00:00 2001
+From: Shanavas M <shanavas.m2 at gmail.com>
+Date: Mon, 31 Oct 2016 22:52:11 +0300
+Subject: [PATCH 1/2] Install files from directories and files fields
+
+https://docs.npmjs.com/files/package.json#directories
+https://docs.npmjs.com/files/package.json#files
+
+Fixes https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=841995
+---
+ npm2deb/__init__.py | 14 ++++++++++++++
+ 1 file changed, 14 insertions(+)
+
+diff --git a/npm2deb/__init__.py b/npm2deb/__init__.py
+index 52fe76f..0e2bf16 100644
+--- a/npm2deb/__init__.py
++++ b/npm2deb/__init__.py
+@@ -158,6 +158,19 @@ def create_install(self):
+             libs.append('bin')
+         if _os.path.isdir('lib'):
+             libs.append('lib')
++
++        # install files from directories field
++        if 'directories' in self.json:
++            directories = self.json['directories']
++            if 'bin' in directories:
++                libs.append(directories['bin'])
++            if 'lib' in directories:
++                libs.append(directories['lib'])
++
++        # install files from files field
++        if 'files' in self.json:
++            libs += self.json['files']
++
+         # install main if not in a subpath
+         if 'main' in self.json:
+             main = self.json['main']
+@@ -171,6 +184,7 @@ def create_install(self):
+                 libs.append('index.js')
+             else:
+                 libs.append('*.js')
++
+         for filename in libs:
+             content += "%s %s/\n" % (filename, self.debian_dest)
+         utils.create_debian_file('install', content)
+
+From 342cb56f28419d28a30ae17cd0526cf2fdeec02b Mon Sep 17 00:00:00 2001
+From: Shanavas M <shanavas.m2 at gmail.com>
+Date: Mon, 31 Oct 2016 23:18:00 +0300
+Subject: [PATCH 2/2] Remove duplicate entries from debian/install file
+
+---
+ npm2deb/__init__.py | 18 +++++++++---------
+ 1 file changed, 9 insertions(+), 9 deletions(-)
+
+diff --git a/npm2deb/__init__.py b/npm2deb/__init__.py
+index 0e2bf16..ed0b5d1 100644
+--- a/npm2deb/__init__.py
++++ b/npm2deb/__init__.py
+@@ -153,23 +153,23 @@ def create_links(self):
+ 
+     def create_install(self):
+         content = ''
+-        libs = ['package.json']
++        libs = {'package.json'}
+         if _os.path.isdir('bin'):
+-            libs.append('bin')
++            libs.add('bin')
+         if _os.path.isdir('lib'):
+-            libs.append('lib')
++            libs.add('lib')
+ 
+         # install files from directories field
+         if 'directories' in self.json:
+             directories = self.json['directories']
+             if 'bin' in directories:
+-                libs.append(directories['bin'])
++                libs.add(directories['bin'])
+             if 'lib' in directories:
+-                libs.append(directories['lib'])
++                libs.add(directories['lib'])
+ 
+         # install files from files field
+         if 'files' in self.json:
+-            libs += self.json['files']
++            libs = libs.union(self.json['files'])
+ 
+         # install main if not in a subpath
+         if 'main' in self.json:
+@@ -178,12 +178,12 @@ def create_install(self):
+             if main == 'index':
+                 main = 'index.js'
+             if not main.find('/') > 0:
+-                libs.append(_os.path.normpath(main))
++                libs.add(_os.path.normpath(main))
+         else:
+             if _os.path.exists('index.js'):
+-                libs.append('index.js')
++                libs.add('index.js')
+             else:
+-                libs.append('*.js')
++                libs.add('*.js')
+ 
+         for filename in libs:
+             content += "%s %s/\n" % (filename, self.debian_dest)
diff --git a/debian/patches/series b/debian/patches/series
index dd97b88..a0e213e 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -4,3 +4,4 @@
 0004-bump-standards.patch
 0005-fix-dependency-format.patch
 0006-more-automation.patch
+0007-install-files-section-of-package-json.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/npm2deb.git



More information about the Pkg-javascript-commits mailing list