Skip to content

Commit

Permalink
Merge pull request #1 from bossjones/feature-bump-gtk3-patch
Browse files Browse the repository at this point in the history
Feature: gtk3 updates
  • Loading branch information
bossjones authored Jun 23, 2017
2 parents ba680aa + 50a18d1 commit 3f226cd
Show file tree
Hide file tree
Showing 7 changed files with 258 additions and 18 deletions.
52 changes: 52 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# -*- coding: utf-8 -*-

matrix:
fast_finish: true
include:
- python: '3.5'
env:
DOCKER_COMPOSE_VERSION: 1.8.0
TEST_TARGET: default
DOCKER_DATA: "$HOME/docker_data"
DOCKER_VERSION: 17.03.1~ce-0~ubuntu-trusty
DOCKER_COMPOSE_VERSION: 1.8.0
sudo: required
dist: trusty
language: python
group: edge

services:
- docker

before_install:
- sudo apt-get update
- travis_retry pip install coveralls
- sudo apt-cache search docker
# List available docker versions.
- apt-cache madison docker-ce
- sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce=$DOCKER_VERSION
# Update Docker. See: https://graysonkoonce.com/managing-docker-and-docker-compose-versions-on-travis-ci/.
# - sudo apt-get -o Dpkg::Options::="--force-confnew" install -y --force-yes docker.io
# Add docker-compose at the version specified in ENV.
- sudo rm -f /usr/local/bin/docker-compose
- curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose
- chmod +x docker-compose
- sudo mv docker-compose /usr/local/bin
- docker-compose --version

cache:
apt: true

install:
- travis_retry docker-compose pull
# set containers as privileged to bypass Travis environment limitations
- 'sed -i "/build: ./a \ \ privileged: true" docker-compose.yml'

script:
- travis_retry docker-compose -f docker-compose.yml -f ci_build.yml build

# source: https://github.com/inspirehep/inspire-next/blob/9700274c36074a3e43168bf48b8ba3e3bfa7bcdf/.travis.yml
after_script:
# Killing via SIGTERM in order to trigger atexit and dump coverage information in WSGI
- "docker-compose -f docker-compose.yml kill -s SIGTERM"

145 changes: 127 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,16 @@ ENV PATH /usr/local/bin:/usr/local/sbin:$PATH

# http://bugs.python.org/issue19846
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
ENV USER "pi"
ENV USER_HOME "/home/${USER}"

# FIXME: DO NOT SET env var USER
ENV UNAME "pi"

# /home/pi
ENV USER_HOME "/home/${UNAME}"

# /home/pi/dev
ENV PROJECT_HOME "/home/${UNAME}/dev"

ENV LANG C.UTF-8
ENV SKIP_ON_TRAVIS yes
ENV CURRENT_DIR $(pwd)
Expand All @@ -25,19 +33,43 @@ ENV ENABLE_GTK yes
ENV PYTHON_VERSION_MAJOR 3
ENV PYTHON_VERSION 3.5
ENV CFLAGS "-fPIC -O0 -ggdb -fno-inline -fno-omit-frame-pointer"
ENV MAKEFLAGS "-j4"
ENV MAKEFLAGS "-j4 V=1"

# /home/pi/jhbuild
ENV PREFIX "${USER_HOME}/jhbuild"

# /home/pi/gnome
ENV JHBUILD "${USER_HOME}/gnome"

# /home/pi/.virtualenvs
ENV PATH_TO_DOT_VIRTUALENV "${USER_HOME}/.virtualenvs"

# /home/pi/jhbuild/bin:/home/pi/jhbuild/sbin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ENV PATH ${PREFIX}/bin:${PREFIX}/sbin:${PATH}

# /home/pi/.virtualenvs/scarlett_os/lib
ENV LD_LIBRARY_PATH ${PREFIX}/lib:${LD_LIBRARY_PATH}

# /home/pi/jhbuild/lib/python3.5/site-packages:/usr/lib/python3.5/site-packages
ENV PYTHONPATH ${PREFIX}/lib/python${PYTHON_VERSION}/site-packages:/usr/lib/python${PYTHON_VERSION}/site-packages

# /home/pi/.virtualenvs/scarlett_os/lib/pkgconfig
ENV PKG_CONFIG_PATH ${PREFIX}/lib/pkgconfig:${PREFIX}/share/pkgconfig:/usr/lib/pkgconfig

# /home/pi/jhbuild/share:/usr/share
ENV XDG_DATA_DIRS ${PREFIX}/share:/usr/share

# /home/pi/jhbuild/etc/xdg
ENV XDG_CONFIG_DIRS ${PREFIX}/etc/xdg

ENV PYTHON "python3"
ENV TERM xterm
ENV PACKAGES "python3-gi python3-gi-cairo"
ENV CC gcc

# FIXME: required for jhbuild( sudo apt-get install docbook-xsl build-essential git-core python-libxml2 )
# source: https://wiki.gnome.org/HowDoI/Jhbuild

RUN ln -fs /usr/share/zoneinfo/UTC /etc/localtime && \
dpkg-reconfigure -f noninteractive tzdata && \
sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
Expand Down Expand Up @@ -169,6 +201,17 @@ RUN ln -fs /usr/share/zoneinfo/UTC /etc/localtime && \
libllvm3.8 \
libsoundtouch-dev \
libsoundtouch1 \
# For general debugging
gdb \
strace \
lsof \
ltrace \
yelp-xsl \
docbook-xsl \
docbook-xsl-doc-html \
python-libxslt1 \
libxslt1-dev \
graphviz \
# end gst-plugins-bad req
ubuntu-restricted-extras && \
apt-get clean && \
Expand All @@ -177,52 +220,106 @@ RUN ln -fs /usr/share/zoneinfo/UTC /etc/localtime && \
rm -rf /var/lib/{cache,log}/ && \
rm -rf /var/lib/apt/lists/*.lz4 /tmp/* /var/tmp/*


# virtualenv stuff
ENV VIRTUALENVWRAPPER_PYTHON '/usr/local/bin/python3'
ENV VIRTUALENVWRAPPER_VIRTUALENV '/usr/local/bin/virtualenv'
ENV VIRTUALENV_WRAPPER_SH '/usr/local/bin/virtualenvwrapper.sh'

# Ensure that Python outputs everything that's printed inside
# the application rather than buffering it.
ENV PYTHONUNBUFFERED 1
ENV PYTHON_VERSION_MAJOR "3"
ENV GSTREAMER "1.0"
ENV USER "pi"
ENV USER_HOME "/home/${USER}"
ENV USER_HOME "/home/${UNAME}"
ENV LANGUAGE_ID 1473
ENV GITHUB_BRANCH "master"
ENV GITHUB_REPO_NAME "scarlett_os"
ENV GITHUB_REPO_ORG "bossjones"
ENV PI_HOME "/home/pi"

# /home/pi/dev/bossjones-github/scarlett_os
ENV MAIN_DIR "${PI_HOME}/dev/${GITHUB_REPO_ORG}-github/${GITHUB_REPO_NAME}"

# /home/pi/.virtualenvs/scarlett_os
ENV VIRT_ROOT "${PI_HOME}/.virtualenvs/${GITHUB_REPO_NAME}"

# /home/pi/.virtualenvs/scarlett_os/lib/pkgconfig
ENV PKG_CONFIG_PATH "${PI_HOME}/.virtualenvs/${GITHUB_REPO_NAME}/lib/pkgconfig"

# /home/pi/dev/bossjones-github/scarlett_os/tests/fixtures/.scarlett
ENV SCARLETT_CONFIG "${PI_HOME}/dev/${GITHUB_REPO_ORG}-github/${GITHUB_REPO_NAME}/tests/fixtures/.scarlett"
ENV SCARLETT_HMM "${PI_HOME}/dev/${GITHUB_REPO_ORG}-github/${GITHUB_REPO_NAME}/.virtualenvs/${GITHUB_REPO_NAME}/share/pocketsphinx/model/en-us/en-us"
ENV SCARLETT_LM "${PI_HOME}/dev/${GITHUB_REPO_ORG}-github/${GITHUB_REPO_NAME}/tests/fixtures/lm/${LANGUAGE_ID}.lm"
ENV SCARLETT_DICT "${PI_HOME}/dev/${GITHUB_REPO_ORG}-github/${GITHUB_REPO_NAME}/tests/fixtures/dict/${LANGUAGE_ID}.dic"

# /home/pi/dev/bossjones-github/scarlett_os/static/speech/hmm/en_US/hub4wsj_sc_8k
ENV SCARLETT_HMM "${PI_HOME}/dev/${GITHUB_REPO_ORG}-github/${GITHUB_REPO_NAME}/static/speech/hmm/en_US/hub4wsj_sc_8k"

# /home/pi/dev/bossjones-github/scarlett_os/static/speech/lm/1473.lm
ENV SCARLETT_LM "${PI_HOME}/dev/${GITHUB_REPO_ORG}-github/${GITHUB_REPO_NAME}/static/speech/lm/${LANGUAGE_ID}.lm"

# /home/pi/dev/bossjones-github/scarlett_os/static/speech/dict/1473.dic
ENV SCARLETT_DICT "${PI_HOME}/dev/${GITHUB_REPO_ORG}-github/${GITHUB_REPO_NAME}/static/speech/dict/${LANGUAGE_ID}.dic"

# /home/pi/.virtualenvs/repoduce_pytest_mock_issue_84/lib
ENV LD_LIBRARY_PATH "${PI_HOME}/.virtualenvs/${GITHUB_REPO_NAME}/lib"

# /home/pi/.virtualenvs/scarlett_os/lib/gstreamer-1.0
ENV GST_PLUGIN_PATH "${PI_HOME}/.virtualenvs/${GITHUB_REPO_NAME}/lib/gstreamer-${GSTREAMER}"
ENV PYTHON "/usr/local/bin/python3"
ENV PYTHON_VERSION "3.5"
ENV VIRTUALENVWRAPPER_PYTHON "/usr/local/bin/python3"
ENV VIRTUALENVWRAPPER_VIRTUALENV "/usr/local/bin/virtualenv"
ENV VIRTUALENVWRAPPER_SCRIPT "/usr/local/bin/virtualenvwrapper.sh"

# /home/pi/.pythonrc
ENV PYTHONSTARTUP "${USER_HOME}/.pythonrc"
ENV PIP_DOWNLOAD_CACHE "${USER_HOME}/.pip/cache"

# /home/pi/.virtualenvs/scarlett_os
ENV WORKON_HOME "${VIRT_ROOT}"

############################[BEGIN - USER]##############################################
RUN set -xe \
&& useradd -U -d ${PI_HOME} -m -r -G adm,sudo,dip,plugdev,tty,audio ${USER} \
&& usermod -a -G ${USER} ${USER} \
&& useradd -U -d ${PI_HOME} -m -r -G adm,sudo,dip,plugdev,tty,audio ${UNAME} \
&& usermod -a -G ${UNAME} ${UNAME} \
&& mkdir -p ${PI_HOME}/dev/${GITHUB_REPO_ORG}-github \
&& mkdir -p ${PI_HOME}/dev/${GITHUB_REPO_ORG}-github/${GITHUB_REPO_NAME} \
&& mkdir -p ${MAIN_DIR} \
&& chown -hR ${USER}:${USER} ${MAIN_DIR} \
&& chown -hR ${UNAME}:${UNAME} ${MAIN_DIR} \
&& echo 'pi ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers \
&& echo '%pi ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers \
&& cat /etc/sudoers

USER pi
USER $UNAME

WORKDIR /home/$UNAME

ENV HOME "/home/$UNAME"
############################[END - USER]################################################

# ENV UNAME pacat

# RUN apt-get update \
# && DEBIAN_FRONTEND=noninteractive apt-get install --yes pulseaudio-utils

# # Set up the user
# RUN export UNAME=$UNAME UID=1000 GID=1000 && \
# mkdir -p "/home/${UNAME}" && \
# echo "${UNAME}:x:${UID}:${GID}:${UNAME} User,,,:/home/${UNAME}:/bin/bash" >> /etc/passwd && \
# echo "${UNAME}:x:${UID}:" >> /etc/group && \
# mkdir -p /etc/sudoers.d && \
# echo "${UNAME} ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/${UNAME} && \
# chmod 0440 /etc/sudoers.d/${UNAME} && \
# chown ${UID}:${GID} -R /home/${UNAME} && \
# gpasswd -a ${UNAME} audio

# COPY pulse-client.conf /etc/pulse/client.conf

# USER $UNAME
# ENV HOME /home/pacat

# # run
# CMD ["pacat", "-vvvv", "/dev/urandom"]

WORKDIR /home/pi

# Create a basic .jhbuildrc
RUN echo "import os" > /home/pi/.jhbuildrc && \
Expand All @@ -231,14 +328,15 @@ RUN echo "import os" > /home/pi/.jhbuildrc &&
echo "moduleset = 'gnome-world'" >> /home/pi/.jhbuildrc && \
echo "interact = False" >> /home/pi/.jhbuildrc && \
echo "makeargs = '$MAKEFLAGS'" >> /home/pi/.jhbuildrc && \
echo "module_autogenargs['gtk-doc'] = 'PYTHON=/usr/bin/python3'" >> /home/pi/.jhbuildrc && \
echo "os.environ['CFLAGS'] = '$CFLAGS'" >> /home/pi/.jhbuildrc && \
echo "os.environ['PYTHON'] = 'python$PYTHON_VERSION_MAJOR'" >> /home/pi/.jhbuildrc && \
echo "os.environ['GSTREAMER'] = '1.0'" >> /home/pi/.jhbuildrc && \
echo "os.environ['ENABLE_PYTHON3'] = 'yes'" >> /home/pi/.jhbuildrc && \
echo "os.environ['ENABLE_GTK'] = 'yes'" >> /home/pi/.jhbuildrc && \
echo "os.environ['PYTHON_VERSION'] = '$PYTHON_VERSION'" >> /home/pi/.jhbuildrc && \
echo "os.environ['CFLAGS'] = '-fPIC -O0 -ggdb -fno-inline -fno-omit-frame-pointer'" >> /home/pi/.jhbuildrc && \
echo "os.environ['MAKEFLAGS'] = '-j4'" >> /home/pi/.jhbuildrc && \
echo "os.environ['MAKEFLAGS'] = '-j4 V=1'" >> /home/pi/.jhbuildrc && \
echo "os.environ['PREFIX'] = '$USER_HOME/jhbuild'" >> /home/pi/.jhbuildrc && \
echo "os.environ['JHBUILD'] = '$USER_HOME/gnome'" >> /home/pi/.jhbuildrc && \
echo "os.environ['PATH'] = '$PREFIX/bin:$PREFIX/sbin:$PATH'" >> /home/pi/.jhbuildrc && \
Expand All @@ -256,6 +354,7 @@ RUN echo "import os" > /home/pi/.jhbuildrc &&
echo "os.environ['PIP_DOWNLOAD_CACHE'] = '$USER_HOME/.pip/cache'" >> /home/pi/.jhbuildrc && \
cat /home/pi/.jhbuildrc


# jhbuild
RUN mkdir -p /home/pi/gnome && \

Expand Down Expand Up @@ -295,15 +394,15 @@ RUN mkdir -p /home/pi/gnome && \
cd /home/pi/gnome && \
cd pygobject && \
git checkout fb1b8fa8a67f2c7ea7ad4b53076496a8f2b4afdb && \
jhbuild run ./autogen.sh --prefix=/home/pi/jhbuild --with-python=python3 > /dev/null && \
jhbuild run ./autogen.sh --prefix=/home/pi/jhbuild --with-python=$(which python3) > /dev/null && \
jhbuild run make install > /dev/null && \

echo "****************[GSTREAMER]****************" && \
cd /home/pi/gnome && \
curl -L "https://gstreamer.freedesktop.org/src/gstreamer/gstreamer-1.8.2.tar.xz" > gstreamer-1.8.2.tar.xz && \
tar -xJf gstreamer-1.8.2.tar.xz && \
cd gstreamer-1.8.2 && \
jhbuild run ./configure --prefix=/home/pi/jhbuild > /dev/null && \
jhbuild run ./configure --enable-doc-installation=no --prefix=/home/pi/jhbuild > /dev/null && \
jhbuild run make -j4 > /dev/null && \
jhbuild run make install > /dev/null && \

Expand Down Expand Up @@ -345,6 +444,7 @@ RUN mkdir -p /home/pi/gnome && \

echo "****************[GST-PLUGINS-BAD]****************" && \
cat /home/pi/jhbuild/bin/gdbus-codegen && \
export BOSSJONES_PATH_TO_PYTHON=$(which python3) && \
sed -i "s,#!python3,#!/usr/bin/python3,g" /home/pi/jhbuild/bin/gdbus-codegen && \
cat /home/pi/jhbuild/bin/gdbus-codegen && \
cd /home/pi/gnome && \
Expand Down Expand Up @@ -394,13 +494,22 @@ RUN mkdir -p /home/pi/gnome && \
jhbuild run ./autogen.sh --prefix=/home/pi/jhbuild > /dev/null && \
jhbuild run ./configure --prefix=/home/pi/jhbuild > /dev/null && \
jhbuild run make clean all > /dev/null && \
jhbuild run make install > /dev/null
jhbuild run make install > /dev/null && \

echo "****************[GDBINIT]****************" && \
sudo zcat /usr/share/doc/python3.5/gdbinit.gz > /home/pi/.gdbinit && \
sudo chown pi:pi /home/pi/.gdbinit && \

echo "****************[GSTREAMER-COMPLETION]****************" && \
curl -L 'https://raw.githubusercontent.com/drothlis/gstreamer/bash-completion-master/tools/gstreamer-completion' | sudo tee -a /etc/bash_completion.d/gstreamer-completion && \
sudo chown root:root /etc/bash_completion.d/gstreamer-completion



# Overlay the root filesystem from this repo
COPY ./container/root /

RUN goss -g /tests/goss.jhbuild.yaml validate
RUN goss -g /tests/goss.jhbuild.yaml validate --retry-timeout 30s --sleep 1s

# NOTE: intentionally NOT using s6 init as the entrypoint
# This would prevent container debugging if any of those service crash
Expand Down
15 changes: 15 additions & 0 deletions FIXME.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# unable to set CAP_SETFCAP effective capability: Operation not permitted

```
[0mI: Modulesets were edited locally but JHBuild is configured to get them from the network, perhaps you need to add use_local_modulesets = True to your /home/pi/.jhbuildrc.
libtool: warning: relinking 'libgstbase-1.0.la'
libtool: warning: relinking 'libgstcontroller-1.0.la'
libtool: warning: relinking 'libgstnet-1.0.la'
libtool: warning: relinking 'libgstcheck-1.0.la'
unable to set CAP_SETFCAP effective capability: Operation not permitted
make[5]: [install-data-hook] Error 1 (ignored)
libtool: warning: relinking 'libgstcoreelements.la'
libtool: warning: relinking 'libgstcoretracers.la'
```

https://unix.stackexchange.com/questions/106336/unable-to-set-capability-cap-setfcap-by-user
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# boss-docker-gnome-pygobject-gtk3-gst-cmusphinx-jhbuild

[![Build Status](https://travis-ci.org/bossjones/boss-docker-jhbuild-pygobject3.svg?branch=master)](https://travis-ci.org/bossjones/boss-docker-jhbuild-pygobject3)

NOTE: This is a prereq for `scarlett_os`. It makes some strong assumptions about how you plan on running jhbuild, and should mainly just run on CI systems.

Docker container that installs an jhbuild environment that has the following:
Expand Down
41 changes: 41 additions & 0 deletions RESEARCH.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# When to use exec?

`source: `

`exec` replaces the current program in the current process, without forking a new process. It is not something you would use in every script you write, but it comes in handy on occasion. Here are some scenarios I have used it;

1. We want the user to run a specific application program without access to the shell. We could change the sign-in program in /etc/passwd, but maybe we want environment setting to be used from start-up files. So, in (say) .profile, the last statement says something like:

`exec appln-program`

so now there is no shell to go back to. Even if appln-program crashes, the end-user cannot get to a shell, because it is not there - the exec replaced it.

2. We want to use a different shell to the one in /etc/passwd. Stupid as it may seem, some sites do not allow users to alter their sign-in shell. One site I know had everyone start with csh, and everyone just put into their .login (csh start-up file) a call to ksh. While that worked, it left a stray csh process running, and the logout was two stage which could get confusing. So we changed it to exec ksh which just replaced the c-shell program with the korn shell, and made everything simpler (there are other issues with this, such as the fact that the ksh is not a login-shell).

3. Just to save processes. If we call prog1 -> prog2 -> prog3 -> prog4 etc. and never go back, then make each call an exec. It saves resources (not much, admittedly, unless repeated) and makes shutdown simplier.
You have obviously seen exec used somewhere, perhaps if you showed the code that's bugging you we could justify its use.

Edit: I realised that my answer above is incomplete. There are two uses of exec in shells like ksh and bash - used for opening file descriptors. Here are some examples:

```
exec 3< thisfile # open "thisfile" for reading on file descriptor 3
exec 4> thatfile # open "thatfile" for writing on file descriptor 4
exec 8<> tother # open "tother" for reading and writing on fd 8
exec 6>> other # open "other" for appending on file descriptor 6
exec 5<&0 # copy read file descriptor 0 onto file descriptor 5
exec 7>&4 # copy write file descriptor 4 onto 7
exec 3<&- # close the read file descriptor 3
exec 6>&- # close the write file descriptor 6
```

Note that spacing is very important here. If you place a space between the fd number and the redirection symbol then exec reverts to the original meaning:


`exec 3 < thisfile # oops, overwrite the current program with command "3"`

There are several ways you can use these, on ksh use read -u or print -u, on bash, for example:

```
read <&3
echo stuff >&4
```
Loading

0 comments on commit 3f226cd

Please sign in to comment.