commit 42208b5c35c79379b74bf4f5785b25b3194b7571d3cceb57ab703913bd2fe705 Author: Bruno Pitrus Date: Tue Sep 10 21:05:38 2024 +0000 - New upstream release 3.2.11 * complete rewrite of the program in Typescript * ensure symlinks do not write unexpectedly (gh#electron/asar#322) - Run test suite in %check OBS-URL: https://build.opensuse.org/package/show/devel:languages:nodejs/asar?expand=0&rev=26 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/asar.changes b/asar.changes new file mode 100644 index 0000000..b409931 --- /dev/null +++ b/asar.changes @@ -0,0 +1,74 @@ +------------------------------------------------------------------- +Tue Sep 10 20:20:43 UTC 2024 - Bruno Pitrus + +- New upstream release 3.2.11 + * complete rewrite of the program in Typescript + * ensure symlinks do not write unexpectedly (gh#electron/asar#322) +- Run test suite in %check + +------------------------------------------------------------------- +Sun May 5 15:36:24 UTC 2024 - Bruno Pitrus + +- New upstream release 3.2.10 + * Fix relative link error (gh#electron/asar#308) + +------------------------------------------------------------------- +Wed Mar 6 20:58:00 UTC 2024 - Bruno Pitrus + +- New upstream version 3.2.9 + * fix symlink pointing error in filesystem.insertLink + +------------------------------------------------------------------- +Wed Nov 8 06:12:12 UTC 2023 - Bruno Pitrus + +- New upstream version 3.2.8 + * better error message when extracting a file that doesn't exist in the archive + +------------------------------------------------------------------- +Wed Sep 27 04:34:29 UTC 2023 - Bruno Pitrus + +- New upstream version 3.2.7 + * ensure that files/folders whose names are properties of Object.prototype are packaged/extracted correctly + +------------------------------------------------------------------- +Tue Sep 26 09:13:12 UTC 2023 - Bruno Pitrus + +- New upstream version 3.2.6 + * Don't overwrite existing folders + +------------------------------------------------------------------- +Tue Sep 19 17:12:27 UTC 2023 - Bruno Pitrus + +- New upstream version 3.2.5 + * properly handle rejections on `createPackageWithOptions` + +------------------------------------------------------------------- +Tue Jan 17 21:50:31 UTC 2023 - Bruno Pitrus +- New upstream version 3.2.3 + * fix bad output on unknown CLI command + * update vendored dependencies + +------------------------------------------------------------------- +Fri Nov 4 18:10:42 UTC 2022 - Bruno Pitrus +- New upstream version 3.2.2 + * Fix allowing nested empty directories. +- New upstream version 3.2.1 + * Rename package to @electron/asar +- Correct bogus “0.0.0-development” version reported by the program. + +------------------------------------------------------------------- +Tue Aug 16 15:09:07 UTC 2022 - Bruno Pitrus +- New upstream version 3.2.0 + * give better hints when failing due to bad links +- Use github tarball and use yarn to download vendored dependencies per yarn.lock + +------------------------------------------------------------------- +Thu Mar 03 00:00:00 UTC 2022 - Bruno Pitrus +- Resurrect package and update to 3.1.0 +- Use local-npm-registry to install dependencies + +------------------------------------------------------------------- +Sun Feb 14 15:11:12 UTC 2016 - i@marguerite.su + +- initial version 0.9.1 + diff --git a/asar.spec b/asar.spec new file mode 100644 index 0000000..1f9a564 --- /dev/null +++ b/asar.spec @@ -0,0 +1,132 @@ +# +# spec file for package asar +# +# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# + + +Name: asar +Version: 3.2.11 +Release: 0 +Summary: Creating atom-shell (electron) app packages +License: MIT and ISC +Group: Development/Languages/NodeJS +Url: https://github.com/electron/asar +Source0: https://github.com/electron/asar/archive/refs/tags/v%{version}.tar.gz +# Created by prepare-vendor.sh +Source1: vendor.tar.zst +Source2: prepare_vendor.sh + +BuildArch: noarch + +BuildRequires: fdupes +BuildRequires: jq +BuildRequires: nodejs-packaging +%if 0%{?fedora} >= 37 +BuildRequires: nodejs-npm +%else +BuildRequires: npm +%endif +BuildRequires: typescript +BuildRequires: zstd + +%global __requires_exclude ^npm(.*)$ +Provides: nodejs-asar = %{version} +%description +Asar is a simple extensive archive format, it works like tar +that concatenates all files together without compression, while +having random access support. + + +%prep +%autosetup -p1 -a 1 +# Use system typescript for building +rm -rf node_modules/typescript +rm -v node_modules/.bin/ts{c,server} + +%build +export ELECTRON_SKIP_BINARY_DOWNLOAD=1 +npm rebuild --verbose --foreground-scripts +# tsc may return a non-zero exit code due to type warnings despite actually succesfully compiling the code. +# If it fails to compile, it will be catched anyway in #check. +tsc --removeComments --sourceMap false || true + +%install +mkdir -pv %{buildroot}%{nodejs_sitelib}/@electron +mkdir -pv %{buildroot}%{_bindir} +cp -lr . %{buildroot}%{nodejs_sitelib}/@electron/asar +ln -srv %{buildroot}%{nodejs_sitelib}/@electron/asar/bin/asar.js %{buildroot}%{_bindir}/asar +# symlink old package name +ln -srv %{buildroot}%{nodejs_sitelib}/{@electron/,}asar +#fix shebang +sed -i '1s/env //' %{buildroot}%{nodejs_sitelib}/@electron/asar/bin/asar.js +cd %{buildroot}%{nodejs_sitelib}/asar + +# Correct bogus version in package.json +jq -cj '.version="%{version}"' package.json > new + +#remove devdependencies +jq -cj 'del(.devDependencies)' package.json > tmp +mv -v tmp package.json +npm prune --omit=dev --verbose --ignore-scripts + +mv -v new package.json + + +#Remove development garbage +find -name example -print0 |xargs -r0 -- rm -rvf +find -name test -print0 |xargs -r0 -- rm -rvf +find -name typings -print0 |xargs -r0 -- rm -rvf +find -name @types -print0 |xargs -r0 -- rm -rvf +find -name .github -print0 |xargs -r0 -- rm -rvf +find -name .circleci -print0 |xargs -r0 -- rm -rvf +find -name '*.md' -type f -print -delete +find -name '*.markdown' -type f -print -delete +find -name '*.ts' -type f -print -delete +find -name '.*.yml' -type f -print -delete +find -name '.*ignore' -type f -print -delete +find -name 'snapcraft*' -type f -print -delete +find -name '.git*' -type f -print -delete +find -name yarn.lock -type f -print -delete +find -name '.yarn*' -type f -print -delete +find -name '*package-lock.json' -type f -print -delete +find -name '.prettierrc*' -type f -print -delete +find -name '.releaserc*' -type f -print -delete +find -name tsconfig.json -type f -print -delete + +# Remove empty directories +find . -type d -empty -print -delete + +%fdupes %{buildroot} + +%check +pushd %{buildroot}%{nodejs_sitelib}/asar +# https://docs.fedoraproject.org/en-US/packaging-guidelines/Node.js/#_build_testing_in_check +%{__nodejs} -e 'require("./")' + +#check that the executable starts +./bin/asar.js -h +popd + +#the actual test suite +npx mocha -- --reporter spec --timeout 10000 + +%files +%defattr(-,root,root) +%doc CHANGELOG.md README.md +%license LICENSE.md +%{_bindir}/asar +%{nodejs_sitelib} + +%changelog diff --git a/prepare_vendor.sh b/prepare_vendor.sh new file mode 100644 index 0000000..6bbe806 --- /dev/null +++ b/prepare_vendor.sh @@ -0,0 +1,77 @@ +#!/bin/bash -eux + +ASAR_PKGDIR="$(pwd)" +ASAR_PKGVERSION=$(<./*.spec grep ^Version | sed -e 's/Version:[ ]*//g') +ASAR_URL="https://github.com/electron/asar/archive/refs/tags/v${ASAR_PKGVERSION}.tar.gz" +ASAR_TARBALL=v${ASAR_PKGVERSION}.tar.gz +ASAR_TMPDIR=$(mktemp --tmpdir -d asar-XXXXXXXX) +ASAR_PATH="$ASAR_TMPDIR/asar-$ASAR_PKGVERSION" + + + +echo "VERSION: $ASAR_PKGVERSION" +echo "PATH: $ASAR_PATH" + +cleanup_tmpdir() +{ + popd 2> /dev/null || exit 1 + rm -rf "$ASAR_TMPDIR" +} +trap cleanup_tmpdir SIGINT + +cleanup_and_exit() +{ + cleanup_tmpdir + if test "$1" = 0 -o -z "$1"; then + exit 0 + else + exit "$1" + fi +} + +if [ ! -w "$ASAR_TARBALL" ]; then + wget "$ASAR_URL" +fi + +tar -xf "$ASAR_TARBALL" -C "$ASAR_TMPDIR" + +pushd "$ASAR_PATH" || cleanup_and_exit 1 + + + +echo ">>>>>> Install npm modules" +yarn install --frozen-lockfile --ignore-engines --ignore-platform --ignore-scripts --link-duplicates +ret=$? +if [ $ret -ne 0 ]; then + echo "ERROR: yarn install failed" + cleanup_and_exit 1 +fi + +echo ">>>>>> Cleanup object files" +find node_modules/ -name "*.node" -print -delete +find node_modules/ -name "*.wasm" -print -delete +find node_modules/ -name "*.jar" -print -delete +find node_modules/ -name "*.dll" -print -delete +find node_modules/ -name "*.exe" -print -delete +find node_modules/ -name "*.dylib" -print -delete +find node_modules/ -name "*.so" -print -delete +find node_modules/ -name "*.o" -print -delete +find node_modules/ -name "*.a" -print -delete + + + +echo '>>>>>> Remove vendored binaries' +#We use sponge to avoid a race condition between find and rm +find . -type f| sponge |\ + xargs -P"$(nproc)" -- sh -c 'file "$@" | grep -v '\'': .*script'\'' | grep '\'': .*executable'\'' | tee /dev/stderr | sed '\''s/: .*//'\'' | xargs rm -fv' + +echo ">>>>>> Remove empty directories" +find . -type d -empty -print -delete + +echo ">>>>>> Package vendor files" +rm -f "${ASAR_PKGDIR}/vendor.tar.zst" +ZSTD_CLEVEL=19 ZSTD_NBTHREADS=$(nproc) tar --zstd --sort=name -vvScf "${ASAR_PKGDIR}/vendor.tar.zst" node_modules +if [ $? -ne 0 ]; then + cleanup_and_exit 1 +fi +echo "vendor $(du -sh "${ASAR_PKGDIR}/vendor.tar.zst")" diff --git a/v3.2.10.tar.gz b/v3.2.10.tar.gz new file mode 100644 index 0000000..43a73e6 --- /dev/null +++ b/v3.2.10.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b1756c31e8cd42257081b81726b1489a3923709e4cbf86f7d377fab3870b1e26 +size 83884 diff --git a/v3.2.11.tar.gz b/v3.2.11.tar.gz new file mode 100644 index 0000000..71c57d8 --- /dev/null +++ b/v3.2.11.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:17218fe9eb7b1840a306758653f7a5869f1182867cb6b29637393c5d670a8dd1 +size 49709 diff --git a/vendor.tar.zst b/vendor.tar.zst new file mode 100644 index 0000000..5c65147 --- /dev/null +++ b/vendor.tar.zst @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:868bba63e9833e2434238c004473e661597c93adbe1bc40d9c0cf1897808dd9c +size 5366272