electrum-nmc icon indicating copy to clipboard operation
electrum-nmc copied to clipboard

Create a proper .deb file

Open rllola opened this issue 6 years ago • 23 comments

It would be nice to have it packaged so it can also automatically push the .desktop at the correct place, etc ...

See this article which explain how : https://blog.serverdensity.com/how-to-create-a-debian-deb-package/

rllola avatar Apr 06 '19 22:04 rllola

.deb packages would be great to have. Probably such a feature should be submitted to upstream Electrum, but it's directly relevant to Namecoin, so definitely not a problem to have an issue for it in Electrum-NMC's issue tracker.

Worth noting that rbm (which Tor uses for reproducible builds) can generate .deb and .rpm packages, so perhaps getting upstream Electrum to use rbm for its build system would be a good way to solve this and some other problems at the same time.

JeremyRand avatar Apr 09 '19 13:04 JeremyRand

Here the PR : https://github.com/spesmilo/electrum/pull/5336

I am not familiar with rbm. I just used dpkg to package everything. Lets see what they comment.

rllola avatar May 12 '19 23:05 rllola

@rllola FYI Debian now has an official package of Electrum v3.3.8. If you'd like to fork Debian's official package to build Electrum-NMC, I could check with Masayuki about getting it submitted to Debian. (If you need me to tag nc3.3.8, let me know and I'll do it ASAP.)

JeremyRand avatar Sep 08 '19 10:09 JeremyRand

Where can I find the code for the debian official package ? I tried to look for it and found this : https://salsa.debian.org/cryptocoin-team/electrum

But it seems to be used for 3.2.3 and not 3.3.8

rllola avatar Sep 12 '19 20:09 rllola

Where can I find the code for the debian official package ? I tried to look for it and found this : https://salsa.debian.org/cryptocoin-team/electrum

But it seems to be used for 3.2.3 and not 3.3.8

@rllola According to https://tracker.debian.org/pkg/electrum , the VCS repo is outdated. I'm not sure how quickly that'll be fixed, but in the meantime, I believe you can get the source via running apt-src update && apt-src install electrum on Debian Sid. Alternatively it looks like there are downloads at the bottom of https://packages.debian.org/source/sid/electrum .

JeremyRand avatar Sep 15 '19 05:09 JeremyRand

Took me a little more time than expected but I think I got it. https://github.com/rllola/electrum/tree/debian

I have follow the debian guide (https://www.debian.org/doc/manuals/maint-guide/build.en.html) and used the electrum files as reference.

I can build the 2 packages locally :

  • python3-electrum-nmc
  • electrum-nmc

(Like they did for electrum)

I can send an email to Masayuki to review it with him.

rllola avatar Sep 23 '19 12:09 rllola

Took me a little more time than expected but I think I got it. https://github.com/rllola/electrum/tree/debian

@rllola Ah cool, excellent! A few minor nits:

  • The phrase "losing your bitcoins" shows up 2 times in your package; that should probably be replaced with "losing your namecoins or names".
  • In the description, "Electrum NMC" (with a space separator) appears in 3 places; that should probably be with a hyphen separator ("Electrum-NMC") instead.
  • The copyright/licensing info should probably point out that the AuxPoW code is based on Electrum-DOGE, which is copyright the Electrum-DOGE contributors and is licensed under GPLv3+.

I can send an email to Masayuki to review it with him.

Okay great. Let me know if you run into trouble reaching him.

JeremyRand avatar Sep 25 '19 03:09 JeremyRand

I have done the modification. I will do a last check this week end before contacting Masayuki.

rllola avatar Sep 27 '19 09:09 rllola

@rllola Some more review of your package (as of 23c4a48ddfae08bbab9ae78bf86d8804823af881 ):

  • changelog indicates version 3.3.4-1. This should probably be 3.3.8-0.1 to match Debian's Electrum (Bitcoin) package.
  • changelog says (Closes: #120). I guess this is a reference to an Electrum-NMC bug number; it should be replaced by a Debian bug number (or, if packaging Electrum-NMC doesn't have a Debian bug number, I suppose it should just be removed).
  • compat is 10, while Debian's Electrum (Bitcoin) package is 11. Is there a reason for the difference? The debhelper dependency in control is 11 for both, so I'm guessing that compat should be 11 as well.
  • In control, Build-Depends indentation uses 2 spaces, while Debian's Electrum (Bitcoin) package uses 1 space. Please use 1 space to minimize the diff.
  • In control, Maintainer appears below Priority, while in Debian's Electrum (Bitcoin) package, it appears below Source. Please follow Debian's convention to minimize the diff.
  • In control, Recommends is missing for python3-electrum-nmc. I don't see any reason why Electrum-NMC should differ from Electrum (Bitcoin) for this line.
  • The manpage files electrum.1 and electrum.manpages from Debian's Electrum (Bitcoin) package are missing.

I'll probably have additional review once these are fixed.

JeremyRand avatar May 19 '20 16:05 JeremyRand

@JeremyRand I have updated the files based on our recommendation. Let me know if I have missed something.

https://github.com/rllola/electrum/tree/debian

rllola avatar Nov 06 '20 11:11 rllola

@rllola More review, based on diff to debian/3.3.8-0.1 tag on Debian Salsa:

  • changelog: release should be capitalized as Release and should have a trailing period.
  • changelog: Is the First Debian package item standard for Debian? I don't see any such item in the changelog for Electrum (BTC).
  • control: Add python3-aiohttp, python3-aiohttp-socks, python3-aiorpcx, and python3-certifi to Build-Depends, remove python3-requests and python3-socks.
  • control: Bump Standards-Version to 4.4.0.
  • control: Replace shlibs:Depends with misc:Depends
  • control: Add missing Recommends for python3-electrum-nmc (value can be same as upstream).
  • control: python3-electrum-nmc's Description should say the "electrum_nmc" Python module, i.e. the hyphen should be an underscore (Python modules don't have hyphens in their names).
  • control: electrum-nmc's Recommends shouldn't include python3-electrum-nmc (it's already covered by Depends).
  • copyright: I don't think Electrum Team's copyright on * should be removed, since Electrum-NMC is a derivative work of Electrum. I'm not 100% sure how Debian wants copyrights of forks to be annotated though. Also I don't think any of the Namecoin devs' changes go as far back as 2011.

I'll probably have more review once the above things are fixed. FWIW you can do a lot of this yourself, I just ran a diff between your repo's debian subfolder and the corresponding subfolder on Debian's Salsa instance (the debian/3.3.8-0.1 tag).

JeremyRand avatar Nov 09 '20 20:11 JeremyRand

Regarding the changelog we are going to be different I think from the one from electrum but we can try to stay as close as possible. I have removed First Debian package line, it was not standard. Instead I have put on what we base the packaging from like Masayuki did here (https://salsa.debian.org/debian/namecoin/-/blob/master/debian/changelog).

For the copyright I have re-added Electrum Team looks like you can attribute several copyright. I also digged to try to find the year when the Namecoin started to work electrum-nmc, according to this news it was close to 2017 : https://www.namecoin.org/2017/06/17/progress-electrum-nmc.html

I didn't realize that since last year they actually changed stuff. I have updated the files to last year new commits.

rllola avatar Nov 12 '20 11:11 rllola

@rllola Nice work, looking a lot better now. A few more minor tweaks:

https://github.com/rllola/electrum/blob/549102e9442221672895ce877aeb658f3fc28f0c/debian/changelog#L5

A couple of stray space characters here.

https://github.com/rllola/electrum/blob/549102e9442221672895ce877aeb658f3fc28f0c/debian/control#L31-L32

Add Recommends field between these two lines; can be the same as the corresponding field in the Electrum (BTC) package

https://github.com/rllola/electrum/blob/549102e9442221672895ce877aeb658f3fc28f0c/debian/copyright#L5-L16

Maybe I'm missing something, but it looks like the latter half of this is redundant (since Electrum Team is specified in both halves). Also, is the copyright year supposed to be the initial year or a range? And yes, you're correct, Electrum-NMC development began in 2017 (funding from NLnet for Electrum-NMC dev was publicly disclosed on May 19, 2017).

https://github.com/rllola/electrum/blob/549102e9442221672895ce877aeb658f3fc28f0c/debian/copyright#L23

"DOGE" should be all uppercase.

https://github.com/rllola/electrum/blob/549102e9442221672895ce877aeb658f3fc28f0c/debian/copyright#L74-L76

Please move this up to between * and electrum_nmc/electrum/*, for consistency with Electrum (BTC)'s package. Also there's a stray space before a colon here.

https://github.com/rllola/electrum/blob/549102e9442221672895ce877aeb658f3fc28f0c/debian/copyright#L40

Looks like the spacing in this line is altered unnecessarily.

https://github.com/rllola/electrum/blob/549102e9442221672895ce877aeb658f3fc28f0c/debian/copyright#L51-L57

Is there a reason that urllib3 is removed here? (If it's because Electrum-NMC doesn't actually include urllib3, then I guess that's fine, though it should be addressed upstream if it isn't already.)

https://github.com/rllola/electrum/blob/549102e9442221672895ce877aeb658f3fc28f0c/debian/copyright#L70-L82

Same question for the revealer fonts.

https://github.com/rllola/electrum/blob/549102e9442221672895ce877aeb658f3fc28f0c/debian/electrum-nmc.1#L10

"losing namecoins" should be "losing namecoins or names".

https://github.com/rllola/electrum/blob/549102e9442221672895ce877aeb658f3fc28f0c/debian/electrum-nmc.1#L69

Grammar: remove "was".

https://github.com/rllola/electrum/blob/549102e9442221672895ce877aeb658f3fc28f0c/debian/electrum-nmc.manpages#L1

Add a newline to end of file.

https://github.com/rllola/electrum/blob/549102e9442221672895ce877aeb658f3fc28f0c/debian/gpb.conf

Typo: gpb should be gbp.

https://github.com/rllola/electrum/blob/549102e9442221672895ce877aeb658f3fc28f0c/debian/python3-electrum-nmc.install#L1

Add a newline to end of file.

https://github.com/rllola/electrum/blob/549102e9442221672895ce877aeb658f3fc28f0c/debian/rules#L3

What does PYBUILD_NAME do here? (Not saying I think it's wrong, I'm just not sure why it's needed for Electrum-NMC but not Electrum (BTC).)

Maybe adapt the signing-key.asc and watch files from the Debian package for Electrum (BTC)? Not totally sure how they work or what they do. Not really a blocker I guess unless the Debian folks ask for it.

Once the above things are fixed, I think we'll be ready to start pushing Debian to add it to Sid. :)

JeremyRand avatar Nov 14 '20 05:11 JeremyRand

Maybe I'm missing something, but it looks like the latter half of this is redundant (since Electrum Team is specified in both halves). Also, is the copyright year supposed to be the initial year or a range? And yes, you're correct, Electrum-NMC development began in 2017 (funding from NLnet for Electrum-NMC dev was publicly disclosed on May 19, 2017).

Yes you are right this is redundant. I believe if you put the initial year it means it continues up to now. So I am wondering because some commits are being cherry picked from upstream does the copyright still apply ? Otherwise I would put the range "2011-2017"...

Is there a reason that urllib3 is removed here? (If it's because Electrum-NMC doesn't actually include urllib3, then I guess that's fine, though it should be addressed upstream if it isn't already.)

I am not sure why it is has been removed. I have put it back. I have also put back the revealer license and the appropriate license copying.

For the rest I am not sure what the watch file does. I am going to look into the doc...

rllola avatar Nov 25 '20 20:11 rllola

Maybe I'm missing something, but it looks like the latter half of this is redundant (since Electrum Team is specified in both halves). Also, is the copyright year supposed to be the initial year or a range? And yes, you're correct, Electrum-NMC development began in 2017 (funding from NLnet for Electrum-NMC dev was publicly disclosed on May 19, 2017).

Yes you are right this is redundant. I believe if you put the initial year it means it continues up to now.

@rllola I do not see any evidence in the relevant Debian policy docs that listing a single year for the copyright implies a range whose end date is the present day. Given that the upstream Electrum (BTC) package doesn't list years for the "Electrum Team" copyright, I don't think we need to list years for the "Namecoin developers" or "Electrum Team" copyright, unless Debian complains about it.

So I am wondering because some commits are being cherry picked from upstream does the copyright still apply ? Otherwise I would put the range "2011-2017"...

The upstream devs still own the copyright on whatever commits we merge from them. Any commits we make that are derived from upstream commits are derivative works, and are (approximately) considered to be jointly copyrighted by both us and them.

Is there a reason that urllib3 is removed here? (If it's because Electrum-NMC doesn't actually include urllib3, then I guess that's fine, though it should be addressed upstream if it isn't already.)

I am not sure why it is has been removed. I have put it back. I have also put back the revealer license and the appropriate license copying.

For the rest I am not sure what the watch file does. I am going to look into the doc...

See the docs on the watch file.

JeremyRand avatar Dec 26 '20 21:12 JeremyRand

@rllola Looking good. More feedback:

https://github.com/rllola/electrum/blob/3de59091148b3af30b0709a494c882706851aa21/debian/copyright#L3

Please use https://www.namecoin.org/download/betas/; it appears that upstream doesn't use a Git repo for this line.

https://github.com/rllola/electrum/blob/3de59091148b3af30b0709a494c882706851aa21/debian/copyright#L9

There's a missing newline here compared to upstream (I think upstream is enforcing a line length limit here). Also the "Comment:" line from upstream is missing.

https://github.com/rllola/electrum/blob/3de59091148b3af30b0709a494c882706851aa21/debian/copyright#L12

Probably the upstream copyright holders from Debian (Vasudev and Tristan) should be listed here also, since your Debian packaging files are derived from upstream?

https://github.com/rllola/electrum/blob/3de59091148b3af30b0709a494c882706851aa21/debian/copyright#L11-L13

These lines have an unnecessary 1-space indent.

https://github.com/rllola/electrum/blob/3de59091148b3af30b0709a494c882706851aa21/debian/gpb.conf

This file's name is a typo, should be gbp.conf.

Would be great to get the signing-key.asc and watch files added. Docs are at http://sejnfjrq6szgca7v.onion/doc/debian-policy/ch-source.html#optional-upstream-source-location-debian-watch and http://pugljpwjhbiagkrn.onion/unstable/devscripts/uscan.1.en.html .

https://github.com/rllola/electrum/blob/3de59091148b3af30b0709a494c882706851aa21/debian/electrum-nmc.1#L1

First instance of electrum should be electrum-nmc.

https://github.com/rllola/electrum/blob/3de59091148b3af30b0709a494c882706851aa21/debian/electrum-nmc.1#L3

Ditto. Not sure if maybe the hyphen in electrum-nmc needs to be escaped with a backslash? Also use lowercase "namecoin" to match upstream.

https://github.com/rllola/electrum/blob/3de59091148b3af30b0709a494c882706851aa21/debian/electrum-nmc.1#L69

Maybe mention that the fork authors are "The Namecoin developers" in addition to the current credit for the unforked Bitcoin version?

JeremyRand avatar Jan 18 '21 19:01 JeremyRand

I have push new updates.

I didn't add the signing-key.asc which public key should I use ? I guess yours ?

rllola avatar Mar 20 '21 12:03 rllola

https://github.com/rllola/electrum/blob/36c86660df6c88b4c5aa6e4ebad4f3b459084ef7/debian/control#L73-L74

Since Electrum-NMC isn't Electrum, maybe this should be reworded to "Electrum-NMC is open source and is a fork of Electrum, which was first released in November 2011."

I didn't add the signing-key.asc which public key should I use ? I guess yours ?

Yes, Electrum-NMC releases are signed by my OpenPGP key labeled as "Primary" on https://www.namecoin.org/team/ . (It's the key I use for email as well.)

ACK on everything else; I can confirm that when the above 2 things are done, we're ready to submit it to Debian. @rllola Do you want me to reach out to the Debian people about getting it added, or do you want to do that?

JeremyRand avatar Apr 08 '21 06:04 JeremyRand

@rllola Do you want me to reach out to the Debian people about getting it added, or do you want to do that?

@rllola If you want to reach out to Debian, it looks like the right people to contact are the Debian Cryptocoin Team. They currently maintain the packages for Bitcoin Core, Electrum, Litecoin, and Monero. Their contact info is:

  • Wiki: https://wiki.debian.org/Teams/cryptocoin
  • GitLab: https://salsa.debian.org/cryptocoin-team/
  • Package tracker: https://tracker.debian.org/teams/cryptocoin/
  • Email: [email protected]
  • Quality Assurance: https://qa.debian.org/developer.php?login=team%2Bcryptocoin%40tracker.debian.org

I think email is probably the right way to contact them. If you email them, please CC me.

JeremyRand avatar Apr 08 '21 06:04 JeremyRand

@rllola I just did some QA testing of the package in a Debian Sid VM. In addition to the two minor issues I noted on April 8, two more minor changes needed.

  • In rules, the line that deletes a font file needs electrum/plugins replaced with electrum_nmc/electrum/plugins. (The package fails to build for me without this change.)
  • Once the package is built, it installs successfully and runs, but the IBD hangs. I'm pretty sure this is due to a connectivity bug that we fixed in 3.3.9. So, we should probably bump the version, as I doubt the Debian people will be happy if we submit a package that is unusable.

Building a later version has 2 changes:

  • Build-time dependency on pyqt5-dev-tools (not needed at run-time).
  • The script ./contrib/make_qt_forms needs to be run at build-time.

We should probably use 3.3.10, since it's identical in build process to 3.3.9 and has a few other bugfixes.

JeremyRand avatar Jul 12 '21 11:07 JeremyRand

I have created a new branch for 3.3.10 that includes the debian packaging files : https://github.com/rllola/electrum/tree/debian-3.3.10

I have tested building it using dpkg-buildpackage -b -rfakeroot -us -uc command installing the .deb on my ubuntu system. It is running for me. Let me know if you encounter any issues.

rllola avatar Jul 14 '21 15:07 rllola

@rllola So, I just realized that our source tarballs don't actually include contrib/make_qt_forms, thus we are violating Debian policy. I've filed https://github.com/namecoin/electrum-nmc/issues/292 to track that. Until that issue is fixed, these changes should be reverted:

  • Build-time dependency on pyqt5-dev-tools (not needed at run-time).

  • The script ./contrib/make_qt_forms needs to be run at build-time.

Apologies for not noticing that earlier.

The version string 3.3.10 in https://github.com/rllola/electrum/blob/370eb0669ec48b06000316cb3843d1eb3f6cb0c3/debian/changelog#L1 should be 3.3.10-0.1.

With the above changes, the package built for me in Debian Sid, and installing the package yielded a working Electrum-NMC.

Looks like these are still needed:

https://github.com/rllola/electrum/blob/36c86660df6c88b4c5aa6e4ebad4f3b459084ef7/debian/control#L73-L74

Since Electrum-NMC isn't Electrum, maybe this should be reworded to "Electrum-NMC is open source and is a fork of Electrum, which was first released in November 2011."

I didn't add the signing-key.asc which public key should I use ? I guess yours ?

Yes, Electrum-NMC releases are signed by my OpenPGP key labeled as "Primary" on https://www.namecoin.org/team/ . (It's the key I use for email as well.)

JeremyRand avatar Jul 15 '21 07:07 JeremyRand

@rllola How are things going on this? We haven't heard much from you for a little while. As this task is now somewhat behind schedule, @yanmaani and I will try to assist as our time permits (with NLnet paying us for the time we put in). If for whatever reason you would prefer not to have our assistance, please let us know. Cheers!

JeremyRand avatar Apr 04 '22 04:04 JeremyRand