forked from pool/nodejs-common
Accepting request 899493 from devel:languages:nodejs
- Use libalternatives on TW by default - Add libalternatives support OBS-URL: https://build.opensuse.org/request/show/899493 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/nodejs-common?expand=0&rev=13
This commit is contained in:
commit
2a2fa76d52
15
node.c
15
node.c
@ -5,6 +5,10 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBALTERNATIVES_H
|
||||||
|
#include <libalternatives.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
const unsigned min_version = 4;
|
const unsigned min_version = 4;
|
||||||
const unsigned max_version = 42;
|
const unsigned max_version = 42;
|
||||||
const char *default_version = "-default";
|
const char *default_version = "-default";
|
||||||
@ -62,6 +66,17 @@ int main(int argc, char *argv[])
|
|||||||
printInvalidVersion(version);
|
printInvalidVersion(version);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBALTERNATIVES_H
|
||||||
|
// if we want default version and not using update-alternatives
|
||||||
|
if (version == default_version)
|
||||||
|
{
|
||||||
|
// should not return, and if it does, it probably means
|
||||||
|
// we should fall back to using node-default fallback.
|
||||||
|
libalts_exec_default(argv);
|
||||||
|
fputs("Falling back to using -default symlink.\n", stderr);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Generate our program path and check that we can execute it */
|
/* Generate our program path and check that we can execute it */
|
||||||
char *program_path, *program;
|
char *program_path, *program;
|
||||||
if (asprintf(&program, "%s%s", *bn, version) == -1 ||
|
if (asprintf(&program, "%s%s", *bn, version) == -1 ||
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Jun 10 10:27:58 UTC 2021 - Adam Majer <adam.majer@suse.de>
|
||||||
|
|
||||||
|
- Use libalternatives on TW by default
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon May 31 16:32:18 UTC 2021 - Adam Majer <adam.majer@suse.de>
|
||||||
|
|
||||||
|
- Add libalternatives support
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Thu May 6 12:50:02 UTC 2021 - Adam Majer <adam.majer@suse.de>
|
Thu May 6 12:50:02 UTC 2021 - Adam Majer <adam.majer@suse.de>
|
||||||
|
|
||||||
|
@ -28,6 +28,12 @@
|
|||||||
%define NODEJS_LTS 16
|
%define NODEJS_LTS 16
|
||||||
%define NODEJS_CURRENT 16
|
%define NODEJS_CURRENT 16
|
||||||
|
|
||||||
|
%if 0%{?suse_version} > 1500
|
||||||
|
%bcond_without libalternatives
|
||||||
|
%else
|
||||||
|
%bcond_with libalternatives
|
||||||
|
%endif
|
||||||
|
|
||||||
# SLE-12 variants
|
# SLE-12 variants
|
||||||
%if 0%{?suse_version} < 1500
|
%if 0%{?suse_version} < 1500
|
||||||
%define default_node_ver %NODEJS_LTS
|
%define default_node_ver %NODEJS_LTS
|
||||||
@ -64,7 +70,7 @@
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
Name: nodejs-common
|
Name: nodejs-common
|
||||||
Version: 4.1
|
Version: 5.0
|
||||||
Release: 0
|
Release: 0
|
||||||
Summary: Common files for the NodeJS ecosystem
|
Summary: Common files for the NodeJS ecosystem
|
||||||
License: MIT
|
License: MIT
|
||||||
@ -78,6 +84,11 @@ Conflicts: nodejs6 < 6.11.1
|
|||||||
Conflicts: nodejs7 < 7.10.1
|
Conflicts: nodejs7 < 7.10.1
|
||||||
Conflicts: nodejs8 < 8.1.4
|
Conflicts: nodejs8 < 8.1.4
|
||||||
BuildRequires: gcc
|
BuildRequires: gcc
|
||||||
|
%if %{with libalternatives}
|
||||||
|
BuildRequires: libalternatives-devel
|
||||||
|
%define libalternatives_cflags -DHAVE_LIBALTERNATIVES_H
|
||||||
|
%define libalternatives_lflags -lalternatives
|
||||||
|
%endif
|
||||||
|
|
||||||
%description
|
%description
|
||||||
Common NodeJS files that allow recursive invocation of Node executable
|
Common NodeJS files that allow recursive invocation of Node executable
|
||||||
@ -120,7 +131,7 @@ the current architecture and codestream.
|
|||||||
%prep
|
%prep
|
||||||
%build
|
%build
|
||||||
cp %{S:2} .
|
cp %{S:2} .
|
||||||
gcc ${RPM_OPT_FLAGS} -o node %{S:1}
|
gcc ${RPM_OPT_FLAGS} %?libalternatives_cflags -o node %{S:1} %?libalternatives_lflags
|
||||||
|
|
||||||
echo "Default Node version: " %{default_node_ver}
|
echo "Default Node version: " %{default_node_ver}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user