tomeshnet / prototype-cjdns-pi

Prototype system for mesh networks on single board computers
https://chat.tomesh.net/#/room/#software:tomesh.net
GNU General Public License v3.0
218 stars 42 forks source link

Patchfoo fix #398

Closed makew0rld closed 5 years ago

makew0rld commented 5 years ago

As I noticed here, Patchfoo can no longer be downloaded from Github, and shouldn't be either, even though there is a commit history.

Previously, Patchfoo would be downloaded from Github and refs to git-ssb would be removed, so that difficulty of installing that wouldn't be needed. Looking at the newer version of Patchfoo, it uses git-ssb a lot for displaying those kinds of messages, and that part of it can't simply be removed. For example, here's all the times git is mentioned in the Patchfoo source:

package.json
35:    "ssb-git": "^1.1.0",
48:  "homepage": "https://git.scuttlebot.io/%25YAg1hicat%2B2GELjE2QJzDwlAWcx0ML%2B1sXEdsWwvdt8%3D.sha256",
50:    "type": "git",

README.md
15:- Render core ssb message types, git-ssb message types, and raw messages.
23:Find [this guide](%VaSj08AbdhIa4itK4z8Z91G80o2h5OhRLCEEO6MhAcU=.sha256) [on github](https://github.com/noffle/sailing-patchfoo) or [on
24:SSB](http://git.scuttlebot.io/%25VaSj08AbdhIa4itK4z8Z91G80o2h5OhRLCEEO6MhAcU%3D.sha256).
30:- [git-ssb][]
43:git clone ssb://%YAg1hicat+2GELjE2QJzDwlAWcx0ML+1sXEdsWwvdt8=.sha256 patchfoo
53:git clone ssb://%YAg1hicat+2GELjE2QJzDwlAWcx0ML+1sXEdsWwvdt8=.sha256 patchfoo
144:[git-ssb]: %n92DiQh7ietE+R+X/I403LQoyf2DtR3WQfCkDKlheQU=.sha256

lib/render.js
406:Render.prototype.gitCommitBody = function (body) {

doc/install-guide.html
5:<title>ssb-npm + git-ssb + patchfoo install</title>
13:<h2>Installing ssb-npm + git-ssb + patchfoo</h2>
44:<h3>Install git-ssb</h3>
46:ssb-npm install -g git-ssb@2.6.1 \
54:git clone ssb://%YAg1hicat+2GELjE2QJzDwlAWcx0ML+1sXEdsWwvdt8=.sha256 patchfoo
64:git clone ssb://%YAg1hicat+2GELjE2QJzDwlAWcx0ML+1sXEdsWwvdt8=.sha256 patchfoo

lib/app.js
15:var Git = require('ssb-git')
88:  this.git = new Git(this.sbot, this.config)
1198:  // get line comments for a git-update message and git object id.
1200:  // but we have message id and git object hash.
1201:  // look up the git object hash for each line-comment
1202:  // to verify that it is for the git object file we want
1235:      self.git.getObjectAtPath({
1340:  var tmpPath = path.join(os.tmpdir(), '.git_vtag_tmp' + Math.random().toString('36'))
1341:  // use a temp file to work around https://github.com/nodejs/node/issues/13542
1351:    self.git.extractSignature(obj, function (err, parts) {

lib/render-msg.js
272:    case 'git-repo': return this.gitRepo(cb)
273:    case 'git-update': return this.gitUpdate(cb)
274:    case 'pull-request': return this.gitPullRequest(cb)
833:RenderMsg.prototype.gitRepo = function (cb) {
842:      'git clone ',
853:RenderMsg.prototype.gitUpdate = function (cb) {
866:      self.wrap(h('div.ssb-git-update',
867:        'git push ', a, ' ',
872:          var path = id && ('/git/' + type + '/' + encodeURIComponent(id)
883:          var path = '/git/commit/' + encodeURIComponent(commit.sha1)
888:            self.render.gitCommitBody(commit.body)
893:          var path = '/git/tag/' + encodeURIComponent(tag.sha1)
902:            tag.body ? self.render.gitCommitBody(tag.body) : ''
915:RenderMsg.prototype.gitPullRequest = function (cb) {
1357:function expandDigitToSpaces(n) {
1362:  return line.replace(/\d/g, expandDigitToSpaces).split('')
1891:          href: self.toUrl('/git/commit/' + self.c.commitId + '?msg=' + encodeURIComponent(self.c.updateId))
1894:          href: self.toUrl('/git/line-comment/' +

lib/serve.js
453:    case '/git': return this.git(m[2])
1987:Serve.prototype.git = function (url) {
1990:    case 'object': return this.gitObject(m[2])
1991:    case 'commit': return this.gitCommit(m[2])
1992:    case 'tag': return this.gitTag(m[2])
1993:    case 'tree': return this.gitTree(m[2])
1994:    case 'blob': return this.gitBlob(m[2])
1995:    case 'raw': return this.gitRaw(m[2])
1996:    case 'diff': return this.gitDiff(m[2])
1997:    case 'signature': return this.gitSignature(m[2])
1998:    case 'line-comment': return this.gitLineComment(m[2])
2003:Serve.prototype.gitRaw = function (rev) {
2007:      pull.once('\'' + rev + '\' is not a git object id'),
2013:    self.wrapPage('git object ' + rev),
2017:  self.app.git.openObject({
2028:      self.app.git.readObject(obj),
2042:Serve.prototype.gitAuthorLink = function (author) {
2056:Serve.prototype.gitObject = function (rev) {
2060:      ph('div.error', 'rev is not a git object id'),
2061:      self.wrapPage('git'),
2067:    self.wrapPage('git object ' + rev),
2072:    return self.app.git.getObjectMsg({
2080:        self.wrapPage('git object ' + rev),
2083:      var path = '/git/object/' + rev
2089:  self.app.git.openObject({
2097:      self.wrapPage('git object ' + rev),
2100:    self.app.git.statObject(obj, function (err, stat) {
2103:        self.wrapPage('git object ' + rev),
2106:      var path = '/git/' + stat.type + '/' + rev
2113:Serve.prototype.gitSignature = function (id) {
2117:      ph('div.error', 'not a git object id'),
2118:      self.wrapPage('git'),
2124:    self.wrapPage('git signature for ' + id),
2128:  self.app.git.openObject({
2137:      var objPath = '/git/object/' + id + '?msg=' + encodeURIComponent(obj.msg.key)
2157:        self.wrapPage('git signature for ' + id),
2168:      self.wrapPage('git signature for ' + id),
2174:Serve.prototype.gitCommit = function (rev) {
2178:      ph('div.error', 'rev is not a git object id'),
2179:      self.wrapPage('git'),
2185:    self.wrapPage('git commit ' + rev),
2190:    return self.app.git.getObjectMsg({
2198:        self.wrapPage('git commit ' + rev),
2201:      var path = '/git/commit/' + rev
2207:  self.app.git.openObject({
2216:      self.wrapPage('git commit ' + rev),
2220:    self.app.git.getCommit(obj, function (err, commit) {
2226:        self.wrapPage('git commit ' + rev),
2241:              self.gitAuthorLink(commit.committer),
2248:              self.gitAuthorLink(commit.author),
2256:              self.gitObjectLinks(obj.msg.key, 'commit')
2260:              self.gitObjectLinks(obj.msg.key, 'tree')
2264:                '/git/signature/' + rev + '?msg=' + encodeURIComponent(self.query.msg)
2269:               self.app.render.gitCommitBody(commit.body)).outerHTML,
2272:              self.app.git.readCommitChanges(commit),
2280:                      self.app.render.toUrl('/git/blob/'
2288:                      self.app.render.toUrl('/git/diff/'
2306:        self.wrapPage('git commit ' + rev),
2313:Serve.prototype.gitTag = function (rev) {
2317:      ph('div.error', 'rev is not a git object id'),
2318:      self.wrapPage('git'),
2324:    self.wrapPage('git tag ' + rev),
2329:    return self.app.git.getObjectMsg({
2337:        self.wrapPage('git tag ' + rev),
2340:      var path = '/git/tag/' + rev
2346:  self.app.git.openObject({
2355:      self.wrapPage('git tag ' + rev),
2360:    self.app.git.getTag(obj, function (err, tag) {
2362:        var path = '/git/commit/' + rev
2371:        self.wrapPage('git tag ' + rev),
2386:              self.gitAuthorLink(tag.tagger),
2395:              self.gitObjectLinks(obj.msg.key, tag.type)
2400:                '/git/signature/' + rev + '?msg=' + encodeURIComponent(self.query.msg)
2407:        self.wrapPage('git tag ' + rev),
2414:Serve.prototype.gitTree = function (rev) {
2418:      ph('div.error', 'rev is not a git object id'),
2419:      self.wrapPage('git'),
2425:    self.wrapPage('git tree ' + rev),
2429:  self.app.git.openObject({
2438:      self.wrapPage('git tree ' + rev),
2454:            self.app.git.readTreeFull(obj),
2463:              var path = '/git/' + item.type + '/' + item.hash
2489:      self.wrapPage('git tree ' + rev),
2495:Serve.prototype.gitBlob = function (rev) {
2499:      ph('div.error', 'rev is not a git object id'),
2500:      self.wrapPage('git'),
2506:    self.wrapPage('git object ' + rev),
2513:      self.wrapPage('git object ' + rev),
2517:    self.app.git.openObject({
2526:        self.wrapPage('git object ' + rev),
2540:            self.app.git.readObject(obj),
2543:              rawUrl: self.app.render.toUrl('/git/raw/' + rev
2549:        self.wrapPage('git blob ' + rev),
2556:Serve.prototype.gitDiff = function (revs) {
2561:    self.wrapPage('git diff'),
2567:    ph('div.error', 'rev 1 is not a git object id'),
2568:    self.wrapPage('git diff'),
2572:    ph('div.error', 'rev 2 is not a git object id'),
2573:    self.wrapPage('git diff'),
2579:    self.wrapPage('git diff'),
2586:  self.app.git.getObjectMsg({
2597:      self.wrapPage('git diff ' + revs),
2605:    var blob1Url = '/git/blob/' + rev1 +
2608:    var blob2Url = '/git/blob/' + rev2 +
2636:          self.app.git.openObject({
2640:          self.app.git.openObject({
2645:          self.app.git.guessCommitAndPath({
2656:            pull.collect(done())(self.app.git.readObject(obj1))
2657:            pull.collect(done())(self.app.git.readObject(obj2))
2664:              cb(null, self.gitDiffTable(diff, lineComments, {
2674:      self.wrapPage('git diff'),
2680:Serve.prototype.gitDiffTable = function (diff, lineComments, lineCommentInfo) {
2794:Serve.prototype.gitLineComment = function (path) {
2818:    self.app.git.diffFile({
2831:        path = '/git/blob/' + file.hash[1]
2837:        path = '/git/diff/' + file.hash[0] + '..' + file.hash[1]
2856:Serve.prototype.gitObjectLinks = function (headMsgId, type) {
2859:    self.app.git.getObjectMsg({
2870:      var path = '/git/' + type + '/' + id

So git-ssb will need to be installed. To install git-ssb, we also need to install ssb-npm, and ssb-npm-registry (also required directy by Patchfoo). All these installations need a connection to the SSB network during the installation, meaning that for us to install Patchfoo like this, ssb-server will already need to be installed and peered with a pub or two, and successfully synced everything.

This feels like a huge mess and a lot of work, so I made this issue before diving in. One solution might be to host the required blobs ourselves, so that an SSB network connection isn't required. But these blobs update and change all the time, and keeping track of them won't work very well and will just add another job for us.

makew0rld commented 5 years ago

At the moment I would suggest a removal of the module, because it does not install at all right now. I am not in favour of using a very old version on Github instead.

@darkdrgn2k Thoughts on everything above?

darkdrgn2k commented 5 years ago

Upstream patch no in PR to install correct Patchfoo install #400 not sure if it will work with version bump of Node.js

If you want to test it try git cherry-pick 107fae35f23363da38f7c5d0feadb5b0d9010190 before install

makew0rld commented 5 years ago

This has been hacked around because of #400, but still needs a real fix and Patchfoo update in the long run.

darkdrgn2k commented 5 years ago

but still needs a real fix and Patchfoo update in the long run.

don't hold your breath this is the same issue we had with git-ssb from the beggining.