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

Re: Making APT prefer locally compiled packages



On Mon, Sep 25, 2006 at 02:00:02AM -0500, Adam Porter wrote:
> This is a little confusing, and please forgive me if the answer is out there
> somewhere, but I haven't been able to find it.  Here's what happened:
> 
> 1.  I installed pentium-builder and set it for "athlon-xp" so it will
> compile for my CPU.
> 2.  $ apt-src -i install nvidia-glx
> 3.  $ apt-cache policy nvidia-glx
> 
> nvidia-glx:
>   Installed: 1.0.8774-3
>   Candidate: 1.0.8774-3
>   Version table:
>      1.0.8774-3 0
>         800 http://ftp.us.debian.org unstable/non-free Packages
>  *** 1.0.8774-3 0
>         100 /var/lib/dpkg/status
> 
> Notice that even though the versions are the same, it's seeing them as
> different packages.
> 
That is because the versions are the same, but the md5sums are
different.  You can force it to prefer yours if you setup a local
repository.  If you are interested in doing that, here is a HOWTO I have
written:

http://people.connexer.com/~roberto/howtos/debrepository

> 
> $ cat /etc/apt/preferences
> Package: *
> Pin: release o=""
> Pin-Priority: 900
> 
> Package: *
> Pin: release a=testing
> Pin-Priority: 900
> 
> Package: *
> Pin: release a=unstable
> Pin-Priority: 800
> 
> 
> That's straight out of the apt_preferences man page.  Didn't work.  So
> finally I found a bug report on apt, bug #351056, that pointed me to the
> MD5sum of the packages:
> 
> 
> $ apt-cache show nvidia-glx
> ...
> Suggests: nvidia-settings, nvidia-kernel-source (>= 1.0.8774)
> Conflicts: nvidia-glx-src
> Filename:
> pool/non-free/n/nvidia-graphics-drivers/nvidia-glx_1.0.8774-3_i386.deb
> Size: 3293444
> MD5sum: 6e393e5d637a15096df1c19935db2567
> SHA1: 00dcc698272d2a76594cd9e4a3afb57fce9a059e
> SHA256: 5a8267d909944e19aec748ad5ab4e63ec769dbe73a03ff96007315a4ef0a1e80
> Description: NVIDIA binary XFree86 4.x driver
> ...
> Suggests: nvidia-settings, nvidia-kernel-source (>= 1.0.8774)
> Conflicts: nvidia-glx-src
> Conffiles:
>  /etc/default/nvidia-glx 81be77103c93a6a52273ba4d0ce8006b
>  /etc/init.d/nvidia-glx 58f85e292ae2141c64b6490e19fc3f91
> Description: NVIDIA binary XFree86 4.x driver
> 
> 
> Notice that the listing for the second package, the one that's currently
> installed, has no MD5sum, or SHA sums.  (I'm not sure why it doesn't have
> any, though I'm guessing it's because I just installed the package with
> dpkg and didn't create a local repository.)
> 
> But even if it had them, I still think it would be a problem, because I
> compiled it with "-mcpu=athlon-xp", so the binaries should be different.
> 
> So, how do I get apt to prefer the local, already-installed package when
> it's the same version number, but the MD5sum may differ or even be
> nonexistant for the already-installed package?
> 
> (And, of course, this is not just a problem for the nvidia-glx package, but
> any others as well.)
> 
> (And I know about apt-build, but it has its own set of problems that
> sometimes forces you to use other ways of compiling packages.)
> 
Is I mentioned above, you can create your own local repository.  Another
possibility is to download the source first and add a changelog entry
bumping the version.

For your nvidia-glx package, you can do something like:
1.0.8774-3 -> 1.0.8774-3~porter0 OR
1.0.8774-3 -> 1.0.8774-3.0.0.porter.0

I also talk about version number selection for customized packages in my
Debian package customization HOWTO:

http://people.connexer.com/~roberto/howtos/debcustomize

Either one should still prefer your version over the archive's
1.0.8774-3, but when 1.0.8774-4 or newer comes out, it will show up as
upgradable.  I am guesing that you want that sort of behavioer so that
you know when to rebuild your package.

Regards,

-Roberto

-- 
Roberto C. Sanchez
http://people.connexer.com/~roberto
http://www.connexer.com

Attachment: signature.asc
Description: Digital signature


Reply to: