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