Skip to content

Commit

Permalink
Merge pull request #6221 from uyuni-project/revert-5654-rhnpush-deb-p…
Browse files Browse the repository at this point in the history
…ackages

Revert "Properly handling of Debian packages in rhnpush"
  • Loading branch information
ycedres authored Nov 28, 2022
2 parents a2c53d0 + 80d15fe commit 02269dc
Show file tree
Hide file tree
Showing 25 changed files with 29 additions and 459 deletions.
31 changes: 0 additions & 31 deletions .github/workflows/mgrpush-unit-tests.yml

This file was deleted.

19 changes: 0 additions & 19 deletions client/tools/mgr-push/Makefile.python
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,18 @@ THIS_MAKEFILE := $(realpath $(lastword $(MAKEFILE_LIST)))
CURRENT_DIR := $(dir $(THIS_MAKEFILE))
include $(CURRENT_DIR)../../../rel-eng/Makefile.python

MGRPUSH_ROOT_DIR := $(shell mktemp -d)
RHNPUSH_PACKAGE_DIR := $(MGRPUSH_ROOT_DIR)/rhnpush
PYTHONPATH := /manager/python/:/manager/client/rhel/spacewalk-client-tools/src/

# Docker tests variables
DOCKER_REF = $(DOCKER_REGISTRY)/$(DOCKER_IMAGE)
DOCKER_CONTAINER_BASE = systemsmanagement/uyuni/master/docker/containers/uyuni-master
DOCKER_REGISTRY = registry.opensuse.org
DOCKER_RUN_EXPORT = "PYTHONPATH=$PYTHONPATH"
DOCKER_VOLUMES = -v "$(CURDIR)/../../../:/manager"

define setup_structure
mkdir $(RHNPUSH_PACKAGE_DIR)
cd /manager/client/tools/mgr-push/src/rhnpush && cp archive.py connection.py rhnpush_cache.py rhnpush_config.py rhnpush_confmanager.py rhnpush_main.py rhnpush_v2.py rpm2mpm.py uploadLib.py utils.py $(RHNPUSH_PACKAGE_DIR)
touch $(RHNPUSH_PACKAGE_DIR)/__init__.py
endef

__pytest ::
$(call setup_structure)
export PYTHONPATH=$(MGRPUSH_ROOT_DIR):$(PYTHONPATH) && pytest --disable-warnings --tb=native --color=yes -v

__pylint ::
$(call update_pip_env)
pylint --rcfile=pylintrc $(shell find -name '*.py') > reports/pylint.log || true

docker_pylint ::
docker run --rm -e $(DOCKER_RUN_EXPORT) $(DOCKER_VOLUMES) $(DOCKER_REGISTRY)/$(DOCKER_CONTAINER_BASE)-pgsql /bin/sh -c "cd /manager/client/tools/mgr-push; make -f Makefile.python __pylint"

docker_pytest ::
docker pull $(DOCKER_REF)
docker run -e $(DOCKER_RUN_EXPORT) $(DOCKER_VOLUMES) $(DOCKER_REF) /bin/sh -c "cd /manager/client/tools/mgr-push; make -f Makefile.python __pytest"

docker_shell ::
docker run -t -i --rm -e $(DOCKER_RUN_EXPORT) $(DOCKER_VOLUMES) $(DOCKER_REGISTRY)/$(DOCKER_CONTAINER_BASE)-pgsql /bin/bash
6 changes: 3 additions & 3 deletions client/tools/mgr-push/Makefile.rhnpush
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ FILES = rhnpush_main rhnpush_v2 uploadLib __init__ connection \
RHN_CONF_DIR = /etc/sysconfig/rhn
RHNPUSHRC = rhnpushrc

PYFILES := $(addprefix src/rhnpush/, $(addsuffix .py, $(FILES)))
PYFILES := $(addsuffix .py, $(FILES))
OBJECTS := $(PYFILES)

ROOT ?= /usr/share/rhn
Expand All @@ -36,15 +36,15 @@ install-conf : $(RHNPUSHRC)

%.inst: rhnpush.inst

all : $(MANS) $(PYFILES)
all : $(MANS) $(OBJECTS)
install : all install-conf
$(INSTALL_DIR) $(PREFIX)$(MANDIR)/man8
$(INSTALL_DATA) $(MANS) $(PREFIX)$(MANDIR)/man8

$(INSTALL_DIR) $(PREFIX)$(ROOT)/rhnpush
$(INSTALL_DATA) $(PYFILES) $(PREFIX)$(ROOT)/rhnpush

$(INSTALL_BIN) bin/rhnpush $(PREFIX)$(BINDIR)/rhnpush-$(PYTHON_VERSION)
$(INSTALL_BIN) rhnpush $(PREFIX)$(BINDIR)/rhnpush-$(PYTHON_VERSION)
@ln -sfv rhnpush $(PREFIX)$(BINDIR)/rpm2mpm

%.8 : %.sgml
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 0 additions & 2 deletions client/tools/mgr-push/mgr-push.changes
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
- Allow rhnpush to handle Debian packages

-------------------------------------------------------------------
Wed Sep 28 11:18:45 CEST 2022 - [email protected]

Expand Down
4 changes: 1 addition & 3 deletions client/tools/mgr-push/mgr-push.spec
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ BuildRequires: python-devel
Requires: python2-rhn-client-tools
Requires: python2-uyuni-common-libs
Requires: rhnlib >= 2.8.3
Requires: python-debian
BuildRequires: python2-rhn-client-tools
BuildRequires: python2-uyuni-common-libs

Expand All @@ -107,7 +106,6 @@ Requires: rpm-python3
Requires: python3-rhn-client-tools
Requires: python3-rhnlib >= 2.8.3
Requires: python3-uyuni-common-libs
Requires: python3-debian
BuildRequires: python3-devel
BuildRequires: python3-rhn-client-tools
BuildRequires: python3-rpm-macros
Expand All @@ -131,7 +129,7 @@ make -f Makefile.rhnpush install PREFIX=$RPM_BUILD_ROOT ROOT=%{python_sitelib} \
%endif

%if 0%{?build_py3}
sed -i 's|#!/usr/bin/python|#!/usr/bin/python3|' bin/rhnpush
sed -i 's|#!/usr/bin/python|#!/usr/bin/python3|' rhnpush
install -d $RPM_BUILD_ROOT/%{python3_sitelib}
make -f Makefile.rhnpush install PREFIX=$RPM_BUILD_ROOT ROOT=%{python3_sitelib} \
MANDIR=%{_mandir} PYTHON_VERSION=%{python3_version}
Expand Down
3 changes: 0 additions & 3 deletions client/tools/mgr-push/pytest.ini

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@
#

import unittest
from rhnpush import rhnpush_cache
import rhnpush_cache
import time


@unittest.skip("skipping UserInfoTestCase")
class UserInfoTestCase(unittest.TestCase):

def setUp(self):
Expand Down Expand Up @@ -67,7 +66,6 @@ def testGetTimeLeft(self):
assert self.userinfo.getTimeLeft() >= 7.98 and self.userinfo.getTimeLeft() <= 8.002


@unittest.skip("skipping CacheManagerTestCase")
class CacheManagerTestCase(unittest.TestCase):

def setUp(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
# in this software or its documentation.
#

from rhnpush import rhnpush_config
from unittest.mock import patch, mock_open
import rhnpush_config
import unittest


Expand All @@ -35,10 +34,9 @@ def testReadConfigFiles(self):
assert self.userconfig.settings != None and self.defaultconfig.settings != None

def testGetOption(self):
with patch('configparser.ConfigParser.get', return_value='0'):
a = self.userconfig.get_option('usage')
b = self.defaultconfig.get_option('usage')
assert a == '0' and b == '0'
a = self.userconfig.get_option('usage')
b = self.defaultconfig.get_option('usage')
assert a != None and b != None and a == '0' and b == '0'

def testKeys(self):
a = list(self.userconfig.keys())
Expand All @@ -54,12 +52,9 @@ def testGetItem(self):
pass

def testAddConfigAsAttr(self):
with patch('configparser.ConfigParser.has_section', return_value='0'), \
patch('configparser.ConfigParser.get', return_value='0'), \
patch('configparser.ConfigParser.options', return_value=['usage']):
self.userconfig._add_config_as_attr()
self.defaultconfig._add_config_as_attr()
assert self.userconfig.usage != None and self.defaultconfig.usage != None
self.userconfig._add_config_as_attr()
self.userconfig._add_config_as_attr()
assert self.userconfig.usage != None and self.defaultconfig.usage != None

if __name__ == "__main__":
unittest.main()
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#

import unittest
from rhnpush import utils
import utils


class TestObj1:
Expand Down
4 changes: 2 additions & 2 deletions client/tools/mgr-push/test/test_archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import zipfile

# test import
from rhnpush import archive
import archive

# globals ----------------------------------------------------------------

Expand All @@ -37,7 +37,7 @@

# test case --------------------------------------------------------------

@unittest.skip("skipping ArchiveTest")

class ArchiveTest(unittest.TestCase):

def setUp(self):
Expand Down
Loading

0 comments on commit 02269dc

Please sign in to comment.