You are not logged in.

#1 2008-05-23 07:44:08

abhidg
Member
From: City of Kol
Registered: 2006-07-01
Posts: 184
Website

pac-file: search for a particular file in the repositories

I made a tool to search the filelists generated by Pierre here:
http://dev.archlinux.org/~pierre/test-repo

Syntax: pac-file sync  (to synchronize)
pac-file search <filename> (to search)

Configuration file is at $HOME/.config/pac-file.conf

#!/bin/bash

mkdir -p $HOME/.local/share/pac-file
store="$HOME/.local/share/pac-file" # default location
repos=(core extra community)
a=$(uname -m)
url="http://dev.archlinux.org/~pierre/test-repo"

if [ -f $HOME/.config/pac-file.conf ];then
    . $HOME/.config/pac-file.conf
fi


case $1 in
  sync) 
    echo "synchronising file cache"
    cd $store || exit 1
    for i in ${repos[@]}
    do
        rm $i.files.tar.gz
        rm -rf $i; mkdir $i 
        wget $url/$i/os/$a/$i.files.tar.gz || exit 1
        tar zxf $i.files.tar.gz -C ./$i
    done
    echo "sync complete."
    ;;
  search)
    cd $store
    grep -R $2 . | sed "s/\.\/\(.*\)\/files:/\1 /g"
    ;;
  *)
    echo "usage: $0 {sync|search}"
esac
exit 0

Offline

#2 2008-05-23 08:20:14

Pierre
Developer
From: Bonn
Registered: 2004-07-05
Posts: 1,954
Website

Re: pac-file: search for a particular file in the repositories

Nice to see some efforts here. :-) Those files will be on every mirror soon, so they will disappear from my home dir. Then one can parse pacman.conf and mirrorlist and get those files from the same mirror pacman uses.

Another hint: those files are updated hourly but only if there are changes. So you can check the mtime before downloading. And for those who think about puting those data into a database: the files within the archive have an mtime, too. ;-) (they are created incrementally).

I have implemented a webfrontend for this. A bad example of how to incrementally feed a mysql database with this data can be found at http://git.archlinux.de/cgit.cgi?url=ww … FileDB.php

Pierre

Offline

#3 2008-06-23 17:54:22

PeteMo
Member
From: H'Burg, VA
Registered: 2006-01-26
Posts: 191
Website

Re: pac-file: search for a particular file in the repositories

I've created a similar script that uses the mirrors specified in /etc/pacman.d/mirrorlist and only downloads the filelists for the repos enabled in /etc/pacman.conf.  You can get it here

usage: pac-file [options] [pattern]

Search package filelists for [pattern].
options:
  pac-file [-h --help]      Print this help message.
  pac-file [-S --sync]      Syncronize package filelists.

Let me know if you run into any bugs!

Offline

#4 2008-06-23 18:28:07

Pierre
Developer
From: Bonn
Registered: 2004-07-05
Posts: 1,954
Website

Re: pac-file: search for a particular file in the repositories

Sounds nice. What about putting it into community; maybe pacman-contrib.

Offline

Board footer

Powered by FluxBB