Re: New upstream release of Koji (and a refresh of Fedora builders?)

2008-01-24 Thread Dennis Gilmore
On Sunday 20 January 2008, Dennis Gilmore wrote:
> On Sunday 20 January 2008, Jesse Keating wrote:
> > On Sun, 20 Jan 2008 20:32:46 -0600
> >
> > Dennis Gilmore <[EMAIL PROTECTED]> wrote:
> > > I have no issues with that at all.  i would prefer we do it so we are
> > > not carrying patches.  Id like to see the patches that i submitted
> > > included also. It will help in secondary arch ramp up over the next
> > > couple of weeks
> >
> > https://fedorahosted.org/koji/changeset/6feae640c291ae24de8e855b8564ff786
> >52 7dcb9  ?  Where there others as of yet not committed?
>
> https://www.redhat.com/archives/fedora-buildsys-list/2008-January/msg00045.
>html
>
> that one is not yet commited.  It adds the config option so we dont spam
> maintainers with a bunch of email for successful builds.
>
> Dennis

here is the updated patch.  if its too late thats ok

Dennis

From 61b4c4f156378d8feee9ff7af86c8d123f17725b Mon Sep 17 00:00:00 2001
From: Dennis Gilmore <[EMAIL PROTECTED]>
Date: Mon, 14 Jan 2008 22:00:43 -0600
Subject: [PATCH] make a configurable option to send email for success or not

---
 hub/httpd.conf |1 +
 hub/kojihub.py |   16 +---
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/hub/httpd.conf b/hub/httpd.conf
index e4acd64..5d3f5e1 100644
--- a/hub/httpd.conf
+++ b/hub/httpd.conf
@@ -32,6 +32,7 @@ Alias /kojihub "/usr/share/koji-hub/XMLRPC"
 # The domain name that will be appended to Koji usernames
 # when creating email notifications
 PythonOption EmailDomain example.com
+PythonOption NotifyOnSuccess False
 # PythonOption KojiDebug On
 # PythonOption KojiTraceback "extended"
 # sending tracebacks to the client isn't very helpful for debugging xmlrpc
diff --git a/hub/kojihub.py b/hub/kojihub.py
index 9a75552..5a4cfc7 100644
--- a/hub/kojihub.py
+++ b/hub/kojihub.py
@@ -3551,13 +3551,15 @@ def get_notification_recipients(build, tag_id, state):
 emails = [result[0] for result in _fetchMulti(query, locals())]
 
 email_domain = context.opts['EmailDomain']
-
-# user who submitted the build
-emails.append('[EMAIL PROTECTED]' % (build['owner_name'], email_domain))
-
-packages = readPackageList(pkgID=package_id, tagID=tag_id, inherit=True)
-# owner of the package in this tag, following inheritance
-emails.append('[EMAIL PROTECTED]' % (packages[package_id]['owner_name'], email_domain))
+notifyonsuccess = context.opts['NotifyOnSuccess'] 
+  
+if notfyonsuccess == 'True' or state != koji.BUILD_STATES['COMPLETE']: 
+# user who submitted the build
+emails.append('[EMAIL PROTECTED]' % (build['owner_name'], email_domain))
+
+packages = readPackageList(pkgID=package_id, tagID=tag_id, inherit=True)
+# owner of the package in this tag, following inheritance
+emails.append('[EMAIL PROTECTED]' % (packages[package_id]['owner_name'], email_domain))
 
 emails_uniq = dict(zip(emails, [1] * len(emails))).keys()
 return emails_uniq
-- 
1.5.3.8



signature.asc
Description: This is a digitally signed message part.
--
Fedora-buildsys-list mailing list
Fedora-buildsys-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-buildsys-list

Re: [PATCH] set the current working directory in the chroot

2008-01-24 Thread Michael E Brown
On Thu, Jan 24, 2008 at 05:16:46PM -0500, Mike Bonnet wrote:
> This patch allows you to set the current working directory (in the
> chroot) before running a command with --chroot.  This avoids the need to
> pass shell snippets ('cd /some/path && /run/cmd') to mock when running a
> command that expects to executed from a certain directory.  It's useful
> when using --copyin to setup the environment before running a command.

This seems reasonable. Applying.
--
Michael


> >From e4071d1d41a62ccf4461dfab958f9325edf30c97 Mon Sep 17 00:00:00 2001
> From: Mike Bonnet <[EMAIL PROTECTED]>
> Date: Thu, 24 Jan 2008 17:09:06 -0500
> Subject: [PATCH] optionally set the current working directory (in the chroot) 
> before running command with --chroot
> 
> ---
>  docs/mock.1 |3 +++
>  py/mock.py  |8 ++--
>  py/mock/util.py |   13 +
>  3 files changed, 18 insertions(+), 6 deletions(-)
> 
> diff --git a/docs/mock.1 b/docs/mock.1
> index 38c3233..531d117 100644
> --- a/docs/mock.1
> +++ b/docs/mock.1
> @@ -140,6 +140,9 @@ Fail build if rpmbuild takes longer than 'timeout' seconds
>  \fB\-\-unpriv\fR
>  Drop privileges before running command when using --chroot
>  .TP
> +\fB\-\-cwd=\fR\fIDIR\fP
> +Change to the specified directory (relative to the chroot) before running 
> command when using --chroot
> +.TP
>  \fB\-q\fR, \fB\-\-quiet\fR
>  Be quiet.
>  .TP
> diff --git a/py/mock.py b/py/mock.py
> index f422a33..d5afbbe 100755
> --- a/py/mock.py
> +++ b/py/mock.py
> @@ -152,6 +152,10 @@ def command_parse(config_opts):
> " seconds ")
>  parser.add_option("--unpriv", action="store_true", default=False,
>help="Drop privileges before running command when 
> using --chroot")
> +parser.add_option("--cwd", action="store", default=None,
> +  metavar="DIR",
> +  help="Change to the specified directory (relative to 
> the chroot)"
> +   " before running command when using --chroot")
>  
>  # verbosity
>  parser.add_option("-v", "--verbose", action="store_const", const=2,
> @@ -536,9 +540,9 @@ def main(ret):
>  chroot._mountall()
>  if options.unpriv:
>  chroot.doChroot(args, shell=shell,
> -uid=chroot.chrootuid, gid=chroot.chrootgid)
> +uid=chroot.chrootuid, gid=chroot.chrootgid, 
> cwd=options.cwd)
>  else:
> -chroot.doChroot(args, shell=shell)
> +chroot.doChroot(args, shell=shell, cwd=options.cwd)
>  finally:
>  chroot._umountall()
>  
> diff --git a/py/mock/util.py b/py/mock/util.py
> index f93f98b..65cc995 100644
> --- a/py/mock/util.py
> +++ b/py/mock/util.py
> @@ -201,6 +201,10 @@ def condChroot(chrootPath):
>  os.chroot(chrootPath)
>  uid.setresuid(saved['ruid'], saved['euid'])
>  
> +def condChdir(cwd):
> +if cwd is not None:
> +os.chdir(cwd)
> +
>  def condDropPrivs(uid, gid):
>  if gid is not None:
>  os.setregid(gid, gid)
> @@ -245,12 +249,12 @@ def logOutput(fds, logger, returnOutput=1, start=0, 
> timeout=0):
>  # The "Not-as-complicated" version
>  #
>  decorate(traceLog())
> -def do(command, shell=False, chrootPath=None, timeout=0, raiseExc=True, 
> returnOutput=0, uid=None, gid=None, personality=None, *args, **kargs):
> +def do(command, shell=False, chrootPath=None, cwd=None, timeout=0, 
> raiseExc=True, returnOutput=0, uid=None, gid=None, personality=None, *args, 
> **kargs):
>  
>  logger = kargs.get("logger", getLog())
>  output = ""
>  start = time.time()
> -preexec = ChildPreExec(personality, chrootPath, uid, gid)
> +preexec = ChildPreExec(personality, chrootPath, cwd, uid, gid)
>  try:
>  child = None
>  logger.debug("Executing command: %s" % command)
> @@ -292,9 +296,10 @@ def do(command, shell=False, chrootPath=None, timeout=0, 
> raiseExc=True, returnOu
>  return output
>  
>  class ChildPreExec(object):
> -def __init__(self, personality, chrootPath, uid, gid):
> +def __init__(self, personality, chrootPath, cwd, uid, gid):
>  self.personality = personality
>  self.chrootPath  = chrootPath
> +self.cwd = cwd
>  self.uid = uid
>  self.gid = gid
>  
> @@ -303,4 +308,4 @@ class ChildPreExec(object):
>  condPersonality(self.personality)
>  condChroot(self.chrootPath)
>  condDropPrivs(self.uid, self.gid)
> -
> +condChdir(self.cwd)
> -- 
> 1.5.3.3
> 
> 
> 
> --
> Fedora-buildsys-list mailing list
> Fedora-buildsys-list@redhat.com
> https://www.redhat.com/mailman/listinfo/fedora-buildsys-list

--
Fedora-buildsys-list mailing list
Fedora-buildsys-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-buildsys-list


Re: [PATCH] add --unpriv option to drop privileges when running a command with --chroot

2008-01-24 Thread Michael E Brown
On Thu, Jan 24, 2008 at 04:07:51PM -0500, Mike Bonnet wrote:
> On Thu, 2008-01-24 at 16:04 -0500, Mike Bonnet wrote:
> > On Thu, 2008-01-24 at 15:42 -0500, Mike Bonnet wrote:
> > > This patch adds a --unpriv option that will cause privileges to be
> > > dropped before running a command with --chroot.  This can be used to
> > > more closely simulate the environment used when running rpmbuilds.
> > 
> > Let me try that again...
> 
> Ok, the attachments are getting stripped off for some reason, trying
> inline...

This patch looks fine to me. Applying.
--
Michael

> 
> 
> >From 85e14d38aec32cf20d7f2bbdc77044d41c32a0a2 Mon Sep 17 00:00:00 2001
> From: Mike Bonnet <[EMAIL PROTECTED]>
> Date: Thu, 24 Jan 2008 15:37:15 -0500
> Subject: [PATCH] optionally drop privileges when running a command with 
> --chroot
> 
> ---
>  docs/mock.1 |3 +++
>  py/mock.py  |8 +++-
>  2 files changed, 10 insertions(+), 1 deletions(-)
> 
> diff --git a/docs/mock.1 b/docs/mock.1
> index beaf2fb..38c3233 100644
> --- a/docs/mock.1
> +++ b/docs/mock.1
> @@ -137,6 +137,9 @@ Change directory where config files are found
>  \fB\-\-rpmbuild_timeout=\fR\fISECONDS\fP
>  Fail build if rpmbuild takes longer than 'timeout' seconds
>  .TP
> +\fB\-\-unpriv\fR
> +Drop privileges before running command when using --chroot
> +.TP
>  \fB\-q\fR, \fB\-\-quiet\fR
>  Be quiet.
>  .TP
> diff --git a/py/mock.py b/py/mock.py
> index 4a589bc..f422a33 100755
> --- a/py/mock.py
> +++ b/py/mock.py
> @@ -150,6 +150,8 @@ def command_parse(config_opts):
>dest="rpmbuild_timeout", type="int", default=None,
>help="Fail build if rpmbuild takes longer than 
> 'timeout'"
> " seconds ")
> +parser.add_option("--unpriv", action="store_true", default=False,
> +  help="Drop privileges before running command when 
> using --chroot")
>  
>  # verbosity
>  parser.add_option("-v", "--verbose", action="store_const", const=2,
> @@ -532,7 +534,11 @@ def main(ret):
>  chroot._resetLogging()
>  try:
>  chroot._mountall()
> -chroot.doChroot(args, shell=shell)
> +if options.unpriv:
> +chroot.doChroot(args, shell=shell,
> +uid=chroot.chrootuid, gid=chroot.chrootgid)
> +else:
> +chroot.doChroot(args, shell=shell)
>  finally:
>  chroot._umountall()
>  
> -- 
> 1.5.3.3
> 
> 
> 
> --
> Fedora-buildsys-list mailing list
> Fedora-buildsys-list@redhat.com
> https://www.redhat.com/mailman/listinfo/fedora-buildsys-list

--
Fedora-buildsys-list mailing list
Fedora-buildsys-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-buildsys-list


[PATCH] set the current working directory in the chroot

2008-01-24 Thread Mike Bonnet
This patch allows you to set the current working directory (in the
chroot) before running a command with --chroot.  This avoids the need to
pass shell snippets ('cd /some/path && /run/cmd') to mock when running a
command that expects to executed from a certain directory.  It's useful
when using --copyin to setup the environment before running a command.

>From e4071d1d41a62ccf4461dfab958f9325edf30c97 Mon Sep 17 00:00:00 2001
From: Mike Bonnet <[EMAIL PROTECTED]>
Date: Thu, 24 Jan 2008 17:09:06 -0500
Subject: [PATCH] optionally set the current working directory (in the chroot) 
before running command with --chroot

---
 docs/mock.1 |3 +++
 py/mock.py  |8 ++--
 py/mock/util.py |   13 +
 3 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/docs/mock.1 b/docs/mock.1
index 38c3233..531d117 100644
--- a/docs/mock.1
+++ b/docs/mock.1
@@ -140,6 +140,9 @@ Fail build if rpmbuild takes longer than 'timeout' seconds
 \fB\-\-unpriv\fR
 Drop privileges before running command when using --chroot
 .TP
+\fB\-\-cwd=\fR\fIDIR\fP
+Change to the specified directory (relative to the chroot) before running 
command when using --chroot
+.TP
 \fB\-q\fR, \fB\-\-quiet\fR
 Be quiet.
 .TP
diff --git a/py/mock.py b/py/mock.py
index f422a33..d5afbbe 100755
--- a/py/mock.py
+++ b/py/mock.py
@@ -152,6 +152,10 @@ def command_parse(config_opts):
" seconds ")
 parser.add_option("--unpriv", action="store_true", default=False,
   help="Drop privileges before running command when using 
--chroot")
+parser.add_option("--cwd", action="store", default=None,
+  metavar="DIR",
+  help="Change to the specified directory (relative to the 
chroot)"
+   " before running command when using --chroot")
 
 # verbosity
 parser.add_option("-v", "--verbose", action="store_const", const=2,
@@ -536,9 +540,9 @@ def main(ret):
 chroot._mountall()
 if options.unpriv:
 chroot.doChroot(args, shell=shell,
-uid=chroot.chrootuid, gid=chroot.chrootgid)
+uid=chroot.chrootuid, gid=chroot.chrootgid, 
cwd=options.cwd)
 else:
-chroot.doChroot(args, shell=shell)
+chroot.doChroot(args, shell=shell, cwd=options.cwd)
 finally:
 chroot._umountall()
 
diff --git a/py/mock/util.py b/py/mock/util.py
index f93f98b..65cc995 100644
--- a/py/mock/util.py
+++ b/py/mock/util.py
@@ -201,6 +201,10 @@ def condChroot(chrootPath):
 os.chroot(chrootPath)
 uid.setresuid(saved['ruid'], saved['euid'])
 
+def condChdir(cwd):
+if cwd is not None:
+os.chdir(cwd)
+
 def condDropPrivs(uid, gid):
 if gid is not None:
 os.setregid(gid, gid)
@@ -245,12 +249,12 @@ def logOutput(fds, logger, returnOutput=1, start=0, 
timeout=0):
 # The "Not-as-complicated" version
 #
 decorate(traceLog())
-def do(command, shell=False, chrootPath=None, timeout=0, raiseExc=True, 
returnOutput=0, uid=None, gid=None, personality=None, *args, **kargs):
+def do(command, shell=False, chrootPath=None, cwd=None, timeout=0, 
raiseExc=True, returnOutput=0, uid=None, gid=None, personality=None, *args, 
**kargs):
 
 logger = kargs.get("logger", getLog())
 output = ""
 start = time.time()
-preexec = ChildPreExec(personality, chrootPath, uid, gid)
+preexec = ChildPreExec(personality, chrootPath, cwd, uid, gid)
 try:
 child = None
 logger.debug("Executing command: %s" % command)
@@ -292,9 +296,10 @@ def do(command, shell=False, chrootPath=None, timeout=0, 
raiseExc=True, returnOu
 return output
 
 class ChildPreExec(object):
-def __init__(self, personality, chrootPath, uid, gid):
+def __init__(self, personality, chrootPath, cwd, uid, gid):
 self.personality = personality
 self.chrootPath  = chrootPath
+self.cwd = cwd
 self.uid = uid
 self.gid = gid
 
@@ -303,4 +308,4 @@ class ChildPreExec(object):
 condPersonality(self.personality)
 condChroot(self.chrootPath)
 condDropPrivs(self.uid, self.gid)
-
+condChdir(self.cwd)
-- 
1.5.3.3



--
Fedora-buildsys-list mailing list
Fedora-buildsys-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-buildsys-list


Re: [PATCH] add --unpriv option to drop privileges when running a command with --chroot

2008-01-24 Thread Mike Bonnet
On Thu, 2008-01-24 at 16:04 -0500, Mike Bonnet wrote:
> On Thu, 2008-01-24 at 15:42 -0500, Mike Bonnet wrote:
> > This patch adds a --unpriv option that will cause privileges to be
> > dropped before running a command with --chroot.  This can be used to
> > more closely simulate the environment used when running rpmbuilds.
> 
> Let me try that again...

Ok, the attachments are getting stripped off for some reason, trying
inline...


>From 85e14d38aec32cf20d7f2bbdc77044d41c32a0a2 Mon Sep 17 00:00:00 2001
From: Mike Bonnet <[EMAIL PROTECTED]>
Date: Thu, 24 Jan 2008 15:37:15 -0500
Subject: [PATCH] optionally drop privileges when running a command with --chroot

---
 docs/mock.1 |3 +++
 py/mock.py  |8 +++-
 2 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/docs/mock.1 b/docs/mock.1
index beaf2fb..38c3233 100644
--- a/docs/mock.1
+++ b/docs/mock.1
@@ -137,6 +137,9 @@ Change directory where config files are found
 \fB\-\-rpmbuild_timeout=\fR\fISECONDS\fP
 Fail build if rpmbuild takes longer than 'timeout' seconds
 .TP
+\fB\-\-unpriv\fR
+Drop privileges before running command when using --chroot
+.TP
 \fB\-q\fR, \fB\-\-quiet\fR
 Be quiet.
 .TP
diff --git a/py/mock.py b/py/mock.py
index 4a589bc..f422a33 100755
--- a/py/mock.py
+++ b/py/mock.py
@@ -150,6 +150,8 @@ def command_parse(config_opts):
   dest="rpmbuild_timeout", type="int", default=None,
   help="Fail build if rpmbuild takes longer than 'timeout'"
" seconds ")
+parser.add_option("--unpriv", action="store_true", default=False,
+  help="Drop privileges before running command when using 
--chroot")
 
 # verbosity
 parser.add_option("-v", "--verbose", action="store_const", const=2,
@@ -532,7 +534,11 @@ def main(ret):
 chroot._resetLogging()
 try:
 chroot._mountall()
-chroot.doChroot(args, shell=shell)
+if options.unpriv:
+chroot.doChroot(args, shell=shell,
+uid=chroot.chrootuid, gid=chroot.chrootgid)
+else:
+chroot.doChroot(args, shell=shell)
 finally:
 chroot._umountall()
 
-- 
1.5.3.3



--
Fedora-buildsys-list mailing list
Fedora-buildsys-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-buildsys-list


Re: [PATCH] add --unpriv option to drop privileges when running a command with --chroot

2008-01-24 Thread Mike Bonnet
On Thu, 2008-01-24 at 15:42 -0500, Mike Bonnet wrote:
> This patch adds a --unpriv option that will cause privileges to be
> dropped before running a command with --chroot.  This can be used to
> more closely simulate the environment used when running rpmbuilds.

Let me try that again...



0001-optionally-drop-privileges-when-running-a-command-wi.patch
Description: application/mbox
--
Fedora-buildsys-list mailing list
Fedora-buildsys-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-buildsys-list

[PATCH] add --unpriv option to drop privileges when running a command with --chroot

2008-01-24 Thread Mike Bonnet
This patch adds a --unpriv option that will cause privileges to be
dropped before running a command with --chroot.  This can be used to
more closely simulate the environment used when running rpmbuilds.



0001-optionally-drop-privileges-when-running-a-command-wi.patch
Description: application/mbox
--
Fedora-buildsys-list mailing list
Fedora-buildsys-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-buildsys-list