dist-common: man
git archive --format=tar --prefix=$(PKGNAME)-$(TAGVER)/ $(TAG) | tar xpf -
git show $(TAG) --oneline | head -1 > $(PKGNAME)-$(TAGVER)/commit-id
- mkdir $(PKGNAME)-$(TAGVER)/doc; mv mic.1 $(PKGNAME)-$(TAGVER)/doc
rm -rf $(PKGNAME)-$(TAGVER)/tests
dist-bz2: dist-common
tar zcpf $(PKGNAME)-$(TAGVER).tar.gz $(PKGNAME)-$(TAGVER)
rm -rf $(PKGNAME)-$(TAGVER)
-man: USAGE.rst
- rst2man $< >mic.1
+man:
+ rst2man doc/man.rst > doc/mic.1
install: build
$(PYTHON) setup.py install
$(PYTHON) setup.py develop
test:
- cd tests/unittest/ && $(PYTHON) suite.py
+ cd tests/ && $(PYTHON) suite.py
clean:
rm -f *.tar.gz
# Installing package
mkdir -p $(CURDIR)/debian/mic $(CURDIR)/debian/mic/usr/bin $(CURDIR)/debian/mic/usr/share/man/man1
- install -m644 mic.1 $(CURDIR)/debian/mic/usr/share/man/man1
- #make DESTDIR=$(CURDIR)/debian/mic installman
- #make DESTDIR=$(CURDIR)/debian/micng installconf
- #make DESTDIR=$(CURDIR)/debian/micng installsymlinks
+ install -m644 doc/mic.1 $(CURDIR)/debian/mic/usr/share/man/man1
python setup.py install --root=$(CURDIR)/debian/mic
binary-indep: build install
-%define is_tizen %(test -e /etc/tizen-release -o -e /etc/meego-release && echo 1 || echo 0)
%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
+
Name: mic
Summary: Image Creator for Linux Distributions
Version: 0.15
Requires: squashfs-tools >= 4.0
Requires: qemu-arm-static
Requires: python-urlgrabber
-%if 0%{is_tizen} == 0
Requires: yum >= 3.2.24
-%endif
%if 0%{?suse_version}
Requires: btrfsprogs
%else
Requires: btrfs-progs
%endif
-%if 0%{?fedora_version} || 0%{is_tizen} == 1
-Requires: m2crypto
-%else
-%if 0%{?suse_version} == 1210
-Requires: python-M2Crypto
-%else
-Requires: python-m2crypto
-%endif
-%endif
-
-%if 0%{?fedora_version} > 13 || 0%{is_tizen} == 1
+%if 0%{?fedora_version} > 13
Requires: syslinux-extlinux
%endif
%{__python} setup.py install --root=$RPM_BUILD_ROOT -O1
%endif
-# remove yum backend for tizen
-%if 0%{is_tizen} == 1
-rm -rf %{buildroot}/%{_prefix}/lib/%{name}/plugins/backend/yumpkgmgr.py
-rm -rf %{buildroot}/%{_sysconfdir}/%{name}/bootstrap.conf
-%endif
-
# install man page
mkdir -p %{buildroot}/%{_prefix}/share/man/man1
-install -m644 mic.1 %{buildroot}/%{_prefix}/share/man/man1
+install -m644 doc/mic.1 %{buildroot}/%{_prefix}/share/man/man1
%files
%defattr(-,root,root,-)
-%doc README.rst
-%doc doc/RELEASE_NOTES
+%doc doc/*
%{_mandir}/man1/*
%dir %{_sysconfdir}/%{name}
%config(noreplace) %{_sysconfdir}/%{name}/%{name}.conf
-%if 0%{is_tizen} == 0
-%config %{_sysconfdir}/%{name}/bootstrap.conf
-%endif
%{python_sitelib}/*
%dir %{_prefix}/lib/%{name}
%{_prefix}/lib/%{name}/*
from mic import msger
from mic.imager import fs
-TEST_BASEIMGR_LOC = os.path.join(os.getcwd(), 'baseimgr_fixtures')
-KSCONF = os.path.join(os.getcwd(), 'baseimgr_fixtures', 'test.ks')
-KSBAK = os.path.join(os.getcwd(), 'baseimgr_fixtures', 'test.ks.bak')
-REPOURI = os.path.join(os.getcwd(), 'baseimgr_fixtures')
-CACHEDIR = os.path.join(os.getcwd(), 'baseimgr_fixtures', 'cache')
+CWD = os.path.dirname(__file__) or '.'
+TEST_BASEIMGR_LOC = os.path.join(CWD, 'baseimgr_fixtures')
+KSCONF = os.path.join(CWD, 'baseimgr_fixtures', 'test.ks')
+KSBAK = os.path.join(CWD, 'baseimgr_fixtures', 'test.ks.bak')
+REPOURI = os.path.join(CWD, 'baseimgr_fixtures')
+CACHEDIR = os.path.join(CWD, 'baseimgr_fixtures', 'cache')
RPMLOCK_PATH = None
def suite():
for entry in p.communicate()[0].split('\n'):
if entry.find(pattern) > 0:
- real_mount_list.append(entry.split(' ')[0])
+ real_mount_list.append(entry.split(' ')[2])
real_mount_list.sort()
os.close(dev_null)
return real_mount_list
RPMLOCK_PATH = "%s/var/lib/rpm" % creator._instroot
exp_mount_list = ['/sys', '/proc', '/proc/sys/fs/binfmt_misc', '/dev/pts']
exp_mount_list.sort()
+ exp_mount_list = [os.path.join(creator._instroot, pth.lstrip('/')) for pth in exp_mount_list]
real_mount_list = self.getMountList(creator._instroot)
self.assertEqual(real_mount_list, exp_mount_list)
real_pkglist = f.read()
self.assertEqual(real_pkglist, '\n'.join(pkglist))
+if os.getuid == 0:
def testBaseImagerZypp(self):
self.BaseImager('zypp')
import unittest
from mic import chroot
-TEST_CHROOT_LOC = os.path.join(os.getcwd(), 'chroot_fixtures')
+CWD = os.path.dirname(__file__) or '.'
+TEST_CHROOT_LOC = os.path.join(CWD, 'chroot_fixtures')
TEST_CHROOT_TAR = os.path.join(TEST_CHROOT_LOC, 'minchroot.tar.gz')
TEST_CHROOT_DIR = os.path.join(TEST_CHROOT_LOC, 'minchroot')
sys.stderr = self.stderr
shutil.rmtree(TEST_CHROOT_DIR, ignore_errors=True)
+if os.getuid() == 0:
def testChroot(self):
try:
chroot.chroot(TEST_CHROOT_DIR, None, 'exit')
import sys
import shutil
import StringIO
+import unittest
from mic import conf, msger
from pykickstart.parser import KickstartParser
-import unittest2 as unittest
-SITECONF = os.path.join(os.getcwd(), 'configmgr_fixtures', 'mic.conf')
-KSCONF = os.path.join(os.getcwd(), 'configmgr_fixtures', 'test.ks')
-KSBAK = os.path.join(os.getcwd(), 'configmgr_fixtures', 'test.ks.bak')
-REPOURI = os.path.join(os.getcwd(), 'configmgr_fixtures', 'packages')
-CACHEDIR = os.path.join(os.getcwd(), 'configmgr_fixtures', 'cache')
+CWD = os.path.dirname(__file__) or '.'
+SITECONF = os.path.join(CWD, 'configmgr_fixtures', 'mic.conf')
+KSCONF = os.path.join(CWD, 'configmgr_fixtures', 'test.ks')
+KSBAK = os.path.join(CWD, 'configmgr_fixtures', 'test.ks.bak')
+REPOURI = os.path.join(CWD, 'configmgr_fixtures', 'packages')
+CACHEDIR = os.path.join(CWD, 'configmgr_fixtures', 'cache')
def suite():
return unittest.makeSuite(ConfigMgrTest)
from mic import msger
import unittest
-TEST_PLUGINS_LOC = os.path.join(os.getcwd(), 'pluginmgr_fixtures')
+CWD = os.path.dirname(__file__) or '.'
+TEST_PLUGINS_LOC = os.path.join(CWD, 'pluginmgr_fixtures')
def suite():
return unittest.makeSuite(PluginMgrTest)
class PluginMgrTest(unittest.TestCase):
def setUp(self):
- self.defploc = plugin.DEFAULT_PLUGIN_LOCATION
- plugin.DEFAULT_PLUGIN_LOCATION = TEST_PLUGINS_LOC
self.plugin = plugin.PluginMgr()
+ self.defploc = self.plugin.plugin_dir
+ self.plugin.plugin_dir = TEST_PLUGINS_LOC
self.stdout = sys.stdout
self.stderr = sys.stderr
sys.stdout = StringIO.StringIO()
def tearDown(self):
sys.stdout = self.stdout
sys.stderr = self.stderr
- #dirs = map(lambda pt: os.path.join(TEST_PLUGINS_LOC, pt), \
- # plugin.PLUGIN_TYPES)
- #pys = reduce(lambda p, q: p+q, map(lambda d: filter(
- # lambda x: x.endswith(".py"), os.listdir(d)), dirs))
- #for mod in pys:
- # if mod.strip('.py') in sys.modules:
- # del sys.modules[mod.strip('.py')]
- #self.plugin._intance = None
- #self.plugin.plugin_dirs = {}
- plugin.DEFAULT_PLUGIN_LOCATION = self.defploc
+ self.plugin.plugin_dir = self.defploc
def testPluginDir(self):
plugindir = {}