Compare commits

...

19 Commits

Author SHA1 Message Date
clrbuilder fc6b90aaa5 Update packages file for version 38830
Signed-off-by: clrbuilder <clrbuilder@intel.com>
2023-04-18 07:56:02 -07:00
clrbuilder b25ec94cf9 Update packages file for version 38820
Signed-off-by: clrbuilder <clrbuilder@intel.com>
2023-04-17 13:01:55 -07:00
clrbuilder a8500a2645 Update packages file for version 38810
Signed-off-by: clrbuilder <clrbuilder@intel.com>
2023-04-17 07:48:28 -07:00
clrbuilder 9d15900efd Update packages file for version 38800
Signed-off-by: clrbuilder <clrbuilder@intel.com>
2023-04-14 09:13:47 -07:00
clrbuilder 9d101b84cf Update packages file for version 38760
Signed-off-by: clrbuilder <clrbuilder@intel.com>
2023-04-12 11:23:10 -07:00
clrbuilder 89d86df8d3 Update packages file for version 38750
Signed-off-by: clrbuilder <clrbuilder@intel.com>
2023-04-11 00:07:27 -07:00
clrbuilder 23e40ddcd8 Update packages file for version 38740
Signed-off-by: clrbuilder <clrbuilder@intel.com>
2023-04-06 00:07:15 -07:00
clrbuilder e0a40a10f2 Update packages file for version 38710
Signed-off-by: clrbuilder <clrbuilder@intel.com>
2023-04-03 14:52:16 -07:00
clrbuilder 3b76c04f7f Update packages file for version 38700
Signed-off-by: clrbuilder <clrbuilder@intel.com>
2023-03-30 16:26:28 -07:00
clrbuilder 8b9b13698f Update packages file for version 38690
Signed-off-by: clrbuilder <clrbuilder@intel.com>
2023-03-30 11:21:18 -07:00
clrbuilder 1f2b9cc5a7 Update packages file for version 38680
Signed-off-by: clrbuilder <clrbuilder@intel.com>
2023-03-30 00:06:55 -07:00
William Douglas aa0028d372 Correct test for config value being set
Fix the vendor.py test checking if cargo vendoring should be done.

Signed-off-by: William Douglas <william.douglas@intel.com>
2023-03-29 16:31:28 -07:00
clrbuilder fb17b414ed Update packages file for version 38650
Signed-off-by: clrbuilder <clrbuilder@intel.com>
2023-03-28 00:08:23 -07:00
William Douglas ead0c3e12d Only vendor if cargo_vendor is true not just if it exists
Signed-off-by: William Douglas <william.douglas@intel.com>
2023-03-27 10:19:53 -07:00
clrbuilder 610754dddd Update packages file for version 38640
Signed-off-by: clrbuilder <clrbuilder@intel.com>
2023-03-24 13:27:46 -07:00
William Douglas ef9417d080 Add checks to ensure options.conf is valid
Signed-off-by: William Douglas <william.douglas@intel.com>
2023-03-24 11:18:11 -07:00
William Douglas dcc38f2193 Add vendor target
Add handling for a vendor target that will handle specific vendor
requirements from a package's options.conf.

The initial change adds handling for 'cargo vendor', creating a new
repo in the configured git repositiory and setting up the ARCHIVES
variable in the package's Makefile.

If the repo already exists, the tooling will check if a repo change
was detected after re-vendoring the sources. If a change is detected
the new content will be pushed and the ARCHIVES variable will be
updated.

Signed-off-by: William Douglas <william.douglas@intel.com>
2023-03-23 15:01:17 -07:00
clrbuilder 9be96daea4 Update packages file for version 38630
Signed-off-by: clrbuilder <clrbuilder@intel.com>
2023-03-23 00:07:26 -07:00
clrbuilder 1350df4df6 Update packages file for version 38620
Signed-off-by: clrbuilder <clrbuilder@intel.com>
2023-03-21 14:46:06 -07:00
4 changed files with 196 additions and 24 deletions
+5
View File
@@ -157,6 +157,10 @@ 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
@@ -171,6 +175,7 @@ autospec: preautospec-checks pullrebase localreponotice clean-old-content
exit 1; \ exit 1; \
fi fi
@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 \
+3
View File
@@ -35,6 +35,9 @@ PKG_BASE_URL = https://github.com/clearlinux-pkgs
# Location where project repos are hosted. # Location where project repos are hosted.
PRJ_BASE_URL = https://github.com/clearlinux PRJ_BASE_URL = https://github.com/clearlinux
# Location where vendor repos are hosted.
VND_BASE_URL =
# Project repos that are integral to the common tooling. # Project repos that are integral to the common tooling.
PROJ_PKGS = autospec clr-bundles common PROJ_PKGS = autospec clr-bundles common
+60 -24
View File
@@ -80,6 +80,7 @@ R-DendSer
R-Deriv R-Deriv
R-DescTools R-DescTools
R-DiagrammeR R-DiagrammeR
R-DiceDesign
R-DistributionUtils R-DistributionUtils
R-DoseFinding R-DoseFinding
R-Ecdat R-Ecdat
@@ -259,6 +260,7 @@ R-caret
R-cclust R-cclust
R-cellranger R-cellranger
R-checkmate R-checkmate
R-chk
R-chron R-chron
R-circlize R-circlize
R-classInt R-classInt
@@ -317,6 +319,8 @@ R-dendextend
R-desc R-desc
R-devtools R-devtools
R-dfoptim R-dfoptim
R-diagram
R-dials
R-dichromat R-dichromat
R-diffobj R-diffobj
R-diffusionMap R-diffusionMap
@@ -1035,6 +1039,7 @@ Vulkan-Headers
Vulkan-Loader Vulkan-Loader
Vulkan-Tools Vulkan-Tools
WALinuxAgent WALinuxAgent
WPEBackend-fdo
WireGuard WireGuard
XStatic-term.js XStatic-term.js
Z3 Z3
@@ -1388,6 +1393,7 @@ dolphin
dolphin-plugins dolphin-plugins
dos2unix dos2unix
dosfstools dosfstools
dotconf
double-conversion double-conversion
dovecot dovecot
doxygen doxygen
@@ -1598,6 +1604,7 @@ gnome-music
gnome-online-accounts gnome-online-accounts
gnome-panel gnome-panel
gnome-photos gnome-photos
gnome-remote-desktop
gnome-screensaver gnome-screensaver
gnome-screenshot gnome-screenshot
gnome-session gnome-session
@@ -2046,6 +2053,7 @@ libaccounts-glib
libaccounts-qt libaccounts-qt
libadwaita libadwaita
libaio libaio
libao
libappindicator libappindicator
libarchive libarchive
libass libass
@@ -2109,7 +2117,6 @@ libffi
libfido2 libfido2
libfixmath libfixmath
libfm libfm
libfm-qt
libfontenc libfontenc
libfreehand libfreehand
libftdi1 libftdi1
@@ -2165,7 +2172,6 @@ libksieve
libksysguard libksysguard
liblangtag liblangtag
liblogging liblogging
liblxqt
libmaxminddb libmaxminddb
libmbim libmbim
libmediaart libmediaart
@@ -2219,7 +2225,6 @@ libqalculate
libqb libqb
libqmi libqmi
libqrtr-glib libqrtr-glib
libqtxdg
libqxp libqxp
libratbag libratbag
librdkafka librdkafka
@@ -2256,7 +2261,6 @@ libstaroffice
libstatgrab libstatgrab
libstemmer_c libstemmer_c
libstoragemgmt libstoragemgmt
libsysstat
libtasn1 libtasn1
libtermkey libtermkey
libthai libthai
@@ -2293,6 +2297,7 @@ libwebp
libwnck libwnck
libwnck3 libwnck3
libwpd libwpd
libwpe
libwpg libwpg
libwps libwps
libxcvt libxcvt
@@ -2338,8 +2343,8 @@ lksctp-tools
llvm llvm
llvm11 llvm11
llvm12 llvm12
llvm13
llvm14 llvm14
llvm15
lm-sensors lm-sensors
lmdb lmdb
logrotate logrotate
@@ -2362,21 +2367,6 @@ luarocks
lutris lutris
luv luv
lv2 lv2
lxqt-about
lxqt-admin
lxqt-build-tools
lxqt-config
lxqt-globalkeys
lxqt-notificationd
lxqt-openssh-askpass
lxqt-panel
lxqt-policykit
lxqt-powermanagement
lxqt-qtplugin
lxqt-runner
lxqt-session
lxqt-sudo
lxqt-themes
lynx lynx
lz4 lz4
lzlib lzlib
@@ -2550,6 +2540,7 @@ numactl
numatop numatop
numlockx numlockx
numpy-stl numpy-stl
nv-codec-headers
nvme-cli nvme-cli
oath-toolkit oath-toolkit
obs-studio obs-studio
@@ -2572,7 +2563,6 @@ openQA
openal-soft openal-soft
openblas openblas
openbox openbox
opencl-clang
opencl-headers opencl-headers
openconnect openconnect
openct openct
@@ -2629,7 +2619,6 @@ pavucontrol
pbzip2 pbzip2
pciutils pciutils
pcmanfm pcmanfm
pcmanfm-qt
pcp pcp
pcre pcre
pcre2 pcre2
@@ -3574,6 +3563,7 @@ pmdk
pmix pmix
pngcrush pngcrush
po4a po4a
poco
podman podman
polkit polkit
polkit-kde-agent polkit-kde-agent
@@ -3634,6 +3624,7 @@ pypi-aiohttp
pypi-aiohttp_cors pypi-aiohttp_cors
pypi-aiosignal pypi-aiosignal
pypi-aiosmtpd pypi-aiosmtpd
pypi-aiosqlite
pypi-alabaster pypi-alabaster
pypi-altgraph pypi-altgraph
pypi-amqp pypi-amqp
@@ -3668,6 +3659,7 @@ pypi-asyncssh
pypi-asynctest pypi-asynctest
pypi-atomicwrites pypi-atomicwrites
pypi-atpublic pypi-atpublic
pypi-attrdict
pypi-attrs pypi-attrs
pypi-autocommand pypi-autocommand
pypi-automat pypi-automat
@@ -3691,6 +3683,7 @@ pypi-bashlex
pypi-bcrypt pypi-bcrypt
pypi-beautifulsoup4 pypi-beautifulsoup4
pypi-beniget pypi-beniget
pypi-billiard
pypi-binaryornot pypi-binaryornot
pypi-bindep pypi-bindep
pypi-bitmath pypi-bitmath
@@ -3753,6 +3746,7 @@ pypi-cmarkgfm
pypi-cmd2 pypi-cmd2
pypi-codecov pypi-codecov
pypi-colorama pypi-colorama
pypi-coloredlogs
pypi-colorlog pypi-colorlog
pypi-columnize pypi-columnize
pypi-comm pypi-comm
@@ -3775,6 +3769,7 @@ pypi-crcmod
pypi-cryptography pypi-cryptography
pypi-cryptography_vectors pypi-cryptography_vectors
pypi-cs pypi-cs
pypi-csscompressor
pypi-cssselect pypi-cssselect
pypi-cssselect2 pypi-cssselect2
pypi-cu2qu pypi-cu2qu
@@ -3794,6 +3789,10 @@ pypi-deepmerge
pypi-deepspeed pypi-deepspeed
pypi-deprecated pypi-deprecated
pypi-deprecation pypi-deprecation
pypi-devpi_client
pypi-devpi_common
pypi-devpi_process
pypi-devpi_server
pypi-diff_cover pypi-diff_cover
pypi-diff_match_patch pypi-diff_match_patch
pypi-diffoscope pypi-diffoscope
@@ -3874,6 +3873,7 @@ pypi-geventhttpclient
pypi-ghp_import pypi-ghp_import
pypi-gitdb pypi-gitdb
pypi-gitpython pypi-gitpython
pypi-glad
pypi-glfw pypi-glfw
pypi-gmqtt pypi-gmqtt
pypi-google_api_core pypi-google_api_core
@@ -3927,6 +3927,7 @@ pypi-httpx
pypi-huggingface_hub pypi-huggingface_hub
pypi-humanfriendly pypi-humanfriendly
pypi-humanize pypi-humanize
pypi-hupper
pypi-hyperframe pypi-hyperframe
pypi-hyperlink pypi-hyperlink
pypi-hypothesis pypi-hypothesis
@@ -3984,6 +3985,7 @@ pypi-jmespath
pypi-joblib pypi-joblib
pypi-josepy pypi-josepy
pypi-jpype1 pypi-jpype1
pypi-jsmin
pypi-json5 pypi-json5
pypi-jsondiff pypi-jsondiff
pypi-jsonlines pypi-jsonlines
@@ -3999,11 +4001,15 @@ pypi-jupyter_events
pypi-jupyter_nbgallery pypi-jupyter_nbgallery
pypi-jupyter_packaging pypi-jupyter_packaging
pypi-jupyter_server pypi-jupyter_server
pypi-jupyter_server_fileid
pypi-jupyter_server_mathjax pypi-jupyter_server_mathjax
pypi-jupyter_server_terminals pypi-jupyter_server_terminals
pypi-jupyter_server_ydoc
pypi-jupyter_sphinx pypi-jupyter_sphinx
pypi-jupyter_ydoc
pypi-jupyterlab pypi-jupyterlab
pypi-jupyterlab_launcher pypi-jupyterlab_launcher
pypi-jupyterlab_link_share
pypi-jupyterlab_pygments pypi-jupyterlab_pygments
pypi-jupyterlab_server pypi-jupyterlab_server
pypi-jupyterlab_widgets pypi-jupyterlab_widgets
@@ -4019,6 +4025,8 @@ pypi-kubernetes
pypi-langcodes pypi-langcodes
pypi-lark_parser pypi-lark_parser
pypi-latexcodec pypi-latexcodec
pypi-lavacli
pypi-lazy
pypi-lazy_loader pypi-lazy_loader
pypi-lazy_object_proxy pypi-lazy_object_proxy
pypi-ldap3 pypi-ldap3
@@ -4041,6 +4049,7 @@ pypi-markdown2
pypi-markdown_it_py pypi-markdown_it_py
pypi-matplotlib pypi-matplotlib
pypi-matplotlib_inline pypi-matplotlib_inline
pypi-maturin
pypi-mdit_py_plugins pypi-mdit_py_plugins
pypi-mdurl pypi-mdurl
pypi-mergedeep pypi-mergedeep
@@ -4051,9 +4060,13 @@ pypi-mistune
pypi-mkdocs pypi-mkdocs
pypi-mkdocs_autorefs pypi-mkdocs_autorefs
pypi-mkdocs_exclude pypi-mkdocs_exclude
pypi-mkdocs_gen_files
pypi-mkdocs_htmlproofer_plugin
pypi-mkdocs_material_extensions pypi-mkdocs_material_extensions
pypi-mkdocs_monorepo_plugin
pypi-mkdocstrings pypi-mkdocstrings
pypi-mkdocstrings_python pypi-mkdocstrings_python
pypi-ml_dtypes
pypi-mock pypi-mock
pypi-modulegraph pypi-modulegraph
pypi-molecule pypi-molecule
@@ -4114,6 +4127,7 @@ pypi-ovirt_imageio
pypi-packaging pypi-packaging
pypi-paho_mqtt pypi-paho_mqtt
pypi-pandocfilters pypi-pandocfilters
pypi-parameterized
pypi-paramiko pypi-paramiko
pypi-parse pypi-parse
pypi-parse_type pypi-parse_type
@@ -4121,6 +4135,7 @@ pypi-parsedatetime
pypi-parsley pypi-parsley
pypi-parso pypi-parso
pypi-partd pypi-partd
pypi-passlib
pypi-paste pypi-paste
pypi-pastedeploy pypi-pastedeploy
pypi-pastel pypi-pastel
@@ -4132,6 +4147,7 @@ pypi-pbr
pypi-pdm_pep517 pypi-pdm_pep517
pypi-pecan pypi-pecan
pypi-ped pypi-ped
pypi-pefile
pypi-pep517 pypi-pep517
pypi-pep621 pypi-pep621
pypi-pep8 pypi-pep8
@@ -4143,13 +4159,17 @@ pypi-phabricator
pypi-pickleshare pypi-pickleshare
pypi-picobox pypi-picobox
pypi-pid pypi-pid
pypi-pidigits
pypi-pillow pypi-pillow
pypi-pint pypi-pint
pypi-pip pypi-pip
pypi-pip_tools pypi-pip_tools
pypi-pipdeptree
pypi-pkgconfig pypi-pkgconfig
pypi-pkginfo pypi-pkginfo
pypi-pkgutil_resolve_name pypi-pkgutil_resolve_name
pypi-plaster
pypi-plaster_pastedeploy
pypi-platformdirs pypi-platformdirs
pypi-plotly pypi-plotly
pypi-pluggy pypi-pluggy
@@ -4236,6 +4256,7 @@ pypi-pyqrcode
pypi-pyqt6_sip pypi-pyqt6_sip
pypi-pyqt_builder pypi-pyqt_builder
pypi-pyquery pypi-pyquery
pypi-pyramid
pypi-pyreadline pypi-pyreadline
pypi-pyrfc3339 pypi-pyrfc3339
pypi-pyro4 pypi-pyro4
@@ -4326,6 +4347,7 @@ pypi-requirements_parser
pypi-resolvelib pypi-resolvelib
pypi-responses pypi-responses
pypi-restructuredtext_lint pypi-restructuredtext_lint
pypi-retrolab
pypi-retry pypi-retry
pypi-retry_decorator pypi-retry_decorator
pypi-retryz pypi-retryz
@@ -4430,7 +4452,9 @@ pypi-sshtunnel
pypi-stack_data pypi-stack_data
pypi-statsmodels pypi-statsmodels
pypi-storops pypi-storops
pypi-strictyaml
pypi-subprocess_tee pypi-subprocess_tee
pypi-suds
pypi-sure pypi-sure
pypi-svg.path pypi-svg.path
pypi-tabulate pypi-tabulate
@@ -4452,6 +4476,7 @@ pypi-three_merge
pypi-tifffile pypi-tifffile
pypi-tinycss2 pypi-tinycss2
pypi-tldextract pypi-tldextract
pypi-tokenizers
pypi-toml pypi-toml
pypi-tomli pypi-tomli
pypi-tomli_w pypi-tomli_w
@@ -4464,6 +4489,7 @@ pypi-tox
pypi-tqdm pypi-tqdm
pypi-traitlets pypi-traitlets
pypi-trampolim pypi-trampolim
pypi-translationstring
pypi-trimesh pypi-trimesh
pypi-trio pypi-trio
pypi-trio_websocket pypi-trio_websocket
@@ -4511,7 +4537,9 @@ pypi-urwid
pypi-user_agents pypi-user_agents
pypi-userpath pypi-userpath
pypi-uvloop pypi-uvloop
pypi-venusian
pypi-verboselogs pypi-verboselogs
pypi-versioneer
pypi-vine pypi-vine
pypi-virtualenv pypi-virtualenv
pypi-volatile pypi-volatile
@@ -4537,6 +4565,7 @@ pypi-wrapt
pypi-wsgiproxy2 pypi-wsgiproxy2
pypi-wsproto pypi-wsproto
pypi-wurlitzer pypi-wurlitzer
pypi-xcffib
pypi-xgboost pypi-xgboost
pypi-xmldiff pypi-xmldiff
pypi-xmljson pypi-xmljson
@@ -4557,11 +4586,14 @@ pypi-xstatic_objectpath
pypi-xstatic_roboto_fontface pypi-xstatic_roboto_fontface
pypi-xvfbwrapper pypi-xvfbwrapper
pypi-xyzservices pypi-xyzservices
pypi-y_py
pypi-yamllint pypi-yamllint
pypi-yamlloader pypi-yamlloader
pypi-yapf pypi-yapf
pypi-yarg pypi-yarg
pypi-yarl pypi-yarl
pypi-yattag
pypi-ypy_websocket
pypi-zabbix_api pypi-zabbix_api
pypi-zc.lockfile pypi-zc.lockfile
pypi-zeroconf pypi-zeroconf
@@ -4655,7 +4687,6 @@ qtwebchannel
qtwebengine qtwebengine
qtwebsockets qtwebsockets
qtx11extras qtx11extras
qtxdg-tools
qtxmlpatterns qtxmlpatterns
quagga quagga
quassel quassel
@@ -4685,6 +4716,7 @@ rest
restic restic
rhythmbox rhythmbox
rinutils rinutils
ripgrep
rlwrap rlwrap
rng-tools rng-tools
robin-map robin-map
@@ -4753,6 +4785,7 @@ smartcols
smartmontools smartmontools
smemstat smemstat
snappy snappy
sndio
socat socat
sof-bin sof-bin
softflowd softflowd
@@ -4873,6 +4906,7 @@ tracker
tracker-miners tracker-miners
tree tree
tree-sitter tree-sitter
trurl
tzdata tzdata
uchardet uchardet
ucpp ucpp
@@ -4929,7 +4963,7 @@ wayland
wayland-protocols wayland-protocols
wcslib wcslib
webkitgtk webkitgtk
webkitgtk50 webkitgtk60
weechat weechat
weston weston
wget wget
@@ -4939,6 +4973,7 @@ wine
wireless-regdb-master wireless-regdb-master
wireplumber wireplumber
wireshark wireshark
wl-clipboard
wlroots wlroots
wmctrl wmctrl
woff2 woff2
@@ -5012,6 +5047,7 @@ xmlsec1
xmlstarlet xmlstarlet
xmlto xmlto
xmodmap xmodmap
xnec2c
xorg-fonts xorg-fonts
xorg-server xorg-server
xorgproto xorgproto
Executable
+128
View File
@@ -0,0 +1,128 @@
#!/usr/bin/env python3
import argparse
import configparser
import os
import re
import shutil
import subprocess
import tempfile
import time
from git import Repo
import requests
def vendor_check():
if not os.path.isfile('options.conf'):
return False
config = configparser.ConfigParser(interpolation=None)
config.read('options.conf')
if 'autospec' not in config.sections():
return False
if vendor := config['autospec'].get('cargo_vendor'):
if vendor == "true":
return 'cargo'
return False
def get_args():
parser = argparse.ArgumentParser()
parser.add_argument('url')
parser.add_argument('name')
parser.add_argument('git')
return parser.parse_args()
def setup_content(url):
tdir = tempfile.mkdtemp()
outfile = os.path.join(tdir, os.path.basename(url))
response = requests.get(url, timeout=30)
response.raise_for_status()
with open(outfile, 'wb') as cfile:
cfile.write(response.content)
subprocess.run(f"tar xf {outfile}", shell=True, cwd=tdir, check=True)
os.remove(outfile)
return tdir
def setup_cargo_vendor(path):
for dirpath, _, files in os.walk(path):
for fname in files:
if fname == "Cargo.toml":
return dirpath
return False
def update_cargo_vendor(path, name, git):
git_uri = os.path.join(git, name)
vendor_path = os.path.join(path, 'vendor')
subprocess.run(f"git clone {git_uri} {vendor_path}", shell=True, check=True)
vendor_git = os.path.join(vendor_path, '.git')
if not os.path.isdir(vendor_git):
# initialize a git repo
subprocess.run('git init .', cwd=vendor_path, shell=True, check=True)
subprocess.run(f"git remote add origin {git_uri}", cwd=vendor_path,
shell=True, check=True)
backup_vendor_git = os.path.join(path, 'clear-linux-vendor-git')
subprocess.run(f"cp -a {vendor_git} {backup_vendor_git}", cwd=path,
shell=True, check=True)
shutil.rmtree(vendor_path)
subprocess.run('cargo vendor', cwd=path, shell=True, check=True)
subprocess.run(f"cp -a {backup_vendor_git} {vendor_git}", cwd=path,
shell=True, check=True)
repo = Repo(vendor_path)
if not len(repo.untracked_files) > 0 or repo.is_dirty():
return False
subprocess.run('git add .', cwd=vendor_path, shell=True, check=True)
subprocess.run('git commit -m "vendor update"', cwd=vendor_path,
shell=True, check=True)
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}"
subprocess.run(f"git tag {tag}", cwd=vendor_path, shell=True,
check=True)
subprocess.run(f"git push origin main:main {tag}", cwd=vendor_path,
shell=True, check=True)
time.sleep(30)
return tag
def update_cargo_sources(name, tag):
makefile = []
archive_match = os.path.join('$(CGIT_BASE_URL)', 'vendor', name,
'snapshot', name)
with open('Makefile', encoding='utf8') as mfile:
for line in mfile.readlines():
if line.startswith('ARCHIVES'):
if re.match(archive_match + '[a-zA-Z0-9_\-.]+\.tar\.xz', line):
new_archives = re.sub(archive_match + '[a-zA-Z0-9_\-.]+\.tar\.xz',
f"{archive_match}-{tag}.tar.xz\n", line)
else:
new_archives = f"ARCHIVES = {archive_match}-{tag}.tar.xz ./vendor\n"
makefile.append(new_archives)
else:
makefile.append(line)
with open('Makefile', 'w', encoding='utf8') as mfile:
mfile.writelines(makefile)
def main():
vtype = vendor_check()
if not vtype:
return
args = get_args()
tdir = setup_content(args.url)
if vtype == 'cargo':
vdir = setup_cargo_vendor(tdir)
if vdir:
tag = update_cargo_vendor(vdir, args.name, args.git)
if tag:
update_cargo_sources(args.name, tag)
shutil.rmtree(tdir)
if __name__ == '__main__':
main()