www-repository mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve Loughran" <steve.lough...@gmail.com>
Subject Re: apache commons-* -sources.jar
Date Sat, 02 Feb 2008 22:22:38 GMT
On Feb 2, 2008 8:08 PM, nicolas de loof <nicolas@apache.org> wrote:
> LICENSE, NOTICE and other *.txt files (release note, readme ...) have been
> added at jar root.
> I can rebuild the jars with those files in META-INF if required.
>
> The script was not designed for reproductibility but to avoid manually
> browse on repo, download, unzip and so on..
>
> Here is the code. It is not portable (based on my computer path and tools)
> and produces on System.out DOS commands to get executed. Some downloaded
> artifacts also required some folder name fix as they didn't follow other
> commons-* conventions.

Can I point out that Apache provide two complete build tools to avoid
you doing this kind of housekeeping in Java.

>
> I'm OK to publish it under Apache license ;-)
>
>
>
>
> import java.io.File;
> import java.io.FilenameFilter;
>
> public class Sources
> {
>
>     /**
>      * @param args
>      */
>     public static void main( String[] args )
>     {
>         getMissingSourceDist();
>         extractSrcDist();
>         createSrcBundle();
>     }
>
>     private static void createSrcBundle()
>     {
>         File repo = new File( "H:/java/repo1.maven.org/maven2" );
>         File[] groups = repo.listFiles();
>         for ( File group : groups )
>          {
>             if ( !group.getName().endsWith( "-src.zip" ) )
>             {
>                 continue;
>             }
>             String dist = group.getName().substring( 0,
> group.getName().length() - "-src.zip".length() );
>              File dir = new File( repo, dist );
>             if ( !dir.exists() )
>             {
>                 dir = new File( repo, dist + "-src" );
>                 if ( !dir.exists() )
>                 {
>                      dir = new File( repo, dist );
>                     if ( !dir.exists() )
>                     {
>                         System.err.println( "no dir for " + dist );
>                         continue;
>                      }
>                 }
>             }
>
>             String f = group.getName().substring( 0,
> group.getName().length() - "-src.zip".length() );
>             if ( new File( dir, "src/java" ).exists() )
>             {
>                 System.out.println( "jar cf " + f + "-sources.jar -C " + dir
> + "\\src\\java ." );
>              }
>             else if ( new File( dir, "src/main/java" ).exists() )
>             {
>                 System.out.println( "jar cf " + f + "-sources.jar -C " + dir
> + "\\src\\main\\java ." );
>              }
>             else if ( new File( dir, "src/share" ).exists() )
>             {
>                 System.out.println( "jar cf " + f + "-sources.jar -C " + dir
> + "\\src\\share ." );
>              }
>             else
>             {
>                 System.err.println( "no src/java for " + dist );
>             }
>             if ( new File( dir, "src/resources" ).exists() )
>              {
>                 System.out.println( "jar uf " + f + "-sources.jar -C " + dir
> + "\\src\\resources ." );
>             }
>             if ( new File( dir, "src/javascript" ).exists() )
>              {
>                 System.out.println( "jar uf " + f + "-sources.jar -C " + dir
> + "\\src\\javascript ." );
>             }
>             File[] txt = dir.listFiles( new FilenameFilter()
>              {
>                 @Override
>                 public boolean accept( File dir, String name )
>                 {
>                     return name.endsWith( ".txt" );
>                 }
>             } );
>              for ( File file : txt )
>             {
>                 System.out.println( "jar uf " + f + "-sources.jar -C " + dir
> + " " + file.getName() );
>             }
>         }
>      }
>
>     private static void extractSrcDist()
>     {
>         File repo = new File( "H:/java/repo1.maven.org/maven2" );
>         File[] groups = repo.listFiles();
>         for ( File group : groups )
>         {
>              if ( !group.getName().endsWith( "-src.zip" ) )
>             {
>                 continue;
>             }
>             System.out.println( "\"c:\\Program Files\\7-Zip\\7z.exe\" x " +
> group.getName() );
>          }
>     }
>
>     private static void getMissingSourceDist()
>     {
>         File repo = new File( "H:/java/repo1.maven.org/maven2" );
>         File[] groups = repo.listFiles();
>         for ( File group : groups )
>          {
>             if ( !group.isDirectory() || !group.getName().startsWith(
> "commons" ) )
>             {
>                 continue;
>             }
>             File pr = new File( group, group.getName() );
>              File[] versions = pr.listFiles();
>             for ( File version : versions )
>             {
>                 if ( !version.isDirectory() )
>                 {
>                     continue;
>                 }
>                  if ( new File( version, group.getName() + "-" +
> version.getName() + "-sources.jar" ).exists() )
>                 {
>                     System.out.println( "rem " + group.getName() + ":" +
> version.getName() + " has sources" );
>                      continue;
>                 }
>
>                 String g = group.getName().substring( "commons-".length() );
>                 System.out.println( "wget -nd
> http://archive.apache.org/dist/commons/" + g + "/source/" + group.getName()
> +
>                      "-" + version.getName() + "-src.zip" );
>             }
>         }
>     }
>
> }
>
>
>
> 2008/2/2, Curt Arnold <carnold@apache.org>:
> >
> > On Feb 2, 2008, at 3:56 AM, nicolas de loof wrote:
> >
> > > I've put some -sources.jars in :
> > >
> > > http://people.apache.org/~nicolas/missing-commons-sources.jar/
> > >
> > > Those one have been created by a script :
> > >
> > > - create list of commons-* without -sources.jar in repo
> > > - search for a src-zip distribution in www.apache.org/dist
> > > - wget available ones
> > > - unzip, jar a src/java + src/resources + *.txt
> > >
> > > Nico.
> > >
> >
> >
> > I looked at commons-beanutils-1.6-sources.jar and it did not contain a
> > LICENSE and NOTICE file in the META-INF directory as required by
> http://www.apache.org/dev/release.html#distribute-raw-artifact
> > .  I assume that is likely the case for the other source jar files.
> > That is a mandatory -1 on these as releases for me.
> >
> > The script used to prepare the source jars should be made available so
> > that others can confirm that the build process is repeatable.  If I
> > can look at the script, run it myself and compare my results with your
> > results, I have more confidence that the process is repeatable and
> > honest.  Obviously, the script should be ASL v2 licensed.
> >
> >
>
>

Mime
View raw message