ALT Linux Bugzilla
– Attachment 4194 Details for
Bug 22709
[FR][PATCH] add pruned BRs as a comment
New bug
|
Search
|
[?]
|
Help
Register
|
Log In
[x]
|
Forgot Password
Login:
[x]
|
EN
|
RU
[patch]
buildreq -u => # optimized out:
0001-buildreq-et-al-support-fixating-pruned-BRs-22709.patch (text/plain), 6.74 KB, created by
Michael Shigorin
on 2010-01-11 01:41:50 MSK
(
hide
)
Description:
buildreq -u => # optimized out:
Filename:
MIME Type:
Creator:
Michael Shigorin
Created:
2010-01-11 01:41:50 MSK
Size:
6.74 KB
patch
obsolete
>From da57b503a4cd0fa01f2bb01fb561a2574d1d3d00 Mon Sep 17 00:00:00 2001 >From: Michael Shigorin <mike@altlinux.org> >Date: Sun, 10 Jan 2010 23:29:40 +0200 >Subject: [PATCH] buildreq et al: support fixating pruned BRs (#22709) > >--- > rpm-utils/buildreq | 19 ++++++++++++++++--- > rpm-utils/filter_spec | 13 +++++++++++++ > rpm-utils/packagereq | 26 ++++++++++++++++++-------- > 3 files changed, 47 insertions(+), 11 deletions(-) > >diff --git a/rpm-utils/buildreq b/rpm-utils/buildreq >index 7111f95..9045e6c 100755 >--- a/rpm-utils/buildreq >+++ b/rpm-utils/buildreq >@@ -1,6 +1,8 @@ > #!/bin/sh -e > # > # Copyright (C) 2000-2006 Dmitry V. Levin <ldv@altlinux.org> >+# Copyright (C) 2007 Alexey Tourbin <at@altlinux.ru> >+# Copyright (C) 2010 Michael Shigorin <mike@altlinux.org> > # > # Generates and adds/updates BuildRequires tag in specfiles. > # >@@ -30,6 +32,8 @@ DEFSTAGE=c > STAGE= > RPMARG="--nodeps --define '__buildreqs 1' --define '__nprocs 1'" > NEWTERM=dumb >+PRUNED= >+PRUNEDREQS= > > Info() > { >@@ -74,6 +78,7 @@ Valid options are: > -t TERM, --term=TERM redefine TERM variable; > --trace-file=FILE trace the usage of FILE; > --trace-package=PACKAGE trace the usage of PACKAGE files; >+-u, --pruned add pruned requires as a comment; > -h, --help show this text. > > Default file with list of essential packages is $ESSENTIAL. >@@ -89,7 +94,7 @@ EOF > exit > } > >-TEMP=`getopt -n $PROG -o b:e:f:i:p:r:t:h -l essential:,filereq:,ignore:,packagereq:,rpm:,args:,define:,reset-args,term:,trace-file:,trace-package:,help -- "$@"` || show_usage >+TEMP=`getopt -n $PROG -o b:e:f:i:p:r:t:uh -l essential:,filereq:,ignore:,packagereq:,rpm:,args:,define:,reset-args,term:,trace-file:,trace-package:,pruned,help -- "$@"` || show_usage > eval set -- "$TEMP" > > TRACE_FILES= >@@ -129,6 +134,8 @@ while :; do > export TRACE_PACKAGES > shift > ;; >+ -u|--pruned) PRUNED=1; shift >+ ;; > -h|--help) show_help > ;; > --) shift; break >@@ -142,12 +149,13 @@ done > [ "$#" -ge 1 ] || show_usage 'Insufficient arguments.' > > REQFILE="$(mktemp -t "$PROG.XXXXXXXXXX")" >+PRUNEDFILE="$(mktemp -t "$PROG.XXXXXXXXXX")" > > exit_handler() > { > local rc=$? > trap - EXIT >- rm -f -- "$REQFILE" >+ rm -f -- "$REQFILE" "$PRUNEDFILE" > exit $rc > } > >@@ -164,10 +172,14 @@ for SPEC in "$@"; do > else > SPEC_STAGE="$STAGE" > fi >+ if [ -z "$PRUNED" ]; then >+ grep -q '^# optimized out: ' -- "$SPEC" && PRUNED=1 >+ fi > eval \ > "$(Quote "TERM=$NEWTERM")" \ > "$(Quote "$PACKAGEREQ")" \ > -o "$(Quote "$REQFILE")" \ >+ -u "$(Quote "$PRUNEDFILE")" \ > -e "$(Quote "$ESSENTIAL")" \ > -i "$(Quote "$IGNORE")" \ > -f "$(Quote "$FILEREQ")" \ >@@ -175,7 +187,8 @@ for SPEC in "$@"; do > TMPFILE="$(mktemp -t "$PROG.XXXXXXXXXX")" > : >"$TMPFILE" > REQS="$(cat "$REQFILE" |xargs echo -n)" >- LC_ALL=C /usr/share/buildreqs/filter_spec -v "reqs=$REQS" "stage=$SPEC_STAGE" <"$SPEC" >>"$TMPFILE" >+ [ -n "$PRUNED" ] && PRUNEDREQS="$(cat "$PRUNEDFILE" |xargs echo -n)" >+ LC_ALL=C /usr/share/buildreqs/filter_spec -v "reqs=$REQS" "pruned=$PRUNEDREQS" "stage=$SPEC_STAGE" <"$SPEC" >>"$TMPFILE" > if ! cmp -s "$SPEC" "$TMPFILE"; then > cat "$TMPFILE" >"$SPEC" > fi >diff --git a/rpm-utils/filter_spec b/rpm-utils/filter_spec >index 6656158..77e66a0 100755 >--- a/rpm-utils/filter_spec >+++ b/rpm-utils/filter_spec >@@ -1,6 +1,7 @@ > #!/bin/awk -f > # > # Copyright (C) 2000, 2003 Dmitry V. Levin <ldv@altlinux.org> >+# Copyright (C) 2010 Michael Shigorin <mike@altlinux.org> > # > # Update BuildRequires. > # >@@ -33,6 +34,8 @@ function insert_reqs() > printf( "# Automatically added by buildreq on %s", strftime("%a %b %d %Y") ); > if (stage != "" && stage != "c") > printf( " (-b%s)", stage ); >+ if ( pruned != "" ) >+ printf( "\n# optimized out: %s", pruned); > printf( "\nBuildRequires: %s\n\n", reqs ); > reqs = ""; > } >@@ -48,6 +51,16 @@ function insert_reqs() > } > } > >+/^\# optimized out: .*$/{ >+ if ( !processed ) >+ { >+ insert_reqs(); >+ processed = 1; >+ found = 1; >+ skipws = 1; >+ } >+} >+ > /^BuildRequires:.*/{ > if ( !processed ) > { >diff --git a/rpm-utils/packagereq b/rpm-utils/packagereq >index 91a6217..8931b16 100755 >--- a/rpm-utils/packagereq >+++ b/rpm-utils/packagereq >@@ -1,6 +1,8 @@ > #!/bin/sh -e > # > # Copyright (C) 2000-2006 Dmitry V. Levin <ldv@altlinux.org> >+# Copyright (C) 2006-2008 Alexey Tourbin <at@altlinux.ru> >+# Copyright (C) 2010 Michael Shigorin <mike@altlinux.org> > # > # Generates list of package requires for given command. > # >@@ -60,13 +62,14 @@ packagereq comes with ABSOLUTELY NO WARRANTY, see license for details. > Usage: $PROG options <program> [program-args] > > Valid options are: >--o FILENAME, --output=FILENAME filename where to write output requires; >--e ESSENTIAL, --essential=ESSENTIAL filename where to get list of >- essential packages; >--i IGNORE, --ignore=IGNORE directory where to get list of >- packages to ignore; >--s SUBST, --substitute=SUBST directory where to get package >- name substitution rules; >+-o FILENAME, --output=FILENAME filename to write optimized requires to; >+-u FILENAME, --pruned=FILENAME filename to write pruned requires to; >+-e ESSENTIAL, --essential=ESSENTIAL filename to get list of >+ essential packages from; >+-i IGNORE, --ignore=IGNORE directory to get list of >+ packages to ignore from; >+-s SUBST, --substitute=SUBST directory to get package >+ name substitution rules from; > -p PACKAGEOF, --packageof=PACKAGEOF path to PACKAGEOF; > -f FILEREQ, --filereq=FILEREQ path to FILEREQ; > -q, --quiet be quiet; >@@ -83,13 +86,15 @@ EOF > exit > } > >-TEMP=`getopt -n $PROG -o +o:e:f:i:p:s:r:qh -l output:,essential:,filereq:,ignore:,packageof:,substitute:,rpm:,quiet,help -- "$@"` || show_usage >+TEMP=`getopt -n $PROG -o +o:u:e:f:i:p:s:r:qh -l output:,pruned:,essential:,filereq:,ignore:,packageof:,substitute:,rpm:,quiet,help -- "$@"` || show_usage > eval set -- "$TEMP" > > while :; do > case "$1" in > -o|--output) shift; OUTFILE="$1"; shift > ;; >+ -u|--pruned) shift; PRUNEDFILE="$1"; shift >+ ;; > -e|--essential) shift; ESSENTIAL="$1"; shift > ;; > -p|--packageof) shift; PACKAGEOF="$1"; shift >@@ -169,6 +174,11 @@ comm -23 "$WORKDIR/deps0" "$WORKDIR/deps1" >"$WORKDIR/optimized-out" > REQS="$(cat "$WORKDIR/deps1" |tr '\n' ' ' |sed -e 's/ \+$//')" > printf %s\\n "$REQS" >"$OUTFILE" > >+if [ -n "$PRUNEDFILE" ]; then >+ PRUNED="$(cat "$WORKDIR/optimized-out" |tr '\n' ' ' |sed -e 's/ \+$//')" >+ printf %s\\n "$PRUNED" >"$PRUNEDFILE" >+fi >+ > if [ -z "$QUIET" ]; then > if [ -s "$WORKDIR/optimized-out" ]; then > Info "optimized out:" $(cat "$WORKDIR/optimized-out") >-- >1.6.5.2 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 22709
: 4194