Improve source package slightly

This moves us one step closer to a normal source package.  The sources
are now unpacked and we run "make install".  We still don't build
since we don't have all the necessary tools.

Also, most importantly, the source tarball now includes our actual
sources in addition to the prebuilt binaries.
This commit is contained in:
Marius Vollmer 2017-08-22 13:59:55 +03:00
parent 78bdbad324
commit a3ea5df10c
5 changed files with 44 additions and 13 deletions

3
.gitignore vendored
View file

@ -3,3 +3,6 @@
node_modules/
dist/
/.vagrant
/webpack.inputs
/subscription-manager-cockpit.tar.gz
/subscription-manager-cockpit-*.*.rpm

View file

@ -5,20 +5,27 @@ clean:
rm -rf dist/
rm -rf _install
install: all
mkdir -p /usr/share/cockpit/subscription-manager
cp -r dist/* /usr/share/cockpit/subscription-manager
install: all install-only
install-only:
mkdir -p $(DESTDIR)/usr/share/cockpit/subscription-manager
cp -r dist/* $(DESTDIR)/usr/share/cockpit/subscription-manager
mkdir -p $(DESTDIR)/usr/share/metainfo/
cp org.cockpit-project.subscription-manager.metainfo.xml $(DESTDIR)/usr/share/metainfo/
EXTRA_DIST = \
README.md \
org.cockpit-project.subscription-manager.metainfo.xml \
package.json \
.eslintrc.json \
webpack.config.js \
webpack-with-stats \
Makefile
# when building a distribution tarball, call webpack with a 'production' environment
dist-gzip: NODE_ENV=production
dist-gzip: clean all
mkdir -p _install/usr/share/cockpit
cp -r dist/ _install/usr/share/cockpit/subscription-manager
mkdir -p _install/usr/share/metainfo/
cp *.metainfo.xml _install/usr/share/metainfo/
cp subscription-manager-cockpit.spec _install/
tar -C _install/ -czf subscription-manager-cockpit.tar.gz .
rm -rf _install
tar czf subscription-manager-cockpit.tar.gz --transform 's,^,subscription-manager-cockpit/,' $$(cat webpack.inputs) $(EXTRA_DIST) dist/
srpm: dist-gzip
rpmbuild -bs \

View file

@ -7,7 +7,7 @@
"author": "",
"license": "LGPL-2.1",
"scripts": {
"build": "webpack"
"build": "./webpack-with-stats"
},
"devDependencies": {
"babel-core": "^6.25.0",

View file

@ -15,12 +15,12 @@ Requires: subscription-manager
Subscription Manager Cockpit UI
%prep
%setup -n subscription-manager-cockpit
%build
%install
mkdir -p %{buildroot}
tar --strip-components=1 -xzf %{sources} -C %{buildroot}
make install-only DESTDIR=%{buildroot}
find %{buildroot} -type f >> files.list
sed -i "s|%{buildroot}||" *.list

21
webpack-with-stats Executable file
View file

@ -0,0 +1,21 @@
#!/usr/bin/env node
var path = require('path');
var fs = require('fs');
var process = require('process');
var webpack = require('webpack');
var config = require('./webpack.config.js');
webpack(config, function (err, stats) {
if (err) {
console.log(JSON.stringify(err));
process.exit(1);
return;
}
var inputs = [ ];
stats.compilation.fileDependencies.forEach(function(file) {
inputs.push(path.relative(process.cwd(), file));
});
fs.writeFileSync('webpack.inputs', inputs.join("\n") + "\n");
});