Implement .rpm package gulp task
.rpm packages can now be build with: gulp vscode-linux-<arch>-build-rpm The resulting package will be output to ~/rpmbuild/RPMS/<arch>/ and can be installed on a Red Hat-based distro with: yum localinstall <path> Note that Debian systems can build the package after installing the 'rpm' package: apt-get install rpm This was tested building 64-bit on Ubuntu 15.10 and installing on CentOS 7. Fixes #3595
This commit is contained in:
parent
571ba1fcf1
commit
3ddbbe9a95
|
@ -255,16 +255,16 @@ function prepareDebPackage(arch) {
|
|||
var packageRevision = getEpochTime();
|
||||
|
||||
return function () {
|
||||
var shortcut = gulp.src('resources/linux/bin/code.sh')
|
||||
var shortcut = gulp.src('resources/linux/bin/code.sh', { base: '.' })
|
||||
.pipe(replace('@@NAME@@', product.applicationName))
|
||||
.pipe(rename('usr/bin/' + product.applicationName));
|
||||
|
||||
var desktop = gulp.src('resources/linux/debian/code.desktop')
|
||||
var desktop = gulp.src('resources/linux/code.desktop', { base: '.' })
|
||||
.pipe(replace('@@NAME_LONG@@', product.nameLong))
|
||||
.pipe(replace('@@NAME@@', product.applicationName))
|
||||
.pipe(rename('usr/share/applications/' + product.applicationName + '.desktop'));
|
||||
|
||||
var icon = gulp.src('resources/linux/code.png')
|
||||
var icon = gulp.src('resources/linux/code.png', { base: '.' })
|
||||
.pipe(rename('usr/share/pixmaps/' + product.applicationName + '.png'));
|
||||
|
||||
var code = gulp.src(binaryDir + '/**/*', { base: binaryDir })
|
||||
|
@ -306,8 +306,7 @@ function prepareDebPackage(arch) {
|
|||
all = es.merge(all, postinst);
|
||||
}
|
||||
|
||||
return all
|
||||
.pipe(symdest(destination));
|
||||
return all.pipe(symdest(destination));
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -320,6 +319,49 @@ function buildDebPackage(arch) {
|
|||
], { cwd: '.build/linux/' + debArch});
|
||||
}
|
||||
|
||||
function getRpmBuildPath() {
|
||||
return path.join(process.env['HOME'], 'rpmbuild');
|
||||
}
|
||||
|
||||
function prepareRpmPackage(arch) {
|
||||
var binaryDir = '../VSCode-linux-' + arch;
|
||||
var destination = process.env['HOME'] + '/rpmbuild';
|
||||
var packageRevision = getEpochTime();
|
||||
|
||||
return function () {
|
||||
var shortcut = gulp.src('resources/linux/bin/code.sh', { base: '.' })
|
||||
.pipe(replace('@@NAME@@', product.applicationName))
|
||||
.pipe(rename('BUILD/usr/bin/' + product.applicationName));
|
||||
|
||||
var desktop = gulp.src('resources/linux/code.desktop', { base: '.' })
|
||||
.pipe(replace('@@NAME_LONG@@', product.nameLong))
|
||||
.pipe(replace('@@NAME@@', product.applicationName))
|
||||
.pipe(rename('BUILD/usr/share/applications/' + product.applicationName + '.desktop'));
|
||||
|
||||
var icon = gulp.src('resources/linux/code.png', { base: '.' })
|
||||
.pipe(rename('BUILD/usr/share/pixmaps/' + product.applicationName + '.png'));
|
||||
|
||||
var code = gulp.src(binaryDir + '/**/*', { base: binaryDir })
|
||||
.pipe(rename(function (p) { p.dirname = 'BUILD/usr/share/' + product.applicationName + '/' + p.dirname; }));
|
||||
|
||||
var spec = gulp.src('resources/linux/rpm/code.spec.template', { base: '.' })
|
||||
.pipe(replace('@@NAME@@', product.applicationName))
|
||||
.pipe(replace('@@VERSION@@', packageJson.version))
|
||||
.pipe(replace('@@RELEASE@@', packageRevision))
|
||||
.pipe(rename('SPECS/' + product.applicationName + '.spec'));
|
||||
|
||||
var all = es.merge(code, desktop, icon, shortcut, spec);
|
||||
|
||||
return all.pipe(symdest(destination));
|
||||
}
|
||||
}
|
||||
|
||||
function buildRpmPackage() {
|
||||
return shell.task([
|
||||
'fakeroot rpmbuild -ba ' + getRpmBuildPath() + '/SPECS/' + product.applicationName + '.spec',
|
||||
]);
|
||||
}
|
||||
|
||||
gulp.task('clean-vscode-win32', util.rimraf(path.join(path.dirname(root), 'VSCode-win32')));
|
||||
gulp.task('clean-vscode-darwin', util.rimraf(path.join(path.dirname(root), 'VSCode-darwin')));
|
||||
gulp.task('clean-vscode-linux-ia32', util.rimraf(path.join(path.dirname(root), 'VSCode-linux-ia32')));
|
||||
|
@ -327,6 +369,9 @@ gulp.task('clean-vscode-linux-x64', util.rimraf(path.join(path.dirname(root), 'V
|
|||
gulp.task('clean-vscode-linux-arm', util.rimraf(path.join(path.dirname(root), 'VSCode-linux-arm')));
|
||||
gulp.task('clean-vscode-linux-ia32-deb', util.rimraf('.build/linux/i386'));
|
||||
gulp.task('clean-vscode-linux-x64-deb', util.rimraf('.build/linux/amd64'));
|
||||
gulp.task('clean-vscode-linux-ia32-rpm', util.rimraf('.build/linux/rpm/i386'));
|
||||
gulp.task('clean-vscode-linux-x64-rpm', util.rimraf('.build/linux/rpm/x86_64'));
|
||||
gulp.task('clean-rpmbuild', util.rimraf(getRpmBuildPath()));
|
||||
|
||||
gulp.task('vscode-win32', ['optimize-vscode', 'clean-vscode-win32'], packageTask('win32'));
|
||||
gulp.task('vscode-darwin', ['optimize-vscode', 'clean-vscode-darwin'], packageTask('darwin'));
|
||||
|
@ -345,6 +390,11 @@ gulp.task('vscode-linux-x64-prepare-deb', ['clean-vscode-linux-x64-deb', 'vscode
|
|||
gulp.task('vscode-linux-ia32-build-deb', ['vscode-linux-ia32-prepare-deb'], buildDebPackage('ia32'));
|
||||
gulp.task('vscode-linux-x64-build-deb', ['vscode-linux-x64-prepare-deb'], buildDebPackage('x64'));
|
||||
|
||||
gulp.task('vscode-linux-ia32-prepare-rpm', ['clean-rpmbuild', 'clean-vscode-linux-ia32-rpm', 'vscode-linux-ia32-min'], prepareRpmPackage('ia32'));
|
||||
gulp.task('vscode-linux-x64-prepare-rpm', ['clean-rpmbuild', 'clean-vscode-linux-x64-rpm', 'vscode-linux-x64-min'], prepareRpmPackage('x64'));
|
||||
gulp.task('vscode-linux-ia32-build-rpm', ['vscode-linux-ia32-prepare-rpm'], buildRpmPackage());
|
||||
gulp.task('vscode-linux-x64-build-rpm', ['vscode-linux-x64-prepare-rpm'], buildRpmPackage());
|
||||
|
||||
// Sourcemaps
|
||||
|
||||
gulp.task('upload-vscode-sourcemaps', ['minify-vscode'], function () {
|
||||
|
|
29
resources/linux/rpm/code.spec.template
Normal file
29
resources/linux/rpm/code.spec.template
Normal file
|
@ -0,0 +1,29 @@
|
|||
Name: @@NAME@@
|
||||
Version: @@VERSION@@
|
||||
Release: @@RELEASE@@
|
||||
Summary: Code editing. Redefined.
|
||||
License: MIT
|
||||
URL: https://code.visualstudio.com/
|
||||
Requires: git
|
||||
AutoReq: 0
|
||||
|
||||
%description
|
||||
Visual Studio Code is a new choice of tool that combines the simplicity of a code editor with what developers need for the core edit-build-debug cycle.
|
||||
|
||||
%install
|
||||
mkdir -p %{buildroot}/usr/bin
|
||||
cp -r usr/bin/@@NAME@@ %{buildroot}/usr/bin
|
||||
mkdir -p %{buildroot}/usr/share/@@NAME@@
|
||||
cp -r usr/share/@@NAME@@/* %{buildroot}/usr/share/@@NAME@@
|
||||
mkdir -p %{buildroot}/usr/share/applications
|
||||
cp -r usr/share/applications/@@NAME@@.desktop %{buildroot}/usr/share/applications
|
||||
mkdir -p %{buildroot}/usr/share/pixmaps
|
||||
cp -r usr/share/pixmaps/@@NAME@@.png %{buildroot}/usr/share/pixmaps
|
||||
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
|
||||
/usr/bin/@@NAME@@
|
||||
/usr/share/@@NAME@@/
|
||||
/usr/share/applications/@@NAME@@.desktop
|
||||
/usr/share/pixmaps/@@NAME@@.png
|
Loading…
Reference in a new issue