这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@Finii
Copy link
Collaborator

@Finii Finii commented Feb 16, 2022

[why]
When the file names of the source files change which happened for example
with these commits:

  ac432eb20 Updated Inconsolata source to latest upstream version of 2.001 (WIP #289)
  9c5ad2c78 Updated Inconsolata source to latest upstream version of 2.001 (WIP #289)

or the patched font files naming changes because of any other reason (*):

The patched-font directory will contain the new files along with the
unchanged old ones (because they where not overwritten).

Typically when manually updating the patched-fonts this is not a
problem, as the maintainer can clean this up by hand (if it is noticed).
But with a github action we might want to have that automatized.

To not deter the usability of the script for end-users or for patching
single fonts of a collection we do NOT want to purge 'all old files'
because we can not know if they are really old or not.

[how]
For each directory that we process from the source fonts we check if all
font files therein match our search criterion (pattern, $2). If we are
going to patch all files that are in that source directory we delete all
font files in the destination directory; expecting that all files will
be recreated.
If we do not patch all files, we can do nothing, because we can not
decide if the existing files originate from one of the
not-to-be-processed source font files or are zombies.

Fixes: #786

(*) For example when the font naming changes because

  • The FontnameParser is used where Nerd Font moves forward before the style in the font name
  • We will finally create font files without blanks in them, but conventional Name-Weight.ttf

Requirements / Checklist

What does this Pull Request (PR) do?

Remove font files from patched-fonts that are not created on the most recent complete patch run.

How should this be manually tested?

Inconsolata has some orphan font files, run the patched patch-em-all and see those vanish.

Any background context you can provide?

What are the relevant tickets (if any)?

#786

Screenshots (if appropriate or helpful)

[why]
When the file names of the source files change which happened for example
with these commits:
  ac432eb Updated Inconsolata source to latest upstream version of 2.001 (WIP #289)
  9c5ad2c Updated Inconsolata source to latest upstream version of 2.001 (WIP #289)

or the patched font files naming changes because of any other reason:

The patched-font directory will contain the new files along with the
unchanged old ones (because they where not overwritten).

Typically when manually updating the patched-fonts this is not a
problem, as the maintainer can clean this up by hand (if it is noticed).
But with a github action we might want to have that automatized.

To not deter the usability of the script for end-users or for patching
single fonts of a collection we do NOT want to purge 'all old files'
because we can not know if they are really old or not.

[how]
For each directory that we process from the source fonts we check if all
font files therein match our search criterion (pattern, $2). If we are
going to patch _all_ files that are in that source directory we delete all
font files in the destination directory; expecting that all files will
be recreated.
If we do _not_ patch _all_ files, we can do nothing, because we can not
decide if the existing files originate from one of the
not-to-be-processed source font files or are zombies.

Fixes: #786

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
if [ -n ${purge} -a -d "${patched_font_dir}complete" ]
then
echo "Purging patched font dir ${patched_font_dir}complete"
rm ${patched_font_dir}complete/*.[to]tf
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does not purge out readmes or any other files.
But maybe we want to do that (purge out all files), so that the patched-fonts/ dir just contains all autogenerated content.

If so we can change the new line 75 accordingly.

On the other hand, in that case the workflow could just wipe the patched-fonts/ dir before calling patch-em-all; and we do not need any of these changes (i.e. this PR)
The drawback of THAT solution is, that it fixes it for our github workflow, but not for any self patching user.

@Finii
Copy link
Collaborator Author

Finii commented Feb 16, 2022

What I did not check is if the https://github.com/EndBug/add-and-commit action works like ordinary (command line) git add.

On the command line, adding a directory marks all missing files in that directory as deleted on the stage and in the later commit.
The action allows also remove: so I'm not sure they changed that behavior (I believe: no, they just call git add and git rm without any special logic added).

@Finii Finii added the Bug fix label Mar 23, 2022
@Finii Finii mentioned this pull request Apr 22, 2022
3 tasks
@Finii
Copy link
Collaborator Author

Finii commented Jun 8, 2022

Here is an instance where the present behavior (keeping old files laying around after renaming etc) results in an Issue...
termux/termux-styling#77

This seems to have gone unnoticed here as because the old Fura* files remain (unupdated) in the Nerd Fonts repo (by mistake, I presume), the download script didn't break

@Finii Finii added this to the v2.2.0 milestone Aug 18, 2022
@Finii Finii merged commit afd7ba1 into master Aug 18, 2022
@Finii Finii deleted the bugfix/remove_orphan_font_files branch August 18, 2022 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

patched-fonts folder contains obsolete files

2 participants