diff --git a/.gitignore b/.gitignore index 2026921b61..d8aedd6cec 100644 --- a/.gitignore +++ b/.gitignore @@ -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/ diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000000..d6f8273939 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +nu (0.2.0-1) unstable; urgency=low + + * Initial release + + -- Jan Koprowski Wed, 04 Sep 2019 21:38:44 +0200 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000000..f599e28b8a --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +10 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000000..50c156c8da --- /dev/null +++ b/debian/control @@ -0,0 +1,18 @@ +Source: nu +Section: shells +Priority: optional +Maintainer: Jan Koprowski +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. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000000..81ce9e5e34 --- /dev/null +++ b/debian/copyright @@ -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. diff --git a/debian/install b/debian/install new file mode 100644 index 0000000000..75cf2844d9 --- /dev/null +++ b/debian/install @@ -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 diff --git a/debian/postinst b/debian/postinst new file mode 100644 index 0000000000..861d76811d --- /dev/null +++ b/debian/postinst @@ -0,0 +1,8 @@ +#! /bin/bash + +if [ "$1" = configure ] && which add-shell >/dev/null +then + add-shell /usr/bin/nu +fi + +exit 0 diff --git a/debian/postrm b/debian/postrm new file mode 100644 index 0000000000..1e4655c7be --- /dev/null +++ b/debian/postrm @@ -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 diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000000..e1c367c123 --- /dev/null +++ b/debian/rules @@ -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) + diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000000..163aaf8d82 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/docker/packaging/Dockerfile.ubuntu-bionic b/docker/packaging/Dockerfile.ubuntu-bionic new file mode 100644 index 0000000000..144f7b421e --- /dev/null +++ b/docker/packaging/Dockerfile.ubuntu-bionic @@ -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 \ No newline at end of file diff --git a/docker/packaging/README.md b/docker/packaging/README.md new file mode 100644 index 0000000000..e825c2780f --- /dev/null +++ b/docker/packaging/README.md @@ -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 \ No newline at end of file