[Pkg-javascript-devel] Bug#961873: Bug#961873: npm2deb: Both node-$module and node-$module-$version get created, with two copies of debian dir

Wookey wookey at wookware.org
Mon Jun 1 04:30:30 BST 2020


On 2020-05-31 16:44 +0530, Pirate Praveen wrote:
> 
> This is a known issue, node-npm-run is temporary and used to create
> node-npm-run-5.0.1 with uscan and uupdate.
> node-npm-run should be deleted to avoid confusion.

OK. Attached is a patch to do this.

I don't write python so this may be less than idiomatic.

I decided to use 'did we cd into the new dir' as the 'it worked, so
the temp dir can be binned' test. You could test whether uupdate ran OK instead.

This is a bit fiddly because the cd is hidden inside a function which
does not pass back any status.

> > node-npm-run-5.0.1/debian/changelog had an extra copy of the stanza for
> > the same version:
> 
> This is added by uupdate.

OK, this is clearly wrong in terms of making a clean package. There
doesn't appear to be a uupdate command for 'don't make a new changelog
entry on update', not a debchange 'remove an entry' option. So after a
bit of thought the neatest way to deal with this seems to be to just
copy the original changelog-made-from-template into the final package
dir, then remove the original temp dir.

If we do this immediately after the chdir into the new dir then we can
be sure that uupdate worked and the new dir was created, so the old
one is no longer wanted.

debdiff attached, but the core of it is:
@@ -100,6 +100,9 @@ class Npm2Deb(object):
 
             new_dir = '%s-%s' % (self.debian_name, self.upstream_version)
             utils.change_dir('../%s' % new_dir)
+            # copy over non-duplicate changelog
+            _os.rename('../%s/debian/changelog' % self.debian_name, 'debian/ch
angelog')
+            _rmtree('../%s' % self.debian_name) 
             self.run_buildpackage()
             self.edit_changelog()
 
(And change changelog template to say 'medium' as the default is no
longer 'low', unless you really do want all these packages to be
'low')

> > node-npm-run (5.0.1-1) UNRELEASED; urgency=medium
> > 
> >   *
> > 
> >  -- Wookey <wookey at debian.org>  Sat, 30 May 2020 16:09:20 +0000
> > 
> > node-npm-run (5.0.1-1) UNRELEASED; urgency=low
> > 
> >   * Initial release (Closes: #nnnn)
> > 
> >  -- Wookey <wookey at debian.org>  Sat, 30 May 2020 16:09:11 +0000


If you don't like the above approach for some reason then the
edit_changelog function could be made to tidy up if there are two
matching stanzas. Something along the lines of the below, but that
need saving the output of processes, and maybe copying result in/out
of pipes, which seems overkill, and is beyond my python-foo in the time
available.

Psuedocode for what needs doing:
        # remove spurious repeat changelog entry if present
        _call(
            'parsechangelog --all | grep " %s (%s-1)" | wc -l' % self.name, self.upstream_version, shell=True)
        if result = 2
        _call(
            "sed -i '1-6 d' debian/changelog", shell=True)

Wookey
-- 
Principal hats:  Linaro, Debian, Wookware, ARM
http://wookware.org/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: npm2deb-0.3.0-fix-961873-2.patch
Type: text/x-diff
Size: 2386 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/pkg-javascript-devel/attachments/20200601/5d951e48/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/pkg-javascript-devel/attachments/20200601/5d951e48/attachment.sig>


More information about the Pkg-javascript-devel mailing list