Merge pull request #656 from jankoprowski/debian

Introduce debian packaging
This commit is contained in:
Jonathan Turner 2019-09-20 06:34:29 +12:00 committed by GitHub
commit 8d5b1ad233
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 196 additions and 0 deletions

7
.gitignore vendored
View file

@ -3,3 +3,10 @@
**/*.rs.bk
history.txt
tests/fixtures/nuplayground
# Debian/Ubuntu
debian/.debhelper/
debian/debhelper-build-stamp
debian/files
debian/nu.substvars
debian/nu/

5
debian/changelog vendored Normal file
View file

@ -0,0 +1,5 @@
nu (0.2.0-1) unstable; urgency=low
* Initial release
-- Jan Koprowski <jan.koprowski@gmail.com> Wed, 04 Sep 2019 21:38:44 +0200

1
debian/compat vendored Normal file
View file

@ -0,0 +1 @@
10

18
debian/control vendored Normal file
View file

@ -0,0 +1,18 @@
Source: nu
Section: shells
Priority: optional
Maintainer: Jan Koprowski <jan.koprowski@gmail.com>
Build-Depends: debhelper (>= 10)
Standards-Version: 4.1.2
Homepage: https://github.com/nushell/nushell
Vcs-Git: https://github.com/nushell/nushell.git
Vcs-Browser: https://github.com/nushell/nushell
Package: nu
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: A modern shell for the GitHub era
The goal of this project is to take the Unix
philosophy of shells, where pipes connect simple
commands together, and bring it to the modern
style of development.

32
debian/copyright vendored Normal file
View file

@ -0,0 +1,32 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: nu
Source: https://github.com/nushell/nushell
Files: *
Copyright: 2019 Yehuda Katz
2019 Jonathan Turner
License: MIT
Files: debian/*
Copyright: 2019 Yehuda Katz
2019 Jonathan Turner
License: MIT
License: MIT
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
.
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

10
debian/install vendored Normal file
View file

@ -0,0 +1,10 @@
target/release/nu usr/bin
target/release/nu_plugin_binaryview usr/bin
target/release/nu_plugin_edit usr/bin
target/release/nu_plugin_inc usr/bin
target/release/nu_plugin_skip usr/bin
target/release/nu_plugin_str usr/bin
target/release/nu_plugin_sum usr/bin
target/release/nu_plugin_sys usr/bin
target/release/nu_plugin_textview usr/bin
target/release/nu_plugin_tree usr/bin

8
debian/postinst vendored Normal file
View file

@ -0,0 +1,8 @@
#! /bin/bash
if [ "$1" = configure ] && which add-shell >/dev/null
then
add-shell /usr/bin/nu
fi
exit 0

17
debian/postrm vendored Normal file
View file

@ -0,0 +1,17 @@
#!/bin/sh
set -e
case "$1" in
upgrade|failed-upgrade|abort-install|abort-upgrade)
;;
remove|purge|disappear)
if which remove-shell >/dev/null && [ -f /etc/shells ]; then
remove-shell /usr/bin/nu
fi
;;
*)
echo "postrm called with unknown argument \`$1'" >&2
exit 1
;;
esac

25
debian/rules vendored Executable file
View file

@ -0,0 +1,25 @@
#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
#export DH_VERBOSE = 1
# see FEATURE AREAS in dpkg-buildflags(1)
#export DEB_BUILD_MAINT_OPTIONS = hardening=+all
# see ENVIRONMENT in dpkg-buildflags(1)
# package maintainers to append CFLAGS
#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
# package maintainers to append LDFLAGS
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
%:
dh $@
# dh_make generated override targets
# This is example for Cmake (See https://bugs.debian.org/641051 )
#override_dh_auto_configure:
# dh_auto_configure -- # -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH)

1
debian/source/format vendored Normal file
View file

@ -0,0 +1 @@
3.0 (quilt)

View file

@ -0,0 +1,17 @@
# docker build -f docker/packaging/Dockerfile.ubuntu-bionic .
ARG FROMTAG=latest
FROM quay.io/nushell/nu-base:${FROMTAG}
RUN apt-get update && apt-get install -y \
devscripts \
debhelper
COPY debian /code/debian
RUN rustc -Vv && cargo build --release && \
cp README.md debian/README.Debian && \
debuild -b -us -uc -i && \
dpkg -i ../nu_0.2.0-1_amd64.deb && \
chsh -s /usr/bin/nu && \
echo 'ls | get name | echo $it' | /usr/bin/nu

View file

@ -0,0 +1,55 @@
# Packaging
This directory contains docker images used for creating packages for different distribution.
## How to use this docker files?
Start with:
```bash
$ docker build -f docker/packaging/Dockerfile.ubuntu-bionic -t nushell/package:ubuntu-bionic .
```
after building the image please run container:
```bash
$ docker run -td --rm --name nushell_package_ubuntu_bionic nushell/package:ubuntu-bionic
```
and copy deb package from inside:
```bash
$ docker cp nushell_package_ubuntu_bionic:/nu_0.2.0-1_amd64.deb .
```
or shell inside, and test install:
```bash
$ docker exec -it nushell_package_ubuntu_bionic bash
$ dpkg -i /nu_0.2.0-1_amd64.deb
(Reading database ... 25656 files and directories currently installed.)
Preparing to unpack /nu_0.2.0-1_amd64.deb ...
Unpacking nu (0.2.0-1) over (0.2.0-1) ...
Setting up nu (0.2.0-1) ...
```
When you are finished, exit and stop the container. It will be removed since we
used `--rm`.
```bash
$ docker stop nushell_package_ubuntu_bionic
```
## What should be done
* We should run sbuild command to create chroot and then install dpkg.
For two reasons. First: we want to use the same tools as Ubuntu package builders
to handle the cornercases. Second: we want to test dpkg requirements.
https://github.com/nushell/nushell/issues/681
* File debian/changelog file should be generated based on git history.
https://github.com/nushell/nushell/issues/682
* Building package and nu version should be parametrized.
https://github.com/nushell/nushell/issues/683