Package: apt-mirror
Version: 0.4.8-3
Severity: normal
Tags: patch
User: [email protected]
Usertags: origin-ubuntu natty ubuntu-patch
*** /tmp/tmpwNwaBO
In Ubuntu, the attached patch was applied to achieve the following:
This patch moves the directory creation after the config parsing.
* fix LP: #727011 - apt-mirror will not automatically create directories if
base_path is non-default; Thanks to Rob Verduijn for the patch
- add debian/patches/create_dirs.patch
- update debian/patches/series
Thanks for considering the patch.
-- System Information:
Debian Release: squeeze/sid
APT prefers natty-updates
APT policy: (500, 'natty-updates'), (500, 'natty-security'), (500,
'natty-proposed'), (500, 'natty-backports'), (500, 'natty')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.38-7-generic (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=UTF-8) (ignored: LC_ALL set to en_US.UTF-8)
Shell: /bin/sh linked to /bin/dash
diff -Nru apt-mirror-0.4.8/debian/changelog apt-mirror-0.4.8/debian/changelog
diff -Nru apt-mirror-0.4.8/debian/patches/create_dirs.patch apt-mirror-0.4.8/debian/patches/create_dirs.patch
--- apt-mirror-0.4.8/debian/patches/create_dirs.patch 1969-12-31 18:00:00.000000000 -0600
+++ apt-mirror-0.4.8/debian/patches/create_dirs.patch 2011-03-22 23:19:43.000000000 -0500
@@ -0,0 +1,69 @@
+Description: Create directories after config is parsed
+ If the base_path isn't default, the directories needed will not be created.
+ Move the directory creation after the config parsing to facilitate creating
+ in non-default directories.
+Author: Rob Verduijn
+Bug-Ubuntu: https://bugs.launchpad.net/bugs/727011
+---
+ apt-mirror | 21 +++++++++++----------
+ 1 file changed, 11 insertions(+), 10 deletions(-)
+
+Index: apt-mirror-0.4.8/apt-mirror
+===================================================================
+--- apt-mirror-0.4.8.orig/apt-mirror
++++ apt-mirror-0.4.8/apt-mirror
+@@ -229,26 +229,16 @@
+ while(scalar @childrens) {
+ my $dead = wait();
+ @childrens = grep { $_ != $dead } @childrens;
+ print "[" . scalar(@childrens) . "]... ";
+ }
+ print "\nEnd time: " . localtime() . "\n\n";
+ }
+
+-######################################################################################
+-## Create the 3 needed directories if they don't exist yet
+-my @needed_directories = (get_variable("mirror_path"), get_variable("skel_path"), get_variable("var_path"));
+-foreach my $needed_directory (@needed_directories) {
+- unless (-d $needed_directory) {
+- mkdir($needed_directory) or die("apt-mirror: can't create $needed_directory directory");
+- }
+-}
+-
+-######################################################################################
+ ## Parse config
+
+ open CONFIG, "<$config_file" or die("apt-mirror: can't open config file ($config_file)");
+ while(<CONFIG>) {
+ next if /^\s*#/;
+ next unless /\S/;
+ my @config_line = split;
+ my $config_line = shift @config_line;
+@@ -290,16 +280,27 @@
+ }
+
+ die("apt-mirror: invalid line in config file ($.: $config_line ...)");
+ }
+ close CONFIG;
+
+ die("Please explicitly specify 'defaultarch' in mirror.list") unless get_variable("defaultarch");
+
++######################################################################################
++## Create the 3 needed directories if they don't exist yet
++my @needed_directories = (get_variable("mirror_path"), get_variable("skel_path"), get_variable("var_path"));
++foreach my $needed_directory (@needed_directories) {
++ unless (-d $needed_directory) {
++ mkdir($needed_directory) or die("apt-mirror: can't create $needed_directory directory");
++ }
++}
++#
++#######################################################################################
++
+ check_lock();
+
+ $SIG{INT} = "unlock_aptmirror";
+ $SIG{HUP} = "unlock_aptmirror";
+ $SIG{TERM} = "unlock_aptmirror";
+
+ lock_aptmirror();
+
diff -Nru apt-mirror-0.4.8/debian/patches/series apt-mirror-0.4.8/debian/patches/series
--- apt-mirror-0.4.8/debian/patches/series 2010-09-28 16:46:12.000000000 -0500
+++ apt-mirror-0.4.8/debian/patches/series 2011-03-22 16:03:37.000000000 -0500
@@ -1 +1,2 @@
shebang.patch
+create_dirs.patch