Compare commits

...

6 Commits

Author SHA1 Message Date
Gilles Grandou 4c9c879a26 wip 2023-12-04 14:10:53 +01:00
Gilles Grandou dc6a629570 wip 2023-12-04 14:10:47 +01:00
Gilles Grandou ff2a3e82ef wip 2023-12-04 13:48:27 +01:00
Gilles Grandou 4fa7999900 wip 2023-12-04 13:23:13 +01:00
Gilles Grandou d48890e4ec wip 2023-12-04 11:20:26 +01:00
Gilles Grandou d3efee62cd wip 2023-12-04 10:55:52 +01:00
6 changed files with 60 additions and 44 deletions

View File

@ -7,6 +7,7 @@ configdir=~/.config/runon
if [ "$1" == "--dev" ]; then
editable=--editable
devmode=1
fi
if [ ! -d $venvdir/bin/activate ]; then
@ -16,6 +17,7 @@ fi
source $venvdir/bin/activate
echo "populate $venvdir..."
python3 -m pip install --upgrade pip
python3 -m pip install wheel
python3 -m pip install $editable $srcdir
@ -25,7 +27,11 @@ ln -sf $venvdir/bin/runon $bindir/
echo "install base config in $configdir..."
mkdir -p $configdir
cp -p $srcdir/runon.default.yaml $configdir/
if [ -n "$devmode" ]; then
ln -s $srcdir/runon.default.yaml $configdir/
else
cp -p $srcdir/runon.default.yaml $configdir/
fi
echo "done."

View File

@ -13,10 +13,10 @@ debian_base: &debian_base
packages:
- xterm
- x11-apps
- build-essential
- vim-gtk3
- git
- libgtk2.0
- libgtk-3-0
- build-essential
- python3
- bash-completion
binds:
- /etc/timezone:ro
@ -26,7 +26,20 @@ debian_base: &debian_base
- USER
- DISPLAY
- TERM
- debian_chroot={osname}
- container={osname}
debian9:
<<: *debian_base
image: debian:9
dockerfile:
- ARG DEBIAN_FRONTEND=noninteractive
- RUN echo "deb http://archive.debian.org/debian stretch main" > /etc/apt/sources.list
- RUN apt-get update
- RUN apt-get -y upgrade
- RUN apt install -y --allow-downgrades libnettle6=3.3-1+b2 # default libnettle6 conflicts with libgtk-3.0
- RUN apt-get -y install sudo
- RUN echo "Defaults lecture = never" >> /etc/sudoers
- RUN echo "ALL ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
debian10:
<<: *debian_base
@ -46,27 +59,22 @@ ubuntu20.04:
ubuntu22.04:
<<: *debian_base
image: ubuntu22.04
image: ubuntu:22.04
rh_base: &rh_base
dockerfile:
- RUN dnf install -y dnf-plugins-core
- RUN dnf config-manager -y --set-enabled powertools
- RUN dnf install -y sudo
- RUN echo "Defaults lecture = never" >> /etc/sudoers
- RUN echo "ALL ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
- RUN dnf group install -y "Development Tools"
pkginstall:
"RUN dnf install -y {}"
packages:
- xterm
- xorg-x11-apps
- xkeyboard-config
- vim-X11
- git
- glibc-devel
- gtk2
- gtk3
- bash-completion
- python3
- bash-completion
binds:
- /etc/timezone:ro
- /etc/localtime:ro
@ -75,45 +83,25 @@ rh_base: &rh_base
- USER
- DISPLAY
- TERM
- debian_chroot={osname}
- container={osname}
centos7:
<<: *rh_base
image: centos:7
dockerfile:
- RUN yum install -y dnf-plugins-core
- RUN yum install -y sudo
- RUN echo "Defaults lecture = never" >> /etc/sudoers
- RUN echo "ALL ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
- RUN yum group install -y "Development Tools"
pkginstall:
"RUN yum install -y {}"
rocky8:
<<: *rh_base
image: rockylinux:8
dockerfile:
- RUN dnf install -y dnf-plugins-core
- RUN dnf config-manager -y --set-enabled powertools
- RUN dnf install -y sudo
- RUN echo "Defaults lecture = never" >> /etc/sudoers
- RUN echo "ALL ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
rocky9:
<<: *rh_base
image: rockylinux:9
dockerfile:
- RUN dnf install -y dnf-plugins-core
- RUN dnf install -y sudo
- RUN echo "Defaults lecture = never" >> /etc/sudoers
- RUN echo "ALL ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
packages:
- xterm
- xkeyboard-config
- git
- glibc-devel
- gtk2
- gtk3
- bash-completion
- python3

View File

@ -3,7 +3,7 @@ import os
import argparse
import getpass
import pathlib
import xdg_base_dirs
import xdg.BaseDirectory
import yaml
import json
import datetime
@ -16,8 +16,8 @@ def read_yaml(conf_name):
yaml_list = [
'runon.yaml',
'.runon.yaml',
os.path.join(xdg_base_dirs.xdg_config_home(), 'runon', 'runon.yaml')
os.path.join(xdg_base_dirs.xdg_config_home(), 'runon', 'runon.default.yaml')
os.path.join(xdg.BaseDirectory.xdg_config_home, 'runon', 'runon.yaml'),
os.path.join(xdg.BaseDirectory.xdg_config_home, 'runon', 'runon.default.yaml')
]
if conf_name:
yaml_list.insert(0, conf_name)
@ -40,7 +40,7 @@ def list_osnames(user_confname):
conf = read_yaml(user_confname)
osnames = []
for key in conf:
if (type(conf[key]) is dict) and conf[key].get('dockerfile'):
if (type(conf[key]) is dict) and conf[key].get('image'):
osnames.append(key)
return osnames
@ -75,7 +75,7 @@ def make_osname_link(binpath, osname):
def build_image(conf, update, verbose):
osname = conf.get('osname')
image_name = 'runon-{}'.format(osname)
cache_dir = os.path.join(xdg_base_dirs.xdg_cache_home(), 'runon')
cache_dir = os.path.join(xdg.BaseDirectory.xdg_cache_home, 'runon')
cache_file = os.path.join(cache_dir, image_name)
if not update and os.path.exists(cache_file):

View File

@ -9,9 +9,9 @@ setup(
packages = find_packages(),
python_requires = ">=3.6",
install_requires = [
"pathlib == 1.0.1",
"xdg_base_dirs == 6.0.1",
"pyyaml == 6.0.1",
"pathlib",
"pyxdg",
"pyyaml",
"pytz",
],
entry_points={

15
tests.sh Executable file
View File

@ -0,0 +1,15 @@
#!/bin/bash -e
cat /etc/os-release
echo
set -x
sudo id
python3 --version
g++ --version | head -1
gvim --version | head -1
xterm -e /bin/bash -c "sleep 1"
set +x
echo "[OK]"

View File

@ -3,6 +3,7 @@
srcdir=$(dirname $(readlink -f $0))
venvdir=~/.local/lib/runon
bindir=~/.local/bin
configdir=~/.config/runon
if [ -e $venvdir/bin/runon ]; then
echo "remove links from $bindir"
@ -13,3 +14,9 @@ if [ -d $venvdir ]; then
echo "remove virtualenv $venvdir"
rm -rf $venvdir
fi
if [ -e $configdir ]; then
echo "remove configs"
rm -vf $configdir/runon.default.yaml
rmdir --ignore-fail-on-non-empty -v $configdir
fi