From 49b44dc25b2664f0b2cbbed14a444d77c4d0ca07 Mon Sep 17 00:00:00 2001 From: blundellc Date: Mon, 15 Sep 2008 11:31:44 +0000 Subject: [PATCH] Merge branch/patch into trunk git-svn-id: svn://svn.r-forge.r-project.org/svnroot/cran2deb@162 edb9625f-4e0d-4859-8d74-9fd3b1da38cb --- trunk/R/debcontrol.R | 2 +- trunk/R/debianpkg.R | 1 + trunk/R/patch.R | 20 ++++++++++++++++++++ trunk/R/zzz.R | 1 + 4 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 trunk/R/patch.R diff --git a/trunk/R/debcontrol.R b/trunk/R/debcontrol.R index 84d9933..aa8ba8a 100644 --- a/trunk/R/debcontrol.R +++ b/trunk/R/debcontrol.R @@ -44,7 +44,7 @@ get_dependencies <- function(pkg,extra_deps) { depends <- lapply(depends,unique) # append the Debian dependencies - depends$build=c(depends$build,'debhelper (>> 4.1.0)','cdbs') + depends$build=c(depends$build,'debhelper (>> 4.1.0)','cdbs','dpatch') if (pkg$archdep) { depends$bin=c(depends$bin,'${shlibs:Depends}') } diff --git a/trunk/R/debianpkg.R b/trunk/R/debianpkg.R index 8d9bb65..31bdb96 100644 --- a/trunk/R/debianpkg.R +++ b/trunk/R/debianpkg.R @@ -127,6 +127,7 @@ prepare_new_debian <- function(pkg,extra_deps) { pkg$license <- accept_license(pkg) pkg$depends <- get_dependencies(pkg,extra_deps) + apply_patches(pkg) generate_changelog(pkg) generate_rules(pkg) generate_copyright(pkg) diff --git a/trunk/R/patch.R b/trunk/R/patch.R new file mode 100644 index 0000000..b9dc8ce --- /dev/null +++ b/trunk/R/patch.R @@ -0,0 +1,20 @@ +apply_patches <- function(pkg) { + patch_path = file.path(patch_dir, pkg$name) + if (!file.exists(patch_path)) { + notice('no patches in',patch_path) + return() + } + + # make debian/patches for simple-patchsys + deb_patch = pkg$debfile('patches') + if (!dir.create(deb_patch)) { + fail('could not create patches directory', deb_patch) + } + + # now just copy the contents of patch_path into debian/patches + for (patch in list.files(patch_path)) { + notice('including patch', patch) + file.copy(file.path(patch_path, patch), deb_patch) + } +} + diff --git a/trunk/R/zzz.R b/trunk/R/zzz.R index a576837..3255fe7 100644 --- a/trunk/R/zzz.R +++ b/trunk/R/zzz.R @@ -10,6 +10,7 @@ global("dinstall_archive", '/etc/cran2deb/archive') global("r_depend_fields", c('Depends','Imports')) # Suggests, Enhances global("scm_revision", 'svn:$Id$') + global("patch_dir", '/etc/cran2deb/patches') global("changesfile", function(srcname,version='*') { return(file.path(pbuilder_results ,paste(srcname,'_',version,'_' -- 2.39.2