Browse Source

Allow setting of uid and gid in a tarfileset - in addition or in place

of user and group.
PR: 19120
Reported by: Dale Sherwood


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@276236 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Reilly 21 years ago
parent
commit
e3ce39634b
3 changed files with 57 additions and 8 deletions
  1. +2
    -0
      WHATSNEW
  2. +17
    -4
      docs/manual/CoreTasks/tar.html
  3. +38
    -4
      src/main/org/apache/tools/ant/taskdefs/Tar.java

+ 2
- 0
WHATSNEW View File

@@ -101,6 +101,8 @@ Other changes:

* spelling fixes, occurred. Bugzilla Report 27282.

* add uid and gid to tarfileset. Bugzilla Report 19120.

Changes from Ant 1.6.0 to Ant 1.6.1
=============================================



+ 17
- 4
docs/manual/CoreTasks/tar.html View File

@@ -135,14 +135,27 @@ attributes
</tr>
<tr>
<td valign="top">username</td>
<td valign="top">The username for the tar entry. This is not the same as the UID, which is
not currently set by the tar task.</td>
<td valign="top">The username for the tar entry. This is not the same as the UID.
</td>
<td align="center" valign="top">No</td>
</tr>
<tr>
<td valign="top">group</td>
<td valign="top">The groupname for the tar entry. This is not the same as the GID, which is
not currently set by the tar task.</td>
<td valign="top">The groupname for the tar entry. This is not the same as the GID.
</td>
<td align="center" valign="top">No</td>
</tr>
<tr>
<td valign="top">uid</td>
<td valign="top">The user identifier (UID) for the tar entry. This is an integer value
and is not the same as the username. <em>since Ant 1.6.2</em>.
</td>
<td align="center" valign="top">No</td>
</tr>
<tr>
<td valign="top">gid</td>
<td valign="top">The group identifier (GID) for the tar entry. <em>since Ant 1.6.2</em>.
</td>
<td align="center" valign="top">No</td>
</tr>
<tr>


+ 38
- 4
src/main/org/apache/tools/ant/taskdefs/Tar.java View File

@@ -378,6 +378,8 @@ public class Tar extends MatchingTask {
}
te.setUserName(tarFileSet.getUserName());
te.setGroupName(tarFileSet.getGroup());
te.setUserId(tarFileSet.getUid());
te.setGroupId(tarFileSet.getGid());

tOut.putNextEntry(te);

@@ -436,6 +438,8 @@ public class Tar extends MatchingTask {

private String userName = "";
private String groupName = "";
private int uid;
private int gid;
private String prefix = "";
private String fullpath = "";
private boolean preserveLeadingSlashes = false;
@@ -519,8 +523,7 @@ public class Tar extends MatchingTask {

/**
* The username for the tar entry
* This is not the same as the UID, which is
* not currently set by the task.
* This is not the same as the UID.
* @param userName the user name for the tar entry.
*/
public void setUserName(String userName) {
@@ -534,10 +537,25 @@ public class Tar extends MatchingTask {
return userName;
}

/**
* The uid for the tar entry
* This is not the same as the User name.
* @param userName the user name for the tar entry.
*/
public void setUid(int uid) {
this.uid = uid;
}

/**
* @return the uid for the tar entry
*/
public int getUid() {
return uid;
}

/**
* The groupname for the tar entry; optional, default=""
* This is not the same as the GID, which is
* not currently set by the task.
* This is not the same as the GID.
* @param groupName the group name string.
*/
public void setGroup(String groupName) {
@@ -551,6 +569,22 @@ public class Tar extends MatchingTask {
return groupName;
}

/**
* The GID for the tar entry; optional, default="0"
* This is not the same as the group name.
* @param groupName the group name string.
*/
public void setGid(int gid) {
this.gid = gid;
}

/**
* @return the group identifier.
*/
public int getGid() {
return gid;
}

/**
* If the prefix attribute is set, all files in the fileset
* are prefixed with that path in the archive.


Loading…
Cancel
Save