On 01/08/14 21:36, T.C. Hollingsworth wrote:
On Wed, Jul 30, 2014 at 3:23 AM, Tom Hughes <[email protected]> wrote:
Rather than packing each one individually, and in the spirit of packaging
from source, should we in fact just have one SRPM which builds all the RPMs
from source using lodash-cli?
Makes sense to me. :-)
So I've knocked up the attached patch which actually extends the
existing nodejs-node-lodash spec file using some lua magic to generate
the separate modules as well as the existing nodejs-lodash-node module.
The alternative is to create a separate srpm, but there isn't really a
source to base it on other than the list of modules to build?
The package.json files it produces aren't quite the same as the
published ones for the modules. I assume the differences are changes
made by npm when publishing? Biggest issue is probably that the private
flag is set, which means the auto-provide doesn't happen and I have to
add it manually instead.
What do people think about this approach?
Tom
--
Tom Hughes ([email protected])
http://compton.nu/
diff --git a/nodejs-lodash-node-functions.txt b/nodejs-lodash-node-functions.txt
new file mode 100644
index 0000000..e142bca
--- /dev/null
+++ b/nodejs-lodash-node-functions.txt
@@ -0,0 +1,162 @@
+after
+_arraypool
+assign
+at
+_basebind
+_baseclone
+_basecreate
+_basecreatecallback
+_basecreatewrapper
+_basedifference
+_baseflatten
+_baseindexof
+_baseisequal
+_basemerge
+_baserandom
+_baseuniq
+bind
+bindall
+bindkey
+_cacheindexof
+_cachepush
+_charatcallback
+clone
+clonedeep
+compact
+_compareascending
+compose
+constant
+contains
+countby
+create
+_createaggregator
+_createcache
+createcallback
+_createwrapper
+curry
+debounce
+defaults
+defer
+delay
+difference
+escape
+_escapehtmlchar
+_escapestringchar
+every
+filter
+find
+findindex
+findkey
+findlast
+findlastindex
+findlastkey
+first
+flatten
+foreach
+foreachright
+forin
+forinright
+forown
+forownright
+functions
+_getarray
+_getobject
+groupby
+has
+_htmlescapes
+_htmlunescapes
+identity
+indexby
+indexof
+initial
+intersection
+invert
+invoke
+isarguments
+isarray
+isboolean
+isdate
+iselement
+isempty
+isequal
+isfinite
+isfunction
+isnan
+_isnative
+isnull
+isnumber
+isobject
+isplainobject
+isregexp
+isstring
+isundefined
+_keyprefix
+keys
+_largearraysize
+last
+lastindexof
+_lodashwrapper
+map
+mapvalues
+max
+_maxpoolsize
+memoize
+merge
+min
+mixin
+noop
+now
+_objectpool
+_objecttypes
+omit
+once
+pairs
+parseint
+partial
+partialright
+pick
+pluck
+property
+pull
+random
+range
+reduce
+reduceright
+_reescapedhtml
+_reinterpolate
+reject
+_releasearray
+_releaseobject
+remove
+rest
+result
+_reunescapedhtml
+sample
+_setbinddata
+_shimisplainobject
+_shimkeys
+shuffle
+size
+_slice
+some
+sortby
+sortedindex
+support
+template
+templatesettings
+throttle
+times
+toarray
+transform
+unescape
+_unescapehtmlchar
+union
+uniq
+uniqueid
+values
+where
+without
+wrap
+xor
+zip
+zipobject
diff --git a/nodejs-lodash-node.spec b/nodejs-lodash-node.spec
index 44fbc62..887ffd5 100644
--- a/nodejs-lodash-node.spec
+++ b/nodejs-lodash-node.spec
@@ -6,6 +6,7 @@ Summary: A collection of Lo-Dash methods as Node.js modules
License: MIT
URL: https://github.com/lodash/lodash-node
Source0: http://registry.npmjs.org/lodash-node/-/lodash-node-%{version}.tgz
+Source1: nodejs-lodash-node-functions.txt
BuildArch: noarch
ExclusiveArch: %{nodejs_arches} noarch
@@ -16,6 +17,27 @@ BuildRequires: npm(lodash-cli)
A collection of Lo-Dash methods as Node.js modules generated by lodash-cli.
+%{lua:
+template = [[
+%package -n nodejs-lodash-@@PKG@@
+Summary: The Lo-Dash function `_.@@FUNC@@` as a Node.js module
+License: MIT
+Provides: npm(lodash.@@FUNC@@)
+
+%description -n nodejs-lodash-@@PKG@@
+The Lo-Dash function `_.@@FUNC@@` as a Node.js module
+generated by lodash-cli.
+
+%files -n nodejs-lodash-@@PKG@@
+%doc npm/lodash.@@FUNC@@/LICENSE.txt npm/lodash.@@FUNC@@/README.md
+%{nodejs_sitelib}/lodash.@@FUNC@@
+]]
+for func in io.open(rpm.expand("%SOURCE1")):lines() do
+ pkg = string.gsub(func, "_", "")
+ print(rpm.expand(string.gsub(string.gsub(template, "@@FUNC@@", func), "@@PKG@@", pkg)).."\n")
+end}
+
+
%prep
%setup -q -n package
rm -rf node_modules compat modern underscore
@@ -25,11 +47,20 @@ rm -rf node_modules compat modern underscore
%{nodejs_sitelib}/lodash-cli/bin/lodash modularize exports="node" -o ./compat/
%{nodejs_sitelib}/lodash-cli/bin/lodash modularize modern exports="node" -o ./modern/
%{nodejs_sitelib}/lodash-cli/bin/lodash modularize underscore exports="node" -o ./underscore/
+%{nodejs_sitelib}/lodash-cli/bin/lodash modularize modern exports="npm" -o ./npm/
%install
mkdir -p %{buildroot}%{nodejs_sitelib}/lodash-node
cp -pr package.json compat modern underscore %{buildroot}%{nodejs_sitelib}/lodash-node
+pushd npm
+for module in lodash.*
+do
+ mkdir %{buildroot}%{nodejs_sitelib}/$module
+ cp -pr $module/package.json %{buildroot}%{nodejs_sitelib}/$module
+ cp -pr $module/index.js %{buildroot}%{nodejs_sitelib}/$module
+done
+popd
%nodejs_symlink_deps
_______________________________________________
nodejs mailing list
[email protected]
https://admin.fedoraproject.org/mailman/listinfo/nodejs