You are not logged in.

#1 2017-11-27 04:06:49

mani.zaeim
Member
Registered: 2016-12-19
Posts: 25

Asking for Review on PKGBUILD - NodeJS electron base app

I am trying to create a PKGBUILD file for an appImage package, but I get really confuse. the developer provide sourceCode, .deb and AppImage for Linux, It is Electron based application. I am not Should Whats the best Approach for packaging, Should I use .deb or AppImage or SourceCode?
if I want to use AppImage I think I need to extract it first with " --appimage-extract " , and then I am not sure what should I do! should I use AppRun script?
I like to know how to package for AchLinux and I Would be really appreciated if anyone can help.

BTW I think it would be great if arch wiki can provide some documentation for electron app packaging.

Last edited by mani.zaeim (2017-11-29 02:13:37)

Offline

#2 2017-11-27 04:12:31

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: Asking for Review on PKGBUILD - NodeJS electron base app

AppImage packages would have to be a -bin package, since it doesn't build from source in the PKGBUILD. Since there is source code, you should use the developer's documented build process to build the software. If possible, see whether you can tell it to use the existing repository package for electron.

Last edited by eschwartz (2017-11-27 04:12:47)


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#3 2017-11-27 04:15:34

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: Asking for Review on PKGBUILD - NodeJS electron base app

What application is it?
Are there instructions for building it from source?

There's already a wiki page for Node.js applications.
https://wiki.archlinux.org/index.php/No … guidelines


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#4 2017-11-27 04:33:58

mani.zaeim
Member
Registered: 2016-12-19
Posts: 25

Re: Asking for Review on PKGBUILD - NodeJS electron base app

Eschwartz wrote:

AppImage packages would have to be a -bin package, since it doesn't build from source in the PKGBUILD. Since there is source code, you should use the developer's documented build process to build the software. If possible, see whether you can tell it to use the existing repository package for electron.

Thanks for replying, So I try to use source code, but there is not any documentation, may be its so obvious for JS developers smile

Offline

#5 2017-11-27 04:41:14

mani.zaeim
Member
Registered: 2016-12-19
Posts: 25

Re: Asking for Review on PKGBUILD - NodeJS electron base app

slithery wrote:

What application is it?
Are there instructions for building it from source?

There's already a wiki page for Node.js applications.
https://wiki.archlinux.org/index.php/No … guidelines

Thanks for the link, I did not know I have to use Node.JS. the application is Super-Productivity

Offline

#6 2017-11-27 05:00:28

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: Asking for Review on PKGBUILD - NodeJS electron base app

mani.zaeim wrote:

So I try to use source code, but there is not any documentation

It's right there on the page you just linked to, though it will need adapting slightly for a PKGBUILD.


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#7 2017-11-27 09:02:35

mani.zaeim
Member
Registered: 2016-12-19
Posts: 25

Re: Asking for Review on PKGBUILD - NodeJS electron base app

slithery wrote:
mani.zaeim wrote:

So I try to use source code, but there is not any documentation

It's right there on the page you just linked to, though it will need adapting slightly for a PKGBUILD.

Thanks guys, I was too blind big_smile

I created this PKGBUILD but I get an error

PKGBUILD file:

pkgname="superProductivity"
pkgver=1.5.2
pkgrel=1
epoch=1
pkgdesc="To Do List / Time Tracker with Jira Integration. Makes you super productive!"
arch=('x86_64')
url="http://www.super-productivity.com"
license=('MIT')
provides=('superProductivity')
options=(!strip)
makedepends=('unzip' 'npm')
source=("$pkgname-$pkgver-$arch.zip::https://github.com/johannesjo/super-productivity/archive/develop.zip")
md5sums=('d9302b74e8cc9c41d4891f5cdbe4fb17')
sha1sum=('1eeecea89e9797e70496daa38b22638372f03345')
sha256sum=('97aed788646c1bdee0f77d8d1803e188893f65b03975a2a4b95d5e5d5fb9d0f9')
sha512sum=('3401d1e351945bdf81a8bbd06af059fc612b87f4134d6a1a30f4bd44f27d7b1c2bb1eadb5ff34f0f0f3c8e445e50604dee43ac26b0aee55fee29f0eef62b3fb3')

package() {
    unzip "$pkgname-$pkgver-$arch.zip"
    cd "$srcdir/super-productivity-develop"
    npm install -g electron node-gyp gulp bower
    npm install && bower install
    gulp build
    install -Dm644 "app-src/img/icon_128x128.png" "$pkgdir/usr/share/icons/hicolor/128x128/apps/$pkgname.png"
    
    echo "[Desktop Entry]\nName=superProductivity\nComment=Personal Task Management App to help you with your daily struggle with JIRA etc.\nExec=AppRun\nTerminal=false\nType=Application\nIcon=superproductivity\nX-AppImage-Version=$pkgver\nCategories=Utility;" > $pkgname.desktop
    install -Dm644 "$pkgname".desktop "$pkgdir"/usr/share/applications/
}

and this is the Error:

npm WARN deprecated bower@1.8.2: ...psst! Your project can stop working at any moment because its dependencies can change. Prevent this by migrating to Yarn: https://bower.io/blog/2017/how-to-migrate-away-from-bower/
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated graceful-fs@1.2.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN checkPermissions Missing write access to /usr/lib/node_modules
npm ERR! path /usr/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/lib/node_modules'
npm ERR!  { Error: EACCES: permission denied, access '/usr/lib/node_modules'
npm ERR!   stack: 'Error: EACCES: permission denied, access \'/usr/lib/node_modules\'',
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/lib/node_modules' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     ~/.npm/_logs/2017-11-27T08_58_06_239Z-debug.log
==> ERROR: A failure occurred in package().
    Aborting...

log of the error file:

1196 silly install generateActionsToTake
1197 warn checkPermissions Missing write access to /usr/lib/node_modules
1198 verbose stack Error: EACCES: permission denied, access '/usr/lib/node_modules'
1199 verbose cwd ~/abs/superProductivity/src/super-productivity-develop
1200 verbose Linux 4.13.12-1-ARCH
1201 verbose argv "/usr/bin/node" "/usr/bin/npm" "install" "-g" "electron" "node-gyp" "gulp" "bower"
1202 verbose node v9.2.0
1203 verbose npm  v5.5.1
1204 error path /usr/lib/node_modules
1205 error code EACCES
1206 error errno -13
1207 error syscall access
1208 error Error: EACCES: permission denied, access '/usr/lib/node_modules'
1208 error  { Error: EACCES: permission denied, access '/usr/lib/node_modules'
1208 error   stack: 'Error: EACCES: permission denied, access \'/usr/lib/node_modules\'',
1208 error   errno: -13,
1208 error   code: 'EACCES',
1208 error   syscall: 'access',
1208 error   path: '/usr/lib/node_modules' }
1209 error Please try running this command again as root/Administrator.
1210 verbose exit [ -13, true ]

So I am not sure is there any problem with the source ?! shall I use .deb to package it?

Last edited by mani.zaeim (2017-11-27 09:03:05)

Offline

#8 2017-11-27 13:54:46

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,919

Re: Asking for Review on PKGBUILD - NodeJS electron base app

Your npm install line misses some needed options, check the example on archwiki nodejs package guidelines page.

Also electron, gulp and bower are present in arch repos.
try adding them as makedepends or depends and only use npm install for node-gyp .


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#9 2017-11-27 14:02:22

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: Asking for Review on PKGBUILD - NodeJS electron base app

gyp is also in the repos


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#10 2017-11-28 03:47:18

mani.zaeim
Member
Registered: 2016-12-19
Posts: 25

Re: Asking for Review on PKGBUILD - NodeJS electron base app

Lone_Wolf wrote:

Your npm install line misses some needed options, check the example on archwiki nodejs package guidelines page.

Also electron, gulp and bower are present in arch repos.
try adding them as makedepends or depends and only use npm install for node-gyp .

Thanks a lot

finally I use this to package it

pkgname="super-productivity"
pkgver=1.5.2
pkgrel=1
epoch=1
pkgdesc="To Do List / Time Tracker with Jira Integration. Makes you super productive!"
arch=('x86_64')
url="http://www.super-productivity.com"
license=('MIT')
provides=('super-productivity')
options=(!strip)
makedepends=('npm' 'electron' 'gyp-git' 'gulp' 'bower')
source=("https://github.com/johannesjo/super-productivity/archive/v$pkgver.tar.gz")
md5sums=('998485e4eeb3b7e1fbe54b64a79d28d0')

package() {
    tar -xvf "v${pkgver}.tar.gz"
    cd "${srcdir}/${pkgname}-${pkgver}"
    npm install -g --user root --prefix "${pkgdir}"/usr
    npm install --cache "${srcdir}/npm-cache"
    npm install && bower install --allow-root
    gulp build
    
    for size in 22 24 32 48 64 128 256 512; do
        install -Dm644 "app-src/img/icon_128x128.png" "${pkgdir}/usr/share/icons/hicolor/${size}x${size}/apps/${pkgname}.png"
    done
    
    printf "[Desktop Entry]\nName=super-productivity\nComment=Personal Task Management App to help you with your daily struggle with JIRA etc.\nExec=AppRun\nTerminal=false\nType=Application\nIcon=superproductivity\nX-AppImage-Version=${pkgver}\nCategories=Utility;" > ${pkgname}.desktop
    mkdir -p "${pkgdir}"/usr/share/applications/
    install -Dm644 "${pkgname}".desktop "${pkgdir}"/usr/share/applications/
    install -Dm644 "${srcdir}/${pkgname}-${pkgver}/LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
    install -d "${pkgdir}/opt/${pkgname}"
    install -d "${pkgdir}/usr/bin"
    cp -r "${srcdir}/${pkgname}-${pkgver}/"* "${pkgdir}/opt/${pkgname}" -R
}

Would be appreciated if anyone can get me a feedback on it. It seems the package is huge and It does not install.

Thanks again.

Last edited by mani.zaeim (2017-11-28 09:58:22)

Offline

#11 2017-11-28 11:09:41

x33a
Forum Fellow
Registered: 2009-08-15
Posts: 4,587

Re: Asking for Review on PKGBUILD - NodeJS electron base app

@mani.zaeim,

regarding your report: If you want to mark the thread as solved, you can do so by editing the thread title from the first post and adding [solved] to it.

Offline

#12 2017-11-28 13:35:41

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,919

Re: Asking for Review on PKGBUILD - NodeJS electron base app

- epoch is only used/needed in a few specific cases, remove that line

- the pkgdesc should not contain the name of the package, ditch the "Makes you super productive!" part

- a package always provides itself, you don't need that line

- What is the reason you use !strip   as option ?

- I've build against gyp from repos , is there a specific reason why you used aur gyp-git ?

- the upstream filename only uses a version as name, this is confusing and a source of conflict .
use the source=('filename::url') format to get a usable name .
$pkgname-v$pkgver.tar.gz works fine here and stays consistent with upstream "naming" of the files.

- remove the tar xvf line, makepkg will handle extraction of many compressed filetypes itself



the .desktop file created is meant for an appimage, but you're building from source now.
apprun won't work .

I have no xp with nodejs / npm pacakges, but try the following after building :
from inside the src folder, run npm start .

if that works, try doing the same after installing but from the opt/super-productivity folder.
Once you know how to start the program, you can create a script and/or  .desktop file to start it and add those to the package.

Last edited by Lone_Wolf (2017-11-28 13:37:22)


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#13 2017-11-29 02:14:28

mani.zaeim
Member
Registered: 2016-12-19
Posts: 25

Re: Asking for Review on PKGBUILD - NodeJS electron base app

Lone_Wolf wrote:

- epoch is only used/needed in a few specific cases, remove that line

- the pkgdesc should not contain the name of the package, ditch the "Makes you super productive!" part

- a package always provides itself, you don't need that line

- What is the reason you use !strip   as option ?

- I've build against gyp from repos , is there a specific reason why you used aur gyp-git ?

- the upstream filename only uses a version as name, this is confusing and a source of conflict .
use the source=('filename::url') format to get a usable name .
$pkgname-v$pkgver.tar.gz works fine here and stays consistent with upstream "naming" of the files.

- remove the tar xvf line, makepkg will handle extraction of many compressed filetypes itself



the .desktop file created is meant for an appimage, but you're building from source now.
apprun won't work .

I have no xp with nodejs / npm pacakges, but try the following after building :
from inside the src folder, run npm start .

if that works, try doing the same after installing but from the opt/super-productivity folder.
Once you know how to start the program, you can create a script and/or  .desktop file to start it and add those to the package.

I've made the changes, thanks alot.

Offline

Board footer

Powered by FluxBB