mirror of
https://github.com/ovh/ovh-ttyrec.git
synced 2023-04-10 17:58:23 +03:00
chore: add rpm autobuild on release
This commit is contained in:
committed by
Stéphane Lesimple
parent
7fd000eaae
commit
e9b401f03a
63
.github/workflows/release.yml
vendored
63
.github/workflows/release.yml
vendored
@@ -13,7 +13,7 @@ jobs:
|
||||
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: verify debian changelog
|
||||
- name: verify changelogs
|
||||
run: |
|
||||
VERSION=$(awk '/static const char version/ { gsub(/[\";]/, "", $6); print $6; exit }' ttyrec.c)
|
||||
if ! head -n1 debian/changelog | grep -F "ovh-ttyrec ($VERSION) master"; then
|
||||
@@ -21,9 +21,22 @@ jobs:
|
||||
head -n1 debian/changelog
|
||||
exit 1
|
||||
fi
|
||||
if ! grep -F " $VERSION" ovh-ttyrec.spec; then
|
||||
echo "inconsistency between version ($VERSION) and rpm changelog:"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: install prerequisites
|
||||
run: sudo apt-get install -y uncrustify make git debhelper tar gzip
|
||||
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
|
||||
|
||||
- name: check style
|
||||
run: |
|
||||
@@ -79,22 +92,37 @@ jobs:
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: build rpm package
|
||||
run: |
|
||||
mkdir -p ~/rpmbuild/SOURCES
|
||||
mv ~/ovh-ttyrec.zip ~/rpmbuild/SOURCES/master.zip
|
||||
unzip -l ~/rpmbuild/SOURCES/master.zip
|
||||
rpmbuild -bb ovh-ttyrec.spec
|
||||
|
||||
- name: get release vars
|
||||
id: getvars
|
||||
run: |
|
||||
upload_url=$(jq -r '.release.upload_url' < $GITHUB_EVENT_PATH)
|
||||
echo "Upload URL is $upload_url"
|
||||
echo "::set-output name=upload_url::$upload_url"
|
||||
debname=$(basename $(ls ../ovh-ttyrec_*.deb))
|
||||
echo "Debian package name is $debname"
|
||||
echo "::set-output name=debian_package::$debname"
|
||||
rpmpath=$(readlink -f $(find ~/rpmbuild/RPMS -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"))
|
||||
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
|
||||
tar cvzf ovh-ttyrec-$version-linux-static-binary.tar.gz ovh-ttyrec-$version
|
||||
echo "Static tar.gz archive name is $debname"
|
||||
echo "::set-output name=static_package::ovh-ttyrec-$version-linux-static-binary.tar.gz"
|
||||
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
|
||||
@@ -103,17 +131,28 @@ jobs:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.getvars.outputs.upload_url }}
|
||||
asset_path: ../${{ steps.getvars.outputs.debian_package }}
|
||||
asset_name: ${{ steps.getvars.outputs.debian_package }}
|
||||
asset_path: ${{ steps.getvars.outputs.debpath }}
|
||||
asset_name: ${{ steps.getvars.outputs.debname }}
|
||||
asset_content_type: application/x-debian-package
|
||||
|
||||
- name: upload static binary
|
||||
- name: upload rpm package
|
||||
id: upload-release-asset2
|
||||
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_path: ${{ steps.getvars.outputs.rpmpath }}
|
||||
asset_name: ${{ steps.getvars.outputs.rpmname }}
|
||||
asset_content_type: application/x-rpm
|
||||
|
||||
- name: upload static binary
|
||||
id: upload-release-asset3
|
||||
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_content_type: application/gzip
|
||||
|
||||
@@ -34,10 +34,10 @@ dist:
|
||||
tar cvzf ttyrec.tar.gz *.c *.h docs/ debian/ configure Makefile.in uncrustify.cfg
|
||||
|
||||
install:
|
||||
install -d -m 0755 -o root -g root $(BIN)
|
||||
install -m 0755 -o root -g root ttyrec $(BIN)
|
||||
install -m 0755 -o root -g root ttyplay $(BIN)
|
||||
install -m 0755 -o root -g root ttytime $(BIN)
|
||||
install -d $(BIN)
|
||||
install ttyrec $(BIN)
|
||||
install ttyplay $(BIN)
|
||||
install ttytime $(BIN)
|
||||
|
||||
test: all
|
||||
./ttyrec -V
|
||||
|
||||
82
ovh-ttyrec.spec
Normal file
82
ovh-ttyrec.spec
Normal file
@@ -0,0 +1,82 @@
|
||||
Summary: Extended (but compatible) fork of ttyrec
|
||||
Name: ovh-ttyrec
|
||||
Version: 1.1.6.5
|
||||
Release: 1
|
||||
License: 3-Clause 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
|
||||
- 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
|
||||
|
||||
%prep
|
||||
|
||||
%setup -q -n ovh-ttyrec
|
||||
|
||||
%build
|
||||
STATIC=1 ./configure
|
||||
make RPM_OPT_FLAGS="$RPM_OPT_FLAGS"
|
||||
|
||||
%install
|
||||
make DESTDIR="$RPM_BUILD_ROOT" install
|
||||
|
||||
%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
|
||||
|
||||
%changelog
|
||||
* Thu 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
|
||||
- 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
|
||||
- fix: race condition on exit where ttyrec could get stuck
|
||||
|
||||
* Fri Jun 14 2019 Stéphane Lesimple (deb packages) <stephane.lesimple@corp.ovh.com> 1.1.6.1
|
||||
- enh: with -f, auto-append .zst if -Z or --zstd was specified
|
||||
- fix: allow usage of -f even if -F if specified
|
||||
|
||||
* Tue Jun 04 2019 Stéphane Lesimple (deb packages) <stephane.lesimple@corp.ovh.com> 1.1.6.0
|
||||
- feat: added generic fread/fwrite/fclose wrappers as a framework to support several (de)compression algorithms
|
||||
- feat: add zstd support to ttyrec and ttyplay
|
||||
ttyrec: add -Z option to enable on-the-fly compression if available
|
||||
ttyrec: add --zstd to force on-the-fly zstd compression
|
||||
ttyrec: add -l option to fine-tune the zstd compression ratio (between 1 and 19, default 3)
|
||||
ttyrec: add --max-flush-time to specify a number of seconds after which we force zstd to flush
|
||||
its output buffers to ensure somewhat idle sessions still get flushed to disk regularly
|
||||
ttyplay: zstd decompression is automatically enabled if the file suffix is ".zst"
|
||||
ttyplay: add -Z option to force on-the-fly zstd decompression regardless of the file suffix
|
||||
ttytime: add a warning if timing a .zst file is attempted (not supported)
|
||||
- feat: implement long-options parsing for ttyrec
|
||||
- feat: add --name-format (-F) to specify a custom file name compatible with strftime()
|
||||
- feat: add --warn-before-lock and --warn-before-kill options
|
||||
- fix: abort if doinput() can't write to master
|
||||
- chore: nicify termios debug output
|
||||
- chore: get rid of help2man requirement
|
||||
- chore: portability fixes, tested under Linux, FreeBSD, NetBSD, OpenBSD, DragonFlyBSD, Darwin, Haiku, OmniOS
|
||||
|
||||
* Thu May 09 2019 Stéphane Lesimple (deb packages) <stephane.lesimple@corp.ovh.com> 1.1.5.0
|
||||
- First public release
|
||||
- Add -c option to enable cheatcodes, as they're now disabled by default
|
||||
50
update-spec-file-changelog-from-debian.pl
Executable file
50
update-spec-file-changelog-from-debian.pl
Executable file
@@ -0,0 +1,50 @@
|
||||
#! /usr/bin/perl
|
||||
use strict;
|
||||
use warnings;
|
||||
use File::Copy;
|
||||
|
||||
my $ver;
|
||||
my @changes;
|
||||
my $changelog_fd;
|
||||
my $oldspec_fd;
|
||||
my $newspec_fd;
|
||||
my $first = 1;
|
||||
open($changelog_fd, '<', 'debian/changelog') or die $!;
|
||||
open($oldspec_fd, '<', 'ovh-ttyrec.spec') or die $!;
|
||||
open($newspec_fd, '>', 'ovh-ttyrec.spec.tmp') or die $!;
|
||||
|
||||
# first, copy all the old spec contents up to %changelog
|
||||
while (<$oldspec_fd>) {
|
||||
print $newspec_fd $_;
|
||||
if (/^%changelog/) { last; }
|
||||
}
|
||||
close($oldspec_fd);
|
||||
|
||||
while (<$changelog_fd>) {
|
||||
if (m{^ovh-ttyrec \(([^)]+)\)}) {
|
||||
$ver = $1;
|
||||
}
|
||||
elsif (m{^ -- (.+)\s+(...), (..) (...) (....)}) {
|
||||
my ($author,$wday,$day,$month,$year) = ($1,$2,$3,$4,$5);
|
||||
# from: Thu, 15 Sep 2020 10:59:22 +0200
|
||||
# to: Wed Nov 04 2020
|
||||
my $date = "$wday $month $day $year";
|
||||
if (@changes) { s/^\*/-/ for @changes; }
|
||||
print $newspec_fd "\n" if $first == 0;
|
||||
$first = 0;
|
||||
print $newspec_fd "* $date $author $ver\n";
|
||||
print $newspec_fd join("\n", @changes);
|
||||
print $newspec_fd "\n";
|
||||
undef $ver;
|
||||
@changes = ();
|
||||
}
|
||||
elsif (m{^ (\* .+)}) {
|
||||
push @changes, $1;
|
||||
}
|
||||
elsif (m{^ (.+)}) {
|
||||
push @changes, $1;
|
||||
}
|
||||
}
|
||||
close($changelog_fd);
|
||||
close($newspec_fd);
|
||||
move("ovh-ttyrec.spec.tmp", "ovh-ttyrec.spec");
|
||||
Reference in New Issue
Block a user