[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Problems with apt-cross -- libcache-apt-perl doesn't parse apt-cache output properly



I recently started having problems with apt-cross on my system.  It was failing to recognize the suite I was passing to it.  Everything is up to date on my Squeeze testing system, and I am using apt-cross 0.13.4 and libcache-apt-perl 0.13.4.  It seems that the problem stems from what I can only assume is a change in the output of 'apt-cache  policy'.  I found the offending line that is no longer matching in /usr/share/perl5/Cache/Apt/Config.pm and fixed it.  Below are the results of my debugging process.

Best Regards,

-Jim Heck

** Failing output of apt-cross

jheck@squeeze2:~/opt-crosslibs-101108$ apt-cross -v -a armel -m http://ftp.us.debian.org/debian/ -S testing -u
Use of uninitialized value $max_pri_suite in pattern match (m//) at /usr/share/perl5/Cache/Apt/Config.pm line 273.
Use of uninitialized value $Cache::Apt::Config::codename in pattern match (m//) at /usr/share/perl5/Cache/Apt/Config.pm line 274.
Use of uninitialized value $max_pri_suite in pattern match (m//) at /usr/share/perl5/Cache/Apt/Config.pm line 273.
Use of uninitialized value $Cache::Apt::Config::codename in pattern match (m//) at /usr/share/perl5/Cache/Apt/Config.pm line 274.
Use of uninitialized value $max_pri_suite in exists at /usr/share/perl5/Cache/Apt/Config.pm line 276.
Use of uninitialized value $max_pri_suite in hash element at /usr/share/perl5/Cache/Apt/Config.pm line 276.
Unable to determine apt-cache policy for Debian main! - using unstable. at /usr/bin/apt-cross line 156
Updating testing on armel using http://ftp.us.debian.org/debian/
debug: recreating /home/jheck/.apt-cross/sources.testing
Adding http://ftp.us.debian.org/debian/ to /home/jheck/.apt-cross/sources.testing
Updating apt-cache for armel
Get:1 http://ftp.us.debian.org testing Release.gpg [835 B]
...

** Current output of 'apt-cache policy' for my machine

jheck@squeeze2:~$ apt-cache policy
Package files:
 100 /var/lib/dpkg/status
     release a=now
 500 http://ftp.us.debian.org/debian/ testing/main i386 Packages
     release o=Debian,a=testing,n=squeeze,l=Debian,c=main
     origin ftp.us.debian.org
Pinned packages:

** Match line difference that gets everything working again in /usr/share/perl5/Cache/Apt/Config.pm

jheck@squeeze2:~$ diff -Naur /usr/share/perl5/Cache/Apt/Config.pm.orig /usr/share/perl5/Cache/Apt/Config.pm
--- /usr/share/perl5/Cache/Apt/Config.pm.orig    2010-02-27 14:12:31.000000000 -0500
+++ /usr/share/perl5/Cache/Apt/Config.pm    2010-11-08 13:25:58.000000000 -0500
@@ -244,7 +244,7 @@
     open POLICY, "apt-cache policy |" or carp "Unable to read apt policy: $!";
     return "unstable" unless <POLICY>;
     for (<POLICY>) {
-        if (/^\s*(\d+)\s(\w+):.*\s+(\w+)\/\w+\/?\w*\sPackages$/) {
+        if (/^\s*(\d+)\s(\w+):.*\s+(\w+)\/\w+\/?\s+\w+\s+Packages$/) {
             $cur_pri = $1;
             $codename = $3;
             # Improved to detect cdrom only installs. Anthony Sharobaiko <anthony@fiord.com>


** Working output from apt-cross with the above patch to /usr/share/perl5/Cache/Apt/Config.pm

jheck@squeeze2:~/opt-crosslibs-101108$ apt-cross -v -a armel -m http://ftp.us.debian.org/debian/ -S testing -u
Updating testing on armel using http://ftp.us.debian.org/debian/
debug: recreating /home/jheck/.apt-cross/sources.testing
Adding http://ftp.us.debian.org/debian/ to /home/jheck/.apt-cross/sources.testing
Updating apt-cache for armel
Get:1 http://ftp.us.debian.org testing Release.gpg [835 B]
...


Reply to: