Skip to content

Commit 2170bfe

Browse files
committed
Add example for regex
Signed-off-by: Keshav Priyadarshi <git@keshav.space>
1 parent 71b92b4 commit 2170bfe

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/fetchcode/package.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,47 +419,54 @@ def get_package_info(cls, package_url):
419419
class UtilLinuxDirectoryListedSource(DirectoryListedSource):
420420
source_url = "https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/"
421421
is_nested = True
422+
# Source archive ex: util-linux-1.2.3.tar.gz
422423
source_archive_regex = re.compile(r"^(util-linux-)(?P<version>[\w.-]*)(.tar.gz)$")
423424
ignored_files_and_dir = []
424425

425426

426427
class BusyBoxDirectoryListedSource(DirectoryListedSource):
427428
source_url = "https://www.busybox.net/downloads/"
429+
# Source archive ex: busybox-1.2.3.tar.bz2
428430
source_archive_regex = re.compile(r"^(busybox-)(?P<version>[\w.-]*)(.tar.bz2)$")
429431
is_nested = False
430432
ignored_files_and_dir = []
431433

432434

433435
class UclibcDirectoryListedSource(DirectoryListedSource):
434436
source_url = "https://www.uclibc.org/downloads/"
437+
# Source archive ex: uClibc-1.2.3.tar.gz
435438
source_archive_regex = re.compile(r"^(uClibc-)(?P<version>[\w.-]*)(.tar.gz)$")
436439
is_nested = False
437440
ignored_files_and_dir = []
438441

439442

440443
class UclibcNGDirectoryListedSource(DirectoryListedSource):
441444
source_url = "https://downloads.uclibc-ng.org/releases/"
445+
# Source archive ex: uClibc-ng-1.2.3.tar.gz
442446
source_archive_regex = re.compile(r"^(uClibc-ng-)(?P<version>[\w.-]*)(.tar.gz)$")
443447
is_nested = True
444448
ignored_files_and_dir = []
445449

446450

447451
class Bzip2DirectoryListedSource(DirectoryListedSource):
448452
source_url = "https://sourceware.org/pub/bzip2/"
453+
# Source archive ex: bzip2-1.2.3.tar.gz
449454
source_archive_regex = re.compile(r"^(bzip2-)(?P<version>[\w.-]*)(.tar.gz)$")
450455
is_nested = False
451456
ignored_files_and_dir = []
452457

453458

454459
class OpenSSHDirectoryListedSource(DirectoryListedSource):
455460
source_url = "https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/"
461+
# Source archive ex: openssh-1.2.3.tar.gz
456462
source_archive_regex = re.compile(r"^(openssh-)(?P<version>[\w.-]*)(.tgz|.tar.gz)$")
457463
is_nested = False
458464
ignored_files_and_dir = []
459465

460466

461467
class DnsmasqDirectoryListedSource(DirectoryListedSource):
462468
source_url = "https://thekelleys.org.uk/dnsmasq/"
469+
# Source archive ex: dnsmasq-1.2.3.tar.gz
463470
source_archive_regex = re.compile(
464471
r"^(dnsmasq-)(?P<version>[\w.-]*)(.tar.xz|.tar.gz)$"
465472
)
@@ -469,13 +476,15 @@ class DnsmasqDirectoryListedSource(DirectoryListedSource):
469476

470477
class EbtablesDirectoryListedSource(DirectoryListedSource):
471478
source_url = "https://www.netfilter.org/pub/ebtables/"
479+
# Source archive ex: ebtables-1.2.3.tar.gz
472480
source_archive_regex = re.compile(r"^(ebtables-)(?P<version>[\w.-]*)(.tar.gz)$")
473481
is_nested = False
474482
ignored_files_and_dir = []
475483

476484

477485
class HostapdDirectoryListedSource(DirectoryListedSource):
478486
source_url = "https://w1.fi/releases/"
487+
# Source archive ex: hostapd-1.2.3.tar.gz
479488
source_archive_regex = re.compile(r"^(hostapd-)(?P<version>[\w.-]*)(.tar.gz)$")
480489
is_nested = False
481490
ignored_files_and_dir = []
@@ -484,6 +493,7 @@ class HostapdDirectoryListedSource(DirectoryListedSource):
484493
class Iproute2DirectoryListedSource(DirectoryListedSource):
485494
source_url = "https://mirrors.edge.kernel.org/pub/linux/utils/net/iproute2/"
486495
source_archive_regex = re.compile(
496+
# Source archive ex: iproute2-1.2.3.tar.gz
487497
r"^(iproute2-)(?P<version>[\w.-]*)(.tar.xz|.tar.gz)$"
488498
)
489499
is_nested = False
@@ -492,27 +502,31 @@ class Iproute2DirectoryListedSource(DirectoryListedSource):
492502

493503
class IptablesDirectoryListedSource(DirectoryListedSource):
494504
source_url = "https://www.netfilter.org/pub/iptables/"
505+
# Source archive ex: iptables-1.2.3.tar.bz2
495506
source_archive_regex = re.compile(r"^(iptables-)(?P<version>[\w.-]*)(.tar.bz2)$")
496507
is_nested = False
497508
ignored_files_and_dir = []
498509

499510

500511
class LibnlDirectoryListedSource(DirectoryListedSource):
501512
source_url = "https://www.infradead.org/~tgr/libnl/files/"
513+
# Source archive ex: libnl-1.2.3.tar.gz
502514
source_archive_regex = re.compile(r"^(libnl-)(?P<version>[\w.-]*)(.tar.gz)$")
503515
is_nested = False
504516
ignored_files_and_dir = []
505517

506518

507519
class LighttpdDirectoryListedSource(DirectoryListedSource):
508520
source_url = "https://download.lighttpd.net/lighttpd/releases-1.4.x/"
521+
# Source archive ex: lighttpd-1.2.3.tar.gz
509522
source_archive_regex = re.compile(r"^(lighttpd-)(?P<version>[\w.-]*)(.tar.gz)$")
510523
is_nested = False
511524
ignored_files_and_dir = []
512525

513526

514527
class NftablesDirectoryListedSource(DirectoryListedSource):
515528
source_url = "https://www.netfilter.org/pub/nftables/"
529+
# Source archive ex: nftables-1.2.3.tar.bz2
516530
source_archive_regex = re.compile(
517531
r"^(nftables-)(?P<version>[\w.-]*)(.tar.xz|.tar.bz2)$"
518532
)
@@ -522,6 +536,7 @@ class NftablesDirectoryListedSource(DirectoryListedSource):
522536

523537
class WpaSupplicantDirectoryListedSource(DirectoryListedSource):
524538
source_url = "https://w1.fi/releases/"
539+
# Source archive ex: wpa_supplicant-1.2.3.tar.gz
525540
source_archive_regex = re.compile(
526541
r"^(wpa_supplicant-)(?P<version>[\w.-]*)(.tar.gz)$"
527542
)
@@ -531,20 +546,23 @@ class WpaSupplicantDirectoryListedSource(DirectoryListedSource):
531546

532547
class SyslinuxDirectoryListedSource(DirectoryListedSource):
533548
source_url = "https://mirrors.edge.kernel.org/pub/linux/utils/boot/syslinux/"
549+
# Source archive ex: syslinux-1.2.3.tar.gz
534550
source_archive_regex = re.compile(r"^(syslinux-)(?P<version>[\w.-]*)(.tar.gz)$")
535551
is_nested = False
536552
ignored_files_and_dir = []
537553

538554

539555
class SyslinuxDirectoryListedSource(DirectoryListedSource):
540556
source_url = "https://mirrors.edge.kernel.org/pub/linux/utils/boot/syslinux/"
557+
# Source archive ex: syslinux-1.2.3.tar.gz
541558
source_archive_regex = re.compile(r"^(syslinux-)(?P<version>[\w.-]*)(.tar.gz)$")
542559
is_nested = False
543560
ignored_files_and_dir = []
544561

545562

546563
class ToyboxDirectoryListedSource(DirectoryListedSource):
547564
source_url = "http://www.landley.net/toybox/downloads/"
565+
# Source archive ex: toybox-1.2.3.tar.gz
548566
source_archive_regex = re.compile(
549567
r"^(toybox-)(?P<version>[\w.-]*)(.tar.gz|.tar.bz2)$"
550568
)
@@ -554,6 +572,7 @@ class ToyboxDirectoryListedSource(DirectoryListedSource):
554572

555573
class DropbearDirectoryListedSource(DirectoryListedSource):
556574
source_url = "https://matt.ucc.asn.au/dropbear/releases/"
575+
# Source archive ex: dropbear-1.2.3.tar.bz2
557576
source_archive_regex = re.compile(
558577
r"^(dropbear-)(?P<version>[\w.-]*)(.tar.bz2|_i386.deb)$"
559578
)
@@ -572,26 +591,30 @@ class DropbearDirectoryListedSource(DirectoryListedSource):
572591

573592
class SambaDirectoryListedSource(DirectoryListedSource):
574593
source_url = "https://download.samba.org/pub/samba/stable/"
594+
# Source archive ex: samba-1.2.3.tar.gz
575595
source_archive_regex = re.compile(r"^(samba-)(?P<version>[\w.-]*)(.tar.gz)$")
576596
is_nested = False
577597
ignored_files_and_dir = []
578598

579599

580600
class MtdUtilsDirectoryListedSource(DirectoryListedSource):
581601
source_url = "https://infraroot.at/pub/mtd/"
602+
# Source archive ex: mtd-utils-1.2.3.tar.bz2
582603
source_archive_regex = re.compile(r"^(mtd-utils-)(?P<version>[\w.-]*)(.tar.bz2)$")
583604
is_nested = False
584605
ignored_files_and_dir = []
585606

586607

587608
class BareboxDirectoryListedSource(DirectoryListedSource):
588609
source_url = "https://www.barebox.org/download/"
610+
# Source archive ex: barebox-1.2.3.tar.bz2
589611
source_archive_regex = re.compile(r"^(barebox-)(?P<version>[\w.-]*)(.tar.bz2)$")
590612
is_nested = False
591613
ignored_files_and_dir = []
592614

593615
class LinuxDirectoryListedSource(DirectoryListedSource):
594616
source_url = "https://cdn.kernel.org/pub/linux/kernel/"
617+
# Source archive ex: linux-1.2.3.tar.gz
595618
source_archive_regex = re.compile(r"^(linux-)(?P<version>[\w.-]*)(.tar.gz)$")
596619
is_nested = True
597620
ignored_files_and_dir = [
@@ -610,6 +633,7 @@ class LinuxDirectoryListedSource(DirectoryListedSource):
610633

611634
class E2fsprogsDirectoryListedSource(DirectoryListedSource):
612635
source_url = "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/"
636+
# Source archive ex: e2fsprogs-1.2.3.tar.gz
613637
source_archive_regex = re.compile(r"^(e2fsprogs-)(?P<version>[\w.-]*)(.tar.gz)$")
614638
is_nested = True
615639
ignored_files_and_dir = ["testing/"]

0 commit comments

Comments
 (0)