Move multipip and associated to tools + docs.
Use the readme.rst for multipip for other tools and place multipip and the new tools under tools since they are anvil tools and should be under that directory. Adjust the code to look under that directory when finding py2rpm and multipip. Remove some tools which are no longer needed/used/make sense. Change-Id: If3a0d627c42ef0374f764ad9e276424b43f29a66
This commit is contained in:
parent
942fc3abc5
commit
e0ccae357f
@ -91,7 +91,7 @@ OPENSTACK_PACKAGES = set([
|
||||
class DependencyHandler(object):
|
||||
"""Basic class for handler of OpenStack dependencies.
|
||||
"""
|
||||
multipip_executable = sh.which("multipip", ["multipip"])
|
||||
multipip_executable = sh.which("multipip", ["tools/"])
|
||||
# Update requirements to make them allow already installed packages
|
||||
force_frozen = True
|
||||
|
||||
|
@ -108,7 +108,7 @@ class YumPackager(base.Packager):
|
||||
class YumDependencyHandler(base.DependencyHandler):
|
||||
OPENSTACK_DEPS_PACKAGE_NAME = "openstack-deps"
|
||||
OPENSTACK_EPOCH = 2
|
||||
py2rpm_executable = sh.which("py2rpm", ["multipip"])
|
||||
py2rpm_executable = sh.which("py2rpm", ["tools/"])
|
||||
|
||||
def __init__(self, distro, root_dir, instances):
|
||||
super(YumDependencyHandler, self).__init__(distro, root_dir, instances)
|
||||
|
2
smithy
2
smithy
@ -7,7 +7,7 @@ cd "$(dirname "$0")"
|
||||
|
||||
YUM_OPTS="--assumeyes --nogpgcheck"
|
||||
PIP_CMD=""
|
||||
PY2RPM_CMD="$PWD/multipip/py2rpm"
|
||||
PY2RPM_CMD="$PWD/tools/py2rpm"
|
||||
|
||||
# Source in our variables (or overrides)
|
||||
source ".anvilrc"
|
||||
|
@ -1,5 +1,8 @@
|
||||
**Anvil utility toolbelt**
|
||||
==========================
|
||||
|
||||
multipip
|
||||
========
|
||||
--------
|
||||
|
||||
`pip` utility refuses to handle multiple requirements for one package::
|
||||
|
||||
@ -54,22 +57,23 @@ freeze`)::
|
||||
pip==1.2
|
||||
|
||||
py2rpm
|
||||
======
|
||||
------
|
||||
|
||||
Distutils provides an interface for building RPMs::
|
||||
|
||||
$ python ./setup.py bdist_rpm
|
||||
|
||||
This tool has several problems:
|
||||
|
||||
* Red Hat based distros use different package names, e.g.,
|
||||
`python-setuptools` instead of `distribute`, `python-nose` instead
|
||||
of `nose` and so on;
|
||||
* `Requires` and `Conflicts` sections for generated RPM are incorrect;
|
||||
* sometimes not all required files are packaged;
|
||||
* miscellaneous problems with man files;
|
||||
* package directory in `/usr/lib*/python*/site-packages/<pkg>` is not
|
||||
of `nose` and so on...
|
||||
* `Requires` and `Conflicts` sections for generated RPM are incorrect.
|
||||
* Sometimes not all required files are packaged.
|
||||
* Miscellaneous problems with man files;
|
||||
* Package directory in `/usr/lib*/python*/site-packages/<pkg>` is not
|
||||
owned by any RPM;
|
||||
* some packages (like selenium) are architecture dependent but
|
||||
* Some packages (like selenium) are architecture dependent but
|
||||
`bdist_rpm` generates `BuildArch: noarch` for them.
|
||||
|
||||
`py2rpm` is aimed to solve all these problems.
|
||||
@ -82,3 +86,43 @@ builds RPMs (current directory is used by default)::
|
||||
Wrote: /home/guest/rpmbuild/SRPMS/python-multipip-0.1-1.src.rpm
|
||||
Wrote: /home/guest/rpmbuild/RPMS/noarch/python-multipip-0.1-1.noarch.rpm
|
||||
...
|
||||
|
||||
build-install-node-from-source.sh
|
||||
---------------------------------
|
||||
|
||||
Helps build latest `node.js` from source into rpms.
|
||||
|
||||
clean-pip
|
||||
---------
|
||||
|
||||
This utility removes package installed by pip but not by rpm.
|
||||
|
||||
clear-dns.sh
|
||||
------------
|
||||
|
||||
Removes leftover nova dnsmasq processes frequently left behind.
|
||||
|
||||
img-uploader
|
||||
------------
|
||||
|
||||
Helper tool to upload images to glance using your anvil settings.
|
||||
|
||||
validate-yaml
|
||||
-------------
|
||||
|
||||
Validates yaml is formatted correctly.
|
||||
|
||||
yaml-pretty
|
||||
-----------
|
||||
|
||||
Pretty prints yaml into a standard format.
|
||||
|
||||
resize.sh
|
||||
---------
|
||||
|
||||
Resizes a images filesystem using guestfish.
|
||||
|
||||
euca.sh
|
||||
-------
|
||||
|
||||
Creates ec2 keys for usage with nova.
|
@ -1,46 +0,0 @@
|
||||
#!/bin/bash -x
|
||||
|
||||
ETH_SRC="eth0"
|
||||
|
||||
echo "Clearing your network up."
|
||||
|
||||
if [[ -n `brctl show | grep -i br100` ]]
|
||||
then
|
||||
echo "Clearing br100 and making $ETH_SRC be the real interface."
|
||||
sudo ifconfig $ETH_SRC down
|
||||
sudo ifconfig br100 down
|
||||
sudo brctl delif br100 $ETH_SRC
|
||||
sudo brctl delbr br100
|
||||
fi
|
||||
|
||||
if [[ -n `brctl show | grep -i virbr0` ]]
|
||||
then
|
||||
echo "Removing virbr0"
|
||||
sudo ifconfig virbr0 down
|
||||
sudo brctl delbr virbr0
|
||||
fi
|
||||
|
||||
|
||||
for pid in `ps -elf | grep -i dnsmasq | grep nova | perl -le 'while (<>) { my $pid = (split /\s+/)[3]; print $pid; }'`
|
||||
do
|
||||
echo "Killing leftover nova dnsmasq process with process id $pid"
|
||||
kill -9 $pid
|
||||
done
|
||||
|
||||
|
||||
if [[ -z `grep "iface $ETH_SRC" /etc/network/interfaces` ]]
|
||||
then
|
||||
|
||||
echo "Readjusting /etc/network/interfaces to have DHCP on for $ETH_SRC"
|
||||
sudo cat > /etc/network/interfaces <<EOF
|
||||
auto $ETH_SRC
|
||||
iface $ETH_SRC inet dhcp
|
||||
EOF
|
||||
|
||||
cat /etc/network/interfaces
|
||||
fi
|
||||
|
||||
echo "Bringing back up $ETH_SRC"
|
||||
sudo ifup $ETH_SRC
|
||||
|
||||
|
@ -1,26 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
|
||||
os.pardir,
|
||||
os.pardir))
|
||||
|
||||
if os.path.exists(os.path.join(possible_topdir,
|
||||
'anvil',
|
||||
'__init__.py')):
|
||||
sys.path.insert(0, possible_topdir)
|
||||
|
||||
if len(sys.argv) == 1:
|
||||
print(sys.argv[0] + " root-component")
|
||||
sys.exit(1)
|
||||
|
||||
from anvil import settings
|
||||
from anvil import cfg
|
||||
from anvil import utils
|
||||
from anvil import pprint
|
||||
|
||||
interp = cfg.YamlInterpolator(settings.COMPONENT_CONF_DIR)
|
||||
result = interp.extract(sys.argv[1])
|
||||
pprint.pprint(result)
|
@ -1,109 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
import re
|
||||
|
||||
possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
|
||||
os.pardir,
|
||||
os.pardir))
|
||||
|
||||
if os.path.exists(os.path.join(possible_topdir,
|
||||
'anvil',
|
||||
'__init__.py')):
|
||||
sys.path.insert(0, possible_topdir)
|
||||
|
||||
|
||||
from anvil import shell as sh
|
||||
from anvil.packaging.helpers import pip_helper
|
||||
from anvil import utils
|
||||
|
||||
|
||||
def main():
|
||||
if len(sys.argv) < 3:
|
||||
print("%s distro_yaml root_dir ..." % sys.argv[0])
|
||||
return 1
|
||||
root_dirs = sys.argv[2:]
|
||||
yaml_fn = sh.abspth(sys.argv[1])
|
||||
|
||||
requires_files = []
|
||||
for d in root_dirs:
|
||||
all_contents = sh.listdir(d, recursive=True, files_only=True)
|
||||
requires_files = [sh.abspth(f) for f in all_contents
|
||||
if re.search(r"(test|pip)[-]requires$", f, re.I)]
|
||||
|
||||
requires_files = sorted(list(set(requires_files)))
|
||||
requirements = []
|
||||
source_requirements = {}
|
||||
for fn in requires_files:
|
||||
source_requirements[fn] = []
|
||||
for req in pip_helper.parse_requirements(sh.load_file(fn)):
|
||||
requirements.append(req.key.lower().strip())
|
||||
source_requirements[fn].append(req.key.lower().strip())
|
||||
|
||||
print("Comparing pips/pip2pkgs in %s to those found in %s" % (yaml_fn, root_dirs))
|
||||
for fn in sorted(requires_files):
|
||||
print(" + " + str(fn))
|
||||
|
||||
requirements = set(requirements)
|
||||
print("All known requirements:")
|
||||
for r in sorted(requirements):
|
||||
print("+ " + str(r))
|
||||
|
||||
distro_yaml = utils.load_yaml(yaml_fn)
|
||||
components = distro_yaml.get('components', {})
|
||||
all_known_names = []
|
||||
components_pips = {}
|
||||
for (c, details) in components.items():
|
||||
components_pips[c] = []
|
||||
pip2pkgs = details.get('pip_to_package', [])
|
||||
pips = details.get('pips', [])
|
||||
known_names = []
|
||||
for item in pip2pkgs:
|
||||
known_names.append(item['name'].lower().strip())
|
||||
for item in pips:
|
||||
known_names.append(item['name'].lower().strip())
|
||||
components_pips[c].extend(known_names)
|
||||
all_known_names.extend(known_names)
|
||||
|
||||
all_known_names = sorted(list(set(all_known_names)))
|
||||
not_needed = []
|
||||
for n in all_known_names:
|
||||
if n not in requirements:
|
||||
not_needed.append(n)
|
||||
if not_needed:
|
||||
print("The following distro yaml mappings may not be needed:")
|
||||
for n in sorted(not_needed):
|
||||
msg = " + %s (" % (n)
|
||||
# Find which components said they need this...
|
||||
for (c, known_names) in components_pips.items():
|
||||
if n in known_names:
|
||||
msg += c + ","
|
||||
msg += ")"
|
||||
print(msg)
|
||||
not_found = []
|
||||
for n in requirements:
|
||||
name = n.lower().strip()
|
||||
if name not in all_known_names:
|
||||
not_found.append(name)
|
||||
not_found = sorted(list(set(not_found)))
|
||||
if not_found:
|
||||
print("The following distro yaml mappings may be required but were not found:")
|
||||
for n in sorted(not_found):
|
||||
msg = " + %s" % (n)
|
||||
msg += " ("
|
||||
# Find which file/s said they need this...
|
||||
for (fn, reqs) in source_requirements.items():
|
||||
matched = False
|
||||
for r in reqs:
|
||||
if r.lower().strip() == name:
|
||||
matched = True
|
||||
if matched:
|
||||
msg += fn + ","
|
||||
msg += ")"
|
||||
print(msg)
|
||||
return len(not_found) + len(not_needed)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
Loading…
Reference in New Issue
Block a user