Git Product home page Git Product logo

gulp-debian's Introduction

gulp-debian

🍹 Gulp plug-in to create a Debian package.

js-standard-style npm version

** Please note that this project did not use semantic versioning prior to v1.0.0. It will be adopted as of that version. **

Install
$ npm install --save-dev gulp-debian
Usage

Define package in-line:

'use strict'

const gulp = require('gulp')
const deb = require('gulp-debian')

gulp.task('default', function (done) {
  return gulp.src(['demo.sh','blob.bin'])
  .pipe(deb({
    package: 'demo',
    version: '0.1-2',
    section: 'base',
    priority: 'optional',
    architecture: 'i386',
    maintainer: 'Mr. Apt <[email protected]>',
    description: 'A dummy package\n Long description starts here...',
    preinst: [ 'echo "hello from dummy package"' ],
    postinst: [ 'cat -n /opt/demo/.npmignore' ],
    prerm: [ 'cat -n /opt/demo/.npmignore' ],
    postrm: [ 'echo "bye from dummy package"' ],
    conffiles: 'configs/dir',
    changelog: [
      {
        version: '0.1-2',
        distribution: 'unstable',
        urgency: 'low',
        date: new Date('2016-12-24T12:40:10'),
        changes: [
          'Added another feature.',
          'Fixed feature X.'
        ]
      },
      {
        version: '0.1-1',
        distribution: 'unstable',
        urgency: 'low',
        date: '2016-12-23T11:24:00',
        changes: [
          'First release.'
        ]
      }
    ],
    _target: 'opt/demo',
    _out: 'dist',
    _copyright: 'path/to/copyright',
    _clean: true,
    _verbose: true
  }))
  done()
})

Alternatively, you can define your package in an external JSON file:

gulp.task('default', function (done) {
  return gulp.src(['demo.sh', 'blob.bin'])
  .pipe(deb('demo_0.1-2_i386.json'))
  done()
})

You can also use a YAML file to define your package. Just convert it to an Object first using the js-yaml module (npm install --save js-yaml):

const YAML = require('js-yaml')
const fs = require('fs')

gulp.task('default', function (done) {
  return gulp.src(['demo.sh', 'blob.bin'])
  .pipe(deb(YAML.load(fs.readFileSync('demo_0.1-2_i386.yml').toString())))
  done()
})
Options
  • Options: Object containing properties for a Debian file and the following parameters:

    • preinst: String with a path to script or array of commands to run for the package's pre-install script (optional).
    • postint: String with a path to script or array of commmands to run for the package's post-install script (optional).
    • prerm: String with a path to script or array of commands to run for the package's pre-remove script (optional).
    • postrm: String with a path to script or array of commmands to run for the package's post-remove script (optional).
    • conffiles: string - path to the directory with configs. All configs must be placed from this directory in subdirectories starting from root folder (optional).
    • changelog: Array of versions and their changes to write to the package's changelog (optional, but recommended). Options are:
      • version: String for version with changes.
      • distribution: String for version distribution.
      • urgency: String for version urgency.
      • date: Date object or String in ISO 8601 notation for version date.
      • changes: Array of changes made.
    • _target: string - The installation target for the created Debian package (mandatory).
    • _out: string - The target directory to create the Debian package in (mandatory).
    • _copyright: string - The path to plain copyright file (functionally optional, but mandatory in Debian policy).

    This should be mandatory in packages you intend to publish, but for testing purposes this can omitted for testing stage packages.

    • _clean: boolean - If true, removes the temporary directory created in the target directory with the same structure than the Debian package.
    • _verbose: boolean - Verbose output from dpkg-deb utility (optional; true if omitted).

    (or)

    • String containing filename for external JSON file defining package.
Contributors
License

MIT

gulp-debian's People

Contributors

catturagreg avatar haslinghuis avatar hydra avatar lucomsky avatar mcgivergim avatar samtheman2022 avatar stpettersens avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

gulp-debian's Issues

postinst script support

Hi!

Same question like the changelog request:
Do you have a idea for a implementation of a postinst script support?
Do you prefer a embedded solution in the Gulpfile.js or more as an external file?

Changelog support

Hi!

Do you have a idea for a implementation of a changelog support? Do you prefer a external file how is loaded from gulp-debian or better as embedded information in the Gulpfile.js? If we say external file is the best way than as yaml file or better json?

issue/feature request - compression method (-Zxz)

dpkg-deb in Ubuntu at others create .deb files with ZST compression; However, Debian 11 stable does not support ZST but rather typically expects XZ compression.

Please add a feature/parameter that allows users to set the compression method. Maybe default can be zst since all other OSes seem to be okay with it.

e.g.

  .pipe(deb({
    package: 'demo',
    version: '0.1-2',
    section: 'base',
    priority: 'optional',
    compression: 'xz',
    [...]

Problem with keywords in options

If some of the options, contains some "keyword" the generation of the control file fails.

For example, this option:

maintainer: 'The Cleanflight Team',

Fails because the Clean word is inside the value. The same for any other option and value (I have tested with description and Copyright for example.

Error executing gulp task: Did you forget to signal async completion?

I cannot execute the gulp-debian task as it throws an error:

[09:56:20] dpkg-deb: building package `koala-emails' in `builds/koala-emails_2.0.0.undefined-1_all.deb'.
[09:56:20] The following tasks did not complete: package-min
[09:56:20] Did you forget to signal async completion?

Here is my gulp task code:

return gulp
      .src([
        'dist/mail_images/**',
        'dist/mail_templates/**/*.html',
        'debian/**',
        '!node_modules/**',
        '!**/.git/**',
        '!etc',
        '!src',
        '!.*'
      ])
      .pipe(deb({
        package: PACKAGE.name,
        version: PACKAGE.version + '.' + global.git_revision + '-1',
        section: 'base',
        priority: 'extra',
        architecture: 'all',
        maintainer: PACKAGE.author + '<' + PACKAGE.email + '>',
        description: PACKAGE.description,
        postinst: [ 'debian/postinst' ],
        changelog: [],
        _target: PACKAGE.install_dir,
        _out: 'builds',
        _verbose: true
      }));

Maybe some empty callback is required or something?

TODO: Owner of files should be root.

  • Owner of files should be root (in group: root).
  • Folders should have 755 permissions.
  • Scripts should have 755 permissions (done already).
  • Normal files should be 644.

Fix this before publishing 0.1.5.

Take in care SemVer

Hi! This is only a suggestion. The SemVer in npm marks the versions as X.Y.Z being Z a pach to the version that does not modify the behaviour of the library. In package.json a "~x.y.z" says that the Z can be changed and is not a problem because it is totally compatible.

The latest version 0.1.8 was not compatible with earlier versions (0.1.7 for example) and it broke all the builds that use this library because the new parameter is mandatory.

Is not a problem, I will change where I'm using it to add the new parameter (I think is important to have the copyright) but being a public library I think that the SemVer must be accomplished ;)

Thanks again for your work!!

Add lintian check to Travis

It'll be good to add lintian check to Travis to have good feedback from real state of *.deb packages.

It can be done by this command: lintian -c dist/demo*.deb

Package have to be build with fakeroot: fakeroot gulp, fakeroot gulp deb-json and so on.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.