mirror of
https://github.com/naveenrajm7/rpmbuild.git
synced 2025-07-12 04:13:50 +00:00
Merge pull request #10 from belden/issue-9-private-repo
Make rpmbuild work work with private repos
This commit is contained in:
@ -6,7 +6,7 @@ COPY . .
|
|||||||
|
|
||||||
# Installing tools needed for rpmbuild ,
|
# Installing tools needed for rpmbuild ,
|
||||||
# depends on BuildRequires field in specfile, (TODO: take as input & install)
|
# depends on BuildRequires field in specfile, (TODO: take as input & install)
|
||||||
RUN yum install -y rpm-build rpmdevtools gcc make coreutils python
|
RUN yum install -y rpm-build rpmdevtools gcc make coreutils python git
|
||||||
|
|
||||||
# Setting up node to run our JS file
|
# Setting up node to run our JS file
|
||||||
# Download Node Linux binary
|
# Download Node Linux binary
|
||||||
|
17
lib/main.js
17
lib/main.js
@ -45,18 +45,11 @@ function run() {
|
|||||||
yield exec.exec('rpmdev-setuptree');
|
yield exec.exec('rpmdev-setuptree');
|
||||||
// Copy spec file from path specFile to /root/rpmbuild/SPECS/
|
// Copy spec file from path specFile to /root/rpmbuild/SPECS/
|
||||||
yield exec.exec(`cp /github/workspace/${specFile} /github/home/rpmbuild/SPECS/`);
|
yield exec.exec(`cp /github/workspace/${specFile} /github/home/rpmbuild/SPECS/`);
|
||||||
// Dowload tar.gz file of source code, Reference : https://developer.github.com/v3/repos/contents/#get-archive-link
|
// Make the code in /github/workspace/ into a tar.gz, located in /github/home/rpmbuild/SOURCES/
|
||||||
yield exec.exec(`curl -L --output tmp.tar.gz https://api.github.com/repos/${owner}/${repo}/tarball/${ref}`);
|
const oldGitDir = process.env.GIT_DIR;
|
||||||
// create directory to match source file - %{name}-{version}.tar.gz of spec file
|
process.env.GIT_DIR = '/github/workspace/.git';
|
||||||
yield exec.exec(`mkdir ${name}-${version}`);
|
yield exec.exec(`git archive --output=/github/home/rpmbuild/SOURCES/${name}-${version}.tar.gz --prefix=${name}-${version}/ HEAD`);
|
||||||
// Extract source code
|
process.env.GIT_DIR = oldGitDir;
|
||||||
yield exec.exec(`tar xvf tmp.tar.gz -C ${name}-${version} --strip-components 1`);
|
|
||||||
// Create Source tar.gz file
|
|
||||||
yield exec.exec(`tar -czvf ${name}-${version}.tar.gz ${name}-${version}`);
|
|
||||||
// // list files in current directory /github/workspace/
|
|
||||||
// await exec.exec('ls -la ');
|
|
||||||
// Copy tar.gz file to source path
|
|
||||||
yield exec.exec(`cp ${name}-${version}.tar.gz /github/home/rpmbuild/SOURCES/`);
|
|
||||||
// Execute rpmbuild , -ba generates both RPMS and SPRMS
|
// Execute rpmbuild , -ba generates both RPMS and SPRMS
|
||||||
try {
|
try {
|
||||||
yield exec.exec(`rpmbuild -ba /github/home/rpmbuild/SPECS/${specFile}`);
|
yield exec.exec(`rpmbuild -ba /github/home/rpmbuild/SPECS/${specFile}`);
|
||||||
|
22
src/main.ts
22
src/main.ts
@ -43,23 +43,11 @@ async function run() {
|
|||||||
// Copy spec file from path specFile to /root/rpmbuild/SPECS/
|
// Copy spec file from path specFile to /root/rpmbuild/SPECS/
|
||||||
await exec.exec(`cp /github/workspace/${specFile} /github/home/rpmbuild/SPECS/`);
|
await exec.exec(`cp /github/workspace/${specFile} /github/home/rpmbuild/SPECS/`);
|
||||||
|
|
||||||
// Dowload tar.gz file of source code, Reference : https://developer.github.com/v3/repos/contents/#get-archive-link
|
// Make the code in /github/workspace/ into a tar.gz, located in /github/home/rpmbuild/SOURCES/
|
||||||
await exec.exec(`curl -L --output tmp.tar.gz https://api.github.com/repos/${owner}/${repo}/tarball/${ref}`)
|
const oldGitDir = process.env.GIT_DIR;
|
||||||
|
process.env.GIT_DIR = '/github/workspace/.git';
|
||||||
// create directory to match source file - %{name}-{version}.tar.gz of spec file
|
await exec.exec(`git archive --output=/github/home/rpmbuild/SOURCES/${name}-${version}.tar.gz --prefix=${name}-${version}/ HEAD`);
|
||||||
await exec.exec(`mkdir ${name}-${version}`);
|
process.env.GIT_DIR = oldGitDir;
|
||||||
|
|
||||||
// Extract source code
|
|
||||||
await exec.exec(`tar xvf tmp.tar.gz -C ${name}-${version} --strip-components 1`);
|
|
||||||
|
|
||||||
// Create Source tar.gz file
|
|
||||||
await exec.exec(`tar -czvf ${name}-${version}.tar.gz ${name}-${version}`);
|
|
||||||
|
|
||||||
// // list files in current directory /github/workspace/
|
|
||||||
// await exec.exec('ls -la ');
|
|
||||||
|
|
||||||
// Copy tar.gz file to source path
|
|
||||||
await exec.exec(`cp ${name}-${version}.tar.gz /github/home/rpmbuild/SOURCES/`);
|
|
||||||
|
|
||||||
// Execute rpmbuild , -ba generates both RPMS and SPRMS
|
// Execute rpmbuild , -ba generates both RPMS and SPRMS
|
||||||
try {
|
try {
|
||||||
|
Reference in New Issue
Block a user