[meego-commits] 7459: Changes to Trunk/mic2
Peter Zhu
no_reply at build.meego.com
Fri Sep 10 13:45:10 UTC 2010
Hi,
I have made the following changes to mic2 in project Trunk. Please review and accept ASAP.
Thank You,
Peter Zhu
[This message was auto-generated]
---
Request #7459:
submit: Trunk:Testing/mic2(r17) -> Trunk/mic2
Message:
Move from Trunk:Testing
State: new 2010-09-10T06:45:10 peter
Comment: None
changes files:
--------------
--- mic2.changes
+++ mic2.changes
@@ -0,0 +1,27 @@
+* Fri Sep 10 2010 Yi Yang <yi.y.yang at intel.com> - 0.21.0
+- Set run_mode to 0 for Fedora, Moblin and MeeGo
+
+* Wed Sep 08 2010 Yi Yang <yi.y.yang at intel.com> - 0.21.0
+- Update to 0.21.0
+
+* Mon Aug 30 2010 Yi Yang <yi.y.yang at intel.com> - 0.20.1
+- Depends on versions with epoch
+
+* Wed Aug 25 2010 Yi Yang <yi.y.yang at intel.com> - 0.20.1
+- Update to 0.20.1 with some fixes
+
+* Tue Aug 24 2010 Yi Yang <yi.y.yang at intel.com> - 0.20
+- Don't require higher version yum on debian-based distros
+
+* Tue Aug 24 2010 Yi Yang <yi.y.yang at intel.com> - 0.20
+- Fix btrfs-progs name issues on different distros
+
+* Mon Aug 23 2010 Yi Yang <yi.y.yang at intel.com> - 0.20
+- Update to 0.20
+
+* Tue Aug 10 2010 Huaxu Wan <huaxu.wan at linux.intel.com> - 0.19
+- Add runtime dependency btrfs-progs
+
+* Sat Jun 12 2010 Yi Yang <yi.y.yang at intel.com> - 0.19
+- Rename pykickstart to python-pykickstart for debian-based distros
+
old:
----
mic2-0.19.tar.gz
new:
----
mic2-0.21.0.tar.gz
spec files:
-----------
--- mic2.spec
+++ mic2.spec
@@ -1,24 +1,19 @@
#
-# Do not Edit! Generated by:
-# spectacle version 0.13~pre
-# On 2010-02-24
+# Do NOT Edit the Auto-generated Part!
+# Generated by: spectacle version 0.18
#
# >> macros
-
# << macros
-%if 0%{?suse_version}
-%{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
-%else
-%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
-%endif
+
+%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
Name: mic2
-Summary: Tools for building images
-Version: 0.19
+Summary: Tools for building images for MeeGo
+Version: 0.21.0
Release: 1
Group: System/Base
License: GPLv2
-URL: http://meego.gitorious.org/meego-developer-tools/image-creator
BuildArch: noarch
+URL: http://meego.gitorious.org/meego-developer-tools/image-creator
Source0: %{name}-%{version}.tar.gz
Source100: mic2.yaml
Requires: util-linux
@@ -26,7 +21,7 @@
Requires: python >= 2.5
Requires: e2fsprogs
Requires: dosfstools >= 2.11-8
-Requires: yum >= 3.2.22
+Requires: yum >= 3.2.24
Requires: pykickstart >= 0.96
Requires: python-iniparse
Requires: syslinux >= 3.82
@@ -43,20 +38,25 @@
Requires: gzip
Requires: bzip2
Requires: squashfs-tools >= 4.0
-BuildRequires: python
+%if 0%{?suse_version}
+Requires: btrfsprogs
+%else
+Requires: btrfs-progs
+%endif
BuildRequires: python-devel
BuildRequires: zlib-devel
-
BuildRoot: %{_tmppath}/%{name}-%{version}-build
+
%description
-Tools for building images. http://moblin.org/projects/moblin-image-creator-2 for more details.
+Tools for building images for MeeGo. http://meego.gitorious.org/meego-developer-tools/image-creator for more details.
%prep
%setup -q -n %{name}-%{version}
+
# >> setup
# << setup
@@ -67,28 +67,26 @@
CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build
# >> build post
-
# << build post
%install
-rm -rf %{buildroot}
+rm -rf $RPM_BUILD_ROOT
# >> install pre
-
# << install pre
%if 0%{?suse_version}
-%{__python} setup.py install --root=%{buildroot} --prefix=%{_prefix}
+%{__python} setup.py install --root=$RPM_BUILD_ROOT --prefix=%{_prefix}
%else
-%{__python} setup.py install --root=%{buildroot} -O1
+%{__python} setup.py install --root=$RPM_BUILD_ROOT -O1
%endif
# >> install post
make DESTDIR=%{buildroot} installman
make DESTDIR=%{buildroot} installconf
make DESTDIR=%{buildroot} installsymlinks
+%if 0%{?fedora_version} || 0%{?moblin_version} || 0%{?fedora_version}
+sed -i 's/^run_mode.*$/run_mode=0/g' %{buildroot}/etc/mic2/mic2.conf
+%endif
# << install post
-%clean
-rm -rf %{buildroot}
-
@@ -97,18 +95,14 @@
%files
%defattr(-,root,root,-)
# >> files
-%if 0%{?suse_version}
-%{python_sitearch}/*
-%else
-%{python_sitelib}/*
-%endif
-%{_bindir}/*
%dir %{_sysconfdir}/%{name}
%config(noreplace) %{_sysconfdir}/%{name}/%{name}.conf
%doc HACKING API ChangeLog
%doc examples/
%doc tests/
%{_mandir}/man1/*.1.gz
+%{python_sitelib}/*
+%{_bindir}/*
# << files
dsc files:
----------
--- mic2.dsc
+++ mic2.dsc
@@ -1,7 +1,7 @@
Format: 1.0
Source: mic2
Binary: mic2
-Version: 0.19
+Version: 0.21.0
Maintainer: Yi Yang <yi.y.yang at intel.com>
Homepage: http://www.meego.com
Architecture: all
other changes:
--------------
++++++ debian.changelog
--- debian.changelog
+++ debian.changelog
@@ -1,3 +1,18 @@
+mic2 (0.21.0) unstable; urgency=low
+
+ * Release of version (0.21.0)
+
+ -- Yi Yang <yi.y.yang at intel.com> Wed, 08 Sep 2010 11:34:53 +0800
+mic2 (0.20.1) unstable; urgency=low
+
+ * Release of version 0.20.1
+
+ -- Yi Yang <yi.y.yang at intel.com> Wed, 25 Aug 2010 11:27:15 +0800
+mic2 (0.20) unstable; urgency=low
+
+ * Release of version 0.20
+
+ -- Yi Yang <yi.y.yang at intel.com> Mon, 23 Aug 2010 11:56:15 +0800
mic2 (0.19) unstable; urgency=low
* Release of version 0.19
++++++ debian.tar.gz
--- control
+++ control
@@ -11,21 +11,23 @@
Depends: ${shlibs:Depends},
${misc:Depends},
${python:Depends},
- pykickstart (>= 0.96),
+ python-pykickstart (>= 0.96),
python-iniparse,
- squashfs-tools (>= 4.0),
+ squashfs-tools (>= 1:4.0),
zlib1g,
dosfstools,
genisoimage,
mkisofs | ubuntu-keyring,
e2fsprogs (>= 1.2),
- yum (> 3.0),
+ yum (>= 3.0),
curl,
rsync,
kpartx,
parted,
dmsetup,
python-urlgrabber,
- syslinux (>= 3.82) [amd64 i386 lpia]
+ btrfs-tools,
+ syslinux (>= 2:3.82) [amd64 i386 lpia],
+ bzip2
Description: MeeGo Image Creator
MeeGo Image Creator or MIC2
++++++ mic2-0.19.tar.gz -> mic2-0.21.0.tar.gz
--- .gitignore
+++ .gitignore
@@ -1,3 +1,10 @@
*.py[oc]
*~
*.swp
+build/
+doc/mic-chroot.1
+doc/mic-image-convertor.1
+doc/mic-image-creator.1
+doc/mic-image-writer.1
+doc/mic-livecd-iso-to-disk.1
+mic/__version__.py
--- ChangeLog
+++ ChangeLog
@@ -1,3 +1,565 @@
+commit b6934d99dc9f9d1e89478f2ceb2b04c867ec8f48
+Author: Yi Yang <yi.y.yang at intel.com>
+Date: Tue Sep 7 14:00:31 2010 +0800
+
+ Fix fs image build errors for ARM sysroot
+
+commit 4cb95cdd4e93cbb3b9e5918422f95b7254dc8878
+Author: Yi Yang <yi.y.yang at intel.com>
+Date: Tue Sep 7 11:37:27 2010 +0800
+
+ Fix an error: global name 'dev_null' is not defined
+
+commit 3aa1099c7389ec05c842e5c3785f85f90e9a15e9
+Author: Yi Yang <yi.y.yang at intel.com>
+Date: Mon Sep 6 15:27:32 2010 +0800
+
+ Use find_binary_path to get rpm path
+
+commit 7590fc217c4266b7a2e57540f8a74a4cdc94aaf3
+Author: Yi Yang <yi.y.yang at intel.com>
+Date: Mon Sep 6 15:00:43 2010 +0800
+
+ Optimize find_binary_path to get all the binary paths
+
+commit 8a97407739b28f3939e4281f553478ceadfc6bb0
+Merge: d9ca2e9... 6b88e2a...
+Author: Huaxu Wan <huaxu.wan at intel.com>
+Date: Thu Sep 2 10:29:02 2010 +0800
+
+ Merge commit 'refs/merge-requests/20' of git://gitorious.org/meego-developer-tools/image-creator into suraj-mic
+
+commit 6b88e2a0f953151be9e8899d728579808fdb8813
+Author: Suraj Barkale <surajb at kpitcummins.com>
+Date: Wed Sep 1 15:25:07 2010 +0530
+
+ Fix check for older release of Ubuntu.
+
+ Bash string compare results in "9.10" being greater than "10.04" causing
+ this problem. Just check major version using integer comparison to fix
+ this bug.
+
+commit d9ca2e95c4525a90d42a35e67d7829219b7ddc1c
+Merge: 7f23587... bfa09fd...
+Author: Huaxu Wan <huaxu.wan at intel.com>
+Date: Wed Sep 1 15:29:37 2010 +0800
+
+ Merge commit 'refs/merge-requests/19' of git://gitorious.org/meego-developer-tools/image-creator into suraj-mic
+
+commit 7f235872452a65b1e2cc662c11d9271ca45a178a
+Author: Yi Yang <yi.y.yang at intel.com>
+Date: Wed Sep 1 11:14:59 2010 +0800
+
+ Fix suffix parsing error
+
+ Note: fix bug #6122, suffix may include '-', but release id will be
+ removed from it.
+
+commit 023b535cfdfbfde52990c7659bb86a1195d6095c
+Author: Huaxu Wan <huaxu.wan at intel.com>
+Date: Tue Aug 31 16:22:21 2010 +0800
+
+ Add MeeGo to the support distro list of mic-check-alldeps.
+ Fix BMC#5025.
+
+commit 9f94de03ae8fca32ca0b1bcdff90145a90c36e34
+Author: Yi Yang <yi.y.yang at intel.com>
+Date: Mon Aug 30 16:45:50 2010 +0800
+
+ Copy mic2 to bootstrap in case of bootstrap mode and check two installations
+
+ mic2 version in Trunk repo is inconsistent with one in tools repo very often,
+ this will make mic2 not work in bootstrap mode because old mic2 can't recognize
+ new options unless you install a new mic2 to bootstrap manually, this is very
+ annoying. Now we have a solution for this, mic2 will copy itself to bootstrap
+ when it is run in bootstrap mode, so you won't encounter this annoying issue
+ any more.
+
+ Another annoying issue is someone install mic2 from binary and source on her
+ /his system, for Fedora and openSUSE, this isn't a problem because binary and
+ source have the same installation path, but for debian-based distros, this
+ will result in some unpredictable errors, the issue is binary used pycentral
+ to install but source used distutils, they will result in the different
+ installation paths, for this, mic2 will detect and exit unless you remove
+ one installation, for developers or guys to want the latest mic2 code, you
+ shloud remove mic2 binary installation, for general users, you should remove
+ mic2 source installation.
+
+commit 979ac944aa5c5b3e8faaeac87dbc5faf0736435b
+Author: Yi Yang <yi.y.yang at intel.com>
+Date: Fri Aug 27 22:23:38 2010 +0800
+
+ Fix no_proxy parsing error
+
+commit 09f4decc1c0c29d82cff341cf0f7604534ea8f61
+Author: Huaxu Wan <huaxu.wan at intel.com>
+Date: Fri Aug 27 10:19:39 2010 +0800
+
+ Resolve absolute path issue found at Ubuntu. Fix BMC#4007
+
+commit 676f40379e9922ba7e11da2b64822e8fc03851fe
+Author: Huaxu Wan <huaxu.wan at intel.com>
+Date: Thu Aug 26 14:11:06 2010 +0800
+
+ Skip dependency check when ImageCreator called by convertor, because no ks provided
+
+commit f8c0fdeca948fc76c1a49437b7758287a8271c69
+Author: Suraj Barkale <surajb at kpitcummins.com>
+Date: Wed Aug 25 18:58:23 2010 +0530
+
+ Remove python-elementree package for Ubuntu 10.04
+
+ In Ubuntu 10.04, python-celementree and python-elementree packages are
+ not present in repository. These packages should only be added to
+ required packages if using Ubuntu version older than 10.04
+
+commit 4243be8c40b76b7837fda2faa5a61ba0e3fed29d
+Author: Huaxu Wan <huaxu.wan at intel.com>
+Date: Wed Aug 25 17:28:29 2010 +0800
+
+ Delete the file after packaged into tar.*
+ Fix BMC# 5554
+
+commit bfa09fd85e3fc14b7ee1183c3e44389576647ad6
+Author: Suraj Barkale <surajb at kpitcummins.com>
+Date: Wed Aug 25 13:21:29 2010 +0530
+
+ Replace /bin/rpm with rpm to work with Ubuntu
+
+commit f85ee397823ff36a7dd569fc65a59d4d3a126f60
+Author: Yi Yang <yi.y.yang at intel.com>
+Date: Wed Aug 25 11:15:18 2010 +0800
+
+ Cut a fix release 0.20.1
+
+commit e2ec84a4e4134003ef4cc6d24088d158fb73f0b4
+Author: Yi Yang <yi.y.yang at intel.com>
+Date: Wed Aug 25 11:08:15 2010 +0800
+
+ Need make in bootstrap for manually updating mic2
+
+commit dd588cc36b83fcbd121289837fc26787ac517b7a
+Author: Yi Yang <yi.y.yang at intel.com>
+Date: Tue Aug 24 16:36:18 2010 +0800
+
+ Fix a regression introduced by commit 06b12db778016c49e4f6f02145365d648972530e
+
+ Note: fix bug #5709
+
+commit 69171e3e0c178eaa0bf6c9cfaf0a6303d302137e
+Author: Yi Yang <yi.y.yang at intel.com>
+Date: Tue Aug 24 14:37:43 2010 +0800
+
+ install btrfs-progs into bootstrap
+
+commit 204817db7508801a5200a9f9d46b7e397cb1ba7a
+Author: Yi Yang <yi.y.yang at intel.com>
+Date: Mon Aug 23 16:41:00 2010 +0800
+
+ Update ChangeLog for 0.20
+
+commit 75810bcaf7b06053b50a0f72beb6fcf821cdf6cb
+Author: Yi Yang <yi.y.yang at intel.com>
+Date: Mon Aug 23 16:21:19 2010 +0800
+
+ Update VERSION to 0.20
+
+commit 5e473fca673e842eb7b12fbe5f1ddd06b135ef1f
+Author: Yi Yang <yi.y.yang at intel.com>
+Date: Mon Aug 23 09:34:25 2010 +0800
+
+ mic2 needs yum >= 3.2.24
+
+commit bf9f040c88eedd903c49d8e2e3c184896c7e3481
+Author: Yi Yang <yi.y.yang at intel.com>
+Date: Thu Aug 19 12:03:57 2010 +0800
+
+ Unnecessary to compress live image
+
+commit c5698796697d7d716e3c68cf03436fa230f9c7e6
+Author: Yi Yang <yi.y.yang at intel.com>
+Date: Wed Aug 18 17:30:17 2010 +0800
+
+ Fix some issues new image compression method and cleanup code introduced
+
+commit 2979aa8594404986e39e6b7cf4f005e8bcb9adc9
+Merge: 57454df... e65c136...
+Author: Yi Yang <yi.y.yang at intel.com>
+Date: Wed Aug 18 16:31:59 2010 +0800
+
+ Merge commit 'refs/merge-requests/17' of git://gitorious.org/meego-developer-tools/image-creator into integration
+
+ Conflicts:
+ mic/imgcreate/misc.py
+
+commit 57454dffbd39bbbcb9eecc8d5d0598c1a4e609a4
+Merge: c106a0b... a303407...
+Author: Yi Yang <yi.y.yang at intel.com>
+Date: Wed Aug 18 16:24:48 2010 +0800
+
+ Merge commit 'refs/merge-requests/16' of git://gitorious.org/meego-developer-tools/image-creator into integration
+
+commit c106a0bad07bcfb4752570c2dd4a7fe5c7a9c9a5
+Author: Yi Yang <yi.y.yang at intel.com>
+Date: Wed Aug 18 16:21:54 2010 +0800
+
+ Use a more elegant way to decide file with specified suffix
+
+commit e65c1365492cbcb90692274a5dd44350751ac583
+Author: Marko Saukko <marko.saukko at gmail.com>
+Date: Wed Aug 18 11:00:02 2010 +0300
+
+ Fixed mrstnand image creation.
+
+commit f00c2faeb8065b0c4fbc77b4269b6d02c5ebbc4f
+Author: Yi Yang <yi.y.yang at intel.com>
+Date: Wed Aug 18 13:03:46 2010 +0800
+
+ Accept kickstart file with $VERTICAL-$ARCH.ks naming pattern
+
+commit a30340749bc8aae60cdaa0954b602b896720b02f
+Author: Marko Saukko <marko.saukko at gmail.com>
+Date: Tue Aug 17 16:02:06 2010 +0300
+
+ Split supported formats with appcreate and imgcreate.
+
+commit 5016e1289a4fa532cb1bf4dcbe3ae649d0362792
+Author: Marko Saukko <marko.saukko at gmail.com>
+Date: Tue Aug 17 15:36:01 2010 +0300
+
+ Code cleanup
+
+commit b52dd3580297021790b065bbf52e78fe913ded3c
+Author: Marko Saukko <marko.saukko at gmail.com>
+Date: Tue Aug 17 15:14:58 2010 +0300
+
+ Cleanup for architecture handling.
+
+commit 11ee1c02a5a6b12e64a440aca788bef36caf4e48
+Author: Marko Saukko <marko.saukko at gmail.com>
+Date: Thu Aug 12 16:29:25 2010 +0300
+
+ Fixed typo introduced when moving code.
+
+commit f5c04cb9d1e525eaf2a44e5d15a082972d3de5a1
+Author: Marko Saukko <marko.saukko at gmail.com>
+Date: Thu Aug 12 14:03:13 2010 +0300
+
+ Changed Moblin->MeeGo and added links to the git repos of the tools that mic is based on.
+
+commit 06b12db778016c49e4f6f02145365d648972530e
+Author: Marko Saukko <marko.saukko at gmail.com>
+Date: Thu Aug 12 13:36:11 2010 +0300
+
+ Don't ignore errors on arm.
+
+commit 5b750f9b13b595db87121e08e86c9d2a0fa0d6c6
+Author: Yi Yang <yi.y.yang at intel.com>
+Date: Thu Aug 12 09:25:58 2010 +0800
+
+ Just use imgcreate instead of mic.imgcreate
+
+commit 58bc417628bd590bcdca846b7aec291a28e989d6
+Merge: 3cf1a17... 1fdefaf...
+Author: Yi Yang <yi.y.yang at intel.com>
+Date: Thu Aug 12 09:24:23 2010 +0800
+
+ Merge commit 'refs/merge-requests/14' of git://gitorious.org/meego-developer-tools/image-creator into integration
+
+commit 1fdefaf6fbb70cc675261e9643749c118d2f5838
+Author: Marko Saukko <marko.saukko at gmail.com>
+Date: Wed Aug 11 11:46:49 2010 +0300
+
+ Moved checks to better places.
+
+commit 3cf1a173c316c94c1a10ef48eda989b7edbef236
+Author: Huaxu Wan <huaxu.wan at intel.com>
+Date: Wed Aug 11 10:18:46 2010 +0800
+
+ Give the reason why mount btrfs error
+
+commit e040f851ddeade50c66e7b3c3b23862fa304e9d2
+Author: Marko Saukko <marko.saukko at gmail.com>
+Date: Tue Aug 10 17:46:39 2010 +0300
+
+ Minor tweaks
+
+commit 5c9a71e0587e0d4deab921d2cc1de6f70dac0362
+Author: Marko Saukko <marko.saukko at gmail.com>
+Date: Tue Aug 10 17:29:14 2010 +0300
+
+ Unified cache dir handling.
+
+commit b774d3b9fcedae82a62175e648497af025b5d9cd
+Author: Marko Saukko <marko.saukko at gmail.com>
+Date: Tue Aug 10 10:56:12 2010 +0300
+
+ Now when --release is used with --package all files are added to the .tar package as well.
+
+commit a808dccfe5e51b64ad38c9266adc0e75b8a322f8
+Author: Marko Saukko <marko.saukko at gmail.com>
+Date: Tue Aug 10 10:07:00 2010 +0300
+
+ List .md5sum files in the file list when created.
+
+commit bdc8b15e8a7a43dcde068ec6e7e38ca08b264190
+Author: Marko Saukko <marko.saukko at gmail.com>
+Date: Tue Aug 10 09:17:03 2010 +0300
+
+ Moved list of supported formats to better place.
+
+commit 7b40b3316d662a4bb0efad8db4581dd354d12129
+Merge: 7eb88ee... 6992f20...
+Author: Yi Yang <yi.y.yang at intel.com>
+Date: Wed Aug 4 09:23:05 2010 +0800
+
+ Merge commit 'refs/merge-requests/13' of git://gitorious.org/meego-developer-tools/image-creator into integration
+
+commit 6992f20d36c23b5e338ceb8530eac1add7650c8e
+Author: Marko Saukko <marko.saukko at gmail.com>
+Date: Tue Aug 3 12:25:35 2010 +0300
+
+ Now --release uses the bz2 to compress images by default.
+
+commit fdf5a6cba9c724784a939b65517621655aa96696
+Author: Marko Saukko <marko.saukko at gmail.com>
+Date: Mon Aug 2 16:01:37 2010 +0300
+
+ Added --compress-disk-image option to mic-image-creator.
+
+commit 7eb88eecd2277e3673b4788ae459224b5c51d9f4
+Author: Yi Yang <yi.y.yang at intel.com>
+Date: Fri Jul 30 10:10:26 2010 +0800
+
+ Fix pykickstart package name error in debian-based distros
+
+ Note: fix bug #4083
+
+commit db2e9b93dfdb456f23ff68c79f3c8a5958ed81b7
+Merge: ac8090d... 81c388f...
+Author: Marko Saukko <marko.saukko at gmail.com>
+Date: Thu Jul 29 10:11:39 2010 +0300
+
+ Merge git://gitorious.org/meego-developer-tools/image-creator into release-packaging
+
+commit 81c388f06ed6091c6bd95ac2d53c43d39b723ee8
+Merge: 1f65a83... 076c572...
+Author: Yi Yang <yi.y.yang at intel.com>
+Date: Tue Jul 27 15:32:02 2010 +0800
+
+ Merge commit 'refs/merge-requests/12' of git://gitorious.org/meego-developer-tools/image-creator into integration
+
+commit 1f65a834da43fa9fbe964687b0544e9c6c452b82
+Merge: 231fdf3... 6936de1...
+Author: Yi Yang <yi.y.yang at intel.com>
+Date: Tue Jul 27 15:26:37 2010 +0800
+
+ Merge commit 'refs/merge-requests/11' of git://gitorious.org/meego-developer-tools/image-creator into integration
+
+commit ac8090d3f282acb8bfeda1600bd52a0ac1b7f6cc
+Author: Marko Saukko <marko.saukko at gmail.com>
+Date: Mon Jul 26 17:15:16 2010 +0300
+
+ Now also raw, vdi and vmdk files are compressed with bz2 when using --release.
+
+commit c5fbc165e75add8489d6f94a6a8230e82980f592
+Author: Marko Saukko <marko.saukko at gmail.com>
+Date: Mon Jul 26 15:13:46 2010 +0300
+
+ Now --release= compresses only the disk image with bzip2 instead of all files to tar.bz2.
+
+commit 076c572cc41a475253ab91a481539689ab9639cf
+Author: Marko Saukko <marko.saukko at gmail.com>
+Date: Mon Jul 26 09:06:57 2010 +0300
+
+ Accept image name prefix in front of kickstart file.
+
+commit 03a6b66648c1102e41bab93b20250f4776167fcb
+Author: Marko Saukko <marko.saukko at gmail.com>
+Date: Mon Jul 26 09:08:27 2010 +0300
+
+ Ignore files that are created during make process.
+
+commit 231fdf30addf3947322b14f39f040de5839ce31d
+Author: Yi Yang <yi.y.yang at intel.com>
+Date: Fri Jul 23 17:05:52 2010 +0800
+
+ fix mic-image-creator path error in bootstrap
+
+ Note: in Ubuntu and Debian, mic-image-creator is installed into
+ /usr/local/bin, but in bootstrap, it is always /usr/bin
+
+commit bace2919d21d69a07b327431adb109a678b3c6b2
+Author: Yi Yang <yi.y.yang at intel.com>
+Date: Fri Jul 23 15:14:11 2010 +0800
+
+ Show repo metadata retrieving progress
+
+commit 53063cc4b2f3b662aa30c97dff870daca25b3b55
+Author: Yi Yang <yi.y.yang at intel.com>
+Date: Fri Jul 23 11:13:45 2010 +0800
+
+ Print local linux distribution info for diagnosing issues
+
+commit 353910b8bf134ac1ab44d79c71e4826cc62b51e6
+Author: Yi Yang <yi.y.yang at intel.com>
+Date: Fri Jul 16 13:53:27 2010 +0800
+
+ Show package retrieving progress correctly and give a good indicator
+
+ Note: fix bug #3756
+
+commit 6936de187fb2a5cc8e7eeb64641fafb89ce72f95
+Author: Ville Ilvonen <ville.p.ilvonen at nokia.com>
+Date: Tue Jul 13 16:30:17 2010 +0300
+
+ Fixes missing bzip2 dependency with squeeze
+
+commit c284142218640a28ac46f12173e9644bbe014aa9
+Author: Yi Yang <yi.y.yang at intel.com>
+Date: Mon Jul 12 14:00:01 2010 +0800
+
+ Fix meego website url
+
+ Note: fix bug #3738
+
+commit 48805cf1d87451290c5ef5259f22808d5edd4816
+Author: Yi Yang <yi.y.yang at intel.com>
+Date: Fri Jul 9 15:45:17 2010 +0800
+
+ Allow to chroot a kvm/raw image
+
+commit 7b88fdb2bbd532e15429cb233ade9833ad94cf3e
+Author: Yi Yang <yi.y.yang at intel.com>
+Date: Fri Jul 9 14:42:53 2010 +0800
+
+ Keep silent if a gpg key has been imported
+
+commit de9702ab6630a624c601b67ae385b0f022398795
+Author: Yi Yang <yi.y.yang at intel.com>
+Date: Thu Jul 8 09:54:52 2010 +0800
+
+ Fix prerequisite package version check issue on OpenSUSE
+
+commit ddf9af9ad8751da0416e23fcfe8e52e92c9bb2f0
+Author: Yi Yang <yi.y.yang at intel.com>
+Date: Wed Jul 7 10:51:55 2010 +0800
+
+ Save and import gpg keys from repos
+
+commit 17798effbd154ddc0a3a17bbf618f32ec7e1ad03
+Merge: ba3e5fb... ee9befc...
+Author: Yi Yang <yi.y.yang at intel.com>
+Date: Mon Jun 28 09:15:54 2010 +0800
+
+ Merge commit 'refs/merge-requests/10' of git://gitorious.org/meego-developer-tools/image-creator into integration
+
+commit ba3e5fb769bba00ff22e6868b79aabb69dd190bd
+Author: Yi Yang <yi.y.yang at intel.com>
+Date: Fri Jun 25 15:35:16 2010 +0800
+
+ Skip proxy settings on saveing repos
+
+ Note: fix bug #3460
+
+commit ee9befc1594cd8698d9fd8dc8a155505bc098956
+Author: Marko Saukko <marko.saukko at gmail.com>
+Date: Wed Jun 23 15:03:04 2010 +0300
+
+ Cleanup for redundant code in meta file fetching.
+
+commit 7b084c52cede61fd941a279b0d333d13492555d7
+Author: Yi Yang <yi.y.yang at intel.com>
+Date: Mon Jun 21 13:46:45 2010 +0800
+
+ Fix an error in case arch is None
+
+commit d5768b79c9de41e0f17368247ed586598ec5f342
+Author: Yi Yang <yi.y.yang at intel.com>
+Date: Fri Jun 18 16:59:31 2010 +0800
+
+ Fix qemu emulator conflicts on OpenSUSE
+
+commit fd84d18fa7c1972dbe9c50d72e5869ecd1798cd6
+Author: Yi Yang <yi.y.yang at intel.com>
+Date: Fri Jun 18 14:13:17 2010 +0800
+
+ Fix BUILD_ID substitution issue
+
+commit d70ddc1ea7e76656512f3af0b87c00196bd23764
+Merge: 0b331c9... 331a953...
+Author: Anas Nashif <anas.nashif at intel.com>
+Date: Thu Jun 17 22:15:51 2010 -0400
+
+ Merge branch 'master' of git at gitorious.org:meego-developer-tools/image-creator
+
+commit 0b331c9d1cff493b70a8577dc4a19fc4dd466755
+Author: Anas Nashif <anas.nashif at intel.com>
+Date: Thu Jun 17 22:15:30 2010 -0400
+
+ in --release mode, replace BUILD_ID with the release argument
+
+commit 331a953c823a50ce9918ec1357c74f2599cc8d47
+Author: Marko Saukko <marko.saukko at gmail.com>
+Date: Thu Jun 17 13:12:00 2010 +0300
+
+ Add btrfs support to appcreate.
+
+commit 190ba94511b640ad3300ef9de6e1d858b2be742c
+Author: Marko Saukko <marko.saukko at gmail.com>
+Date: Thu Jun 17 12:52:51 2010 +0300
+
+ Sort the list of file before printing.
+
+commit 0d4239f36e68b35fc548bb30d91548412ffc284c
+Author: Marko Saukko <marko.saukko at gmail.com>
+Date: Thu Jun 17 12:43:02 2010 +0300
+
+ Added pkgs files to the file list that is shown in the end of image creation.
+
+commit f565297a746e723122a1e5593297e169b9172c19
+Author: Yi Yang <yi.y.yang at intel.com>
+Date: Thu Jun 17 13:48:10 2010 +0800
+
+ Correct a typo
+
+commit 3d4b75ca260746f302d1504ecd5e636a9ec0eb5c
+Merge: f26cdd1... 0467b40...
+Author: Yi Yang <yi.y.yang at intel.com>
+Date: Thu Jun 17 13:45:07 2010 +0800
+
+ Merge commit 'refs/merge-requests/8' of git://gitorious.org/meego-developer-tools/image-creator into integration
+
+commit f26cdd1ff4c9bfb550386c6a7c58bf38f488d2b1
+Author: Yi Yang <yi.y.yang at intel.com>
+Date: Thu Jun 17 11:48:53 2010 +0800
+
+ chroot API needs rootdir must be full path name
+
+commit 0467b4073cafe6c738c946e556dd82a1fd4c877e
+Author: Marko Saukko <marko.saukko at gmail.com>
+Date: Wed Jun 16 17:33:46 2010 +0300
+
+ Unified binary path finding.
+
+commit 630fa45c57ecd82ba5d61cf3c12f479e04b43469
+Author: Marko Saukko <marko.saukko at gmail.com>
+Date: Wed Jun 16 16:48:59 2010 +0300
+
+ Add ext4 support to partitioned fs mount
+
+commit ee723c9d33c9e3539306134e1d293858a297bd2f
+Author: Yi Yang <yi.y.yang at intel.com>
+Date: Thu Jun 10 17:16:14 2010 +0800
+
+ Fix a chroot error for mic-image-creator
+
+commit 724604079029fbcee82cfdbc9cc5536bb054a49d
+Author: Yi Yang <yi.y.yang at intel.com>
+Date: Thu Jun 10 16:22:03 2010 +0800
+
+ Cut release 0.19
+
commit 845ab935a4c2180e18d310bca8a096d515ae2079
Author: Yi Yang <yi.y.yang at intel.com>
Date: Thu Jun 10 15:48:41 2010 +0800
--- README
+++ README
@@ -1,6 +1,7 @@
-Moblin Image Creator 2
+MeeGo Image Creator
==========================
-This tool is based on Fedora livecd tools and The Fedora Appliance tools.
+This tool is based on Fedora livecd tools (http://git.fedorahosted.org/git/?p=livecd)
+and The Fedora Appliance tools (http://git.fedorahosted.org/git/?p=appliance-tools.git).
-For more information, see http://moblin.org/projects/moblin-image-creator-2
+For more information, see http://meego.gitorious.org/meego-developer-tools/image-creator
--- VERSION
+++ VERSION
@@ -1 +1 @@
-0.19
+0.21.0
\ No newline at end of file
--- doc/mic.1
+++ doc/mic.1
@@ -1,4 +1,4 @@
-.TH MIC "1" "Jun 2010" "mic 0.18" "User Commands"
+.TH MIC "1" "Jul 2010" "mic 0.19" "User Commands"
.SH NAME
mic \- MeeGo image command-line tool.
.SH SYNOPSIS
--- mic/appcreate/__init__.py
+++ mic/appcreate/__init__.py
@@ -16,6 +16,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+""" When new format is added update the new format to this list. """
+supported_formats = ['raw', 'vmdk', 'vdi', 'mrstnand', 'nand']
from mic.imgcreate.live import *
from mic.imgcreate.creator import *
--- mic/appcreate/appliance.py
+++ mic/appcreate/appliance.py
@@ -74,7 +74,7 @@
if self.__disk_format == "vdi":
self._dep_checks.append(('/usr/bin/VBoxManage',))
- def configure(self):
+ def configure(self, repodata = None):
def chroot():
os.chroot(self._instroot)
@@ -83,7 +83,7 @@
if self.__disk_format in ("raw", "vmdk", "vdi"):
if os.path.exists(self._instroot + "/usr/bin/Xorg"):
subprocess.call(["/bin/chmod", "u+s", "/usr/bin/Xorg"], preexec_fn = chroot)
- ImageCreator.configure(self)
+ ImageCreator.configure(self, repodata)
def _get_fstab(self):
s = ""
@@ -328,87 +328,6 @@
def _resparse(self, size = None):
return self.__instloop.resparse(size)
- def package(self, destdir,package = "none",include = None):
- """Prepares the created image for final delivery.
- Stage
- add includes
- package
- """
- self._stage_final_image()
-
- if self._recording_pkgs:
- self._save_recording_pkgs(destdir)
-
- #add stuff
- if include and os.path.isdir(include):
- logging.debug("adding everything in %s to %s" % (include,self._outdir))
- files = glob.glob('%s/*' % include)
- for file in files:
- if os.path.isdir(file):
- logging.debug("adding dir %s to %s" % (file,os.path.join(self._outdir,os.path.basename(file))))
- shutil.copytree(file, os.path.join(self._outdir,os.path.basename(file)),symlinks=False)
- else:
- logging.debug("adding %s to %s" % (file,self._outdir))
- shutil.copy(file, self._outdir)
- elif include:
- logging.debug("adding %s to %s" % (include,self._outdir))
- shutil.copy(include, self._outdir)
-
- #package
- (pkg, comp) = os.path.splitext(package)
- if comp:
- comp=comp.lstrip(".")
-
- if pkg == "zip":
- dst = "%s/%s.zip" % (destdir, self.name)
- files = glob.glob('%s/*' % self._outdir)
- if comp == "64":
- logging.debug("creating %s with ZIP64 extensions" % (dst))
- z = zipfile.ZipFile(dst, "w", compression=8, allowZip64="True")
- else:
- logging.debug("creating %s" % (dst))
- z = zipfile.ZipFile(dst, "w", compression=8, allowZip64="False")
- for file in files:
- if file != dst:
- if os.path.isdir(file):
- #because zip sucks we cannot just add a dir
- for root, dirs, dirfiles in os.walk(file):
- for dirfile in dirfiles:
- arcfile=self.name+"/"+root[len(os.path.commonprefix((os.path.dirname(file), root)))+1:]+"/"+dirfile
- filepath=os.path.join(root,dirfile)
- logging.debug("adding %s to %s" % (arcfile,dst))
- z.write(filepath,arcfile, compress_type=None)
- else:
- logging.debug("adding %s to %s" % (os.path.join(self.name,os.path.basename(file)),dst))
- z.write(file, arcname=os.path.join(self.name,os.path.basename(file)), compress_type=None)
- z.close()
-
- elif pkg == "tar":
- if comp:
- dst = "%s/%s.tar.%s" % (destdir, self.name, comp)
- else:
- dst = "%s/%s.tar" % (destdir, self.name)
- files = glob.glob('%s/*' % self._outdir)
- logging.debug("creating %s" % (dst))
- tar = tarfile.open(dst, "w|"+comp)
- for file in files:
- logging.debug("adding %s to %s" % (file,dst))
- tar.add(file, arcname=os.path.join(self.name,os.path.basename(file)))
- tar.close()
-
- else:
- dst = os.path.join(destdir, "%s-%s" % (self.name, self.__disk_format))
- logging.debug("creating destination dir: " + dst)
- makedirs(dst)
- # Ensure all data is flushed to _outdir
- subprocess.call(["sync"])
- for f in os.listdir(self._outdir):
- logging.debug("moving %s to %s" % (os.path.join(self._outdir, f), os.path.join(dst, f)))
- shutil.move(os.path.join(self._outdir, f),os.path.join(dst, f))
- self.outimage.append(os.path.join(dst, f))
- if f[-4:] not in (".vmx", ".xml"):
- self.do_genchecksum(os.path.join(dst, f))
-
def _stage_final_image(self):
"""Stage the final system image in _outdir.
Convert disks
@@ -424,7 +343,8 @@
logging.debug("moving disks to stage location")
for name in self.__disks.keys():
src = "%s/%s-%s.raw" % (self.__imgdir, self.name,name)
- dst = "%s/%s-%s.%s" % (self._outdir, self.name,name, self.__disk_format)
+ self._img_name = "%s-%s.%s" % (self.name, name, self.__disk_format)
+ dst = "%s/%s" % (self._outdir, self._img_name)
logging.debug("moving %s to %s" % (src,dst))
shutil.move(src,dst)
#write meta data in stage dir
@@ -434,7 +354,8 @@
def _convert_image(self):
#convert disk format
for name in self.__disks.keys():
- dst = "%s/%s-%s.%s" % (self._outdir, self.name,name, self.__disk_format)
+ self._img_name = "%s-%s.%s" % (self.name, name, self.__disk_format)
+ dst = "%s/%s" % (self._outdir, self._img_name)
logging.debug("converting %s image to %s" % (self.__disks[name].lofile, dst))
if self.__disk_format != "vdi":
rc = subprocess.call(["/usr/bin/qemu-img", "convert",
--- mic/appcreate/nand.py
+++ mic/appcreate/nand.py
@@ -246,6 +246,7 @@
# create bootimg file
imgpath = os.path.join(self._outdir, '%s-boot.bin' % self.name)
+
try:
imgfile = open(imgpath, 'wb')
except IOError, e:
@@ -281,6 +282,9 @@
raise CreatorError("IO error: %s" % e)
finally:
imgfile.close()
+ os.remove(bootstub)
+ os.remove(vmlinuz)
+ os.remove(initrd)
#
# Actual implementation
@@ -418,10 +422,10 @@
ayum.close()
os.unlink(yum_conf)
- def configure(self):
+ def configure(self, repodata = None):
if not self.__bootimg_only:
# call root class
- ImageCreator.configure(self)
+ ImageCreator.configure(self, repodata)
# copy initrd to instroot
if (self.__initrd_url or self.__initrd_path) and self.__override_initrd:
@@ -434,25 +438,11 @@
shutil.copyfile(initrd_path, initrd_path_in_root)
except IOError:
raise CreatorError("Unable to copy initrd files to instroot")
+ else:
+ # if bootimg only, only call this
+ self._create_bootconfig()
- return
-
- # if bootimg only, only call this
- self._create_bootconfig()
-
- def package(self, destdir = "."):
- """Prepares the created image for final delivery.
- """
-
- if not self.__bootimg_only:
- # parent _stage_final_image move image file from _imgdir to _outdir
- self._stage_final_image()
-
- if self._recording_pkgs:
- self._save_recording_pkgs(destdir)
-
- """ Start to create boot image in _outdir
- """
+ """ Start to create boot image in _outdir """
# get the actual path of boot files
bootstub = self._outdir + "/bootstub"
@@ -460,16 +450,8 @@
initrds = glob.glob(self._outdir + "/initrd*")
# cmdline to be written to image
- #cmdline = "ro boot=usb single pci=noearly console=tty1 console=ttyMS0 earlyprintk=mrst loglevel=8 notsc "
+ # cmdline = "ro boot=usb single pci=noearly console=tty1 console=ttyMS0 earlyprintk=mrst loglevel=8 notsc "
# read boot cmdline from ks file
cmdline = self.ks.handler.bootloader.appendLine
self.__bootable_nandimg(cmdline, bootstub, vmlinuzs[0], initrds[0])
-
- for f in glob.glob("%s/%s-*" % (self._outdir, self.name)):
- shutil.move(f, os.path.join(destdir, os.path.basename(f)))
- self.outimage.append(os.path.join(destdir, os.path.basename(f)))
- if f[-4:] in (".bin"):
- self.do_genchecksum(os.path.join(destdir, os.path.basename(f)))
-
- print "SUCCESS."
--- mic/appcreate/partitionedfs.py
+++ mic/appcreate/partitionedfs.py
@@ -282,8 +282,10 @@
rmmountdir = True
if p['fstype'] == "vfat" or p['fstype'] == "msdos":
myDiskMount = VfatDiskMount
- elif p['fstype'] == "ext2" or p['fstype'] == "ext3":
+ elif p['fstype'] in ("ext2", "ext3", "ext4"):
myDiskMount = ExtDiskMount
+ elif p['fstype'] == "btrfs":
+ myDiskMount = BtrfsDiskMount
else:
raise MountError("Fail to support file system " + p['fstype'])
--- mic/chroot/chroot.py
+++ mic/chroot/chroot.py
@@ -242,6 +242,23 @@
shutil.rmtree(self.imgmnt, ignore_errors = True)
raise imgcreate.CreatorError("Failed to loopback mount '%s' : %s" %
(self.img, e))
+ elif self.imgtype == "raw":
+ self.disk = imgcreate.SparseLoopbackDisk(self.img, self.imgsize)
+ self.extmnt = targetdir
+ self.tmpoutdir = imgcreate.mkdtemp()
+ self.imgloop = appcreate.PartitionedMount({'/dev/sdb':self.disk}, self.extmnt, skipformat = True)
+ self.img_fstype = "ext3"
+ self.imgloop.add_partition(self.imgsize/1024/1024, "/dev/sdb", "/", self.img_fstype, boot=False)
+ self.extloop = None
+ try:
+ self.imgloop.mount()
+ self.os_image = self.img
+ return
+ except imgcreate.MountError, e:
+ self.imgloop.cleanup()
+ raise imgcreate.CreatorError("Failed to loopback mount '%s' : %s" %
+ (self.img, e))
+
else:
shutil.rmtree(self.imgmnt, ignore_errors = True)
raise imgcreate.CreatorError("I can't recognize image type of %s" % self.img)
@@ -297,7 +314,8 @@
raise imgcreate.CreatorError("Failed to loopback mount '%s' : %s" %
(os_image, e))
def cleanup(self):
- self.extloop.cleanup()
+ if self.extloop:
+ self.extloop.cleanup()
if self.imgtype != "ext3fsimg":
self.imgloop.cleanup()
shutil.rmtree(self.tmpoutdir, ignore_errors = True)
@@ -308,7 +326,7 @@
os.chroot(chrootdir)
os.chdir("/")
- """ Register qemu-arm-static if it is an ARM fs """
+ """ Register statically-linked qemu-arm if it is an ARM fs """
dev_null = os.open("/dev/null", os.O_WRONLY)
file = subprocess.Popen(["/usr/bin/file", chrootdir + "/sbin/init"], stdout=subprocess.PIPE, stderr=dev_null)
fileOutput = file.communicate()[0].strip().split("\n")
--- mic/imgconvert/convertor.py
+++ mic/imgconvert/convertor.py
@@ -128,7 +128,7 @@
def _reinstall_kernel(self, kernel, instroot, repo_urls = {}):
# Remove current kernel
- args = [ "/bin/rpm", "--root=" + instroot, "-e", kernel ]
+ args = [ imgcreate.fs.find_binary_path("rpm"), "--root=" + instroot, "-e", kernel ]
subprocess.call(args)
ayum = imgcreate.LiveCDYum()
--- mic/imgcreate/__init__.py
+++ mic/imgcreate/__init__.py
@@ -16,6 +16,9 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+""" When new format is added update the new format to this list. """
+supported_formats = ['fs', 'livecd', 'liveusb', 'loop', 'ubi', 'jffs2']
+
from mic.imgcreate.live import *
from mic.imgcreate.creator import *
from mic.imgcreate.ubi import *
--- mic/imgcreate/bootstrap.py
+++ mic/imgcreate/bootstrap.py
@@ -42,7 +42,6 @@
def get_repo_metadata(repo, cachedir, reponame, proxies = {}, arch = None):
makedirs(cachedir + "/" + reponame)
- print "Geting repomd.xml from repo %s..." % reponame
url = str(repo + "/repodata/repomd.xml")
filename = str("%s/%s/repomd.xml" % (cachedir, reponame))
repomd = myurlgrab(url, filename, proxies)
@@ -58,7 +57,6 @@
primaryxml = str(cachedir + "/%s/%s" % (reponame, os.path.basename(m.group(1))))
primarydb = cachedir + "/%s/%s" % (reponame, ".tmp.primary.sqlite")
primaryxmlurl = str(repo + "/" + m.group(1))
- print "Geting primary.xml from repo %s..." % reponame
primaryxml = myurlgrab(primaryxmlurl, primaryxml, proxies)
if primaryxml.rfind(".gz") != -1:
subprocess.call([gunzip, "-f", primaryxml])
@@ -72,7 +70,6 @@
primarydb = primarydb + ".gz"
elif primarydburl.rfind(".bz2") != -1:
primarydb = primarydb + ".bz2"
- print "Geting primary.sqlite from repo %s..." % reponame
primarydb = myurlgrab(primarydburl, primarydb, proxies)
if primarydb.rfind(".gz") != -1:
subprocess.call([gunzip, "-f", primarydb])
@@ -282,27 +279,37 @@
return childpkgs
-def is_ubuntu():
+def find_key_in_file(key, file):
found = False
+ if not os.path.exists(file):
+ return found
+ fd = open(file, "r")
+ content = fd.read()
+ for line in content.split("\n"):
+ if line.find(key) != -1:
+ found = True
+ break
+ fd.close()
+ return found
+
+def is_debian_based():
+ found = find_key_in_file("Debian", "/etc/issue")
+ if found:
+ return found
+
+ found = find_key_in_file("Ubuntu", "/etc/issue")
+ if found:
+ return found
+
for release in glob.glob("/etc/*-release"):
- fd = open(release, "r")
- content = fd.read()
- for line in content.split("\n"):
- if line.find("Ubuntu") != -1:
- found = True
- break
- fd.close()
+ found = find_key_in_file("Ubuntu", release)
if found:
break
return found
def install_rpm(pkgpath, pkgname, rootpath, force = False):
- rpm = "/bin/rpm"
- if not os.path.exists(rpm):
- rpm = "/usr/bin/rpm"
- if not os.path.exists(rpm):
- raise CreatorError("Failed to run 'rpm'.")
+ rpm = find_binary_path("rpm")
rootpath = os.path.abspath(os.path.expanduser(rootpath))
print "Installing %s..." % pkgname
@@ -311,7 +318,7 @@
argv = [rpm, "-i", "--ignorearch", "--ignoreos", "--nodigest", "--nosignature", "--root=" + rootpath, pkgpath]
if force:
argv.extend(["--force", "--nodeps"])
- if is_ubuntu():
+ if is_debian_based():
argv.append("--force-debian")
subprocess.call(argv, stdout = dev_null, stderr = dev_null)
finally:
@@ -367,7 +374,7 @@
for pkg in pkglist:
download_and_install(pkg, True)
- pkglist = ["glibc", "passwd", "pam-modules-cracklib", "meego-release", "moblin-release", "fastinit", "nss", "genisoimage", "bzip2", "gzip", "cpio", "perl", "syslinux-extlinux", "mic2"]
+ pkglist = ["glibc", "passwd", "pam-modules-cracklib", "meego-release", "moblin-release", "fastinit", "nss", "genisoimage", "bzip2", "gzip", "cpio", "perl", "syslinux-extlinux", "btrfs-progs", "make", "mic2"]
pkglist.extend(["isomd5sum", "wget"])
for pkg in pkglist:
for node in get_my_all_deps_in_order(pkg, con):
@@ -556,3 +563,47 @@
print "Your new image can be found here:"
for file in outimage:
print os.path.abspath(file)
+
+def clean_files(pattern, dir):
+ for f in os.listdir(dir):
+ entry = os.path.join(dir, f)
+ if os.path.isdir(entry):
+ clean_files(pattern, entry)
+ elif re.match(pattern, entry):
+ os.unlink(entry)
+
+def copy_mic2(bootstrap, bin_path = "/usr/bin", python_lib_path = "/usr/lib/python2.6/site-packages"):
+ bootstrap_mic = bootstrap + "/usr/lib/python2.6/site-packages/mic"
+ shutil.rmtree(bootstrap_mic, ignore_errors = True)
+ subprocess.call(["/bin/cp", "-af", python_lib_path + "/mic", os.path.dirname(bootstrap_mic)])
+ clean_files(".*\.py[co]$", bootstrap_mic)
+ for file in glob.glob(bootstrap + "/usr/bin/mic-*"):
+ os.unlink(file)
+ for file in glob.glob(bootstrap + "/usr/bin/moblin-*"):
+ os.unlink(file)
+ os.unlink(bootstrap + "/usr/bin/mic")
+ for file in glob.glob(bin_path + "/mic-*"):
+ shutil.copy(file, bootstrap + "/usr/bin/" + os.path.basename(file))
+ for file in glob.glob(bin_path + "/moblin-*"):
+ if os.path.islink(file):
+ linkto = os.readlink(file)
+ os.symlink(linkto, bootstrap + "/usr/bin/" + os.path.basename(file))
+ shutil.copy(bin_path + "/mic", bootstrap + "/usr/bin/mic")
+
+def check_mic(bootstrap):
+ import distutils.sysconfig
+ pythonlib = distutils.sysconfig.get_python_lib()
+ if os.path.exists(pythonlib + "/mic/imgcreate/creator.py"):
+ copy_mic2(bootstrap, bin_path = "/usr/bin", python_lib_path = pythonlib)
+ elif is_debian_based():
+ dev_null = os.open("/dev/null", os.O_WRONLY)
+ proc = subprocess.Popen(["/usr/bin/pycentral", "pycentraldir", "mic2"],
+ stdout = subprocess.PIPE, stderr = dev_null)
+ output = proc.communicate()[0]
+ os.close(dev_null)
+ if proc.returncode != 0:
+ raise CreatorError("Failed to run /usr/bin/pycentral")
+ else:
+ pycentraldir = output.split()[0]
+ pythonlib = pycentraldir
+ copy_mic2(bootstrap, bin_path = "/usr/local/bin", python_lib_path = pythonlib)
--- mic/imgcreate/creator.py
+++ mic/imgcreate/creator.py
@@ -65,7 +65,7 @@
name -- a name for the image; used for e.g. image filenames or
filesystem labels
-
+
"""
self.ks = ks
"""A pykickstart.KickstartParser instance."""
@@ -75,7 +75,7 @@
self.distro_name = "MeeGo"
- """Output image file name"""
+ """Output image file names"""
self.outimage = []
"""A flag to generate checksum"""
@@ -91,6 +91,10 @@
self.__builddir = None
self.__bindmounts = []
+ """ Contains the compression method that is used to compress
+ the disk image after creation, e.g., bz2.
+ This value is set with compression_method function. """
+ self.__img_compression_method = None
# dependent commands to check
self._dep_checks = [('/bin/ls',),
@@ -111,6 +115,17 @@
# target arch for non-x86 image
self.target_arch = None
+ """ Name of the disk image file that is created. """
+ self._img_name = None
+
+ """ No ks provided when called by convertor, so skip the dependency check """
+ if self.ks:
+ """ If we have btrfs partition we need to check that we have toosl for those """
+ for part in self.ks.handler.partition.partitions:
+ if part.fstype and part.fstype == "btrfs":
+ self._dep_checks.append(("/sbin/mkfs.btrfs",))
+ break
+
def set_target_arch(self, arch):
if not rpmUtils.arch.arches.has_key(arch):
return False
@@ -119,7 +134,10 @@
for dep in self._dep_checks:
if "/sbin/extlinux" in dep:
self._dep_checks.remove(dep)
- self._dep_checks.append(("/usr/bin/qemu-arm-static",))
+
+ if not os.path.exists("/usr/bin/qemu-arm") or not is_statically_linked("/usr/bin/qemu-arm"):
+ self._dep_checks.append(("/usr/bin/qemu-arm-static",))
+
return True
@@ -234,6 +252,7 @@
content = '\n'.join(pkgs)
f.write(content)
f.close()
+ self.outimage.append(namefile);
# if 'content', save more details
if self._recording_pkgs == 'content':
@@ -258,6 +277,7 @@
content += '\n'
f.write(content)
f.close()
+ self.outimage.append(contfile)
def _get_required_packages(self):
"""Return a list of required packages.
@@ -826,7 +846,17 @@
finally:
os.unlink(path)
- def configure(self):
+ def __save_repo_keys(self, repodata):
+ if not repodata:
+ return None
+ gpgkeydir = "/etc/pki/rpm-gpg"
+ makedirs(self._instroot + gpgkeydir)
+ for repo in repodata:
+ if repo["repokey"]:
+ repokey = gpgkeydir + "/RPM-GPG-KEY-%s" % repo["name"]
+ shutil.copy(repo["repokey"], self._instroot + repokey)
+
+ def configure(self, repodata = None):
"""Configure the system image according to the kickstart.
This method applies the (e.g. keyboard or network) configuration
@@ -851,12 +881,10 @@
kickstart.NetworkConfig(self._instroot).apply(ksh.network)
kickstart.RPMMacroConfig(self._instroot).apply(self.ks)
kickstart.DesktopConfig(self._instroot).apply(ksh.desktop)
- kickstart.MoblinRepoConfig(self._instroot).apply(ksh.repo)
+ self.__save_repo_keys(repodata)
+ kickstart.MoblinRepoConfig(self._instroot).apply(ksh.repo, repodata)
except:
- if self.target_arch:
- pass
- else:
- raise CreatorError("Failed to apply configuration to image")
+ raise CreatorError("Failed to apply configuration to image")
if not self.target_arch:
self._create_bootconfig()
@@ -892,6 +920,7 @@
fd = open(image_name + ".md5sum", "w")
fd.write(md5sum)
fd.close()
+ self.outimage.append(image_name+".md5sum")
def package(self, destdir = "."):
"""Prepares the created image for final delivery.
@@ -907,6 +936,22 @@
"""
self._stage_final_image()
+ if self.__img_compression_method:
+ if not self._img_name:
+ raise CreatorError("Image name not set.")
+ rc = None
+ img_location = os.path.join(self._outdir,self._img_name)
+ if self.__img_compression_method == "bz2":
+ print "Compressing %s with bzip2. Please wait..." % img_location
+ rc = subprocess.call([bzip2, "-f", img_location])
+ if rc:
+ raise CreatorError("Failed to compress image %s with %s." % (img_location, self.__img_compression_method))
+ for bootimg in glob.glob(os.path.dirname(img_location) + "/*-boot.bin"):
+ print "Compressing %s with bzip2. Please wait..." % bootimg
+ rc = subprocess.call([bzip2, "-f", bootimg])
+ if rc:
+ raise CreatorError("Failed to compress image %s with %s." % (bootimg, self.__img_compression_method))
+
if self._recording_pkgs:
self._save_recording_pkgs(destdir)
@@ -932,6 +977,7 @@
def print_outimage_info(self):
print "Your new image can be found here:"
+ self.outimage.sort()
for file in self.outimage:
print os.path.abspath(file)
@@ -956,17 +1002,23 @@
dst = "%s/%s-%s.tar" % (destdir, self.name, image_format)
print "creating %s" % dst
tar = tarfile.open(dst, "w:" + comp)
- for file in self.outimage:
+
+ for file in self.outimage:
print "adding %s to %s" % (file, dst)
tar.add(file, arcname=os.path.join("%s-%s" % (self.name, image_format), os.path.basename(file)))
+ if os.path.isdir(file):
+ shutil.rmtree(file, ignore_errors = True)
+ else:
+ os.remove(file)
+
+
tar.close()
- self.outimage.append(dst)
+
+ '''All the file in outimage has been packaged into tar.* file'''
+ self.outimage = [dst]
def release_output(self, config, destdir, name):
- create_release(config, destdir, name)
- self.outimage = []
- for f in os.listdir(destdir):
- self.outimage.append(os.path.join(destdir, f))
+ self.outimage = create_release(config, destdir, name, self.outimage)
def save_kernel(self, destdir):
if not os.path.exists(destdir):
@@ -976,6 +1028,17 @@
shutil.copy(kernel, kernelfilename)
self.outimage.append(kernelfilename)
+ def compress_disk_image(self, compression_method):
+ """
+ With this you can set the method that is used to compress the disk
+ image after it is created.
+ """
+
+ if compression_method not in ('bz2'):
+ raise CreatorError("Given disk image compression method ('%s') is not valid." % (compression_method))
+
+ self.__img_compression_method = compression_method
+
class LoopImageCreator(ImageCreator):
"""Installs a system into a loopback-mountable filesystem image.
@@ -1014,6 +1077,8 @@
4096L * 1024 * 1024)
else:
self.__image_size = 0
+
+ self._img_name = self.name + ".img"
def _set_fstype(self, fstype):
self.__fstype = fstype
@@ -1158,7 +1223,8 @@
def _stage_final_image(self):
self._resparse()
- shutil.move(self._image, self._outdir + "/" + self.name + ".img")
+ shutil.move(self._image, self._outdir + "/" + self._img_name)
+
class FsImageCreator(ImageCreator):
--- mic/imgcreate/fs.py
+++ mic/imgcreate/fs.py
@@ -26,24 +26,68 @@
import string
import logging
import time
+import fcntl
+import struct
+import termios
from mic.imgcreate.errors import *
from urlgrabber.grabber import URLGrabber
from urlgrabber.grabber import URLGrabError
-if os.path.exists('/bin/bunzip2'):
- bunzip2 = '/bin/bunzip2'
-elif os.path.exists('/usr/bin/bunzip2'):
- bunzip2 = '/usr/bin/bunzip2'
-else:
- raise CreatorError('Failed to find bunzip2.')
-
-if os.path.exists('/bin/gunzip'):
- gunzip = '/bin/gunzip'
-elif os.path.exists('/usr/bin/gunzip'):
- gunzip = '/usr/bin/gunzip'
-else:
- raise CreatorError('Failed to find gunzip.')
+def terminal_width(fd=1):
+ """ Get the real terminal width """
+ try:
+ buf = 'abcdefgh'
+ buf = fcntl.ioctl(fd, termios.TIOCGWINSZ, buf)
+ return struct.unpack('hhhh', buf)[1]
+ except: # IOError
+ return 80
+
+def truncate_url(url, width):
+ if len(url) > width:
+ return os.path.basename(url)[0:width]
+ return url
+
+class TextProgress(object):
+ def start(self, filename, url, *args, **kwargs):
+ self.url = url
+ self.termwidth = terminal_width()
+ sys.stdout.write("Retrieving %s " % truncate_url(self.url, self.termwidth - 13))
+ sys.stdout.flush()
+ self.indicators = ["-", "\\", "|", "/"]
+ self.counter = 0
+ def update(self, *args):
+ if sys.stdout.isatty():
+ sys.stdout.write("\rRetrieving %s %s" % (truncate_url(self.url, self.termwidth - 13), self.indicators[self.counter%4]))
+ sys.stdout.flush()
+ self.counter += 1
+ else:
+ pass
+ def end(self, *args):
+ if sys.stdout.isatty():
+ sys.stdout.write("\rRetrieving %s ...OK\n" % (self.url,))
+ else:
+ sys.stdout.write("...OK\n")
+ sys.stdout.flush()
+
+def find_binary_path(binary):
+ if os.environ.has_key("PATH"):
+ paths = os.environ["PATH"].split(":")
+ else:
+ paths = []
+ if os.environ.has_key("HOME"):
+ paths += [os.environ["HOME"] + "/bin"]
+ paths += ["/usr/local/sbin", "/usr/local/bin", "/usr/sbin", "/usr/bin", "/sbin", "/bin"]
+
+ for path in paths:
+ bin_path = "%s/%s" % (path, binary)
+ if os.path.exists(bin_path):
+ return bin_path
+ raise CreatorError("Command '%s' is not available." % binary)
+
+bunzip2 = find_binary_path('bunzip2')
+gunzip = find_binary_path('gunzip')
+bzip2 = find_binary_path('bzip2')
def makedirs(dirname):
"""A version of os.makedirs() that doesn't throw an
@@ -650,7 +694,7 @@
found = True
break
if not found:
- raise MountError("Your system can't mount btrfs filesystem")
+ raise MountError("Your system can't mount btrfs filesystem, please make sure your kernel has btrfs support and the module btrfs.ko has been loaded.")
# disable selinux, selinux will block write
if os.path.exists("/usr/sbin/setenforce"):
@@ -877,7 +921,7 @@
else:
try:
filename = g.urlgrab(url = url, filename = filename,
- proxies = proxies, http_headers = (('Pragma', 'no-cache'),))
+ proxies = proxies, http_headers = (('Pragma', 'no-cache'),), progress_obj = TextProgress())
except URLGrabError, e:
raise CreatorError("URLGrabber error: %s: %s" % (e, url))
except:
--- mic/imgcreate/jffs2.py
+++ mic/imgcreate/jffs2.py
@@ -32,12 +32,13 @@
self.image_size = 0
self._set_image_size(self.image_size)
self.img_done = False
- self._mkjffs2fs = "/usr/sbin/mkfs.jffs2"
- self._dep_checks.append((self._mkjffs2fs,))
+ self._mkjffs2fs = "/usr/sbin/mkfs.jffs2"
+ self._dep_checks.append((self._mkjffs2fs,))
+ self._img_name = self.name + ".jffs2"
def _genjffs2img(self):
self.img_done = True
- rc = subprocess.call([self._mkjffs2fs, "-e", "128", "-l", "-n", "-r", self._instroot, "-o", self._outdir + "/" + self.name + ".jffs2"])
+ rc = subprocess.call([self._mkjffs2fs, "-e", "128", "-l", "-n", "-r", self._instroot, "-o", self._outdir + "/" + self._img_name])
if rc:
raise CreatorError("Failed to make jffs2 image")
--- mic/imgcreate/kickstart.py
+++ mic/imgcreate/kickstart.py
@@ -384,12 +384,13 @@
fd.write("baseurl=" + baseurl + "\n")
if mirrorlist:
fd.write("mirrorlist=" + mirrorlist + "\n")
- if repo.proxy:
- fd.write("proxy=" + repo.proxy + "\n")
- if repo.proxy_username:
- fd.write("proxy_username=" + repo.proxy_username + "\n")
- if repo.proxy_password:
- fd.write("proxy_password=" + repo.proxy_password + "\n")
+ """ Skip saving proxy settings """
+ #if repo.proxy:
+ # fd.write("proxy=" + repo.proxy + "\n")
+ #if repo.proxy_username:
+ # fd.write("proxy_username=" + repo.proxy_username + "\n")
+ #if repo.proxy_password:
+ # fd.write("proxy_password=" + repo.proxy_password + "\n")
if repo.gpgkey:
fd.write("gpgkey=" + repo.gpgkey + "\n")
fd.write("gpgcheck=1\n")
@@ -412,11 +413,19 @@
self.__create_repo_section(repo, "source", f)
f.close()
- def apply(self, ksrepo):
+ def apply(self, ksrepo, repodata):
for repo in ksrepo.repoList:
if repo.save:
self.__create_repo_file(repo, "/etc/yum.repos.d")
self.__create_repo_file(repo, "/etc/zypp/repos.d")
+ """ Import repo gpg keys """
+ if repodata:
+ dev_null = os.open("/dev/null", os.O_WRONLY)
+ for repo in repodata:
+ if repo['repokey']:
+ subprocess.call([fs.find_binary_path("rpm"), "--root=%s" % self.instroot, "--import", repo['repokey']],
+ stdout = dev_null, stderr = dev_null)
+ os.close(dev_null)
class RPMMacroConfig(KickstartConfig):
"""A class to apply the specified rpm macros to the filesystem"""
--- mic/imgcreate/misc.py
+++ mic/imgcreate/misc.py
@@ -92,11 +92,7 @@
def get_file_size(file):
"""Return size in MB unit"""
- du = "/usr/bin/du"
- if not os.path.exists(du):
- du = "/bin/du"
- if not os.path.exists(du):
- raise CreatorError("command du isn't available")
+ du = find_binary_path("du")
dev_null = os.open("/dev/null", os.O_WRONLY)
duProc = subprocess.Popen([du, "-s", "-b", "-B", "1M", file],
stdout=subprocess.PIPE, stderr=dev_null)
@@ -342,6 +338,8 @@
if not _my_noproxy:
return
for item in _my_noproxy.split(","):
+ if not item:
+ continue
if item[0] != '.' and item.find("/") == -1:
""" Need to match it """
_my_noproxy_list.append({"match":0,"needle":item.strip()})
@@ -597,9 +595,26 @@
site_repos.append(repostr[1:])
return site_repos
+def get_metadata_from_repo(baseurl, proxies, cachedir, reponame, filename):
+ suffix = None
+ if filename.endswith(".gz"):
+ suffix = ".gz"
+ if filename.endswith(".bz2"):
+ suffix = ".bz2"
+ url = str(baseurl + "/" + filename)
+ filename_tmp = str("%s/%s/%s" % (cachedir, reponame, os.path.basename(filename)))
+ filename = myurlgrab(url, filename_tmp, proxies)
+ if suffix == ".bz2":
+ subprocess.call([bunzip2, "-f", filename])
+ if suffix == ".gz":
+ subprocess.call([gunzip, "-f", filename])
+ if suffix:
+ filename = filename.replace(suffix, "")
+ return filename
+
def get_metadata_from_repos(repostrs, cachedir):
if not cachedir:
- cachedir = os.path.abspath(os.path.expanduser("~/.mic2_cachedir"))
+ CreatorError("No cache dir defined.")
my_repo_metadata = []
for repostr in repostrs:
@@ -623,7 +638,6 @@
if proxy:
proxies = {str(proxy.split(":")[0]):str(proxy)}
makedirs(cachedir + "/" + reponame)
- print "Geting repomd.xml from repo %s..." % reponame
url = str(baseurl + "/repodata/repomd.xml")
filename = str("%s/%s/repomd.xml" % (cachedir, reponame))
repomd = myurlgrab(url, filename, proxies)
@@ -667,58 +681,23 @@
if not primary_type:
continue
- print "Getting primary%s from repo %s..." % (primary_type, reponame)
primary = elm.find("%slocation" % ns).attrib['href']
- suffix = None
- if primary.endswith(".gz"):
- suffix = ".gz"
- if primary.endswith(".bz2"):
- suffix = ".bz2"
- url = str(baseurl + "/" + primary)
- filename = str("%s/%s/%s" % (cachedir, reponame, os.path.basename(primary)))
- primary = myurlgrab(url, filename, proxies)
- if suffix == ".bz2":
- subprocess.call([bunzip2, "-f", primary])
- if suffix == ".gz":
- subprocess.call([gunzip, "-f", primary])
- if suffix:
- primary = primary.replace(suffix, "")
+ primary = get_metadata_from_repo(baseurl, proxies, cachedir, reponame, primary)
if patterns:
- print "Getting patterns %s from repo %s..." % (patterns, reponame)
- suffix = None
- if patterns.endswith(".gz"):
- suffix = ".gz"
- if patterns.endswith(".bz2"):
- suffix = ".bz2"
- url = str(baseurl + "/" + patterns)
- filename = str("%s/%s/%s" % (cachedir, reponame, os.path.basename(patterns)))
- patterns = myurlgrab(url, filename, proxies)
- if suffix == ".bz2":
- subprocess.call([bunzip2, "-f", patterns])
- if suffix == ".gz":
- subprocess.call([gunzip, "-f", patterns])
- if suffix:
- patterns = patterns.replace(suffix, "")
+ patterns = get_metadata_from_repo(baseurl, proxies, cachedir, reponame, patterns)
if comps:
- print "Getting comps %s from repo %s..." % (comps, reponame)
- suffix = None
- if comps.endswith(".gz"):
- suffix = ".gz"
- if comps.endswith(".bz2"):
- suffix = ".bz2"
- url = str(baseurl + "/" + comps)
- filename = str("%s/%s/%s" % (cachedir, reponame, os.path.basename(comps)))
- comps = myurlgrab(url, filename, proxies)
- if suffix == ".bz2":
- subprocess.call([bunzip2, "-f", comps])
- if suffix == ".gz":
- subprocess.call([gunzip, "-f", comps])
- if suffix:
- comps = comps.replace(suffix, "")
+ comps = get_metadata_from_repo(baseurl, proxies, cachedir, reponame, comps)
- my_repo_metadata.append({"name":reponame, "baseurl":baseurl, "repomd":repomd, "primary":primary, "cachedir":cachedir, "proxies":proxies, "patterns":patterns, "comps":comps})
+ """ Get repo key """
+ try:
+ repokey = get_metadata_from_repo(baseurl, proxies, cachedir, reponame, "repodata/repomd.xml.key")
+ except CreatorError:
+ repokey = None
+ print "Warning: can't get %s/%s" % (baseurl, "repodata/repomd.xml.key")
+
+ my_repo_metadata.append({"name":reponame, "baseurl":baseurl, "repomd":repomd, "primary":primary, "cachedir":cachedir, "proxies":proxies, "patterns":patterns, "comps":comps, "repokey":repokey})
return my_repo_metadata
def get_arch(repometadata):
@@ -905,53 +884,80 @@
return pkglist
+def is_statically_linked(binary):
+ ret = False
+ dev_null = os.open("/dev/null", os.O_WRONLY);
+ args = [ "/usr/bin/file", binary ]
+ file = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=dev_null)
+ output = file.communicate()[0]
+ os.close(dev_null)
+ if output.find(", statically linked, ") > 0:
+ ret = True
+ return ret
+
def setup_qemu_emulator(rootdir, arch):
# mount binfmt_misc if it doesn't exist
if not os.path.exists("/proc/sys/fs/binfmt_misc"):
subprocess.call(["/sbin/modprobe", "binfmt_misc"])
if not os.path.exists("/proc/sys/fs/binfmt_misc/register"):
subprocess.call(["/bin/mount", "-t", "binfmt_misc", "none", "/proc/sys/fs/binfmt_misc"])
- # qemu emulator should be a static-linked executable file
- qemu_emulator = "/usr/bin/qemu-arm-static"
+ # qemu emulator should be a statically-linked executable file
+ qemu_emulator = "/usr/bin/qemu-arm"
+ if not os.path.exists(qemu_emulator) or not is_statically_linked(qemu_emulator):
+ qemu_emulator = "/usr/bin/qemu-arm-static"
if not os.path.exists(qemu_emulator):
- raise CreatorError("Please install qemu-arm-static")
+ raise CreatorError("Please install a statically-linked qemu-arm")
if not os.path.exists(rootdir + "/usr/bin"):
makedirs(rootdir + "/usr/bin")
shutil.copy(qemu_emulator, rootdir + qemu_emulator)
- # unregister it if it has been registered
- if os.path.exists("/proc/sys/fs/binfmt_misc/qemu-arm-static"):
+ node = "/proc/sys/fs/binfmt_misc/arm"
+ if is_statically_linked(qemu_emulator) and os.path.exists(node):
+ return
+
+ # unregister it if it has been registered and is a dynamically-linked executable
+ if not is_statically_linked(qemu_emulator) and os.path.exists(node):
qemu_unregister_string = "-1\n"
- fd = open("/proc/sys/fs/binfmt_misc/qemu-arm-static", "w")
+ fd = open("/proc/sys/fs/binfmt_misc/arm", "w")
fd.write(qemu_unregister_string)
fd.close()
# register qemu emulator for interpreting other arch executable file
- qemu_arm_string = ":qemu-arm-static:M::\\x7fELF\\x01\\x01\\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x02\\x00\\x28\\x00:\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\x00\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xfa\\xff\\xff\\xff:/usr/bin/qemu-arm-static:\n"
- fd = open("/proc/sys/fs/binfmt_misc/register", "w")
- fd.write(qemu_arm_string)
- fd.close()
+ if not os.path.exists(node):
+ qemu_arm_string = ":arm:M::\\x7fELF\\x01\\x01\\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x02\\x00\\x28\\x00:\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\x00\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xfa\\xff\\xff\\xff:%s:\n" % qemu_emulator
+ fd = open("/proc/sys/fs/binfmt_misc/register", "w")
+ fd.write(qemu_arm_string)
+ fd.close()
- # disable selinux, selinux will block qemu-arm-static to run
+ # disable selinux, selinux will block qemu emulator to run
if os.path.exists("/usr/sbin/setenforce"):
subprocess.call(["/usr/sbin/setenforce", "0"])
-def create_release(config, destdir, name):
+def create_release(config, destdir, name, outimages):
+ """ TODO: This functionality should really be in creator.py inside the
+ ImageCreator class. """
+
""" Create release directory and files """
os.system ("cp %s %s/%s.ks" % (config, destdir, name))
+ outimages.append("%s/%s.ks" % (destdir,name))
+
os.system ("mv %s/*-pkgs.txt %s/%s.packages" % (destdir, destdir, name))
+ outimages.append("%s/%s.packages" % (destdir,name))
+
d = os.listdir(destdir)
for f in d:
if os.path.isdir(destdir+"/"+f):
shutil.rmtree("%s/%s" %(destdir, f ))
continue
- if ".iso" in f:
+ if f.endswith(".iso"):
ff = f.replace(".iso", ".img")
os.rename("%s/%s" %(destdir, f ), "%s/%s" %(destdir, ff))
- elif ".usbimg" in f:
+ outimages.append("%s/%s" %(destdir, ff))
+ elif f.endswith(".usbimg"):
ff = f.replace(".usbimg", ".img")
os.rename("%s/%s" %(destdir, f ), "%s/%s" %(destdir, ff))
- elif "-sda.bin" in f or "-boot.bin" in f:
+ outimages.append("%s/%s" %(destdir, ff))
+ elif f.endswith("-sda.bin") or f.endswith("-boot.bin"):
os.remove(destdir+"/"+f)
fd = open(destdir + "/MANIFEST", "w")
@@ -968,5 +974,34 @@
else:
md5sum = md5sum.split(" ")[0]
fd.write(md5sum+" "+f+"\n")
-
+
+ outimages.append("%s/MANIFEST" % destdir)
fd.close()
+
+ """ Update the file list. """
+ updated_list = []
+ for file in outimages:
+ if os.path.exists("%s" % file):
+ updated_list.append(file)
+
+ return updated_list
+
+def get_local_distro():
+ print "Local linux distribution:"
+ for file in glob.glob("/etc/*-release"):
+ fd = open(file, "r")
+ content = fd.read()
+ fd.close()
+ print content
+ if os.path.exists("/etc/issue"):
+ fd = open("/etc/issue", "r")
+ content = fd.read()
+ fd.close()
+ print content
+
+def check_mic_installation(argv):
+ print argv
+ creator_name = os.path.basename(argv[0])
+ if os.path.exists("/usr/local/bin/" + creator_name) \
+ and os.path.exists("/usr/bin/" + creator_name):
+ raise CreatorError("There are two mic2 installations existing, this will result in some unpredictable errors, the reason is installation path of mic2 binary is different from installation path of mic2 source on debian-based distros, please remove one of them to ensure it can work normally.")
--- mic/imgcreate/ubi.py
+++ mic/imgcreate/ubi.py
@@ -35,6 +35,7 @@
self._ubinize = "/usr/sbin/ubinize"
self._dep_checks.append((self._mkubifs,))
self._dep_checks.append((self._ubinize,))
+ self._img_name = self.name + ".ubiimg"
def _writeUbiConf(self, configfile, baseimage):
conf = "[ubifs]\n"
@@ -62,7 +63,7 @@
rc = subprocess.call([self._mkubifs, "-m", "2048", "-e", "129024", "-c", str(max_leb_cnt), "-R", "4MiB", "-r", self._instroot, "-v", "-o", baseimage])
if rc:
raise CreatorError("Failed to make ubifs")
- rc = subprocess.call([self._ubinize, "-o", self._outdir + "/" + self.name + ".ubiimg", "-m", "2048", "-p", "128KiB", "-s", "512", configfile])
+ rc = subprocess.call([self._ubinize, "-o", self._outdir + "/" + self._img_name, "-m", "2048", "-p", "128KiB", "-s", "512", configfile])
if rc:
raise CreatorError("Failed to generate ubi image")
finally:
--- mic/imgcreate/yuminst.py
+++ mic/imgcreate/yuminst.py
@@ -32,15 +32,7 @@
import subprocess
from mic.imgcreate.errors import *
-
-class TextProgress(object):
- def start(self, filename, url, *args, **kwargs):
- sys.stdout.write("Retrieving %s " % (url,))
- self.url = url
- def update(self, *args):
- pass
- def end(self, *args):
- sys.stdout.write("...OK\n")
+from mic.imgcreate.fs import *
class LiveCDYum(yum.YumBase):
def __init__(self, recording_pkgs=None, target_arch = None):
--- mic2.spec
+++ mic2.spec
@@ -1,24 +1,19 @@
#
-# Do not Edit! Generated by:
-# spectacle version 0.13~pre
-# On 2010-02-24
+# Do NOT Edit the Auto-generated Part!
+# Generated by: spectacle version 0.18
#
# >> macros
-
# << macros
-%if 0%{?suse_version}
-%{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
-%else
-%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
-%endif
+
+%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
Name: mic2
-Summary: Tools for building images
-Version: 0.19
+Summary: Tools for building images for MeeGo
+Version: 0.21.0
Release: 1
Group: System/Base
License: GPLv2
-URL: http://meego.gitorious.org/meego-developer-tools/image-creator
BuildArch: noarch
+URL: http://meego.gitorious.org/meego-developer-tools/image-creator
Source0: %{name}-%{version}.tar.gz
Source100: mic2.yaml
Requires: util-linux
@@ -26,7 +21,7 @@
Requires: python >= 2.5
Requires: e2fsprogs
Requires: dosfstools >= 2.11-8
-Requires: yum >= 3.2.22
+Requires: yum >= 3.2.24
Requires: pykickstart >= 0.96
Requires: python-iniparse
Requires: syslinux >= 3.82
@@ -43,20 +38,21 @@
Requires: gzip
Requires: bzip2
Requires: squashfs-tools >= 4.0
-BuildRequires: python
+Requires: btrfs-progs
BuildRequires: python-devel
BuildRequires: zlib-devel
-
BuildRoot: %{_tmppath}/%{name}-%{version}-build
+
%description
-Tools for building images. http://moblin.org/projects/moblin-image-creator-2 for more details.
+Tools for building images for MeeGo. http://meego.gitorious.org/meego-developer-tools/image-creator for more details.
%prep
%setup -q -n %{name}-%{version}
+
# >> setup
# << setup
@@ -67,17 +63,15 @@
CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build
# >> build post
-
# << build post
%install
-rm -rf %{buildroot}
+rm -rf $RPM_BUILD_ROOT
# >> install pre
-
# << install pre
%if 0%{?suse_version}
-%{__python} setup.py install --root=%{buildroot} --prefix=%{_prefix}
+%{__python} setup.py install --root=$RPM_BUILD_ROOT --prefix=%{_prefix}
%else
-%{__python} setup.py install --root=%{buildroot} -O1
+%{__python} setup.py install --root=$RPM_BUILD_ROOT -O1
%endif
# >> install post
@@ -86,9 +80,6 @@
make DESTDIR=%{buildroot} installsymlinks
# << install post
-%clean
-rm -rf %{buildroot}
-
@@ -97,18 +88,14 @@
%files
%defattr(-,root,root,-)
# >> files
-%if 0%{?suse_version}
-%{python_sitearch}/*
-%else
-%{python_sitelib}/*
-%endif
-%{_bindir}/*
%dir %{_sysconfdir}/%{name}
%config(noreplace) %{_sysconfdir}/%{name}/%{name}.conf
%doc HACKING API ChangeLog
%doc examples/
%doc tests/
%{_mandir}/man1/*.1.gz
+%{python_sitelib}/*
+%{_bindir}/*
# << files
--- mic2.yaml
+++ mic2.yaml
@@ -1,25 +1,26 @@
Name: mic2
-Summary: Tools for building images for Moblin
-Version: 0.19
+Summary: Tools for building images for MeeGo
+Version: 0.21.0
Release: 1
Group: System/Base
License: GPLv2
-URL: http://moblin.org/projects/moblin-image-creator-2
+URL: http://meego.gitorious.org/meego-developer-tools/image-creator
Description: |
- Tools for generating moblin2 live images. http://moblin.org/projects/moblin-image-creator-2 for more details.
+ Tools for building images for MeeGo. http://meego.gitorious.org/meego-developer-tools/image-creator for more details.
Sources:
- "%{name}-%{version}.tar.gz"
-Configure: none
+
Builder: python
BuildArch: noarch
SupportOtherDistros: yes
+
Requires:
- util-linux
- coreutils
- python >= 2.5
- e2fsprogs
- dosfstools >= 2.11-8
- - yum > 3.0
+ - yum >= 3.2.24
- pykickstart >= 0.96
- python-iniparse
- syslinux >= 3.82
@@ -36,8 +37,8 @@
- gzip
- bzip2
- squashfs-tools >= 4.0
+ - btrfs-progs
PkgBR:
- - python
- python-devel
- zlib-devel
--- tools/mic
+++ tools/mic
@@ -50,7 +50,7 @@
${help_list}
global ${option_list}
For additional information, see
- * http://www.meego.org/
+ * http://www.meego.com/
"""
name = 'mic'
conf = None
--- tools/mic-check-alldeps
+++ tools/mic-check-alldeps
@@ -40,7 +40,7 @@
fi
}
-distros=("Fedora" "Redhat" "CentOS" "openSUSE" "SUSE" "Ubuntu" "Debian")
+distros=("Fedora" "Redhat" "CentOS" "openSUSE" "SUSE" "Ubuntu" "Debian" "MeeGo")
extrapkgs=()
if [ $(id -u) != 0 ]; then
@@ -68,39 +68,52 @@
exit 1
fi
+requiredpkgs=("autoconf" "automake" "yum" "rpm" "kpartx" "parted" "syslinux" "curl" "gcc" "bzip2" "gzip" "python-iniparse")
+
case $distro in
"Fedora" | "Redhat" | "CentOS")
installer="yum -y install"
querycmd="rpm -q"
qvercmd="rpm -q --qf %{VERSION}"
- extrapkgs=("isomd5sum" "squashfs-tools" "device-mapper" "sqlite" "zlib-devel" "python-devel" "qemu-img" "make")
+ extrapkgs=("pykickstart" "isomd5sum" "squashfs-tools" "device-mapper" "sqlite" "zlib-devel" "python-devel" "qemu-img" "make")
+ ;;
+ "MeeGo")
+ installer="yum -y install"
+ querycmd="rpm -q"
+ qvercmd="rpm -q --qf %{VERSION}"
+ extrapkgs=("pykickstart" "isomd5sum" "squashfs-tools" "device-mapper" "sqlite" "zlib-devel" "python-devel" "make")
;;
"openSUSE")
installer="zypper install"
querycmd="rpm -q"
- extrapkgs=("squashfs" "device-mapper" "sqlite3" "zlib-devel" "python-devel" "qemu" "make")
+ qvercmd="rpm -q --qf %{VERSION}"
+ extrapkgs=("pykickstart" "squashfs" "device-mapper" "sqlite3" "zlib-devel" "python-devel" "qemu" "make")
;;
"SUSE")
installer="zypper install"
querycmd="rpm -q"
qvercmd="rpm -q --qf %{VERSION}"
- extrapkgs=("isomd5sum" "squashfs-tools" "device-mapper" "sqlite" "zlib-devel" "python-devel" "qemu-img")
+ extrapkgs=("pykickstart" "isomd5sum" "squashfs-tools" "device-mapper" "sqlite" "zlib-devel" "python-devel" "qemu-img")
;;
"Ubuntu")
installer="apt-get install"
querycmd="dpkg -s"
qvercmd="dpkg -s"
- extrapkgs=("isomd5sum" "squashfs-tools" "python-celementtree" "python-elementtree" "python-dev" "dmsetup" "sqlite3" "libsqlite3-0" "zlib1g-dev" "qemu-kvm")
+ extrapkgs=("python-pykickstart" "isomd5sum" "squashfs-tools" "python-dev" "dmsetup" "sqlite3" "libsqlite3-0" "zlib1g-dev" "qemu-kvm")
+ read dummy ubuntu_rel < <(lsb_release -r)
+ # Include elementtree packages only if Ubuntu major release is older than 10.04
+ if [ ${ubuntu_rel%%.*} -lt 10 ] ; then
+ extrapkgs=(${extrapkgs[*]} "python-celementtree" "python-elementtree")
+ fi
;;
"Debian")
installer="apt-get install"
querycmd="dpkg -s"
qvercmd="dpkg -s"
- extrapkgs=("isomd5sum" "squashfs-tools" "python-celementtree" "python-elementtree" "python-dev" "dmsetup" "sqlite3" "libsqlite3-0" "zlib1g-dev" "qemu" "kvm" "make" "mkisofs")
+ extrapkgs=("python-pykickstart" "isomd5sum" "squashfs-tools" "python-celementtree" "python-elementtree" "python-dev" "dmsetup" "sqlite3" "libsqlite3-0" "zlib1g-dev" "qemu" "kvm" "make" "mkisofs")
;;
esac
-requiredpkgs=("autoconf" "automake" "yum" "rpm" "kpartx" "parted" "syslinux" "curl" "gcc" "bzip2" "gzip" "pykickstart" "python-iniparse")
for ((i=0;i<${#requiredpkgs[@]};i++))
do
@@ -114,7 +127,7 @@
# Check versions of some packages
packages=("yum" "syslinux" "squashfs-tools")
-versions=("3.2.22" "3.85" "4.0")
+versions=("3.2.24" "3.85" "4.0")
for ((i=0;i<${#packages[@]};i++))
do
checkpkgver "$qvercmd" "${packages[$i]}" "${versions[$i]}"
--- tools/mic-chroot
+++ tools/mic-chroot
@@ -92,7 +92,7 @@
target = args[0]
if os.path.isfile(target):
type = imgcreate.get_image_type(target)
- if type not in ("livecd", "liveusb", "ext3fsimg"):
+ if type not in ("livecd", "liveusb", "ext3fsimg", "raw"):
chroot.perror("I can't recognize this image type.")
return None
options.targettype = "img"
@@ -181,6 +181,7 @@
tmpdir = options.saveto
chroot.pinfo("%s will be unpacked into %s" % (options.targetpath, options.saveto))
savefs = False
+ options.saveto = os.path.abspath(os.path.expanduser(options.saveto))
if options.targettype == "img":
imgmount = chroot.ImageMount(options.targetpath)
@@ -225,10 +226,10 @@
if options.convertto:
chroot.cleanup_mounts(options.saveto)
if options.targettype == "img":
- args = ["/usr/bin/mic-image-convertor", "--source-image=%s" % imgmount.os_image,
+ args = ["mic-image-convertor", "--source-image=%s" % imgmount.os_image,
"--target-format=%s" % options.convertto, "--outdir=%s" % options.outdir]
else:
- args = ["/usr/bin/mic-image-convertor", "--source-image=%s" % options.saveto,
+ args = ["mic-image-convertor", "--source-image=%s" % options.saveto,
"--target-format=%s" % options.convertto, "--outdir=%s" % options.outdir]
subprocess.call(args)
if options.convertonly and not options.convertto:
--- tools/mic-image-creator
+++ tools/mic-image-creator
@@ -88,7 +88,7 @@
help="Path to kickstart config file")
commonopt.add_option("-f", "--format", type="string", dest="format",
- help="Image format, you can specify as fs, livecd, liveusb, loop, raw, nand, mrstnand, ubi, jffs2, vdi or vmdk")
+ help="Available image formats: %s" % (", ".join(imgcreate.supported_formats + appcreate.supported_formats)))
parser.add_option_group(commonopt)
@@ -207,6 +207,9 @@
help="Package format, this option will package up output into a given-format package, "
"currently only tar, tar.gz and tar.bz2 are supported, the default "
"is none, i.e. doesn't package up output")
+ sysopt.add_option("", "--compress-disk-image", type="string",
+ dest="compress_disk_image", default=None,
+ help="Compress the disk image that is created. When using --release option default is bz2, otherwise default is none. Supported compression methods: bz2, none")
parser.add_option("", "--traceback", action="store_true",
default=False, help="Dump call stack")
@@ -267,19 +270,20 @@
return None
def get_siteconf_opt(siteconf, section, option):
- if not siteconf:
+ if not siteconf or not section or not option:
return None
- if option:
- if siteconf.has_section(section) and siteconf.has_option(section, option):
- value = siteconf.get(section, option)
- if value:
- return value
+
+ if siteconf.has_section(section) and siteconf.has_option(section, option):
+ value = siteconf.get(section, option)
+ if value:
+ return value
+
return None
def rebuild_argv(argv, options):
blacklist = ["bootstrap", "buildbootstrap", "mainrepo", "repo", "default_ks", "siteconf", "prefix", "ignore_siteconf", "package", "run_mode"]
myargv = []
- myargv.append(argv[0])
+ myargv.append("/usr/bin/mic-image-creator")
optlist = options.__dict__
for key in optlist.keys():
@@ -299,6 +303,7 @@
return myargv
def main():
+ imgcreate.misc.check_mic_installation(sys.argv)
options = parse_options(sys.argv[1:])
if os.geteuid () != 0:
@@ -312,6 +317,7 @@
imgcreate.misc.output_siteconf(siteconf)
else:
siteconf = None
+ imgcreate.get_local_distro()
distro_name = get_siteconf_opt(siteconf, "main", "distro_name")
if not distro_name:
@@ -367,12 +373,10 @@
else:
print "Run mode: legacy"
- # Need to be update if new format added
- support_format = ('fs', 'livecd', 'liveusb', 'loop', 'raw', 'vmdk', 'vdi', 'ubi', 'jffs2', 'mrstnand', 'nand')
if not options.format:
options.format = get_siteconf_opt(siteconf, "main", "image_format")
- if options.format not in support_format:
- raise FatalError("Image format '%s' isn't supported " % options.format)
+ if options.format not in (imgcreate.supported_formats + appcreate.supported_formats):
+ raise FatalError("Image format '%s' isn't supported. Supported formats: %s " % (options.format, ", ".join(imgcreate.supported_formats + appcreate.supported_formats)))
if options.package not in ("none", "tar", "tar.gz", "tar.bz2"):
raise FatalError("Package format '%s' isn't supported" % options.package)
@@ -389,13 +393,17 @@
options.tmpdir = value
if not options.cachedir:
- options.cachedir = None
value = get_siteconf_diropt(siteconf, "cachedir")
if value:
options.cachedir = value
+ else:
+ """ If no cache dir is found from configs lets create dir to users home as default. """
+ options.cachedir = os.path.abspath(os.path.expanduser("~/.mic2_cachedir"))
else:
options.cachedir = os.path.abspath(os.path.expanduser(options.cachedir))
+ print "Using %s as cache directory." % (options.cachedir)
+
destdir = "."
if not options.outdir:
value = get_siteconf_diropt(siteconf, "outdir")
@@ -404,10 +412,19 @@
else:
destdir = options.outdir
destdir = os.path.abspath(os.path.expanduser(destdir))
+ if options.release and options.config:
+ fd = open(options.config, "r")
+ kscont = fd.read()
+ fd.close()
+ kscont = kscont.replace("@BUILD_ID@", options.release)
+ base = os.path.basename(options.config)
+ options.config = "%s/%s" %(options.tmpdir, base)
+ fd = open(options.config, "w")
+ fd.write(kscont)
+ fd.close()
+ releaseksbasename = None
if options.release and options.run_mode == 0:
- if options.format not in ["livecd", "liveusb"]:
- options.package = "tar.bz2"
options.record_pkgs = "name"
if not options.prefix:
options.prefix = "meego"
@@ -416,28 +433,32 @@
meegovert = ["handset", "netbook", "tablet", "ivi", "cetv", "core"]
meegoarch = ["ia32", "armv5tel", "armv7l"]
base = os.path.basename(options.config)
- ksname = base.split(".")[0]
+ ksname = base[:base.rfind(".")]
ksnamec = ksname.split("-")
- if ksnamec[0] not in meegovert or ksnamec[1] not in meegoarch:
- raise FatalError("Configuration file %s does not follow naming conventions: $VERTICAL-$ARCH-$VARIANT " %(options.config))
-
- options.outdir = "%s/%s/%s/images/%s-%s" %(destdir, options.release, ksnamec[0], options.prefix, ksname)
+
+ """ Accept also the image name prefix in kickstart filename. """
+ if ksnamec[0] == options.prefix:
+ ksnamec.pop(0)
+
+ """ Ignore release id in kickstart """
+ if re.match("\d+\.\d+.\d+.*$", ksnamec[-1]):
+ ksnamec.pop(-1)
+
+ """ There might be more than 3 parts in the ksnamec because of the release numbering. """
+ if len(ksnamec) < 2 or ksnamec[0] not in meegovert or ksnamec[1] not in meegoarch:
+ raise FatalError("Configuration file %s does not follow naming conventions: $VERTICAL-$ARCH-$VARIANT or %s-$VERTICAL-$ARCH-$VARIANT" %(options.config,options.prefix))
+
+ """ Use the ksnamec array here, as we do not want to keep the old release name that might come after $VARIANT in kickstart filename. """
+ releaseksbasename = "-".join(ksnamec)
+ options.outdir = "%s/%s/%s/images/%s-%s" %(destdir, options.release, ksnamec[0], options.prefix, releaseksbasename)
destdir = options.outdir
if not os.path.exists(destdir):
imgcreate.fs.makedirs(destdir)
- imgcreate.misc.set_proxies()
-
- """ proxy settings from stie config override proxy settings from environment variables """
- proxy = None
- no_proxy = None
- if siteconf and siteconf.has_section("main") and siteconf.has_option("main", "proxy"):
- proxy = siteconf.get("main", "proxy")
- if siteconf and siteconf.has_section("main") and siteconf.has_option("main", "no_proxy"):
- no_proxy = siteconf.get("main", "no_proxy")
- if proxy or no_proxy:
- imgcreate.misc.set_proxies(proxy, no_proxy)
+ """ proxy settings from site config override proxy settings from environment variables """
+ imgcreate.misc.set_proxies(get_siteconf_opt(siteconf,"main","proxy"), \
+ get_siteconf_opt(siteconf,"main","no_proxy"))
""" Get repos from site config """
site_repos = imgcreate.misc.get_repostrs_from_siteconf(siteconf)
@@ -458,19 +479,19 @@
ks_repos = imgcreate.misc.get_repostrs_from_ks(ks)
except imgcreate.CreatorError, e:
raise FatalError("unable to load kickstart file '%s' : %s" % (options.config, e))
+
try:
repometadata = imgcreate.misc.get_metadata_from_repos(options.addrepos + site_repos + ks_repos, options.cachedir)
if not repometadata:
- raise FatalError("Not any repo is available")
+ raise FatalError("No repositories found")
release_no = imgcreate.misc.get_release_no(repometadata, distro_name.lower())
target_archlist = imgcreate.misc.get_arch(repometadata)
- print target_archlist
- except imgcreate.CreatorError, e:
+ except (OSError,imgcreate.CreatorError), e:
debugger.record_callstack()
raise FatalError("failed to create image : %s" % e)
- except OSError, e:
- raise FatalError("failed to create image : %s" % e)
- print "%s release %s" % (distro_name, release_no)
+
+ print "Available target architectures in repositories: %s" % target_archlist
+ print "\n%s release %s\n" % (distro_name, release_no)
if not options.config:
try:
@@ -539,14 +560,29 @@
if not options.prefix:
options.prefix = "%s-" % distro_name.lower()
else:
- options.prefix = "%s-" %options.prefix
+ options.prefix = "%s-" % options.prefix
if not options.suffix:
options.suffix = "%s.%s" %(release_no, time.strftime("%Y%m%d.%H%M"))
- name = imgcreate.build_name(options.config, options.prefix, suffix=options.suffix)
+ ksname = options.config
+ """ With release we have stripped old release tags out of the name. """
+ if releaseksbasename:
+ ksname = releaseksbasename
+ name = imgcreate.build_name(ksname, options.prefix, suffix=options.suffix)
+
+ if options.arch:
+ arch_set = False
+ for target_arch in target_archlist:
+ if target_arch.startswith(options.arch.strip()):
+ options.arch = target_arch
+ print "Target arch: %s" % options.arch
+ arch_set = True
+ break
+
+ if not arch_set:
+ raise FatalError("Given arch '%s' is not found from the repositories." % options.arch.strip())
- target_arch = options.arch
need_convert = False
if options.bootstrap and options.format in ("vmdk", "vdi"):
imgcreate.bootstrap.check_depends(options.format)
@@ -557,17 +593,6 @@
options.package = "none"
if options.buildbootstrap:
- # ensure a cachedir is available
- rmcachedir = False
- if not options.cachedir:
- try:
- options.cachedir = tempfile.mkdtemp(dir = options.tmpdir,
- prefix = "bootstrapcache-")
- rmcachedir = True
- except OSError, (err, msg):
- raise CreatorError("Failed create bootstrap cache directory in %s: %s" %
- (options.tmpdir, msg))
-
# Use main repo from command line option
proxies = {}
reponame = None
@@ -580,15 +605,11 @@
break
# guess main repo if not provided
- if options.arch:
- for target_arch in target_archlist:
- if target_arch.startswith(options.arch.strip()):
- break
if not reponame:
for repo in ks.handler.repo.repoList:
if repo.proxy:
proxies = {"http":repo.proxy,"https":repo.proxy, "ftp":repo.proxy, "ftps":repo.proxy}
- imgcreate.bootstrap.get_repo_metadata(repo.baseurl, options.cachedir, repo.name, proxies, arch = target_arch)
+ imgcreate.bootstrap.get_repo_metadata(repo.baseurl, options.cachedir, repo.name, proxies, arch = options.arch)
if imgcreate.bootstrap.is_mainrepo(options.cachedir, repo.name):
reponame = repo.name
repourl = repo.baseurl
@@ -596,13 +617,11 @@
if not reponame:
raise FatalError("Please specify main repo name using --mainrepo option.")
else:
- sqlitedb = imgcreate.bootstrap.get_repo_metadata(repourl, options.cachedir, reponame, proxies, arch = target_arch)
- imgcreate.bootstrap.build_bootstrap(repourl, options.cachedir, reponame, options.bootstrap, proxies, arch = target_arch)
- if rmcachedir:
- shutil.rmtree(options.cachedir, ignore_errors = True)
-
+ sqlitedb = imgcreate.bootstrap.get_repo_metadata(repourl, options.cachedir, reponame, proxies, arch = options.arch)
+ imgcreate.bootstrap.build_bootstrap(repourl, options.cachedir, reponame, options.bootstrap, proxies, arch = options.arch)
if options.bootstrap:
+ imgcreate.bootstrap.check_mic(options.bootstrap)
options.outdir = os.path.abspath(os.path.expanduser(destdir))
if options.cachedir:
options.cachedir = os.path.abspath(os.path.expanduser(options.cachedir))
@@ -629,7 +648,7 @@
bindmounts += "%s;%s" % (options.outdir, options.tmpdir)
if options.cachedir:
bindmounts = bindmounts + ";%s" % options.cachedir
- run_in_bootstrap(options.bootstrap, argv, bindmounts, arch = target_arch)
+ run_in_bootstrap(options.bootstrap, argv, bindmounts, arch = options.arch)
# For the case with release option, destdir is changed, so get it
for line in open(mypipe).xreadlines():
if line.find("destdir=") != -1:
@@ -646,13 +665,9 @@
outimages = imgcreate.bootstrap.convert_to(imgfile, imgfmt)
dst = imgcreate.bootstrap.package_image(outimages, imgfmt, destdir, pkgfmt)
if options.release:
- imgcreate.create_release(oldconfig, destdir, name)
+ outimages = imgcreate.create_release(oldconfig, destdir, name, outimages)
if dst:
outimages.append(dst)
- if options.release:
- outimages = []
- for f in os.listdir(destdir):
- outimages.append(os.path.join(destdir, f))
imgcreate.bootstrap.print_imginfo(outimages)
print "Finished."
# Save original kickstart file
@@ -710,48 +725,47 @@
else:
raise FatalError("You have to specify an image format")
+ if options.compress_disk_image == "none":
+ """ If user does not want compression for release for example """
+ options.compress_disk_image = None
+ elif not options.compress_disk_image and options.release:
+ """ For livecd and liveusb image, unnecessary to compress """
+ if options.format in ("livecd", "liveusb"):
+ options.compress_disk_image = None
+ else:
+ """ If compression is not set then for release we set the default to bz2 """
+ options.compress_disk_image = "bz2"
+
+ if options.compress_disk_image:
+ creator.compress_disk_image(options.compress_disk_image)
+
creator.tmpdir = options.tmpdir
creator._alt_initrd_name = options.alt_initrd_name
creator._recording_pkgs = options.record_pkgs
creator._local_pkgs_path = options.local_pkgs_path
creator._genchecksum = options.genchecksum
creator.distro_name = distro_name
-
+
if options.arch:
- arch_set = False
- for target_arch in target_archlist:
- if target_arch.startswith(options.arch.strip()):
- creator.set_target_arch(target_arch)
- print "Target arch: %s" % creator.target_arch
- arch_set = True
- break
-
- if not arch_set:
- raise FatalError("Given arch '%s' is not found from the repositories." % options.arch.strip())
-
+ creator.set_target_arch(options.arch)
+
imgname = creator.name
- for part in ks.handler.partition.partitions:
- if part.fstype and part.fstype == "btrfs":
- creator._dep_checks.append(("/sbin/mkfs.btrfs",))
- break
+
try:
creator.check_depend_tools()
creator.mount(None, options.cachedir)
creator.install()
- creator.configure()
+ creator.configure(repometadata)
if options.save_kernel:
creator.save_kernel(destdir)
creator.launch_shell(options.give_shell)
creator.unmount()
- if options.format in ("raw", "vmdk", "vdi"):
- creator.package(destdir, "none", None)
- else:
- creator.package(destdir)
+ creator.package(destdir)
outimage = creator.outimage
if not options.image_info:
- creator.package_output(options.format, destdir, options.package)
if options.release:
creator.release_output(options.config, destdir, name)
+ creator.package_output(options.format, destdir, options.package)
creator.print_outimage_info()
outimage = creator.outimage
else:
@@ -792,7 +806,7 @@
try:
ret = main()
sys.exit(ret)
- except FatalError, e:
+ except (imgcreate.CreatorError,FatalError), e:
print >> sys.stderr, "\n%sError: %s%s\n" % (COLOR_RED, e, COLOR_BLACK)
debugger.record_callstack()
debugger.dump_debuginfo()
++++++ mic2.yaml
--- mic2.yaml
+++ mic2.yaml
@@ -1,25 +1,26 @@
Name: mic2
-Summary: Tools for building images for Moblin
-Version: 0.19
+Summary: Tools for building images for MeeGo
+Version: 0.21.0
Release: 1
Group: System/Base
License: GPLv2
-URL: http://moblin.org/projects/moblin-image-creator-2
+URL: http://meego.gitorious.org/meego-developer-tools/image-creator
Description: |
- Tools for generating moblin2 live images. http://moblin.org/projects/moblin-image-creator-2 for more details.
+ Tools for building images for MeeGo. http://meego.gitorious.org/meego-developer-tools/image-creator for more details.
Sources:
- "%{name}-%{version}.tar.gz"
-Configure: none
+
Builder: python
BuildArch: noarch
SupportOtherDistros: yes
+
Requires:
- util-linux
- coreutils
- python >= 2.5
- e2fsprogs
- dosfstools >= 2.11-8
- - yum > 3.0
+ - yum >= 3.2.24
- pykickstart >= 0.96
- python-iniparse
- syslinux >= 3.82
@@ -36,8 +37,8 @@
- gzip
- bzip2
- squashfs-tools >= 4.0
+ - btrfs-progs
PkgBR:
- - python
- python-devel
- zlib-devel
More information about the MeeGo-commits
mailing list