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/ node_modules/
dist/ dist/
/.vagrant /.vagrant
/webpack.inputs
/subscription-manager-cockpit.tar.gz
/subscription-manager-cockpit-*.*.rpm

View file

@ -5,20 +5,27 @@ clean:
rm -rf dist/ rm -rf dist/
rm -rf _install rm -rf _install
install: all install: all install-only
mkdir -p /usr/share/cockpit/subscription-manager
cp -r dist/* /usr/share/cockpit/subscription-manager 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 # when building a distribution tarball, call webpack with a 'production' environment
dist-gzip: NODE_ENV=production dist-gzip: NODE_ENV=production
dist-gzip: clean all dist-gzip: clean all
mkdir -p _install/usr/share/cockpit tar czf subscription-manager-cockpit.tar.gz --transform 's,^,subscription-manager-cockpit/,' $$(cat webpack.inputs) $(EXTRA_DIST) dist/
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
srpm: dist-gzip srpm: dist-gzip
rpmbuild -bs \ rpmbuild -bs \

View file

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

View file

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