nnn

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 41235445e714fa55bdc77328212628cb3dd34d58
parent 4af8ba19f1ddbb0d85f239618d0a7b3e4b02217b
Author: Michael Fenn <michaelfenn87@gmail.com>
Date:   Fri, 28 Apr 2017 03:14:27 -0400

Add automatic RPM builds via travis (#18)

* Add automatic RPM builds via travis

* readline.h must be imported after stdio.h to pick up def of FILE

Diffstat:
M.travis.yml | 49++++++++++++++++++++++++++++++-------------------
Abuild-docker | 42++++++++++++++++++++++++++++++++++++++++++
Mnnn.c | 2+-
Aredhat/build-rpm | 25+++++++++++++++++++++++++
Aredhat/nnn.spec | 48++++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 146 insertions(+), 20 deletions(-)

diff --git a/.travis.yml b/.travis.yml @@ -1,20 +1,31 @@ language: c -matrix: - include: - # Access more recent gcc and clang via a Trusty image - - os: linux - dist: trusty - compiler: gcc - - os: linux - dist: trusty - compiler: clang - - os: osx - compiler: gcc - - os: osx - compiler: clang -script: - - export CFLAGS=-Werror - - make clean - - make - - make clean - - make -f Makefile.generic +sudo: required +env: + matrix: + - OS_TYPE=centos OS_VERSION=7 + - OS_TYPE=fedora OS_VERSION=24 +services: + - docker + +before_install: + - sudo docker pull $OS_TYPE:$OS_VERSION + +script: + - ./build-docker $OS_TYPE $OS_VERSION + - sudo chown -R $(id -un).$(id -gn) dist + +after_success: +- ls -l dist + +deploy: + skip_cleanup: true + provider: releases + api-key: + secure: ZtMbo/H21MoodNvw7+tvPId97meS4Xs2beUzqOhI166iuaLSWtjXxQgeC7vdYTWgPNacN6gxwhnXTLMXpt81a7g0NWxjRQ72/Rwh7aCdgQkJI/Y+0c7RNNVdLOtAWBM8csPoJy0jFdI34yHRj053tm9x65V4fMEKC9ArRm7pbTjNNovYXbW2KmRh6kr3dJdB/7tpoCpiMov6l4uHyWIcniFx97P+3dGnGqBd8SpR3IxeEypm8fzIGiX7NIJqwyG5MbLaWoyloBu21ilwh07dDifF6MI4mrkxtGY0yQ9GtHVp5cr7qyMgCt60hUGtrKhTtPQWwpzK0GSZ5eeYiLt6I/kkcj8FkWP+OazRLy/MydjGtG7q8tnbgNcmGqsbv+g1jJMEfZsnTfozeGOPPsYlhB/7kCi2BVqguXlKMRmpNPMZsc4HYK9yjV4HNsEkmwJcXgD350XS5iFu/koIGiT2PJ+/msdwPir74JpgRn00iGC0fD25V8M2TRnKn43g6jNRAZYMITaYDx+ML0SkdWIjksalW0759BgLfQopNbs9a9PbsKiNbfRRRF3xA8j2fQI6my7hXx0TzRwWTC7aMAuJkdjKn5UYOrMAZ+VXhHSOcX5LPiefwgtoU0YGjgWQdgTkQ7aR13rKuDSKepGonnkyiHWnM9gGftnNbNFi7WZRk5w= + file_glob: true + file: + - dist/*.deb + - dist/*.rpm + on: + repo: jarun/nnn +tags: true diff --git a/build-docker b/build-docker @@ -0,0 +1,42 @@ +#!/bin/bash + +set -xe + +if [[ $# -ne 2 ]]; then + echo "Usage: $0 <OS_TYPE> <OS_VERSION>" + exit 1 +fi + +os_type="$1" +os_version="$2" + +docker_args="-e OS_TYPE=$os_type -e OS_VERSION=$os_version -v $(pwd):/build:rw --rm=true" + +case $os_type in + centos|fedora) + # check for correct package manager + if [[ $os_type == "fedora" ]]; then + YUM=dnf + else + YUM=yum + fi + + # set up the docker image with a baseline + cat >Dockerfile <<EOF +FROM $os_type:$os_version +RUN mkdir /build +VOLUME /build +RUN $YUM -y install rpm-build gcc git make readline-devel ncurses-devel +EOF + sudo docker build -t nnn . + + # do the build + sudo docker run $docker_args nnn /bin/bash -c "cd /build && ./redhat/build-rpm" + ;; + *) + echo "$OS_TYPE $OS_VERSION not supported!" + exit 1 + ;; +esac + +# vim: et:ai:ts=4:sw=4 diff --git a/nnn.c b/nnn.c @@ -1,5 +1,4 @@ /* See LICENSE file for copyright and license details. */ -#include <readline/readline.h> #include <sys/stat.h> #include <sys/types.h> #include <sys/wait.h> @@ -30,6 +29,7 @@ #include <string.h> #include <time.h> #include <unistd.h> +#include <readline/readline.h> #define __USE_XOPEN_EXTENDED #include <ftw.h> diff --git a/redhat/build-rpm b/redhat/build-rpm @@ -0,0 +1,25 @@ +#!/bin/bash + +set -xe + +# create the rpm tree +rpmdir=$(mktemp -d) +install -d -m0755 $rpmdir/{BUILD,BUILDROOT,RPMS/$(uname -m),SOURCES,SPECS,SRPMS} + +# copy the sources into place +cp redhat/nnn.spec $rpmdir/SPECS/nnn.spec +vers=$(git describe --always | sed 's/^v//' | tr - .) +sed -i -e "s/Version:\s*\(\S\+\)/Version: $vers/" $rpmdir/SPECS/nnn.spec +git archive --prefix=nnn-$vers/ --format=tar.gz -o $rpmdir/SOURCES/nnn-$vers.tar.gz HEAD + +# do the build +( cd $rpmdir/SPECS && rpmbuild --define="%_topdir $rpmdir" -ba nnn.spec ) + +# retreive the artifacts +mkdir -p dist +cp $rpmdir/{SRPMS,RPMS/*}/*.rpm dist/ + +# clean up +rm -rf $rpmdir + +# vim: et:ai:ts=4:sw=4 diff --git a/redhat/nnn.spec b/redhat/nnn.spec @@ -0,0 +1,48 @@ +%global debug_package %{nil} + +Name: nnn +Version: 1.0 +Release: 1%{?dist} +Summary: The missing terminal file browser for X + +Group: Applications/Engineering +License: GPLv3 +URL: https://github.com/jarun/nnn +Source0: %{name}-%{version}.tar.gz + +BuildRequires: gcc binutils make gzip +BuildRequires: ncurses-devel readline-devel + +%description +nnn is a fork of noice, a blazing-fast lightweight terminal file browser with easy keyboard shortcuts for navigation, opening files and running tasks. noice is developed considering terminal based systems. There is no config file and mime associations are hard-coded. However, the incredible user-friendliness and speed make it a perfect utility on modern distros. + +nnn can use the default desktop opener at runtime. It also comes with nlay - a customizable bash script to handle media types. It adds new navigation options, enhanced DE integration, a disk usage analyzer mode, comprehensive file details and much more. Add to that a huge performance boost. For a detailed comparison, visit nnn vs. noice. + +If you want to edit a file in vim with some soothing music in the background while referring to a spec in your GUI PDF viewer, nnn got it! All from the same terminal session. Follow the instructions in the quickstart section and see how nnn simplifies those long desktop sessions... + +%prep +%setup -q + + +%build +make %{?_smp_mflags} + +%install +%{__install} -m755 -d %{buildroot}%{_bindir} +%{__install} -m755 -d %{buildroot}%{_mandir}/man1 +%{__install} -m755 nnn %{buildroot}%{_bindir}/nnn +%{__install} -m755 nlay %{buildroot}%{_bindir}/nlay +%{__install} -m644 nnn.1 %{buildroot}%{_mandir}/man1/nnn.1 + +%files +%{_bindir}/nnn +%{_bindir}/nlay +%{_mandir}/man1/nnn.1.gz +%doc README.md +%doc LICENSE +%doc CHANGELOG + + +%changelog +* Wed Apr 26 2017 Michael Fenn <michaelfenn87@gmail.com> - 1.0-1 +- Initial RPM