Просмотр исходного кода

* cherry-pick a fix from apt--mvo--0 to check the ctime as well when packages are removed (because they are too old)

Patches applied:

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-53
   * check ctime as well in cron.daily when cleaning up packages in apt.cron.daily
Michael Vogt лет назад: 21
Родитель
Сommit
d713e67d4b
3 измененных файлов с 22 добавлено и 7 удалено
  1. 1 1
      configure.in
  2. 10 4
      debian/apt.cron.daily
  3. 11 2
      debian/changelog

+ 1 - 1
configure.in

@@ -18,7 +18,7 @@ AC_CONFIG_AUX_DIR(buildlib)
 AC_CONFIG_HEADER(include/config.h:buildlib/config.h.in include/apti18n.h:buildlib/apti18n.h.in)
 
 dnl -- SET THIS TO THE RELEASE VERSION --
-AC_DEFINE_UNQUOTED(VERSION,"0.6.40.1ubuntu2")
+AC_DEFINE_UNQUOTED(VERSION,"0.6.40.1ubuntu3")
 PACKAGE="apt"
 AC_DEFINE_UNQUOTED(PACKAGE,"$PACKAGE")
 AC_SUBST(PACKAGE)

+ 10 - 4
debian/apt.cron.daily

@@ -95,9 +95,9 @@ check_size_constraints()
 
     # check age
     if [ ! $MaxAge -eq 0 ] && [ ! $MinAge -eq 0 ]; then
-	find $Cache -name "*.deb"  -mtime +$MaxAge -and -not -mtime -$MinAge -print0 | xargs -r -0 rm -f
+	find $Cache -name "*.deb"  \( -mtime +$MaxAge -and -ctime +$MaxAge \) -and -not \( -mtime -$MinAge -or -ctime -$MinAge \) -print0 | xargs -r -0 rm -f
     elif [ ! $MaxAge -eq 0 ]; then
-	find $Cache -name "*.deb"  -mtime +$MaxAge -print0 | xargs -r -0 rm -f
+	find $Cache -name "*.deb"  -ctime +$MaxAge -and -mtime +$MaxAge -print0 | xargs -r -0 rm -f
     fi
     
     # check size
@@ -120,8 +120,14 @@ check_size_constraints()
 
 	    # check for MinAge of the file
 	    if [ ! $MinAge -eq 0 ]; then 
-		mtime=$(date --date=$(date -r $file --iso-8601) +%s)
-		delta=$(($now-$mtime))
+		# check both ctime and mtime 
+		mtime=$(date -c %Y $file)
+		ctime=$(stat -c %Z $file)
+		if [ $mtime -gt $ctime ]; then
+		    delta=$(($now-$mtime))
+		else
+		    delta=$(($now-$ctime))
+		fi
 		#echo "$file ($delta), $MinAge"
 		if [ $delta -le $MinAge ]; then
 		    #echo "Skiping $file (delta=$delta)"

+ 11 - 2
debian/changelog

@@ -1,3 +1,12 @@
+apt (0.6.40.1ubuntu3) breezy; urgency=low
+
+  * debian/apt.cron.daily:
+    - use the ctime as well when figuring what packages need to
+      be removed. This fixes the problem that packages copied with    
+      "cp -a" (e.g. from the installer) have old mtimes (ubuntu #14504)
+
+ -- Michael Vogt <michael.vogt@ubuntu.com>  Tue,  6 Sep 2005 18:30:46 +0200
+
 apt (0.6.40.1ubuntu2) breezy; urgency=low
 
   * improved the support for "error" and "conffile" reporting from
@@ -32,7 +41,7 @@ apt (0.6.40.1) unstable; urgency=low
 
 apt (0.6.40ubuntu1) breezy; urgency=low
 
-   * Synchronize with Debian
+  * Synchronize with Debian
 
  -- Matt Zimmerman <mdz@ubuntu.com>  Thu,  4 Aug 2005 15:53:22 -0700
 
@@ -94,7 +103,7 @@ apt (0.6.39) unstable; urgency=low
   * Update priority of apt-utils to important, to match the override file
   * Install only one keyring on each branch (Closes: #316119)
 
- -- Matt Zimmerman <mdz@ubuntu.com>  Tue, 28 Jun 2005 11:35:21 -0700
+ -- Matt Zimmerman <mdz@debian.org>  Tue, 28 Jun 2005 11:35:21 -0700
 
 apt (0.6.38ubuntu1) breezy; urgency=low