# - desc wrapping is totally fucked up on global.spec,1.25, dosemu.spec,1.115-
# - it should change: /%source([0-9]+)/i to %{SOURCE\1}
# - extra quote on LDFLAGS line: https://bugs.launchpad.net/pld-linux/+bug/385836
+# - %{with_foo:%attr()...} gets converted to %attr() %{with_foo:...} [vlc.spec]
+# - 'R: foo ' (with traliling space) gets coverted to "R: foo\nR: " [vlc.spec @ 1.199 ]
BEGIN {
RPM_SECTIONS = "package|build|changelog|clean|description|install|post|posttrans|postun|pre|prep|pretrans|preun|triggerin|triggerpostun|triggerun|verifyscript|check"
import_rpm_macros()
- packages_dir = topdir "/packages"
+ packages_dir = topdir
groups_file = packages_dir "/rpm.groups"
system("cd "packages_dir"; [ -f rpm.groups ] || cvs up rpm.groups > /dev/null")
replace_requires();
}
- if (field ~ /^requires:/) {
+ if (field ~ /^requires:/ || field ~ /^requires\(/) {
replace_requires();
}
$1 = "License:"
}
+ # ease updating from debian .dsc
+ if (field ~ /homepage:/) {
+ $1 = "URL:"
+ }
+
if (field ~ /license:/) {
l = substr($0, index($0, $2));
if (l == "Python Software Foundation License") {
if (l == "GPLv2+") {
l = "GPL v2+"
}
+ if (l == "LGPLv2+") {
+ l = "LGPL v2+"
+ }
$0 = "License:\t" l;
}
$0 = "%attr(755,root,root) " $0
}
+ # remove attrs from man pages
+ if (/%{_mandir}/ && /^%attr/) {
+ sub("^%attr\\(.*\\) *", "");
+ }
+
# /etc/sysconfig files
# %attr(640,root,root) %config(noreplace) %verify(not size mtime md5) /etc/sysconfig/*
# attr not required, allow default 644 attr
{
# sourceforge urls
- # Docs about sourceforge mirror system: http://sourceforge.net/docs/B05/
- sub("[?&]big_mirror=.*$", "", url);
- sub("[?&]modtime=.*$", "", url);
- sub("[?]use_mirror=.*$", "", url);
- sub("[?]download$", "", url);
-
- sub("^http://prdownloads\.sourceforge\.net/", "http://dl.sourceforge.net/", url)
- sub("^http://download\.sf\.net/", "http://dl.sourceforge.net/", url)
- sub("^http://download\.sourceforge\.net/", "http://dl.sourceforge.net/", url)
- sub("^http://downloads\.sourceforge\.net/", "http://dl.sourceforge.net/", url)
-
- sub("^http://.*\.dl\.sourceforge\.net/", "http://dl.sourceforge.net/", url)
- sub("^http://dl\.sourceforge\.net/sourceforge/", "http://dl.sourceforge.net/", url)
- sub("^http://dl\.sf\.net/", "http://dl.sourceforge.net/", url)
+ # Docs about sourceforge mirror system: http://sourceforge.net/apps/trac/sourceforge/wiki/Mirrors
+ sub("^http://prdownloads\.sourceforge\.net/", "http://downloads.sourceforge.net/", url)
+ sub("^http://download\.sf\.net/", "http://downloads.sourceforge.net/", url)
+ sub("^http://download\.sourceforge\.net/", "http://downloads.sourceforge.net/", url)
+ sub("^http://dl\.sourceforge\.net/", "http://downloads.sourceforge.net/", url)
+ sub("^http://.*\.dl\.sourceforge\.net/", "http://downloads.sourceforge.net/", url)
+ sub("^http://dl\.sf\.net/", "http://downloads.sourceforge.net/", url)
+ sub("^http://downloads\.sourceforge\.net/sourceforge/", "http://downloads.sourceforge.net/", url)
+ # new style urls, strip "files/" between and prepend dl.
+ if (match(url, "^http://sourceforge.net/projects/[^/]+/files/")) {
+ url = substr(url, 1, RLENGTH - length("files/")) substr(url, RSTART + RLENGTH);
+ sub("^http://sourceforge.net/projects/", "http://downloads.sourceforge.net/project/", url);
+ }
+ if (url ~ /sourceforge.net/) {
+ sub("[?&]big_mirror=.*$", "", url);
+ sub("[?&]modtime=.*$", "", url);
+ sub("[?]use_mirror=.*$", "", url);
+ sub("[?]download$", "", url);
+ sub("/download$", "", url);
+ }
sub("^ftp://ftp\.gnome\.org/", "http://ftp.gnome.org/", url)
sub("^http://ftp\.gnome\.org/pub/gnome/", "http://ftp.gnome.org/pub/GNOME/", url)
BR[BR_count++] = br
}
-function replace_requires()
-{
-
- # jpackages
- sub(/^java-devel$/, "jdk", $2);
- sub(/^log4j$/, "java-log4j", $2);
- sub(/^logging-log4j$/, "java-log4j", $2);
- sub(/^jakarta-log4j$/, "java-log4j", $2);
- sub(/^oro$/, "java-oro", $2);
- sub(/^jakarta-oro$/, "java-oro", $2);
- sub(/^jakarta-ant$/, "ant", $2);
- sub(/^xerces-j2$/, "java-xerces", $2);
- sub(/^xerces-j$/, "java-xerces", $2);
- sub(/^ldapjdk$/, "ldapsdk", $2);
- sub(/^saxon-scripts$/, "saxon", $2);
- sub(/^xalan-j2$/, "java-xalan", $2);
- sub(/^xalan-j$/, "java-xalan", $2);
- sub(/^gnu-regexp$/, "java-gnu-regexp", $2);
- sub(/^gnu.regexp$/, "java-gnu-regexp", $2);
- sub(/^jakarta-commons-httpclient$/, "java-commons-httpclient", $2);
- sub(/^xml-commons-resolver$/, "java-xml-commons-resolver", $2);
- sub(/^axis$/, "java-axis", $2);
- sub(/^wsdl4j$/, "java-wsdl4j", $2);
- sub(/^uddi4j$/, "java-uddi4j", $2);
- sub(/^hamcrest$/, "java-hamcrest", $2);
-
- # redhat virtual
- sub(/^tftp-server$/, "tftpdaemon", $2);
-
- sub(/^gcc-c\+\+$/, "libstdc++-devel", $2);
- sub(/^chkconfig$/, "/sbin/chkconfig", $2);
-
- # fedora
- sub(/^iscsi-initiator-utils$/, "open-iscsi", $2);
-
- replace_php_virtual_deps()
-}
-
-# php virtual deps as discussed in devel-en
-function replace_php_virtual_deps()
-{
- pkg = $2
-# if (pkg == "php-program") {
-# $0 = $1 "\t/usr/bin/php"
-# return
-# }
-
-# if (pkg ~ /^php-[a-z]/ && pkg !~ /^php-(pear|common|cli|devel|fcgi|cgi|dirs|program|pecl-)/) {
-# sub(/^php-/, "php(", pkg);
-# sub(/$/, ") # verify this correctness -- it may be wanted to use specific not virtual dep", pkg);
-# $2 = pkg
-# }
-
- if (pkg ~/^php$/) {
- $2 = "webserver(php)";
- if ($4 ~ /^[0-9]:/) {
- $4 = substr($4, 3);
- }
- }
-
- if (pkg ~/^php4$/) {
- $2 = "webserver(php)";
- if ($4 ~ /^[0-9]:/) {
- $4 = substr($4, 3);
- }
- }
-}
# Load rpm macros
# you should update the list also in adapter when making changes here
tmpdir = ENVIRON["tmpdir"]
}
+
+# php virtual deps as discussed in devel-en
+function replace_php_virtual_deps() {
+ pkg = $2
+# if (pkg == "php-program") {
+# $0 = $1 "\t/usr/bin/php"
+# return
+# }
+
+# if (pkg ~ /^php-[a-z]/ && pkg !~ /^php-(pear|common|cli|devel|fcgi|cgi|dirs|program|pecl-)/) {
+# sub(/^php-/, "php(", pkg);
+# sub(/$/, ") # verify this correctness -- it may be wanted to use specific not virtual dep", pkg);
+# $2 = pkg
+# }
+
+ if (pkg ~/^php$/) {
+ $2 = "webserver(php)";
+ if ($4 ~ /^[0-9]:/) {
+ $4 = substr($4, 3);
+ }
+ }
+
+ if (pkg ~/^php4$/) {
+ $2 = "webserver(php)";
+ if ($4 ~ /^[0-9]:/) {
+ $4 = substr($4, 3);
+ }
+ }
+}
+
+function replace_requires() {
+
+ # jpackages
+ sub(/^java-devel$/, "jdk", $2);
+ sub(/^log4j$/, "java-log4j", $2);
+ sub(/^logging-log4j$/, "java-log4j", $2);
+ sub(/^jakarta-log4j$/, "java-log4j", $2);
+ sub(/^oro$/, "java-oro", $2);
+ sub(/^jakarta-oro$/, "java-oro", $2);
+ sub(/^jakarta-ant$/, "ant", $2);
+ sub(/^xerces-j2$/, "java-xerces", $2);
+ sub(/^xerces-j$/, "java-xerces", $2);
+ sub(/^ldapjdk$/, "ldapsdk", $2);
+ sub(/^saxon-scripts$/, "saxon", $2);
+ sub(/^xalan-j2$/, "java-xalan", $2);
+ sub(/^xalan-j$/, "java-xalan", $2);
+ sub(/^gnu-regexp$/, "java-gnu-regexp", $2);
+ sub(/^gnu.regexp$/, "java-gnu-regexp", $2);
+ sub(/^jakarta-commons-httpclient$/, "java-commons-httpclient", $2);
+ sub(/^xml-commons-resolver$/, "java-xml-commons-resolver", $2);
+ sub(/^axis$/, "java-axis", $2);
+ sub(/^wsdl4j$/, "java-wsdl4j", $2);
+ sub(/^uddi4j$/, "java-uddi4j", $2);
+ sub(/^hamcrest$/, "java-hamcrest", $2);
+
+ # redhat virtual
+ sub(/^tftp-server$/, "tftpdaemon", $2);
+
+ sub(/^gcc-c\+\+$/, "libstdc++-devel", $2);
+ sub(/^chkconfig$/, "/sbin/chkconfig", $2);
+
+ # fedora
+ sub(/^iscsi-initiator-utils$/, "open-iscsi", $2);
+ sub(/^gnome-python2-extras$/, "python-gnome-extras", $2);
+ sub(/^gtk2$/, "gtk+2", $2);
+ sub(/^gtk2-devel$/, "gtk+2-devel", $2);
+ sub(/^pygtk2-devel$/, "python-pygtk-devel", $2);
+ sub(/^pygtk2$/, "python-pygtk", $2);
+ sub(/^qt4-devel$/, "qt4-build", $2);
+ sub(/^file-devel$/, "libmagic-devel", $2);
+ sub(/^gamin-python$/, "python-gamin", $2);
+ sub(/^pygobject2$/, "python-pygobject", $2);
+ sub(/^tkinter$/, "python-tkinter", $2);
+ sub(/^python-imaging$/, "python-PIL", $2);
+ sub(/^python-imaging-tk$/, "python-PIL-tk", $2);
+ sub(/^initscripts$/, "rc-scripts", $2);
+
+ # debian
+ sub(/^libgconf2-dev$/, "GConf2-devel", $2);
+ sub(/^libglib2.0-dev$/, "glib2-devel", $2);
+ sub(/^libgtk2.0-dev$/, "gtk+2-devel", $2);
+ sub(/^libhunspell-dev$/, "hunspell-devel", $2);
+ sub(/^libpango1.0-dev$/, "pango-devel", $2);
+ sub(/^libxslt1-dev$/, "libxslt-devel", $2);
+ sub(/^libgl1-mesa-dev$/, "OpenGL-devel", $2);
+ sub(/^mesa-common-dev$/, "OpenGL-devel", $2);
+ sub(/^libgl1-mesa-dri$/, "OpenGL", $2);
+ sub(/^libglu1-mesa-dev$/, "OpenGL-GLU-devel", $2);
+ sub(/^libxss-dev$/, "xorg-lib-libXScrnSaver-devel", $2);
+ sub(/^libboost-filesystem[0-9.]+-dev$/, "boost-devel", $2);
+ sub(/^libboost-program-options[0-9.]+-dev$/, "boost-devel", $2);
+ sub(/^libboost-regex[0-9.]+-dev$/, "boost-devel", $2);
+ sub(/^libboost-thread[0-9.]+-dev$/, "boost-devel", $2);
+ sub(/^libmcrypt-dev$/, "libmcrypt-devel", $2);
+ sub(/^libcurl4-openssl-dev$/, "curl-devel", $2);
+ sub(/^libmhash-dev$/, "mhash-devel", $2);
+ sub(/^libqt4-dev$/, "qt4-build", $2);
+ sub(/^libssl-dev$/, "openssl-devel", $2);
+
+ replace_php_virtual_deps()
+}
+
function replace_groupnames(group) {
+ group = replace(group, "Amusements/Games", "Applications/Games");
group = replace(group, "Amusements/Games/Strategy/Real Time", "X11/Applications/Games/Strategy");
group = replace(group, "Application/Multimedia", "Applications/Multimedia");
group = replace(group, "Application/System", "Applications/System");
group = replace(group, "System Environment/Daemons", "Daemons");
group = replace(group, "System Environment/Kernel", "Base/Kernel");
group = replace(group, "System Environment/Libraries", "Libraries");
+ group = replace(group, "System Tools", "Applications/System");
group = replace(group, "System", "Base");
group = replace(group, "System/Base", "Base");
group = replace(group, "System/Kernel and hardware", "Base/Kernel");
group = replace(group, "System/Servers", "Daemons");
group = replace(group, "Text Processing/Markup/HTML", "Applications/Text");
group = replace(group, "Text Processing/Markup/XML", "Applications/Text");
+ group = replace(group, "User Interface/Desktops", "X11/Applications");
+ group = replace(group, "Utilities/System", "Applications/System");
group = replace(group, "Web/Database", "Applications/WWW");
group = replace(group, "X11/GNOME", "X11/Applications");
group = replace(group, "X11/GNOME/Applications", "X11/Applications");
# - builder -u fetches current version first (well that's okay, how you compare versions if you have no old spec?)
# - when Icon: field is present, -5 and -a5 doesn't work
# - builder -R skips installing BR if spec is not present before builder invocation (need to run builder twice)
+# - does not respect NoSource: X, and tries to cvs up such files [ example: VirtualBox-bin.spec and its Source0 ]
# TODO:
# - ability to do ./builder -bb foo.spec foo2.spec foo3.spec
GROUP_BCONDS="no"
# create symlinks for tools in PACKAGE_DIR, see get_spec()
-SYMLINK_TOOLS="yes"
+SYMLINK_TOOLS="no"
PATCHES=""
SOURCES=""
them into src.rpm,
--short-circuit - short-circuit build
-B, --branch - add branch
--c, --clean - clean all temporarily created files (in BUILD, SOURCES,
- SPECS and \$RPM_BUILD_ROOT and CVS/Entries) after rpmbuild commands.
+-c, --clean - clean all temporarily created files (in BUILD\$RPM_BUILD_ROOT) after rpmbuild commands.
+ may be used with building process.
-m, --mr-proper - clean all temporarily created files (in BUILD, SOURCES,
SPECS and \$RPM_BUILD_ROOT and CVS/Entries). Doesn't run
any rpm building.
depspecname() {
local package="$1"
- package=$(echo "$package" | sed -e '/perl(.*)/{s,perl(\(.*\)),perl-\1,;s,::,-,g}')
+ package=$(echo "$package" | sed -e '/perl(.*)/{s,perl(\(.*\)),perl-\1,;s,::,-,g};' -e 's/-\(devel\|static\)$//' )
echo "$package"
}
# set TARGET from BuildArch: from SPECFILE
set_spec_target() {
if [ -n "$SPECFILE" ] && [ -z "$TARGET" ]; then
- tmp=$(awk '/^BuildArch:/ { print $NF}' $ASSUMED_NAME/$SPECFILE)
+ tmp=$(awk '/^BuildArch:/ { print $NF; exit }' $ASSUMED_NAME/$SPECFILE)
if [ "$tmp" ]; then
target_platform=$(rpm -E '%{_target_vendor}-%{_target_os}%{?_gnu}')
TARGET="$tmp"
%x8664 x86_64 amd64 ia32e
%alt_kernel %{nil}
%_alt_kernel %{nil}
-%requires_releq_kernel_up %{nil}
-%requires_releq_kernel_smp %{nil}
-%requires_releq_kernel %{nil}
+%requires_releq_kernel_up(s:n:) %{nil}
+%requires_releq_kernel_smp(s:n:) %{nil}
+%requires_releq_kernel(s:n:) %{nil}
%requires_releq() %{nil}
%pyrequires_eq() %{nil}
%requires_eq() %{nil}
%requires_eq_to() %{nil}
-%releq_kernel_up ERROR
-%releq_kernel_smp ERROR
-%releq_kernel ERROR
+%releq_kernel_up(n:) ERROR
+%releq_kernel_smp(n:) ERROR
+%releq_kernel(n:) ERROR
%kgcc_package ERROR
%_fontsdir ERROR
%ruby_version ERROR
if [ "$NOINIT" != "yes" ] ; then
TOP_DIR=$(eval $RPM $RPMOPTS --eval '%{_topdir}')
- REPO_DIR=$TOP_DIR/packages
- PACKAGE_DIR=$TOP_DIR/packages/$ASSUMED_NAME
+ REPO_DIR=$TOP_DIR
+ PACKAGE_DIR=$REPO_DIR/$ASSUMED_NAME
else
REPO_DIR="."
PACKAGE_DIR="."
cd "$REPO_DIR"
if [ ! -f "$ASSUMED_NAME/$SPECFILE" ]; then
- SPECFILE="$(basename $SPECFILE .spec).spec"
+ # XXX: still needed?
+ SPECFILE=$(basename $SPECFILE)
fi
if [ "$NOCVSSPEC" != "yes" ]; then
# create symlinks for tools
if [ "$SYMLINK_TOOLS" != "no" ]; then
- for a in dropin md5 adapter builder {relup,compile,repackage,rsync}.sh; do
+ for a in dropin md5 adapter builder {relup,compile,repackage,rsync,pearize}.sh; do
[ -f $a ] || continue
ln -s ../$a $ASSUMED_NAME
cvsignore_df $a
}
check_md5() {
+ local bad
[ "$NO5" = "yes" ] && return
update_shell_title "check md5"
for i in "$@"; do
- if good_md5 "$i" && good_size "$i"; then
- continue
+ bad=0
+ if ! good_md5 "$i"; then
+ echo -n "MD5 sum mismatch."
+ bad=1
+ fi
+ if ! good_size "$i"; then
+ echo -n "0 sized file."
+ bad=1
fi
- echo "MD5 sum mismatch or 0 size. Use -U to refetch sources,"
- echo "or -5 to update md5 sums, if you're sure files are correct."
- Exit_error err_no_source_in_repo $i
+ if [ $bad -eq 1 ]; then
+ echo " Use -U to refetch sources,"
+ echo "or -5 to update md5 sums, if you're sure files are correct."
+ Exit_error err_no_source_in_repo $i
+ fi
done
}
if echo $i | grep -vE '(http|ftp|https|cvs|svn)://' | grep -qE '\.(gz|bz2)$']; then
echo "Warning: no URL given for $i"
fi
+ target="$fp"
if [ -z "$NODIST" ] && [ -n "$srcmd5" ]; then
if good_md5 "$i" && good_size "$i"; then
echo "$fp having proper md5sum already exists"
continue
fi
- target="$fp"
# optionally prefer mirror over distfiles if there's mirror
# TODO: build url list and then try each url from the list
update_shell_title "${GETURI2%% *}: $url_attic"
${GETURI2} ${OUTFILEOPT} "$target" "$url_attic"
fi
+ test -s "$target" || rm -f "$target"
fi
fi
im="$i"
fi
update_shell_title "${GETURI%% *}: $im"
- ${GETURI} "$im" || \
+ ${GETURI} "$im" ${OUTFILEOPT} "$target" || \
if [ "`echo $im | grep -E 'ftp://'`" ]; then
update_shell_title "${GETURI2%% *}: $im"
- ${GETURI2} "$im"
+ ${GETURI2} "$im" ${OUTFILEOPT} "$target"
fi
+ test -s "$target" || rm -f "$target"
fi
if [ "$cvsup" = 1 ]; then
echo "- run cvs co SPECS"
echo "To checkout *all* packages:"
- echo "- run cvs up in $TOP_DIR/packages dir"
+ echo "- run cvs up -dP in $TOP_DIR/packages dir"
echo ""
echo "To commit with your developer account:"
-B | --branch )
COMMAND="branch"; shift; TAG="${1}"; shift;;
-c | --clean )
- CLEAN="--clean --rmspec --rmsource"; shift ;;
+ CLEAN="--clean"; shift ;;
-cf | --cvs-force )
CVS_FORCE="-F"; shift;;
-d | --cvsroot )
Exit_error err_invalid_cmdline "$1"
;;
*)
- SPECFILE="${1}"
+ SPECFILE=$1; shift
# check if specname was passed as specname:cvstag
if [ "${SPECFILE##*:}" != "${SPECFILE}" ]; then
CVSTAG="${SPECFILE##*:}"
SPECFILE="${SPECFILE%%:*}"
fi
+ # always have SPECFILE ending with .spec extension
+ SPECFILE=${SPECFILE%%.spec}.spec
ASSUMED_NAME=$(basename ${SPECFILE%%.spec})
- shift
esac
done
[ -d "$ASSUMED_NAME" ] && CVS_ENTRIES="$ASSUMED_NAME/CVS/Entries" || CVS_ENTRIES="CVS/Entries"
if [ -f "$CVS_ENTRIES" ] && [ -z "$CVSTAG" ]; then
- CVSTAG=$(awk -vSPECFILE=$(basename ${SPECFILE%.spec}.spec) -F/ '$2 == SPECFILE && $6 ~ /^T/{print substr($6, 2)}' ${CVS_ENTRIES})
+ CVSTAG=$(awk -vSPECFILE=$(basename $SPECFILE) -F/ '$2 == SPECFILE && $6 ~ /^T/{print substr($6, 2)}' ${CVS_ENTRIES})
if [ "$CVSTAG" ]; then
echo >&2 "builder: Sticky tag $CVSTAG active. Use -r TAGNAME to override."
fi
# display SMP make flags if set
smp_mflags=$(rpm -E %{?_smp_mflags})
if [ "$smp_mflags" ]; then
- echo >&2 "builder: SMP make flags are set to $smp_mflags"
+ echo "builder: SMP make flags are set to $smp_mflags"
fi
get_spec