From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.4 Received: (qmail 24662 invoked from network); 10 Jun 2022 07:34:43 -0000 Received: from 9front.inri.net (168.235.81.73) by inbox.vuxu.org with ESMTPUTF8; 10 Jun 2022 07:34:43 -0000 Received: from mail.posixcafe.org ([45.76.19.58]) by 9front; Fri Jun 10 03:33:03 -0400 2022 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=posixcafe.org; s=20200506; t=1654846378; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=6spX+aOP7k1jacN3Qxx4PCuQpk2GdFIe4LjQRkOltKA=; b=TiuZ+OKoHmiJLFcBz4Eca7DjtKHVJaCE5BWaQ/fHWIdhnssB1R5bHsEN+OMvhyeJrMJcdE Rshcf6dK+SjGUjBvHSITJHRdCARoUq3V7tAdw5wYKdL7QY2gT4j4NhP7pULtsQ6mcT/AWr 2CNJoHtQNMfCXNiAHqIn885dotjS288= Received: from [192.168.168.200] (161-97-228-135.lpcnextlight.net [161.97.228.135]) by mail.posixcafe.org (OpenSMTPD) with ESMTPSA id 35e356d0 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for <9front@9front.org>; Fri, 10 Jun 2022 02:32:58 -0500 (CDT) Message-ID: Date: Fri, 10 Jun 2022 01:32:18 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Content-Language: en-US To: 9front@9front.org From: Jacob Moody Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: shared software content-driven-based method NoSQL solution Subject: [9front] [PATCH] embed git head hash as /dev/head Reply-To: 9front@9front.org Precedence: bulk This embeds the current commit hash for HEAD in to devcons as /dev/head. Thought this could be handy, curious to hear what others think. thanks, moody --- diff 13065e16b3c4fba4d9200ed7fec89ee49338f12a uncommitted --- a//sys/src/9/port/devcons.c +++ b//sys/src/9/port/devcons.c @@ -329,11 +329,13 @@ Qzero, Qmordor, Qconfig, + Qhead, }; enum { VLNUMSIZE= 22, + HEADSIZE= 41, }; static Dirtab consdir[]={ @@ -360,6 +362,7 @@ "zero", {Qzero}, 0, 0444, "config", {Qconfig}, 0, 0444, "mordor", {Qmordor}, 0, 0666, + "head", {Qhead}, HEADSIZE, 0444, }; int @@ -466,6 +469,7 @@ int i, k, id; vlong offset = off; extern char configfile[]; + extern char headhash[]; if(n <= 0) return n; @@ -623,6 +627,8 @@ snprint(tmp, sizeof tmp, "2000"); n = readstr((ulong)offset, buf, n, tmp); return n; + case Qhead: + return readstr((ulong)offset, buf, n, headhash); default: print("consread %#llux\n", c->qid.path); @@ -787,6 +793,9 @@ case Qmordor: error("one does not simply write into mordor"); + return 0; + case Qhead: + error(Eperm); return 0; default: --- a//sys/src/9/port/portmkfile +++ b//sys/src/9/port/portmkfile @@ -55,6 +55,11 @@ sed -e 's/^[0-9a-f]+ //' -e 's/ ([0-9a-f][0-9a-f])/0x\1,/g' echo 0, echo '};'} >> $CONF.c + {echo 'uchar headhash[]={' + xd -1x /dist/plan9front/.git/`{awk '{ print $2 }' /dist/plan9front/.git/HEAD} | + sed -e 's/^[0-9a-f]+ //' -e 's/ ([0-9a-f][0-9a-f])/0x\1,/g' + echo 0, + echo '};'} >> $CONF.c errstr.h:D: ../port/mkerrstr ../port/error.h rc ../port/mkerrstr > errstr.h