[development] Cleaning up code for Fedora Packages

in #utopian-io6 years ago

Repository

https://github.com/fedora-infra/fedora-packages

Reducing Technical Debt

image.png

What is the project about?

Fedora Packages is a web app that lists software included in different Fedora repositories. It can be used to lookup what version of software will be shipped with the next Fedora release or to find a package source to upgrade the package (this thing will be important further).

For example, there is a great productivity tool called ranger that can be installed easily with dnf install ranger.

image.png

Because it is included in Fedora package repository, there is no need to compile it from source. But as you can see from command line that version is a little outdated and doesn't include all the latest greatness.

image.png

There would be no problem to use outdated version if it didn't contain a nasty bug with broken search which requires package update.

The ranger page on Fedora packages lists the available version of ranger, which is 1.7.2 for current released Fedora (fc28) and 1.7.2 for future Fedora release (always named Rawhide, or upcoming fc29).

image.png

That means nobody submitted work to bring ranger to a new version in future release.

image.png

What needs to be fixed?

To update a package to a new version, you need to find package source that only contains instructions for packaging and helper files. That's the way how package source is different from application source. The link to ranger package source is supposed to be in Sources tab of ranger page, but clicking the tab produces nothing and following Sources link directly produces error 404.

image.png

That is the thing that needs to be fixed - the Sources tab in Fedora Packages.

What was the solution?

I went to GitHub and filled a bug some weeks ago:

which was closed as a duplicate. I could not see that anybody was fixing that, and I decided to fix that myself, because it is open source. The first step was to get the project running on my machine, and - the system didn't run.

I ran into technical debt.

Technical Debt

Technical debt is some technology that new people can not pickup, and former developers don't have time to play with anymore. The way to deal with it is to either make the technology more attractive, or to port it to more modern stack. I decided to try the latter. Fedora Packages contains a lot of references to some fedoracommunity package, and its deployment scripts are located elsewhere, so my time was spent into researching how fedoracommunity is related to fedora-packages, then I updated documentation and removed things that are 100% not used anymore.

Work done

image.png

Except for minor README fixes submitted by other people, I've submitted few PRs while learning codebase details.

The broken thing that was missing is that fedora-packages requires more files to be downloaded during the build process. One of these files was Xapian Database with indexed packages, and the URL for that gone 404.

We've been able to restore the missing database thanks to cooperation of https://github.com/cverna who retained repository rights after previous maintainer left the project. He merged all PRs and helped to switch the primary branch from develop to master and now the workflow is more smooth for future git merges and rebases for other contributors. Now everybody can run fedora-packages locally and start contributing fixes without additional hassle.

git clone [email protected]:fedora-infra/fedora-packages.git
cd fedora-packages/devel
docker-compose up

Run the code above and follow http://127.0.0.1/packages and if it doesn't work - fill an issue to get in touch.

Roadmap

The goal is still to bring technical debt to minimum to allow new people making contributions faster. There is an idea for Standard layout for Python web applications which is still work in process, and the core of it is that project layout should be machine-readable so machines can help people. Then one day my personal bot could checkout a project, safely run it in container, and it if works - give me the editor window to fix just the bug I need with all that handy live reloading and backround test runners already in place.

The plan for near future.

  • Decouple Python application from Apache
    • Map static resources independently of Apache config
  • Fix missing images in docker-compose setup (need to fetch them)
    • Move dependencies out of Docker and Vagrant scripts into single script
    • Factor out static cache refresh into separate app (Flask maybe)
  • Document current deployment process with Ansible
  • Fix the bug with the Sources tab
  • Deal with the rest of fedora-packages issues

GitHub Account

https://github.com/abitrolly

Sort:  

Hi there,

Welcome to Utopian. Great to see more people onboarding to STEEM/Utopian ecosystem.

While I really appreciate what you do, in the development category we expect more than READMEchanges. Our questionnaire is not really useful in this cases so I have manually given a score to your contribution.

If you follow our guidelines you will get much better review scores on your future contributions.

Thank you.


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

There are changes beyond README fixes. Ripping away stale code without knowing the codebase while ensuring that it doesn't break anything requires the same time investment. Such commits look simple, but they imply work with repo history and testing. Clearing technical debt is not the easy task to review without knowing how bad of good is the codebase, but my opinion that this type of work is no less valuable and time consuming that writing new code in terms of required expertise and impact for the project and future contributions. Otherwise I wouldn't spent 5 hours writing this post. =)

Perhaps it would be easier to review if I have mentioned that it all started, because dev environment didn't start up for unknown reason and I had to pick up codebase from scratch. Anyway, thanks for review. Is there a way to see my score?

Hey abitrolly,

I totally hear you. However, we need to follow the standard review questionnaire to make sure the every contribution treated equally. Most of the questionnaire consists of "code changes" as you may see.

We don't share the scores with contributors, we share the review answers normally but it's not applicable to your case.

Hi emrebeyler. If code cleanups are not applicable, then what category should I have filled this in? There is no separate open-source tag that could cover this.

@emrebeyler you were flagged by a worthless gang of trolls, so, I gave you an upvote to counteract it! Enjoy!!

@emrebeyler you were flagged by a worthless gang of trolls, so, I gave you an upvote to counteract it! Enjoy!!

Hey @abitrolly
Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!

Congratulations @abitrolly! You have completed the following achievement on Steemit and have been rewarded with new badge(s) :

You published your First Post
You got a First Vote

Click on the badge to view your Board of Honor.
If you no longer want to receive notifications, reply to this comment with the word STOP

To support your work, I also upvoted your post!

Do not miss the last post from @steemitboard:
SteemitBoard World Cup Contest - The results, the winners and the prizes

Do you like SteemitBoard's project? Then Vote for its witness and get one more award!

Congratulations @abitrolly! You have completed the following achievement on Steemit and have been rewarded with new badge(s) :

Award for the number of upvotes received

Click on the badge to view your Board of Honor.
If you no longer want to receive notifications, reply to this comment with the word STOP

Do not miss the last post from @steemitboard:
SteemitBoard World Cup Contest - The results, the winners and the prizes

Do you like SteemitBoard's project? Then Vote for its witness and get one more award!

Congratulations @abitrolly! You have completed the following achievement on Steemit and have been rewarded with new badge(s) :

You made your First Comment

Click on the badge to view your Board of Honor.
If you no longer want to receive notifications, reply to this comment with the word STOP

Do not miss the last post from @steemitboard:
SteemitBoard World Cup Contest - The results, the winners and the prizes

Do you like SteemitBoard's project? Then Vote for its witness and get one more award!

Congratulations @abitrolly! You have completed the following achievement on Steemit and have been rewarded with new badge(s) :

You got your First payout
Award for the total payout received

Click on the badge to view your Board of Honor.
If you no longer want to receive notifications, reply to this comment with the word STOP

Do you like SteemitBoard's project? Then Vote for its witness and get one more award!