mirror of
https://github.com/clearlinux/common.git
synced 2026-09-08 06:42:10 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b23d156f2c | ||
|
|
39e8d4e68a | ||
|
|
9d440aff3a | ||
|
|
c1e426713a | ||
|
|
d9e4f478eb | ||
|
|
96b366e71f | ||
|
|
84097fd526 | ||
|
|
c2cd51b5f2 | ||
|
|
ed1ef58d9a | ||
|
|
497f2a66f4 | ||
|
|
3b8d3c66ea | ||
|
|
373cbad44c | ||
|
|
0fcc984675 | ||
|
|
78023bd74a | ||
|
|
d2b5b72346 | ||
|
|
4953d9e087 | ||
|
|
ee37765ed2 | ||
|
|
492abf6d32 | ||
|
|
2562a8c7fb | ||
|
|
5fd02ece36 | ||
|
|
039e63fb1e | ||
|
|
dcf8bc4978 | ||
|
|
3951710117 | ||
|
|
504d77bc58 | ||
|
|
d3514ae496 | ||
|
|
4403e9280a | ||
|
|
0aed61be35 | ||
|
|
cdda6bcece | ||
|
|
61203724ab | ||
|
|
3dfbdf4c58 | ||
|
|
e0e5b4b1a7 | ||
|
|
b95dd8c67f | ||
|
|
8ed4d2d0de | ||
|
|
023a2da624 | ||
|
|
cdd4aeebe2 | ||
|
|
ee744332e0 | ||
|
|
353042a9bd | ||
|
|
1a0366ab21 | ||
|
|
4080b704f3 | ||
|
|
4626f673ca | ||
|
|
5121c565eb | ||
|
|
a26aea0290 | ||
|
|
54a9f967c3 | ||
|
|
9153630dcb | ||
|
|
d80039c90b | ||
|
|
f5a3630590 | ||
|
|
75cb8bf424 | ||
|
|
2a586be1b3 | ||
|
|
93fccd1edf | ||
|
|
9527057e5e | ||
|
|
f3500feb2d | ||
|
|
05598abd55 | ||
|
|
2b0163ef73 | ||
|
|
3f2b9100e6 |
+12
-5
@@ -157,10 +157,6 @@ pullrebase:
|
|||||||
fi \
|
fi \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# help vendor: Attempt to create an updated vendor tar archive if needed
|
|
||||||
vendor: preautospec-checks pullrebase clean-old-content
|
|
||||||
@ $(TOPLVL)/projects/common/vendor.py $(firstword $(NEWURL) $(URL)) $(PKG_NAME) $(VND_BASE_URL)
|
|
||||||
|
|
||||||
preautospec-checks:
|
preautospec-checks:
|
||||||
|
|
||||||
#help autospec: automatically generates a specfile. If there is
|
#help autospec: automatically generates a specfile. If there is
|
||||||
@@ -174,8 +170,8 @@ autospec: preautospec-checks pullrebase localreponotice clean-old-content
|
|||||||
echo "Specfile already exists and was not created by autospec.py! Aborting."; \
|
echo "Specfile already exists and was not created by autospec.py! Aborting."; \
|
||||||
exit 1; \
|
exit 1; \
|
||||||
fi
|
fi
|
||||||
|
$(eval ARCHIVES = $(shell $(TOPLVL)/projects/common/vendor.py '$(value ARCHIVES)' $(firstword $(NEWURL) $(URL)) $(PKG_NAME) $(VND_BASE_URL)))
|
||||||
@printf 'PKG_NAME := %s\nURL = %s\nARCHIVES = %s\n\ninclude ../common/Makefile.common\n' $(PKG_NAME) '$(firstword $(value NEWURL) $(value URL))' '$(value ARCHIVES)' > Makefile
|
@printf 'PKG_NAME := %s\nURL = %s\nARCHIVES = %s\n\ninclude ../common/Makefile.common\n' $(PKG_NAME) '$(firstword $(value NEWURL) $(value URL))' '$(value ARCHIVES)' > Makefile
|
||||||
@$(MAKE) vendor
|
|
||||||
python3 $(TOPLVL)/projects/autospec/autospec/autospec.py \
|
python3 $(TOPLVL)/projects/autospec/autospec/autospec.py \
|
||||||
--target . \
|
--target . \
|
||||||
--integrity \
|
--integrity \
|
||||||
@@ -391,6 +387,17 @@ koji-waitrepo: kojidef
|
|||||||
koji wait-repo --build=${SRPMVERS} ${WAIT_OPTS} ${KOJI_TAG}-build; \
|
koji wait-repo --build=${SRPMVERS} ${WAIT_OPTS} ${KOJI_TAG}-build; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
.PHONY: koji-tag
|
||||||
|
#help koji-tag: runs koji tag-pkg on what's in the current specfile's nvr
|
||||||
|
koji-tag:
|
||||||
|
koji tag-pkg dist-clear $(SRPMVERS)
|
||||||
|
|
||||||
|
.PHONY: koji-untag
|
||||||
|
#help koji-untag: runs koji untag-pkg on what's in the current specfile's nvr
|
||||||
|
koji-untag:
|
||||||
|
koji untag-pkg dist-clear $(SRPMVERS)
|
||||||
|
|
||||||
|
|
||||||
update-versions:
|
update-versions:
|
||||||
|
|
||||||
.PHONY: update
|
.PHONY: update
|
||||||
|
|||||||
@@ -2,4 +2,3 @@
|
|||||||
/usr/lib/systemd/system/sysinit.target.wants/systemd-firstboot.service
|
/usr/lib/systemd/system/sysinit.target.wants/systemd-firstboot.service
|
||||||
/usr/lib/systemd/system/sysinit.target.wants/systemd-hwdb-update.service
|
/usr/lib/systemd/system/sysinit.target.wants/systemd-hwdb-update.service
|
||||||
/usr/lib/systemd/system/sysinit.target.wants/systemd-update-done.service
|
/usr/lib/systemd/system/sysinit.target.wants/systemd-update-done.service
|
||||||
/usr/lib/systemd/system/update-triggers.target.wants
|
|
||||||
|
|||||||
+6
-2
@@ -98,9 +98,13 @@ def zap_entire_file_end(filename):
|
|||||||
global files
|
global files
|
||||||
global files_chunks
|
global files_chunks
|
||||||
global files_header
|
global files_header
|
||||||
|
files_to_remove = list()
|
||||||
for file in files:
|
for file in files:
|
||||||
if file.endswith(filename):
|
if file.endswith(filename):
|
||||||
files.remove(file)
|
# Don't modify the original list while iterating over it
|
||||||
|
files_to_remove.append(file)
|
||||||
|
for file in files_to_remove:
|
||||||
|
files.remove(file)
|
||||||
|
|
||||||
def zap_line_in_file_substring(filename, match):
|
def zap_line_in_file_substring(filename, match):
|
||||||
global header
|
global header
|
||||||
@@ -186,7 +190,7 @@ def zap_empty_chunks():
|
|||||||
files_to_remove = list()
|
files_to_remove = list()
|
||||||
for file in files:
|
for file in files:
|
||||||
if file not in files_chunks:
|
if file not in files_chunks:
|
||||||
files.remove(file)
|
files_to_remove.append(file)
|
||||||
continue
|
continue
|
||||||
to_remove = list()
|
to_remove = list()
|
||||||
for chunk in files_chunks[file]:
|
for chunk in files_chunks[file]:
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ def vendor_check():
|
|||||||
|
|
||||||
def get_args():
|
def get_args():
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
|
parser.add_argument('archives')
|
||||||
parser.add_argument('url')
|
parser.add_argument('url')
|
||||||
parser.add_argument('name')
|
parser.add_argument('name')
|
||||||
parser.add_argument('git')
|
parser.add_argument('git')
|
||||||
@@ -44,7 +45,7 @@ def setup_content(url):
|
|||||||
with open(outfile, 'wb') as cfile:
|
with open(outfile, 'wb') as cfile:
|
||||||
cfile.write(response.content)
|
cfile.write(response.content)
|
||||||
|
|
||||||
subprocess.run(f"tar xf {outfile}", shell=True, cwd=tdir, check=True)
|
subprocess.run(f"tar xf {outfile}", shell=True, cwd=tdir, check=True, stdout=subprocess.DEVNULL)
|
||||||
os.remove(outfile)
|
os.remove(outfile)
|
||||||
return tdir
|
return tdir
|
||||||
|
|
||||||
@@ -60,61 +61,88 @@ def setup_cargo_vendor(path):
|
|||||||
def update_cargo_vendor(path, name, git):
|
def update_cargo_vendor(path, name, git):
|
||||||
git_uri = os.path.join(git, name)
|
git_uri = os.path.join(git, name)
|
||||||
vendor_path = os.path.join(path, 'vendor')
|
vendor_path = os.path.join(path, 'vendor')
|
||||||
subprocess.run(f"git clone {git_uri} {vendor_path}", shell=True, check=True)
|
subprocess.run(f"git clone {git_uri} {vendor_path}", shell=True, check=True,
|
||||||
|
stdout=subprocess.DEVNULL)
|
||||||
vendor_git = os.path.join(vendor_path, '.git')
|
vendor_git = os.path.join(vendor_path, '.git')
|
||||||
if not os.path.isdir(vendor_git):
|
if not os.path.isdir(vendor_git):
|
||||||
# initialize a git repo
|
# initialize a git repo
|
||||||
subprocess.run('git init .', cwd=vendor_path, shell=True, check=True)
|
subprocess.run('git init .', cwd=vendor_path, shell=True, check=True,
|
||||||
|
stdout=subprocess.DEVNULL)
|
||||||
subprocess.run(f"git remote add origin {git_uri}", cwd=vendor_path,
|
subprocess.run(f"git remote add origin {git_uri}", cwd=vendor_path,
|
||||||
shell=True, check=True)
|
shell=True, check=True, stdout=subprocess.DEVNULL)
|
||||||
backup_vendor_git = os.path.join(path, 'clear-linux-vendor-git')
|
backup_vendor_git = os.path.join(path, 'clear-linux-vendor-git')
|
||||||
subprocess.run(f"cp -a {vendor_git} {backup_vendor_git}", cwd=path,
|
subprocess.run(f"cp -a {vendor_git} {backup_vendor_git}", cwd=path,
|
||||||
shell=True, check=True)
|
shell=True, check=True, stdout=subprocess.DEVNULL)
|
||||||
shutil.rmtree(vendor_path)
|
shutil.rmtree(vendor_path)
|
||||||
subprocess.run('cargo vendor', cwd=path, shell=True, check=True)
|
subprocess.run('cargo vendor', cwd=path, shell=True, check=True,
|
||||||
|
stdout=subprocess.DEVNULL)
|
||||||
subprocess.run(f"cp -a {backup_vendor_git} {vendor_git}", cwd=path,
|
subprocess.run(f"cp -a {backup_vendor_git} {vendor_git}", cwd=path,
|
||||||
shell=True, check=True)
|
shell=True, check=True, stdout=subprocess.DEVNULL)
|
||||||
repo = Repo(vendor_path)
|
repo = Repo(vendor_path)
|
||||||
if not (len(repo.untracked_files) > 0 or repo.is_dirty()):
|
if not (len(repo.untracked_files) > 0 or repo.is_dirty()):
|
||||||
return False
|
return False
|
||||||
subprocess.run('git add .', cwd=vendor_path, shell=True, check=True)
|
subprocess.run('git add .', cwd=vendor_path, shell=True, check=True,
|
||||||
|
stdout=subprocess.DEVNULL)
|
||||||
subprocess.run('git commit -m "vendor update"', cwd=vendor_path,
|
subprocess.run('git commit -m "vendor update"', cwd=vendor_path,
|
||||||
shell=True, check=True)
|
shell=True, check=True, stdout=subprocess.DEVNULL)
|
||||||
gmt = time.gmtime()
|
gmt = time.gmtime()
|
||||||
tag = f"{gmt.tm_year}-{gmt.tm_mon:02d}-{gmt.tm_mday:02d}-{gmt.tm_hour:02d}-{gmt.tm_min:02d}-{gmt.tm_sec:02d}"
|
tag = f"{gmt.tm_year}-{gmt.tm_mon:02d}-{gmt.tm_mday:02d}-{gmt.tm_hour:02d}-{gmt.tm_min:02d}-{gmt.tm_sec:02d}"
|
||||||
subprocess.run(f"git tag {tag}", cwd=vendor_path, shell=True,
|
subprocess.run(f"git tag {tag}", cwd=vendor_path, shell=True,
|
||||||
check=True)
|
check=True, stdout=subprocess.DEVNULL)
|
||||||
subprocess.run(f"git push origin main:main {tag}", cwd=vendor_path,
|
subprocess.run(f"git push origin main:main {tag}", cwd=vendor_path,
|
||||||
shell=True, check=True)
|
shell=True, check=True, stdout=subprocess.DEVNULL)
|
||||||
time.sleep(30)
|
time.sleep(30)
|
||||||
return tag
|
return tag
|
||||||
|
|
||||||
|
|
||||||
def update_cargo_sources(name, tag):
|
def update_cargo_sources(name, tag):
|
||||||
makefile = []
|
makefile = []
|
||||||
archive_match = os.path.join('$(CGIT_BASE_URL)', 'vendor', name,
|
options = []
|
||||||
|
archive_match = os.path.join(r'\$\(CGIT_BASE_URL\)', 'vendor', name,
|
||||||
'snapshot', name)
|
'snapshot', name)
|
||||||
|
archive_replace = os.path.join('$(CGIT_BASE_URL)', 'vendor', name,
|
||||||
|
'snapshot', name)
|
||||||
with open('Makefile', encoding='utf8') as mfile:
|
with open('Makefile', encoding='utf8') as mfile:
|
||||||
for line in mfile.readlines():
|
for line in mfile.readlines():
|
||||||
if line.startswith('ARCHIVES'):
|
if line.startswith('ARCHIVES'):
|
||||||
if re.match(archive_match + '[a-zA-Z0-9_\-.]+\.tar\.xz', line):
|
if re.search(archive_match + r'[a-zA-Z0-9_\-.]+\.tar\.xz', line):
|
||||||
new_archives = re.sub(archive_match + '[a-zA-Z0-9_\-.]+\.tar\.xz',
|
new_archives = re.sub(archive_match + r'[a-zA-Z0-9_\-.]+\.tar\.xz',
|
||||||
f"{archive_match}-{tag}.tar.xz\n", line)
|
f"{archive_replace}-{tag}.tar.xz", line)
|
||||||
else:
|
else:
|
||||||
new_archives = f"ARCHIVES = {archive_match}-{tag}.tar.xz ./vendor\n"
|
new_archives = f"{line[:-1]} {archive_replace}-{tag}.tar.xz ./vendor\n"
|
||||||
|
print(new_archives.replace('ARCHIVES = ', '', 1))
|
||||||
makefile.append(new_archives)
|
makefile.append(new_archives)
|
||||||
else:
|
else:
|
||||||
makefile.append(line)
|
makefile.append(line)
|
||||||
with open('Makefile', 'w', encoding='utf8') as mfile:
|
with open('Makefile', 'w', encoding='utf8') as mfile:
|
||||||
mfile.writelines(makefile)
|
mfile.writelines(makefile)
|
||||||
|
|
||||||
|
archive_match = os.path.join('http://localhost', 'cgit', 'vendor', name,
|
||||||
|
'snapshot', name)
|
||||||
|
with open('options.conf', encoding='utf8') as ofile:
|
||||||
|
for line in ofile.readlines():
|
||||||
|
if line.startswith('archives'):
|
||||||
|
if re.search(archive_match + r'[a-zA-Z0-9_\-.]+\.tar\.xz', line):
|
||||||
|
new_archives = re.sub(archive_match + r'[a-zA-Z0-9_\-.]+\.tar\.xz',
|
||||||
|
f"{archive_match}-{tag}.tar.xz", line)
|
||||||
|
else:
|
||||||
|
new_archives = f"{line[:-1]} {archive_match}-{tag}.tar.xz ./vendor\n"
|
||||||
|
options.append(new_archives)
|
||||||
|
else:
|
||||||
|
options.append(line)
|
||||||
|
with open('options.conf', 'w', encoding='utf8') as ofile:
|
||||||
|
ofile.writelines(options)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
updated = False
|
||||||
|
args = get_args()
|
||||||
|
|
||||||
vtype = vendor_check()
|
vtype = vendor_check()
|
||||||
if not vtype:
|
if not vtype:
|
||||||
|
print(args.archives)
|
||||||
return
|
return
|
||||||
|
|
||||||
args = get_args()
|
|
||||||
tdir = setup_content(args.url)
|
tdir = setup_content(args.url)
|
||||||
if vtype == 'cargo':
|
if vtype == 'cargo':
|
||||||
vdir = setup_cargo_vendor(tdir)
|
vdir = setup_cargo_vendor(tdir)
|
||||||
@@ -122,7 +150,11 @@ def main():
|
|||||||
tag = update_cargo_vendor(vdir, args.name, args.git)
|
tag = update_cargo_vendor(vdir, args.name, args.git)
|
||||||
if tag:
|
if tag:
|
||||||
update_cargo_sources(args.name, tag)
|
update_cargo_sources(args.name, tag)
|
||||||
|
updated = True
|
||||||
|
if not updated:
|
||||||
|
print(args.archives)
|
||||||
shutil.rmtree(tdir)
|
shutil.rmtree(tdir)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|||||||
Reference in New Issue
Block a user