![User's banner](/_next/image?url=https%3A%2F%2Flemmy.ml%2Fpictrs%2Fimage%2F338f99f4-4803-43ea-8f9c-f371a5effbc5.jpeg&w=2048&q=75)
![Avatar](/_next/image?url=https%3A%2F%2Flemmy.ml%2Fpictrs%2Fimage%2F6bc83bcc-037e-4b71-b71c-f705f2df0be9.png&w=3840&q=75)
![Avatar](/_next/image?url=%2Flemmy-icon-96x96.webp&w=3840&q=75)
bahmanm
Husband, father, kabab lover, history buff, chess fan and software engineer. Believes creating software must resemble art: intuitive creation and joyful discovery.
๐ linktr.ee/bahmanm
Views are my own.
Can you provide what you mean by check the environment, and why youโd need to do that before anything else?
One recent example is a makefile (in a subproject), w/ a dozen of targets to provision machines and run Ansible playbooks. Almost all the targets need at least a few variables to be set. Additionally, I needed any fresh invocation to clean the โbuildโ directory before starting the work.
At first, I tried capturing those variables w/ a bunch of ifeq
s, shell
s and define
s. However, I wasnโt satisfied w/ the results for a couple of reasons:
- Subjectively speaking, it didnโt turn out as nice and easy-to-read as I wanted it to.
- I had to replicate my (admittedly simple)
clean
target as a shell command at the top of the file.
Then I tried capturing that in a target using bmakelib.error-if-blank
and bmakelib.default-if-blank
as below.
##############
.PHONY : ensure-variables
ensure-variables : bmakelib.error-if-blank( VAR1 VAR2 )
ensure-variables : bmakelib.default-if-blank( VAR3,foo )
##############
.PHONY : ansible.run-playbook1
ansible.run-playbook1 : ensure-variables cleanup-residue | $(ansible.venv)
ansible.run-playbook1 :
...
##############
.PHONY : ansible.run-playbook2
ansible.run-playbook2 : ensure-variables cleanup-residue | $(ansible.venv)
ansible.run-playbook2 :
...
##############
But this was not DRY as I had to repeat myself.
Thatโs why I thought there may be a better way of doing this which led me to the manual and then the method I describe in the post.
running specific targets or rules unconditionally can lead to trouble later as your Makefile grows up
That is true! My concern is that when the number of targets which donโt need that initialisation grows I may have to rethink my approach.
Iโll keep this thread posted of how this pans out as the makefile scales.
Even though Iโve been writing GNU Makefiles for decades, I still am learning new stuff constantly, so if someone has better, different ways, Iโm certainly up for studying them.
Love the attitude! Iโm on the same boat. I could have just kept doing what I already knew but I thought a bit of manual reading is going to be well worth it.
Update 1
ttrpg.network is now on lemmy-meter ๐ฅณ Thanks for your interest ๐
To be precise, itโs not 4 requests to the same endpoint.
lemmy-meter probes 4 endpoints each once per minute:
- The landing page
api.getPosts
(limit=1
)api.getComments
(limit=1
)api.getCommunities
(limit=1
)
Thatโs b/c Iโve frequently experienced cases when the landing page works but some mobile APIs donโt and vice versa.
Hope that makes sense.
As I said, if after some time you feel like this is too much load, reach out to me and I can easily configure lemmy-meter to probe less frequently.
Something that Iโll definitely keep an eye on. Thanks for sharing!
NB: I have never had the fortune to write Lisp in a professional setup.
For years, I used to use SBCL snippets for a whole set of automation tasks in my daily workflow, like updating git repos in batch, checking failing CI/CD pipelines per repo, organising my music collection, etc.
But gradually I switched to more specialised tools and, yes, Emacs Lisp to do what I needed to do. It just felt more ergonomic in my case.
The last time I seriously used SBCL was to solve some of Project Eulerโs challenges back in 2018: https://github.com/bahmanm/euler-cl
Nowadays, Iโve got no non-elisp code left ๐ ๐คทโโ๏ธ
First off, I was ready to close the tab at the slightest suggestion of using Velocity as a metric. That didnโt happen ๐
I like the idea that metrics should be contained and sustainable. Though I donโt agree w/ the suggested metrics.
In general, it seems they are all designed around the process and not the product. In particular, thereโs no mention of the โvalue unlockedโ in each sprint: itโs an important one for an Agile team as it holds Product accountable to understanding of what is the $$$ value of the teamโs effort.
The suggested set, to my mind, is formed around the idea of a feature factory line and its efficiency (assuming it is measurable.) It leaves out the โmeaningโ of what the team achieve w/ that efficiency.
My 2 cents.
Good read nonetheless ๐ Got me thinking about this intriguing topic after a few years.
This is fantastic! ๐
I use Perl one-liners for record and text processing a lot and this will be definitely something I will keep coming back to - Iโve already learned a trick from โContext Matchingโ (9) ๐
Update 1
Thanks all for your feedback ๐ I think everybody made a valid point that the OOTB configuration of 33 requests/min was quite useless and we can do better than that.
I reconfigured timeouts and probes and tuned it down to 4 HTTP GET requests/minute out of the box - see the configuration for details.
๐ A pre-release version is available at lemmy-meter.info.
For the moment, it only probes the test instances
Iโd very much appreciate your further thoughts and feedback.