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

Re: Patch for alicia: better handling source + binary overrides



On Tue, Dec 20, 2005 at 05:13:05PM -0800, Jeroen van Wolffelaar wrote:
> Please find below (or in spohr:~jeroen/katie/alicia{,.diff,.changelog})
> a reasonable smallish patch for alicia, to get her to work properly with
> binary vs source overrides, instead of bailing out if an override exists
> for both (could happen in the past, happens much more now that cindy
> will add missing source overrides). Without this patch, override
> handling is harder to do, natalie isn't very convenient, in usage nor in
> logging.

I wrote a somewhat different patch for Ubuntu's dak installation a while
back, which lets you use alicia to work on udeb overrides too. (I don't
know if it'll apply cleanly to current CVS.) With this you use '-t dsc'
to work on source packages.

--- alicia.orig	2005-04-09 15:20:41.000000000 +0100
+++ alicia	2005-06-26 12:59:50.785807323 +0100
@@ -53,6 +53,7 @@
   -d, --done=BUG#            send priority/section change as closure to bug#
   -n, --no-action            don't do anything
   -s, --suite                specify the suite to use
+  -t, --type                 specify the override type
 """
     sys.exit(exit_code)
 
@@ -65,12 +66,15 @@
                  ('d',"done","Alicia::Options::Done", "HasArg"),
                  ('n',"no-action","Alicia::Options::No-Action"),
                  ('s',"suite","Alicia::Options::Suite", "HasArg"),
+                 ('t',"type","Alicia::Options::Type", "HasArg"),
                  ];
     for i in ["help", "no-action"]:
 	if not Cnf.has_key("Alicia::Options::%s" % (i)):
 	    Cnf["Alicia::Options::%s" % (i)] = "";
     if not Cnf.has_key("Alicia::Options::Suite"):
 	Cnf["Alicia::Options::Suite"] = "breezy"; # XXX should use site-wide default
+    if not Cnf.has_key("Alicia::Options::Type"):
+        Cnf["Alicia::Options::Type"] = "deb";
 
     arguments = apt_pkg.ParseCommandLine(Cnf,Arguments,sys.argv);
     Options = Cnf.SubTree("Alicia::Options")
@@ -86,6 +90,7 @@
 
     package = arguments.pop(0);
     suite = Options["Suite"]
+    override_type = Options["Type"]
     if arguments and len(arguments) > 2:
         utils.fubar("Too many arguments");
 
@@ -108,13 +113,16 @@
     # Retrieve current section/priority...
     q = projectB.query("""
     SELECT priority.priority AS prio, section.section AS sect
-      FROM override, priority, section, suite
+      FROM override, priority, section, suite, override_type
      WHERE override.priority = priority.id
        AND override.section = section.id
        AND override.package = %s
        AND override.suite = suite.id
+       AND override.type = override_type.id
        AND suite.suite_name = %s
-    """ % (pg._quote(package,"str"), pg._quote(suite,"str")));
+       AND override_type.type = %s
+    """ % (pg._quote(package,"str"), pg._quote(suite,"str"),
+           pg._quote(override_type,"str")));
 
     if q.ntuples() == 0:
         utils.fubar("Unable to find package %s" % (package));
@@ -189,10 +197,12 @@
         UPDATE override
            SET priority=%d
          WHERE package=%s
-           AND suite = (SELECT id FROM suite WHERE suite_name=%s)""" % (
+           AND suite = (SELECT id FROM suite WHERE suite_name=%s)
+           AND type = (SELECT id from override_type WHERE type=%s)""" % (
             newprioid,
             pg._quote(package,"str"),
-            pg._quote(suite,"str") ));
+            pg._quote(suite,"str"),
+            pg._quote(override_type,"str") ));
         Logger.log(["changed priority",package,oldpriority,newpriority]);
 
     if newsection != oldsection:
@@ -200,10 +210,12 @@
         UPDATE override
            SET section=%d
          WHERE package=%s
-           AND suite = (SELECT id FROM suite WHERE suite_name=%s)""" % (
+           AND suite = (SELECT id FROM suite WHERE suite_name=%s)
+           AND type = (SELECT id FROM override_type WHERE type=%s)""" % (
             newsecid,
             pg._quote(package,"str"),
-            pg._quote(suite,"str") ));
+            pg._quote(suite,"str"),
+            pg._quote(override_type,"str") ));
         Logger.log(["changed priority",package,oldsection,newsection]);
     projectB.query("COMMIT WORK");
 

-- 
Colin Watson                                       [cjwatson@debian.org]



Reply to: