[PATCH][kteam-tools 1/2] maint-getabis: add --pool flag

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH][kteam-tools 1/2] maint-getabis: add --pool flag

Marcelo Henrique Cerri
Add a new --pool flag to specify additional repository URLs to retrieve
the ABI information from.

The --pool flag is also passed to the in-tree script
debian/scripts/misc/getabis but this change is backward compatible with
trees that don't support this flag.

Signed-off-by: Marcelo Henrique Cerri <[hidden email]>
---
 maintscripts/maint-getabis | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/maintscripts/maint-getabis b/maintscripts/maint-getabis
index f375cc1df042..2ffb8f858570 100755
--- a/maintscripts/maint-getabis
+++ b/maintscripts/maint-getabis
@@ -9,6 +9,7 @@
 #==============================================================================
 import sys, os, optparse, re
 from subprocess import *
+from urlparse import urlparse
 
 #------------------------------------------------------------------------------
 # Libraries shared by all kteam-tools will be found here (../lib)
@@ -50,8 +51,17 @@ parser.add_option("--ckt-ppa", action="store_true", dest="cktppa",
 parser.add_option("--no-tree-script", action="store_true", dest="forcemethod",
  default=False, help="Use the external retrieving method " +
  "even if there is a in-tree getabis.")
+parser.add_option("--pool", action="append", dest="additional_repos",
+ default=[], help="add the URL as an abi source")
 (opts, args) = parser.parse_args()
 
+for repo in opts.additional_repos:
+ try:
+ urlparse(repo)
+ except:
+ print "EE: invalid URL: %s" % repo
+ sys.exit(1)
+
 #------------------------------------------------------------------------------
 # The release tag (or SHA1) is a required argument
 #------------------------------------------------------------------------------
@@ -169,6 +179,8 @@ def DownloadPackage(pkgname, srcpkgname):
  if opts.cktppa:
  cmd += "http://ppa.launchpad.net/canonical-kernel-team/"
  cmd += "ppa/ubuntu/pool/main/l/$src\n"
+ for repo in opts.additional_repos:
+ cmd += "%s\n" % repo
  cmd += "\"\n"
  cmd += "if test -f $pkg; then\n"
  cmd += " exit 0\n"
@@ -415,6 +427,9 @@ def TreeGetAbisRemote():
  #----------------------------------------------------------------------
  cmd  = "cd " + tmpdir + "\n"
  cmd += "DEBIAN=. ./getabis " + kversion + " " + revision
+ for repo in opts.additional_repos:
+ cmd += " --pool '%s'" % repo
+        print "II: Running getabis: %s" % cmd
  print "II: Running getabis on", opts.tgthost, "..."
  sys.stdout.flush()
  if not opts.dryrun:
@@ -453,6 +468,8 @@ def TreeGetAbis():
  revision = version.split("-")[1]
  cmd  = "./debian/scripts/misc/getabis " + kversion + " "
  cmd += revision
+ for repo in opts.additional_repos:
+ cmd += " --pool '%s'" % repo
  if not opts.dryrun:
  rc = RunScript(cmd, getoutput=False)[0]
  else:
--
2.7.4


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[PATCH][kteam-tools 2/2] maint-startnewrelease: add --pool flag

Marcelo Henrique Cerri
Pass the --pool flag to maint-getabis.

Signed-off-by: Marcelo Henrique Cerri <[hidden email]>
---
 maintscripts/maint-startnewrelease | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/maintscripts/maint-startnewrelease b/maintscripts/maint-startnewrelease
index 38a8a51d6538..d06eafe4a28a 100755
--- a/maintscripts/maint-startnewrelease
+++ b/maintscripts/maint-startnewrelease
@@ -43,6 +43,9 @@ parser.add_option(
  "--ckt-ppa", action="store_true", dest="cktppa", default=False,
  help="pass --ckt-ppa to maint-getabis, to add c-k-t ppa as an "
      "abi source")
+parser.add_option("--pool", action="append", dest="additional_repos",
+ default=[], help="pass --pool to maint-getabis, add the URL "
+ "as an abi source")
 epilog = "Example: user@test:~/ubuntu-oneiric$ %s " % (parser.get_prog_name())
 epilog += "--local --ckt-ppa"
 parser.epilog = epilog
@@ -128,6 +131,8 @@ if os.path.isdir(os.path.join(debian_dir, "abi")):
  cmd += " --local"
  if opts.cktppa:
  cmd += " --ckt-ppa"
+ for repo in opts.additional_repos:
+ cmd += " --pool '%s'" % repo
         if "-lts-" in srcpkg:
             v = "Ubuntu-lts-" + version + '_' + lts_version
         elif "-raspi2" in srcpkg:
--
2.7.4


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH][kteam-tools 2/2] maint-startnewrelease: add --pool flag

Andy Whitcroft-3
On Fri, Apr 28, 2017 at 02:08:48AM -0300, Marcelo Henrique Cerri wrote:

> Pass the --pool flag to maint-getabis.
>
> Signed-off-by: Marcelo Henrique Cerri <[hidden email]>
> ---
>  maintscripts/maint-startnewrelease | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/maintscripts/maint-startnewrelease b/maintscripts/maint-startnewrelease
> index 38a8a51d6538..d06eafe4a28a 100755
> --- a/maintscripts/maint-startnewrelease
> +++ b/maintscripts/maint-startnewrelease
> @@ -43,6 +43,9 @@ parser.add_option(
>   "--ckt-ppa", action="store_true", dest="cktppa", default=False,
>   help="pass --ckt-ppa to maint-getabis, to add c-k-t ppa as an "
>       "abi source")
> +parser.add_option("--pool", action="append", dest="additional_repos",
> + default=[], help="pass --pool to maint-getabis, add the URL "
> + "as an abi source")
>  epilog = "Example: user@test:~/ubuntu-oneiric$ %s " % (parser.get_prog_name())
>  epilog += "--local --ckt-ppa"
>  parser.epilog = epilog
> @@ -128,6 +131,8 @@ if os.path.isdir(os.path.join(debian_dir, "abi")):
>   cmd += " --local"
>   if opts.cktppa:
>   cmd += " --ckt-ppa"
> + for repo in opts.additional_repos:
> + cmd += " --pool '%s'" % repo

That is vunerable to ' injection on the command line.  Then again they
could just run it direct.

>          if "-lts-" in srcpkg:
>              v = "Ubuntu-lts-" + version + '_' + lts_version
>          elif "-raspi2" in srcpkg:
> --
> 2.7.4

-apw

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH][kteam-tools 2/2] maint-startnewrelease: add --pool flag

Marcelo Henrique Cerri
On Fri, Apr 28, 2017 at 11:44:34AM +0100, Andy Whitcroft wrote:
> On Fri, Apr 28, 2017 at 02:08:48AM -0300, Marcelo Henrique Cerri wrote:
> > + for repo in opts.additional_repos:
> > + cmd += " --pool '%s'" % repo
>
> That is vunerable to ' injection on the command line.  Then again they
> could just run it direct.

I can reject any URL containing ' or replace it with %27. But do you
think it's really necessary?

--
Regards,
Marcelo


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team