LeoIannacone / npm2deb

tool to help debianize Node.js modules
GNU General Public License v3.0
46 stars 34 forks source link

automate import-dsc command #149

Closed nileshpatra closed 3 years ago

nileshpatra commented 4 years ago

Solves #64

nileshpatra commented 4 years ago

@shanavas786 @LeoIannacone please review.

shanavas786 commented 4 years ago

@nileshpatra A sanity check if gbp exist would be nice. Looks good. @pravi can you test this ?

nileshpatra commented 4 years ago

@shanavas786 added the sanity check. Could you, and @pravi please review this, and let me know if it looks okay?

pravi commented 4 years ago

@nileshpatra did you test it? I don't think you tested it. You should do a basic test before asking for review.

pravi commented 4 years ago

If you take pretty-hrtime module as an example, you should remove pretty-hrtime/node-pretty-hrtime directory before gbp import (currently it is imported under pretty-hrtime/node-pretty-hrtime-1.0.3/node-pretty-hrtime). If the import is successfull pretty-hrtime/node-pretty-hrtime-1.0.3 directory should be removed.

nileshpatra commented 3 years ago

@pravi done. Please review :-)

nileshpatra commented 3 years ago

cc: @shanavas786

shanavas786 commented 3 years ago

@nileshpatra would be great if you test it for a node module and attach the complete log here as well.

nileshpatra commented 3 years ago

@shanavas786

Logs: For node-uniq:

[~/packages/uniq]$ npm2deb create uniq

Downloading source tarball file using debian/watch file...
uscan: Newest version of node-uniq on remote site is 1.0.1, specified download version is 1.0.1
Successfully symlinked ../uniq-1.0.1.tgz to ../node-uniq_1.0.1.orig.tar.gz.

Creating debian source package...
uupdate: debian/source/format is "3.0 (quilt)".
uupdate: Auto-generating node-uniq_1.0.1-1.debian.tar.xz
uupdate: -> Use existing node-uniq_1.0.1-1.debian.tar.xz
dpkg-source: info: extracting node-uniq in node-uniq-1.0.1
dpkg-source: info: unpacking node-uniq_1.0.1.orig.tar.gz
dpkg-source: info: unpacking node-uniq_1.0.1-1.debian.tar.xz
uupdate: Remember: Your current directory is changed back to the old source tree!
uupdate: Do a "cd ../node-uniq-1.0.1" to see the new source tree and
    edit it to be nice Debianized source.

Building the binary package
dpkg-source: info: using source format '3.0 (quilt)'
dpkg-source: info: building node-uniq using existing ./node-uniq_1.0.1.orig.tar.gz
dpkg-source: info: building node-uniq in node-uniq_1.0.1-1.debian.tar.xz
dpkg-source: info: building node-uniq in node-uniq_1.0.1-1.dsc
dpkg-buildpackage: info: source package node-uniq
dpkg-buildpackage: info: source version 1.0.1-1
dpkg-buildpackage: info: source distribution UNRELEASED
dpkg-buildpackage: info: source changed by Nilesh Patra <npatra974@gmail.com>
dpkg-buildpackage: info: host architecture amd64
 dpkg-source --before-build .
 fakeroot debian/rules clean
dh clean --with nodejs
   dh_auto_clean --buildsystem=nodejs
    rm -rf ./node_modules/.cache
   dh_clean
 dpkg-source -b .
dpkg-source: info: using source format '3.0 (quilt)'
dpkg-source: info: building node-uniq using existing ./node-uniq_1.0.1.orig.tar.gz
dpkg-source: info: building node-uniq in node-uniq_1.0.1-1.debian.tar.xz
dpkg-source: info: building node-uniq in node-uniq_1.0.1-1.dsc
 debian/rules build
dh build --with nodejs
   dh_update_autotools_config
   dh_autoreconf
   dh_auto_configure --buildsystem=nodejs
   dh_auto_build --buildsystem=nodejs
No build command found, searching known files
   dh_auto_test --buildsystem=nodejs
    /usr/bin/node -e require\(\"./.\"\)
   create-stamp debian/debhelper-build-stamp
 fakeroot debian/rules binary
dh binary --with nodejs
   dh_testroot
   dh_prep
   dh_auto_install --buildsystem=nodejs
No "files" field in ./package.json, install all files
    mkdir -p /home/nilesh/packages/uniq/uniq/node-uniq-1.0.1/debian/node-uniq//usr/share/nodejs/uniq/
    cp --reflink=auto -a ./uniq.js /home/nilesh/packages/uniq/uniq/node-uniq-1.0.1/debian/node-uniq//usr/share/nodejs/uniq//
    cp --reflink=auto -a ./package.json /home/nilesh/packages/uniq/uniq/node-uniq-1.0.1/debian/node-uniq//usr/share/nodejs/uniq//
Set ${nodejs:Version} to 12.18.3~dfsg
   dh_installdocs
   dh_installchangelogs
   dh_perl
   dh_link
   dh_strip_nondeterminism
   dh_compress
   dh_fixperms
   dh_missing
   dh_installdeb
   dh_gencontrol
dpkg-gencontrol: warning: package node-uniq: substitution variable ${nodejs:Version} unused, but is defined
   dh_md5sums
   dh_builddeb
dpkg-deb: building package 'node-uniq' in '../node-uniq_1.0.1-1_all.deb'.
 dpkg-genbuildinfo
 dpkg-genchanges  >../node-uniq_1.0.1-1_amd64.changes
dpkg-genchanges: info: including full source code in upload
 dpkg-source --after-build .
dpkg-buildpackage: info: full upload (original source is included)
dpkg-buildpackage: warning: not signing UNRELEASED build; use --force-sign to override
dh clean --with nodejs
   dh_auto_clean --buildsystem=nodejs
    rm -rf ./node_modules/.cache
   dh_clean
/usr/bin/gbp
/home/nilesh/packages/uniq/uniq/node-uniq-1.0.1
gbp:info: No git repository found, creating one.
gbp:info: Version '1.0.1-1' imported under '/home/nilesh/packages/uniq/uniq/node-uniq'

Remember, your new source directory is uniq/node-uniq-1.0.1

This is not a crystal ball, so please take a look at auto-generated files.

You may want fix first these issues:

/bin/grep: uniq/node-uniq-1.0.1/debian/*: No such file or directory
uniq/node-uniq_itp.mail:Subject: ITP: node-uniq -- FIX_ME write the Debian package description
uniq/node-uniq_itp.mail:  Description     : FIX_ME write the Debian package description
uniq/node-uniq_itp.mail: FIX_ME: This ITP report is not ready for submission, until you are
uniq/node-uniq_itp.mail:FIX_ME: Explain why this package is suitable for adding to Debian. Is
uniq/node-uniq_itp.mail:FIX_ME: Explain how you intend to consistently maintain this package

*** Warning ***
Using npmregistry to download npm dist tarballs, because upstream
git repo is missing tags. Its better to ask upstream to tag their releases
instead of using npm dist tarballs as dist tarballs may contain pre built files
and may not include tests.

[~/packages/uniq]$ ls uniq           
node-uniq  node-uniq_1.0.1-1_all.deb  node-uniq_1.0.1-1_amd64.buildinfo  node-uniq_1.0.1-1_amd64.changes  node-uniq_1.0.1-1.debian.tar.xz  node-uniq_1.0.1-1.dsc  node-uniq_1.0.1.orig.tar.gz  node-uniq_itp.mail  uniq-1.0.1.tgz
[~/packages/uniq]$ cd uniq/node-uniq 
[master][~/packages/uniq/uniq/node-uniq]$ git status
On branch master
nothing to commit, working tree clean

For rollup:

[~/packages/uniq]$ npm2deb create rollup

Downloading source tarball file using debian/watch file...
uscan: Newest version of node-rollup on remote site is 2.26.10, specified download version is 2.26.10
Successfully symlinked ../node-rollup-2.26.10.tar.gz to ../node-rollup_2.26.10.orig.tar.gz.

Creating debian source package...
uupdate: debian/source/format is "3.0 (quilt)".
uupdate: Auto-generating node-rollup_2.26.10-1.debian.tar.xz
uupdate: -> Use existing node-rollup_2.26.10-1.debian.tar.xz
dpkg-source: info: extracting node-rollup in node-rollup-2.26.10
dpkg-source: info: unpacking node-rollup_2.26.10.orig.tar.gz
dpkg-source: info: unpacking node-rollup_2.26.10-1.debian.tar.xz
uupdate: Remember: Your current directory is changed back to the old source tree!
uupdate: Do a "cd ../node-rollup-2.26.10" to see the new source tree and
    edit it to be nice Debianized source.

Building the binary package
dpkg-source: info: using source format '3.0 (quilt)'
dpkg-source: info: building node-rollup using existing ./node-rollup_2.26.10.orig.tar.gz
dpkg-source: info: building node-rollup in node-rollup_2.26.10-1.debian.tar.xz
dpkg-source: info: building node-rollup in node-rollup_2.26.10-1.dsc
dpkg-buildpackage: info: source package node-rollup
dpkg-buildpackage: info: source version 2.26.10-1
dpkg-buildpackage: info: source distribution UNRELEASED
dpkg-buildpackage: info: source changed by Nilesh Patra <npatra974@gmail.com>
dpkg-buildpackage: info: host architecture amd64
 dpkg-source --before-build .
 fakeroot debian/rules clean
dh clean --with nodejs
   dh_auto_clean --buildsystem=nodejs
    rm -rf ./node_modules/.cache
   dh_clean
 dpkg-source -b .
dpkg-source: info: using source format '3.0 (quilt)'
dpkg-source: info: building node-rollup using existing ./node-rollup_2.26.10.orig.tar.gz
dpkg-source: warning: ignoring deletion of directory .github
dpkg-source: warning: ignoring deletion of file .github/PULL_REQUEST_TEMPLATE.md, use --include-removal to override
dpkg-source: warning: ignoring deletion of file .github/labels.json, use --include-removal to override
dpkg-source: warning: ignoring deletion of file .github/ISSUE_TEMPLATE.md, use --include-removal to override
dpkg-source: warning: ignoring deletion of file .github/FUNDING.yml, use --include-removal to override
dpkg-source: warning: ignoring deletion of directory .github/ISSUE_TEMPLATE
dpkg-source: warning: ignoring deletion of file .github/ISSUE_TEMPLATE/FEATURE.md, use --include-removal to override
dpkg-source: warning: ignoring deletion of file .github/ISSUE_TEMPLATE/DOCS.md, use --include-removal to override
dpkg-source: warning: ignoring deletion of file .github/ISSUE_TEMPLATE/SUPPORT.md, use --include-removal to override
dpkg-source: warning: ignoring deletion of file .github/ISSUE_TEMPLATE/MODIFICATION.md, use --include-removal to override
dpkg-source: warning: ignoring deletion of file .github/ISSUE_TEMPLATE/BUG.md, use --include-removal to override
dpkg-source: warning: ignoring deletion of directory .github/workflows
dpkg-source: warning: ignoring deletion of file .github/workflows/node-windows.yml, use --include-removal to override
dpkg-source: info: building node-rollup in node-rollup_2.26.10-1.debian.tar.xz
dpkg-source: info: building node-rollup in node-rollup_2.26.10-1.dsc
 debian/rules build
dh build --with nodejs
   dh_update_autotools_config
   dh_autoreconf
   dh_auto_configure --buildsystem=nodejs
   dh_auto_build --buildsystem=nodejs
   dh_auto_test --buildsystem=nodejs
    /usr/bin/node -e require\(\"./.\"\)
internal/modules/cjs/loader.js:329
      throw err;
      ^

Error: Cannot find module '/home/nilesh/packages/uniq/rollup/node-rollup-2.26.10/dist/rollup.js'. Please verify that the package.json has a valid "main" entry
    at tryPackage (internal/modules/cjs/loader.js:321:19)
    at Function.Module._findPath (internal/modules/cjs/loader.js:682:18)
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:952:27)
    at Function.Module._load (internal/modules/cjs/loader.js:841:27)
    at Module.require (internal/modules/cjs/loader.js:1025:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at [eval]:1:1
    at Script.runInThisContext (vm.js:120:18)
    at Object.runInThisContext (vm.js:309:38)
    at Object.<anonymous> ([eval]-wrapper:10:26) {
  code: 'MODULE_NOT_FOUND',
  path: '/home/nilesh/packages/uniq/rollup/node-rollup-2.26.10/package.json',
  requestPath: './.'
}
dh_auto_test: error: /usr/bin/node -e require\(\"./.\"\) returned exit code 1
make: *** [debian/rules:8: build] Error 1
dpkg-buildpackage: error: debian/rules build subprocess returned exit status 2
dh clean --with nodejs
   dh_auto_clean --buildsystem=nodejs
    rm -rf ./node_modules/.cache
   dh_clean
/usr/bin/gbp
/home/nilesh/packages/uniq/rollup/node-rollup-2.26.10
gbp:info: No git repository found, creating one.
gbp:info: Version '2.26.10-1' imported under '/home/nilesh/packages/uniq/rollup/node-rollup'

Remember, your new source directory is rollup/node-rollup-2.26.10

This is not a crystal ball, so please take a look at auto-generated files.

You may want fix first these issues:

/bin/grep: rollup/node-rollup-2.26.10/debian/*: No such file or directory
rollup/node-rollup_itp.mail:Subject: ITP: node-rollup -- FIX_ME write the Debian package description
rollup/node-rollup_itp.mail:  Description     : FIX_ME write the Debian package description
rollup/node-rollup_itp.mail: FIX_ME: This ITP report is not ready for submission, until you are
rollup/node-rollup_itp.mail:FIX_ME: Explain why this package is suitable for adding to Debian. Is
rollup/node-rollup_itp.mail:FIX_ME: Explain how you intend to consistently maintain this package
Warnings occurred:
 [error]   fsevents: dependency node-fsevents not in debian

[~/packages/uniq]$ ls rollup 
node-rollup  node-rollup_2.26.10-1.debian.tar.xz  node-rollup_2.26.10-1.dsc  node-rollup_2.26.10.orig.tar.gz  node-rollup-2.26.10.tar.gz  node-rollup_itp.mail
[~/packages/uniq]$ ls rollup/node-rollup
browser        CHANGELOG.md  CODE_OF_CONDUCT.md  debian  LICENSE-CORE.md  markdownlint.json  package-lock.json  rollup.config.js  src   tsconfig.json  typings
build-plugins  cli           CONTRIBUTING.md     docs    LICENSE.md       package.json       README.md          scripts           test  tslint.json
[~/packages/uniq]$ cd rollup/node-rollup 
[master][~/packages/uniq/rollup/node-rollup]$ git status
On branch master
nothing to commit, working tree clean

Pasted two logs for full verfication - I hope that looks OK?