/**
 * Copyright (c) 2010-2013, theo@m1theo.org.
 * 
 * All rights reserved. This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 */

package org.m1theo.apt.repo.packages;

/**
 * Represents an entry in the Packages file.
 * 
 * @author Theo Weiss
 * @since 0.1.0
 * 
 */
public class PackageEntry {
  private String packageName;
  private String version;
  private String architecture;
  private String maintainer;
  private String installed_size;
  private String depends;
  private String filename;
  private long size;
  private String md5sum;
  private String sha1;
  private String sha256;
  private String section;
  private String priority;
  private String description;


  @Override
  public String toString() {
    return "Package: " + packageName + "\n" + "Version: " + version + "\n" + "Architecture: "
        + architecture + "\n" + "Maintainer: " + maintainer + "\n" + "Installed-Size: "
        + installed_size + "\n" + "Depends: " + depends + "\n" + "Filename: " + filename + "\n"
        + "Size: " + size + "\n" + "MD5sum: " + md5sum + "\n" + "SHA1: " + sha1 + "\n" + "SHA256: "
        + sha256 + "\n" + "Section: " + section + "\n" + "Priority: " + priority + "\n"
        + "Description: " + description + "\n";
  }

  public void setPackageName(String packageName) {
    this.packageName = packageName;
  }

  public void setVersion(String version) {
    this.version = version;
  }

  public void setArchitecture(String architecture) {
    this.architecture = architecture;
  }

  public void setMaintainer(String maintainer) {
    this.maintainer = maintainer;
  }

  public void setInstalled_size(String installed_size) {
    this.installed_size = installed_size;
  }

  public void setDepends(String depends) {
    this.depends = depends;
  }

  public void setFilename(String filename) {
    this.filename = filename;
  }

  public void setSize(long size) {
    this.size = size;
  }

  public void setMd5sum(String md5sum) {
    this.md5sum = md5sum;
  }

  public void setSha1(String sha1) {
    this.sha1 = sha1;
  }

  public void setSha256(String sha256) {
    this.sha256 = sha256;
  }

  public void setSection(String section) {
    this.section = section;
  }

  public void setPriority(String priority) {
    this.priority = priority;
  }

  public void setDescription(String description) {
    this.description = description;
  }


}

@@ -890,15 +890,68 @@
     
-return 
+StringBuffer buffer = new StringBuffer();%0A    buffer.append(
 %22Pac
@@ -1005,24 +1005,32 @@
 rsion + %22%5Cn%22
+%0A       
  + %22Architec
@@ -1036,24 +1036,16 @@
 cture: %22
-%0A       
  + archi
@@ -1091,24 +1091,32 @@
 ainer + %22%5Cn%22
+%0A       
  + %22Installe
@@ -1124,24 +1124,16 @@
 -Size: %22
-%0A       
  + insta
@@ -1148,19 +1148,66 @@
 e + %22%5Cn%22
- + 
+);%0A    if (depends != null) %7B%0A      buffer.append(
 %22Depends
@@ -1226,19 +1226,43 @@
 s + %22%5Cn%22
- + 
+);%0A    %7D%0A    buffer.append(
 %22Filenam
@@ -1279,32 +1279,24 @@
 ename + %22%5Cn%22
-%0A       
  + %22Size: %22 
@@ -1330,16 +1330,24 @@
 + md5sum
+%0A       
  + %22%5Cn%22 
@@ -1383,24 +1383,16 @@
 HA256: %22
-%0A       
  + sha25
@@ -1426,24 +1426,32 @@
 ction + %22%5Cn%22
+%0A       
  + %22Priority
@@ -1467,32 +1467,24 @@
 ority + %22%5Cn%22
-%0A       
  + %22Descript
@@ -1510,16 +1510,48 @@
 n + %22%5Cn%22
+);%0A%0A    return buffer.toString()
 ;%0A  %7D%0A%0A 

make depends in control file optional