// we need this script to gerenate a jobname:package-version matching very fast
// if there is a better way to do this, please implement it! :)

hudsonInstance = hudson.model.Hudson.instance

allItems = hudsonInstance.items
pkgJobs = allItems.findAll{job -> job.name.contains("pkg+")}

for (job in pkgJobs) {
  lastBuild = job.getLastBuild();
  if (lastBuild == null)
    // catch case when job has never been built so far
    println job.name + " 0.0#0"
  else
    println lastBuild
}

// we need this script to gerenate a jobname:package-version matching very fast
// (relatively ugly, but fast - better ideas for version-handling are welcome!)

hudsonInstance = hudson.model.Hudson.instance

allItems = hudsonInstance.items
pkgJobs = allItems.findAll{job -> job.name.contains("pkg+")}

for (job in pkgJobs) {
  jobName = job.name;
  jobVersion = "0";
  job.getBuildWrappersList().each() {
    cl -> if (cl.getClass().equals(org.jenkinsci.plugins.buildnamesetter.BuildNameSetter))
      jobVersion = cl.template.replace('#${BUILD_NUMBER}', "");
  }
  println jobName + " " + jobVersion;
}

Improve groovy script to never ever fail
Improve groovy script to never ever fail

This was required, because we can now determine installed
and not-installed packages by comparing versions.
