Tar error

So I uploaded a tar.gz file in my Github that basically contains a py script. I compressed it in Linux in KDE.
Code:
===>  License BSD2CLAUSE accepted by the user
===>   de-dict-2 depends on file: /usr/local/sbin/pkg - found
===> Fetching all distfiles required by de-dict-2 for building
=> SHA256 Checksum OK for dict-2.tar.gz.
tar: Error opening archive: Unrecognized archive format
===>  Failed to extract "/usr/ports/distfiles//dict-2.tar.gz".
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/german/dict
*** Error code 1

Stop.
The content of tar.gz is weird (maybe HTML?):
Code:
cat /usr/ports/distfiles//dict-2.tar.gz
{"payload":{"allShortcutsEnabled":false,"fileTree":{"":{"items":[{"name":"LICENSE","path":"LICENSE","conten
tType":"file"},{"name":"README.md","path":"README.md","contentType":"file"},{"name":"dict-2.tar.gz","path":
"dict-2.tar.gz","contentType":"file"},{"name":"dictcc.py","path":"dictcc.py","contentType":"file"}],"totalC
ount":4}},"fileTreeProcessingTime":1.640511,"foldersToFetch":[],"reducedMotionEnabled":null,"repo":{"id":70
4411840,"defaultBranch":"master","name":"dictcc","ownerLogin":"chrislongros","currentUserCanPush":false,"is
Fork":true,"isEmpty":false,"createdAt":"2023-10-13T07:49:28.000Z","ownerAvatar":"[URL]https://avatars.githubuser[/URL]
content.com/u/98426896?v=4","public":true,"private":false,"isOrgOwned":false},"symbolsExpanded":false,"tree
Expanded":true,"refInfo":{"name":"master","listCacheKey":"v0:1697183413.0","canEdit":false,"refType":"branc
h","currentOid":"eb3448ed8941c1777e681d98b3cd62f287c8016f"},"path":"dict-2.tar.gz","currentUser":null,"blob
":{"rawLines":null,"stylingDirectives":null,"csv":null,"csvError":null,"dependabotInfo":{"showConfiguration
Banner":false,"configFilePath":null,"networkDependabotPath":"/chrislongros/dictcc/network/updates","dismiss
ConfigurationNoticePath":"/settings/dismiss-notice/dependabot_configuration_notice","configurationNoticeDis
missed":null,"repoAlertsPath":"/chrislongros/dictcc/security/dependabot","repoSecurityAndAnalysisPath":"/ch
rislongros/dictcc/settings/security_analysis","repoOwnerIsOrg":false,"currentUserCanAdminRepo":false},"disp
layName":"dict-2.tar.gz","displayUrl":"[URL]https://github.com/chrislongros/dictcc/blob/master/dict-2.tar.gz?raw[/URL]
=true","headerInfo":{"blobSize":"2.14 KB","deleteInfo":{"deleteTooltip":"You must be signed in to make or p
ropose changes"},"editInfo":{"editTooltip":"You must be signed in to make or propose changes"},"ghDesktopPa
th":"[URL]https://desktop.github.com[/URL]","gitLfsPath":null,"onBranch":true,"shortPath":"3893575","siteNavLoginPath"
:"/login?return_to=https%3A%2F%2Fgithub.com%2Fchrislongros%2Fdictcc%2Fblob%2Fmaster%2Fdict-2.tar.gz","isCSV
":false,"isRichtext":false,"toc":null,"lineInfo":{"truncatedLoc":null,"truncatedSloc":null},"mode":"file"},
"image":false,"isCodeownersFile":null,"isPlain":false,"isValidLegacyIssueTemplate":false,"issueTemplateHelp
Url":"[URL]https://docs.github.com/articles/about-issue-and-pull-request-templates[/URL]","issueTemplate":null,"discus
sionTemplate":null,"language":null,"languageID":null,"large":false,"loggedIn":false,"newDiscussionPath":"/c
hrislongros/dictcc/discussions/new","newIssuePath":"/chrislongros/dictcc/issues/new","planSupportInfo":{"re
poIsFork":null,"repoOwnedByCurrentUser":null,"requestFullPath":"/chrislongros/dictcc/blob/master/dict-2.tar
.gz","showFreeOrgGatedFeatureMessage":null,"showPlanSupportBanner":null,"upgradeDataAttributes":null,"upgra
dePath":null},"publishBannersInfo":{"dismissActionNoticePath":"/settings/dismiss-notice/publish_action_from
_dockerfile","dismissStackNoticePath":"/settings/dismiss-notice/publish_stack_from_file","releasePath":"/ch
rislongros/dictcc/releases/new?marketplace=true","showPublishActionBanner":false,"showPublishStackBanner":f
alse},"rawBlobUrl":"[URL]https://github.com/chrislongros/dictcc/raw/master/dict-2.tar.gz[/URL]","renderImageOrRaw":tru
e,"richText":null,"renderedFileInfo":null,"shortPath":null,"tabSize":8,"topBannersInfo":{"overridingGlobalF
undingFile":false,"globalPreferredFundingPath":null,"repoOwner":"chrislongros","repoName":"dictcc","showInv
alidCitationWarning":false,"citationHelpUrl":"[URL]https://docs.github.com/en/github/creating-cloning-and-archiv[/URL]
ing-repositories/creating-a-repository-on-github/about-citation-files","showDependabotConfigurationBanner":
false,"actionsOnboardingTip":null},"truncated":false,"viewable":false,"workflowRedirectUrl":null,"symbols":
null},"copilotInfo":null,"csrf_tokens":{"/chrislongros/dictcc/branches":{"post":"ZF3PB1M3zF-C9tmZaOTCT882Ur
XJqacgYDGE3mU8XRFQa4Yd9lr5JTg4hbFbJqu_UY8V3LV2WlIRL6n61frGKg"},"/repos/preferences":{"post":"zTHwVd5YP6wfeQ
v_qkfsaX6xcFjz8Oqm5Y0TmuvSuSAVju1Y9L_lSUvpGW5w6wj1V_NkcTMnxNXvN8WirOVnqA"}}},"title":"dictcc/dict-2.tar.gz

The Makefile is as follows. I modified it and is probably wrong (newbie)
Code:
root@FreeBSD:/usr/ports/german/dict # cat Makefile
PORTNAME=       dict
PORTVERSION=    2
CATEGORIES=     german
MASTER_SITES=   [URL]https://github.com/chrislongros/dictcc/blob/master/[/URL]
DISTFILES=      ${DISTNAME}${EXTRACT_SUFX} ${dict.gz}
EXTRACT_ONLY=   ${DISTNAME}${EXTRACT_SUFX}

MAINTAINER=     [email]ports@FreeBSD.org[/email]
COMMENT=        Simple English/German dictionary
WWW=            [URL]https://github.com/chrislongros/dictcc/[/URL]

LICENSE=        BSD2CLAUSE

RUN_DEPENDS=    agrep:textproc/agrep

NO_BUILD=       yes
PLIST_FILES=    bin/de-dict


post-extract: ${dict}

${dict}:
        ${GZCAT} < ${DISTDIR}/${dict.gz} > ${WRKSRC}/${.TARGET}

do-install:
        ${INSTALL_SCRIPT} ${WRKSRC}/dict.py ${STAGEDIR}${PREFIX}/bin/de-dict


.include <bsd.port.mk>
 
The content of tar.gz is weird
It's an uncompressed tar ball. There's no gzip compression, so the *.gz extension is wrong.

Code:
MASTER_SITES=   https://github.com/chrislongros/dictcc/blob/master/
Use GH_ACCOUNT and GH_PROJECT instead.
Code:
USE_GITHUB= yes
GH_ACCOUNT= chrislongros
GH_PROJECT= dictcc
 
To view the file type:
file /usr/ports/distfiles/dict-2.tar.gz
To display gz content:
zcat /usr/ports/distfiles/dict-2.tar.gz
 
Hehe, looks like it's not even a tarball. It's a plain JSON file.
 
Code:
MASTER_SITES=   https://github.com/chrislongros/dictcc/blob/master/
Use GH_ACCOUNT and GH_PROJECT instead.
Actually, you shouldn't. USE_GITHUB is only for cases when no official distfile exists. If there is an official distfile, it should normally be preferred (there are few exceptions), even when uploaded to github.*

That said, of course, a JSON file is not a distfile, whatever happened here. And also, judging from MASTER_SITES this "not a tarball" was added to the git repository and pushed -- that's certainly not how you upload a distfile, instead, you create a "release" on github and upload your distfile as an attachment there.

*edit, as a generic warning to all porters who might read this: Every github "release" has two automatic "attachments", one of them being a tarball. Those aren't real attachments (you can verify they refer to a path containing archive/ref) but auto-generated from the repository. If that's all there is, USE_GITHUB is indeed the way to go.
 
Back
Top