mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-03-10 22:44:14 +00:00
Fix file ignore rules matching metadata folders breaking qemu builds
Change-type: patch
This commit is contained in:
parent
6bc55ea7ab
commit
9b52dec725
@ -119,10 +119,6 @@ exports.loadProject = (logger, projectPath, projectName, image) ->
|
|||||||
logger.logDebug('Creating project...')
|
logger.logDebug('Creating project...')
|
||||||
createProject(projectPath, composeStr, projectName)
|
createProject(projectPath, composeStr, projectName)
|
||||||
|
|
||||||
toPosixPath = (systemPath) ->
|
|
||||||
path = require('path')
|
|
||||||
systemPath.replace(new RegExp('\\' + path.sep, 'g'), '/')
|
|
||||||
|
|
||||||
exports.tarDirectory = tarDirectory = (dir, preFinalizeCallback = null) ->
|
exports.tarDirectory = tarDirectory = (dir, preFinalizeCallback = null) ->
|
||||||
tar = require('tar-stream')
|
tar = require('tar-stream')
|
||||||
klaw = require('klaw')
|
klaw = require('klaw')
|
||||||
@ -130,6 +126,7 @@ exports.tarDirectory = tarDirectory = (dir, preFinalizeCallback = null) ->
|
|||||||
fs = require('mz/fs')
|
fs = require('mz/fs')
|
||||||
streamToPromise = require('stream-to-promise')
|
streamToPromise = require('stream-to-promise')
|
||||||
{ FileIgnorer } = require('./ignore')
|
{ FileIgnorer } = require('./ignore')
|
||||||
|
{ toPosixPath } = require('./helpers')
|
||||||
|
|
||||||
getFiles = ->
|
getFiles = ->
|
||||||
streamToPromise(klaw(dir))
|
streamToPromise(klaw(dir))
|
||||||
@ -178,6 +175,7 @@ exports.buildProject = (
|
|||||||
builder = require('resin-multibuild')
|
builder = require('resin-multibuild')
|
||||||
transpose = require('docker-qemu-transpose')
|
transpose = require('docker-qemu-transpose')
|
||||||
qemu = require('./qemu')
|
qemu = require('./qemu')
|
||||||
|
{ toPosixPath } = require('./helpers')
|
||||||
|
|
||||||
logger.logInfo("Building for #{arch}/#{deviceType}")
|
logger.logInfo("Building for #{arch}/#{deviceType}")
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ import Bluebird = require('bluebird');
|
|||||||
import chalk from 'chalk';
|
import chalk from 'chalk';
|
||||||
import _ = require('lodash');
|
import _ = require('lodash');
|
||||||
import os = require('os');
|
import os = require('os');
|
||||||
|
import path = require('path');
|
||||||
import visuals = require('resin-cli-visuals');
|
import visuals = require('resin-cli-visuals');
|
||||||
import rindle = require('rindle');
|
import rindle = require('rindle');
|
||||||
|
|
||||||
@ -28,6 +29,10 @@ const waitStreamAsync = Bluebird.promisify(rindle.wait);
|
|||||||
|
|
||||||
const balena = BalenaSdk.fromSharedOptions();
|
const balena = BalenaSdk.fromSharedOptions();
|
||||||
|
|
||||||
|
export function toPosixPath(p: string): string {
|
||||||
|
return p.replace(new RegExp('\\' + path.sep, 'g'), '/');
|
||||||
|
}
|
||||||
|
|
||||||
export function getGroupDefaults(group: {
|
export function getGroupDefaults(group: {
|
||||||
options: Array<{ name: string; default?: string }>;
|
options: Array<{ name: string; default?: string }>;
|
||||||
}): { [name: string]: string | undefined } {
|
}): { [name: string]: string | undefined } {
|
||||||
|
@ -5,6 +5,8 @@ import * as path from 'path';
|
|||||||
import dockerIgnore = require('@zeit/dockerignore');
|
import dockerIgnore = require('@zeit/dockerignore');
|
||||||
import ignore from 'ignore';
|
import ignore from 'ignore';
|
||||||
|
|
||||||
|
import { toPosixPath } from './helpers';
|
||||||
|
|
||||||
export enum IgnoreFileType {
|
export enum IgnoreFileType {
|
||||||
DockerIgnore,
|
DockerIgnore,
|
||||||
GitIgnore,
|
GitIgnore,
|
||||||
@ -90,8 +92,9 @@ export class FileIgnorer {
|
|||||||
const relFile = path.relative(this.basePath, filename);
|
const relFile = path.relative(this.basePath, filename);
|
||||||
|
|
||||||
// Don't ignore any metadata files
|
// Don't ignore any metadata files
|
||||||
const baseDir = path.dirname(relFile).split(path.sep)[0];
|
// The regex below matches `.balena/qemu` and `myservice/.balena/qemu`
|
||||||
if (baseDir === '.balena' || baseDir === '.resin') {
|
// but not `some.dir.for.balena/qemu`.
|
||||||
|
if (/(^|\/)\.(balena|resin)\//.test(toPosixPath(relFile))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user