cvs commit: ant/src/main/org/apache/tools/ant/taskdefs Tar.java
peterreilly2004/03/15 06:36:21 Modified:.WHATSNEW docs/manual/CoreTasks tar.html src/main/org/apache/tools/ant/taskdefs Tar.java Log: Allow setting of uid and gid in a tarfileset - in addition or in place of user and group. PR: 19120 Reported by: Dale Sherwood Revision ChangesPath 1.573 +2 -0 ant/WHATSNEW Index: WHATSNEW === RCS file: /home/cvs/ant/WHATSNEW,v retrieving revision 1.572 retrieving revision 1.573 diff -u -r1.572 -r1.573 --- WHATSNEW 15 Mar 2004 11:23:47 - 1.572 +++ WHATSNEW 15 Mar 2004 14:36:20 - 1.573 @@ -101,6 +101,8 @@ * 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 = 1.21 +17 -4 ant/docs/manual/CoreTasks/tar.html Index: tar.html === RCS file: /home/cvs/ant/docs/manual/CoreTasks/tar.html,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- tar.html 9 Feb 2004 21:50:05 - 1.20 +++ tar.html 15 Mar 2004 14:36:21 - 1.21 @@ -135,14 +135,27 @@ /tr tr td valign=topusername/td -td valign=topThe 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=topThe username for the tar entry. This is not the same as the UID. + /td td align=center valign=topNo/td /tr tr td valign=topgroup/td -td valign=topThe 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=topThe groupname for the tar entry. This is not the same as the GID. + /td +td align=center valign=topNo/td + /tr + tr +td valign=topuid/td +td valign=topThe user identifier (UID) for the tar entry. This is an integer value + and is not the same as the username. emsince Ant 1.6.2/em. + /td +td align=center valign=topNo/td + /tr + tr +td valign=topgid/td +td valign=topThe group identifier (GID) for the tar entry. emsince Ant 1.6.2/em. + /td td align=center valign=topNo/td /tr tr 1.52 +38 -4 ant/src/main/org/apache/tools/ant/taskdefs/Tar.java Index: Tar.java === RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Tar.java,v retrieving revision 1.51 retrieving revision 1.52 diff -u -r1.51 -r1.52 --- Tar.java 12 Mar 2004 09:09:03 - 1.51 +++ Tar.java 15 Mar 2004 14:36:21 - 1.52 @@ -378,6 +378,8 @@ } te.setUserName(tarFileSet.getUserName()); te.setGroupName(tarFileSet.getGroup()); +te.setUserId(tarFileSet.getUid()); +te.setGroupId(tarFileSet.getGid()); tOut.putNextEntry(te); @@ -436,6 +438,8 @@ private String userName = ; private String groupName = ; +private intuid; +private intgid; private String prefix = ; private String fullpath = ; private boolean preserveLeadingSlashes = false; @@ -519,8 +523,7 @@ /** * 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) { @@ -535,9 +538,24 @@ } /** + * 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) { @@ -549,6 +567,22 @@ */ public String getGroup() { return groupName; +} + +/** + * The GID for the tar entry; optional, default=0
cvs commit: ant/src/main/org/apache/tools/ant/taskdefs Tar.java
peterreilly2004/03/12 01:09:03 Modified:src/main/org/apache/tools/ant/taskdefs Tar.java Log: add javadoc Revision ChangesPath 1.51 +84 -7 ant/src/main/org/apache/tools/ant/taskdefs/Tar.java Index: Tar.java === RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Tar.java,v retrieving revision 1.50 retrieving revision 1.51 diff -u -r1.50 -r1.51 --- Tar.java 9 Mar 2004 16:48:06 - 1.50 +++ Tar.java 12 Mar 2004 09:09:03 - 1.51 @@ -91,6 +91,7 @@ /** * Add a new fileset with the option to specify permissions + * @return the tar fileset to be used as the nested element. */ public TarFileSet createTarFileSet() { TarFileSet fileset = new TarFileSet(); @@ -101,6 +102,7 @@ /** * Set is the name/location of where to create the tar file. + * @param tarFile the location of the tar file. * @deprecated for consistency with other tasks, please use setDestFile() */ public void setTarfile(File tarFile) { @@ -118,6 +120,7 @@ /** * This is the base directory to look in for things to tar. + * @param baseDir the base directory. */ public void setBasedir(File baseDir) { this.baseDir = baseDir; @@ -135,6 +138,7 @@ * li gnu - GNU extensions are used for any paths greater than the maximum. * li omit - paths greater than the maximum are omitted from the archive * /ul + * @param mode the mode string to handle long files. * @deprecated setLongFile(String) is deprecated and is replaced with * setLongFile(Tar.TarLongFileMode) to make Ant's Introspection * mechanism do the work and also to encapsulate operations on @@ -159,6 +163,7 @@ * li gnu - GNU extensions are used for any paths greater than the maximum. * li omit - paths greater than the maximum are omitted from the archive * /ul + * @param mode the mode to handle long file names. */ public void setLongfile(TarLongFileMode mode) { this.longFileMode = mode; @@ -172,6 +177,7 @@ * li gzip - Gzip compression * li bzip2 - Bzip2 compression * /ul + * @param mode the compression method. */ public void setCompression(TarCompressionMethod mode) { this.compression = mode; @@ -179,6 +185,7 @@ /** * do the business + * @throws BuildException on error */ public void execute() throws BuildException { if (tarFile == null) { @@ -298,6 +305,11 @@ /** * tar a file + * @param file the file to tar + * @param tOut the output stream + * @param vPath the path name of the file to tar + * @param tarFileSet the fileset that the file came from. + * @throws IOException on error */ protected void tarFile(File file, TarOutputStream tOut, String vPath, TarFileSet tarFileSet) @@ -389,6 +401,9 @@ } /** + * Is the archive up to date in relationship to a list of files. + * @param files the files to check + * @return true if the archive is up to date. * @deprecated use the two-arg version instead. */ protected boolean archiveIsUpToDate(String[] files) { @@ -396,6 +411,10 @@ } /** + * Is the archive up to date in relationship to a list of files. + * @param files the files to check + * @param dir the base directory for the files. + * @return true if the archive is up to date. * @since Ant 1.5.2 */ protected boolean archiveIsUpToDate(String[] files, File dir) { @@ -407,6 +426,7 @@ /** * This is a FileSet with the option to specify permissions + * and other attributes. */ public static class TarFileSet extends FileSet { private String[] files = null; @@ -420,17 +440,28 @@ private String fullpath = ; private boolean preserveLeadingSlashes = false; +/** + * Creates a new codeTarFileSet/code instance. + * Using a fileset as a constructor argument. + * + * @param fileset a codeFileSet/code value + */ public TarFileSet(FileSet fileset) { super(fileset); } +/** + * Creates a new codeTarFileSet/code instance. + * + */ public TarFileSet() { super(); } /** * Get a list of files and directories specified in the fileset. - * @return a list of file and directory names, relative to + * @param p the current project. + * @return a list of file and
cvs commit: ant/src/main/org/apache/tools/ant/taskdefs Tar.java
peterreilly2004/03/12 01:10:10 Modified:src/main/org/apache/tools/ant/taskdefs Tag: ANT_16_BRANCH Tar.java Log: sync with head Revision ChangesPath No revision No revision 1.46.2.5 +84 -7 ant/src/main/org/apache/tools/ant/taskdefs/Tar.java Index: Tar.java === RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Tar.java,v retrieving revision 1.46.2.4 retrieving revision 1.46.2.5 diff -u -r1.46.2.4 -r1.46.2.5 --- Tar.java 9 Mar 2004 17:01:34 - 1.46.2.4 +++ Tar.java 12 Mar 2004 09:10:10 - 1.46.2.5 @@ -91,6 +91,7 @@ /** * Add a new fileset with the option to specify permissions + * @return the tar fileset to be used as the nested element. */ public TarFileSet createTarFileSet() { TarFileSet fileset = new TarFileSet(); @@ -101,6 +102,7 @@ /** * Set is the name/location of where to create the tar file. + * @param tarFile the location of the tar file. * @deprecated for consistency with other tasks, please use setDestFile() */ public void setTarfile(File tarFile) { @@ -118,6 +120,7 @@ /** * This is the base directory to look in for things to tar. + * @param baseDir the base directory. */ public void setBasedir(File baseDir) { this.baseDir = baseDir; @@ -135,6 +138,7 @@ * li gnu - GNU extensions are used for any paths greater than the maximum. * li omit - paths greater than the maximum are omitted from the archive * /ul + * @param mode the mode string to handle long files. * @deprecated setLongFile(String) is deprecated and is replaced with * setLongFile(Tar.TarLongFileMode) to make Ant's Introspection * mechanism do the work and also to encapsulate operations on @@ -159,6 +163,7 @@ * li gnu - GNU extensions are used for any paths greater than the maximum. * li omit - paths greater than the maximum are omitted from the archive * /ul + * @param mode the mode to handle long file names. */ public void setLongfile(TarLongFileMode mode) { this.longFileMode = mode; @@ -172,6 +177,7 @@ * li gzip - Gzip compression * li bzip2 - Bzip2 compression * /ul + * @param mode the compression method. */ public void setCompression(TarCompressionMethod mode) { this.compression = mode; @@ -179,6 +185,7 @@ /** * do the business + * @throws BuildException on error */ public void execute() throws BuildException { if (tarFile == null) { @@ -298,6 +305,11 @@ /** * tar a file + * @param file the file to tar + * @param tOut the output stream + * @param vPath the path name of the file to tar + * @param tarFileSet the fileset that the file came from. + * @throws IOException on error */ protected void tarFile(File file, TarOutputStream tOut, String vPath, TarFileSet tarFileSet) @@ -389,6 +401,9 @@ } /** + * Is the archive up to date in relationship to a list of files. + * @param files the files to check + * @return true if the archive is up to date. * @deprecated use the two-arg version instead. */ protected boolean archiveIsUpToDate(String[] files) { @@ -396,6 +411,10 @@ } /** + * Is the archive up to date in relationship to a list of files. + * @param files the files to check + * @param dir the base directory for the files. + * @return true if the archive is up to date. * @since Ant 1.5.2 */ protected boolean archiveIsUpToDate(String[] files, File dir) { @@ -407,6 +426,7 @@ /** * This is a FileSet with the option to specify permissions + * and other attributes. */ public static class TarFileSet extends FileSet { private String[] files = null; @@ -420,17 +440,28 @@ private String fullpath = ; private boolean preserveLeadingSlashes = false; +/** + * Creates a new codeTarFileSet/code instance. + * Using a fileset as a constructor argument. + * + * @param fileset a codeFileSet/code value + */ public TarFileSet(FileSet fileset) { super(fileset); } +/** + * Creates a new codeTarFileSet/code instance. + * + */ public TarFileSet() { super(); } /** * Get a list of files and directories specified in the fileset. - *