tis-nodejs
23.1.0-5
Node.js is an open-source, cross-platform, JavaScript runtime environment that executes JavaScript code outside a web browser
26101 downloads
See build result See VirusTotal scan
Description
- package : tis-nodejs
- name : Node.js
- version : 23.1.0-5
- categories : Development
- maintainer : WAPT Team,Tranquil IT,Jimmy PELÉ
- installed_size : 83446606
- editor : OpenJS Foundation
- licence : opensource_free,cpe:/a:mit:x11_license,wapt_public
- signature_date : 2024-10-29T22:19:21.000000
- size : 30.43 Mo
- locale : all
- target_os : linux
- impacted_process : node
- architecture : x64
- Homepage : https://nodejs.org/
control
package : tis-nodejs
version : 23.1.0-5
architecture : x64
section : base
priority : optional
name : Node.js
categories : Development
maintainer : WAPT Team,Tranquil IT,Jimmy PELÉ
description : Node.js is an open-source, cross-platform, JavaScript runtime environment that executes JavaScript code outside a web browser
depends :
conflicts :
maturity : PROD
locale : all
target_os : linux
min_wapt_version : 2.3
sources : https://nodejs.org/en/download/current/
installed_size : 83446606
impacted_process : node
description_fr : Node.js est un environnement d'exécution JavaScript ouvert, multiplateforme, qui exécute du code JavaScript en dehors d'un navigateur web
description_pl : Node.js to open-source'owe, wieloplatformowe środowisko uruchomieniowe JavaScript, które wykonuje kod JavaScript poza przeglądarką internetową
description_de : Node.js ist eine quelloffene, plattformübergreifende JavaScript-Laufzeitumgebung, die JavaScript-Code außerhalb eines Webbrowsers ausführt
description_es : Node.js es un entorno de ejecución de JavaScript de código abierto y multiplataforma que ejecuta código JavaScript fuera de un navegador web
description_pt : Node.js é um ambiente de código aberto, multi-plataforma, JavaScript runtime que executa o código JavaScript fora de um navegador web
description_it : Node.js è un ambiente runtime JavaScript open-source e multipiattaforma che esegue codice JavaScript al di fuori di un browser web
description_nl : Node.js is een open-source, cross-platform, JavaScript runtime omgeving die JavaScript code uitvoert buiten een web browser
description_ru : Node.js - это кроссплатформенная среда выполнения JavaScript с открытым исходным кодом, которая выполняет код JavaScript вне веб-браузера
audit_schedule :
editor : OpenJS Foundation
keywords : javascript,js,node,open,code
licence : opensource_free,cpe:/a:mit:x11_license,wapt_public
homepage : https://nodejs.org/
package_uuid : d4366db9-df01-4d79-bff1-ba92416176b2
valid_from :
valid_until :
forced_install_on :
changelog : https://github.com/nodejs/node/blob/master/CHANGELOG.md
min_os_version : 6.3
max_os_version :
icon_sha256sum : 77ad7394671d64dc6a1045c837364be28fabdc7dfa7299d29b76fe1c4c2d7769
signer : Tranquil IT
signer_fingerprint: 8c5127a75392be9cc9afd0dbae1222a673072c308c14d88ab246e23832e8c6bb
signature_date : 2024-10-29T22:19:21.000000
signed_attributes : package,version,architecture,section,priority,name,categories,maintainer,description,depends,conflicts,maturity,locale,target_os,min_wapt_version,sources,installed_size,impacted_process,description_fr,description_pl,description_de,description_es,description_pt,description_it,description_nl,description_ru,audit_schedule,editor,keywords,licence,homepage,package_uuid,valid_from,valid_until,forced_install_on,changelog,min_os_version,max_os_version,icon_sha256sum,signer,signer_fingerprint,signature_date,signed_attributes
signature : GTwNrMoy2yCXGzN+L2vueV77U5bzwGhXuwHL0kLV1JOe5Yr/CHOs30pHFvBSbcaRI9sWMzw6DzfazZ0H/ZIDwDVlyEBg8KqRue3WeYO68UgQkZ/L5LDGB96dyVwkuLXk+1yVAgdXm0jbOhd/TiBr4ip2JxK4VHhP913cv1OXxnYmgXgyeANOBUsVZOyj2g2poHQYxooG5ZlyExJoJkdWLYm3BMSc0bGfPnzE4oabHNxv8I2zf48kNu9cjNZPibx2x8YTiCiujMO6Qq+iXl4yWu6dl62r371VPhdQzANxiJ9yuINjnKxX0RDpMDbRGUD2BP9dm13f8mPs/iTG6YpX+w==
Setup.py
# -*- coding: utf-8 -*-
from setuphelpers import *
dir_name = "nodejs"
app_dir = "/opt/nodejs"
usr_local_bin = "/usr/local/bin"
def install():
zip_name = glob.glob("node-v*-linux-x64.tar.xz")[0]
print(f"Extracting: {zip_name}")
unzipped_dir = makepath(os.getcwd(), zip_name.split(".tar.xz")[0])
if isdir(unzipped_dir):
remove_tree(unzipped_dir)
if isdir(dir_name):
remove_tree(dir_name)
run(f"tar -x -f {zip_name} -C .")
# Renaming unzipped_dir
print(f"Renaming: {unzipped_dir} to: {dir_name}")
run(f"mv {unzipped_dir} {dir_name}") # mv command in linux can be used to rename files or directories
# Moving unzipped_dir to app_dir
if isdir(app_dir):
remove_tree(app_dir)
mkdirs(app_dir)
print(f"Moving: {dir_name} to: {app_dir}")
move_directory(dir_name, app_dir)
# Creating symbolic links from app_dir/bin to /usr/local/bin
for binary in glob.glob(makepath(app_dir, "bin", "*")):
symlink_path = makepath(usr_local_bin, binary.split("/")[-1])
if isfile(symlink_path):
remove_file(symlink_path)
print(f"Creating symbolic link of: {binary} to: {usr_local_bin}")
run(f"ln -s {binary} {symlink_path}")
def audit():
audit_status = "OK"
# Checking if the application directory is here
if not isdir(app_dir) or dir_is_empty(app_dir):
print("ERROR: Application directory is not present")
audit_status = "ERROR"
# Checking symbolic links located in /usr/local/bin
symlink_list = ["corepack", "node", "npm", "npx"]
for symlink in symlink_list:
symlink_path = makepath(usr_local_bin, symlink)
if not os.path.islink(symlink_path):
print(f"ERROR: Symbolic link: {symlink_path} is not present")
audit_status = "ERROR"
return audit_status
def uninstall():
# Removing symbolic links located in /usr/local/bin
for binary in glob.glob(makepath(app_dir, "bin", "*")):
symlink_path = makepath(usr_local_bin, binary.split("/")[-1])
if isfile(symlink_path):
print(f"Removing symbolic link: {symlink_path}")
remove_file(symlink_path)
# Removing app directory
if isdir(app_dir):
print(f"Removing application directory: {app_dir}")
remove_tree(app_dir)
def move_directory(source, destination):
"""
Moves a directory safely, avoiding unnecessary subfolders.
Args:
source (str): The path of the directory to move.
destination (str): The destination path where the directory will be moved to.
Returns:
bool: True if the directory was successfully moved, False otherwise.
"""
try:
if not os.path.exists(destination):
os.makedirs(destination)
for item in os.listdir(source):
item_path = os.path.join(source, item)
if os.path.isfile(item_path):
shutil.move(item_path, destination)
if os.path.islink(item_path):
shutil.move(item_path, destination)
elif os.path.isdir(item_path):
new_destination = os.path.join(destination, item)
shutil.move(item_path, new_destination)
os.rmdir(source)
return True
except Exception as e:
print(f"ERROR: {e}")
return False
update_package.py
# -*- coding: utf-8 -*-
from setuphelpers import *
from setupdevhelpers import *
import bs4 as BeautifulSoup
from urllib.parse import urlparse, urljoin
def update_package():
# Declaring local variables
package_updated = False
proxies = get_proxies()
if not proxies:
proxies = get_proxies_from_wapt_console()
url = "https://nodejs.org/dist/latest/"
download_dict = {
"windows-arm64": "-arm64.msi",
"windows-x64": "-x64.msi",
"windows-x86": "-x86.msi",
"windows-all": "-x86.msi",
"darwin-x64": "-darwin-x64.tar.xz",
"darwin-arm64": "-darwin-arm64.tar.xz",
"linux-x64": "-linux-x64.tar.xz",
"linux-arm64": "-linux-arm64.tar.xz ",
}
# Getting latest version information from official sources
print("URL used is: %s" % url)
binaries_dict = bs_index_of_to_dict(url, proxies=proxies)
for to_download in binaries_dict.keys():
filename = to_download
if download_dict[control.target_os + "-" + ensure_list(control.architecture)[0]] in filename:
download_url = binaries_dict[to_download]
latest_bin = filename
version = filename.split("-")[1].replace("v", "")
# Downloading latest binaries
print("Latest %s version is: %s" % (control.name, version))
print("Download URL is: %s" % download_url)
if not isfile(latest_bin):
print("Downloading: %s" % latest_bin)
wget(download_url, latest_bin, proxies=proxies)
else:
print("Binary is present: %s" % latest_bin)
# Deleting outdated binaries
remove_outdated_binaries(latest_bin)
# arch_list = ensure_list(control.architecture)
# remove_outdated_binaries(version, filename_contains=("x64" if "x64" in arch_list else "x86" if "x86" in arch_list else []))
# Checking version from file
if get_os_name() == "Windows" and "windows" in control.target_os.lower():
version_from_file = get_version_from_binary(latest_bin)
if Version(version_from_file, 4) == Version(version, 4):
print(f"INFO: Binary file version ({version_from_file}) corresponds to online version ({version})")
else:
error(f"ERROR: Binary file version ({version_from_file}) do NOT corresponds to online version ({version})")
# Changing version of the package
if Version(version, 4) > Version(control.get_software_version(), 4):
print("Software version updated (from: %s to: %s)" % (control.get_software_version(), Version(version)))
package_updated = True
else:
print("Software version up-to-date (%s)" % Version(version))
control.set_software_version(version)
control.save_control_to_wapt()
# Validating or not update-package-sources
return package_updated
# # Changing version of the package and validating update-package-sources
# return complete_control_version(control, version)
def bs_index_of_to_dict(url, **kwargs):
r"""Parse html "Index of" web page with BeautifulSoup and get a dict of the result
Args:
url (str): url of the web page to parse
Return:
result: a dict of the index URLs
"""
result = {}
for elem in bs_find_all(url, "a", "href"):
if not "://" in elem["href"]:
# absolute_link = urljoin(url, url + "/" + elem["href"] if not url.endswith("/") else url + elem["href"])
absolute_link = url + "/" + elem["href"] if not url.endswith("/") else url + elem["href"]
else:
absolute_link = elem["href"]
key = elem.text
if key.endswith("..>"): # if key.endswith("..>"):
key = elem["href"]
result[key] = absolute_link
return result
def is_url(x):
try:
result = urlparse(x)
return all([result.scheme, result.netloc])
except:
return False
def bs_find_all(url, element, attribute=None, value=None, user_agent=None, proxies=None, features="html.parser", **kwargs):
"""
Parse an HTML or XML web page with BeautifulSoup and retrieve a list of all matching results.
Args:
url (str): URL of the web page or string to parse.
element (str): Searched element.
attribute (str): Selected attribute of the element.
value (str): Value of the selected attribute.
user_agent (str): Specify a user-agent if needed.
proxies (dict): Specify proxies if needed.
features (str): BeautifulSoup feature to use.
**kwargs: Additional parameters for the requests library.
Returns:
list: List of bs4.element.Tag objects representing the matching elements.
Examples:
>>> bs_find_all('https://www.w3.org/', 'a', 'title', 'Open Web Platform testing')[0]['href']
'https://web-platform-tests.org/'
>>> bs_find_all('https://www.w3.org/', 'span', 'class', 'alt-logo')[0].string
'W3C'
.. versionadded:: 2.0
.. versionchanged:: 2.5
Function can now parse string content of a page or reparse a "bs_result". It is now possible to parse a specific attribute.
"""
url = str(url)
if is_url(url):
if user_agent:
page = requests.get(url, proxies=proxies, headers={"User-Agent": user_agent}, **kwargs).text
else:
page = requests.get(url, proxies=proxies, **kwargs).text
else:
page = url
soup = BeautifulSoup.BeautifulSoup(page, features=features)
if value:
return soup.find_all(element, {attribute: value})
elif attribute:
return soup.find_all(element, attrs={attribute: True})
else:
return soup.find_all(element)
38d056ab130f7bf7c481c12636a4e9959de36561d3dfcbe54c6e3571bc0c1dc3 : WAPT/certificate.crt
30f12a6e50a74666fc29492c1bb3fad465b8c845cb9b2407c96276a44b4b9673 : WAPT/control
77ad7394671d64dc6a1045c837364be28fabdc7dfa7299d29b76fe1c4c2d7769 : WAPT/icon.png
06644e92764e760d5ea276e4f8dd671513186be858db4c27fa0985769b9fcc18 : luti.json
ccacff4f32e3c3729f5094d20e4089a16a3b8f1381e9730b19f1c16f7cf64da9 : node-v23.1.0-linux-x64.tar.xz
57a0be22e5894ca5481c6350463da5665d547cd3296e3bd38821b0239a363de7 : setup.py
3724b60c824a9c5639c512be647620d8db0f2314641fae7d991fb4f94710d870 : update_package.py