building a nodejs package

Hi,
I tried my luck already in the packaging mailing list, but no one seems to have an idea…
I’m trying to build a webfrontend based on nodejs:
https://build.opensuse.org/package/show/Application:ERP:Tryton:3.8/tryton-sao

not sure yet - my first try with nodejs - if it runs and installs correctly, but at least it builds correct - for openSUSE 13.2.

For Leap and the rest of the world it fails, as %{nodejs_modulesdir} is not getting resolved properly:

261s] + umask 022
261s] + cd /home/abuild/rpmbuild/BUILD
261s] + cd package
261s] + mkdir -p ‘/home/abuild/rpmbuild/BUILDROOT/tryton-sao-3.8.1-7.1.x86_64%{nodejs_modulesdir}/tryton-sao’

262s] RPM build errors:
262s] File must begin with “/”: %{nodejs_modulesdir}/tryton-sao

Anybody an idea what it could be?

Hi
Look further back in the build log;


   94s] + mkdir -p '/home/abuild/rpmbuild/BUILDROOT/tryton-sao-3.8.1-7.1.x86_64%{nodejs_modulesdir}/tryton-sao'

So nodejs_modulesdir (is it really "/usr/lib/node_modules ?) is not defined (as it’s actually creating%{nodejs_modulesdir} as a directory name) , add to the project config is probably the easiest option, else in the spec file add;


%define  nodejs_modulesdir /what/ever/it/needs/to/be

Hi Malcolm,

sure we can define the
%define nodejs_modulesdir /usr/lib/node_modules
in the spec file…but…should that not be solved upstream? Why is it defined for 13.2, but not for 13.1, SLE or Leap?

Because 13.2 is newer than SLE and as Leap is based on SLE some packages are also older there. Apparently this macro was added after SLE was branched.

On Wed 16 Dec 2015 07:16:01 PM CST, DocB wrote:

Hi Malcolm,

sure we can define the
%define nodejs_modulesdir /usr/lib/node_modules
in the spec file…but…should that not be solved upstream? Why is it
defined for 13.2, but not for 13.1, SLE or Leap?

Hi
Missing build requires… for the nodejs_modulesdir macro.


-------------------------------------------------------------------
Thu Oct  9 15:06:49 UTC 2014 - jgleissner@suse.com

- removed macros.nodejs (moved to nodejs-packaging)

So add a conditional…


Cheers Malcolm °¿° LFCS, SUSE Knowledge Partner (Linux Counter #276890)
SUSE Linux Enterprise Desktop 12 | GNOME 3.10.1 | 3.12.51-52.31-default
If you find this post helpful and are logged into the web interface,
please show your appreciation and click on the star below… Thanks!

So, that worked, and the SLE based packages build. Problem comes now on installation:

  Problem: npm(bower) >= 1.4.1 benötigt von tryton-sao-3.8.1-11.1.noarch wird nirgends zur Verfügung gestellt


nodejs-npm is installed - is npm (bower) a different npm?

On Sat 19 Dec 2015 08:26:02 PM CST, DocB wrote:

malcolmlewis;2743234 Wrote:
> Hi
> Missing build requires… for the nodejs_modulesdir macro.
> >
Code:

> >
> -------------------------------------------------------------------
> Thu Oct 9 15:06:49 UTC 2014 - jgleissner@suse.com
>
> - removed macros.nodejs (moved to nodejs-packaging)
>

> >
> So add a conditional…
>

So, that worked, and the SLE based packages build. Problem comes now on
installation:

Code:

Problem: npm(bower) >= 1.4.1 benötigt von
tryton-sao-3.8.1-11.1.noarch wird nirgends zur Verfügung gestellt


nodejs-npm is installed - is npm (bower) a different npm?

Hi
Yes npm is it’s own package (well in Leap) and nodejs-npm (Bundled), so
I guess some conflict between releases needs to be sorted?


Cheers Malcolm °¿° LFCS, SUSE Knowledge Partner (Linux Counter #276890)
SUSE Linux Enterprise Desktop 12 SP1|GNOME 3.10.4|3.12.51-60.20-default
If you find this post helpful and are logged into the web interface,
please show your appreciation and click on the star below… Thanks!

nodejs is…odd. bower is a ‘plugin’ for npm. npm is available.
The tweak was to add a
Provides: npm(bower)
to let the build run through.
But then there is a problem with the content of
%{nodejs_sitelib}/*
Its empty. No idea why. In the installation from source, grunt runs afterwards and installs a lot of stuff. How to incorporate this in the build process? Analyzing this and adding each package as requirement? Seems that the nodejs stuff is not really made for packaging…

Hi
On your project page for the package, click on say the Leap build on the right, then it will show you all the built rpms, then click on the offending rpm. This will show a summary page of all the provides/requires for the package. Any of the missing ones will need adding if the package doesn’t detect them in the build process.