shutils: improve how the patches are applied.
Now all patches must be placed in PATCHESDIR (templatesdir/$pkgname/patches) and must be in -p0 format. If other args are required, a same file with .args extension should be created with specific args inside of it. --HG-- extra : convert_revision : xtraeme%40gmail.com-20091015140224-x5n026mdhwb4pvyq
This commit is contained in:
parent
9296d25811
commit
e056e23be1
@ -1,5 +1,5 @@
|
|||||||
#-
|
#-
|
||||||
# Copyright (c) 2008 Juan Romero Pardines.
|
# Copyright (c) 2008-2009 Juan Romero Pardines.
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# Redistribution and use in source and binary forms, with or without
|
# Redistribution and use in source and binary forms, with or without
|
||||||
@ -24,57 +24,57 @@
|
|||||||
#-
|
#-
|
||||||
|
|
||||||
#
|
#
|
||||||
# Applies to the build directory the patches specified by a template.
|
# Applies to the build directory all patches found in PATCHESDIR
|
||||||
|
# (templates/$pkgname/patches).
|
||||||
#
|
#
|
||||||
apply_tmpl_patches()
|
apply_tmpl_patches()
|
||||||
{
|
{
|
||||||
local patch=
|
local patch_files args patch i
|
||||||
local i=
|
|
||||||
|
|
||||||
# Apply some build/install patches automatically.
|
[ ! -d $PATCHESDIR ] && return 0
|
||||||
if [ -f $XBPS_TEMPLATESDIR/$pkgname/build.diff ]; then
|
|
||||||
patch_files="build.diff $patch_files"
|
|
||||||
fi
|
|
||||||
if [ -f $XBPS_TEMPLATESDIR/$pkgname/install.diff ]; then
|
|
||||||
patch_files="install.diff $patch_files"
|
|
||||||
fi
|
|
||||||
|
|
||||||
[ -z "$patch_args" ] && patch_args="-p0"
|
for f in $(echo $PATCHESDIR/*); do
|
||||||
[ -z "$patch_files" ] && return 0
|
if $(echo $f|grep -q '.args'); then
|
||||||
|
|
||||||
#
|
|
||||||
# If package needs some patches applied before building,
|
|
||||||
# apply them now.
|
|
||||||
#
|
|
||||||
for i in ${patch_files}; do
|
|
||||||
patch="$XBPS_TEMPLATESDIR/$pkgname/$i"
|
|
||||||
if [ ! -f "$patch" ]; then
|
|
||||||
msg_warn "unexistent patch: $i."
|
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
patch_files="$patch_files $f"
|
||||||
|
done
|
||||||
|
|
||||||
cp -f $patch $wrksrc
|
for i in ${patch_files}; do
|
||||||
|
args="-Np0"
|
||||||
|
patch=$(basename $i)
|
||||||
|
if [ -f $PATCHESDIR/$patch.args ]; then
|
||||||
|
args=$(cat $PATCHESDIR/$patch.args)
|
||||||
|
fi
|
||||||
|
cp -f $i $wrksrc
|
||||||
|
|
||||||
# Try to guess if its a compressed patch.
|
# Try to guess if its a compressed patch.
|
||||||
if $(echo $patch|grep -q '.diff.gz'); then
|
if $(echo $i|grep -q '.diff.gz'); then
|
||||||
gunzip $wrksrc/$i
|
gunzip $wrksrc/$patch
|
||||||
patch=${i%%.gz}
|
patch=${patch%%.gz}
|
||||||
elif $(echo $patch|grep -q '.diff.bz2'); then
|
elif $(echo $i|grep -q '.patch.gz'); then
|
||||||
bunzip2 $wrksrc/$i
|
gunzip $wrksrc/$patch
|
||||||
patch=${i%%.bz2}
|
patch=${patch%%.gz}
|
||||||
elif $(echo $patch|grep -q '.diff'); then
|
elif $(echo $i|grep -q '.diff.bz2'); then
|
||||||
patch=$i
|
bunzip2 $wrksrc/$patch
|
||||||
|
patch=${patch%%.bz2}
|
||||||
|
elif $(echo $i|grep -q '.patch.bz2'); then
|
||||||
|
bunzip2 $wrksrc/$patch
|
||||||
|
patch=${patch%%.bz2}
|
||||||
|
elif $(echo $i|grep -q '.diff'); then
|
||||||
|
:
|
||||||
|
elif $(echo $i|grep -q '.patch'); then
|
||||||
|
:
|
||||||
else
|
else
|
||||||
msg_warn "unknown patch type: $i."
|
msg_warn "unknown patch type: $i."
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd $wrksrc && patch -s ${patch_args} < \
|
cd $wrksrc && patch -s ${args} < $patch 2>/dev/null
|
||||||
$patch 2>/dev/null
|
if [ $? -eq 0 ]; then
|
||||||
if [ "$?" -eq 0 ]; then
|
msg_normal "Patch applied: $patch."
|
||||||
msg_normal "Patch applied: $i."
|
|
||||||
else
|
else
|
||||||
msg_error "couldn't apply patch: $i."
|
msg_error "couldn't apply patch: $patch."
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ reset_tmpl_vars()
|
|||||||
local TMPL_VARS="pkgname distfiles configure_args configure_env \
|
local TMPL_VARS="pkgname distfiles configure_args configure_env \
|
||||||
make_build_args make_install_args build_style \
|
make_build_args make_install_args build_style \
|
||||||
short_desc maintainer long_desc checksum wrksrc \
|
short_desc maintainer long_desc checksum wrksrc \
|
||||||
patch_files make_cmd base_chroot register_shell \
|
make_cmd base_chroot register_shell \
|
||||||
make_build_target configure_script noextract nofetch \
|
make_build_target configure_script noextract nofetch \
|
||||||
pre_configure pre_build pre_install configure_shell \
|
pre_configure pre_build pre_install configure_shell \
|
||||||
post_configure post_build post_install \
|
post_configure post_build post_install \
|
||||||
@ -74,13 +74,13 @@ reset_tmpl_vars()
|
|||||||
sgml_catalogs xml_catalogs xml_entries sgml_entries \
|
sgml_catalogs xml_catalogs xml_entries sgml_entries \
|
||||||
build_depends libtool_fixup_la_stage no_fixup_libtool \
|
build_depends libtool_fixup_la_stage no_fixup_libtool \
|
||||||
disable_parallel_build run_depends cross_compiler \
|
disable_parallel_build run_depends cross_compiler \
|
||||||
only_for_archs patch_args conf_files keep_dirs \
|
only_for_archs conf_files keep_dirs \
|
||||||
noarch subpackages sourcepkg gtk_iconcache_dirs \
|
noarch subpackages sourcepkg gtk_iconcache_dirs \
|
||||||
abi_depends api_depends triggers openrc_services \
|
abi_depends api_depends triggers openrc_services \
|
||||||
libtool_no_delete_archives \
|
libtool_no_delete_archives \
|
||||||
XBPS_EXTRACT_DONE XBPS_CONFIGURE_DONE \
|
XBPS_EXTRACT_DONE XBPS_CONFIGURE_DONE \
|
||||||
XBPS_BUILD_DONE XBPS_INSTALL_DONE FILESDIR DESTDIR \
|
XBPS_BUILD_DONE XBPS_INSTALL_DONE FILESDIR DESTDIR \
|
||||||
SRCPKGDESTDIR"
|
SRCPKGDESTDIR PATCHESDIR"
|
||||||
|
|
||||||
for v in ${TMPL_VARS}; do
|
for v in ${TMPL_VARS}; do
|
||||||
eval unset "$v"
|
eval unset "$v"
|
||||||
@ -212,6 +212,7 @@ set_tmpl_common_vars()
|
|||||||
[ -z "$pkgname" ] && return 1
|
[ -z "$pkgname" ] && return 1
|
||||||
|
|
||||||
FILESDIR=${XBPS_TEMPLATESDIR}/${pkgname}/files
|
FILESDIR=${XBPS_TEMPLATESDIR}/${pkgname}/files
|
||||||
|
PATCHESDIR=${XBPS_TEMPLATESDIR}/${pkgname}/patches
|
||||||
DESTDIR=${XBPS_DESTDIR}/${pkgname}-${version}
|
DESTDIR=${XBPS_DESTDIR}/${pkgname}-${version}
|
||||||
if [ -z "${sourcepkg}" ]; then
|
if [ -z "${sourcepkg}" ]; then
|
||||||
sourcepkg=${pkgname}
|
sourcepkg=${pkgname}
|
||||||
|
Loading…
Reference in New Issue
Block a user