diff options
author | Robert Yang <liezhi.yang@windriver.com> | 2012-08-22 15:34:34 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-08-29 16:02:08 -0700 |
commit | 3883f82926adc973516a24f69f56f6c63eb66d37 (patch) | |
tree | efbd6166e3f14906f65456577f7e5c6ad7e5cdcb /meta/classes/package_rpm.bbclass | |
parent | 2ba95cc79e44bb2bf94d07b90cd305c3198fee68 (diff) | |
download | poky-3883f82926adc973516a24f69f56f6c63eb66d37.tar.gz |
archiver.bbclass: fix the fakeroot and other issues
* Fix the fakeroot issue
The archiver.bbclass is used for archiving sources, patches, and logs,
it uses the "rpmbuild -bs" from the package_rpm.bbclass to generate the
.src.rpm, but it didn't work (it's not easy to explain it clearly):
Reason:
- It directly used the "fakeroot" command, we don't have such a
command in native tools, so it would use the fakeroot from the host,
and it would fail when there is no fakeroot on the host.
- The "rpmbuild -bs" doesn't need to work under root, but it is in the
function do_package_write_rpm which is running under fakeroot, and
"rpmbuild" needs to know the source file's user/group name, the source
file is the tarball which is created by the postfuncs of do_unpack
or do_patch which doesn't use the fakeroot, so the created file's
owner would be the real user, e.g.: robert, but there is no such a
user under our native tools' fakeroot(pseudo), then the rpmbuild would
fail. It worked when use the host's fakeroot in the past was because
that the host's fakeroot knows the users on the host.
Fix:
- Remove the incorrect "fakeroot".
- Change the source file's owner to root.root under fakeroot will fix the
problem.
* Other fixes:
- The typo: "do_remove_taball -> do_remove_tarball" which will cause the
tarball is not removed.
- Add the _sourcedir defination to the rpmbuild command since the the
SOURCES would be added to the specfile when archiver.bbclass is
inherited, otherwise there would be errors when "rpmbuild -bb", though
the build is OK. It only added the defination to "rpmbuild -bs",
didn't add to "rpmbuild -bb".
[YOCTO #2619]
(From OE-Core rev: ac152f277fdff256def01af4268215a05685a0f7)
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/package_rpm.bbclass')
-rw-r--r-- | meta/classes/package_rpm.bbclass | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass index 58a9aac779..b999c28a9b 100644 --- a/meta/classes/package_rpm.bbclass +++ b/meta/classes/package_rpm.bbclass | |||
@@ -585,11 +585,17 @@ python write_specfile () { | |||
585 | if d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True) and d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True).upper() == 'SRPM': | 585 | if d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True) and d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True).upper() == 'SRPM': |
586 | source_number = 0 | 586 | source_number = 0 |
587 | patch_number = 0 | 587 | patch_number = 0 |
588 | workdir = d.getVar('WORKDIR', True) | ||
588 | for source in source_list: | 589 | for source in source_list: |
590 | # The rpmbuild doesn't need the root permission, but it needs | ||
591 | # to know the file's user and group name, the only user and | ||
592 | # group in fakeroot is "root" when working in fakeroot. | ||
593 | os.chown("%s/%s" % (workdir, source), 0, 0) | ||
589 | spec_preamble_top.append('Source' + str(source_number) + ': %s' % source) | 594 | spec_preamble_top.append('Source' + str(source_number) + ': %s' % source) |
590 | source_number += 1 | 595 | source_number += 1 |
591 | if patch_list: | 596 | if patch_list: |
592 | for patch in patch_list: | 597 | for patch in patch_list: |
598 | os.chown("%s/%s" % (workdir, patch), 0, 0) | ||
593 | print_deps(patch, "Patch" + str(patch_number), spec_preamble_top, d) | 599 | print_deps(patch, "Patch" + str(patch_number), spec_preamble_top, d) |
594 | patch_number += 1 | 600 | patch_number += 1 |
595 | # We need a simple way to remove the MLPREFIX from the package name, | 601 | # We need a simple way to remove the MLPREFIX from the package name, |
@@ -1142,8 +1148,9 @@ python do_package_rpm () { | |||
1142 | cmd = cmd + " --define '_rpmfc_magic_path " + magicfile + "'" | 1148 | cmd = cmd + " --define '_rpmfc_magic_path " + magicfile + "'" |
1143 | cmd = cmd + " --define '_tmppath " + workdir + "'" | 1149 | cmd = cmd + " --define '_tmppath " + workdir + "'" |
1144 | if d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True) and d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True).upper() == 'SRPM': | 1150 | if d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True) and d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True).upper() == 'SRPM': |
1145 | cmdsrpm = cmd + " --define '_sourcedir " + workdir + "' --define '_srcrpmdir " + creat_srpm_dir(d) + "'" | 1151 | cmd = cmd + " --define '_sourcedir " + workdir + "'" |
1146 | cmdsrpm = 'fakeroot ' + cmdsrpm + " -bs " + outspecfile | 1152 | cmdsrpm = cmd + " --define '_srcrpmdir " + creat_srpm_dir(d) + "'" |
1153 | cmdsrpm = cmdsrpm + " -bs " + outspecfile | ||
1147 | cmd = cmd + " -bb " + outspecfile | 1154 | cmd = cmd + " -bb " + outspecfile |
1148 | 1155 | ||
1149 | # Build the source rpm package ! | 1156 | # Build the source rpm package ! |