fedora-rpmdevtools rpmdev-checksig, NONE, 1.1 rpmdev-diff, NONE, 1.1 rpmdev-extract, NONE, 1.1 rpmdev-md5, NONE, 1.1 rpmdev-newspec, NONE, 1.1 rpmdev-rmdevelrpms, NONE, 1.1 rpmdev-setuptree, NONE, 1.1 rpmdev-vercmp, NONE, 1.1 rpmdev-wipetree, NONE, 1.1 Makefile.am, 1.6, 1.7 rmdevelrpms.conf, 1.2, 1.3 rpmdevtools.spec, 1.8, 1.9 buildrpmtree, 1.1, NONE diffarchive, 1.1, NONE extractarchive, 1.1, NONE newrpmspec, 1.3, NONE rmdevelrpms, 1.4, NONE rpmchecksig, 1.1, NONE rpmmd5, 1.1, NONE rpmvercmp, 1.1, NONE wipebuildtree, 1.1, NONE
Ville Skytta (scop)
fedora-extras-commits at redhat.com
Sun Aug 20 15:40:46 UTC 2006
- Previous message (by thread): comps comps-fe5.xml.in,1.105,1.106 comps-fe6.xml.in,1.101,1.102
- Next message (by thread): fedora-rpmdevtools/emacs rpmdev-init.el, NONE, 1.1 Makefile.am, 1.3, 1.4 rpmdevtools-init.el, 1.1, NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: scop
Update of /cvs/fedora/fedora-rpmdevtools
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv10742
Modified Files:
Makefile.am rmdevelrpms.conf rpmdevtools.spec
Added Files:
rpmdev-checksig rpmdev-diff rpmdev-extract rpmdev-md5
rpmdev-newspec rpmdev-rmdevelrpms rpmdev-setuptree
rpmdev-vercmp rpmdev-wipetree
Removed Files:
buildrpmtree diffarchive extractarchive newrpmspec rmdevelrpms
rpmchecksig rpmmd5 rpmvercmp wipebuildtree
Log Message:
Re-rename bunch of things to rpmdev-*.
--- NEW FILE rpmdev-checksig ---
#!/usr/bin/python -tt
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Library General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# Copyright 2003 Duke University
# Seth Vidal skvidal at phy.duke.edu
######
# Simple docs: run it with a list of rpms as the args
# it will tell you if any of them is damaged and if so how
# it will tell you if any of them has a bad key or invalid sig or whatever
# it exits with the largest error code possible for the set of pkgs
# error codes are:
# 0 - all fine
# 100 = damaged pkg
# 101 = unsigned pkg
# 102 = signed but bad pkg - if we ever get this one I'll be amazed
# 103 = signed - but key not in rpmdb
# 104 = signed but untrusted key
import rpm
import re
import os
import os.path
import sys
def lookupKeyID(ts, keyid):
"""looks up a key id - returns the header"""
mi = ts.dbMatch('name','gpg-pubkey')
mi.pattern('version', rpm.RPMMIRE_STRCMP, keyid)
for hdr in mi:
sum = hdr['summary']
mo = re.search('\<.*\>', sum)
email = mo.group()
return email
def checkSig(ts, package):
""" take a package, check it's sigs, return 0 if they are all fine, return
103 if the gpg key can't be found, 104 if the key is not trusted,100 if the
header is in someway damaged"""
try:
fdno = os.open(package, os.O_RDONLY)
except OSError, e:
return 100
stderr = os.dup(2)
null = os.open("/dev/null", os.O_WRONLY | os.O_APPEND)
os.dup2(null, 2)
try:
ts.hdrFromFdno(fdno)
except rpm.error, e:
if str(e) == "public key not availaiable":
error = 103
if str(e) == "public key not available":
error = 103
if str(e) == "public key not trusted":
error = 104
if str(e) == "error reading package header":
error = 100
os.dup2(stderr, 2)
os.close(null)
os.close(stderr)
os.close(fdno)
return error
os.dup2(stderr, 2)
os.close(null)
os.close(stderr)
os.close(fdno)
return 0
def returnHdr(ts, package):
"""hand back the hdr - duh - if the pkg is foobar handback None"""
try:
fdno = os.open(package, os.O_RDONLY)
except OSError, e:
hdr = None
return hdr
ts.setVSFlags(~(rpm.RPMVSF_NOMD5|rpm.RPMVSF_NEEDPAYLOAD))
try:
hdr = ts.hdrFromFdno(fdno)
except rpm.error, e:
hdr = None
if type(hdr) != rpm.hdr:
hdr = None
ts.setVSFlags(0)
os.close(fdno)
return hdr
def getSigInfo(hdr):
"""hand back signature information and an error code"""
string = '%|DSAHEADER?{%{DSAHEADER:pgpsig}}:{%|RSAHEADER?{%{RSAHEADER:pgpsig}}:{%|SIGGPG?{%{SIGGPG:pgpsig}}:{%|SIGPGP?{%{SIGPGP:pgpsig}}:{(none)}|}|}|}|'
siginfo = hdr.sprintf(string)
if siginfo != '(none)':
error = 0
sigtype, sigdate, sigid = siginfo.split(',')
else:
error = 101
sigtype = 'MD5'
sigdate = 'None'
sigid = 'None'
infotuple = (sigtype, sigdate, sigid)
return error, infotuple
def main(args):
finalexit = 0
ts = rpm.TransactionSet()
for package in args:
error = 0
sigerror = 0
ts.setVSFlags(0)
error = checkSig(ts, package)
hdr = returnHdr(ts, package)
if hdr == None:
error = 100
print '%s: FAILED - None <None>' % package
else:
sigerror, (sigtype, sigdate, sigid) = getSigInfo(hdr)
if sigid == 'None':
email = '<None>'
keyid = 'None'
else:
keyid = sigid[-8:]
email = lookupKeyID(ts, keyid)
if error != 0:
if error == 103:
print '%s: MISSING KEY - %s' % (package, keyid)
else:
print '%s: FAILED - %s %s' % (package, keyid, email)
else:
print '%s: %s - %s - %s' % (package, sigtype, keyid, email)
if error < sigerror:
error = sigerror
if error > finalexit:
finalexit = error
del hdr
sys.exit(finalexit)
if __name__ == '__main__':
main(sys.argv[1:])
--- NEW FILE rpmdev-diff ---
#!/bin/bash
# -*- coding: utf-8 -*-
# rpmdev-diff -- Diff contents of two archives
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Library General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
set -e
unset CDPATH
tmpdir=
diffopts=
list=
trap cleanup EXIT
cleanup()
{
set +e
[ -z "$tmpdir" -o ! -d "$tmpdir" ] || rm -rf "$tmpdir"
}
version()
{
cat <<EOF
rpmdev-diff version 1.0
Copyright (c) 2004-2006 Fedora Project <http://fedoraproject.org/>.
This program is licensed under the GNU General Public License, see the
file COPYING included in the distribution archive.
Written by Ville Skyttä.
EOF
}
help()
{
cat <<EOF
rpmdev-diff diffs contents of two archives.
See rpmdev-extract(1) for information about supported archive types.
EOF
usage
echo ""
echo "Report bugs to <http://bugzilla.redhat.com/>."
}
usage()
{
cat <<EOF
Usage: rpmdev-diff [OPTION]... [DIFF_OPTIONS] FROM-ARCHIVE TO-ARCHIVE
Options:
-l, --list Diff lists of files in archives, not files themselves.
-h, --help Print help message and exit.
-v, --version Print version information and exit.
diff-options Options passed to diff(1), in addition to -r (default: -Nu).
The first argument not starting with a '-' ends diff-options.
EOF
}
while true ; do
case "$1" in
-l|--list) [ -n "$list" ] && diffopts="$diffopts $1" || list=true ;;
-h|--help) help ; exit 0 ;;
-v|--version) version ; exit 0 ;;
-*) diffopts="$diffopts $1" ;;
*) break ;;
esac
shift
done
if [ $# -lt 2 ] ; then
usage
exit 1
fi
for file in "$1" "$2" ; do
if [ ! -f "$file" ] ; then
[ -e "$file" ] && \
echo "Error: not a regular file: '$file'" >&2 ||
echo "Error: file does not exist: '$file'" >&2
exit 1
fi
done
diffopts="-r ${diffopts:--Nu}"
tmpdir=`mktemp -d /tmp/rpmdev-diff.XXXXXX`
mkdir "$tmpdir/old" "$tmpdir/new"
rpmdev-extract -q -C "$tmpdir/old" "$1"
rpmdev-extract -q -C "$tmpdir/new" "$2"
# It would be nice if rpmdev-extract could do some of the chmods.
find "$tmpdir"/* -type d -exec chmod u+rx {} ';' # Note: -exec, not xargs here.
chmod -R u+rw "$tmpdir"/*
cd "$tmpdir"
# Did the archives uncompress into base dirs?
if [ `ls -1d old/* | wc -l` -eq 1 ] ; then
old=`ls -1d old/*`
else
old=old
fi
if [ `ls -1d new/* | wc -l` -eq 1 ] ; then
new=`ls -1d new/*`
else
new=new
fi
# Fixup base dirs to the same level.
if [ `basename "$old"` != `basename "$new"` ] ; then
if [ "$old" != old ] ; then
mv "$old" .
old=`basename "$old"`
fi
if [ "$new" != new ] ; then
mv "$new" .
new=`basename "$new"`
fi
fi
# Here we go.
if [ -n "$list" ] ; then
find "$old" | sort | cut -d/ -f 2- -s > "$old.files"
find "$new" | sort | cut -d/ -f 2- -s > "$new.files"
diff $diffopts "$old.files" "$new.files"
else
diff $diffopts "$old" "$new"
fi
--- NEW FILE rpmdev-extract ---
#!/bin/bash
# -*- coding: utf-8 -*-
# rpmdev-extract -- Extract various archives in "tar xvf" style
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Library General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# TODO: more archive types
set -e
unset CDPATH
ftype=
decomp=
quiet=
force=
dir=
version()
{
cat <<EOF
rpmdev-extract version 1.0
Copyright (c) 2004-2006 Fedora Project <http://fedoraproject.org/>.
This program is licensed under the GNU General Public License, see the
file COPYING included in the distribution archive.
Written by Ville Skyttä.
EOF
}
help()
{
cat <<EOF
rpmdev-extract extracts various archives in "tar xvf" style.
Depending on availability of external (un)archiver programs, the following
archive types are supported: ace, ar/deb, arj, cab/exe, cpio, lha, rar, rpm,
tar, zip/jar, zoo.
EOF
usage
echo ""
echo "Report bugs to <http://bugzilla.redhat.com/>."
}
usage()
{
cat <<EOF
Usage: rpmdev-extract [OPTION]... ARCHIVE...
Options:
-q Suppress output.
-f Force overwriting existing files.
-C DIR Change to directory DIR before extracting.
-h Print help message and exit.
-v Print version information and exit.
EOF
}
fmime()
{
case "$1" in
application/x-zip|application/zip) ftype=zip ;;
application/x-tar*) ftype=tar ;;
application/x-rpm) ftype=rpm ;;
application/x-archive|application/x-debian-package) ftype=ar ;;
application/x-arj) ftype=arj ;;
application/x-zoo) ftype=zoo ;;
application/x-lha*) ftype=lha ;;
application/x-rar) ftype=rar ;;
esac
}
ftype()
{
t=`file -ibL "$1" 2>/dev/null`
fmime "$t"
[ -n "$ftype" ] && return
case "$t" in
application/x-compress|application/x-gzip) decomp="gzip -dc" ;;
application/x-bzip2) decomp="bzip2 -dc" ;;
esac
if [ -n "$decomp" ] ; then
t=`file -zibL "$1" 2>/dev/null`
fmime "$t"
[ -n "$ftype" ] && return
fi
t=`file -${decomp:+z}bL "$1" 2>/dev/null`
case "$t" in
*Z[iI][pP]\ *archive*) ftype=zip ;;
*tar\ archive*) ftype=tar ;;
*ar\ archive*|*Debian\ *package*) ftype=ar ;;
*ARJ\ *archive*) ftype=arj ;;
*Zoo\ *archive*) ftype=zoo ;;
*cpio\ archive*) ftype=cpio ;;
*C[aA][bB]*archive*) ftype=cab ;;
RPM\ *) ftype=rpm ;;
*ACE\ *archive*) ftype=ace ;;
*LHa\ *archive*) ftype=lha ;;
*RAR\ *archive*) ftype=rar ;;
esac
}
unarch()
{
case "$1" in
/*) f="$1" ;;
*) f="$PWD/$1" ;;
esac
ftype "$1"
cd "$2"
case "$ftype" in
tar)
[ -n "$force" ] && o= || o=k
${decomp:-cat} "$f" | tar xv$o
;;
zip)
[ -n "$force" ] && o=-o || o=-n
unzip $o "$f"
;;
rar)
[ -n "$force" ] && o=+ || o=-
unrar x -o$o -y "$f"
;;
cab)
# force not supported, it's always on (as of cabextract 1.[01])
cabextract -f "$f"
;;
rpm)
name=`rpm -qp --qf "%{NAME}-%{VERSION}-%{RELEASE}" "$f"`
mkdir -p "$name"
cd "$name"
rpm2cpio "$f" \
| cpio --quiet --no-absolute-filenames -id${force:+u}mv 2>&1 \
| sed "s|^\(\./\)\?|$name/|"
cd ..
;;
cpio)
${decomp:-cat} "$f" | \
cpio --quiet --no-absolute-filenames -id${force:+u}mv
;;
ar)
# force not supported, it's always on
ar xvo "$f"
;;
ace)
[ -n "$force" ] && o=+ || o=-
unace x -o$o -y "$f"
;;
arj)
# force not supported, it's always off (as of unarj 2.6[35])
# it will also return an error if some files already exist :(
unarj x "$f"
;;
zoo)
zoo x${force:+OOS} "$f"
;;
lha)
lha x${force:+f} "$f" < /dev/null
;;
*)
echo "Error: unrecognized archive: '$f'" >&2
exit 1
;;
esac
cd - >/dev/null 2>&1
}
dir="$PWD"
while getopts "qfC:hv" key ; do
case "$key" in
q) quiet=1 ;;
f) force=1 ;;
C) dir="$OPTARG" ;;
h) help ; exit 0 ;;
v) version ; exit 0 ;;
*) usage ; exit 1 ;;
esac
done
shift $(( $OPTIND -1 ))
if [ ! -d "$dir" ] ; then
[ -e "$dir" ] && \
echo "Error: not a directory: '$dir'" >&2 ||
echo "Error: directory does not exist: '$dir'" >&2
exit 1
fi
for file in "$@" ; do
if [ ! -f "$file" ] ; then
[ -e "$file" ] && \
echo "Error: not a regular file: '$file'" >&2 ||
echo "Error: file does not exist: '$file'" >&2
exit 1
fi
# Not that fancy at the moment, but -q is for backwards compatibility
# and in case we need to do more fine-grained stuff for some unarchivers
# later.
if [ -n "$quiet" ] ; then
unarch "$file" "$dir" >/dev/null
else
unarch "$file" "$dir"
fi
done
--- NEW FILE rpmdev-md5 ---
#! /bin/sh
# Copyright (C) 2003 Enrico Scholz <enrico.scholz at informatik.tu-chemnitz.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
while test "$1"; do
case "$1" in
--help) echo $"Usage: rpmdev-md5 <package>"; exit 0;;
--version) echo $"rpmdev-md5 0.4"; exit 0;;
--) shift; break;;
*) break
esac
shift
done
test "$1" || {
echo $"No package specified; use '--help' for more information"
exit 1
}
unset CDPATH
tmp=`mktemp -d /var/tmp/fedmd5.XXXXXX`
trap "rm -rf $tmp" EXIT
rpm2cpio - <"$1" | ( cd $tmp; cpio -i --quiet )
cd -- `dirname -- "$1"`
md5sum -- `basename -- "$1"`
cd $tmp
md5sum *
--- NEW FILE rpmdev-newspec ---
#!/bin/bash
SPECDIR="/etc/rpmdevtools"
DEFTYPE="minimal"
DEFSPEC="newpackage.spec"
usage() {
ret=${1:-0}
cat <<EOF
Usage: rpmdev-newspec [option]... [appname]
Options:
-o FILE Output the specfile to FILE. "-" means stdout. The default is
"<appname>.spec", or "$DEFSPEC" if appname is not given.
-t TYPE Force use of the TYPE spec template. The default is guessed
from <appname>, falling back to "$DEFTYPE" if the guesswork
does not result in a more specific one or if <appname> is not
given. See $SPECDIR/spectemplate-*.spec for available types.
-h Show this usage message
EOF
exit $ret
}
appname=
specfile=
spectype=
while [ -n "$1" ] ; do
case "$1" in
-t|--type)
shift
spectype="$1"
;;
-o|--output)
shift
specfile="$1"
;;
-h|--help)
usage 0
;;
*.spec)
[ -z "$specfile" ] && specfile="$1"
[ -z "$appname" ] && appname="$(basename $1 .spec)"
;;
*)
appname="$1"
[ -z "$specfile" ] && specfile="$appname.spec"
;;
esac
shift
done
specfilter=
if [ -z "$spectype" ] ; then
case "$appname" in
perl-*)
spectype=perl
cpandist="${appname##perl-}"
specfilter="; s/^%setup.*/%setup -q -n $cpandist-%{version}/ \
; s|^\\(URL:\\s*\\).*|\1http://search.cpan.org/dist/$cpandist/|"
;;
php-pear-*)
spectype=php-pear
pearname="$(echo ${appname##php-pear-} | tr - _)"
basepeardir="$(echo $pearname | cut -f 1 -d _)"
peardirpath="$(echo $pearname | tr _ /)"
specfilter="; s|^\\(.*\\)Foo_Bar\\(.*\\)|\1$pearname\2| \
; s|^\\(%{pear_phpdir}/\\)Foo|\1$basepeardir| \
; s|^\\(%{pear_phpdir}/\\)$pearname\\(.php\\)|\1$peardirpath\2|"
;;
[Pp]y*)
spectype=python
;;
ruby-*)
spectype=ruby
;;
lib*|*-lib|*-libs)
spectype=lib
;;
*)
spectype=$DEFTYPE
;;
esac
fi
tempspec="$SPECDIR/spectemplate-$spectype.spec"
if [ ! -f "$tempspec" ] ; then
echo "Template \"$tempspec\" not found, exiting."
exit 1
fi
[ -z "$specfile" ] && specfile="$DEFSPEC"
if [ -f "$specfile" ] ; then
echo "Output file \"$specfile\" already exists, exiting."
exit 2
elif [ "$specfile" = "-" ] ; then
specfile=/dev/stdout
fi
cat "$tempspec" | sed -e "s/^\\(Name:\\s*\\)/\\1$appname/ $specfilter" \
> "$specfile"
if [ "$specfile" != "/dev/stdout" ] ; then
echo "Skeleton specfile ($spectype) has been created to \"$specfile\"."
fi
--- NEW FILE rpmdev-rmdevelrpms ---
#!/usr/bin/python -tt
# -*- coding: utf-8 -*-
# rpmdev-rmdevelrpms -- Find (and optionally remove) "development" RPMs
#
# Author: Ville Skyttä <ville.skytta at iki.fi>
# Credits: Seth Vidal (yum), Thomas Vander Stichele (mach)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Library General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
import getopt, os, re, rpm, stat, sys, types
__version__ = "1.2"
dev_re = re.compile("-(?:de(?:buginfo|vel)|sdk)\\b", re.IGNORECASE)
test_re = re.compile("^perl-(?:Devel|ExtUtils|Test)-")
lib_re1 = re.compile("^lib.+")
lib_re2 = re.compile("-libs?$")
a_re = re.compile("\\w\\.a$")
so_re = re.compile("\\w\\.so(?:\\.\\d+)*$")
comp_re = re.compile("^compat-gcc")
# required by Ant, which is required by Eclipse...
jdev_re = re.compile("^java-.+-gcj-compat-devel$")
def_devpkgs =\
("autoconf", "autoconf213", "automake", "automake14", "automake15",
"automake16", "automake17", "bison", "byacc", "dev86", "djbfft",
"docbook-utils-pdf", "doxygen", "flex", "gcc-g77", "gcc-gfortran", "gcc-gnat",
"gcc-objc", "gcc32", "gcc34", "gcc34-c++", "gcc34-java", "gcc35", "gcc35-c++",
"gcc4", "gcc4-c++", "gcc4-gfortran", "gettext", "glade", "glade2",
"kernel-source", "kernel-sourcecode", "libtool", "m4", "nasm",
"perl-Module-Build", "pkgconfig", "qt-designer", "swig", "texinfo",
)
# zlib-devel: see #151622
def_nondevpkgs =\
("glibc-devel", "libstdc++-devel", "libgcj-devel", "zlib-devel",
)
devpkgs = ()
nondevpkgs = ()
def isDevelPkg(hdr):
"""
Decides whether a package is a devel one, based on name, configuration
and contents.
"""
if not hdr: return 0
name = hdr[rpm.RPMTAG_NAME]
if not name: return 0
if name in nondevpkgs: return 0
if name in devpkgs: return 1
if name in def_nondevpkgs: return 0
if name in def_devpkgs: return 1
if jdev_re.search(name): return 0
if dev_re.search(name): return 1
if test_re.search(name): return 1
if comp_re.search(name): return 1
if lib_re1.search(name) or lib_re2.search(name):
# Heuristics for lib*, *-lib and *-libs packages (kludgy...)
a_found = so_found = 0
fnames = hdr[rpm.RPMTAG_FILENAMES]
fmodes = hdr[rpm.RPMTAG_FILEMODES]
for i in range(len(fnames)):
# Peek into the files in the package.
if not (stat.S_ISLNK(fmodes[i]) or stat.S_ISREG(fmodes[i])):
# Not a file or a symlink: ignore.
pass
fn = fnames[i]
if so_re.search(fn):
# *.so or a *.so.*: cannot be sure, treat pkg as non-devel.
so_found = 1
break
if not a_found and a_re.search(fn):
# A *.a: mmm... this has potential, let's look further...
a_found = 1
# If we have a *.a but no *.so or *.so.*, assume devel.
return a_found and not so_found
def callback(what, bytes, total, h, user):
"Callback called during rpm transaction."
sys.stdout.write(".")
sys.stdout.flush()
def help():
print '''rpmdev-rmdevelrpms is a script for finding and optionally removing
"development" packages, for example for cleanup purposes before starting to
build a new package.
By default, the following packages are treated as development ones and are
thus candidates for removal: any package whose name matches "-devel\\b",
"-debuginfo\\b", or "-sdk\\b" (case insensitively) except gcc requirements;
any package whose name starts with "perl-(Devel|ExtUtils|Test)-"; any package
whose name starts with "compat-gcc"; packages in the internal list of known
development oriented packages (see def_devpkgs in the source code); packages
determined to be development ones based on some basic heuristic checks on the
package\'s contents.
The default set of packages above is not intended to not reduce a system into
a minimal clean build root, but to keep it usable for general purposes while
getting rid of a reasonably large set of development packages. The package
set operated on can be configured to meet various scenarios.
To include additional packages in the list of ones treated as development
packages, use the "devpkgs" option in the configuration file. To exclude
packages from the list use "nondevpkgs" in it. Exclusion overrides inclusion.
The system wide configuration file is /etc/rpmdevtools/rmdevelrpms.conf, and
per user settings (which override system ones) can be specified in
~/.rmdevelrpmsrc. These files are written in Python.
'''
usage(None)
print '''
Report bugs to <http://bugzilla.redhat.com/>.'''
sys.exit(0)
def usage(exit=1):
print '''
Usage: rpmdev-rmdevelrpms [OPTION]...
Options:
-y, --yes Assume yes to all questions, do not prompt.
-v, --version Print program version and exit.
-h, --help Print help message and exit.'''
if exit is not None:
sys.exit(exit)
def version():
print "rpmdev-rmdevelrpms version %s" % __version__
print '''
Copyright (c) 2004-2006 Fedora Project <http://fedoraproject.org/>.
This program is licensed under the GNU General Public License, see the
file COPYING included in the distribution archive.
Written by Ville Skyttä.'''
sys.exit(0)
def main():
"Da meat."
try:
# TODO: implement -r|--root for checking a specified rpm root
opts, args = getopt.getopt(sys.argv[1:],
"yvh",
["yes", "version", "help"])
except getopt.GetoptError:
usage(2)
confirm = 1
for o, a in opts:
if o in ("-v", "--version"):
version()
if o in ("-h", "--help"):
help()
elif o in ("-y", "--yes"):
confirm = 0
ts = rpm.TransactionSet("/")
ts.setVSFlags(~(rpm._RPMVSF_NOSIGNATURES|rpm._RPMVSF_NODIGESTS))
for pkg in ts.dbMatch():
if isDevelPkg(pkg):
# addErase behaves like "--allmatches"
ts.addErase(pkg[rpm.RPMTAG_NAME])
ts.order()
pkgs = []
try:
te = ts.next()
while te:
pkgs.append(te.NEVR())
te = ts.next()
except StopIteration:
pass
try:
if len(pkgs) > 0:
pkgs.sort()
print "Found %d devel packages:" % len(pkgs)
for pkg in pkgs:
print " %s" % pkg
unresolved = ts.check()
if unresolved:
print "...but removal would cause unresolved dependencies:"
unresolved.sort(lambda x, y: cmp(x[0][0], y[0][0]))
for t in unresolved:
dep = t[1][0]
if t[1][1]:
dep = dep + " "
if t[2] & rpm.RPMSENSE_LESS:
dep = dep + "<"
if t[2] & rpm.RPMSENSE_GREATER:
dep = dep + ">"
if t[2] & rpm.RPMSENSE_EQUAL:
dep = dep + "="
dep = dep + " " + t[1][1]
if t[4] == rpm.RPMDEP_SENSE_CONFLICTS:
dep = "conflicts with " + dep
elif t[4] == rpm.RPMDEP_SENSE_REQUIRES:
dep = "requires " + dep
print " %s-%s-%s %s" % (t[0][0], t[0][1], t[0][2], dep)
print "Skipped."
elif os.geteuid() == 0:
if confirm:
proceed = raw_input("Remove them? [y/N] ")
else:
proceed = "y"
if (proceed in ("Y", "y")):
sys.stdout.write("Removing...")
errors = ts.run(callback, "")
print "Done."
if errors:
for error in errors:
print error
sys.exit(1)
else:
print "Not removed."
else:
print "Not running as root, skipping remove."
else:
print "No devel packages found."
finally:
ts.closeDB()
del ts
for conf in ("/etc/rpmdevtools/rmdevelrpms.conf",
os.path.join(os.environ["HOME"], ".rmdevelrpmsrc")):
try:
execfile(conf)
except IOError:
pass
if type(devpkgs) == types.StringType:
devpkgs = devpkgs.split()
if type(nondevpkgs) == types.StringType:
nondevpkgs = nondevpkgs.split()
main()
--- NEW FILE rpmdev-setuptree ---
#!/bin/sh
#
# RPM-build-tree.txt
# also called: fedora-buildrpmtree, rpmdev-setuptree
#
# Set up a 'plain userid' SRPM build environment
#
# Home locale for this script:
# http://www.rpm.org/hintskinks/buildtree/RPM-build-tree.txt
# also: ftp://ftp.owlriver.com/pub/local/ORC/rpmbuild/
#
# See also: http://freshrpms.net/docs/fight.html
#
# based on a post:
# Date: Tue, 30 Jul 2002 17:00:21 +0200
# From: Ralf Ertzinger <ralf at camperquake.de>
# Reply-To: rpm-list at freshrpms.net
#
VER="0.06-050205"
# copyright (c) 2002 Owl River Company - Columbus OH
# info at owlriver.com -- GPL v.2
#
# rev 0.06 050205 IVA -- use the paths as defined in configuration
# rev 0.05 030814 RPH -- apply NIS extension per
# nate at rj1.org (Nathan Owen)
# https://bugzilla.fedora.us/show_bug.cgi?id=594
# rev 0.04 030422 RPH -- change to vendor neutral 'rpmbuild'
# path element
# rev 0.03 021210 RPH -- put the home in the right place
# automatically
# rev 0.02 021207 RPH -- add %make macro for people using
# Mandrake .spec files on non-Mandrake platforms
# initial 0.01 020731 RPH - initial release
#
[ "x$1" = "x-d" ] && {
DEBUG="y"
export DEBUG
shift 1
}
#
IAM=`id -un`
# returns bare username
#
PASSWDDIR=`grep ^$IAM: /etc/passwd | awk -F":" '{print $6}'`
HOMEDIR=${HOME:=$PASSWDDIR}
[ ! -d $HOMEDIR ] && {
echo "ERROR: Home directory for user $IAM not found in /etc/passwd."
exit 1
}
# and home directory
#
#
#
RPMMACROS="$HOMEDIR/.rpmmacros"
touch $RPMMACROS
#
TOPDIR="%_topdir"
ISTOP=`grep -c ^$TOPDIR $RPMMACROS`
[ $ISTOP -lt 1 ] && {
echo "%_topdir %(echo \$HOME)/rpmbuild" >> $RPMMACROS
}
#
#MAKE="%make "
#ISTOP=`grep -c ^$MAKE $RPMMACROS`
#[ $ISTOP -lt 1 ] && {
# echo "$MAKE make" >> $RPMMACROS
# }
#
MFLAGS="%_smp_mflags"
ISTOP=`grep -c ^$MFLAGS $RPMMACROS`
[ $ISTOP -lt 1 ] && {
echo "$MFLAGS -j3" >> $RPMMACROS
}
#
ISTOP=`grep -c ^%__arch_install_post $RPMMACROS`
[ $ISTOP -lt 1 ] && {
cat <<EOF >> $RPMMACROS
%__arch_install_post \
/usr/lib/rpm/check-rpaths \
/usr/lib/rpm/check-buildroot
EOF
}
RPMDIR=`rpm --eval "%{_rpmdir}"`
SRCDIR=`rpm --eval "%{_sourcedir}"`
SPECDIR=`rpm --eval "%{_specdir}"`
SRPMDIR=`rpm --eval "%{_srcrpmdir}"`
BUILDDIR=`rpm --eval "%{_builddir}"`
[ "x$DEBUG" != "x" ] && {
echo "$IAM $HOMEDIR $RPMMACROS"
echo "$RPMDIR $SRCDIR $SPECDIR"
echo "$SRPMDIR $BUILDDIR"
}
#
for i in $RPMDIR $SRCDIR $SPECDIR $SRPMDIR $BUILDDIR ; do
[ ! -d $i ] && mkdir -p $i
done
#
exit 0
#
--- NEW FILE rpmdev-vercmp ---
#!/usr/bin/python
#
# Seth Vidal - yadda yadda yadda GPL Yadda yadda yadda Use at own risk
import rpm
import sys
def usage():
print """
rpmdev-vercmp epoch1, ver1, release1, epoch2, ver2, release2
or just let it ask you.
"""
def vercmp((e1, v1, r1), (e2, v2, r2)):
rc = rpm.labelCompare((e1, v1, r1), (e2, v2, r2))
return rc
def askforstuff(thingname):
thing = raw_input('%s :' % thingname)
return thing
def main():
if len(sys.argv) > 1 and sys.argv[1] in ['-h', '--help', '-help', '--usage']:
usage()
sys.exit(0)
elif len(sys.argv) < 7:
e1 = askforstuff('Epoch1')
v1 = askforstuff('Version1')
r1 = askforstuff('Release1')
e2 = askforstuff('Epoch2')
v2 = askforstuff('Version2')
r2 = askforstuff('Release2')
else:
(e1, v1, r1, e2, v2, r2) = sys.argv[1:]
rc = vercmp((e1, v1, r1), (e2, v2, r2))
if rc > 0:
print "%s:%s-%s is newer" % (e1, v1, r1)
elif rc == 0:
print "These are Equal"
elif rc < 0:
print "%s:%s-%s is newer" % (e2, v2, r2)
if __name__ == "__main__":
main()
--- NEW FILE rpmdev-wipetree ---
#!/bin/sh
#
# rpmdev-wipetree
# Erases all files within the rpm build dir
#
# Author: Warren Togami <warren at togami.com>
# License: GPL
# Sanity Check: Forbid root user
if [ $(id -u) -eq 0 ]; then
echo
echo "ERROR: You should not be building RPMS as the superuser!"
echo "Please use rpmdev-setuptree as a normal user and build"
echo "packages as that user. If package building fails, then"
echo "the package is improper and needs fixing."
echo
exit 255
fi
# Wipe RPM Build Directory clean
echo "Removing all build files..."
rm -rf $(rpm --eval "%{_builddir}")/*
rm -rf $(rpm --eval "%{_sourcedir}")/*
rm -rf $(rpm --eval "%{_srcrpmdir}")/*
rm -rf $(rpm --eval "%{_specdir}")/*
find $(rpm --eval "%{_rpmdir}") -name "*.rpm" | xargs rm -f
Index: Makefile.am
===================================================================
RCS file: /cvs/fedora/fedora-rpmdevtools/Makefile.am,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Makefile.am 18 Jul 2006 16:52:35 -0000 1.6
+++ Makefile.am 20 Aug 2006 15:40:44 -0000 1.7
@@ -6,13 +6,12 @@
pkgsysconfdir = $(sysconfdir)/rpmdevtools
rpmlibdir = $(libdir)/rpm
-dist_bin_SCRIPTS = buildrpmtree diffarchive extractarchive \
- rpmmd5 newrpmspec \
- rmdevelrpms rpmchecksig rpminfo rpmvercmp \
- wipebuildtree
+dist_bin_SCRIPTS = rpmdev-checksig rpmdev-diff rpmdev-extract rpmdev-md5 \
+ rpmdev-newspec rpmdev-rmdevelrpms rpmdev-setuptree rpmdev-vercmp \
+ rpmdev-wipetree rpminfo
-dist_man1_MANS = extractarchive.1 diffarchive.1
-dist_man8_MANS = rmdevelrpms.8
+dist_man1_MANS = rpmdev-diff.1 rpmdev-extract.1
+dist_man8_MANS = rpmdev-rmdevelrpms.8
dist_pkgdata_DATA = template.init
Index: rmdevelrpms.conf
===================================================================
RCS file: /cvs/fedora/fedora-rpmdevtools/rmdevelrpms.conf,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- rmdevelrpms.conf 17 Jul 2006 20:02:10 -0000 1.2
+++ rmdevelrpms.conf 20 Aug 2006 15:40:44 -0000 1.3
@@ -1,8 +1,8 @@
# -*- python -*-
#
-# To prevent rmdevelrpms from removing some packages, add them to nondevpkgs.
-# The value can be a Python tuple or a whitespace separated string.
-# For example:
+# To prevent rpmdev-rmdevelrpms from removing some packages, add them to
+# nondevpkgs. The value can be a Python tuple or a whitespace separated
+# string. For example:
# nondevpkgs = ("foo-devel", "bar-devel")
# nondevpkgs = "foo-devel bar-devel"
#
Index: rpmdevtools.spec
===================================================================
RCS file: /cvs/fedora/fedora-rpmdevtools/rpmdevtools.spec,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- rpmdevtools.spec 2 Aug 2006 20:41:47 -0000 1.8
+++ rpmdevtools.spec 20 Aug 2006 15:40:44 -0000 1.9
@@ -5,7 +5,7 @@
Name: rpmdevtools
Version: 5.0
Release: 1%{?dist}
-Summary: Fedora RPM Development Tools
+Summary: RPM Development Tools
Group: Development/Tools
License: GPL
@@ -26,19 +26,18 @@
%description
This package contains scripts and (X)Emacs support files to aid in
-development of Fedora RPM packages. These tools are designed for Fedora
-Core 2 and later.
-buildrpmtree Create RPM build tree within user's home directory
-diffarchive Diff contents of two archives
-extractarchive Extract various archives, "tar xvf" style
-newrpmspec Creates new .spec from template
-rmdevelrpms Find (and optionally remove) "development" RPMs
-rpmchecksig Check package signatures using alternate RPM keyring
-rpminfo Prints information about executables and libraries
-rpmmd5 Display the md5sum of all files in an RPM
-rpmvercmp RPM version comparison checker
-spectool Expand and download sources and patches in specfiles
-wipebuildtree Erase all files within dirs created by buildrpmtree
+development of RPM packages.
+rpmdev-setuptree Create RPM build tree within user's home directory
+rpmdev-diff Diff contents of two archives
+rpmdev-newspec Creates new .spec from template
+rpmdev-rmdevelrpms Find (and optionally remove) "development" RPMs
+rpmdev-checksig Check package signatures using alternate RPM keyring
+rpminfo Print information about executables and libraries
+rpmdev-md5 Display the md5sum of all files in an RPM
+rpmdev-vercmp RPM version comparison checker
+spectool Expand and download sources and patches in specfiles
+rpmdev-wipetree Erase all files within dirs created by rpmdev-setuptree
+rpmdev-extract Extract various archives, "tar xvf" style
%prep
@@ -60,21 +59,21 @@
for dir in %{emacs_sitestart_d} %{xemacs_sitestart_d} ; do
install -dm 755 $RPM_BUILD_ROOT$dir
- ln -s %{_datadir}/rpmdevtools/rpmdevtools-init.el $RPM_BUILD_ROOT$dir
- touch $RPM_BUILD_ROOT$dir/rpmdevtools-init.elc
+ ln -s %{_datadir}/rpmdevtools/rpmdev-init.el $RPM_BUILD_ROOT$dir
+ touch $RPM_BUILD_ROOT$dir/rpmdev-init.elc
done
# Backwards compatibility symlinks
-ln -s buildrpmtree $RPM_BUILD_ROOT%{_bindir}/fedora-buildrpmtree
-ln -s diffarchive $RPM_BUILD_ROOT%{_bindir}/fedora-diffarchive
-ln -s extractarchive $RPM_BUILD_ROOT%{_bindir}/fedora-extract
-ln -s newrpmspec $RPM_BUILD_ROOT%{_bindir}/fedora-newrpmspec
-ln -s rmdevelrpms $RPM_BUILD_ROOT%{_bindir}/fedora-rmdevelrpms
-ln -s rpmchecksig $RPM_BUILD_ROOT%{_bindir}/fedora-rpmchecksig
-ln -s rpminfo $RPM_BUILD_ROOT%{_bindir}/fedora-rpminfo
-ln -s rpmmd5 $RPM_BUILD_ROOT%{_bindir}/fedora-md5
-ln -s rpmvercmp $RPM_BUILD_ROOT%{_bindir}/fedora-rpmvercmp
-ln -s wipebuildtree $RPM_BUILD_ROOT%{_bindir}/fedora-wipebuildtree
+ln -s rpmdev-checksig $RPM_BUILD_ROOT%{_bindir}/fedora-rpmchecksig
+ln -s rpmdev-diff $RPM_BUILD_ROOT%{_bindir}/fedora-diffarchive
+ln -s rpmdev-extract $RPM_BUILD_ROOT%{_bindir}/fedora-extract
+ln -s rpmdev-md5 $RPM_BUILD_ROOT%{_bindir}/fedora-md5
+ln -s rpmdev-newspec $RPM_BUILD_ROOT%{_bindir}/fedora-newrpmspec
+ln -s rpmdev-rmdevelrpms $RPM_BUILD_ROOT%{_bindir}/fedora-rmdevelrpms
+ln -s rpmdev-setuptree $RPM_BUILD_ROOT%{_bindir}/fedora-buildrpmtree
+ln -s rpmdev-vercmp $RPM_BUILD_ROOT%{_bindir}/fedora-rpmvercmp
+ln -s rpmdev-wipetree $RPM_BUILD_ROOT%{_bindir}/fedora-wipebuildtree
+ln -s rpminfo $RPM_BUILD_ROOT%{_bindir}/fedora-rpminfo
%check
@@ -87,17 +86,17 @@
%triggerin -- emacs-common
[ -d %{emacs_sitestart_d} ] && \
- ln -sf %{_datadir}/rpmdevtools/rpmdevtools-init.el %{emacs_sitestart_d} || :
+ ln -sf %{_datadir}/rpmdevtools/rpmdev-init.el %{emacs_sitestart_d} || :
%triggerin -- xemacs-common
[ -d %{xemacs_sitestart_d} ] && \
- ln -sf %{_datadir}/rpmdevtools/rpmdevtools-init.el %{xemacs_sitestart_d} || :
+ ln -sf %{_datadir}/rpmdevtools/rpmdev-init.el %{xemacs_sitestart_d} || :
%triggerun -- emacs-common
-[ $2 -eq 0 ] && rm -f %{emacs_sitestart_d}/rpmdevtools-init.el* || :
+[ $2 -eq 0 ] && rm -f %{emacs_sitestart_d}/rpmdev-init.el* || :
%triggerun -- xemacs-common
-[ $2 -eq 0 ] && rm -f %{xemacs_sitestart_d}/rpmdevtools-init.el* || :
+[ $2 -eq 0 ] && rm -f %{xemacs_sitestart_d}/rpmdev-init.el* || :
%files
@@ -112,6 +111,9 @@
%changelog
+* Sun Aug 20 2006 Ville Skyttä <ville.skytta at iki.fi>
+- Re-rename almost everything to rpmdev-*, with backwards compat symlinks.
+
* Wed Aug 2 2006 Ville Skyttä <ville.skytta at iki.fi>
- Treat *-sdk as devel packages in rmdevelrpms (#199909).
- Don't assume compface is a devel package in rmdevelrpms.
--- buildrpmtree DELETED ---
--- diffarchive DELETED ---
--- extractarchive DELETED ---
--- newrpmspec DELETED ---
--- rmdevelrpms DELETED ---
--- rpmchecksig DELETED ---
--- rpmmd5 DELETED ---
--- rpmvercmp DELETED ---
--- wipebuildtree DELETED ---
- Previous message (by thread): comps comps-fe5.xml.in,1.105,1.106 comps-fe6.xml.in,1.101,1.102
- Next message (by thread): fedora-rpmdevtools/emacs rpmdev-init.el, NONE, 1.1 Makefile.am, 1.3, 1.4 rpmdevtools-init.el, 1.1, NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the fedora-extras-commits
mailing list