[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: best format for patches

On Sun, Dec 15, 2002 at 11:25:50AM +0100, Martin Schulze wrote:
> If I would be affected, I'd like to have it split up into small
> pieces, not all submitted at the same time (to avoid a flood of
> patches that may have a similar effect as a large patch).

Ok, here is a small patch to madison.

I found the ./heidi script can be manually used
to add a package to a distribution, however, first
you need a complete list of files to move.

Madison will generate this complete list of files
(with the -S flag),
but the format is different to what heidi expects, for

- if there is a binary file with the same name as the
  source, it will list it twice, for instance:

[611] [snoopy:unstable:bam] /debian/katie >./madison -s unstable -S dbs
      dbs |       0.17 |      unstable | source, all
      dbs |       0.17 |      unstable | source, all

- the | are parsed by heide as a seperate fields, and it sees three
  fields total.

- heidi needs a seperate row for each architecture.

This patch will add on option to madison that changes the format
appropriately. Now you can say:

madison -s unstable -S valgrind -n | ./heidi --add=stable

For instance to add the valgrind package from unstable to stable.

I did not know what to call this option, so I just
called it --non-human-readable.

(it is possible that there is already another better way of doing this,
but I didn't get/accidently missed any answers when I previously asked).

Also I have SQL SELECT statements that will list all {binary,source}
packages in unstable but not stable.


Is this a good appropriate sized patch, with an appropriate description?
Brian May <bam@debian.org>
Index: madison
RCS file: /cvs/dak/dak/madison,v
retrieving revision 1.22
diff -u -r1.22 madison
--- madison	8 Dec 2002 17:25:17 -0000	1.22
+++ madison	16 Dec 2002 01:04:25 -0000
@@ -46,6 +46,7 @@
   -r, --regex                treat PACKAGE as a regex
   -s, --suite=SUITE          only show info for this suite
   -S, --source-and-binary    show info for the binary children of source pkgs
+  -n, --non-human-readable   output in format compatable with heidi
   -h, --help                 show this help and exit
 Both ARCH and SUITE can be space seperated lists, e.g.
@@ -64,9 +65,10 @@
                  ('r', "regex", "Madison::Options::Regex"),
                  ('s', "suite", "Madison::Options::Suite", "HasArg"),
                  ('S', "source-and-binary", "Madison::Options::Source-And-Binary"),
+                 ('n', "non-human-readable", "Madison::Options::Non-Human"),
                  ('h', "help", "Madison::Options::Help")];
     for i in [ "architecture", "component", "regex", "suite",
-               "source-and-binary", "help" ]:
+               "source-and-binary", "Non-Human", "help" ]:
 	if not Cnf.has_key("Madison::Options::%s" % (i)):
 	    Cnf["Madison::Options::%s" % (i)] = "";
@@ -98,6 +100,17 @@
         packages = new_packages;
+    # Remove duplicate packages (otherwise will add source package twice
+    # if binary package of same name exists and Source-And-Binary is selected)
+    tmp = {};
+    new_packages = [];
+    for package in packages:
+        if not tmp.has_key(package):
+            tmp[package] = 1;
+            new_packages.append(package);
+    packages = new_packages;
     results = 0;
     for package in packages:
         q = projectB.query("SELECT b.package, b.version, a.arch_string, su.suite_name, m.name FROM binaries b, architecture a, suite su, bin_associations ba, maintainer m WHERE b.package %s '%s' AND a.id = b.architecture AND su.id = ba.suite AND b.id = ba.bin AND b.maintainer = m.id %s %s" % (comparison_operator, package, con_suites, con_architectures));
@@ -129,11 +142,16 @@
                 suites = d[pkg][version].keys();
                 for suite in suites:
-                    sys.stdout.write("%10s | %10s | %13s | " % (pkg, version, suite));
                     arches = d[pkg][version][suite];
-                    sys.stdout.write(", ".join(arches));
-                    sys.stdout.write('\n');
+                    if Options["Non-Human"]:
+			for arch in arches:
+                            sys.stdout.write("%s %s %s\n" % (pkg, version, arch));
+	            else:
+                        sys.stdout.write("%10s | %10s | %13s | " % (pkg, version, suite));
+                        sys.stdout.write(", ".join(arches));
+                        sys.stdout.write('\n');
     if not results:

Reply to: