FAQ Search Today's Posts Mark Forums Read

» Linux Archive
Home
New Posts
Search
FAQ



 
 
LinkBack Thread Tools
 
Old 12-04-2007, 04:59 PM
Michael E Brown
 
Default mock 0.8.9

On Tue, Dec 04, 2007 at 04:05:00PM +0000, Paul Howarth wrote:
> Todd Zullinger wrote:
> >Michael E Brown wrote:
> >>Patches welcome.
> >
> >Here's one. This adds a --define option, which may be used multiple
> >times. Usage is pretty much like the rpm --define option:
> >
> >$ mock --define="with_extra_cheese 1" --define="packager Monkey" ...
> >
> >Rather than pass the define options directly to rpmbuild, they are
> >added to the .rpmmacros file in the chroot. I'm not sure if there's
> >much difference in practice. If anyone knows differently, please
> >speak up.
>
> Anything written to the buildroot might get cached, mightn't it?

Excellent thought. In this case, it is safe. The .rpmmacros file is
written from scratch in init() every time, so there is no possibility of
an old .rpmmacros file hanging around.

--
Michael

--
fedora-devel-list mailing list
fedora-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list
 
Old 12-04-2007, 05:06 PM
Michael E Brown
 
Default mock 0.8.9

On Tue, Dec 04, 2007 at 06:27:33PM +0200, Ville Skyttä wrote:
> On Tuesday 04 December 2007, Todd Zullinger wrote:
> > Michael E Brown wrote:
> > > Patches welcome.
> >
> > Here's one. This adds a --define option, which may be used multiple
> > times. Usage is pretty much like the rpm --define option:
> >
> > $ mock --define="with_extra_cheese 1" --define="packager Monkey" ...
>
> That's nice, but even better IMHO would be something that could be used to
> pass arbitrary options (or at least -D, --define, --with, --without
> and --target) as-is to rpmbuild, for example everything after a "--", like
>
> mock rebuild foo.src.rpm -- --define="foo bar" --target=i686 --with
> foo --without bar --define 'quux baz'

--target is already passed to rpmbuild. Its value depends on
"target_arch" setting in the chroot config file.

file:///usr/share/doc/rpm-4.4.2.2/conditionalbuilds
=====================================
For example, when rpm is invoked as
verbatim
rpm ... --with ldap ...
endverbatim
then the popt aliases will cause the options to be rewritten as
verbatim
rpm ... --define "_with_ldap --with-ldap" ...
endverbatim
which causes a "%_with_ldap" macro to be defined with value
"--with-ldap"
during a build.
=====================================

So, we could probably easily implement --with{,out} using this code as a
base.

--
Michael

--
fedora-devel-list mailing list
fedora-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list
 
Old 12-04-2007, 09:59 PM
Todd Zullinger
 
Default mock 0.8.9

Michael E Brown wrote:
> On Tue, Dec 04, 2007 at 06:27:33PM +0200, Ville Skyttä wrote:
>> That's nice, but even better IMHO would be something that could be
>> used to pass arbitrary options (or at least -D, --define, --with,
>> --without and --target) as-is to rpmbuild, for example everything
>> after a "--", like

More! More!. Damn user demands. (Just kidding, of course Ville.

> So, we could probably easily implement --with{,out} using this code
> as a base.

Okay, here's another set of patches to implement --with{,out} options.
I used git-format-patch this time, and probably did it awkwardly. But
hopefully not too badly. Just in case (and for non-git users), I'll
also attach a single diff that should apply cleanly to mock-0.8.14.

Comments and improvements welcome.

--
Todd OpenPGP -> KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~
Play "wheels on the bus" and get the hell out of my sight.
-- Stewie Griffin

From 153cdbd620cffaebddfceb747c66d727270b1313 Mon Sep 17 00:00:00 2001
From: Todd Zullinger <tmz@pobox.com>
Date: Mon, 3 Dec 2007 20:58:03 -0500
Subject: [PATCH] add --define option to pass rpm macros on the command line

---
docs/mock.1 | 5 +++++
py/mock.py | 14 ++++++++++++++
2 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/docs/mock.1 b/docs/mock.1
index 3adc047..ca212b5 100644
--- a/docs/mock.1
+++ b/docs/mock.1
@@ -56,6 +56,11 @@ Dont clean chroot after building. If automatic cleanup is enabled, use this to d
fB--arch=fRfIARCHfP
Specify target build arch.
.TP
+fB--define=fR"fINAME VALUEfP"
+Specify macro definitions used for the build. This option may be used multiple times, just as the rpmbuild --define option can be. For example:
+
+fB--define="vendor Not Fedora" --define="packager Some guy"fR
+.TP
fB--resultdir=fRfIRESULTDIRfP
Change directory where resulting files (RPMs and build logs) are written. Resultdir can contain python-string substitutions for any variable in the chroot config. For example:

diff --git a/py/mock.py b/py/mock.py
index bb5df8c..490c77e 100755
--- a/py/mock.py
+++ b/py/mock.py
@@ -104,6 +104,9 @@ def command_parse(config_opts):
" cleanup is enabled, use this to disable.", )
parser.add_option("--arch", action ="store", dest="arch",
default=None, help="target build arch")
+ parser.add_option("--define", action="append", dest="rpmmacros",
+ default=[], type="string", metavar="'NAME VALUE'",
+ help="define an rpm macro (may be used more than once)")
parser.add_option("--resultdir", action="store", type="string",
default=None, help="path for resulting files to be put")
parser.add_option("--uniqueext", action="store", type="string",
@@ -222,6 +225,17 @@ def set_config_opts_per_cmdline(config_opts, options):
if not options.clean:
config_opts['clean'] = options.clean

+ for macro in options.rpmmacros:
+ try:
+ k, v = macro.split(" ", 1)
+ if not k.startswith('%'):
+ k = '%%%s' % k
+ config_opts['macros'].update({k: v})
+ except:
+ raise mock.exception.BadCmdline(
+ "Bad option for '--define' (%s). Use --define 'name value'"
+ % macro)
+
if options.resultdir:
config_opts['resultdir'] = os.path.expanduser(options.resultdir)
if options.uniqueext:
--
1.5.3.6

From 875080a4ea11b7e46c9aa8a378d490d7156ca8c9 Mon Sep 17 00:00:00 2001
From: Todd Zullinger <tmz@pobox.com>
Date: Tue, 4 Dec 2007 05:28:13 -0500
Subject: [PATCH] use 'MACRO EXPR' in --define docs to match the rpmbuild docs

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

diff --git a/docs/mock.1 b/docs/mock.1
index ca212b5..17b5081 100644
--- a/docs/mock.1
+++ b/docs/mock.1
@@ -56,10 +56,10 @@ Dont clean chroot after building. If automatic cleanup is enabled, use this to d
fB--arch=fRfIARCHfP
Specify target build arch.
.TP
-fB--define=fR"fINAME VALUEfP"
+fB--define=fR"fIMACRO EXPRfP"
Specify macro definitions used for the build. This option may be used multiple times, just as the rpmbuild --define option can be. For example:

-fB--define="vendor Not Fedora" --define="packager Some guy"fR
+fB--define="with_extra_cheese 1" --define="packager Monkey"fR
.TP
fB--resultdir=fRfIRESULTDIRfP
Change directory where resulting files (RPMs and build logs) are written. Resultdir can contain python-string substitutions for any variable in the chroot config. For example:
diff --git a/py/mock.py b/py/mock.py
index 490c77e..b78d37a 100755
--- a/py/mock.py
+++ b/py/mock.py
@@ -105,7 +105,7 @@ def command_parse(config_opts):
parser.add_option("--arch", action ="store", dest="arch",
default=None, help="target build arch")
parser.add_option("--define", action="append", dest="rpmmacros",
- default=[], type="string", metavar="'NAME VALUE'",
+ default=[], type="string", metavar="'MACRO EXPR'",
help="define an rpm macro (may be used more than once)")
parser.add_option("--resultdir", action="store", type="string",
default=None, help="path for resulting files to be put")
@@ -233,7 +233,7 @@ def set_config_opts_per_cmdline(config_opts, options):
config_opts['macros'].update({k: v})
except:
raise mock.exception.BadCmdline(
- "Bad option for '--define' (%s). Use --define 'name value'"
+ "Bad option for '--define' (%s). Use --define 'macro expr'"
% macro)

if options.resultdir:
--
1.5.3.6

From 6157b70e994c9325c96d47f55b52607003466c3b Mon Sep 17 00:00:00 2001
From: Todd Zullinger <tmz@pobox.com>
Date: Tue, 4 Dec 2007 15:38:24 -0500
Subject: [PATCH] add --with and --without options to enable/disable options in a srpm

---
docs/mock.1 | 12 +++++++++++-
py/mock.py | 12 ++++++++++++
2 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/docs/mock.1 b/docs/mock.1
index 17b5081..28c2629 100644
--- a/docs/mock.1
+++ b/docs/mock.1
@@ -59,7 +59,17 @@ Specify target build arch.
fB--define=fR"fIMACRO EXPRfP"
Specify macro definitions used for the build. This option may be used multiple times, just as the rpmbuild --define option can be. For example:

-fB--define="with_extra_cheese 1" --define="packager Monkey"fR
+fB--define "with_extra_cheese 1" --define="packager Monkey"fR
+.TP
+fB--with=fRfIOPTIONfP
+Enable configure OPTION for build. This option may be used multiple times. For example:
+
+fB--with extra_cheesefR
+.TP
+fB--without=fRfIOPTIONfP
+Disable configure OPTION for build. This option may be used multiple times. For example:
+
+fB--without anchoviesfR
.TP
fB--resultdir=fRfIRESULTDIRfP
Change directory where resulting files (RPMs and build logs) are written. Resultdir can contain python-string substitutions for any variable in the chroot config. For example:
diff --git a/py/mock.py b/py/mock.py
index b78d37a..a4cefa7 100755
--- a/py/mock.py
+++ b/py/mock.py
@@ -107,6 +107,12 @@ def command_parse(config_opts):
parser.add_option("--define", action="append", dest="rpmmacros",
default=[], type="string", metavar="'MACRO EXPR'",
help="define an rpm macro (may be used more than once)")
+ parser.add_option("--with", action="append", dest="rpmwith",
+ default=[], type="string", metavar="option",
+ help="enable configure option for build (may be used more than once)")
+ parser.add_option("--without", action="append", dest="rpmwithout",
+ default=[], type="string", metavar="option",
+ help="disable configure option for build (may be used more than once)")
parser.add_option("--resultdir", action="store", type="string",
default=None, help="path for resulting files to be put")
parser.add_option("--uniqueext", action="store", type="string",
@@ -225,6 +231,12 @@ def set_config_opts_per_cmdline(config_opts, options):
if not options.clean:
config_opts['clean'] = options.clean

+ for option in options.rpmwith:
+ options.rpmmacros.append("_with_%s 1" % option)
+
+ for option in options.rpmwithout:
+ options.rpmmacros.append("_with_%s 0" % option)
+
for macro in options.rpmmacros:
try:
k, v = macro.split(" ", 1)
--
1.5.3.6

diff --git a/docs/mock.1 b/docs/mock.1
index 3adc047..28c2629 100644
--- a/docs/mock.1
+++ b/docs/mock.1
@@ -56,6 +56,21 @@ Dont clean chroot after building. If automatic cleanup is enabled, use this to d
fB--arch=fRfIARCHfP
Specify target build arch.
.TP
+fB--define=fR"fIMACRO EXPRfP"
+Specify macro definitions used for the build. This option may be used multiple times, just as the rpmbuild --define option can be. For example:
+
+fB--define "with_extra_cheese 1" --define="packager Monkey"fR
+.TP
+fB--with=fRfIOPTIONfP
+Enable configure OPTION for build. This option may be used multiple times. For example:
+
+fB--with extra_cheesefR
+.TP
+fB--without=fRfIOPTIONfP
+Disable configure OPTION for build. This option may be used multiple times. For example:
+
+fB--without anchoviesfR
+.TP
fB--resultdir=fRfIRESULTDIRfP
Change directory where resulting files (RPMs and build logs) are written. Resultdir can contain python-string substitutions for any variable in the chroot config. For example:

diff --git a/py/mock.py b/py/mock.py
index cb558e0..0fbb1fc 100755
--- a/py/mock.py
+++ b/py/mock.py
@@ -103,6 +103,15 @@ def command_parse(config_opts):
" cleanup is enabled, use this to disable.", )
parser.add_option("--arch", action ="store", dest="arch",
default=None, help="target build arch")
+ parser.add_option("--define", action="append", dest="rpmmacros",
+ default=[], type="string", metavar="'MACRO EXPR'",
+ help="define an rpm macro (may be used more than once)")
+ parser.add_option("--with", action="append", dest="rpmwith",
+ default=[], type="string", metavar="option",
+ help="enable configure option for build (may be used more than once)")
+ parser.add_option("--without", action="append", dest="rpmwithout",
+ default=[], type="string", metavar="option",
+ help="disable configure option for build (may be used more than once)")
parser.add_option("--resultdir", action="store", type="string",
default=None, help="path for resulting files to be put")
parser.add_option("--uniqueext", action="store", type="string",
@@ -221,6 +230,23 @@ def set_config_opts_per_cmdline(config_opts, options):
if not options.clean:
config_opts['clean'] = options.clean

+ for option in options.rpmwith:
+ options.rpmmacros.append("_with_%s 1" % option)
+
+ for option in options.rpmwithout:
+ options.rpmmacros.append("_with_%s 0" % option)
+
+ for macro in options.rpmmacros:
+ try:
+ k, v = macro.split(" ", 1)
+ if not k.startswith('%'):
+ k = '%%%s' % k
+ config_opts['macros'].update({k: v})
+ except:
+ raise mock.exception.BadCmdline(
+ "Bad option for '--define' (%s). Use --define 'macro expr'"
+ % macro)
+
if options.resultdir:
config_opts['resultdir'] = os.path.expanduser(options.resultdir)
if options.uniqueext:
--
fedora-devel-list mailing list
fedora-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list
 
Old 12-04-2007, 11:41 PM
Michael E Brown
 
Default mock 0.8.9

On Tue, Dec 04, 2007 at 04:59:07PM -0500, Todd Zullinger wrote:
> Okay, here's another set of patches to implement --with{,out} options.
> I used git-format-patch this time, and probably did it awkwardly. But
> hopefully not too badly. Just in case (and for non-git users), I'll
> also attach a single diff that should apply cleanly to mock-0.8.14.
>
> Comments and improvements welcome.

This looks great to me. I've committed this to the repo.
--
Michael

--
fedora-devel-list mailing list
fedora-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list
 
Old 12-05-2007, 01:32 AM
"Paulo Cavalcanti"
 
Default mock 0.8.9

On Dec 4, 2007 9:41 PM, Michael E Brown <Michael_E_Brown@dell.com> wrote:

On Tue, Dec 04, 2007 at 04:59:07PM -0500, Todd Zullinger wrote:
> Okay, here's another set of patches to implement --with{,out} options.
> I used git-format-patch this time, and probably did it awkwardly. *But

> hopefully not too badly. *Just in case (and for non-git users), I'll
> also attach a single diff that should apply cleanly to mock-0.8.14.
>
> Comments and improvements welcome.


This looks great to me. I've committed this to the repo.

It is working for me.* I tried --with and --without.

This will make my buildings a lot easier.

Thanks.


--
Paulo Roma Cavalcanti
LCG - UFRJ
--
fedora-devel-list mailing list
fedora-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list
 
Old 12-05-2007, 09:45 PM
Ville Skyttä
 
Default mock 0.8.9

On Wednesday 05 December 2007, Michael E Brown wrote:
> On Tue, Dec 04, 2007 at 04:59:07PM -0500, Todd Zullinger wrote:
> > Okay, here's another set of patches to implement --with{,out} options.
> > I used git-format-patch this time, and probably did it awkwardly. But
> > hopefully not too badly. Just in case (and for non-git users), I'll
> > also attach a single diff that should apply cleanly to mock-0.8.14.
> >
> > Comments and improvements welcome.
>
> This looks great to me. I've committed this to the repo.

Thanks, guys! When there's a mock release out with these changes (assuming
they work ), I think mock has finally caught up with essential features in
mach and I'm ready to start using mock.

--
fedora-devel-list mailing list
fedora-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list
 
Old 12-05-2007, 09:55 PM
Todd Zullinger
 
Default mock 0.8.9

Ville Skyttä wrote:
> Thanks, guys! When there's a mock release out with these changes
> (assuming they work ), I think mock has finally caught up with
> essential features in mach and I'm ready to start using mock.

They'll be in 0.8.15, which I believe Michael plans to release
sometime next week. Yell at me if the define/with options don't work.

--
Todd OpenPGP -> KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~
Why does a slight tax increase cost you two hundred dollars and a
substantial tax cut save you thirty cents?
-- Peg Bracken

--
fedora-devel-list mailing list
fedora-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list
 
Old 12-05-2007, 09:56 PM
"Paulo Cavalcanti"
 
Default mock 0.8.9

On Dec 5, 2007 7:45 PM, Ville Skyttä <ville.skytta@iki.fi> wrote:

On Wednesday 05 December 2007, Michael E Brown wrote:
> On Tue, Dec 04, 2007 at 04:59:07PM -0500, Todd Zullinger wrote:
> > Okay, here's another set of patches to implement --with{,out} options.

> > I used git-format-patch this time, and probably did it awkwardly. *But
> > hopefully not too badly. *Just in case (and for non-git users), I'll
> > also attach a single diff that should apply cleanly to
mock-0.8.14.
> >
> > Comments and improvements welcome.
>
> This looks great to me. I've committed this to the repo.

Thanks, guys! *When there's a mock release out with these changes (assuming

they work ), I think mock has finally caught up with essential features in
mach and I'm ready to start using mock.



The only issue* I have so far is during init:


mock -r fedora-7-i386 init

INFO: mock.py version 0.8.14 starting...
State Changed: init plugins
State Changed: start

State Changed: lock buildroot
State Changed: clean
State Changed: init
State Changed: lock buildroot
INFO: enabled yum cache
State Changed: cleaning yum metadata
INFO: enabled root cache
State Changed: running yum

ERROR: Command failed. See logs for output.
*# mount -n --bind /home/mock/cache/fedora-7-i386/yum_cache/* /home/mock/fedora-7-i386/root/var/cache/yum

*But if the chroot is already initialized by a previous mock version, them everything goes fine.


I have an updated mock rpm if anyone else is willing to try it.


--
Paulo Roma Cavalcanti
LCG - UFRJ
--
fedora-devel-list mailing list
fedora-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list
 
Old 12-07-2007, 07:04 AM
Michael E Brown
 
Default mock 0.8.9

On Wed, Dec 05, 2007 at 07:56:11PM -0200, Paulo Cavalcanti wrote:
> On Dec 5, 2007 7:45 PM, Ville Skyttä <ville.skytta@iki.fi> wrote:
>
> > On Wednesday 05 December 2007, Michael E Brown wrote:
> > > On Tue, Dec 04, 2007 at 04:59:07PM -0500, Todd Zullinger wrote:
> > > > Okay, here's another set of patches to implement --with{,out} options.
> > > > I used git-format-patch this time, and probably did it awkwardly. But
> > > > hopefully not too badly. Just in case (and for non-git users), I'll
> > > > also attach a single diff that should apply cleanly to mock-0.8.14.
> > > >
> > > > Comments and improvements welcome.
> > >
> > > This looks great to me. I've committed this to the repo.
> >
> > Thanks, guys! When there's a mock release out with these changes
> > (assuming
> > they work ), I think mock has finally caught up with essential features
> > in
> > mach and I'm ready to start using mock.
> >
> > <https://www.redhat.com/mailman/listinfo/fedora-devel-list>
> >
>
> The only issue I have so far is during init:
>
>
> mock -r fedora-7-i386 init
>
> INFO: mock.py version 0.8.14 starting...
> State Changed: init plugins
> State Changed: start
> State Changed: lock buildroot
> State Changed: clean
> State Changed: init
> State Changed: lock buildroot
> INFO: enabled yum cache
> State Changed: cleaning yum metadata
> INFO: enabled root cache
> State Changed: running yum
> ERROR: Command failed. See logs for output.
> # mount -n --bind /home/mock/cache/fedora-7-i386/yum_cache/
> /home/mock/fedora-7-i386/root/var/cache/yum
>
> But if the chroot is already initialized by a previous mock version, them
> everything goes fine.
>
> I have an updated mock rpm if anyone else is willing to try it.

Mock 0.8.15 is in updates-stable now and has a fix for this problem.
--
Michael

--
fedora-devel-list mailing list
fedora-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list
 
Old 12-07-2007, 07:58 AM
"Paulo Cavalcanti"
 
Default mock 0.8.9

On Dec 7, 2007 5:04 AM, Michael E Brown <Michael_E_Brown@dell.com> wrote:

On Wed, Dec 05, 2007 at 07:56:11PM -0200, Paulo Cavalcanti wrote:
> On Dec 5, 2007 7:45 PM, Ville Skyttä <ville.skytta@iki.fi> wrote:
>
> > On Wednesday 05 December 2007, Michael E Brown wrote:

> > > On Tue, Dec 04, 2007 at 04:59:07PM -0500, Todd Zullinger wrote:
> > > > Okay, here's another set of patches to implement --with{,out} options.
> > > > I used git-format-patch this time, and probably did it awkwardly. *But

> > > > hopefully not too badly. *Just in case (and for non-git users), I'll
> > > > also attach a single diff that should apply cleanly to mock-0.8.14.
> > > >
> > > > Comments and improvements welcome.

> > >
> > > This looks great to me. I've committed this to the repo.
> >
> > Thanks, guys! *When there's a mock release out with these changes
> > (assuming
> > they work ), I think mock has finally caught up with essential features

> > in
> > mach and I'm ready to start using mock.
> >
> > <https://www.redhat.com/mailman/listinfo/fedora-devel-list
>
> >
>
> The only issue *I have so far is during init:
>
>
> mock -r fedora-7-i386 init
>
> INFO: mock.py version 0.8.14 starting...

> State Changed: init plugins
> State Changed: start
> State Changed: lock buildroot
> State Changed: clean
> State Changed: init
> State Changed: lock buildroot
> INFO: enabled yum cache

> State Changed: cleaning yum metadata
> INFO: enabled root cache
> State Changed: running yum
> ERROR: Command failed. See logs for output.
> *# mount -n --bind /home/mock/cache/fedora-7-i386/yum_cache/

> /home/mock/fedora-7-i386/root/var/cache/yum
>
> *But if the chroot is already initialized by a previous mock version, them
> everything goes fine.
>
> I have an updated mock rpm if anyone else is willing to try it.


Mock 0.8.15 is in updates-stable now and has a fix for this problem.

Thanks!

I installed* mock 0.8.15 yesterday and I did not see any problem yet.
This version seems to be very good.


--
Paulo Roma Cavalcanti
LCG - UFRJ
--
fedora-devel-list mailing list
fedora-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list
 

Thread Tools




All times are GMT. The time now is 01:20 PM.

VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org