Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes i3 bar icons by including FontAwesome #2

Merged

Conversation

2 participants
@PreciousChicken
Copy link

commented Jun 13, 2019

Fixes regolith-linux/regolith-i3blocks#1

Icons used in i3 bar (e.g. cog, calendar) fail to display if FontAwesome not specifically listed. This bug not apparent in all circumstances, e.g. clean install of Ubuntu.

Unsure why there are two files containing this config detail, but thought safest is to update both?

@kgilmer

This comment has been minimized.

Copy link
Member

commented Jun 14, 2019

Thank you @PaleAugust! This is great, and updates the code as we'd expect. But, it turns out there is a different approach with more steps which involves updating the package. There are a number of good reasons for this but in essence it allows subscribers to the Regolith repository to know there is an update available to them. To do this we modify the Debian package files and use a patching tool called quilt. So, we can do one of two things;

  1. I can adapt your changes into a different commit that would include the Debian packaging stuff, and of course let you see what I did if you're curious.
  2. I can give you some general pointers and/or specific steps to take of what's outlined above, and you can update this PR with the necessary package metadata.

What would you like to do?

@PreciousChicken

This comment has been minimized.

Copy link
Author

commented Jun 14, 2019

Apologies for not doing this correctly @kgilmer, I am super new to this. I am keen to learn however so would like to try option 2) - providing of course you have the time to help out. If you are busy, I'm 100% happy with you just doing this yourself (which clearly will take far less time). Would you be able to guide me in the direction I need to take; I can then have another go?

@kgilmer

This comment has been minimized.

Copy link
Member

commented Jun 14, 2019

No problem @PaleAugust , I wouldn't expect you to know about this stuff. I certainly didn't when I e started! We have plenty of time and I'm happy to provide hints or specific direction, depending on how you want to handle it.

So, there are two tasks we need to perform as part of this PR:

  1. Update the configuration using quilt.
  2. Update the Debian changelog to bump the version and explain the change.

There is a README on some of the Regolith repos that give some basic direction for how to update packages, but unfortunately this is not one of them. If you take a look at https://github.com/regolith-linux/regolith-desktop/blob/master/README.md , you'll see what I mean. If you substitute "regolith-i3" for "regolith-desktop" the instructions should hold true. Here's how I'd go about making the change:

  1. Install the debian package tools (as linked to in the README), so follow up to "create a working directory" in the Packaging guide.
  2. Check out regolith-i3
  3. Use quilt to apply the existing patches to your local copy
  4. Add your code fix
  5. Use quilt to refresh the patches with your code fix.
  6. Use the Debian tool dch to update the changelog
  7. Use debuild to verify the fix builds locally
  8. Commit your changes locally and update the Pull request

It may sound like a lot of steps but they are all pretty quick. It may be of interest to know why we have so many steps just to update a line or two. In this case, we are making changes to an upstream package (i3-gaps). We do not want to mix the changes of Regolith with upstream source, because keeping them separate makes it easier to track updates. Also, it makes it easier for package maintainers to test if a regression is from the upstream package or was introduced by a local (Regolith) change. So in this package we refer to the i3-gaps source code as something immutable, and then apply one or more patches to that codebase during the package build. This is the mechanism that keeps Regolith changes isolated from the upstream source.

If you get stuck, need more specific steps, or are just generally confused just let me know and I'm very happy to provide more guidance!

@PreciousChicken

This comment has been minimized.

Copy link
Author

commented Jun 14, 2019

That's great, thanks, really good detail; I'll take a read of the docs and give it a whirl (or get back to you).

PS I'm thinking about changing my github handle - I've been meaning to do it for a while, and this seems like a good time, so don't be surprised if the name changes...

@PreciousChicken

This comment has been minimized.

Copy link
Author

commented Jun 15, 2019

Hi @kgilmer, I've had a go; and getting there, but not quite. Got as far as line 7) command debuild -S -sa entered and got the following:

This package has a Debian revision number but there does not seem to be an appropriate original tar file or .orig directory in the parent directory; (expected one of regolith-i3_4.16.orig.tar.gz, regolith-i3_4.16.orig.tar.bz2, regolith-i3_4.16.orig.tar.lzma, regolith-i3_4.16.orig.tar.xz or regolith-i3.orig) continue anyway
'[.....]'
dpkg-source: error: can't build with source format '3.0 (quilt)': no upstream tarball found at ../regolith-i3_4.16.orig.tar.{bz2,gz,lzma,xz}
dpkg-buildpackage: error: dpkg-source -b regolith-i3 subprocess returned exit status 25
debuild: fatal error at line 1152:
dpkg-buildpackage -rfakeroot -us -uc -ui -S -sa failed

Which sounds like a fail...

I also had a number of errors on applying the patch with quilt push -a -f:

Applying patch patches/remove_i3_xsession.patch
can't find file to patch at input line 3
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|--- a/Makefile.am
|+++ b/Makefile.am
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.
1 out of 1 hunk ignored
The next patch would delete the file share/xsessions/i3-with-shmlog.desktop,
which does not exist! Assume -R? [n]
Apply anyway? [n]
Skipping patch.
1 out of 1 hunk ignored
The next patch would delete the file share/xsessions/i3.desktop,
which does not exist! Assume -R? [n]
Apply anyway? [n]
Skipping patch.
1 out of 1 hunk ignored
The next patch would delete the file share/applications/i3.desktop,
which does not exist! Assume -R? [n]
Apply anyway? [n]
Skipping patch.
1 out of 1 hunk ignored
Patch patches/remove_i3_xsession.patch appears to be empty; applied

Any ideas where I might be going wrong? Clearly a lack of an upstream tarball seems to be the source of the problem... Thank you for your help.

@kgilmer

This comment has been minimized.

Copy link
Member

commented Jun 15, 2019

My bad @PreciousChicken ! I forgot a few things, and that's why you are getting errors. I said in step 2 to "download regolith-i3" but you also need the actual program source itself. regolith-i3 is just package stuff, not the actual program. It would be impossible to guess this but regolith-i3_4.16.orig.tar.gz is actually i3-gaps source and is hosted by launchpad.net, here, from this page, which has all of the Regolith package source.

So what you need to do, is download that tarball, put it in the parent directory from your project, and also unpack the contents into your project directory. And remove anything that quilt may have put in there before doing so. And then re push quilt, you should get no errors this time, and now you're all set to make your actual code fix. Let me know if you have any questions or get stuck!

@PreciousChicken

This comment has been minimized.

Copy link
Author

commented Jun 16, 2019

Pull request updated, however not entirely sure if it worked... Let me know if I need to redo any of the steps again, or if what I have submitted is manageable.

There was one point above which I didn't understand: "and also unpack the contents into your project directory" - by doing this you typically overwrite all the files in the project directory. After doing this when I ran the dch command the changelog only had your initial commit in - so by downloading you appear to overwrite all other changes. Alternatively I could not overwrite (e.g. skip files, flag k in tar command) - but in that case there appeared to be no change to the project directory. Wasn't entirely sure which of those options I wanted...

@kgilmer

This comment has been minimized.

Copy link
Member

commented Jun 17, 2019

Hi @PreciousChicken thanks for sticking with this. So, I took at a look at your diff and it looks like there was something strange w/ how the patching happened. If you take a look, you can see there are a lot of differences between the Regolith version of the file and your edits, where there should just be your one specific change. I think it may be best to start from a fresh directory. Also, I think I led you astray yesterday when I had you download the source. For this particular repo. the source is in fact in the repository, so there is no need to "unpack the contents". This would explain why you were confused by my directions. To avoid me further mangling this, I did a test run from start to finish (skipping your actual change) but just to ensure I have steps that make sense and actually work. Here they are:

$ mkdir preciouschicken && cd preciouschicken/ # Create a working dir
$ git clone https://github.com/preciouschicken/regolith-i3.git # Checkout the repo, you will want to use a fork based directly from the Regolith repo.  There has been another change since you started this so best to just create another fork or rebase your existing one.
$ cd regolith-i3/
$ quilt push -a # Unpack existing patches and apply them to the source
$ quilt new bar-font-fix.patch # Create a new patch for our change
$ quilt add etc/config # Add the file we want to change to the patch
$ vim etc/config  # Actually make the change (this is where you'd add the font)
$ quilt refresh  # this makes quilt write the patch file
$ quilt pop -a  # Revert all the patches that we applied above, they are saved in debian/patches
$ ls debian/patches/  # notice your new patch
$ cat debian/patches/bar-font-fix.patch # take a look at the patch, it should have only your change
$ dch # Add a changelog entry, be sure to change from UNRELEASED to bionic or disco depending on your machine
$ debuild -S  # notice how debuild complains about not having a orig source file, notice the name it is looking for and say "n" to abort.
$ tar cfzv ../regolith-i3_4.16.orig.tar.gz .  # create the tarball to appease debuild
$ debuild -S  # build the package locally
$ git add debian/*  # this should add 3 files, which should be your PR.  Ignore the warning.
$ git push

If you're able to get this far with debuild completing successfully and you only have your change in the patch file; victory! One other thing I forgot is that you need to set some environment variables for the Debian package tools to work properly. So, set the environment variables before the steps above.

Thanks again for hanging in there. If it's any consolation, you're learning Debian packaging the same way I did...trial and error and error. 😄

PreciousChicken
Fixes i3 bar icons by including FontAwesome
Fixes regolith-linux/regolith-i3blocks#1

Icons used in i3 bar (e.g. cog, calendar) fail to display if FontAwesome not specifically listed.  This bug not apparent in all circumstances, e.g. clean install of Ubuntu.

@PreciousChicken PreciousChicken force-pushed the PreciousChicken:fix/i3_bar_icons_malformed branch from 6e47433 to 4b8ad1a Jun 17, 2019

@PreciousChicken

This comment has been minimized.

Copy link
Author

commented Jun 17, 2019

Ok @kgilmer how does that look? It was a force-push as I had to rebase this branch in line with your current base branch.

Some notes (more for my own future reference than anything else):

  • I set the environment variables by entering the following at the command line according to the Debian using quilt guide:

    export QUILT_PATCHES=debian/patches
    export QUILT_REFRESH_ARGS="-p ab --no-timestamps --no-index"

  • The command debuild -S gave me the following error message:

    debsign: gpg error occurred! Aborting....
    debuild: fatal error at line 1081:
    running debsign failed

    This didn't look good so I then ran debuild -S -us -uc (i.e. run but don't sign), which appeared to complete ok.

  • The penultimate command should have been git commit; just in case you copy and paste the above into a readme / how-to later on.

I have my fingers crossed here... Thanks very much for your help with this, really appreciate your guidance.

@kgilmer

This comment has been minimized.

Copy link
Member

commented Jun 18, 2019

This is it! 🥇 Yeah, you were right to run debuild -S -us -uc. Nice work in figuring all this stuff out and getting the job done @PreciousChicken !

@kgilmer kgilmer merged commit de8b187 into regolith-linux:master Jun 18, 2019

@kgilmer

This comment has been minimized.

Copy link
Member

commented Jun 18, 2019

Your change is building as regolith-i3 - 4.16-1ubuntu18ppa1 in https://launchpad.net/~kgilmer/+archive/ubuntu/regolith-unstable/+packages. Next step is to test it in the unstable repo and if it's good then promote it to the stable repo where everyone else will get your fix.

I had to add another changelog entry as the debian tools expected me to have your key as you were the last email in the changelog. Details here: https://askubuntu.com/questions/737884/debuild-secret-key-not-available-someone-elses-key and https://help.launchpad.net/Packaging/PPA/BuildingASourcePackage

@kgilmer

This comment has been minimized.

Copy link
Member

commented Jun 18, 2019

If you're interested in contributing more in the future I can look into how to add your pgp key into the PPA so you can directly push package changes yourself.

@kgilmer

This comment has been minimized.

Copy link
Member

commented Jun 18, 2019

Package is built into regolith-unstable PPA successfully.

@PreciousChicken

This comment has been minimized.

Copy link
Author

commented Jun 19, 2019

regolith_fix

I've tested regolith-unstable; as you can see from the screenshot it all seems to have worked - the icons have displayed correctly. To get there I uninstalled regolith stable:

sudo apt purge regolith-desktop
sudo add-apt-repository --remove ppa://kgilmer/regolith-stable
sudo apt purge rofi
sudo apt purge gnome-flashback
sudo apt purge compton
sudo apt autoremove
rm .config/i3-regolith/config
reboot

and then installed the unstable:

sudo add-apt-repository -y ppa://kgilmer/regolith-unstable
sudo apt install regolith-desktop

I'm sure you'll have other testing, but from this perspective it looks good for release into stable.

@PreciousChicken PreciousChicken deleted the PreciousChicken:fix/i3_bar_icons_malformed branch Jun 19, 2019

@kgilmer

This comment has been minimized.

Copy link
Member

commented Jun 20, 2019

Fantastic, thanks for switching to regolith-unstable and testing that. I also have had it for a few days and haven't noticed any issues. I'll promote it to regolith-stable today. Congrats and thank you for your first contribution to Regolith!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.