gnu-arch-users
[Top][All Lists]
Advanced

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

[Gnu-arch-users] Automatic archive discovery, take 1


From: Andrew Suffield
Subject: [Gnu-arch-users] Automatic archive discovery, take 1
Date: Sun, 14 Dec 2003 04:43:41 +0000
User-agent: Mutt/1.5.4i

Here's a rough-but-functional, lightweight archive discovery
system. This is something of an experiment; if this works well, it
could be rewritten as part of tla proper. First, a new hook for tla:

--- orig/libarch/archive.c
+++ mod/libarch/archive.c
@@ -140,7 +140,13 @@
   struct arch_archive * answer = 0;
   t_uchar * location = 0;
 
-  location = arch_archive_location (name, 0);
+  location = arch_archive_location (name, 1);
+
+  if (!location)
+    {
+      arch_run_hook ("find-archive", "ARCH_ARCHIVE", name, 0);
+      location = arch_archive_location (name, 0);
+    }
 
   answer = arch_archive_connect_location (name, location, want_mirror_of);
   lim_free (0, answer->name);


(Too trivial for me to spend time creating a branch for it)

Secondly, the archive discovery script itself (tla-find-archive),
which is attached. This requires libwww-perl.

Thirdly, you need a ~/.arch-params/archive-list, which forms the
starting point for searches.

An archive list file is a list of "name location" pairs, one per
line. In the simple form, an archive name is used:

address@hidden http://arch.quackerhead.com/~lord/archives/address@hidden

The other form is a prefix match, which is indicated by ending the
name with a *:

address@hidden http://people.debian.org/~asuffield/archive-list

This instructs tla-find-archive that in orderto find archives
beginning with the string "address@hidden", retrieve
http://people.debian.org/~asuffield/archive-list and process it as an
archive list. http, ftp, and file URI schemes are currently supported.

The list is processed in sequence; if multiple names could match, the
first is used.

To set it up:

 - put tla-find-archive somewhere in your $PATH
 - put this or equivalent in ~/.arch-params/hook
   (shell script variation):

case "$1" in
    find-archive)
        tla-find-archive "$ARCH_ARCHIVE"
        exit $?
        ;;
esac

 - put this in ~/.arch-params/archive-list:

* http://people.debian.org/~asuffield/big-archive-list


I will be maintaining
http://people.debian.org/~asuffield/big-archive-list as a list of
publically accessible archives, for now (it's presently the set which
I happen to have registered on this workstation). Let me know if you
have a public archive which isn't listed. I express a preference for
references to your own archive list file, so that I can wildcard based
on your mail address, rather than including archives directly.

If you had a list of site-specific archives, you could do something
like this in your archive-list:

address@hidden http://internal/archive-list
* http://people.debian.org/~asuffield/big-archive-list

Or you could do this:

---8<--- ~/.arch-params/archive-list ---
* http://internal/archive-list
----------------------------------------

---8<--- http://internal/archive-list --
# Some local archives go here
...
# Default reference for anything else
* http://people.debian.org/~asuffield/big-archive-list
----------------------------------------

-- 
  .''`.  ** Debian GNU/Linux ** | Andrew Suffield
 : :' :  http://www.debian.org/ |
 `. `'                          |
   `-             -><-          |

Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]