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

RedOS and Python3 #44

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
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
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ install-notmodule:
cp -R distros/* $(DESTDIR)$(SYSCONFDIR)/yumbootstrap/suites

tarball:
python setup.py sdist --formats=zip
python3 setup.py sdist --formats=zip

egg:
python setup.py bdist_egg
python3 setup.py bdist_egg

clean:
python setup.py clean --all
python3 setup.py clean --all
rm -rf dist lib/*.egg-info
# rm -rf $(SPHINX_DOCTREE) $(SPHINX_OUTPUT)

Expand Down
8 changes: 4 additions & 4 deletions bin/yumbootstrap
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3

import os
import sys
Expand Down Expand Up @@ -361,7 +361,7 @@ def do_install(opts, suite_name, target):

def do_list_suites(opts):
for suite in yumbootstrap.suites.list_suites(opts.suite_dir):
print suite
print(suite)

#-----------------------------------------------------------

Expand All @@ -371,7 +371,7 @@ def do_list_scripts(opts, target):
else:
suite = read_cached_suite(target)
for name in suite.post_install.names():
print name
print(name)

#-----------------------------------------------------------

Expand Down Expand Up @@ -429,4 +429,4 @@ except YBError, e:
sys.exit(e.code)

#-----------------------------------------------------------------------------
# vim:ft=python
# vim:ft=python3
31 changes: 31 additions & 0 deletions distros/gpg/RPM-GPG-KEY-RED-SOFT
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v2.0.22 (GNU/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3PaVUpb2bQ7ohplF9E9H
VejsvTEhgSdyJh301KaqyMvTmaZpFZaiy7GjV18GI/fGfFZM4kENkcUp37GC1f64
NjgLYntgQ/vplL3dTO1tNV0nAbWtZO64Mg5Gbme0dt97BJicgmJXlZJrqKtMV80A
EQEAAYkBHwQYAQIACQUCWR6ZoAIbDAAKCRALV/Fn+KwY7t/YCADOlIVdMYNlrEPB
Mn6U+IbVHuEStaZfnRYjur9XDCyWEI965yN1/UJ40aH4jHlG2Y0Ka7Vep6uP0Zto
Q0gAHcn+CI38YBegnjs9pomUSopDm3L7jx7hVKRr0z6b0gPEKUXSWxaLa9f0/k6/
DY3kVSvxF8cdY9jstVQuGeC04dfZdJKDyc0ZXNKd6WC+ABLiI0+Vk08xrWR81H8T
B4gFLG0U0EMNkjq5u8sygCL7YL0/YebaiMSDtSuSX2JXnkDDwThQ6p2Fas4Csmxm
7OvuZQIYYZUgurPbRsMYDHiDA8jhCEkpxxnz5RMMF0/9sUXtcvnU3sPdGObHg1tY
+ulLukIs
=QS0H
-----END PGP PUBLIC KEY BLOCK-----
18 changes: 18 additions & 0 deletions distros/packages/common-redos.list
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# subset from @Core
coreutils
bash
grep
gawk
basesystem
rpm
initscripts
iproute
less
make
mktemp
vim-minimal
yum
redos-release

# required to fix RPM DB
/usr/bin/db_load
1 change: 1 addition & 0 deletions distros/packages/redos-7.list
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
common-redhat.list
22 changes: 22 additions & 0 deletions distros/redos-7.suite
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name = RedOS
release = 7

gpg_key = gpg/RPM-GPG-KEY-RED-SOFT

packages = packages/common-redos.list

[post_install]
finalize = scripts/fix_rpmdb.py
finalize = scripts/clean_yumbootstrap.py

[repositories]
base = https://repo1.red-soft.ru/redos/7.3/$basearch/os,https://mirror.yandex.ru/redos/7.3/$basearch/os,http://repo.red-soft.ru/redos/7.3/$basearch/os
kernels = https://repo1.red-soft.ru/redos/7.3/$basearch/kernels,https://mirror.yandex.ru/redos/7.3/$basearch/kernels,http://repo.red-soft.ru/redos/7.3/$basearch/kernels
updates = https://repo1.red-soft.ru/redos/7.3/$basearch/updates,https://mirror.yandex.ru/redos/7.3/$basearch/updates,http://repo.red-soft.ru/redos/7.3/$basearch/updates

[environment]
#PYTHONPATH=...
#PYTHONPATH
#SUDO_*

# vim:ft=dosini
4 changes: 2 additions & 2 deletions distros/scripts/clean_yumbootstrap.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3

import os
import time
Expand All @@ -7,5 +7,5 @@
target = os.environ['TARGET']
yumbootstrap_dir = os.environ['YUMBOOTSTRAP_DIR']
if os.environ['VERBOSE'] == 'true':
print time.strftime('[%T] ') + 'removing yumbootstrap directory from target'
print(time.strftime('[%T] ') + 'removing yumbootstrap directory from target')
shutil.rmtree(os.path.join(target, yumbootstrap_dir))
4 changes: 2 additions & 2 deletions distros/scripts/fix_rpmdb.old-rpm.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3

import os
import time
Expand All @@ -22,4 +22,4 @@
yum.fix_rpmdb(expected_rpmdb_dir = '/var/lib/rpm')

#-----------------------------------------------------------------------------
# vim:ft=python
# vim:ft=python3
4 changes: 2 additions & 2 deletions distros/scripts/fix_rpmdb.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3

import os
import time
Expand Down Expand Up @@ -27,4 +27,4 @@
yum.fix_rpmdb()

#-----------------------------------------------------------------------------
# vim:ft=python
# vim:ft=python3
4 changes: 2 additions & 2 deletions examples/scripts/clean_yumbootstrap.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3

import os
import time
Expand All @@ -7,5 +7,5 @@
target = os.environ['TARGET']
yumbootstrap_dir = os.environ['YUMBOOTSTRAP_DIR']
if os.environ['VERBOSE'] == 'true':
print time.strftime('[%T] ') + 'removing yumbootstrap directory from target'
print(time.strftime('[%T] ') + 'removing yumbootstrap directory from target')
shutil.rmtree(os.path.join(target, yumbootstrap_dir))
2 changes: 1 addition & 1 deletion examples/scripts/fix_rpmdb.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3

import os
import time
Expand Down
4 changes: 2 additions & 2 deletions lib/yumbootstrap/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/python
#!/usr/bin/python3

#-----------------------------------------------------------------------------

#-----------------------------------------------------------------------------
# vim:ft=python
# vim:ft=python3
4 changes: 2 additions & 2 deletions lib/yumbootstrap/bdb.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3

import sys
import bsddb
Expand Down Expand Up @@ -34,4 +34,4 @@ def db_dump(filename, outfile = sys.stdout):
outfile.write("DATA=END\n")

#-----------------------------------------------------------------------------
# vim:ft=python
# vim:ft=python3
4 changes: 2 additions & 2 deletions lib/yumbootstrap/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3

#-----------------------------------------------------------------------------

Expand Down Expand Up @@ -28,4 +28,4 @@ def __repr__(self):
return "<YBError (%d)>" % (self._exit)

#-----------------------------------------------------------------------------
# vim:ft=python
# vim:ft=python3
6 changes: 3 additions & 3 deletions lib/yumbootstrap/log.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3

import logging
import time
Expand All @@ -7,7 +7,7 @@

class ProgressHandler(logging.Handler):
def emit(self, record):
print time.strftime('[%T] ') + record.getMessage()
print(time.strftime('[%T] ') + record.getMessage())

#-----------------------------------------------------------------------------
# vim:ft=python
# vim:ft=python3
4 changes: 2 additions & 2 deletions lib/yumbootstrap/sh.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3

import os
import subprocess
Expand Down Expand Up @@ -99,4 +99,4 @@ def chroot_fun(*args):
return OutPipe(command[0], proc)

#-----------------------------------------------------------------------------
# vim:ft=python
# vim:ft=python3
4 changes: 2 additions & 2 deletions lib/yumbootstrap/suites.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3

import re
import os
Expand Down Expand Up @@ -375,4 +375,4 @@ def read(self, filename):
section.add(**groups)

#-----------------------------------------------------------------------------
# vim:ft=python
# vim:ft=python3
6 changes: 3 additions & 3 deletions lib/yumbootstrap/yum.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3

import rpm as rpm_mod
import os
Expand Down Expand Up @@ -151,7 +151,7 @@ def fix_rpmdb(self, expected_rpmdb_dir = None,
current_rpmdb_dir = rpm_mod.expandMacro('%{_dbpath}')
if expected_rpmdb_dir is None:
expected_rpmdb_dir = sh.run(
['python', '-c', 'import rpm; print rpm.expandMacro("%{_dbpath}")'],
['python3', '-c', 'import rpm; print(rpm.expandMacro("%{_dbpath}"))'],
chroot = self.chroot,
pipe = sh.READ,
env = self.yum_conf.env,
Expand Down Expand Up @@ -197,4 +197,4 @@ def fix_rpmdb(self, expected_rpmdb_dir = None,
self.rpmdb_fixed = True

#-----------------------------------------------------------------------------
# vim:ft=python
# vim:ft=python3
14 changes: 7 additions & 7 deletions redhat/yumbootstrap.spec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
%define _release 1
%define _packager Stanislaw Klekot <[email protected]>

%define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")
%define python3_sitearch %(%{__python3} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")


Summary: yumbootstrap - chroot installer for Red Hat derivatives
Name: yumbootstrap
Expand All @@ -12,11 +13,10 @@ Group: Development/Tools
License: GPL v3
Source0: yumbootstrap-%{_version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-root
URL: http://dozzie.jarowit.net/trac/wiki/yumbootstrap
BuildArch: noarch
Packager: %{_packager}
Prefix: %{_prefix}
BuildRequires: python-setuptools
BuildRequires: python3-setuptools
Requires: yum >= 3.0

%description
Expand All @@ -28,11 +28,11 @@ debootstrap.
%setup -q

%build
CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build
CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build

%install
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "$RPM_BUILD_ROOT"
%{__python} setup.py install --root "$RPM_BUILD_ROOT"
%{__python3} setup.py install --root "$RPM_BUILD_ROOT"
make install-notmodule \
DESTDIR="$RPM_BUILD_ROOT" \
BINDIR=%{_sbindir} SYSCONFDIR=%{_sysconfdir}
Expand All @@ -51,8 +51,8 @@ cp KNOWN_ISSUES.md LICENSE README.md SUITES.md TODO \
%{_sysconfdir}/yumbootstrap
#%{_mandir}/man8
%{_docdir}/yumbootstrap-%{_version}
%{python_sitearch}/yumbootstrap
%{python_sitearch}/yumbootstrap-*.egg-info
%{python3_sitearch}/yumbootstrap
%{python3_sitearch}/yumbootstrap-*.egg-info


# %changelog
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3

from setuptools import setup, find_packages
from glob import glob
Expand Down