felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clem...@apache.org
Subject svn commit: r942340 - in /felix/sandbox/clement/Project-Checker: ./ src/org/apache/felix/project/checker/
Date Sat, 08 May 2010 08:22:46 GMT
Author: clement
Date: Sat May  8 08:22:46 2010
New Revision: 942340

URL: http://svn.apache.org/viewvc?rev=942340&view=rev
Log:
some old changes

Modified:
    felix/sandbox/clement/Project-Checker/README.txt
    felix/sandbox/clement/Project-Checker/config.properties
    felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/ChangelogChecker.java
    felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/HeaderChecker.java
    felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/License.java
    felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/MD5Checker.java
    felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/NoticeCopyrightChecker.java
    felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/Project.java
    felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/Sha1Checker.java

Modified: felix/sandbox/clement/Project-Checker/README.txt
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Project-Checker/README.txt?rev=942340&r1=942339&r2=942340&view=diff
==============================================================================
--- felix/sandbox/clement/Project-Checker/README.txt (original)
+++ felix/sandbox/clement/Project-Checker/README.txt Sat May  8 08:22:46 2010
@@ -72,6 +72,13 @@ java 
  java \
 	 -cp bin:libs/commons-cli-1.1.jar:libs/commons-collections-3.2.1.jar:libs/commons-lang-2.4.jar:libs/dom4j-1.6.1.jar:libs/apache-rat-0.7-SNAPSHOT.jar:libs/apache-rat-core-0.7-SNAPSHOT.jar
\
 	 org.apache.felix.project.checker.Project \
+	 -n org.apache.felix.ipojo.junit4osgi \
+	 -v 1.1.0-SNAPSHOT \
+	 -d ~/workspaces/felix-trunk/ipojo/junit4osgi/junit4osgi 
+ 
+ java \
+	 -cp bin:libs/commons-cli-1.1.jar:libs/commons-collections-3.2.1.jar:libs/commons-lang-2.4.jar:libs/dom4j-1.6.1.jar:libs/apache-rat-0.7-SNAPSHOT.jar:libs/apache-rat-core-0.7-SNAPSHOT.jar
\
+	 org.apache.felix.project.checker.Project \
 	 -n org.apache.felix.main \
 	 -v 1.6.1 \
 	 -u http://people.apache.org/~pauls/1.6.1/

Modified: felix/sandbox/clement/Project-Checker/config.properties
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Project-Checker/config.properties?rev=942340&r1=942339&r2=942340&view=diff
==============================================================================
--- felix/sandbox/clement/Project-Checker/config.properties (original)
+++ felix/sandbox/clement/Project-Checker/config.properties Sat May  8 08:22:46 2010
@@ -7,6 +7,7 @@ RM=rm
 # Global properties
 PARENT_PROJECT_NAME=Apache Felix
 SVN_URL=http://svn.apache.org/repos/asf/felix/releases/
+NEXUS_REPOSITORY=https://repository.apache.org/content/repositories/
 
 # Ignored packages
 # This list of packages is ignored during license checking

Modified: felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/ChangelogChecker.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/ChangelogChecker.java?rev=942340&r1=942339&r2=942340&view=diff
==============================================================================
--- felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/ChangelogChecker.java
(original)
+++ felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/ChangelogChecker.java
Sat May  8 08:22:46 2010
@@ -10,7 +10,10 @@ public class ChangelogChecker implements
         File changelog = new File(project, "/doc/changelog.txt");
         
         if (! changelog.exists()) {
-            throw new Exception("The changelog is missing");
+            changelog = new File(project, "changelog.txt");
+            if (! changelog.exists()) {
+                throw new Exception("The changelog is missing");
+            }
         }
         //TODO Check that the changelog is up to date.
     }

Modified: felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/HeaderChecker.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/HeaderChecker.java?rev=942340&r1=942339&r2=942340&view=diff
==============================================================================
--- felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/HeaderChecker.java
(original)
+++ felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/HeaderChecker.java
Sat May  8 08:22:46 2010
@@ -119,7 +119,8 @@ public class HeaderChecker implements Ch
                 || name.contains(".svn")
                 || name.contains(".classpath") || name.contains(".project") 
                 || name.contains(".externalToolBuilders") || name.contains(".settings")
-                || name.contains("maven-eclipse.xml");
+                || name.contains("maven-eclipse.xml")
+                || name.contains(".checkstyle");
         }
 
         public void report(RatReport report, File file) throws RatReportFailedException {

Modified: felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/License.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/License.java?rev=942340&r1=942339&r2=942340&view=diff
==============================================================================
--- felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/License.java
(original)
+++ felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/License.java
Sat May  8 08:22:46 2010
@@ -221,7 +221,7 @@ public class License {
            file = Utils.expand(release.getArtifactDirectory(), "LIC-1", je, jar);
            boolean ok = Utils.compare(this.file, file);
            if (! ok) {
-               release.error(chk, "Differences found in the license file", null);
+               release.error(chk, "Differences found in the license of " + keyword + " with
" + this.file.getAbsolutePath(), null);
            }
        } catch (IOException e) {
            release.error(chk, "Cannot expand the license file from the Jar file", e.getMessage());
@@ -239,7 +239,7 @@ public class License {
         }
         boolean ok = Utils.compare(this.file, file);
         if (! ok) {
-            release.error(chk, "Differences found in the license file", null);
+            release.error(chk, "Differences found in the license of " + keyword + " with
" + this.file.getAbsolutePath(), null);
         }
      }
     

Modified: felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/MD5Checker.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/MD5Checker.java?rev=942340&r1=942339&r2=942340&view=diff
==============================================================================
--- felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/MD5Checker.java
(original)
+++ felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/MD5Checker.java
Sat May  8 08:22:46 2010
@@ -20,6 +20,7 @@ public class MD5Checker implements Check
         for (File f : files) {
             // Remove the .asc from the file name
             int index = f.getName().lastIndexOf('.');
+            
             String n = f.getName().substring(0, index);
             
             Command cmd = new Command();
@@ -37,7 +38,11 @@ public class MD5Checker implements Check
         BufferedReader br = new BufferedReader (fis);
         String line = br.readLine();
         int index = line.indexOf(' ');
-        return line.substring(index).trim();
+        if (index == -1) {
+            return line.trim();
+        } else {
+            return line.substring(index).trim();
+        }
     }
 
     public void clean() {

Modified: felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/NoticeCopyrightChecker.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/NoticeCopyrightChecker.java?rev=942340&r1=942339&r2=942340&view=diff
==============================================================================
--- felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/NoticeCopyrightChecker.java
(original)
+++ felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/NoticeCopyrightChecker.java
Sat May  8 08:22:46 2010
@@ -15,8 +15,8 @@ public class NoticeCopyrightChecker impl
         Matcher matcher = COPYRIGHT_PATTERN.matcher(copyright);
         if (matcher.matches()) {
             String year = matcher.group(1);
-            if (! year.contains("2009")) {
-                throw new Exception("The copyright year(s) must contains 2009");
+            if (! year.contains("2010")) {
+                throw new Exception("The copyright year(s) must contains 2010");
             }
         } else {
             throw new Exception("The copyright (" + copyright + ") is not conform against
" + COPYRIGHT_REGEX);

Modified: felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/Project.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/Project.java?rev=942340&r1=942339&r2=942340&view=diff
==============================================================================
--- felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/Project.java
(original)
+++ felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/Project.java
Sat May  8 08:22:46 2010
@@ -66,6 +66,33 @@ public class Project {
 
     private JarFile jar;
     
+    public static Project projectFromNexus(String nexus) throws FileNotFoundException, IOException
{
+        //https://repository.apache.org/content/repositories/orgapachefelix-001/org/apache/felix/org.apache.felix.bundlerepository/1.4.3/
+        
+        // Load configuration.
+        Properties props = new Properties();
+        props.load(new FileInputStream(new File(CONFIG_FILE)));
+        
+        String root = (String) props.get("NEXUS_REPOSITORY");
+        String url = nexus.substring(root.length());
+        
+        String[] parts = url.split("/");
+        System.out.println("Repository=" + parts[0]);
+        
+        String groupid = "";
+        for (int i = 0; i <= parts.length - 3; i++) {
+            groupid += parts[i];
+        }
+        
+        String name = parts[parts.length - 2];
+        System.out.println("Artifact=" + name);
+        System.out.println("GroupId=" + groupid);
+        String version = parts[parts.length - 1];
+        System.out.println("Version=" + version);
+        
+        return new Project(nexus, name, version, false);
+    }
+    
     public Project(String url, String name, String version, boolean project_mode) throws
FileNotFoundException, IOException {
         this(url, name, version, CONFIG_FILE, project_mode);
     }
@@ -246,6 +273,9 @@ public class Project {
       
         // Get notice
         ZipEntry ze = jar.getEntry("META-INF/NOTICE");
+        if (ze == null) {
+            throw new Exception("Cannot find the notice file inside the artifact");
+        }
         InputStream is = jar.getInputStream(ze);
         File not = new File(getArtifactDirectory(), "NOTICE");
         FileOutputStream os = new FileOutputStream(not);
@@ -368,12 +398,14 @@ public class Project {
     }
     
     public static void main(String[] args) throws Exception {
+        //https://repository.apache.org/content/repositories/orgapachefelix-001/org/apache/felix/org.apache.felix.bundlerepository/1.4.3/
         String url = null;
         String name = null;
         String version = null;
         String configuration = null;
         boolean download = true;
         boolean project = false;
+        String nexus = null;
         for (int i = 0; i < args.length; i++) {
             if (! args[i].contains("-")) {
                 continue; // Skip the value.
@@ -398,17 +430,26 @@ public class Project {
                 url = args[i+1];
                 project = true;
             }
+            if (args[i].equals("--nexus")) {
+                nexus = args[i+1];
+                System.out.println("Enabled nexus mode");
+            }
         }
         
-        if (url == null || name == null || version == null) {
+        if ((url == null || name == null || version == null) && nexus == null) {
             printUsage();
             return;
         }
         Project release = null;
-        if (configuration == null) {
-            release = new Project(url, name, version, project);
+        
+        if (nexus != null) {
+            release = Project.projectFromNexus(nexus);
         } else {
-            release = new Project(url, name, version, configuration, project);
+            if (configuration == null) {
+                release = new Project(url, name, version, project);
+            } else {
+                release = new Project(url, name, version, configuration, project);
+            }
         }
         
         if (! project && download) {

Modified: felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/Sha1Checker.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/Sha1Checker.java?rev=942340&r1=942339&r2=942340&view=diff
==============================================================================
--- felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/Sha1Checker.java
(original)
+++ felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/Sha1Checker.java
Sat May  8 08:22:46 2010
@@ -37,7 +37,11 @@ public class Sha1Checker implements Chec
         BufferedReader br = new BufferedReader (fis);
         String line = br.readLine();
         int index = line.indexOf(' ');
-        return line.substring(index).trim();
+        if (index == -1) {
+            return line.trim();
+        } else {
+            return line.substring(index).trim();
+        }
     }
 
     public void clean() {



Mime
View raw message