release v1.1.6.6

chore: add machine triplet in -V
chore: add rpm autobuild
chore: multi-arch autobuild
This commit is contained in:
Stéphane Lesimple
2020-11-07 15:47:31 +01:00
parent e9b401f03a
commit 0c7ab93b71
9 changed files with 165 additions and 84 deletions

View File

@@ -6,7 +6,7 @@ on:
jobs:
check:
checks:
runs-on: ubuntu-latest
steps:
@@ -27,16 +27,7 @@ jobs:
fi
- name: install prerequisites
run: sudo apt-get update && sudo apt-get install -y uncrustify make git debhelper tar gzip jq zip unzip rpm rsync
- name: create source zip file for rpm build
run: |
curdir=$PWD
tempfolder=$(mktemp -d)
cd $tempfolder
mkdir ovh-ttyrec
rsync -va --exclude=.git $curdir/ ovh-ttyrec/
zip -9r ~/ovh-ttyrec.zip ovh-ttyrec
run: sudo apt-get update && sudo apt-get install -y uncrustify make git gcc
- name: check style
run: |
@@ -76,15 +67,7 @@ jobs:
exit 1
fi
- name: build and test debian package
run: |
make clean && ./configure && make -j$(nproc) && ./ttyrec -V
make deb
ls -l ..
sudo dpkg -i ../ovh-ttyrec_*.deb
dpkg -L ovh-ttyrec
- name: build fully static version
- name: compile fully static version
run: |
make clean && STATIC=1 ./configure && make -j$(nproc) && ./ttyrec -V
./ttyrec -V | grep -qF 'zstd[static]'
@@ -92,12 +75,78 @@ jobs:
exit 1
fi
- name: build rpm package
multiarch:
needs: checks
runs-on: ubuntu-latest
strategy:
matrix:
cross:
- arm32v5
- arm32v7
- arm64v8
- ppc64le
- mips64le
- s390x
- i386
- amd64
steps:
- uses: actions/checkout@v2
- name: prepare qemu
run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
- name: install prerequisites
run: sudo apt-get update && sudo apt-get install -y rsync zip jq
- name: create source zip file for rpm build
run: |
curdir=$PWD
tempfolder=$(mktemp -d)
cd $tempfolder
mkdir ovh-ttyrec
rsync -va --exclude=.git $curdir/ ovh-ttyrec/
mkdir -p ~/rpmbuild/SOURCES
mv ~/ovh-ttyrec.zip ~/rpmbuild/SOURCES/master.zip
unzip -l ~/rpmbuild/SOURCES/master.zip
rpmbuild -bb ovh-ttyrec.spec
zip -9r ~/rpmbuild/SOURCES/master.zip ovh-ttyrec
- name: build for ${{ matrix.cross }}
run: >
mkdir /tmp/pkg &&
docker run --rm -e DEBIAN_FRONTEND=noninteractive
-v $PWD:/pkg/code
-v /tmp/pkg:/pkg
-v $HOME:/root
${{ matrix.cross }}/debian
/bin/bash -c '
set -exo pipefail;
apt-get update;
apt-get install -y make gcc libzstd-dev dpkg-dev debhelper unzip rpm binutils;
cd /pkg/code;
dpkg-buildpackage -b -rfakeroot -us -uc;
if [ "${{ matrix.cross }}" = i386 ]; then target="--target=i386"; else target=""; fi
set +o pipefail;
rpm --showrc | head;
set -o pipefail;
if [ $(rpm -E "%{_arch}") != "%{_arch}" ]; then
rpmbuild -bb $target ovh-ttyrec.spec;
else
arch=$(rpm --showrc | grep "^build arch" | awk "{print \$4}");
rpmbuild --define "_arch $arch" -bb $target ovh-ttyrec.spec;
fi;
mv ~/rpmbuild/RPMS/*/*.rpm /pkg;
STATIC=1 ./configure && make clean && make -j$(nproc) && ./ttyrec -V;
./ttyrec -V | grep -qF "zstd[static]";
if ldd ttyrec; then
exit 1;
fi;
version=$(./ttyrec -V | head -n1 | cut -d" " -f2 | grep -Eo "[0-9][A-Za-z0-9._-]+");
mkdir ovh-ttyrec-$version;
strip ttyrec ttyplay ttytime;
install ttyrec ttyplay ttytime ovh-ttyrec-$version;
cp -va docs ovh-ttyrec-$version;
staticname=ovh-ttyrec-${version}_$(dpkg --print-architecture)-linux-static-binary.tar.gz;
tar cvzf /pkg/$staticname ovh-ttyrec-$version;
'
- name: get release vars
id: getvars
@@ -105,38 +154,23 @@ jobs:
upload_url=$(jq -r '.release.upload_url' < $GITHUB_EVENT_PATH)
echo "Upload URL is $upload_url"
echo "::set-output name=upload_url::$upload_url"
rpmpath=$(readlink -f $(find ~/rpmbuild/RPMS -type f -name "*.rpm"))
rpmpath=$(find /tmp/pkg -mindepth 1 -maxdepth 1 -type f -name "*.rpm")
rpmname=$(basename "$rpmpath")
echo "RPM package name is $rpmname ($rpmpath)"
echo "::set-output name=rpmname::$rpmname"
echo "::set-output name=rpmpath::$rpmpath"
debpath=$(readlink -f $(find .. -mindepth 1 -maxdepth 1 -type f -name "*.deb"))
debpath=$(find /tmp/pkg -mindepth 1 -maxdepth 1 -type f -name "*.deb" ! -name "*dbgsym*")
debname=$(basename "$debpath")
echo "Debian package name is $debname ($debpath)"
echo "::set-output name=debname::$debname"
echo "::set-output name=debpath::$debpath"
version=$(echo "$debname" | cut -d_ -f2)
mkdir ovh-ttyrec-$version
install ttyrec ttyplay ttytime ovh-ttyrec-$version
cp -va docs ovh-ttyrec-$version
staticname=ovh-ttyrec-$version-linux-static-binary.tar.gz
tar cvzf $staticname ovh-ttyrec-$version
echo "Static tar.gz archive name is $staticname"
echo "::set-output name=static_package::$staticname"
- name: upload debian package
id: upload-release-asset1
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.getvars.outputs.upload_url }}
asset_path: ${{ steps.getvars.outputs.debpath }}
asset_name: ${{ steps.getvars.outputs.debname }}
asset_content_type: application/x-debian-package
staticpath=$(find /tmp/pkg -mindepth 1 -maxdepth 1 -type f -name "*-linux-static-binary.tar.gz" | head -n1)
staticname=$(basename "$staticpath")
echo "Static tar.gz archive name is $staticname ($staticpath)"
echo "::set-output name=staticname::$staticname"
echo "::set-output name=staticpath::$staticpath"
- name: upload rpm package
id: upload-release-asset2
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -146,13 +180,22 @@ jobs:
asset_name: ${{ steps.getvars.outputs.rpmname }}
asset_content_type: application/x-rpm
- name: upload static binary
id: upload-release-asset3
- name: upload debian package
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.getvars.outputs.upload_url }}
asset_path: ${{ steps.getvars.outputs.static_package }}
asset_name: ${{ steps.getvars.outputs.static_package }}
asset_path: ${{ steps.getvars.outputs.debpath }}
asset_name: ${{ steps.getvars.outputs.debname }}
asset_content_type: application/x-debian-package
- name: upload static binary
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.getvars.outputs.upload_url }}
asset_path: ${{ steps.getvars.outputs.staticpath }}
asset_name: ${{ steps.getvars.outputs.staticname }}
asset_content_type: application/gzip

View File

@@ -1,5 +1,5 @@
CC = %CC%
CFLAGS = -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -I/usr/local/include %CFLAGS%
CFLAGS = -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -I/usr/local/include %CFLAGS% $(RPM_OPT_FLAGS)
LDFLAGS = -L/usr/local/lib
LDLIBS = %LDLIBS%
@@ -7,11 +7,18 @@ BINARIES = ttyrec ttyplay ttytime
BIN = $(DESTDIR)/usr/bin
.PHONY: all deb rpm clean distclean style dist install test
all: $(BINARIES)
deb:
dpkg-buildpackage -b -rfakeroot -us -uc
rpm: clean
o=$$PWD && t=$$(mktemp -d) && cd $$t && mkdir ovh-ttyrec && rsync -a --exclude=.git $$o/ ovh-ttyrec/ && zip -9r ~/rpmbuild/SOURCES/master.zip ovh-ttyrec
rpmbuild -bb ovh-ttyrec.spec
ls -lh ~/rpmbuild/RPMS/*/ovh-ttyrec*.rpm
ttyrec: ttyrec.o io.o compress.o %COMPRESS_ZSTD%
$(CC) $(CFLAGS) -o $@ ttyrec.o io.o compress.o %COMPRESS_ZSTD% $(LDFLAGS) $(LDLIBS) %PTHREAD%
@@ -38,6 +45,7 @@ install:
install ttyrec $(BIN)
install ttyplay $(BIN)
install ttytime $(BIN)
install -m 0644 -D -t $(DESTDIR)/usr/share/man/man1/ docs/*
test: all
./ttyrec -V

View File

@@ -54,11 +54,18 @@ If you want to build a .deb (Debian/Ubuntu) package, just run:
$ ./configure && make deb
## build a .rpm package
If you want to build a .rpm (RHEL/CentOS) package, just run:
$ ./configure && make rpm
## usage
The simplest usage is just calling the binary, it'll execute the users' shell and record the session until exit:
$ ttyrec
To replay this session:
$ ttyplay ./ttyrecord

1
configure vendored
View File

@@ -245,6 +245,7 @@ rm -f $(dirname $0)/Makefile.tmp
cat >>"$curdir/configure.h" <<EOF
#define DEFINES_STR "$DEFINES_STR"
#define COMPILER_NAME "$CC"
#define MACHINE_STR "$($CC -dumpmachine)"
#endif
EOF

10
debian/changelog vendored
View File

@@ -1,8 +1,14 @@
ovh-ttyrec (1.1.6.6) master; urgency=medium
* chore: display machine triplet in -V
-- Stéphane Lesimple (deb packages) <stephane.lesimple@corp.ovh.com> Mon, 09 Nov 2020 10:23:41 +0100
ovh-ttyrec (1.1.6.5) master; urgency=medium
* fix: race condition when running w/o pty
-- Stéphane Lesimple (deb packages) <stephane.lesimple@corp.ovh.com> Thu, 15 Sep 2020 10:59:22 +0200
-- Stéphane Lesimple (deb packages) <stephane.lesimple@corp.ovh.com> Tue, 15 Sep 2020 10:59:22 +0200
ovh-ttyrec (1.1.6.4) master; urgency=medium
@@ -14,7 +20,7 @@ ovh-ttyrec (1.1.6.3) master; urgency=medium
* fix: race condition on exit when a sighandler gets called while we're in libc's exit(), fixes #7
-- Stéphane Lesimple (deb packages) <stephane.lesimple@corp.ovh.com> Fri, 10 Oct 2019 14:43:17 +0200
-- Stéphane Lesimple (deb packages) <stephane.lesimple@corp.ovh.com> Thu, 10 Oct 2019 14:43:17 +0200
ovh-ttyrec (1.1.6.2) master; urgency=medium

2
debian/compat vendored
View File

@@ -1 +1 @@
7
9

2
debian/control vendored
View File

@@ -11,7 +11,7 @@ Depends: ${shlibs:Depends}, ${misc:Depends}
Conflicts: ttyrec
Description: Extended (but compatible) fork of ttyrec
ttyrec is a terminal (tty) recorder, it comes with ttyplay, which is a tty player.
Some features ov ovh-ttyrec follow:
Some features of ovh-ttyrec follow:
- Drop-in replacement of the classic ttyrec, additional features don't break compatibility
- The code is portable and OS features that can be used are detected at compile time
- Supports ttyrec output file rotation without interrupting the session

View File

@@ -1,54 +1,70 @@
Summary: Extended (but compatible) fork of ttyrec
Name: ovh-ttyrec
Version: 1.1.6.5
Version: 1.1.6.6
Release: 1
License: 3-Clause BSD
License: BSD
Group: Applications/System
Source: https://github.com/ovh/ovh-ttyrec/archive/master.zip
BuildRoot: /var/tmp/%{name}-buildroot
%description
Description: Extended (but compatible) fork of ttyrec
ttyrec is a terminal (tty) recorder, it comes with ttyplay, which is a tty player.
Some features ov ovh-ttyrec follow:
- Drop-in replacement of the classic ttyrec, additional features don't break compatibility
- The code is portable and OS features that can be used are detected at compile time
- Supports ttyrec output file rotation without interrupting the session
- Supports locking the session after a keyboard input timeout, optionally displaying a custom message
Extended (but compatible) fork of ttyrec.
ttyrec is a terminal (tty) recorder,
it comes with ttyplay, which is a tty player.
Some features of ovh-ttyrec follow:
- Drop-in replacement of the classic ttyrec,
additional features don't break compatibility
- The code is portable and OS features that
can be used are detected at compile time
- Supports ttyrec output file rotation
without interrupting the session
- Supports locking the session after a keyboard input
timeout, optionally displaying a custom message
- Supports terminating the session after a keyboard input timeout
- Supports manually locking or terminating the session via "cheatcodes" (specific keystrokes)
- Supports a no-tty mode, relying on pipes instead of pseudottys, while still recording stdout/stderr
- Automatically detects whether to use pseudottys or pipes, also overridable from command-line
- Supports reporting the number of bytes that were output to the terminal on session exit
- Supports manually locking or terminating the
session via "cheatcodes" (specific keystrokes)
- Supports a no-tty mode, relying on pipes instead
of pseudottys, while still recording stdout/stderr
- Automatically detects whether to use pseudottys
or pipes, also overridable from command-line
- Supports reporting the number of bytes that
were output to the terminal on session exit
%prep
%setup -q -n ovh-ttyrec
%build
STATIC=1 ./configure
make RPM_OPT_FLAGS="$RPM_OPT_FLAGS"
%configure
%make_build
%install
make DESTDIR="$RPM_BUILD_ROOT" install
%make_install
find "$RPM_BUILD_ROOT"/usr/bin -type f -exec strip '{}' \;
find "$RPM_BUILD_ROOT"
%clean
rm -rf -- "$RPM_BUILD_ROOT"
%files
%doc docs/ttyplay.1 docs/ttytime.1 docs/ttyrec.1
/usr/bin/ttyplay
/usr/bin/ttytime
/usr/bin/ttyrec
%{_mandir}/man1/ttyplay.*
%{_mandir}/man1/ttytime.*
%{_mandir}/man1/ttyrec.*
%{_bindir}/ttyplay
%{_bindir}/ttytime
%{_bindir}/ttyrec
%changelog
* Thu Sep 15 2020 Stéphane Lesimple (deb packages) <stephane.lesimple@corp.ovh.com> 1.1.6.5
* Mon Nov 09 2020 Stéphane Lesimple (deb packages) <stephane.lesimple@corp.ovh.com> 1.1.6.6
- chore: display machine triplet in -V
* Tue Sep 15 2020 Stéphane Lesimple (deb packages) <stephane.lesimple@corp.ovh.com> 1.1.6.5
- fix: race condition when running w/o pty
* Thu Mar 05 2020 Stéphane Lesimple (deb packages) <stephane.lesimple@corp.ovh.com> 1.1.6.4
- fix: -k was not working correctly when used without -t
* Fri Oct 10 2019 Stéphane Lesimple (deb packages) <stephane.lesimple@corp.ovh.com> 1.1.6.3
* Thu Oct 10 2019 Stéphane Lesimple (deb packages) <stephane.lesimple@corp.ovh.com> 1.1.6.3
- fix: race condition on exit when a sighandler gets called while we're in libc's exit(), fixes #7
* Fri Aug 30 2019 Stéphane Lesimple (deb packages) <stephane.lesimple@corp.ovh.com> 1.1.6.2

View File

@@ -210,7 +210,7 @@ static time_t locked_since = 0;
static int lock_warned = 0;
static int kill_warned = 0;
static const char version[] = "1.1.6.5";
static const char version[] = "1.1.6.6";
static FILE *fscript;
static int child;
@@ -509,15 +509,15 @@ int main(int argc, char **argv)
// version
case 'V':
printf("ttyrec v%s\r\n", version);
printf("ttyrec v%s (%s)\n", version, MACHINE_STR);
#ifdef DEFINES_STR
printf("%s (%s)\r\n", DEFINES_STR, OS_STR);
printf("%s (%s)\n", DEFINES_STR, OS_STR);
#endif
#ifdef __VERSION__
printf("compiler version %s (%s)\r\n", __VERSION__, COMPILER_NAME);
printf("compiler version %s (%s)\n", __VERSION__, COMPILER_NAME);
#endif
#ifdef HAVE_zstd
printf("libzstd version %u (%d.%d.%d)\r\n", ZSTD_versionNumber(), ZSTD_VERSION_MAJOR, ZSTD_VERSION_MINOR, ZSTD_VERSION_RELEASE);
printf("libzstd version %u (%d.%d.%d)\n", ZSTD_versionNumber(), ZSTD_VERSION_MAJOR, ZSTD_VERSION_MINOR, ZSTD_VERSION_RELEASE);
#endif
exit(0);