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

Old categories are not purged when they are no longer active #479

Closed
dlangille opened this issue Nov 1, 2023 · 3 comments
Closed

Old categories are not purged when they are no longer active #479

dlangille opened this issue Nov 1, 2023 · 3 comments
Assignees
Labels

Comments

@dlangille
Copy link
Contributor

dlangille commented Nov 1, 2023

Categories come and go. FreshPorts handles new categories. It does not detect and remove categories.

NOTE: We can't delete old categories if there are deleted ports in those categories (e.g. palm).

This came about from #473

So far, I see these which should be removed: ipv6 erlang offix palm paralell perl php picobsd python:2.7 tcl80 tcl81 tcl82 tcl83 tcl84 tk42 tk80 tk82 tk83 tk84 tkstep90 wip

Remove only if not used.

Case in point, sometimes a category is created in error:

freshports.devgit=# select * from categories where name = 'paralell';
 id | is_primary | element_id |   name   |                       description                        
----+------------+------------+----------+----------------------------------------------------------
 93 | f          |            | paralell | This is a virtual category. No description is available.
(1 row)

freshports.devgit=# select * from categories where name = 'parallel';
 id | is_primary | element_id |   name   |                     description                     
----+------------+------------+----------+-----------------------------------------------------
 68 | f          |            | parallel | Applications dealing with parallelism in computing.
(1 row)

freshports.devgit=# 
@dlangille
Copy link
Contributor Author

We got a whole bunch in use:

freshports.devgit=# select count(*), categories.name from ports_categories join categories on ports_categories.category_id = categories.id  where category_id in (select id from categories where name in ('ipv6', 'erlang', 'offix', 'palm', 'paralell', 'perl', 'php', 'picobsd', 'python:2.7', 'tcl80', 'tcl81', 'tcl82', 'tcl83', 'tcl84', 'tk42', 'tk80', 'tk82', 'tk83', 'tk84', 'tkstep90', 'wip')) group by categories.name order by categories.name;
 count |  name   
-------+---------
  1709 | ipv6
    70 | palm
     1 | picobsd
     2 | tcl80
     1 | tcl81
     2 | tcl82
     1 | tcl83
     5 | tcl84
     2 | tk42
     4 | tk80
     8 | tk82
     2 | tk83
     6 | tk84
(13 rows)

freshports.devgit=# 

@dlangille
Copy link
Contributor Author

How often are these used?

with suspects as (
select name from categories where name in 
('ipv6', 'erlang', 'offix', 'palm', 'paralell', 'perl', 'php', 'picobsd', 'python:2.7', 'tcl80', 'tcl81', 'tcl82', 'tcl83', 'tcl84', 'tk42', 'tk80', 'tk82', 'tk83', 'tk84', 'tkstep90', 'wip')
)
select suspects.name, count(*) 
from suspects join categories on categories.name = suspects.name
left outer join ports_categories on ports_categories.category_id = categories.id
 group by suspects.name;

    name    | count 
------------+-------
 erlang     |     1
 ipv6       |  1709
 offix      |     1
 palm       |    70
 paralell   |     1
 perl       |     1
 php        |     1
 picobsd    |     1
 python:2.7 |     1
 tcl80      |     2
 tcl81      |     1
 tcl82      |     2
 tcl83      |     1
 tcl84      |     5
 tk42       |     2
 tk80       |     4
 tk82       |     8
 tk83       |     2
 tk84       |     6
 wip        |     1
(20 rows)

freshports.devgit=# 

@dlangille dlangille self-assigned this Nov 12, 2023
@dlangille
Copy link
Contributor Author

NOTE: We can't delete old categories if there are deleted ports in those categories (e.g. palm).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant