Added packaging for fuel-mirror

Change-Id: I296a5f356ca805deda28ea984df15c0b63b43a80
Closes-Bug: #1487077
Closes-Bug: #1489506
Implements: blueprint refactor-local-mirror-scripts
This commit is contained in:
Bulat Gaifullin 2015-11-26 19:34:32 +03:00
parent a31465e82e
commit 2e39995864
21 changed files with 297 additions and 265 deletions

View File

@ -1,6 +1,3 @@
centos_baseurl: &centos_baseurl
mos_baseurl: &mos_baseurl
fuel_release_match:
version: $openstack_version
operating_system: CentOS

View File

@ -50,5 +50,11 @@ def get_fuel_api_accessor(address=None, user=None, password=None):
# import fuelclient.ClientAPI after configuring
# environment variables
from fuelclient import objects
try:
from fuelclient import objects
except ImportError:
raise RuntimeError(
"fuelclient module seems not installed. "
"This action requires it to be available."
)
return objects

View File

@ -6,4 +6,6 @@ pbr>=0.8
Babel>=1.3
cliff>=1.7.0
six>=1.5.2
packetary
PyYAML>=3.10
packetary>=0.1.0
python-fuelclient>=7.0.0

View File

@ -1,5 +1,6 @@
[metadata]
name = fuel_mirror
version = 8.0.0
summary = The Utility to create local repositories with packages is
required for openstack deployment.
description-file =
@ -13,7 +14,7 @@ classifier =
Environment :: OpenStack
Intended Audience :: Information Technology
Intended Audience :: System Administrators
License :: OSI Approved :: Apache Software License
License :: OSI Approved :: GNU General Public License v2 (GPLv2)
Operating System :: POSIX :: Linux
Programming Language :: Python
Programming Language :: Python :: 2
@ -59,3 +60,8 @@ input_file = locale/fuel_mirror.pot
keywords = _ gettext ngettext l_ lazy_gettext
mapping_file = babel.cfg
output_file = locale/fuel_mirror.pot
[global]
setup-hooks =
pbr.hooks.setup_hook
setup_hooks.setup_hook

View File

@ -0,0 +1,21 @@
# Copyright 2015 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
def setup_hook(config):
import pbr
import pbr.packaging
# this monkey patch is to avoid appending git version to version
pbr.packaging._get_version_from_git = lambda pre_version: pre_version

60
debian/changelog vendored
View File

@ -1,59 +1,5 @@
fuel-createmirror (8.0-1) experimental; urgency=low
fuel-mirror (8.0.0-1) experimental; urgency=low
* Thu Sep 03 2015 skulanov <skulanov@mirantis.com>
* Initial release.
- Bump to version 8.0
-- skulanov <skulanov@mirantis.com> Thu, 03 Sep 2015 12:35:26 +0300
fuel-createmirror (7.0-2) experimental; urgency=low
* Thu Aug 13 2015 vparakhin <vparakhin@mirantis.com>
- Switch MOS DEB repos to new format, update configs from fuel-main
-- vparakhin <vparakhin@mirantis.com> Thu, 13 Aug 2015 14:58:48 +0300
fuel-createmirror (7.0-1) experimental; urgency=low
* Fri Aug 07 2015 skulanov <skulanov@mirantis.com>
- Bump version to 7.0. Update code from upstream
-- skulanov <skulanov@mirantis.com> Fri, 07 Aug 2015 17:25:49 +0300
fuel-createmirror (6.1-14) experimental; urgency=low
* Fri Jul 24 2015 aschultz <aschultz@mirantis.com>
- Fixing permisions after rsync of pool data
-- aschultz <aschultz@mirtantis.com> Fri, 24 Jul 2015 13:45:00 -0600
fuel-createmirror (6.1-13) experimental; urgency=low
* Thu Jun 11 2015 vparakhin <vparakhin@mirantis.com>
- Add sysfsutils package to requirements-deb.txt
* Fri Jun 5 2015 vparakhin <vparakhin@mirantis.com>
- Fix release ID hardcoded in fuel-createmirror
* Thu Jun 4 2015 vparakhin <vparakhin@mirantis.com>
- Change netboot installer path for partial mirror
* Tue Jun 2 2015 vparakhin <vparakhin@mirantis.com>
- Bypass http proxy while accessing Fuel Master node
* Tue Jun 2 2015 mmosesohn <mmosesohn@mirantis.com>
- Added proxy info to help
* Converted from .rpm format to .deb
- Added fuel-package-updates integration
-- vparakhin <vparakhin@mirantis.com> Fri, 22 May 2015 14:58:48 +0300
-- bgaifullin <bgaifullin@mirantis.com> Fri, 27 Nov 2015 00:28:26 +0300

2
debian/compat vendored
View File

@ -1 +1 @@
7
9

6
debian/conffiles vendored
View File

@ -1,6 +0,0 @@
/opt/fuel-createmirror-8.0/config/common.cfg
/opt/fuel-createmirror-8.0/config/fuel.cfg
/opt/fuel-createmirror-8.0/config/mos-ubuntu-updatesonly.cfg
/opt/fuel-createmirror-8.0/config/mos-ubuntu.cfg
/opt/fuel-createmirror-8.0/config/requirements-deb.txt
/opt/fuel-createmirror-8.0/config/ubuntu.cfg

62
debian/control vendored
View File

@ -1,14 +1,54 @@
Source: fuel-createmirror
Section: admin
Priority: optional
Source: fuel-mirror
Section: Utilities
Priority: extra
Maintainer: Mirantis Product <product@mirantis.com>
Build-Depends: debhelper (>= 7)
Standards-Version: 3.9.2
Build-Depends: debhelper (>= 9),
dh-python,
openstack-pkg-tools (>= 23~),
python-all,
python-pbr (>= 0.8),
python-setuptools
Standards-Version: 3.9.6
Homepage: mirantis.com
Package: fuel-createmirror
Package: fuel-mirror
Architecture: all
Depends: ${shlibs:Depends},python,dpkg-dev,openssl,rsync
Description: CLI script for MOS/upstream mirroring
**fuel-createmirror -- utility for creating local mirrors of MOS and
upstream OS repositories
.
Section: python
Depends: python-babel,
python-cliff (>= 1.7.0),
python-packetary (= ${binary:Version}),
python-pbr (>= 0.8),
python-six,
python-yaml,
python-tz,
${python:Depends}
Recommends: python-fuelclient (>= 7.0.0)
Description: Utility to create RPM and DEB mirror
Provides two commands fuel-mirror and fuel-createmirror.
Second one is for backward compatibility with the previous
generation of the utility. These commands could be used
to create local copies of MOS and upstream deb and rpm
repositories.
Package: python-packetary
Architecture: all
Depends: createrepo,
python-babel,
python-bintrees (>= 2.0.2),
python-chardet,
python-cliff (>= 1.7.0),
python-debian (>= 0.1.21),
python-eventlet (>= 0.15),
python-lxml,
python-pbr (>= 0.8),
python-six,
python-stevedore (>= 1.1.0),
python-tz,
${python:Depends}
Description: Library allows to build and clone deb and rpm repos
Provides object model and API for dealing with deb
and rpm repositories. One can use this framework to
implement operations like building repository
from a set of packages, clone repository, find package
dependencies, mix repositories, pull out a subset of
packages into a separate repository, etc.

44
debian/copyright vendored
View File

@ -1 +1,43 @@
Copyright: GPLv2
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: fuel-mirror
Source: git://github.com/openstack/fuel-mirror.git
Files: debian/*
Copyright: (c) 2014, Mirantis
License: GPL-2
Files: *
Copyright: (c) 2014, Mirantis
License: Apache-2
License: Apache-2
Licensed under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance with the License. You may obtain a copy of
the License at:
.
http://www.apache.org/licenses/LICENSE-2.0
.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations under
the License.
.
On Debian-based systems the full text of the Apache version 2.0 license can be
found in /usr/share/common-licenses/Apache-2.0.
License: GPL-2
Licensed under the GPL License, Version 2.0 (the "License"); you may not
use this file except in compliance with the License. You may obtain a copy of
the License at:
.
http://www.opensource.org/licenses/GPL-2.0
.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations under
the License.
.
On Debian-based systems the full text of the GPL version 2.0 license can be
found in /usr/share/common-licenses/GPL-2.

2
debian/fuel-mirror.install vendored Normal file
View File

@ -0,0 +1,2 @@
contrib/fuel_mirror/etc/config.yaml /etc/fuel-mirror
contrib/fuel_mirror/scripts/fuel-createmirror /usr/bin/

3
debian/postinst vendored
View File

@ -1,3 +0,0 @@
#!/bin/bash
ln -sf /opt/fuel-createmirror-8.0/fuel-createmirror /usr/bin/
ln -sf /opt/fuel-createmirror-8.0/config /etc/fuel-createmirror

10
debian/postrm vendored
View File

@ -1,10 +0,0 @@
#!/bin/bash
if [ "$1" = "1" ]; then
rm -f /usr/bin/fuel-createmirror
rm -f /etc/fuel-createmirror
ln -sf /opt/fuel-createmirror-8.0/fuel-createmirror /usr/bin/
ln -sf /opt/fuel-createmirror-8.0/config /etc/fuel-createmirror
else
rm -f /usr/bin/fuel-createmirror
rm -f /etc/fuel-createmirror
fi

83
debian/rules vendored
View File

@ -1,60 +1,39 @@
#!/usr/bin/make -f
# FIXME (skulanov)
# Since we are still building packages with ISO
# we have to define DEB_VERSION_EPOCH_UPSTREAM explicitly
DEB_VERSION_EPOCH_UPSTREAM=8.0
# otherwise this variable correctly defined below
# include /usr/share/dpkg/pkg-info.mk
PYTHONS:=$(shell pyversions -vr)
export DH_ALWAYS_EXCLUDE=CVS:.git:specs
include /usr/share/openstack-pkg-tools/pkgos.make
export OSLO_PACKAGE_VERSION=$(shell dpkg-parsechangelog | grep Version: | cut -d' ' -f2 | sed -e 's/^[[:digit:]]*://' -e 's/[-].*//' -e 's/~/.0/' | head -n 1)
PACKAGE=$(shell dh_listpackages)
%:
dh $@ --buildsystem=python_distutils --with python2
build:
dh_testdir
clean:
dh_testdir
dh_testroot
dh_clean -d
binary-indep: build
binary-arch: build
dh_testdir
dh_testroot
dh_prep
dh_installdirs
dh_installdocs
dh_installchangelogs
# Copy the packages's files.
mkdir -p debian/$(PACKAGE)/opt/$(PACKAGE)-$(DEB_VERSION_EPOCH_UPSTREAM)
cp fuel-createmirror debian/$(PACKAGE)/opt/$(PACKAGE)-$(DEB_VERSION_EPOCH_UPSTREAM)
cp deb-mirror debian/$(PACKAGE)/opt/$(PACKAGE)-$(DEB_VERSION_EPOCH_UPSTREAM)
cp -r util debian/$(PACKAGE)/opt/$(PACKAGE)-$(DEB_VERSION_EPOCH_UPSTREAM)
cp -r config debian/$(PACKAGE)/opt/$(PACKAGE)-$(DEB_VERSION_EPOCH_UPSTREAM)
cp LICENSE debian/$(PACKAGE)/opt/$(PACKAGE)-$(DEB_VERSION_EPOCH_UPSTREAM)
cp README.md debian/$(PACKAGE)/opt/$(PACKAGE)-$(DEB_VERSION_EPOCH_UPSTREAM)
#
# If you need to move files around in debian/$(PACKAGE) or do some
# binary patching, do it here
#
override_dh_clean:
rm -rf build
dh_clean -O--buildsystem=python_distutils
# This has been known to break on some wacky binaries.
# dh_strip
dh_compress
# dh_fixperms
dh_makeshlibs
dh_installdeb
-dh_shlibdeps
dh_gencontrol
dh_md5sums
dh_builddeb
override_dh_auto_install:
set -e ; for pyvers in $(PYTHONS); do \
python$$pyvers setup.py install --install-layout=deb \
--root $(CURDIR)/debian/python-packetary; \
done
set -e ; cd contrib/fuel_mirror/; \
for pyvers in $(PYTHONS); do \
python$$pyvers ./setup.py install --install-layout=deb \
--root $(CURDIR)/debian/fuel-mirror; \
done
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary
override_dh_fixperms:
set -e; chmod 755 $(CURDIR)/debian/fuel-mirror/usr/bin/fuel-createmirror
override_dh_python2:
dh_python2 --no-guessing-deps
override_dh_installcatalogs:
override_dh_installemacsen override_dh_installifupdown:
override_dh_installinfo override_dh_installmenu override_dh_installmime:
override_dh_installmodules override_dh_installlogcheck:
override_dh_installpam override_dh_installppp override_dh_installudev override_dh_installwm:
override_dh_installxfonts override_dh_gconf override_dh_icons override_dh_perl override_dh_usrlocal:
override_dh_installgsettings:

1
debian/source/format vendored Normal file
View File

@ -0,0 +1 @@
3.0 (quilt)

View File

@ -2,12 +2,12 @@
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
pbr>=1.6
pbr>=0.8
Babel>=1.3
eventlet>=0.15
bintrees>=2.0.2
chardet>=2.3.0
chardet>=2.0.1
stevedore>=1.1.0
six>=1.5.2
python-debian>=0.1.23
python-debian>=0.1.21
lxml>=3.2

View File

@ -1,5 +1,6 @@
[metadata]
name = packetary
version = 8.0.0
summary = The chain of tools to manage package`s lifecycle.
description-file =
README.rst
@ -12,7 +13,7 @@ classifier =
Environment :: OpenStack
Intended Audience :: Information Technology
Intended Audience :: System Administrators
License :: OSI Approved :: Apache Software License
License :: OSI Approved :: GNU General Public License v2 (GPLv2)
Operating System :: POSIX :: Linux
Programming Language :: Python
Programming Language :: Python :: 2
@ -54,3 +55,8 @@ input_file = packetary/locale/packetary.pot
keywords = _ gettext ngettext l_ lazy_gettext
mapping_file = babel.cfg
output_file = packetary/locale/packetary.pot
[global]
setup-hooks =
pbr.hooks.setup_hook
setup_hooks.setup_hook

21
setup_hooks.py Normal file
View File

@ -0,0 +1,21 @@
# Copyright 2015 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
def setup_hook(config):
import pbr
import pbr.packaging
# this monkey patch is to avoid appending git version to version
pbr.packaging._get_version_from_git = lambda pre_version: pre_version

View File

@ -1,112 +0,0 @@
%define name fuel-createmirror
%{!?version: %define version 8.0.0}
%{!?release: %define release 1}
Name: %{name}
Version: %{version}
Release: %{release}%{?dist}
Summary: CLI script for MOS/upstream mirroring
URL: http://mirantis.com
Group: Development/Tools
License: GPLv2
Source0: %{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
BuildArch: noarch
Requires: bash
Requires: docker-io
Requires: dpkg-devel
Requires: fuel-dockerctl
Requires: openssl
Requires: python
Requires: rsync
%description
**fuel-createmirror -- utility for creating local mirrors of MOS and
upstream OS repositories
%prep
rm -rf %{name}-%{version}
mkdir %{name}-%{version}
tar xzvf %{SOURCE0} -C %{name}-%{version}
%build
%install
rm -rf %{buildroot}
mkdir -p %{buildroot}/opt/%{name}-%{version}
cp %{name}-%{version}/%{name} %{buildroot}/opt/%{name}-%{version}
cp %{name}-%{version}/deb-mirror %{buildroot}/opt/%{name}-%{version}
cp -R %{name}-%{version}/util/ %{buildroot}/opt/%{name}-%{version}
cp -R %{name}-%{version}/config/ %{buildroot}/opt/%{name}-%{version}
cp %{name}-%{version}/LICENSE %{buildroot}/opt/%{name}-%{version}
cp %{name}-%{version}/README.md %{buildroot}/opt/%{name}-%{version}
%clean
rm -rf %{buildroot}
%post
ln -sf /opt/%{name}-%{version}/%{name} %{_bindir}
ln -sf /opt/%{name}-%{version}/config %{_sysconfdir}/%{name}
%postun
if [ "$1" = "1" ]; then
rm -f %{_bindir}/%{name}
rm -f %{_sysconfdir}/%{name}
ln -sf /opt/%{name}-%{version}/%{name} %{_bindir}
ln -sf /opt/%{name}-%{version}/config %{_sysconfdir}/%{name}
else
rm -f %{_bindir}/%{name}
rm -f %{_sysconfdir}/%{name}
fi
%files
%defattr(-,root,root)
%dir /opt/%{name}-%{version}/
/opt/%{name}-%{version}/%{name}
/opt/%{name}-%{version}/deb-mirror
/opt/%{name}-%{version}/util/
%config /opt/%{name}-%{version}/config/
/opt/%{name}-%{version}/LICENSE
/opt/%{name}-%{version}/README.md
%changelog
* Thu Sep 03 2015 Sergey Kulanov <skulanov@mirantis.com>
- Bump to version 8.0
* Thu Aug 13 2015 vparakhin <vparakhin@mirantis.com>
- Switch MOS DEB repos to new format, update configs from fuel-main
* Fri Aug 07 2015 Sergey Kulanov <skulanov@mirantis.com>
- Bump version to 7.0. Update code from upstream
* Fri Jul 24 2015 Alex Schultz <aschultz@mirantis.com>
- Fixing permisions after rsync of pool data
* Thu Jun 11 2015 vparakhin <vparakhin@mirantis.com>
- Add sysfsutils package to requirements
* Fri Jun 5 2015 vparakhin <vparakhin@mirantis.com>
- Fix release ID hardcoded in fuel-createmirror
* Thu Jun 4 2015 vparakhin <vparakhin@mirantis.com>
- Change netboot installer path for partial mirror
* Tue Jun 2 2015 vparakhin <vparakhin@mirantis.com>
- Bypass http proxy while accessing Fuel Master node
* Tue Jun 2 2015 mmosesohn <mmosesohn@mirantis.com>
- Added proxy info to help
* Tue May 12 2015 vparakhin <vparakhin@mirantis.com>
- Added fuel-package-updates integration
* Thu Apr 30 2015 vparakhin <vparakhin@mirantis.com>
- Added instructions on repositories setup in Fuel UI
* Tue Apr 28 2015 vparakhin <vparakhin@mirantis.com>
- Script name changed to fuel-createmirror
* Thu Apr 23 2015 vparakhin <vparakhin@mirantis.com>
- Initial release

96
specs/fuel-mirror.spec Normal file
View File

@ -0,0 +1,96 @@
%define name fuel-mirror
%{!?version: %define version 8.0.0}
%{!?release: %define release 1}
Name: %{name}
Version: %{version}
Release: %{release}
Source0: %{name}-%{version}.tar.gz
Summary: Utility to create RPM and DEB mirror
URL: http://mirantis.com
License: GPLv2
Group: Utilities
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
Prefix: %{_prefix}
BuildRequires: git
BuildRequires: python-setuptools
BuildRequires: python-pbr
BuildArch: noarch
Requires: python
Requires: python-babel >= 1.3
Requires: python-cliff >= 1.7.0
Requires: python-fuelclient >= 7.0.0
Requires: python-packetary == %{version}
Requires: python-pbr >= 0.8
Requires: python-six >= 1.5.2
Requires: PyYAML >= 3.10
# Workaroud for babel bug
Requires: pytz
Obsoletes: fuel-createmirror
%description
Provides two commands fuel-mirror and fuel-createmirror.
Second one is for backward compatibility with the previous
generation of the utility. These commands could be used
to create local copies of MOS and upstream deb and rpm
repositories.
%package -n python-packetary
Summary: Library that allows to build and clone deb and rpm repositories
Group: Development/Libraries
Requires: createrepo
Requires: python
Requires: python-babel >= 1.3
Requires: python-bintrees >= 2.0.2
Requires: python-chardet >= 2.0.1
Requires: python-cliff >= 1.7.0
Requires: python-debian >= 0.1.21
Requires: python-eventlet >= 0.15
Requires: python-lxml >= 1.1.23
Requires: python-pbr >= 0.8
Requires: python-six >= 1.5.2
Requires: python-stevedore >= 1.1.0
# Workaroud for babel bug
Requires: pytz
%description -n python-packetary
Provides object model and API for dealing with deb
and rpm repositories. One can use this framework to
implement operations like building repository
from a set of packages, clone repository, find package
dependencies, mix repositories, pull out a subset of
packages into a separate repository, etc.
%prep
%setup -cq -n %{name}-%{version}
%build
cd %{_builddir}/%{name}-%{version} && python setup.py build
cd %{_builddir}/%{name}-%{version}/contrib/fuel_mirror && python setup.py build
%install
cd %{_builddir}/%{name}-%{version} && python setup.py install --single-version-externally-managed -O1 --root=$RPM_BUILD_ROOT --record=%{_builddir}/%{name}-%{version}/INSTALLED_FILES
cd %{_builddir}/%{name}-%{version}/contrib/fuel_mirror && python setup.py install --single-version-externally-managed -O1 --root=$RPM_BUILD_ROOT --record=%{_builddir}/%{name}-%{version}/contrib/fuel_mirror/INSTALLED_FILES
mkdir -p %{buildroot}/etc/%{name}
mkdir -p %{buildroot}/usr/bin
mkdir -p %{buildroot}/usr/share/%{name}
install -m 755 %{_builddir}/%{name}-%{version}/contrib/fuel_mirror/scripts/fuel-createmirror %{buildroot}/usr/bin/fuel-createmirror
install -m 755 %{_builddir}/%{name}-%{version}/contrib/fuel_mirror/etc/config.yaml %{buildroot}/etc/%{name}/config.yaml
%clean
rm -rf $RPM_BUILD_ROOT
%files -f %{_builddir}/%{name}-%{version}/contrib/fuel_mirror/INSTALLED_FILES
%defattr(0755,root,root)
/usr/bin/fuel-createmirror
%attr(0644,root,root) /etc/%{name}/config.yaml
%files -n python-packetary -f %{_builddir}/%{name}-%{version}/INSTALLED_FILES
%defattr(-,root,root)

View File

@ -2,8 +2,6 @@
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
-r requirements.txt
hacking<0.11,>=0.10.0
coverage>=3.6