Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libslz: testing #2

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
language: generic

sudo: required

services:
- docker

env:
matrix:
- MOCK_CONFIG=fedora-rawhide-x86_64

script:
- PKG=$(git log -1 --pretty=%s | sed 's/:.*//')
- if [[ ! -d ${PKG} ]]; then echo "Directory ${PKG} not found"; exit 1; fi
- if [[ ! -f ${PKG}/${PKG}.spec ]]; then echo "No spec file (${PKG}.spec found in directory ${PKG}"; exit 1; fi
- |
{
H="/travis/${PKG}"
echo "#!/bin/bash -xe"
echo "dnf -q -y install fedora-review"
echo "rpmbuild -D'_sourcedir ${H}' -D'_srcrpmdir ${H}' -bs ${H}/${PKG}.spec"
echo "useradd -d ${H} -g mock review"
echo "chown -R review:mock ${H}"
echo "/travis/spinner.sh \"su - -c 'fedora-review -v --mock-config ${MOCK_CONFIG} -n ${PKG}' review\" || { cat ${H}/.cache/fedora-review.log; find ${H}/review-${PKG} -name '*.log' -print -exec cat {} \\;; exit 1; }"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The whole spinner.sh stuff there is needed as fedora-review has no --progress option (see https://pagure.io/FedoraReview/issue/277) and Travis just dies after 10min without output. Also fedora-review won't print the log files if it fails.

echo "find ${H}/review-${PKG} -name '*.log' -print -exec cat {} \\;"
echo "cat ${H}/review-${PKG}/licensecheck.txt"
echo "cat ${H}/review-${PKG}/review.txt"
} > review.sh
- chmod +x review.sh
- docker run --privileged -v "${PWD}:/travis:rw" -it fedora:latest /travis/review.sh

after_success:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can basically ignore that whole block for now. In my setup at https://github.com/junghans/fedora-review, Travis will automatically upload the spec file,review.txt and the src.rpm to github.io, so one can directly paste it into a review bug.

We could do the same here, but that would need some more Travis setup, namely encrypting the private key of a deploy key with the Travis public key (Travis CLI: travis encrypt-file id_rsa.private).

- git config --global user.name "Automatic Deployment (Travis CI)"
- git config --global user.email "[email protected]"
- git fetch origin gh-pages && git checkout -b gh-pages FETCH_HEAD
- cd ${PKG}
- rm -f ${PKG}*.src.rpm
- git checkout ${TRAVIS_COMMIT} -- ./${PKG}.spec
- cp review-${PKG}/review.txt .
- cp review-${PKG}/results/${PKG}*.src.rpm .
- git add ${PKG}.spec ${PKG}*.src.rpm review.txt
- git diff HEAD -- ${PKG}.spec review.txt | cat
- if [[ ${encrypted_404fa93e7e35_key} && ${encrypted_404fa93e7e35_iv} && ${TRAVIS_BRANCH} == master ]]; then
git commit -m "Review output";
mkdir -p ~/.ssh;
chmod 700 ~/.ssh;
openssl aes-256-cbc -K $encrypted_404fa93e7e35_key -iv $encrypted_404fa93e7e35_iv -in ../deploy.enc -out ~/.ssh/id_rsa -d;
chmod 600 ~/.ssh/id_rsa;
git push [email protected]:${TRAVIS_REPO_SLUG} gh-pages:gh-pages;
echo "###################################################";
echo "Spec URL http://${TRAVIS_REPO_SLUG%/*}.github.io/${TRAVIS_REPO_SLUG#*/}/${PKG}/${PKG}.spec";
echo "SRPM URL http://${TRAVIS_REPO_SLUG%/*}.github.io/${TRAVIS_REPO_SLUG#*/}/${PKG}/$(echo ${PKG}*.src.rpm)";
echo "Review.txt http://${TRAVIS_REPO_SLUG%/*}.github.io/${TRAVIS_REPO_SLUG#*/}/${PKG}/review.txt";
echo "Build log https://travis-ci.org/${TRAVIS_REPO_SLUG}/builds/${TRAVIS_BUILD_ID}";
echo "Raw Build log https://s3.amazonaws.com/archive.travis-ci.org/jobs/$((${TRAVIS_BUILD_ID}+1))/log.txt";
echo "###################################################";
else
git status;
fi
Binary file added libslz/libslz-1.1.0.tar.gz
Binary file not shown.
79 changes: 79 additions & 0 deletions libslz/libslz.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
Name: libslz
Version: 1.1.0
Release: 1%{?dist}
Summary: StateLess Zip

Group: System Environment/Libraries
License: MIT
# TODO when upstream is ready
# URL: http://libslz.org/
URL: http://1wt.eu/projects/libslz/
# The tarball is currently generated manually until source tarballs
# are distributed upstream:
# V=%%version
# git archive --format=tgz --prefix=libtgz-$V/ --output=libslz-$V.tar.gz v$V
Source: http://git.1wt.eu/web?p=%{name}.git;a=snapshot;h=v%{version};sf=tgz#/%{name}-%{version}.tar.gz

BuildRequires: gcc

%description
SLZ is a fast and memory-less stream compressor which produces an output that
can be decompressed with zlib or gzip. It does not implement decompression at
all, zlib is perfectly fine for this.

The purpose is to use SLZ in situations where a zlib-compatible stream is
needed and zlib's resource usage would be too high while the compression ratio
is not critical. The typical use case is in HTTP servers and gateways which
have to compress many streams in parallel with little CPU resources to assign
to this task, and without having to limit the compression ratio due to the
memory usage. In such an environment, the server's memory usage can easily be
divided by 10 and the CPU usage by 3.


%package devel

Summary: Development files for %{name}
Requires: %{name}%{?_isa} = %{version}-%{release}


%description devel
Development files for SLZ, the zenc and zdec commands that respectively
compress using SLZ and dump the decoding process.


%prep
%setup -q -n %{name}


%build
%make_build CFLAGS="%{optflags}" LDFLAGS="%__global_ldflags"


%install
strip libslz.so.1
%make_install PREFIX=%{_prefix} LIBDIR=%{_libdir}
chmod +x %{buildroot}%{_libdir}/*.so.*
rm %{buildroot}%{_libdir}/*.a


%files
%doc README
%license LICENSE
%{_libdir}/*.so.*


%files devel
%{_libdir}/*.so
%{_bindir}/*
%{_includedir}/*


%post -p /sbin/ldconfig


%postun -p /sbin/ldconfig


%changelog
* Sun Sep 25 2016 - Dridi Boukelmoune <[email protected]> - 1.1.0-1
- Initial spec.
26 changes: 26 additions & 0 deletions spinner.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash
# Small spinner script, that returns exit code of CMD and keeps colored output
# Usage: ./spinner CMD

spinner() {
local PID=$1
local SPIN="/-\|"
local i=0
while kill -0 $PID >/dev/null 2>&1; do
printf "\r%s" "${SPIN:$i:1}"
i=$(($i+1))
[[ $i -eq 4 ]] && i=0
sleep 0.5;
done
}

cat /tmp/update 2>/dev/null
$(script -q -e /dev/null -c "${@} 2>&1" >/tmp/output) &
PID=$!
spinner "${PID}" &
wait ${PID}
RC=$?
sleep 30
printf "\r"
cat /tmp/output
exit $RC