[Cmake-commits] CMake branch, next, updated. v3.3.1-2958-gb937b17
Domen Vrankar
domen.vrankar at gmail.com
Tue Sep 15 18:46:24 EDT 2015
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via b937b173e28042dbee74f2beeb526e38890a68e3 (commit)
via 716f9bf961b3739587d820369ad958a4fca33287 (commit)
from 7b9bab0f445c8d56f4c0e95e5d28edda6df14d99 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b937b173e28042dbee74f2beeb526e38890a68e3
commit b937b173e28042dbee74f2beeb526e38890a68e3
Merge: 7b9bab0 716f9bf
Author: Domen Vrankar <domen.vrankar at gmail.com>
AuthorDate: Tue Sep 15 18:46:23 2015 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Sep 15 18:46:23 2015 -0400
Merge topic 'cpack-deb-fakeroot-removal' into next
716f9bf9 Revert "fixup! cmArchiveWrite: control user/group, permissions"
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=716f9bf961b3739587d820369ad958a4fca33287
commit 716f9bf961b3739587d820369ad958a4fca33287
Author: Domen Vrankar <domen.vrankar at gmail.com>
AuthorDate: Wed Sep 16 00:44:05 2015 +0200
Commit: Domen Vrankar <domen.vrankar at gmail.com>
CommitDate: Wed Sep 16 00:44:05 2015 +0200
Revert "fixup! cmArchiveWrite: control user/group, permissions"
This reverts commit 271bc8d13beb1c24cabc30d4da8e1466825bd3a3.
diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx
index 9402689..55eeec5 100644
--- a/Source/CPack/cmCPackDebGenerator.cxx
+++ b/Source/CPack/cmCPackDebGenerator.cxx
@@ -453,8 +453,10 @@ int cmCPackDebGenerator::createDeb()
// uid/gid should be the one of the root user, and this root user has
// always uid/gid equal to 0.
- data_tar.SetUIDAndGID(0u, 0u);
- data_tar.SetUNAMEAndGNAME("root", "root");
+ data_tar.SetUID(0);
+ data_tar.SetGID(0);
+ data_tar.SetUNAME("root");
+ data_tar.SetGNAME("root");
// now add all directories which have to be compressed
// collect all top level install dirs for that
@@ -569,8 +571,10 @@ int cmCPackDebGenerator::createDeb()
"paxr");
// sets permissions and uid/gid for the files
- control_tar.SetUIDAndGID(0u, 0u);
- control_tar.SetUNAMEAndGNAME("root", "root");
+ control_tar.SetUID(0);
+ control_tar.SetGID(0);
+ control_tar.SetUNAME("root");
+ control_tar.SetGNAME("root");
/* permissions are set according to
https://www.debian.org/doc/debian-policy/ch-files.html#s-permissions-owners
@@ -619,7 +623,7 @@ int cmCPackDebGenerator::createDeb()
strictFiles + sizeof(strictFiles)/sizeof(strictFiles[0]));
// default
- control_tar.ClearPermissions();
+ control_tar.SetPermissions(-1);
std::vector<std::string> controlExtraList;
cmSystemTools::ExpandListArgument(controlExtra, controlExtraList);
diff --git a/Source/cmArchiveWrite.cxx b/Source/cmArchiveWrite.cxx
index 7946950..f6a1b4f 100644
--- a/Source/cmArchiveWrite.cxx
+++ b/Source/cmArchiveWrite.cxx
@@ -84,7 +84,11 @@ cmArchiveWrite::cmArchiveWrite(
Archive(archive_write_new()),
Disk(archive_read_disk_new()),
Verbose(false),
- Format(format)
+ Format(format),
+ uid(-1),
+ gid(-1),
+ permissions(-1),
+ permissionsMask(-1)
{
switch (c)
{
@@ -284,29 +288,29 @@ bool cmArchiveWrite::AddFile(const char* file,
}
// manages the uid/guid of the entry (if any)
- if (this->Uid.IsSet() && this->Gid.IsSet())
+ if (this->uid > -1 && this->gid > -1)
{
- archive_entry_set_uid(e, this->Uid.Get());
- archive_entry_set_gid(e, this->Gid.Get());
+ archive_entry_set_uid(e, this->uid);
+ archive_entry_set_gid(e, this->gid);
}
- if (this->Uname.size() && this->Gname.size())
+ if (this->uname.size() && this->gname.size())
{
- archive_entry_set_uname(e, this->Uname.c_str());
- archive_entry_set_gname(e, this->Gname.c_str());
+ archive_entry_set_uname(e, this->uname.c_str());
+ archive_entry_set_gname(e, this->gname.c_str());
}
// manages the permissions
- if (this->Permissions.IsSet())
+ if (this->permissions > -1)
{
- archive_entry_set_perm(e, this->Permissions.Get());
+ archive_entry_set_perm(e, this->permissions);
}
- if (this->PermissionsMask.IsSet())
+ if (this->permissionsMask > -1)
{
mode_t perm = archive_entry_perm(e);
- archive_entry_set_perm(e, perm & this->PermissionsMask.Get());
+ archive_entry_set_perm(e, perm & this->permissionsMask );
}
// Clear acl and xattr fields not useful for distribution.
diff --git a/Source/cmArchiveWrite.h b/Source/cmArchiveWrite.h
index 945688e..a42211c 100644
--- a/Source/cmArchiveWrite.h
+++ b/Source/cmArchiveWrite.h
@@ -18,22 +18,6 @@
# error "cmArchiveWrite not allowed during bootstrap build!"
#endif
-template<typename T>
-class cmArchiveWriteOptional
-{
-public:
- cmArchiveWriteOptional() {this->Clear();}
- explicit cmArchiveWriteOptional(T val) {this->Set(val);}
-
- void Set(T val) {this->IsValueSet = true; this->Value=val;}
- void Clear() {this->IsValueSet = false;}
- bool IsSet() const {return this->IsValueSet;}
- T Get() const {return Value;}
-private:
- T Value;
- bool IsValueSet;
-};
-
/** \class cmArchiveWrite
* \brief Wrapper around libarchive for writing.
*
@@ -90,57 +74,51 @@ public:
void SetMTime(std::string const& t) { this->MTime = t; }
//! Sets the permissions of the added files/folders
- void SetPermissions(mode_t permissions_)
+ //! @note set to -1 to use the default permissions
+ long int SetPermissions(long int permissions_)
{
- this->Permissions.Set(permissions_);
+ std::swap(this->permissions, permissions_);
+ return permissions_;
}
- //! Clears permissions - default is used instead
- void ClearPermissions() { this->Permissions.Clear(); }
-
//! Sets the permissions mask of files/folders
//!
//! The permissions will be copied from the existing file
//! or folder. The mask will then be applied to unset
//! some of them
- void SetPermissionsMask(mode_t permissionsMask_)
- {
- this->PermissionsMask.Set(permissionsMask_);
- }
-
- //! Clears permissions mask - default is used instead
- void ClearPermissionsMask()
+ long int SetPermissionsMask(long int permissionsMask_)
{
- this->PermissionsMask.Clear();
+ std::swap(this->permissionsMask, permissionsMask_);
+ return permissionsMask_;
}
- //! Sets UID and GID to be used in the tar file
- void SetUIDAndGID(uid_t uid_, gid_t gid_)
+ //! Sets the UID to be used in the tar file
+ //! @return the previous UID
+ //! @note set to -1 to disable the UID overriding
+ long int SetUID( long int uid_ )
{
- this->Uid.Set(uid_);
- this->Gid.Set(gid_);
+ std::swap(this->uid, uid_);
+ return uid_;
}
- //! Clears UID and GID to be used in the tar file - default is used instead
- void ClearUIDAndGID()
+ std::string SetUNAME(std::string uname_)
{
- this->Uid.Clear();
- this->Gid.Clear();
+ std::swap(this->uname, uname_);
+ return uname_;
}
- //! Sets UNAME and GNAME to be used in the tar file
- void SetUNAMEAndGNAME(const std::string& uname_, const std::string& gname_)
+ //! Sets the UID to be used in the tar file
+ //! @return the previous UID
+ long int SetGID( long int gid_ )
{
- this->Uname = uname_;
- this->Gname = gname_;
+ std::swap(this->gid, gid_);
+ return gid_;
}
- //! Clears UNAME and GNAME to be used in the tar file
- //! default is used instead
- void ClearUNAMEAndGNAME()
+ std::string SetGNAME(std::string gname_)
{
- this->Uname = "";
- this->Gname = "";
+ std::swap(this->gname, gname_);
+ return gname_;
}
private:
@@ -163,21 +141,22 @@ private:
std::string Error;
std::string MTime;
- //! UID of the user in the tar file
- cmArchiveWriteOptional<uid_t> Uid;
+ //! UID of the user in the tar file. Set to -1
+ //! to disable overriding
+ long int uid;
//! GUID of the user in the tar file
- cmArchiveWriteOptional<gid_t> Gid;
+ long int gid;
//! UNAME/GNAME of the user (does not override UID/GID)
//!@{
- std::string Uname;
- std::string Gname;
+ std::string uname;
+ std::string gname;
//!@}
//! Permissions on files/folders
- cmArchiveWriteOptional<mode_t> Permissions;
- cmArchiveWriteOptional<mode_t> PermissionsMask;
+ long int permissions;
+ long int permissionsMask;
};
#endif
-----------------------------------------------------------------------
Summary of changes:
Source/CPack/cmCPackDebGenerator.cxx | 14 ++++--
Source/cmArchiveWrite.cxx | 26 ++++++-----
Source/cmArchiveWrite.h | 85 +++++++++++++---------------------
3 files changed, 56 insertions(+), 69 deletions(-)
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list