List Info

Thread: Refactoring BuildRoot:and %clean out of spec files




Refactoring BuildRoot:and %clean out of spec files
user name
2006-08-19 17:14:00
Since I have more development time for rpm-4.4.7 while
waiting for  
Berkeley DB,
I'm going to refactor all the BuildRoot: code so that the
value is  
set per-buildsystem,
not per-package or per-invocation.

The attached patch achieves most everything necessary to
enforce  
mandatory
BuildRoot: by setting a default value for %.

Simple, isn't it? You'ld think the package monkeys would
have  
figgered out
how to set % years ago.

There's more to do to refactor %clean out of spec files, my
next patch.

I shall probably also implement a general mechanism for
macros to  
become immutable (and thereby
effectively readonly) at appropriately chosen point in
configuring  
macros.

Matthias: You're welcome, I'm just a lazy schmuck. 

73 de Jeff

Index: macros.in
============================================================
=======
RCS file: /cvs/devel/rpm/macros.in,v
retrieving revision 1.154.2.43
diff -u -b -B -w -p -r1.154.2.43 macros.in
--- macros.in   30 Jul 2006 16:24:11 -0000      1.154.2.43
+++ macros.in   19 Aug 2006 17:04:42 -0000
 -228,7
+228,7  package or when debugging this package.\
#      Configurable build root path, same as BuildRoot: in a
specfile.
#      (Note: the configured macro value will override the
spec file  
value).
#
-#%buildroot
+%buildroot             %/%-root
#      The sub-directory (relative to %) where
sources are  
compiled.
#      This macro is set after processing %setup, either
explicitly  
from the

_______________________________________________
Rpm-devel mailing list
Rpm-devellists.dulug.duke.edu
https://lists.dulug.duke.edu/mailman/listinfo/rpm-devel
Refactoring BuildRoot:and %clean out of spec files
user name
2006-08-19 18:56:45
On August 19, 2006 1:14:00 PM -0400 Jeff Johnson
<n3npqmac.com> wrote:
> The attached patch achieves most everything necessary
to enforce  mandatory
> BuildRoot: by setting a default value for %.

yay.

> There's more to do to refactor %clean out of spec
files, my next patch.

PLEASE make the default more than 'rm -rf
$RPM_BUILD_ROOT'.  I'm using

cd /
rm -rf $RPM_BUILD_ROOT
rm -rf $RPM_BUILD_DIR/%

> I shall probably also implement a general mechanism for
macros to  become immutable (and thereby
> effectively readonly) at appropriately chosen point in
configuring  macros.

cool.  My personal desire is to have %buildroot and %clean
be non-immutable.

-frank
_______________________________________________
Rpm-devel mailing list
Rpm-devellists.dulug.duke.edu
https://lists.dulug.duke.edu/mailman/listinfo/rpm-devel
Refactoring BuildRoot:and %clean out of spec files
user name
2006-08-20 19:38:06
On Aug 19, 2006, at 1:14 PM, Jeff Johnson wrote:

>
> I shall probably also implement a general mechanism for
macros to  
> become immutable (and thereby
> effectively readonly) at appropriately chosen point in
configuring  
> macros.
>

The attached patch adds the ability to mark a macro as
unchangeable,  
i.e. cannot be redefined.

Basically here's the behavior for a macro defined with a
leading '.':

	$ rpm -D '.bing bang' -D 'bing boom' -E '%'
	error: Macro 'bing' is readonly and cannot be changed.
	error: Macro 'bing' is readonly and cannot be changed.
	bang

The behavior will be used internally to rpmbuild to insure
that the  
1st, not the last, definition
of %buildroot is what is used during the build. That
captures one of  
the two speshul
differences for the %buildroot macro (the other speshul
difference is  
checking that '/' and
all possible aliases for '/' like /.././.../ are
forbidden, not that  
a build host can't be totalled by, say,
	%define buildroot	/lib
but somehow noone seems to care about /lib. <shrug>).

Next patch will teach rpmbuild to define %.buildroot.

73 de Jeff
_______________________________________________
Rpm-devel mailing list
Rpm-devellists.dulug.duke.edu
https://lists.dulug.duke.edu/mailman/listinfo/rpm-devel
Refactoring BuildRoot:and %clean out of spec files
user name
2006-08-20 22:08:17
On Aug 19, 2006, at 1:14 PM, Jeff Johnson wrote:

>
> There's more to do to refactor %clean out of spec
files, my next  
> patch.
>

The attached patch accomplishes refactoring BuildRoot: and
%clean
out of spec files into rpmbuild
configuration/implementation.

The existing fields in spec files are parsed and ignored.

There's a few more things to do, i.e. wiring a better check
for sane % 
buildroot
configured, and using macros instead of hard-wiring
	rm -rf %
at beginning of %install/%clean bodies using macros. Easy
stuff.

Time to let the bits compost and ripen a bit, but I see no
reason  
whatsoever
not to force BuildRoot: and %clean out of spec files
forevermore.

73 de Jeff
_______________________________________________
Rpm-devel mailing list
Rpm-devellists.dulug.duke.edu
https://lists.dulug.duke.edu/mailman/listinfo/rpm-devel
Refactoring BuildRoot:and %clean out of spec files
user name
2006-08-21 18:46:52
Jeff Johnson wrote :

> Matthias: You're welcome, I'm just a lazy schmuck.


Thanks :-D

Matthias

-- 
Clean custom Red Hat Linux rpm packages : http://freshrpms.net/
Fedora Core release 5.91 (FC6 Test2) - Linux kernel
2.6.17-1.2532.fc6
Load : 0.69 0.78 1.07
_______________________________________________
Rpm-devel mailing list
Rpm-devellists.dulug.duke.edu
https://lists.dulug.duke.edu/mailman/listinfo/rpm-devel
Refactoring BuildRoot:and %clean out of spec files
user name
2006-08-21 20:58:37
On Sunday, 20 August 2006, at 18:08:17 (-0400),
Jeff Johnson wrote:

> Time to let the bits compost and ripen a bit, but I see
no reason
> whatsoever not to force BuildRoot: and %clean out of
spec files
> forevermore.

Will the --buildroot option be removed as well?

Michael

-- 
Michael Jennings (a.k.a. KainX)  http://www.kainx.org/ 
<mejkainx.org>
n + 1, Inc., http://www.nplus1.net/    
  Author, Eterm (www.eterm.org)
------------------------------------------------------------
-----------
 "So here we are face to face and heart to heart.  I
want you to know
  we will never be apart.  Now I believe that wishes can
come true
  'cause I see my whole world; I see only you.  When I look
into your
  eyes, I can see how much I love you, and it makes me
realize."
                            -- Firehouse, "When I Look
into Your Eyes"
_______________________________________________
Rpm-devel mailing list
Rpm-devellists.dulug.duke.edu
https://lists.dulug.duke.edu/mailman/listinfo/rpm-devel
Refactoring BuildRoot:and %clean out of spec files
user name
2006-08-21 21:31:04
On Aug 21, 2006, at 4:58 PM, Michael Jennings wrote:

> On Sunday, 20 August 2006, at 18:08:17 (-0400),
> Jeff Johnson wrote:
>
>> Time to let the bits compost and ripen a bit, but I
see no reason
>> whatsoever not to force BuildRoot: and %clean out
of spec files
>> forevermore.
>
> Will the --buildroot option be removed as well?
>

Technically yes, but noone really distinguishes between
options and  
popt aliases:

Index: rpmpopt.in
============================================================
=======
RCS file: /cvs/devel/rpm/rpmpopt.in,v
retrieving revision 2.39.2.12
diff -u -b -B -w -p -r2.39.2.12 rpmpopt.in
--- rpmpopt.in  7 May 2006 00:25:37 -0000       2.39.2.12
+++ rpmpopt.in  20 Aug 2006 21:51:56 -0000
 -285,6
+285,9  rpmbuild alias --with               --define  
"_with_!
rpmbuild alias --without       --define "_without_!#:+
 --without-!#: 
+" \
         --POPTdesc=$"disable configure <option>
for build" \
         --POPTargs=$"<option>"
+rpmbuild alias --buildroot     --define '.buildroot !#:+'
\
+       --POPTdesc=$"override build root" \
+       --POPTargs=$"DIRECTORY"
#===========================================================
============ 
=======
rpmd   alias --dbpath          --define '_dbpath !#:+' \
         --POPTdesc=$"use database in DIRECTORY"
\

73 de Jeff
_______________________________________________
Rpm-devel mailing list
Rpm-devellists.dulug.duke.edu
https://lists.dulug.duke.edu/mailman/listinfo/rpm-devel
Refactoring BuildRoot:and %clean out of spec files
user name
2006-08-21 23:27:29
On Monday, 21 August 2006, at 17:31:04 (-0400),
Jeff Johnson wrote:

> Technically yes, but noone really distinguishes between
options and
> popt aliases:

Right, I was just verifying that the buildroot will still be
modifiable on the command line once it's immutable in spec
files. 

Thanks,
Michael

-- 
Michael Jennings (a.k.a. KainX)  http://www.kainx.org/ 
<mejkainx.org>
n + 1, Inc., http://www.nplus1.net/    
  Author, Eterm (www.eterm.org)
------------------------------------------------------------
-----------
 "We cannot offer you a position at this time, but you
are obviously
  qualified.  Unfortunately, the other six billion people on
Earth
  are more qualified."         -- Dogbert, from the
"Dilbert" cartoons
_______________________________________________
Rpm-devel mailing list
Rpm-devellists.dulug.duke.edu
https://lists.dulug.duke.edu/mailman/listinfo/rpm-devel
[1-8]

about | contact  Other archives ( Real Estate discussion Medical topics )