Add libcap package (#3546)

This commit is contained in:
Adam J. Stewart 2017-03-24 16:02:01 -05:00 committed by GitHub
parent 0b4c39a9e0
commit 50f4f0827d
2 changed files with 82 additions and 0 deletions

View File

@ -0,0 +1,31 @@
Ensure the XATTR_NAME_CAPS is defined when it is used
Upstream-Status: Pending
VFS_CAP_U32 can not ensure that XATTR_NAME_CAPS is defined, and failed to build
libcap-native in old release, like CentOS release 6.7 (Final), with the blow
error:
cap_file.c: In function cap_get_fd:
cap_file.c:199: error: XATTR_NAME_CAPS undeclared (first use in this function)
cap_file.c:199: error: (Each undeclared identifier is reported only once
Signed-off-by: Roy Li <rongqing.li@windriver.com>
---
libcap/cap_file.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libcap/cap_file.c b/libcap/cap_file.c
index 40756ea..e27ca80 100644
--- a/libcap/cap_file.c
+++ b/libcap/cap_file.c
@@ -25,7 +25,7 @@ extern int fremovexattr(int, const char *);
#include "libcap.h"
-#ifdef VFS_CAP_U32
+#if defined (VFS_CAP_U32) && defined (XATTR_NAME_CAPS)
#if VFS_CAP_U32 != __CAP_BLKS
# error VFS representation of capabilities is not the same size as kernel
--
2.8.1

View File

@ -0,0 +1,51 @@
##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-647188
#
# For details, see https://github.com/llnl/spack
# Please also see the LICENSE file for our notice and the LGPL.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License (as
# published by the Free Software Foundation) version 2.1, February 1999.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
# conditions of the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
from spack import *
class Libcap(MakefilePackage):
"""Libcap implements the user-space interfaces to the POSIX 1003.1e
capabilities available in Linux kernels. These capabilities are a
partitioning of the all powerful root privilege into a set of
distinct privileges."""
homepage = "https://sites.google.com/site/fullycapable/"
url = "https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.25.tar.gz"
version('2.25', '4b18f7166a121138cca0cdd8ab64df4c')
patch('libcap-fix-the-libcap-native-building-failure-on-CentOS-6.7.patch')
def install(self, spec, prefix):
make_args = [
'RAISE_SETFCAP=no',
'lib=lib',
'prefix={0}'.format(prefix),
'install'
]
make(*make_args)
chmod = which('chmod')
chmod('+x', join_path(prefix.lib, 'libcap.so'))