repose icon indicating copy to clipboard operation
repose copied to clipboard

Rewrite in Rust

Open vodik opened this issue 8 years ago • 6 comments

I've spent a day and currently at about 20% - can load the database and read through it, so looks like its going to be mostly smooth sailing. The current design of repose is already rather compatible with how Rust would want things architected.

Problems I'm hitting which is making me thing this is the right path:

  • Enhancing the parsers to deal with possible regressions (from #44). I'm not comfortable anymore with the longevity of ragel
  • Enhancing the internal data structures to support new features (#29 and #43). Doesn't help that the new hashmap I was attempting to implement is already very very similar to how Rust implements theirs.
  • Creating a library (#30). There is some subtle memory corruption going on somewhere inside repose that, while it operates correctly, prevents me from putting in inside a library. I currently take advantage of the short/one-time usage of this tool and just let the os reap the pkgcache's memory. Now while this should be fixable with some digging/valgrind (or with replacing the hashmap, see above), I think I'd rather have something up on crates.io.

vodik avatar Jan 24 '17 19:01 vodik

How would this impact repo packages (i.e., for Arch)? Afaik, rust doesn't have a stable ABI yet so things like shared libraries are a bit harder.

AladW avatar Jan 26 '17 23:01 AladW

@AladW didn't look into it, but Arch Linux already carries packages of software written in Rust. There's also cargo-pkgbuild.

vodik avatar Jan 30 '17 21:01 vodik

Got to the point where I can load an existing database (*.db/*.files) entirely into memory, parsing both the tar ball directory structure and the desc files, and then implemented an equivalent --list operator.

Its measurably faster. This is a good sign.

vodik avatar Jan 30 '17 21:01 vodik

Another milestone reached tonight - can now parse PKGINFO files:

Package {
    name: "repose-git",
    version: "6.2.10.gbab93f3-1",
    arch: Arch(
        "x86_64"
    ),
    metadata: {
        Url: Text(
            "http://github.com/vodik/repose"
        ),
        Packager: Text(
            "Simon Gomizelj <[email protected]>"
        ),
        Conflicts: List(
            [
                "repose"
            ]
        ),
        Depends: List(
            [
                "pacman",
                "libarchive",
                "gnupg"
            ]
        ),
        License: List(
            [
                "GPL"
            ]
        ),
        Provides: List(
            [
                "repose"
            ]
        ),
        Description: Text(
            "A archlinux repo building tool"
        ),
        BuildDate: Timestamp(
            1477843787
        ),
        PackageSize: Size(
            63488
        ),
        MakeDepends: List(
            [
                "git",
                "ragel"
            ]
        )
    }
}

All that's left is:

  1. Diffing database against local filesystem
  2. Writing database to disk
  3. Ensuring symlinks works

vodik avatar Feb 02 '17 06:02 vodik

Database handling should now be functionally equivalent. As in, packages can be loaded from the filesystem and compiled into a valid database. All that's left to add:

  • pool/root symlinking
  • filtering support

Then spend some serious time cleaning up the code base as its awful, but as least functional enough that I can't release it as a beta.

vodik avatar Feb 13 '17 04:02 vodik

Hey I found this repo on crates.io so I was pretty confused when the upstream repo was in C.

Anyway now that I see this issue I see that was an experimental rewrite. looking at the rust branch now it's been untouched for the last two years.

So are there any plans to continue with it? And would you accept contributions towards it?

Although personally I'm looking for a rust library, not an executable. So assuming you want to continue with the rust code, would you also approve of a lib-repose/repose split?

Morganamilo avatar Mar 18 '19 00:03 Morganamilo