cvs commit: ant/src/main/org/apache/tools/ant/taskdefs Tar.java
peterreilly2004/03/15 07:32:41 Modified:.Tag: ANT_16_BRANCH WHATSNEW docs/manual/CoreTasks Tag: ANT_16_BRANCH tar.html src/main/org/apache/tools/ant/taskdefs Tag: ANT_16_BRANCH Tar.java Log: sync with head Revision ChangesPath No revision No revision 1.503.2.61 +2 -0 ant/WHATSNEW Index: WHATSNEW === RCS file: /home/cvs/ant/WHATSNEW,v retrieving revision 1.503.2.60 retrieving revision 1.503.2.61 diff -u -r1.503.2.60 -r1.503.2.61 --- WHATSNEW 15 Mar 2004 11:29:13 - 1.503.2.60 +++ WHATSNEW 15 Mar 2004 15:32:40 - 1.503.2.61 @@ -52,6 +52,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 === No revision No revision 1.19.2.3 +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.19.2.2 retrieving revision 1.19.2.3 diff -u -r1.19.2.2 -r1.19.2.3 --- tar.html 9 Feb 2004 22:12:07 - 1.19.2.2 +++ tar.html 15 Mar 2004 15:32:40 - 1.19.2.3 @@ -136,14 +136,27 @@ username -The username for the tar entry. This is not the same as the UID, which is - not currently set by the tar task. +The username for the tar entry. This is not the same as the UID. + No group -The groupname for the tar entry. This is not the same as the GID, which is - not currently set by the tar task. +The groupname for the tar entry. This is not the same as the GID. + +No + + +uid +The user identifier (UID) for the tar entry. This is an integer value + and is not the same as the username. since Ant 1.6.2. + +No + + +gid +The group identifier (GID) for the tar entry. since Ant 1.6.2. + No No revision No revision 1.46.2.6 +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.46.2.5 retrieving revision 1.46.2.6 diff -u -r1.46.2.5 -r1.46.2.6 --- Tar.java 12 Mar 2004 09:10:10 - 1.46.2.5 +++ Tar.java 15 Mar 2004 15:32:41 - 1.46.2.6 @@ -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" + * This is not the same as the group name. + * @param group
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 @@ username -The username for the tar entry. This is not the same as the UID, which is - not currently set by the tar task. +The username for the tar entry. This is not the same as the UID. + No group -The groupname for the tar entry. This is not the same as the GID, which is - not currently set by the tar task. +The groupname for the tar entry. This is not the same as the GID. + +No + + +uid +The user identifier (UID) for the tar entry. This is an integer value + and is not the same as the username. since Ant 1.6.2. + +No + + +gid +The group identifier (GID) for the tar entry. since Ant 1.6.2. + No 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" + * 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. + */ +publi
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 @@ * gnu - GNU extensions are used for any paths greater than the maximum. * omit - paths greater than the maximum are omitted from the archive * + * @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 @@ * gnu - GNU extensions are used for any paths greater than the maximum. * omit - paths greater than the maximum are omitted from the archive * + * @param mode the mode to handle long file names. */ public void setLongfile(TarLongFileMode mode) { this.longFileMode = mode; @@ -172,6 +177,7 @@ * gzip - Gzip compression * bzip2 - Bzip2 compression * + * @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 TarFileSet instance. + * Using a fileset as a constructor argument. + * + * @param fileset a FileSet value + */ public TarFileSet(FileSet fileset) { super(fileset); } +/** + * Creates a new TarFileSet instance. + * + */ public TarFileSet() { super(); } /** * Get a list of files and directories specified in the fileset. - * @return a list of file and directory names, relative
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 @@ * gnu - GNU extensions are used for any paths greater than the maximum. * omit - paths greater than the maximum are omitted from the archive * + * @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 @@ * gnu - GNU extensions are used for any paths greater than the maximum. * omit - paths greater than the maximum are omitted from the archive * + * @param mode the mode to handle long file names. */ public void setLongfile(TarLongFileMode mode) { this.longFileMode = mode; @@ -172,6 +177,7 @@ * gzip - Gzip compression * bzip2 - Bzip2 compression * + * @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 TarFileSet instance. + * Using a fileset as a constructor argument. + * + * @param fileset a FileSet value + */ public TarFileSet(FileSet fileset) { super(fileset); } +/** + * Creates a new TarFileSet 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 directory names, relative to *
cvs commit: ant/src/main/org/apache/tools/ant/taskdefs Tar.java
conor 2003/07/17 07:36:44 Modified:src/main/org/apache/tools/ant IntrospectionHelper.java src/main/org/apache/tools/ant/taskdefs Tar.java Log: More style Revision ChangesPath 1.58 +49 -32 ant/src/main/org/apache/tools/ant/IntrospectionHelper.java Index: IntrospectionHelper.java === RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/IntrospectionHelper.java,v retrieving revision 1.57 retrieving revision 1.58 diff -u -w -u -r1.57 -r1.58 --- IntrospectionHelper.java 6 Jul 2003 09:57:34 - 1.57 +++ IntrospectionHelper.java 17 Jul 2003 14:36:39 - 1.58 @@ -331,6 +331,7 @@ }); } catch (NoSuchMethodException nse) { +// ignore } } else if (name.startsWith("add") && java.lang.Void.TYPE.equals(returnType) @@ -357,6 +358,7 @@ }); nestedStorers.remove(name); } catch (NoSuchMethodException nse) { +// ignore } } } @@ -409,6 +411,7 @@ * The method will make sure the helper will be cleaned up at the end of * the project, and only one instance will be created for each class. * + * @param p the project instance * @param c The class for which a helper is required. * Must not be null. * @@ -454,9 +457,9 @@ dc.setDynamicAttribute(attributeName, value); return; } else { -String msg = getElementName(p, element) + -" doesn't support the \"" + attributeName + -"\" attribute."; +String msg = getElementName(p, element) ++ " doesn't support the \"" + attributeName ++ "\" attribute."; throw new BuildException(msg); } } @@ -519,10 +522,17 @@ } } +/** + * Utility method to throw a NotSupported exception + * + * @param project the Project instance. + * @param parent the object which doesn't support a requested element + * @param elementName the name of the Element which is trying to be created. + */ public void throwNotSupported(Project project, Object parent, String elementName) { -String msg = project.getElementName(parent) + -" doesn't support the nested \"" + elementName + "\" element."; +String msg = project.getElementName(parent) ++ " doesn't support the nested \"" + elementName + "\" element."; throw new BuildException(msg); } @@ -603,9 +613,9 @@ * @return true if the given nested element is supported */ public boolean supportsNestedElement(String elementName) { -return nestedCreators.containsKey(elementName) || -DynamicConfigurator.class.isAssignableFrom(bean) || -addTypeMethods.size() != 0; +return nestedCreators.containsKey(elementName) +|| DynamicConfigurator.class.isAssignableFrom(bean) +|| addTypeMethods.size() != 0; } /** @@ -670,8 +680,9 @@ throws BuildException { Class nt = (Class) nestedTypes.get(elementName); if (nt == null) { -String msg = "Class " + bean.getName() + -" doesn't support the nested \"" + elementName + "\" element."; +String msg = "Class " + bean.getName() ++ " doesn't support the nested \"" + elementName ++ "\" element."; throw new BuildException(msg); } return nt; @@ -839,13 +850,13 @@ }; // EnumeratedAttributes have their own helper class -} else if (org.apache.tools.ant.types.EnumeratedAttribute.class.isAssignableFrom(reflectedArg)) { +} else if (EnumeratedAttribute.class.isAssignableFrom(reflectedArg)) { return new AttributeSetter() { public void set(Project p, Object parent, String value) throws InvocationTargetException, IllegalAccessException, BuildException { try { -org.apache.tools.ant.types.EnumeratedAttribute ea = - (org.apache.tools.ant.types.EnumeratedAttribute) reflectedArg.newInstance(); +EnumeratedAttribute ea = +(EnumeratedAttribute) reflectedArg.newInstance(); ea.setValue(value); m.invoke(parent, new EnumeratedAttribute[]