Skip to content

A web app to demo parsing Debian package control files using Deb-Parse

Notifications You must be signed in to change notification settings

aihaddad/deb-parse-web

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deb-Parse-Web

Challenge:

A small app that exposes some key information about packages in a Debian control file via a web interface.

I broke this down in two. First, I wrote a simple parser in Python; then packaged it and distributed it on PyPi. Lastly, I wrote this Flask web app that depends on that package to demonstrate how it works.


See it in action


Run it locally

$ git clone git@github.com:aihaddad/deb-parse-web.git
$ cd deb-parse-web

Create a .env file with the following information:

FLASK_APP=deb_parse_web/app.py
FLASK_DEBUG=1
UPLOAD_FOLDER=deb_parse_web/uploads

This app doesn't connect to any database, so you don't have to worry about that.

Next, make sure you have Python >= 3.7 and pipenv installed and:

$ pipenv install
...

and activate the virtual environment:

$ pipenv shell
...
(deb-parse-web) $

Then comes, Flask:

$ flask run

The app should be running on http://localhost:5000/

Usage

You will be greeted with a file input form. Browse and upload your sample control file. You will be redirected to a packages index page at http://localhost:5000/XXXX/packages/. You can then check the clean details of every package individually.

XXXX is a four-digit randomly generated recovery_id, use it to get back to the same results of this specific operation as long as they are alive. It's a rudimentary method I used to store, namespace and subdomain parsed results without relying on a database. This is a demo, so data integrity is not important. In the online version, all files will be only stored on the instance store, so they will be lost when the instance stops.

API Endpoints

JSON-formatted results will also be available for your benefit:

http://localhost:5000/XXXX/api/packages/raw     -> list of raw package information
http://localhost:5000/XXXX/api/packages/clean   -> list of cleaned-up information; same used by the web app
http://localhost:5000/XXXX/api/packages/list    -> list of just the package names

Development

There are probably a few opportunities for refactoring. I've personally already identified a couple, at least one in this app, and one in the parser package. This is a learning project and to the best of my knowledge, everything works fine for now. So, I will get on with other projects first, and maybe revisit this later.

About

A web app to demo parsing Debian package control files using Deb-Parse

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages