-
Notifications
You must be signed in to change notification settings - Fork 0
/
github.htm
129 lines (116 loc) · 6.06 KB
/
github.htm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<!DOCTYPE html>
<html>
<head>
<meta charset="utf8" />
<title>How to obtain source code from GitHub?</title>
</head>
<body><a href="https://github.com/ArsenShnurkov/gentoo-mono-handbook"><img alt="Fork me on GitHub" id="forkme" src="images/forkme.png" align="right" width="100" /></a>
<table><tr><td valign="top">
<h1>How to obtain source code from GitHub?</h1>
</td><td valign="top">
<a href="index.htm">Gentoo Mono Handbook</a>
<br />
see also <a href="https://devmanual.gentoo.org/eclass-reference/git-2.eclass/index.html">git-2</a>,
<a href="https://devmanual.gentoo.org/eclass-reference/git-r3.eclass/index.html">git-r3</a>,
<a href="https://devmanual.gentoo.org/eclass-reference/vcs-snapshot.eclass/index.html">cvs-snapshot</a>
</td></tr></table>
<h2>by SHA1</h2>
When using a distributed source control system such as Git, it's important to understand
that the latest check-in on the GitHub repository is not necessarily the one
you want to download or sync to as it may be a different branch than the master branch.
<br />
<a href="SHA1.htm">Details about SHA1</a>
<h3>Example</h3>
<pre>
# vcs-snapshot.eclass will strip that first dir level and re-add /${P} , so default S works
# eg instead of unpacking to $WORKDIR/foo-dc8s9ee1/ , it will unpack to $WORKDIR/foo-1.2.3/ as expected
inherit vcs-snapshot
REPO_OWNER=apache
REPO_NAME=logging-log4net
EGIT_COMMIT=dbad144815221ffe4ed85efa73134583253dc75b
SRC_URI="https://api.github.com/repos/${REPO_OWNER}/${REPO_NAME}/tarball/${EGIT_COMMIT} -> <font style="color:green">${P}.tar.gz</font>"
</pre>
It should be <font style="color:green">${P}.tar.gz</font>, not ${CATEGORY}-${PN}-${PV}.tar.gz, to match the default value of ${S} variable
<!--
Code on github can be in the <strong>master</strong> branch
<pre>NAME="<font style="color:red">ProjectName</font>"
HOMEPAGE="https://github.com/<font style="color:red">AccountName</font>/${NAME}"
EGIT_COMMIT="<font style="color:red">061d8a27b13db5a76cae4757bb902b2808494a83</font>"
SRC_URI="${HOMEPAGE}/archive/${EGIT_COMMIT}.tar.gz -> ${PN}-${PV}.tar.gz"
RESTRICT="mirror"
S="${WORKDIR}/${NAME}-${EGIT_COMMIT}"</pre>
or in the another branch
<br />
<pre>NAME="<font style="color:#CC00CC">ProjectName</font>"
HOMEPAGE="https://github.com/<font style="color:#CC00CC">AccountName</font>/${NAME}"
<font style="color:#00CC00">EGIT_BRANCH</font>="<font style="color:red">BranchName</font>"
EGIT_COMMIT="<font style="color:#CC00CC">c3eb07ff89523154dc2385c7db0ba9437bff3362</font>"
SRC_URI="${HOMEPAGE}/archive/<font style="color:#00CC00">${EGIT_BRANCH}</font>/${EGIT_COMMIT}.tar.gz -> ${PN}-${PV}.tar.gz"
RESTRICT="mirror"
S="${WORKDIR}/${NAME}-${EGIT_COMMIT}"</pre>
-->
<h3>Documentation and specifications</h3>
<a href="https://docs.github.com/en/free-pro-team@latest/rest/reference/repos#download-a-repository-archive-zip">https://docs.github.com/en/free-pro-team@latest/rest/reference/repos#download-a-repository-archive-zip</a>
<br />
Example:
<br />
https://api.github.com/repos/apache/logging-log4net/zipball/dbad144815221ffe4ed85efa73134583253dc75b
<br />
$ wget -c https://api.github.com/repos/apache/logging-log4net/zipball/dbad144815221ffe4ed85efa73134583253dc75b
<pre>
--2020-10-26 21:21:06-- https://api.github.com/repos/apache/logging-log4net/zipball/dbad144815221ffe4ed85efa73134583253dc75b
Resolving api.github.com... 140.82.121.6
Connecting to api.github.com|140.82.121.6|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://codeload.github.com/apache/logging-log4net/legacy.zip/dbad144815221ffe4ed85efa73134583253dc75b [following]
--2020-10-26 21:21:07-- https://codeload.github.com/apache/logging-log4net/legacy.zip/dbad144815221ffe4ed85efa73134583253dc75b
Resolving codeload.github.com... 140.82.121.9
Connecting to codeload.github.com|140.82.121.9|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/zip]
Saving to: ‘dbad144815221ffe4ed85efa73134583253dc75b’
dbad144815221ffe4ed85efa73134583253dc75b [ <=> ] 1,59M 3,29MB/s in 0,5s
2020-10-26 21:21:08 (3,29 MB/s) - ‘dbad144815221ffe4ed85efa73134583253dc75b’ saved [1670579]
</pre>
<br />
<br />
<a href="https://help.github.com/">https://help.github.com/</a>
<br />
<a href="https://developer.github.com/v3/repos/contents/#get-archive-link">https://developer.github.com/v3/repos/contents/#get-archive-link</a>
<br />
<img src="github/get-archive-link.png" alt="github/get-archive-link.png" />
<br />
In github web interface it looks like this: <font style="color:red">TODO</font>
<br />
<br />
Nodeload - <a href="https://github.com/blog/678-meet-nodeload-the-new-download-server">https://github.com/blog/678-meet-nodeload-the-new-download-server</a>
<br />
any time you download a tarball or zip file of any repository branch or tag, you're going through nodeload.
<br />
<br />
looks like "ebuild ... digest" doesn't work with 302 redirect (<font style="color:red">need to be investigated deeper</font>)
<br />
<br />
<a href="http://stackoverflow.com/questions/8377081/github-api-download-zip-or-tarball-link">http://stackoverflow.com/questions/8377081/github-api-download-zip-or-tarball-link</a>
<h2>by tag</h2>
github provide links for packaged sources for each commit:
<br />
for example
<br />
https://github.com/deveel/deveel-math/archive/dmath-1.5.66.tar.gz
<br />
<br />
These links can be directly used in SRC_URI variale.
<br />
<br />
import versionator
<br />
# PR Package revision, or r0 if no revision exists.
<br />
NUSPEC_VERSION=$(get_version_component_range 1-3)"${PR//r/.}"
<h1>Other</h1>
<a href="http://webapps.stackexchange.com/questions/46113/how-to-see-list-of-issues-reported-by-me-on-github">http://webapps.stackexchange.com/questions/46113/how-to-see-list-of-issues-reported-by-me-on-github</a>
<br />
<a href="https://github.com/blog/12-tarball-downloads">https://github.com/blog/12-tarball-downloads</a>
</body>
</html>